#pragma clang diagnostic ignored "-Wmissing-prototypes"

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

using namespace metal;

#if defined(__has_builtin)
#if !defined(SPV_ASSUME) && __has_builtin(__builtin_assume)
#define SPV_ASSUME(x) __builtin_assume(x);
#endif
#if !defined(SPV_EXPECT) && __has_builtin(__builtin_expect)
#define SPV_EXPECT(x, y) __builtin_expect(x, y);
#endif
#endif
#ifndef SPV_ASSUME
#define SPV_ASSUME(x)
#endif
#ifndef SPV_EXPECT
#define SPV_EXPECT(x, y) x
#endif
struct buffer_t
{
    uint z;
};

constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(32u, 1u, 1u);

kernel void main0(device buffer_t& buf [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]])
{
    SPV_ASSUME(gl_WorkGroupID.x < 32u)
    buf.z = SPV_EXPECT(gl_WorkGroupID.z, 0u);
}

