#include <metal_stdlib>

using namespace metal;

struct frexp_result_vec2 {
  float2 fract;
  int2 exp;
};
frexp_result_vec2 tint_frexp(float2 param_0) {
  frexp_result_vec2 result;
  result.fract = frexp(param_0, result.exp);
  return result;
}

void frexp_eb2421() {
  frexp_result_vec2 res = tint_frexp(float2(1.0f));
}

struct tint_symbol {
  float4 value [[position]];
};

float4 vertex_main_inner() {
  frexp_eb2421();
  return float4(0.0f);
}

vertex tint_symbol vertex_main() {
  float4 const inner_result = vertex_main_inner();
  tint_symbol wrapper_result = {};
  wrapper_result.value = inner_result;
  return wrapper_result;
}

fragment void fragment_main() {
  frexp_eb2421();
  return;
}

kernel void compute_main() {
  frexp_eb2421();
  return;
}

