// language: metal1.0
#include <metal_stdlib>
#include <simd/simd.h>

using metal::uint;

struct _modf_result_f32_ {
    float fract;
    float whole;
};
struct _modf_result_vec2_f32_ {
    metal::float2 fract;
    metal::float2 whole;
};
struct _modf_result_vec4_f32_ {
    metal::float4 fract;
    metal::float4 whole;
};
struct _frexp_result_f32_ {
    float fract;
    int exp;
};
struct _frexp_result_vec4_f32_ {
    metal::float4 fract;
    metal::int4 exp;
};

_modf_result_f32_ naga_modf(float arg) {
    float other;
    float fract = metal::modf(arg, other);
    return _modf_result_f32_{ fract, other };
}

_modf_result_vec2_f32_ naga_modf(metal::float2 arg) {
    metal::float2 other;
    metal::float2 fract = metal::modf(arg, other);
    return _modf_result_vec2_f32_{ fract, other };
}

_modf_result_vec4_f32_ naga_modf(metal::float4 arg) {
    metal::float4 other;
    metal::float4 fract = metal::modf(arg, other);
    return _modf_result_vec4_f32_{ fract, other };
}

_frexp_result_f32_ naga_frexp(float arg) {
    int other;
    float fract = metal::frexp(arg, other);
    return _frexp_result_f32_{ fract, other };
}

_frexp_result_vec4_f32_ naga_frexp(metal::float4 arg) {
    int4 other;
    metal::float4 fract = metal::frexp(arg, other);
    return _frexp_result_vec4_f32_{ fract, other };
}

fragment void main_(
) {
    metal::float4 v = metal::float4(0.0);
    float a = ((1.0) * 57.295779513082322865);
    float b = ((1.0) * 0.017453292519943295474);
    metal::float4 c = ((v) * 57.295779513082322865);
    metal::float4 d = ((v) * 0.017453292519943295474);
    metal::float4 e = metal::saturate(v);
    metal::float4 g = metal::refract(v, v, 1.0);
    metal::int4 sign_b = metal::int4(-1, -1, -1, -1);
    metal::float4 sign_d = metal::float4(-1.0, -1.0, -1.0, -1.0);
    int const_dot = ( + metal::int2 {}.x * metal::int2 {}.x + metal::int2 {}.y * metal::int2 {}.y);
    metal::int2 flb_b = metal::int2(-1, -1);
    metal::uint2 flb_c = metal::uint2(0u, 0u);
    metal::int2 ftb_c = metal::int2(0, 0);
    metal::uint2 ftb_d = metal::uint2(0u, 0u);
    metal::uint2 ctz_e = metal::uint2(32u, 32u);
    metal::int2 ctz_f = metal::int2(32, 32);
    metal::uint2 ctz_g = metal::uint2(0u, 0u);
    metal::int2 ctz_h = metal::int2(0, 0);
    metal::int2 clz_c = metal::int2(0, 0);
    metal::uint2 clz_d = metal::uint2(31u, 31u);
    float lde_a = metal::ldexp(1.0, 2);
    metal::float2 lde_b = metal::ldexp(metal::float2(1.0, 2.0), metal::int2(3, 4));
    _modf_result_f32_ modf_a = naga_modf(1.5);
    float modf_b = naga_modf(1.5).fract;
    float modf_c = naga_modf(1.5).whole;
    _modf_result_vec2_f32_ modf_d = naga_modf(metal::float2(1.5, 1.5));
    float modf_e = naga_modf(metal::float4(1.5, 1.5, 1.5, 1.5)).whole.x;
    float modf_f = naga_modf(metal::float2(1.5, 1.5)).fract.y;
    _frexp_result_f32_ frexp_a = naga_frexp(1.5);
    float frexp_b = naga_frexp(1.5).fract;
    int frexp_c = naga_frexp(1.5).exp;
    int frexp_d = naga_frexp(metal::float4(1.5, 1.5, 1.5, 1.5)).exp.x;
    float quantizeToF16_a = float(half(1.0));
    metal::float2 quantizeToF16_b = metal::float2(metal::half2(metal::float2(1.0, 1.0)));
    metal::float3 quantizeToF16_c = metal::float3(metal::half3(metal::float3(1.0, 1.0, 1.0)));
    metal::float4 quantizeToF16_d = metal::float4(metal::half4(metal::float4(1.0, 1.0, 1.0, 1.0)));
    return;
}
