#include <metal_stdlib>

using namespace metal;

template<typename T, size_t N>
struct tint_array {
    const constant T& operator[](size_t i) const constant { return elements[i]; }
    device T& operator[](size_t i) device { return elements[i]; }
    const device T& operator[](size_t i) const device { return elements[i]; }
    thread T& operator[](size_t i) thread { return elements[i]; }
    const thread T& operator[](size_t i) const thread { return elements[i]; }
    threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
    const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
    T elements[N];
};

struct tint_packed_vec3_f32_array_element {
  /* 0x0000 */ packed_float3 elements;
  /* 0x000c */ tint_array<int8_t, 4> tint_pad;
};

struct S_tint_packed_vec3 {
  /* 0x0000 */ tint_array<tint_packed_vec3_f32_array_element, 3> tint_symbol;
  /* 0x0030 */ packed_float3 vector;
  /* 0x003c */ tint_array<int8_t, 4> tint_pad_1;
};

float3x3 tint_unpack_vec3_in_composite(tint_array<tint_packed_vec3_f32_array_element, 3> in) {
  float3x3 result = float3x3(float3(in[0].elements), float3(in[1].elements), float3(in[2].elements));
  return result;
}

struct S {
  float3x3 tint_symbol;
  float3 vector;
};

fragment void tint_symbol_1(const constant S_tint_packed_vec3* tint_symbol_2 [[buffer(0)]]) {
  float3 const x = (float3((*(tint_symbol_2)).vector) * tint_unpack_vec3_in_composite((*(tint_symbol_2)).tint_symbol));
  return;
}

