#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"

#include <metal_stdlib>
#include <simd/simd.h>

using namespace metal;

template<typename T, size_t Num>
struct spvUnsafeArray
{
    T elements[Num ? Num : 1];
    
    thread T& operator [] (size_t pos) thread
    {
        return elements[pos];
    }
    constexpr const thread T& operator [] (size_t pos) const thread
    {
        return elements[pos];
    }
    
    device T& operator [] (size_t pos) device
    {
        return elements[pos];
    }
    constexpr const device T& operator [] (size_t pos) const device
    {
        return elements[pos];
    }
    
    constexpr const constant T& operator [] (size_t pos) const constant
    {
        return elements[pos];
    }
    
    threadgroup T& operator [] (size_t pos) threadgroup
    {
        return elements[pos];
    }
    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
    {
        return elements[pos];
    }
};

constant float spec_const_tmp [[function_constant(0)]];
constant float spec_const = is_function_constant_defined(spec_const_tmp) ? spec_const_tmp : 0.0;
constant float4 _20 = float4(spec_const);

struct UBO
{
    float uniform_float;
};

constant spvUnsafeArray<float, 8> _26 = spvUnsafeArray<float, 8>({ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 });

kernel void main0(constant UBO& ubo [[buffer(0)]])
{
    float4 a = float4(0.0);
    float4x4 b = float4x4(float4(1.0), float4(1.0), float4(1.0), float4(1.0));
    float4 c = _20;
    float4 d = float4(ubo.uniform_float);
    float4x4 e = float4x4(d, d, d, d);
    spvUnsafeArray<float, 8> f = {ubo.uniform_float, ubo.uniform_float, ubo.uniform_float, ubo.uniform_float, ubo.uniform_float, ubo.uniform_float, ubo.uniform_float, ubo.uniform_float};
}

