#include <metal_stdlib>

using namespace metal;

struct frexp_result_vec4_f16 {
  half4 fract;
  int4 exp;
};
frexp_result_vec4_f16 tint_frexp(half4 param_0) {
  frexp_result_vec4_f16 result;
  result.fract = frexp(param_0, result.exp);
  return result;
}

void frexp_3dd21e() {
  half4 arg_0 = half4(1.0h);
  frexp_result_vec4_f16 res = tint_frexp(arg_0);
}

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

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

struct VertexOutput {
  float4 pos;
};

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

VertexOutput vertex_main_inner() {
  VertexOutput out = {};
  out.pos = float4(0.0f);
  frexp_3dd21e();
  return out;
}

vertex tint_symbol vertex_main() {
  VertexOutput const inner_result = vertex_main_inner();
  tint_symbol wrapper_result = {};
  wrapper_result.pos = inner_result.pos;
  return wrapper_result;
}

