#include <metal_stdlib>

using namespace metal;

struct frexp_result_vec4_f16 {
  half4 fract;
  int4 exp;
};
void frexp_3dd21e() {
  frexp_result_vec4_f16 res = frexp_result_vec4_f16{.fract=half4(0.5h), .exp=int4(1)};
}

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;
}

