
RWByteAddressBuffer ssbo : register(u0);
void v_1(uint offset, float2x2 obj) {
  ssbo.Store2((offset + 0u), asuint(obj[0u]));
  ssbo.Store2((offset + 8u), asuint(obj[1u]));
}

float2x2 v_2(uint offset) {
  float2 v_3 = asfloat(ssbo.Load2((offset + 0u)));
  return float2x2(v_3, asfloat(ssbo.Load2((offset + 8u))));
}

[numthreads(1, 1, 1)]
void f() {
  float2x2 v = v_2(0u);
  v_1(0u, v);
}

