#include <metal_stdlib>
using namespace metal;

struct modf_result_vec4_f32 {
  float4 fract;
  float4 whole;
};

struct VertexOutput {
  float4 pos;
};

struct vertex_main_outputs {
  float4 VertexOutput_pos [[position]];
};

void modf_4bfced() {
  modf_result_vec4_f32 res = modf_result_vec4_f32{.fract=float4(-0.5f), .whole=float4(-1.0f)};
}

fragment void fragment_main() {
  modf_4bfced();
}

kernel void compute_main() {
  modf_4bfced();
}

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

vertex vertex_main_outputs vertex_main() {
  vertex_main_outputs tint_wrapper_result = {};
  tint_wrapper_result.VertexOutput_pos = vertex_main_inner().pos;
  return tint_wrapper_result;
}
