test: Generate expected output for all tests

The expected output is far from perfect, and the generated HLSL and MSL
isn't even validated yet, so may be incorrect.

However, by committing the generated output, we get clear examples of
the currently generated output of each backend. As we land fixes and
improvements to each backend, the presubmits will require us to update
the expected test output, and so code reviews will include diffs of
each backend's generated output.

Change-Id: I5c2a9e5b796d0ab75b3ec4c7f8ad00a0a2ab166f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51224
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
diff --git a/test/bug/tint/749.spvasm.expected.wgsl b/test/bug/tint/749.spvasm.expected.wgsl
new file mode 100644
index 0000000..17ceb49
--- /dev/null
+++ b/test/bug/tint/749.spvasm.expected.wgsl
@@ -0,0 +1,1494 @@
+struct QuicksortObject {
+  numbers : array<i32, 10>;
+};
+
+[[block]]
+struct buf0 {
+  resolution : vec2<f32>;
+};
+
+var<private> obj : QuicksortObject;
+
+[[builtin(position)]] var<in> gl_FragCoord : vec4<f32>;
+
+[[group(0), binding(0)]] var<uniform> x_188 : buf0;
+
+[[location(0)]] var<out> x_GLF_color : vec4<f32>;
+
+fn swap_i1_i1_(i : ptr<function, i32>, j : ptr<function, i32>) {
+  var temp : i32;
+  let x_932 : i32 = temp;
+  temp = 0;
+  temp = x_932;
+  let x_523 : vec3<f32> = vec3<f32>(vec3<f32>(1.0, 2.0, 3.0).z, vec3<f32>(1.0, 2.0, 3.0).y, vec3<f32>(1.0, 2.0, 3.0).z);
+  let x_933 : i32 = i;
+  i = 0;
+  i = x_933;
+  let x_28 : i32 = i;
+  let x_934 : i32 = j;
+  j = 0;
+  j = x_934;
+  let x_524 : vec3<f32> = vec3<f32>(x_523.y, x_523.x, x_523.y);
+  let x_935 : i32 = temp;
+  temp = 0;
+  temp = x_935;
+  let x_30 : ptr<private, i32> = obj.numbers[x_28];
+  let x_936 : i32 = x_30;
+  x_30 = 0;
+  x_30 = x_936;
+  let x_31 : i32 = x_30;
+  let x_937 : i32 = temp;
+  temp = 0;
+  temp = x_937;
+  temp = x_31;
+  let x_938 : i32 = j;
+  j = 0;
+  j = x_938;
+  let x_525 : vec3<f32> = vec3<f32>(x_523.z, vec3<f32>(1.0, 2.0, 3.0).x, x_523.y);
+  let x_939 : i32 = i;
+  i = 0;
+  i = x_939;
+  let x_32 : i32 = i;
+  let x_940 : i32 = x_30;
+  x_30 = 0;
+  x_30 = x_940;
+  let x_33 : i32 = j;
+  let x_941 : i32 = i;
+  i = 0;
+  i = x_941;
+  let x_526 : vec3<f32> = vec3<f32>(x_525.x, x_525.z, x_525.z);
+  let x_942 : i32 = x_30;
+  x_30 = 0;
+  x_30 = x_942;
+  let x_34 : ptr<private, i32> = obj.numbers[x_33];
+  let x_35 : i32 = x_34;
+  let x_943 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_943;
+  let x_527 : vec2<f32> = vec2<f32>(x_526.x, x_526.x);
+  let x_36 : ptr<private, i32> = obj.numbers[x_32];
+  let x_528 : vec3<f32> = vec3<f32>(x_524.x, x_524.z, x_524.x);
+  x_36 = x_35;
+  let x_944 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_944;
+  let x_529 : vec3<f32> = vec3<f32>(x_526.y, x_526.z, x_526.x);
+  let x_945 : i32 = i;
+  i = 0;
+  i = x_945;
+  let x_37 : i32 = j;
+  let x_946 : i32 = temp;
+  temp = 0;
+  temp = x_946;
+  let x_530 : vec2<f32> = vec2<f32>(x_529.z, x_529.y);
+  let x_947 : i32 = x_34;
+  x_34 = 0;
+  x_34 = x_947;
+  let x_38 : i32 = temp;
+  let x_948 : i32 = j;
+  j = 0;
+  j = x_948;
+  let x_531 : vec3<f32> = vec3<f32>(x_527.x, x_526.y, x_526.x);
+  let x_949 : i32 = x_36;
+  x_36 = 0;
+  x_36 = x_949;
+  let x_950 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_950;
+  let x_532 : vec3<f32> = vec3<f32>(x_528.x, x_528.y, x_528.x);
+  let x_951 : i32 = x_34;
+  x_34 = 0;
+  x_34 = x_951;
+  obj.numbers[x_37] = x_38;
+  return;
+}
+
+fn performPartition_i1_i1_(l : ptr<function, i32>, h : ptr<function, i32>) -> i32 {
+  var param_3 : i32;
+  var i_1 : i32;
+  var j_1 : i32;
+  var param_2 : i32;
+  var param_1 : i32;
+  var param : i32;
+  var pivot : i32;
+  var x_537 : vec2<f32>;
+  var x_538 : vec3<f32>;
+  let x_952 : i32 = h;
+  h = 0;
+  h = x_952;
+  let x_41 : i32 = h;
+  let x_953 : i32 = l;
+  l = 0;
+  l = x_953;
+  let x_42 : ptr<private, i32> = obj.numbers[x_41];
+  let x_954 : i32 = x_42;
+  x_42 = 0;
+  x_42 = x_954;
+  let x_43 : i32 = x_42;
+  let x_955 : i32 = param_3;
+  param_3 = 0;
+  param_3 = x_955;
+  let x_534 : vec3<f32> = vec3<f32>(vec3<f32>(1.0, 2.0, 3.0).z, vec3<f32>(1.0, 2.0, 3.0).x, vec3<f32>(1.0, 2.0, 3.0).z);
+  let x_956 : i32 = param_1;
+  param_1 = 0;
+  param_1 = x_956;
+  pivot = x_43;
+  let x_45 : i32 = l;
+  let x_957 : i32 = h;
+  h = 0;
+  h = x_957;
+  let x_958 : i32 = j_1;
+  j_1 = 0;
+  j_1 = x_958;
+  let x_535 : vec3<f32> = vec3<f32>(x_534.y, x_534.z, x_534.y);
+  let x_959 : i32 = l;
+  l = 0;
+  l = x_959;
+  i_1 = (x_45 - bitcast<i32>(1u));
+  let x_49 : i32 = l;
+  let x_536 : vec3<f32> = vec3<f32>(x_534.x, x_534.z, x_535.x);
+  j_1 = 10;
+  let x_960 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_960;
+  loop {
+    let x_961 : i32 = pivot;
+    pivot = 0;
+    pivot = x_961;
+    let x_962 : i32 = param_1;
+    param_1 = 0;
+    param_1 = x_962;
+    let x_55 : i32 = j_1;
+    let x_963 : i32 = pivot;
+    pivot = 0;
+    pivot = x_963;
+    x_537 = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).y, vec3<f32>(1.0, 2.0, 3.0).z);
+    let x_964 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_964;
+    let x_56 : i32 = h;
+    let x_965 : i32 = h;
+    h = 0;
+    h = x_965;
+    let x_966 : i32 = param;
+    param = 0;
+    param = x_966;
+    let x_967 : i32 = j_1;
+    j_1 = 0;
+    j_1 = x_967;
+    x_538 = vec3<f32>(x_534.x, x_537.y, x_534.z);
+    let x_968 : i32 = param;
+    param = 0;
+    param = x_968;
+    if ((x_55 <= (x_56 - bitcast<i32>(1u)))) {
+    } else {
+      break;
+    }
+    let x_60 : i32 = j_1;
+    let x_969 : i32 = x_42;
+    x_42 = 0;
+    x_42 = x_969;
+    let x_61 : ptr<private, i32> = obj.numbers[x_60];
+    let x_970 : i32 = h;
+    h = 0;
+    h = x_970;
+    let x_539 : vec3<f32> = vec3<f32>(x_537.x, x_535.z, x_537.x);
+    let x_971 : i32 = param_1;
+    param_1 = 0;
+    param_1 = x_971;
+    let x_62 : i32 = x_61;
+    let x_972 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_972;
+    let x_63 : i32 = pivot;
+    let x_540 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).y, x_534.z);
+    let x_973 : i32 = i_1;
+    i_1 = 0;
+    i_1 = x_973;
+    let x_974 : i32 = l;
+    l = 0;
+    l = x_974;
+    let x_541 : vec3<f32> = vec3<f32>(x_534.y, x_534.x, x_534.y);
+    let x_975 : i32 = pivot;
+    pivot = 0;
+    pivot = x_975;
+    if ((x_62 <= x_63)) {
+      let x_542 : vec3<f32> = vec3<f32>(x_541.z, x_541.x, x_541.x);
+      let x_976 : i32 = param_3;
+      param_3 = 0;
+      param_3 = x_976;
+      let x_67 : i32 = i_1;
+      let x_977 : i32 = pivot;
+      pivot = 0;
+      pivot = x_977;
+      let x_543 : vec2<f32> = vec2<f32>(x_539.x, x_541.y);
+      let x_978 : i32 = i_1;
+      i_1 = 0;
+      i_1 = x_978;
+      let x_979 : i32 = param;
+      param = 0;
+      param = x_979;
+      i_1 = (x_67 + bitcast<i32>(1u));
+      let x_980 : i32 = l;
+      l = 0;
+      l = x_980;
+      let x_544 : vec3<f32> = vec3<f32>(vec3<f32>(1.0, 2.0, 3.0).z, vec3<f32>(1.0, 2.0, 3.0).y, x_540.x);
+      let x_70 : i32 = i_1;
+      let x_545 : vec2<f32> = vec2<f32>(x_537.y, x_538.x);
+      let x_981 : i32 = param;
+      param = 0;
+      param = x_981;
+      param = x_70;
+      let x_982 : i32 = param;
+      param = 0;
+      param = x_982;
+      let x_546 : vec2<f32> = vec2<f32>(x_545.x, x_545.x);
+      let x_983 : i32 = i_1;
+      i_1 = 0;
+      i_1 = x_983;
+      let x_72 : i32 = j_1;
+      param_1 = x_72;
+      let x_984 : i32 = param_3;
+      param_3 = 0;
+      param_3 = x_984;
+      swap_i1_i1_(param, param_1);
+      let x_985 : i32 = param_1;
+      param_1 = 0;
+      param_1 = x_985;
+    }
+    let x_986 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_986;
+
+    continuing {
+      let x_987 : i32 = h;
+      h = 0;
+      h = x_987;
+      let x_74 : i32 = j_1;
+      let x_988 : i32 = h;
+      h = 0;
+      h = x_988;
+      let x_547 : vec3<f32> = vec3<f32>(x_539.x, x_541.z, x_541.z);
+      let x_989 : i32 = x_61;
+      x_61 = 0;
+      x_61 = x_989;
+      let x_990 : i32 = param;
+      param = 0;
+      param = x_990;
+      j_1 = (1 + x_74);
+      let x_991 : i32 = param_1;
+      param_1 = 0;
+      param_1 = x_991;
+      let x_548 : vec3<f32> = vec3<f32>(x_541.y, x_541.z, x_541.x);
+      let x_992 : i32 = x_61;
+      x_61 = 0;
+      x_61 = x_992;
+    }
+  }
+  let x_76 : i32 = i_1;
+  let x_993 : i32 = x_42;
+  x_42 = 0;
+  x_42 = x_993;
+  let x_549 : vec2<f32> = vec2<f32>(x_534.x, x_534.y);
+  let x_994 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_994;
+  let x_995 : i32 = h;
+  h = 0;
+  h = x_995;
+  i_1 = (1 + x_76);
+  let x_996 : i32 = param_1;
+  param_1 = 0;
+  param_1 = x_996;
+  let x_79 : i32 = i_1;
+  let x_997 : i32 = j_1;
+  j_1 = 0;
+  j_1 = x_997;
+  let x_550 : vec2<f32> = vec2<f32>(x_534.x, x_534.x);
+  let x_998 : i32 = param_1;
+  param_1 = 0;
+  param_1 = x_998;
+  param_2 = x_79;
+  let x_551 : vec2<f32> = vec2<f32>(x_534.y, x_536.x);
+  let x_999 : i32 = pivot;
+  pivot = 0;
+  pivot = x_999;
+  let x_81 : i32 = h;
+  let x_552 : vec2<f32> = vec2<f32>(x_550.x, x_549.y);
+  let x_1000 : i32 = h;
+  h = 0;
+  h = x_1000;
+  param_3 = x_81;
+  let x_1001 : i32 = i_1;
+  i_1 = 0;
+  i_1 = x_1001;
+  let x_553 : vec2<f32> = vec2<f32>(x_549.y, x_552.x);
+  let x_1002 : i32 = h;
+  h = 0;
+  h = x_1002;
+  swap_i1_i1_(param_2, param_3);
+  let x_1003 : i32 = l;
+  l = 0;
+  l = x_1003;
+  let x_554 : vec2<f32> = vec2<f32>(x_536.z, vec3<f32>(1.0, 2.0, 3.0).y);
+  let x_1004 : i32 = param_1;
+  param_1 = 0;
+  param_1 = x_1004;
+  let x_83 : i32 = i_1;
+  let x_1005 : i32 = param;
+  param = 0;
+  param = x_1005;
+  let x_555 : vec2<f32> = vec2<f32>(x_534.y, x_534.x);
+  let x_1006 : i32 = j_1;
+  j_1 = 0;
+  j_1 = x_1006;
+  return x_83;
+}
+
+fn quicksort_() {
+  var param_4 : i32;
+  var h_1 : i32;
+  var p : i32;
+  var l_1 : i32;
+  var top : i32;
+  var stack : array<i32, 10>;
+  var param_5 : i32;
+  l_1 = 0;
+  let x_1007 : i32 = param_5;
+  param_5 = 0;
+  param_5 = x_1007;
+  h_1 = 9;
+  let x_1008 : array<i32, 10> = stack;
+  stack = array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+  stack = x_1008;
+  let x_556 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).y, vec3<f32>(1.0, 2.0, 3.0).y);
+  let x_1009 : i32 = param_5;
+  param_5 = 0;
+  param_5 = x_1009;
+  top = -1;
+  let x_1010 : i32 = p;
+  p = 0;
+  p = x_1010;
+  let x_93 : i32 = top;
+  let x_557 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).x, vec3<f32>(1.0, 2.0, 3.0).x);
+  let x_1011 : i32 = p;
+  p = 0;
+  p = x_1011;
+  let x_94 : i32 = (x_93 + bitcast<i32>(1u));
+  let x_1012 : i32 = top;
+  top = 0;
+  top = x_1012;
+  let x_558 : vec2<f32> = vec2<f32>(x_556.y, x_557.y);
+  let x_1013 : i32 = param_4;
+  param_4 = 0;
+  param_4 = x_1013;
+  top = x_94;
+  let x_1014 : i32 = h_1;
+  h_1 = 0;
+  h_1 = x_1014;
+  let x_559 : vec3<f32> = vec3<f32>(x_557.y, x_557.x, x_557.x);
+  let x_1015 : i32 = param_4;
+  param_4 = 0;
+  param_4 = x_1015;
+  let x_95 : i32 = l_1;
+  let x_1016 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_1016;
+  let x_560 : vec3<f32> = vec3<f32>(x_559.y, x_559.x, x_557.x);
+  let x_96 : ptr<function, i32> = stack[x_94];
+  let x_1017 : array<i32, 10> = stack;
+  stack = array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+  stack = x_1017;
+  let x_561 : vec3<f32> = vec3<f32>(x_556.y, x_556.y, x_556.y);
+  let x_1018 : i32 = l_1;
+  l_1 = 0;
+  l_1 = 0;
+  x_96 = x_95;
+  let x_1019 : i32 = param_5;
+  param_5 = 0;
+  param_5 = x_1019;
+  let x_97 : i32 = top;
+  let x_1020 : i32 = param_4;
+  param_4 = 0;
+  param_4 = x_1020;
+  let x_562 : vec3<f32> = vec3<f32>(vec3<f32>(1.0, 2.0, 3.0).z, x_558.y, vec3<f32>(1.0, 2.0, 3.0).y);
+  let x_1021 : i32 = x_96;
+  x_96 = 0;
+  x_96 = x_1021;
+  let x_98 : i32 = (x_97 + 1);
+  let x_1022 : i32 = x_96;
+  x_96 = 0;
+  x_96 = x_1022;
+  let x_563 : vec3<f32> = vec3<f32>(x_559.x, x_559.z, x_556.y);
+  top = x_98;
+  let x_1023 : i32 = param_4;
+  param_4 = 0;
+  param_4 = x_1023;
+  let x_99 : i32 = h_1;
+  let x_1024 : i32 = param_4;
+  param_4 = 0;
+  param_4 = x_1024;
+  let x_564 : vec3<f32> = vec3<f32>(x_558.x, x_561.x, x_558.y);
+  let x_1025 : i32 = l_1;
+  l_1 = 0;
+  l_1 = x_1025;
+  let x_100 : ptr<function, i32> = stack[x_98];
+  let x_1026 : i32 = param_5;
+  param_5 = 0;
+  param_5 = x_1026;
+  let x_565 : vec2<f32> = vec2<f32>(x_564.z, x_564.z);
+  let x_1027 : i32 = p;
+  p = 0;
+  p = x_1027;
+  x_100 = x_99;
+  loop {
+    let x_566 : vec3<f32> = vec3<f32>(x_563.x, x_563.x, x_563.x);
+    let x_1028 : i32 = h_1;
+    h_1 = 0;
+    h_1 = x_1028;
+    let x_1029 : array<i32, 10> = stack;
+    stack = array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    stack = x_1029;
+    let x_106 : i32 = top;
+    let x_1030 : array<i32, 10> = stack;
+    stack = array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    stack = x_1030;
+    let x_567 : vec2<f32> = vec2<f32>(x_558.x, x_564.z);
+    let x_1031 : i32 = param_4;
+    param_4 = 0;
+    param_4 = x_1031;
+    if ((x_106 >= bitcast<i32>(0u))) {
+    } else {
+      break;
+    }
+    let x_1032 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_1032;
+    let x_568 : vec3<f32> = vec3<f32>(x_559.y, x_559.x, x_563.y);
+    let x_1033 : i32 = param_4;
+    param_4 = 0;
+    param_4 = x_1033;
+    let x_108 : i32 = top;
+    let x_569 : vec3<f32> = vec3<f32>(x_565.x, x_567.y, x_565.x);
+    let x_1034 : i32 = h_1;
+    h_1 = 0;
+    h_1 = x_1034;
+    let x_570 : vec2<f32> = vec2<f32>(x_556.x, x_556.x);
+    let x_1035 : i32 = p;
+    p = 0;
+    p = x_1035;
+    top = (x_108 - bitcast<i32>(1u));
+    let x_1036 : i32 = p;
+    p = 0;
+    p = x_1036;
+    let x_110 : ptr<function, i32> = stack[x_108];
+    let x_1037 : i32 = x_96;
+    x_96 = 0;
+    x_96 = x_1037;
+    let x_111 : i32 = x_110;
+    let x_1038 : array<i32, 10> = stack;
+    stack = array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    stack = x_1038;
+    let x_571 : vec3<f32> = vec3<f32>(x_559.y, x_559.x, x_564.y);
+    let x_1039 : i32 = l_1;
+    l_1 = 0;
+    l_1 = x_1039;
+    h_1 = x_111;
+    let x_1040 : array<i32, 10> = stack;
+    stack = array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    stack = x_1040;
+    let x_572 : vec2<f32> = vec2<f32>(x_562.y, x_561.y);
+    let x_1041 : i32 = p;
+    p = 0;
+    p = x_1041;
+    let x_112 : i32 = top;
+    let x_1042 : i32 = param_4;
+    param_4 = 0;
+    param_4 = x_1042;
+    let x_1043 : i32 = x_100;
+    x_100 = 0;
+    x_100 = x_1043;
+    let x_573 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).y, vec3<f32>(1.0, 2.0, 3.0).z);
+    top = (x_112 - 1);
+    let x_1044 : i32 = param_5;
+    param_5 = 0;
+    param_5 = x_1044;
+    let x_574 : vec3<f32> = vec3<f32>(x_570.y, x_565.x, x_570.y);
+    let x_1045 : i32 = h_1;
+    h_1 = 0;
+    h_1 = x_1045;
+    let x_114 : ptr<function, i32> = stack[x_112];
+    let x_575 : vec2<f32> = vec2<f32>(x_564.y, x_564.z);
+    let x_1046 : i32 = x_100;
+    x_100 = 0;
+    x_100 = x_1046;
+    let x_115 : i32 = x_114;
+    let x_1047 : i32 = p;
+    p = 0;
+    p = x_1047;
+    let x_576 : vec3<f32> = vec3<f32>(x_573.y, x_573.y, x_565.x);
+    let x_1048 : i32 = param_5;
+    param_5 = 0;
+    param_5 = x_1048;
+    l_1 = x_115;
+    let x_1049 : i32 = top;
+    top = 0;
+    top = x_1049;
+    let x_118 : i32 = l_1;
+    param_4 = x_118;
+    let x_1050 : i32 = x_110;
+    x_110 = 0;
+    x_110 = x_1050;
+    let x_577 : vec2<f32> = vec2<f32>(x_569.y, x_569.z);
+    let x_120 : i32 = h_1;
+    let x_578 : vec2<f32> = vec2<f32>(x_558.x, vec3<f32>(1.0, 2.0, 3.0).y);
+    param_5 = x_120;
+    let x_1051 : i32 = x_100;
+    x_100 = 0;
+    x_100 = x_1051;
+    let x_121 : i32 = performPartition_i1_i1_(param_4, param_5);
+    let x_579 : vec2<f32> = vec2<f32>(x_567.x, x_568.x);
+    let x_1052 : i32 = param_5;
+    param_5 = 0;
+    param_5 = x_1052;
+    p = x_121;
+    let x_1053 : i32 = param_4;
+    param_4 = 0;
+    param_4 = x_1053;
+    let x_122 : i32 = p;
+    let x_1054 : i32 = h_1;
+    h_1 = 0;
+    h_1 = x_1054;
+    let x_580 : vec2<f32> = vec2<f32>(x_568.y, x_568.y);
+    let x_1055 : i32 = l_1;
+    l_1 = 0;
+    l_1 = x_1055;
+    let x_1056 : i32 = h_1;
+    h_1 = 0;
+    h_1 = x_1056;
+    let x_124 : i32 = l_1;
+    let x_1057 : i32 = x_110;
+    x_110 = 0;
+    x_110 = x_1057;
+    let x_1058 : i32 = h_1;
+    h_1 = 0;
+    h_1 = x_1058;
+    let x_582 : vec2<f32> = vec2<f32>(x_567.y, x_573.x);
+    let x_1059 : i32 = x_100;
+    x_100 = 0;
+    x_100 = x_1059;
+    if (((x_122 - bitcast<i32>(1u)) > x_124)) {
+      let x_1060 : i32 = param_4;
+      param_4 = 0;
+      param_4 = x_1060;
+      let x_128 : i32 = top;
+      let x_583 : vec2<f32> = vec2<f32>(x_571.y, x_556.y);
+      let x_1061 : i32 = x_100;
+      x_100 = 0;
+      x_100 = x_1061;
+      let x_1062 : array<i32, 10> = stack;
+      stack = array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+      stack = x_1062;
+      let x_584 : vec2<f32> = vec2<f32>(x_569.z, x_569.y);
+      let x_585 : vec3<f32> = vec3<f32>(x_580.y, x_577.x, x_577.x);
+      let x_130 : i32 = l_1;
+      let x_1063 : i32 = x_114;
+      x_114 = 0;
+      x_114 = x_1063;
+      let x_586 : vec2<f32> = vec2<f32>(x_564.x, x_585.x);
+      let x_1064 : i32 = param_5;
+      param_5 = 0;
+      param_5 = x_1064;
+      let x_131 : ptr<function, i32> = stack[(1 + x_128)];
+      let x_1065 : i32 = x_110;
+      x_110 = 0;
+      x_110 = x_1065;
+      let x_587 : vec3<f32> = vec3<f32>(x_566.y, x_566.y, x_563.x);
+      let x_1066 : i32 = param_5;
+      param_5 = 0;
+      param_5 = x_1066;
+      x_131 = x_130;
+      let x_132 : i32 = top;
+      let x_1067 : i32 = x_100;
+      x_100 = 0;
+      x_100 = x_1067;
+      let x_588 : vec2<f32> = vec2<f32>(x_575.y, x_575.x);
+      let x_1068 : i32 = x_131;
+      x_131 = 0;
+      x_131 = x_1068;
+      let x_133 : i32 = bitcast<i32>((1u + bitcast<u32>(x_132)));
+      let x_1069 : i32 = x_100;
+      x_100 = 0;
+      x_100 = x_1069;
+      let x_589 : vec3<f32> = vec3<f32>(x_576.z, x_588.y, x_576.z);
+      let x_1070 : i32 = h_1;
+      h_1 = 0;
+      h_1 = x_1070;
+      top = x_133;
+      let x_1071 : array<i32, 10> = stack;
+      stack = array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+      stack = x_1071;
+      let x_134 : i32 = p;
+      let x_590 : vec2<f32> = vec2<f32>(x_576.x, x_573.y);
+      let x_1072 : i32 = x_114;
+      x_114 = 0;
+      x_114 = x_1072;
+      let x_136 : ptr<function, i32> = stack[x_133];
+      let x_1073 : i32 = x_114;
+      x_114 = 0;
+      x_114 = x_1073;
+      x_136 = (x_134 - bitcast<i32>(1u));
+      let x_1074 : i32 = x_96;
+      x_96 = 0;
+      x_96 = x_1074;
+      let x_591 : vec2<f32> = vec2<f32>(x_569.z, x_569.y);
+      let x_1075 : i32 = x_136;
+      x_136 = 0;
+      x_136 = x_1075;
+    }
+    let x_1076 : i32 = x_96;
+    x_96 = 0;
+    x_96 = x_1076;
+    let x_592 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).x, vec3<f32>(1.0, 2.0, 3.0).y);
+    let x_1077 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_1077;
+    let x_137 : i32 = p;
+    let x_1078 : i32 = x_114;
+    x_114 = 0;
+    x_114 = x_1078;
+    let x_593 : vec3<f32> = vec3<f32>(x_571.z, x_556.x, x_556.y);
+    let x_1079 : i32 = p;
+    p = 0;
+    p = x_1079;
+    let x_594 : vec3<f32> = vec3<f32>(x_563.z, x_563.x, x_575.x);
+    let x_1080 : i32 = x_114;
+    x_114 = 0;
+    x_114 = x_1080;
+    let x_139 : i32 = h_1;
+    let x_1081 : i32 = top;
+    top = 0;
+    top = x_1081;
+    let x_595 : vec3<f32> = vec3<f32>(x_560.z, x_568.x, x_560.x);
+    let x_1082 : i32 = x_100;
+    x_100 = 0;
+    x_100 = x_1082;
+    let x_1083 : i32 = p;
+    p = 0;
+    p = x_1083;
+    if ((bitcast<i32>((1u + bitcast<u32>(x_137))) < x_139)) {
+      let x_1084 : i32 = x_114;
+      x_114 = 0;
+      x_114 = x_1084;
+      let x_596 : vec2<f32> = vec2<f32>(x_592.y, x_582.x);
+      let x_1085 : i32 = l_1;
+      l_1 = 0;
+      l_1 = x_1085;
+      let x_143 : i32 = top;
+      let x_1086 : i32 = x_114;
+      x_114 = 0;
+      x_114 = x_1086;
+      let x_597 : vec3<f32> = vec3<f32>(x_562.y, x_560.y, x_560.y);
+      let x_144 : i32 = (x_143 + 1);
+      let x_1087 : i32 = param_5;
+      param_5 = 0;
+      param_5 = x_1087;
+      top = x_144;
+      let x_1088 : i32 = x_114;
+      x_114 = 0;
+      x_114 = x_1088;
+      let x_145 : i32 = p;
+      let x_1089 : i32 = param_5;
+      param_5 = 0;
+      param_5 = x_1089;
+      let x_599 : vec3<f32> = vec3<f32>(x_560.z, x_560.x, x_568.x);
+      let x_1090 : i32 = p;
+      p = 0;
+      p = x_1090;
+      let x_600 : vec3<f32> = vec3<f32>(x_556.x, x_580.x, x_580.x);
+      let x_1091 : i32 = x_100;
+      x_100 = 0;
+      x_100 = x_1091;
+      let x_147 : ptr<function, i32> = stack[x_144];
+      let x_1092 : i32 = x_110;
+      x_110 = 0;
+      x_110 = x_1092;
+      let x_601 : vec2<f32> = vec2<f32>(x_563.x, x_563.y);
+      x_147 = bitcast<i32>((1u + bitcast<u32>(x_145)));
+      let x_1093 : array<i32, 10> = stack;
+      stack = array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+      stack = x_1093;
+      let x_148 : i32 = top;
+      let x_1094 : i32 = x_114;
+      x_114 = 0;
+      x_114 = x_1094;
+      let x_602 : vec2<f32> = vec2<f32>(x_565.y, x_599.y);
+      let x_1095 : array<i32, 10> = stack;
+      stack = array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+      stack = x_1095;
+      let x_149 : i32 = (x_148 + bitcast<i32>(1u));
+      let x_1096 : i32 = x_147;
+      x_147 = 0;
+      x_147 = x_1096;
+      top = x_149;
+      let x_1097 : i32 = param_4;
+      param_4 = 0;
+      param_4 = x_1097;
+      let x_150 : i32 = h_1;
+      let x_1098 : i32 = x_100;
+      x_100 = 0;
+      x_100 = x_1098;
+      let x_1099 : i32 = x_96;
+      x_96 = 0;
+      x_96 = x_1099;
+      stack[x_149] = x_150;
+      let x_1100 : i32 = x_114;
+      x_114 = 0;
+      x_114 = x_1100;
+      let x_603 : vec3<f32> = vec3<f32>(x_568.y, x_564.x, x_564.x);
+      let x_1101 : i32 = l_1;
+      l_1 = 0;
+      l_1 = x_1101;
+    }
+    let x_1102 : i32 = x_100;
+    x_100 = 0;
+    x_100 = x_1102;
+
+    continuing {
+      let x_1103 : i32 = l_1;
+      l_1 = 0;
+      l_1 = x_1103;
+      let x_604 : vec2<f32> = vec2<f32>(x_563.z, x_564.x);
+      let x_1104 : QuicksortObject = obj;
+      obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+      obj = x_1104;
+    }
+  }
+  let x_1105 : i32 = h_1;
+  h_1 = 0;
+  h_1 = x_1105;
+  return;
+}
+
+[[stage(fragment)]]
+fn main() {
+  var color : vec3<f32>;
+  var i_2 : i32;
+  var uv : vec2<f32>;
+  let x_717 : vec2<f32> = uv;
+  uv = vec2<f32>(0.0, 0.0);
+  uv = x_717;
+  i_2 = 0;
+  let x_721 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_721;
+  if (true) {
+    let x_722 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_722;
+    let x_431 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).x, vec3<f32>(1.0, 2.0, 3.0).x);
+    let x_158 : i32 = i_2;
+    let x_723 : vec2<f32> = uv;
+    uv = vec2<f32>(0.0, 0.0);
+    uv = x_723;
+    let x_725 : vec3<f32> = color;
+    color = vec3<f32>(0.0, 0.0, 0.0);
+    color = x_725;
+    let x_432 : vec2<f32> = vec2<f32>(x_431.y, x_431.y);
+    let x_726 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_726;
+  }
+  let x_756 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_756;
+  let x_446 : vec2<f32> = vec2<f32>(vec2<f32>(0.0, 0.0).x, vec2<f32>(0.0, 0.0).x);
+  let x_757 : i32 = i_2;
+  i_2 = 0;
+  i_2 = x_757;
+  quicksort_();
+  let x_758 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_758;
+  let x_184 : vec4<f32> = gl_FragCoord;
+  let x_759 : vec2<f32> = uv;
+  uv = vec2<f32>(0.0, 0.0);
+  uv = x_759;
+  let x_447 : vec2<f32> = vec2<f32>(vec2<f32>(0.0, 0.0).y, vec2<f32>(0.0, 0.0).y);
+  let x_760 : vec2<f32> = uv;
+  uv = vec2<f32>(0.0, 0.0);
+  uv = x_760;
+  let x_185 : vec2<f32> = vec2<f32>(x_184.x, x_184.y);
+  let x_448 : vec3<f32> = vec3<f32>(x_185.y, x_446.y, x_446.y);
+  let x_761 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_761;
+  let x_762 : vec2<f32> = uv;
+  uv = vec2<f32>(0.0, 0.0);
+  uv = x_762;
+  let x_191 : vec2<f32> = x_188.resolution;
+  let x_763 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_763;
+  let x_449 : vec3<f32> = vec3<f32>(x_184.y, vec3<f32>(1.0, 2.0, 3.0).z, x_184.w);
+  let x_764 : vec3<f32> = color;
+  color = vec3<f32>(0.0, 0.0, 0.0);
+  color = x_764;
+  let x_192 : vec2<f32> = (x_185 / x_191);
+  let x_765 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_765;
+  let x_450 : vec2<f32> = vec2<f32>(x_447.x, x_185.y);
+  let x_766 : vec3<f32> = color;
+  color = vec3<f32>(0.0, 0.0, 0.0);
+  let x_767 : vec3<f32> = color;
+  color = vec3<f32>(0.0, 0.0, 0.0);
+  color = x_767;
+  color = x_766;
+  uv = x_192;
+  color = vec3<f32>(1.0, 2.0, 3.0);
+  let x_768 : vec3<f32> = color;
+  color = vec3<f32>(0.0, 0.0, 0.0);
+  color = x_768;
+  let x_451 : vec3<f32> = vec3<f32>(x_185.x, x_185.y, x_446.y);
+  let x_769 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_769;
+  let x_200 : ptr<private, i32> = obj.numbers[0u];
+  let x_770 : i32 = x_200;
+  x_200 = 0;
+  x_200 = x_770;
+  let x_201 : i32 = x_200;
+  let x_771 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_771;
+  let x_205 : ptr<function, f32> = color.x;
+  let x_772 : i32 = x_200;
+  x_200 = 0;
+  x_200 = x_772;
+  let x_206 : f32 = x_205;
+  let x_773 : f32 = x_205;
+  x_205 = 0.0;
+  x_205 = x_773;
+  let x_452 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).z, vec3<f32>(1.0, 2.0, 3.0).y);
+  let x_774 : i32 = i_2;
+  i_2 = 0;
+  i_2 = x_774;
+  let x_775 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_775;
+  let x_208 : ptr<function, f32> = color.x;
+  let x_453 : vec3<f32> = vec3<f32>(x_451.x, x_450.x, x_450.y);
+  x_208 = (x_206 + f32(x_201));
+  let x_776 : vec2<f32> = uv;
+  uv = vec2<f32>(0.0, 0.0);
+  uv = x_776;
+  let x_209 : ptr<function, f32> = uv.x;
+  let x_777 : vec2<f32> = uv;
+  uv = vec2<f32>(0.0, 0.0);
+  uv = x_777;
+  let x_454 : vec2<f32> = vec2<f32>(x_184.y, x_184.y);
+  let x_210 : f32 = x_209;
+  let x_455 : vec2<f32> = vec2<f32>(x_192.y, x_192.x);
+  let x_778 : f32 = x_209;
+  x_209 = 0.0;
+  x_209 = x_778;
+  let x_779 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_779;
+  if ((x_210 > 0.25)) {
+    let x_780 : i32 = i_2;
+    i_2 = 0;
+    i_2 = x_780;
+    let x_781 : i32 = x_200;
+    x_200 = 0;
+    x_200 = x_781;
+    let x_456 : vec3<f32> = vec3<f32>(vec2<f32>(0.0, 0.0).y, x_448.y, x_448.y);
+    let x_782 : f32 = x_209;
+    x_209 = 0.0;
+    x_209 = x_782;
+    let x_216 : i32 = obj.numbers[1];
+    let x_783 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_783;
+    let x_457 : vec2<f32> = vec2<f32>(x_454.x, x_454.x);
+    let x_784 : vec2<f32> = uv;
+    uv = vec2<f32>(0.0, 0.0);
+    uv = x_784;
+    let x_218 : ptr<function, f32> = color[0];
+    let x_785 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_785;
+    let x_458 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).z, vec2<f32>(0.0, 0.0).y);
+    let x_786 : i32 = i_2;
+    i_2 = 0;
+    i_2 = x_786;
+    let x_219 : f32 = x_218;
+    let x_787 : f32 = x_218;
+    x_218 = 0.0;
+    x_218 = x_787;
+    let x_788 : vec3<f32> = color;
+    color = vec3<f32>(0.0, 0.0, 0.0);
+    color = x_788;
+    let x_789 : vec3<f32> = color;
+    color = vec3<f32>(0.0, 0.0, 0.0);
+    color = x_789;
+    let x_459 : vec3<f32> = vec3<f32>(x_454.y, x_454.y, x_447.y);
+    let x_790 : f32 = x_218;
+    x_218 = 0.0;
+    x_218 = x_790;
+    color.x = (f32(x_216) + x_219);
+    let x_791 : i32 = x_200;
+    x_200 = 0;
+    x_200 = x_791;
+  }
+  let x_792 : f32 = x_209;
+  x_209 = 0.0;
+  x_209 = x_792;
+  let x_222 : ptr<function, f32> = uv.x;
+  let x_793 : f32 = x_209;
+  x_209 = 0.0;
+  x_209 = x_793;
+  let x_223 : f32 = x_222;
+  let x_794 : f32 = x_222;
+  x_222 = 0.0;
+  x_222 = x_794;
+  let x_460 : vec3<f32> = vec3<f32>(x_453.z, x_453.y, x_453.y);
+  let x_795 : vec2<f32> = uv;
+  uv = vec2<f32>(0.0, 0.0);
+  uv = x_795;
+  let x_796 : f32 = x_222;
+  x_222 = 0.0;
+  x_222 = x_796;
+  let x_461 : vec2<f32> = vec2<f32>(vec2<f32>(0.0, 0.0).y, vec2<f32>(0.0, 0.0).y);
+  let x_797 : f32 = x_222;
+  x_222 = 0.0;
+  x_222 = x_797;
+  if ((x_223 > 0.5)) {
+    let x_798 : f32 = x_222;
+    x_222 = 0.0;
+    x_222 = x_798;
+    let x_462 : vec2<f32> = vec2<f32>(x_446.x, x_446.x);
+    let x_799 : f32 = x_205;
+    x_205 = 0.0;
+    x_205 = x_799;
+    let x_229 : ptr<private, i32> = obj.numbers[2u];
+    let x_800 : f32 = x_205;
+    x_205 = 0.0;
+    x_205 = x_800;
+    let x_463 : vec3<f32> = vec3<f32>(x_453.x, x_453.z, x_461.y);
+    let x_801 : f32 = x_208;
+    x_208 = 0.0;
+    x_208 = x_801;
+    let x_230 : i32 = x_229;
+    let x_802 : f32 = x_209;
+    x_209 = 0.0;
+    x_209 = x_802;
+    let x_803 : f32 = x_205;
+    x_205 = 0.0;
+    x_205 = x_803;
+    let x_233 : ptr<function, f32> = color.y;
+    let x_804 : i32 = x_229;
+    x_229 = 0;
+    x_229 = x_804;
+    let x_464 : vec2<f32> = vec2<f32>(x_450.y, x_191.x);
+    let x_805 : f32 = x_233;
+    x_233 = 0.0;
+    x_233 = x_805;
+    let x_234 : f32 = x_233;
+    let x_806 : i32 = x_229;
+    x_229 = 0;
+    x_229 = x_806;
+    let x_465 : vec2<f32> = vec2<f32>(x_463.x, x_185.x);
+    let x_807 : f32 = x_208;
+    x_208 = 0.0;
+    x_208 = x_807;
+    let x_808 : i32 = i_2;
+    i_2 = 0;
+    i_2 = x_808;
+    let x_466 : vec2<f32> = vec2<f32>(x_455.y, vec2<f32>(0.0, 0.0).y);
+    let x_809 : i32 = i_2;
+    i_2 = 0;
+    i_2 = x_809;
+    color.y = (f32(x_230) + x_234);
+    let x_810 : f32 = x_209;
+    x_209 = 0.0;
+    x_209 = x_810;
+  }
+  let x_237 : ptr<function, f32> = uv[0];
+  let x_811 : i32 = i_2;
+  i_2 = 0;
+  i_2 = x_811;
+  let x_467 : vec2<f32> = vec2<f32>(x_191.x, x_191.x);
+  let x_812 : f32 = x_222;
+  x_222 = 0.0;
+  x_222 = x_812;
+  let x_238 : f32 = x_237;
+  let x_813 : vec3<f32> = color;
+  color = vec3<f32>(0.0, 0.0, 0.0);
+  color = x_813;
+  let x_814 : f32 = x_208;
+  x_208 = 0.0;
+  x_208 = x_814;
+  if ((x_238 > 0.75)) {
+    let x_815 : f32 = x_205;
+    x_205 = 0.0;
+    x_205 = x_815;
+    let x_245 : i32 = obj.numbers[3];
+    let x_816 : f32 = x_208;
+    x_208 = 0.0;
+    x_208 = x_816;
+    let x_817 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_817;
+    let x_468 : vec3<f32> = vec3<f32>(x_467.x, x_467.x, x_467.x);
+    let x_818 : f32 = x_237;
+    x_237 = 0.0;
+    x_237 = x_818;
+    let x_248 : ptr<function, f32> = color.z;
+    let x_819 : f32 = x_222;
+    x_222 = 0.0;
+    x_222 = x_819;
+    let x_249 : f32 = x_248;
+    let x_820 : vec3<f32> = color;
+    color = vec3<f32>(0.0, 0.0, 0.0);
+    color = x_820;
+    let x_469 : vec3<f32> = vec3<f32>(x_467.x, x_191.y, x_467.y);
+    let x_821 : f32 = x_248;
+    x_248 = 0.0;
+    x_248 = x_821;
+    let x_822 : i32 = x_200;
+    x_200 = 0;
+    x_200 = x_822;
+    let x_470 : vec2<f32> = vec2<f32>(vec2<f32>(0.0, 0.0).x, vec2<f32>(0.0, 0.0).y);
+    let x_823 : f32 = x_248;
+    x_248 = 0.0;
+    x_248 = x_823;
+    color.z = (x_249 + f32(x_245));
+    let x_824 : vec2<f32> = uv;
+    uv = vec2<f32>(0.0, 0.0);
+    uv = x_824;
+    let x_471 : vec2<f32> = vec2<f32>(x_470.y, x_470.y);
+  }
+  let x_825 : f32 = x_237;
+  x_237 = 0.0;
+  x_237 = x_825;
+  let x_472 : vec3<f32> = vec3<f32>(x_454.x, x_454.y, x_454.y);
+  let x_253 : ptr<private, i32> = obj.numbers[4];
+  let x_254 : i32 = x_253;
+  let x_826 : f32 = x_237;
+  x_237 = 0.0;
+  x_237 = x_826;
+  let x_827 : vec3<f32> = color;
+  color = vec3<f32>(0.0, 0.0, 0.0);
+  color = x_827;
+  let x_473 : vec3<f32> = vec3<f32>(x_446.y, x_453.x, x_453.x);
+  let x_828 : i32 = x_253;
+  x_253 = 0;
+  x_253 = x_828;
+  let x_256 : ptr<function, f32> = color.y;
+  let x_474 : vec2<f32> = vec2<f32>(x_191.x, x_184.z);
+  let x_829 : f32 = x_209;
+  x_209 = 0.0;
+  x_209 = x_829;
+  let x_257 : f32 = x_256;
+  let x_830 : f32 = x_256;
+  x_256 = 0.0;
+  x_256 = x_830;
+  let x_475 : vec2<f32> = vec2<f32>(x_467.x, x_450.x);
+  let x_831 : f32 = x_222;
+  x_222 = 0.0;
+  x_222 = x_831;
+  let x_259 : ptr<function, f32> = color.y;
+  let x_832 : f32 = x_205;
+  x_205 = 0.0;
+  x_205 = x_832;
+  let x_476 : vec2<f32> = vec2<f32>(x_451.z, x_460.y);
+  x_259 = (x_257 + f32(x_254));
+  let x_477 : vec3<f32> = vec3<f32>(vec2<f32>(0.0, 0.0).x, x_472.x, vec2<f32>(0.0, 0.0).y);
+  let x_833 : f32 = x_209;
+  x_209 = 0.0;
+  x_209 = x_833;
+  let x_260 : ptr<function, f32> = uv.y;
+  let x_834 : f32 = x_205;
+  x_205 = 0.0;
+  x_205 = x_834;
+  let x_478 : vec2<f32> = vec2<f32>(x_472.x, x_472.y);
+  let x_835 : f32 = x_260;
+  x_260 = 0.0;
+  x_260 = x_835;
+  let x_261 : f32 = x_260;
+  let x_836 : i32 = i_2;
+  i_2 = 0;
+  i_2 = x_836;
+  let x_479 : vec3<f32> = vec3<f32>(vec2<f32>(0.0, 0.0).y, x_454.y, vec2<f32>(0.0, 0.0).x);
+  let x_837 : i32 = x_200;
+  x_200 = 0;
+  x_200 = x_837;
+  let x_838 : f32 = x_259;
+  x_259 = 0.0;
+  x_259 = x_838;
+  let x_480 : vec3<f32> = vec3<f32>(x_446.x, x_446.x, vec2<f32>(0.0, 0.0).y);
+  let x_839 : f32 = x_209;
+  x_209 = 0.0;
+  x_209 = x_839;
+  if ((x_261 > 0.25)) {
+    let x_481 : vec2<f32> = vec2<f32>(x_447.x, x_480.z);
+    let x_840 : vec3<f32> = color;
+    color = vec3<f32>(0.0, 0.0, 0.0);
+    color = x_840;
+    let x_267 : i32 = obj.numbers[5u];
+    let x_841 : f32 = x_205;
+    x_205 = 0.0;
+    x_205 = x_841;
+    let x_842 : i32 = i_2;
+    i_2 = 0;
+    i_2 = x_842;
+    let x_843 : i32 = i_2;
+    i_2 = 0;
+    i_2 = x_843;
+    let x_270 : f32 = color.x;
+    let x_844 : f32 = x_237;
+    x_237 = 0.0;
+    x_237 = x_844;
+    let x_482 : vec3<f32> = vec3<f32>(x_455.x, x_475.y, x_455.y);
+    let x_845 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_845;
+    let x_846 : f32 = x_260;
+    x_260 = 0.0;
+    x_260 = x_846;
+    let x_847 : i32 = i_2;
+    i_2 = 0;
+    i_2 = x_847;
+    let x_483 : vec3<f32> = vec3<f32>(x_184.w, x_184.w, x_192.x);
+    let x_848 : f32 = x_209;
+    x_209 = 0.0;
+    x_209 = x_848;
+    color.x = (f32(x_267) + x_270);
+    let x_484 : vec3<f32> = vec3<f32>(x_454.y, x_450.x, x_454.y);
+    let x_849 : f32 = x_209;
+    x_209 = 0.0;
+    x_209 = x_849;
+  }
+  let x_850 : f32 = x_205;
+  x_205 = 0.0;
+  x_205 = x_850;
+  let x_485 : vec3<f32> = vec3<f32>(x_467.x, x_450.y, x_450.x);
+  let x_851 : f32 = x_260;
+  x_260 = 0.0;
+  x_260 = x_851;
+  let x_273 : ptr<function, f32> = uv.y;
+  let x_852 : i32 = x_253;
+  x_253 = 0;
+  x_253 = x_852;
+  let x_274 : f32 = x_273;
+  let x_853 : i32 = x_200;
+  x_200 = 0;
+  x_200 = x_853;
+  if ((x_274 > 0.5)) {
+    let x_854 : f32 = x_222;
+    x_222 = 0.0;
+    x_222 = x_854;
+    let x_486 : vec2<f32> = vec2<f32>(x_480.y, x_455.y);
+    let x_279 : ptr<private, i32> = obj.numbers[6u];
+    let x_855 : f32 = x_256;
+    x_256 = 0.0;
+    x_256 = x_855;
+    let x_487 : vec2<f32> = vec2<f32>(x_449.z, x_449.y);
+    let x_856 : f32 = x_273;
+    x_273 = 0.0;
+    x_273 = x_856;
+    let x_280 : i32 = x_279;
+    let x_857 : f32 = x_260;
+    x_260 = 0.0;
+    x_260 = x_857;
+    let x_858 : i32 = i_2;
+    i_2 = 0;
+    i_2 = x_858;
+    let x_859 : i32 = x_253;
+    x_253 = 0;
+    x_253 = x_859;
+    let x_488 : vec2<f32> = vec2<f32>(x_473.z, x_473.y);
+    let x_283 : f32 = color.y;
+    let x_860 : vec2<f32> = uv;
+    uv = vec2<f32>(0.0, 0.0);
+    uv = x_860;
+    let x_861 : f32 = x_208;
+    x_208 = 0.0;
+    x_208 = x_861;
+    let x_489 : vec2<f32> = vec2<f32>(x_475.y, x_475.x);
+    let x_862 : i32 = x_279;
+    x_279 = 0;
+    x_279 = x_862;
+    let x_863 : i32 = x_279;
+    x_279 = 0;
+    x_279 = x_863;
+    let x_490 : vec2<f32> = vec2<f32>(x_480.z, x_480.z);
+    let x_864 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_864;
+    color.y = (f32(x_280) + x_283);
+    let x_865 : f32 = x_208;
+    x_208 = 0.0;
+    x_208 = x_865;
+    let x_491 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).y, x_454.x);
+    let x_866 : f32 = x_259;
+    x_259 = 0.0;
+    x_259 = x_866;
+  }
+  let x_492 : vec2<f32> = vec2<f32>(x_455.y, x_455.y);
+  let x_867 : f32 = x_205;
+  x_205 = 0.0;
+  x_205 = x_867;
+  let x_286 : ptr<function, f32> = uv.y;
+  let x_287 : f32 = x_286;
+  let x_868 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_868;
+  let x_493 : vec2<f32> = vec2<f32>(x_475.x, x_475.y);
+  let x_869 : f32 = x_237;
+  x_237 = 0.0;
+  x_237 = x_869;
+  let x_870 : f32 = x_259;
+  x_259 = 0.0;
+  x_259 = x_870;
+  let x_494 : vec3<f32> = vec3<f32>(x_191.x, x_191.y, x_191.y);
+  let x_871 : i32 = x_253;
+  x_253 = 0;
+  x_253 = x_871;
+  if ((x_287 > 0.75)) {
+    let x_872 : vec3<f32> = color;
+    color = vec3<f32>(0.0, 0.0, 0.0);
+    color = x_872;
+    let x_873 : f32 = x_208;
+    x_208 = 0.0;
+    x_208 = x_873;
+    let x_495 : vec3<f32> = vec3<f32>(x_192.y, x_192.x, x_192.y);
+    let x_874 : vec3<f32> = color;
+    color = vec3<f32>(0.0, 0.0, 0.0);
+    color = x_874;
+    let x_293 : i32 = obj.numbers[7];
+    let x_875 : f32 = x_222;
+    x_222 = 0.0;
+    x_222 = x_875;
+    let x_496 : vec3<f32> = vec3<f32>(x_475.x, x_467.y, x_467.x);
+    let x_876 : f32 = x_259;
+    x_259 = 0.0;
+    x_259 = x_876;
+    let x_497 : vec2<f32> = vec2<f32>(x_477.x, x_461.y);
+    let x_877 : i32 = x_200;
+    x_200 = 0;
+    x_200 = x_877;
+    let x_878 : f32 = x_259;
+    x_259 = 0.0;
+    x_259 = x_878;
+    let x_498 : vec3<f32> = vec3<f32>(x_478.x, x_478.y, x_478.x);
+    let x_879 : f32 = x_205;
+    x_205 = 0.0;
+    x_205 = x_879;
+    let x_296 : f32 = color.z;
+    let x_880 : f32 = x_273;
+    x_273 = 0.0;
+    x_273 = x_880;
+    let x_499 : vec2<f32> = vec2<f32>(x_184.x, x_184.y);
+    let x_881 : f32 = x_209;
+    x_209 = 0.0;
+    x_209 = x_881;
+    let x_882 : f32 = x_286;
+    x_286 = 0.0;
+    x_286 = x_882;
+    let x_298 : ptr<function, f32> = color.z;
+    let x_883 : f32 = x_273;
+    x_273 = 0.0;
+    x_273 = x_883;
+    let x_500 : vec3<f32> = vec3<f32>(x_499.y, x_499.y, x_494.z);
+    let x_884 : f32 = x_298;
+    x_298 = 0.0;
+    x_298 = x_884;
+    x_298 = (f32(x_293) + x_296);
+    let x_885 : f32 = x_256;
+    x_256 = 0.0;
+    x_256 = x_885;
+    let x_501 : vec2<f32> = vec2<f32>(x_453.x, x_453.z);
+    let x_886 : f32 = x_205;
+    x_205 = 0.0;
+    x_205 = x_886;
+  }
+  let x_887 : i32 = i_2;
+  i_2 = 0;
+  i_2 = x_887;
+  let x_502 : vec2<f32> = vec2<f32>(x_451.y, x_192.y);
+  let x_888 : vec2<f32> = uv;
+  uv = vec2<f32>(0.0, 0.0);
+  uv = x_888;
+  let x_300 : ptr<private, i32> = obj.numbers[8];
+  let x_301 : i32 = x_300;
+  let x_889 : i32 = i_2;
+  i_2 = 0;
+  i_2 = x_889;
+  let x_503 : vec2<f32> = vec2<f32>(x_185.x, x_451.z);
+  let x_890 : i32 = x_300;
+  x_300 = 0;
+  x_300 = x_890;
+  let x_891 : f32 = x_256;
+  x_256 = 0.0;
+  x_256 = x_891;
+  let x_504 : vec2<f32> = vec2<f32>(x_453.y, vec2<f32>(0.0, 0.0).x);
+  let x_892 : f32 = x_205;
+  x_205 = 0.0;
+  x_205 = x_892;
+  let x_303 : ptr<function, f32> = color.z;
+  let x_505 : vec3<f32> = vec3<f32>(x_504.x, x_504.y, x_504.x);
+  let x_893 : f32 = x_303;
+  x_303 = 0.0;
+  x_303 = x_893;
+  let x_304 : f32 = x_303;
+  let x_894 : f32 = x_208;
+  x_208 = 0.0;
+  x_208 = x_894;
+  let x_506 : vec2<f32> = vec2<f32>(x_493.x, x_492.x);
+  let x_895 : i32 = x_253;
+  x_253 = 0;
+  x_253 = x_895;
+  let x_896 : f32 = x_286;
+  x_286 = 0.0;
+  x_286 = x_896;
+  let x_507 : vec2<f32> = vec2<f32>(x_461.x, x_447.x);
+  let x_897 : f32 = x_259;
+  x_259 = 0.0;
+  x_259 = x_897;
+  let x_306 : ptr<function, f32> = color.z;
+  x_306 = (x_304 + f32(x_301));
+  let x_898 : vec2<f32> = uv;
+  uv = vec2<f32>(0.0, 0.0);
+  uv = x_898;
+  let x_899 : f32 = x_222;
+  x_222 = 0.0;
+  x_222 = x_899;
+  let x_508 : vec3<f32> = vec3<f32>(x_461.y, x_461.x, x_506.y);
+  let x_900 : f32 = x_222;
+  x_222 = 0.0;
+  x_222 = x_900;
+  let x_308 : f32 = uv.x;
+  let x_901 : f32 = x_259;
+  x_259 = 0.0;
+  x_259 = x_901;
+  let x_309 : ptr<function, f32> = uv.y;
+  let x_509 : vec3<f32> = vec3<f32>(x_503.y, x_503.x, x_448.z);
+  let x_902 : f32 = x_260;
+  x_260 = 0.0;
+  x_260 = x_902;
+  let x_310 : f32 = x_309;
+  let x_903 : f32 = x_260;
+  x_260 = 0.0;
+  x_260 = x_903;
+  let x_904 : f32 = x_306;
+  x_306 = 0.0;
+  x_306 = x_904;
+  let x_510 : vec3<f32> = vec3<f32>(vec3<f32>(1.0, 2.0, 3.0).y, x_485.y, x_485.z);
+  let x_905 : f32 = x_306;
+  x_306 = 0.0;
+  x_306 = x_905;
+  let x_906 : i32 = i_2;
+  i_2 = 0;
+  i_2 = x_906;
+  let x_511 : vec2<f32> = vec2<f32>(x_485.z, x_485.y);
+  let x_907 : vec3<f32> = color;
+  color = vec3<f32>(0.0, 0.0, 0.0);
+  color = x_907;
+  let x_908 : f32 = x_260;
+  x_260 = 0.0;
+  x_260 = x_908;
+  let x_512 : vec3<f32> = vec3<f32>(x_455.y, x_455.y, x_455.y);
+  let x_909 : i32 = x_253;
+  x_253 = 0;
+  x_253 = x_909;
+  if ((abs((x_308 - x_310)) < 0.25)) {
+    let x_910 : f32 = x_209;
+    x_209 = 0.0;
+    x_209 = x_910;
+    let x_911 : QuicksortObject = obj;
+    obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+    obj = x_911;
+    let x_513 : vec3<f32> = vec3<f32>(x_505.z, x_505.x, x_448.x);
+    let x_912 : i32 = x_300;
+    x_300 = 0;
+    x_300 = x_912;
+    let x_317 : i32 = obj.numbers[9u];
+    let x_514 : vec3<f32> = vec3<f32>(x_474.y, x_474.y, x_474.y);
+    let x_913 : f32 = x_260;
+    x_260 = 0.0;
+    x_260 = x_913;
+    let x_320 : f32 = color.x;
+    let x_914 : f32 = x_286;
+    x_286 = 0.0;
+    x_286 = x_914;
+    let x_515 : vec2<f32> = vec2<f32>(x_502.x, x_502.y);
+    let x_915 : f32 = x_205;
+    x_205 = 0.0;
+    x_205 = x_915;
+    let x_916 : vec3<f32> = color;
+    color = vec3<f32>(0.0, 0.0, 0.0);
+    color = x_916;
+    let x_516 : vec2<f32> = vec2<f32>(x_452.x, x_452.x);
+    let x_917 : vec2<f32> = uv;
+    uv = vec2<f32>(0.0, 0.0);
+    uv = x_917;
+    let x_322 : ptr<function, f32> = color.x;
+    let x_918 : f32 = x_209;
+    x_209 = 0.0;
+    x_209 = x_918;
+    let x_517 : vec3<f32> = vec3<f32>(vec2<f32>(0.0, 0.0).x, vec2<f32>(0.0, 0.0).x, vec2<f32>(0.0, 0.0).y);
+    x_322 = (f32(x_317) + x_320);
+    let x_919 : f32 = x_322;
+    x_322 = 0.0;
+    x_322 = x_919;
+    let x_518 : vec3<f32> = vec3<f32>(x_480.y, x_508.x, x_480.x);
+    let x_920 : f32 = x_205;
+    x_205 = 0.0;
+    x_205 = x_920;
+  }
+  let x_921 : f32 = x_309;
+  x_309 = 0.0;
+  x_309 = x_921;
+  let x_325 : vec3<f32> = color;
+  let x_922 : f32 = x_237;
+  x_237 = 0.0;
+  x_237 = x_922;
+  let x_519 : vec3<f32> = vec3<f32>(x_447.x, x_446.x, x_446.y);
+  let x_326 : vec3<f32> = normalize(x_325);
+  let x_923 : f32 = x_209;
+  x_209 = 0.0;
+  x_209 = x_923;
+  let x_924 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_924;
+  let x_925 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_925;
+  let x_926 : f32 = x_259;
+  x_259 = 0.0;
+  x_259 = x_926;
+  let x_520 : vec2<f32> = vec2<f32>(x_506.y, x_519.y);
+  let x_927 : f32 = x_259;
+  x_259 = 0.0;
+  x_259 = x_927;
+  let x_330 : vec4<f32> = vec4<f32>(x_326.x, x_326.y, x_326.z, 1.0);
+  let x_928 : f32 = x_309;
+  x_309 = 0.0;
+  x_309 = x_928;
+  let x_521 : vec3<f32> = vec3<f32>(vec3<f32>(1.0, 2.0, 3.0).y, vec3<f32>(1.0, 2.0, 3.0).y, x_520.y);
+  let x_929 : f32 = x_222;
+  x_222 = 0.0;
+  x_222 = x_929;
+  x_GLF_color = x_330;
+  let x_930 : QuicksortObject = obj;
+  obj = QuicksortObject(array<i32, 10>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+  obj = x_930;
+  let x_522 : vec3<f32> = vec3<f32>(x_330.w, x_330.y, x_493.x);
+  let x_931 : f32 = x_208;
+  x_208 = 0.0;
+  x_208 = x_931;
+  return;
+}
diff --git a/test/bug/tint/782.wgsl.expected.hlsl b/test/bug/tint/782.wgsl.expected.hlsl
new file mode 100644
index 0000000..4bd27f5
--- /dev/null
+++ b/test/bug/tint/782.wgsl.expected.hlsl
@@ -0,0 +1,12 @@
+
+void foo() {
+  int tint_symbol[2] = {0, 0};
+  int implict[2] = {0, 0};
+  implict = tint_symbol;
+}
+
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
diff --git a/test/bug/tint/782.wgsl.expected.msl b/test/bug/tint/782.wgsl.expected.msl
new file mode 100644
index 0000000..d8d58a5
--- /dev/null
+++ b/test/bug/tint/782.wgsl.expected.msl
@@ -0,0 +1,10 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+void foo() {
+  int tint_symbol[2] = {0};
+  int implict[2] = {0};
+  implict = tint_symbol;
+}
+
diff --git a/test/bug/tint/782.wgsl.expected.spvasm b/test/bug/tint/782.wgsl.expected.spvasm
new file mode 100644
index 0000000..91c057f
--- /dev/null
+++ b/test/bug/tint/782.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
+               OpExecutionMode %unused_entry_point LocalSize 1 1 1
+               OpName %unused_entry_point "unused_entry_point"
+               OpName %foo "foo"
+               OpName %explicit "explicit"
+               OpName %implict "implict"
+               OpDecorate %_arr_int_uint_2 ArrayStride 4
+       %void = OpTypeVoid
+          %1 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+       %uint = OpTypeInt 32 0
+     %uint_2 = OpConstant %uint 2
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
+         %13 = OpConstantNull %_arr_int_uint_2
+%unused_entry_point = OpFunction %void None %1
+          %4 = OpLabel
+               OpReturn
+               OpFunctionEnd
+        %foo = OpFunction %void None %1
+          %6 = OpLabel
+   %explicit = OpVariable %_ptr_Function__arr_int_uint_2 Function %13
+    %implict = OpVariable %_ptr_Function__arr_int_uint_2 Function %13
+         %15 = OpLoad %_arr_int_uint_2 %explicit
+               OpStore %implict %15
+               OpReturn
+               OpFunctionEnd
diff --git a/test/bug/tint/782.wgsl.expected.wgsl b/test/bug/tint/782.wgsl.expected.wgsl
new file mode 100644
index 0000000..2719237
--- /dev/null
+++ b/test/bug/tint/782.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+type ArrayExplicitStride = [[stride(4)]] array<i32, 2>;
+
+type ArrayImplicitStride = array<i32, 2>;
+
+fn foo() {
+  var explicit : ArrayExplicitStride;
+  var implict : ArrayImplicitStride;
+  implict = explicit;
+}
diff --git a/test/samples/compute_boids.wgsl.expected.hlsl b/test/samples/compute_boids.wgsl.expected.hlsl
new file mode 100644
index 0000000..e29d25b
--- /dev/null
+++ b/test/samples/compute_boids.wgsl.expected.hlsl
@@ -0,0 +1,118 @@
+struct tint_symbol_1 {
+  float2 a_particlePos : TEXCOORD0;
+  float2 a_particleVel : TEXCOORD1;
+  float2 a_pos : TEXCOORD2;
+};
+struct tint_symbol_2 {
+  float4 value : SV_Position;
+};
+struct tint_symbol_3 {
+  float4 value : SV_Target0;
+};
+struct SimParams {
+  float deltaT;
+  float rule1Distance;
+  float rule2Distance;
+  float rule3Distance;
+  float rule1Scale;
+  float rule2Scale;
+  float rule3Scale;
+};
+struct tint_symbol_5 {
+  uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
+};
+
+ConstantBuffer<SimParams> params : register(b0, space0);
+
+RWByteAddressBuffer particlesA : register(u1, space0);
+RWByteAddressBuffer particlesB : register(u2, space0);
+
+tint_symbol_2 vert_main(tint_symbol_1 tint_symbol) {
+  const float2 a_particlePos = tint_symbol.a_particlePos;
+  const float2 a_particleVel = tint_symbol.a_particleVel;
+  const float2 a_pos = tint_symbol.a_pos;
+  float angle = -(  atan2(a_particleVel.x, a_particleVel.y));
+  float2 pos = float2(((a_pos.x *   cos(angle)) - (a_pos.y *   sin(angle))), ((a_pos.x *   sin(angle)) + (a_pos.y *   cos(angle))));
+  const tint_symbol_2 tint_symbol_8 = {float4((pos + a_particlePos), 0.0f, 1.0f)};
+  return tint_symbol_8;
+}
+
+tint_symbol_3 frag_main() {
+  const tint_symbol_3 tint_symbol_9 = {float4(1.0f, 1.0f, 1.0f, 1.0f)};
+  return tint_symbol_9;
+}
+
+[numthreads(1, 1, 1)]
+void comp_main(tint_symbol_5 tint_symbol_4) {
+  const uint3 gl_GlobalInvocationID = tint_symbol_4.gl_GlobalInvocationID;
+  uint index = gl_GlobalInvocationID.x;
+  if ((index >= 5u)) {
+    return;
+  }
+  float2 vPos = asfloat(particlesA.Load2((16u * index)));
+  float2 vVel = asfloat(particlesA.Load2(((16u * index) + 8u)));
+  float2 cMass = float2(0.0f, 0.0f);
+  float2 cVel = float2(0.0f, 0.0f);
+  float2 colVel = float2(0.0f, 0.0f);
+  int cMassCount = 0;
+  int cVelCount = 0;
+  float2 pos = float2(0.0f, 0.0f);
+  float2 vel = float2(0.0f, 0.0f);
+  {
+    uint i = 0u;
+    {
+      bool tint_hlsl_is_first_1 = true;
+      for(;;) {
+        if (!tint_hlsl_is_first_1) {
+          i = (i + 1u);
+        }
+        tint_hlsl_is_first_1 = false;
+
+        if (!((i < 5u))) {
+          break;
+        }
+        if ((i == index)) {
+          continue;
+        }
+        pos = asfloat(particlesA.Load2((16u * i))).xy;
+        vel = asfloat(particlesA.Load2(((16u * i) + 8u))).xy;
+        if ((        distance(pos, vPos) < params.rule1Distance)) {
+          cMass = (cMass + pos);
+          cMassCount = (cMassCount + 1);
+        }
+        if ((        distance(pos, vPos) < params.rule2Distance)) {
+          colVel = (colVel - (pos - vPos));
+        }
+        if ((        distance(pos, vPos) < params.rule3Distance)) {
+          cVel = (cVel + vel);
+          cVelCount = (cVelCount + 1);
+        }
+      }
+    }
+  }
+  if ((cMassCount > 0)) {
+    cMass = ((cMass / float2(float(cMassCount), float(cMassCount))) - vPos);
+  }
+  if ((cVelCount > 0)) {
+    cVel = (cVel / float2(float(cVelCount), float(cVelCount)));
+  }
+  vVel = (((vVel + (cMass * params.rule1Scale)) + (colVel * params.rule2Scale)) + (cVel * params.rule3Scale));
+  vVel = (  normalize(vVel) *   clamp(  length(vVel), 0.0f, 0.100000001f));
+  vPos = (vPos + (vVel * params.deltaT));
+  if ((vPos.x < -1.0f)) {
+    vPos.x = 1.0f;
+  }
+  if ((vPos.x > 1.0f)) {
+    vPos.x = -1.0f;
+  }
+  if ((vPos.y < -1.0f)) {
+    vPos.y = 1.0f;
+  }
+  if ((vPos.y > 1.0f)) {
+    vPos.y = -1.0f;
+  }
+  particlesB.Store2((16u * index), asuint(vPos));
+  particlesB.Store2(((16u * index) + 8u), asuint(vVel));
+  return;
+}
+
diff --git a/test/samples/compute_boids.wgsl.expected.msl b/test/samples/compute_boids.wgsl.expected.msl
new file mode 100644
index 0000000..05afb51
--- /dev/null
+++ b/test/samples/compute_boids.wgsl.expected.msl
@@ -0,0 +1,120 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+  float2 a_particlePos [[attribute(0)]];
+  float2 a_particleVel [[attribute(1)]];
+  float2 a_pos [[attribute(2)]];
+};
+struct tint_symbol_2 {
+  float4 value [[position]];
+};
+struct tint_symbol_3 {
+  float4 value [[color(0)]];
+};
+struct Particle {
+  /* 0x0000 */ packed_float2 pos;
+  /* 0x0008 */ packed_float2 vel;
+};
+struct SimParams {
+  /* 0x0000 */ float deltaT;
+  /* 0x0004 */ float rule1Distance;
+  /* 0x0008 */ float rule2Distance;
+  /* 0x000c */ float rule3Distance;
+  /* 0x0010 */ float rule1Scale;
+  /* 0x0014 */ float rule2Scale;
+  /* 0x0018 */ float rule3Scale;
+};
+struct Particles {
+  /* 0x0000 */ Particle particles[5];
+};
+struct tint_symbol_5 {
+  uint3 gl_GlobalInvocationID [[thread_position_in_grid]];
+};
+
+vertex tint_symbol_2 vert_main(tint_symbol_1 tint_symbol [[stage_in]]) {
+  const float2 a_particlePos = tint_symbol.a_particlePos;
+  const float2 a_particleVel = tint_symbol.a_particleVel;
+  const float2 a_pos = tint_symbol.a_pos;
+  float angle = -(  atan2(a_particleVel.x, a_particleVel.y));
+  float2 pos = float2(((a_pos.x *   cos(angle)) - (a_pos.y *   sin(angle))), ((a_pos.x *   sin(angle)) + (a_pos.y *   cos(angle))));
+  return {float4((pos + a_particlePos), 0.0f, 1.0f)};
+}
+
+fragment tint_symbol_3 frag_main() {
+  return {float4(1.0f, 1.0f, 1.0f, 1.0f)};
+}
+
+kernel void comp_main(tint_symbol_5 tint_symbol_4 [[stage_in]], constant SimParams& params [[buffer(0)]], device Particles& particlesA [[buffer(1)]], device Particles& particlesB [[buffer(2)]]) {
+  const uint3 gl_GlobalInvocationID = tint_symbol_4.gl_GlobalInvocationID;
+  uint index = gl_GlobalInvocationID.x;
+  if ((index >= 5u)) {
+    return;
+  }
+  float2 vPos = particlesA.particles[index].pos;
+  float2 vVel = particlesA.particles[index].vel;
+  float2 cMass = float2(0.0f, 0.0f);
+  float2 cVel = float2(0.0f, 0.0f);
+  float2 colVel = float2(0.0f, 0.0f);
+  int cMassCount = 0;
+  int cVelCount = 0;
+  float2 pos = 0.0f;
+  float2 vel = 0.0f;
+  {
+    uint i = 0u;
+    {
+      bool tint_msl_is_first_1 = true;
+      for(;;) {
+        if (!tint_msl_is_first_1) {
+          i = (i + 1u);
+        }
+        tint_msl_is_first_1 = false;
+
+        if (!((i < 5u))) {
+          break;
+        }
+        if ((i == index)) {
+          continue;
+        }
+        pos = particlesA.particles[i].pos.xy;
+        vel = particlesA.particles[i].vel.xy;
+        if ((        distance(pos, vPos) < params.rule1Distance)) {
+          cMass = (cMass + pos);
+          cMassCount = (cMassCount + 1);
+        }
+        if ((        distance(pos, vPos) < params.rule2Distance)) {
+          colVel = (colVel - (pos - vPos));
+        }
+        if ((        distance(pos, vPos) < params.rule3Distance)) {
+          cVel = (cVel + vel);
+          cVelCount = (cVelCount + 1);
+        }
+      }
+    }
+  }
+  if ((cMassCount > 0)) {
+    cMass = ((cMass / float2(float(cMassCount), float(cMassCount))) - vPos);
+  }
+  if ((cVelCount > 0)) {
+    cVel = (cVel / float2(float(cVelCount), float(cVelCount)));
+  }
+  vVel = (((vVel + (cMass * params.rule1Scale)) + (colVel * params.rule2Scale)) + (cVel * params.rule3Scale));
+  vVel = (  normalize(vVel) *   clamp(  length(vVel), 0.0f, 0.100000001f));
+  vPos = (vPos + (vVel * params.deltaT));
+  if ((vPos.x < -1.0f)) {
+    vPos.x = 1.0f;
+  }
+  if ((vPos.x > 1.0f)) {
+    vPos.x = -1.0f;
+  }
+  if ((vPos.y < -1.0f)) {
+    vPos.y = 1.0f;
+  }
+  if ((vPos.y > 1.0f)) {
+    vPos.y = -1.0f;
+  }
+  particlesB.particles[index].pos = vPos;
+  particlesB.particles[index].vel = vVel;
+  return;
+}
+
diff --git a/test/samples/compute_boids.wgsl.expected.spvasm b/test/samples/compute_boids.wgsl.expected.spvasm
new file mode 100644
index 0000000..a164a17
--- /dev/null
+++ b/test/samples/compute_boids.wgsl.expected.spvasm
@@ -0,0 +1,443 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 279
+; Schema: 0
+               OpCapability Shader
+         %40 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vert_main "vert_main" %tint_pointsize %tint_symbol_1 %tint_symbol_2 %tint_symbol %tint_symbol_4
+               OpEntryPoint Fragment %frag_main "frag_main" %tint_symbol_7
+               OpEntryPoint GLCompute %comp_main "comp_main" %tint_symbol_9
+               OpExecutionMode %frag_main OriginUpperLeft
+               OpExecutionMode %comp_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %tint_symbol "tint_symbol"
+               OpName %tint_symbol_1 "tint_symbol_1"
+               OpName %tint_symbol_2 "tint_symbol_2"
+               OpName %tint_symbol_4 "tint_symbol_4"
+               OpName %tint_symbol_7 "tint_symbol_7"
+               OpName %SimParams "SimParams"
+               OpMemberName %SimParams 0 "deltaT"
+               OpMemberName %SimParams 1 "rule1Distance"
+               OpMemberName %SimParams 2 "rule2Distance"
+               OpMemberName %SimParams 3 "rule3Distance"
+               OpMemberName %SimParams 4 "rule1Scale"
+               OpMemberName %SimParams 5 "rule2Scale"
+               OpMemberName %SimParams 6 "rule3Scale"
+               OpName %params "params"
+               OpName %Particles "Particles"
+               OpMemberName %Particles 0 "particles"
+               OpName %Particle "Particle"
+               OpMemberName %Particle 0 "pos"
+               OpMemberName %Particle 1 "vel"
+               OpName %particlesA "particlesA"
+               OpName %particlesB "particlesB"
+               OpName %tint_symbol_9 "tint_symbol_9"
+               OpName %tint_symbol_5 "tint_symbol_5"
+               OpName %tint_symbol_3 "tint_symbol_3"
+               OpName %vert_main "vert_main"
+               OpName %angle "angle"
+               OpName %pos "pos"
+               OpName %tint_symbol_8 "tint_symbol_8"
+               OpName %tint_symbol_6 "tint_symbol_6"
+               OpName %frag_main "frag_main"
+               OpName %comp_main "comp_main"
+               OpName %index "index"
+               OpName %vPos "vPos"
+               OpName %vVel "vVel"
+               OpName %cMass "cMass"
+               OpName %cVel "cVel"
+               OpName %colVel "colVel"
+               OpName %cMassCount "cMassCount"
+               OpName %cVelCount "cVelCount"
+               OpName %pos_0 "pos"
+               OpName %vel "vel"
+               OpName %i "i"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+               OpDecorate %tint_symbol Location 0
+               OpDecorate %tint_symbol_1 Location 1
+               OpDecorate %tint_symbol_2 Location 2
+               OpDecorate %tint_symbol_4 BuiltIn Position
+               OpDecorate %tint_symbol_7 Location 0
+               OpDecorate %SimParams Block
+               OpMemberDecorate %SimParams 0 Offset 0
+               OpMemberDecorate %SimParams 1 Offset 4
+               OpMemberDecorate %SimParams 2 Offset 8
+               OpMemberDecorate %SimParams 3 Offset 12
+               OpMemberDecorate %SimParams 4 Offset 16
+               OpMemberDecorate %SimParams 5 Offset 20
+               OpMemberDecorate %SimParams 6 Offset 24
+               OpDecorate %params Binding 0
+               OpDecorate %params DescriptorSet 0
+               OpDecorate %Particles Block
+               OpMemberDecorate %Particles 0 Offset 0
+               OpMemberDecorate %Particle 0 Offset 0
+               OpMemberDecorate %Particle 1 Offset 8
+               OpDecorate %_arr_Particle_uint_5 ArrayStride 16
+               OpDecorate %particlesA Binding 1
+               OpDecorate %particlesA DescriptorSet 0
+               OpDecorate %particlesB Binding 2
+               OpDecorate %particlesB DescriptorSet 0
+               OpDecorate %tint_symbol_9 BuiltIn GlobalInvocationId
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+    %v2float = OpTypeVector %float 2
+%_ptr_Input_v2float = OpTypePointer Input %v2float
+%tint_symbol = OpVariable %_ptr_Input_v2float Input
+%tint_symbol_1 = OpVariable %_ptr_Input_v2float Input
+%tint_symbol_2 = OpVariable %_ptr_Input_v2float Input
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+         %13 = OpConstantNull %v4float
+%tint_symbol_4 = OpVariable %_ptr_Output_v4float Output %13
+%tint_symbol_7 = OpVariable %_ptr_Output_v4float Output %13
+  %SimParams = OpTypeStruct %float %float %float %float %float %float %float
+%_ptr_Uniform_SimParams = OpTypePointer Uniform %SimParams
+     %params = OpVariable %_ptr_Uniform_SimParams Uniform
+   %Particle = OpTypeStruct %v2float %v2float
+       %uint = OpTypeInt 32 0
+     %uint_5 = OpConstant %uint 5
+%_arr_Particle_uint_5 = OpTypeArray %Particle %uint_5
+  %Particles = OpTypeStruct %_arr_Particle_uint_5
+%_ptr_StorageBuffer_Particles = OpTypePointer StorageBuffer %Particles
+ %particlesA = OpVariable %_ptr_StorageBuffer_Particles StorageBuffer
+ %particlesB = OpVariable %_ptr_StorageBuffer_Particles StorageBuffer
+     %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol_9 = OpVariable %_ptr_Input_v3uint Input
+       %void = OpTypeVoid
+         %29 = OpTypeFunction %void %v4float
+         %34 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+     %uint_0 = OpConstant %uint 0
+%_ptr_Input_float = OpTypePointer Input %float
+     %uint_1 = OpConstant %uint 1
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+         %75 = OpConstantNull %v2float
+    %float_0 = OpConstant %float 0
+         %90 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+         %98 = OpConstantNull %uint
+       %bool = OpTypeBool
+%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
+        %113 = OpConstantComposite %v2float %float_0 %float_0
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+%_ptr_Function_int = OpTypePointer Function %int
+        %121 = OpConstantNull %int
+%_ptr_Uniform_float = OpTypePointer Uniform %float
+      %int_1 = OpConstant %int 1
+     %uint_2 = OpConstant %uint 2
+     %uint_3 = OpConstant %uint 3
+     %uint_4 = OpConstant %uint 4
+     %uint_6 = OpConstant %uint 6
+%float_0_100000001 = OpConstant %float 0.100000001
+   %float_n1 = OpConstant %float -1
+%tint_symbol_5 = OpFunction %void None %29
+%tint_symbol_3 = OpFunctionParameter %v4float
+         %33 = OpLabel
+               OpStore %tint_symbol_4 %tint_symbol_3
+               OpReturn
+               OpFunctionEnd
+  %vert_main = OpFunction %void None %34
+         %36 = OpLabel
+      %angle = OpVariable %_ptr_Function_float Function %4
+        %pos = OpVariable %_ptr_Function_v2float Function %75
+               OpStore %tint_pointsize %float_1
+         %43 = OpAccessChain %_ptr_Input_float %tint_symbol_1 %uint_0
+         %44 = OpLoad %float %43
+         %46 = OpAccessChain %_ptr_Input_float %tint_symbol_1 %uint_1
+         %47 = OpLoad %float %46
+         %39 = OpExtInst %float %40 Atan2 %44 %47
+         %38 = OpFNegate %float %39
+               OpStore %angle %38
+         %50 = OpAccessChain %_ptr_Input_float %tint_symbol_2 %uint_0
+         %51 = OpLoad %float %50
+         %53 = OpLoad %float %angle
+         %52 = OpExtInst %float %40 Cos %53
+         %54 = OpFMul %float %51 %52
+         %55 = OpAccessChain %_ptr_Input_float %tint_symbol_2 %uint_1
+         %56 = OpLoad %float %55
+         %58 = OpLoad %float %angle
+         %57 = OpExtInst %float %40 Sin %58
+         %59 = OpFMul %float %56 %57
+         %60 = OpFSub %float %54 %59
+         %61 = OpAccessChain %_ptr_Input_float %tint_symbol_2 %uint_0
+         %62 = OpLoad %float %61
+         %64 = OpLoad %float %angle
+         %63 = OpExtInst %float %40 Sin %64
+         %65 = OpFMul %float %62 %63
+         %66 = OpAccessChain %_ptr_Input_float %tint_symbol_2 %uint_1
+         %67 = OpLoad %float %66
+         %69 = OpLoad %float %angle
+         %68 = OpExtInst %float %40 Cos %69
+         %70 = OpFMul %float %67 %68
+         %71 = OpFAdd %float %65 %70
+         %72 = OpCompositeConstruct %v2float %60 %71
+               OpStore %pos %72
+         %77 = OpLoad %v2float %pos
+         %78 = OpLoad %v2float %tint_symbol
+         %79 = OpFAdd %v2float %77 %78
+         %80 = OpCompositeExtract %float %79 0
+         %81 = OpCompositeExtract %float %79 1
+         %83 = OpCompositeConstruct %v4float %80 %81 %float_0 %float_1
+         %76 = OpFunctionCall %void %tint_symbol_5 %83
+               OpReturn
+               OpFunctionEnd
+%tint_symbol_8 = OpFunction %void None %29
+%tint_symbol_6 = OpFunctionParameter %v4float
+         %86 = OpLabel
+               OpStore %tint_symbol_7 %tint_symbol_6
+               OpReturn
+               OpFunctionEnd
+  %frag_main = OpFunction %void None %34
+         %88 = OpLabel
+         %89 = OpFunctionCall %void %tint_symbol_8 %90
+               OpReturn
+               OpFunctionEnd
+  %comp_main = OpFunction %void None %34
+         %92 = OpLabel
+      %index = OpVariable %_ptr_Function_uint Function %98
+       %vPos = OpVariable %_ptr_Function_v2float Function %75
+       %vVel = OpVariable %_ptr_Function_v2float Function %75
+      %cMass = OpVariable %_ptr_Function_v2float Function %75
+       %cVel = OpVariable %_ptr_Function_v2float Function %75
+     %colVel = OpVariable %_ptr_Function_v2float Function %75
+ %cMassCount = OpVariable %_ptr_Function_int Function %121
+  %cVelCount = OpVariable %_ptr_Function_int Function %121
+      %pos_0 = OpVariable %_ptr_Function_v2float Function %75
+        %vel = OpVariable %_ptr_Function_v2float Function %75
+          %i = OpVariable %_ptr_Function_uint Function %98
+         %94 = OpAccessChain %_ptr_Input_uint %tint_symbol_9 %uint_0
+         %95 = OpLoad %uint %94
+               OpStore %index %95
+         %99 = OpLoad %uint %index
+        %100 = OpUGreaterThanEqual %bool %99 %uint_5
+               OpSelectionMerge %102 None
+               OpBranchConditional %100 %103 %102
+        %103 = OpLabel
+               OpReturn
+        %102 = OpLabel
+        %104 = OpLoad %uint %index
+        %106 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %104 %uint_0
+        %107 = OpLoad %v2float %106
+               OpStore %vPos %107
+        %109 = OpLoad %uint %index
+        %110 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %109 %uint_1
+        %111 = OpLoad %v2float %110
+               OpStore %vVel %111
+               OpStore %cMass %113
+               OpStore %cVel %113
+               OpStore %colVel %113
+               OpStore %cMassCount %int_0
+               OpStore %cVelCount %int_0
+               OpStore %i %uint_0
+               OpBranch %126
+        %126 = OpLabel
+               OpLoopMerge %127 %128 None
+               OpBranch %129
+        %129 = OpLabel
+        %131 = OpLoad %uint %i
+        %132 = OpULessThan %bool %131 %uint_5
+        %130 = OpLogicalNot %bool %132
+               OpSelectionMerge %133 None
+               OpBranchConditional %130 %134 %133
+        %134 = OpLabel
+               OpBranch %127
+        %133 = OpLabel
+        %135 = OpLoad %uint %i
+        %136 = OpLoad %uint %index
+        %137 = OpIEqual %bool %135 %136
+               OpSelectionMerge %138 None
+               OpBranchConditional %137 %139 %138
+        %139 = OpLabel
+               OpBranch %128
+        %138 = OpLabel
+        %140 = OpLoad %uint %i
+        %141 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %140 %uint_0
+        %142 = OpLoad %v2float %141
+        %143 = OpVectorShuffle %v2float %142 %142 0 1
+               OpStore %pos_0 %143
+        %144 = OpLoad %uint %i
+        %145 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %144 %uint_1
+        %146 = OpLoad %v2float %145
+        %147 = OpVectorShuffle %v2float %146 %146 0 1
+               OpStore %vel %147
+        %149 = OpLoad %v2float %pos_0
+        %150 = OpLoad %v2float %vPos
+        %148 = OpExtInst %float %40 Distance %149 %150
+        %152 = OpAccessChain %_ptr_Uniform_float %params %uint_1
+        %153 = OpLoad %float %152
+        %154 = OpFOrdLessThan %bool %148 %153
+               OpSelectionMerge %155 None
+               OpBranchConditional %154 %156 %155
+        %156 = OpLabel
+        %157 = OpLoad %v2float %cMass
+        %158 = OpLoad %v2float %pos_0
+        %159 = OpFAdd %v2float %157 %158
+               OpStore %cMass %159
+        %160 = OpLoad %int %cMassCount
+        %162 = OpIAdd %int %160 %int_1
+               OpStore %cMassCount %162
+               OpBranch %155
+        %155 = OpLabel
+        %164 = OpLoad %v2float %pos_0
+        %165 = OpLoad %v2float %vPos
+        %163 = OpExtInst %float %40 Distance %164 %165
+        %167 = OpAccessChain %_ptr_Uniform_float %params %uint_2
+        %168 = OpLoad %float %167
+        %169 = OpFOrdLessThan %bool %163 %168
+               OpSelectionMerge %170 None
+               OpBranchConditional %169 %171 %170
+        %171 = OpLabel
+        %172 = OpLoad %v2float %colVel
+        %173 = OpLoad %v2float %pos_0
+        %174 = OpLoad %v2float %vPos
+        %175 = OpFSub %v2float %173 %174
+        %176 = OpFSub %v2float %172 %175
+               OpStore %colVel %176
+               OpBranch %170
+        %170 = OpLabel
+        %178 = OpLoad %v2float %pos_0
+        %179 = OpLoad %v2float %vPos
+        %177 = OpExtInst %float %40 Distance %178 %179
+        %181 = OpAccessChain %_ptr_Uniform_float %params %uint_3
+        %182 = OpLoad %float %181
+        %183 = OpFOrdLessThan %bool %177 %182
+               OpSelectionMerge %184 None
+               OpBranchConditional %183 %185 %184
+        %185 = OpLabel
+        %186 = OpLoad %v2float %cVel
+        %187 = OpLoad %v2float %vel
+        %188 = OpFAdd %v2float %186 %187
+               OpStore %cVel %188
+        %189 = OpLoad %int %cVelCount
+        %190 = OpIAdd %int %189 %int_1
+               OpStore %cVelCount %190
+               OpBranch %184
+        %184 = OpLabel
+               OpBranch %128
+        %128 = OpLabel
+        %191 = OpLoad %uint %i
+        %192 = OpIAdd %uint %191 %uint_1
+               OpStore %i %192
+               OpBranch %126
+        %127 = OpLabel
+        %193 = OpLoad %int %cMassCount
+        %194 = OpSGreaterThan %bool %193 %int_0
+               OpSelectionMerge %195 None
+               OpBranchConditional %194 %196 %195
+        %196 = OpLabel
+        %197 = OpLoad %v2float %cMass
+        %199 = OpLoad %int %cMassCount
+        %198 = OpConvertSToF %float %199
+        %201 = OpLoad %int %cMassCount
+        %200 = OpConvertSToF %float %201
+        %202 = OpCompositeConstruct %v2float %198 %200
+        %203 = OpFDiv %v2float %197 %202
+        %204 = OpLoad %v2float %vPos
+        %205 = OpFSub %v2float %203 %204
+               OpStore %cMass %205
+               OpBranch %195
+        %195 = OpLabel
+        %206 = OpLoad %int %cVelCount
+        %207 = OpSGreaterThan %bool %206 %int_0
+               OpSelectionMerge %208 None
+               OpBranchConditional %207 %209 %208
+        %209 = OpLabel
+        %210 = OpLoad %v2float %cVel
+        %212 = OpLoad %int %cVelCount
+        %211 = OpConvertSToF %float %212
+        %214 = OpLoad %int %cVelCount
+        %213 = OpConvertSToF %float %214
+        %215 = OpCompositeConstruct %v2float %211 %213
+        %216 = OpFDiv %v2float %210 %215
+               OpStore %cVel %216
+               OpBranch %208
+        %208 = OpLabel
+        %217 = OpLoad %v2float %vVel
+        %218 = OpLoad %v2float %cMass
+        %220 = OpAccessChain %_ptr_Uniform_float %params %uint_4
+        %221 = OpLoad %float %220
+        %222 = OpVectorTimesScalar %v2float %218 %221
+        %223 = OpFAdd %v2float %217 %222
+        %224 = OpLoad %v2float %colVel
+        %225 = OpAccessChain %_ptr_Uniform_float %params %uint_5
+        %226 = OpLoad %float %225
+        %227 = OpVectorTimesScalar %v2float %224 %226
+        %228 = OpFAdd %v2float %223 %227
+        %229 = OpLoad %v2float %cVel
+        %231 = OpAccessChain %_ptr_Uniform_float %params %uint_6
+        %232 = OpLoad %float %231
+        %233 = OpVectorTimesScalar %v2float %229 %232
+        %234 = OpFAdd %v2float %228 %233
+               OpStore %vVel %234
+        %236 = OpLoad %v2float %vVel
+        %235 = OpExtInst %v2float %40 Normalize %236
+        %239 = OpLoad %v2float %vVel
+        %238 = OpExtInst %float %40 Length %239
+        %237 = OpExtInst %float %40 NClamp %238 %float_0 %float_0_100000001
+        %241 = OpVectorTimesScalar %v2float %235 %237
+               OpStore %vVel %241
+        %242 = OpLoad %v2float %vPos
+        %243 = OpLoad %v2float %vVel
+        %244 = OpAccessChain %_ptr_Uniform_float %params %uint_0
+        %245 = OpLoad %float %244
+        %246 = OpVectorTimesScalar %v2float %243 %245
+        %247 = OpFAdd %v2float %242 %246
+               OpStore %vPos %247
+        %248 = OpAccessChain %_ptr_Function_float %vPos %uint_0
+        %249 = OpLoad %float %248
+        %251 = OpFOrdLessThan %bool %249 %float_n1
+               OpSelectionMerge %252 None
+               OpBranchConditional %251 %253 %252
+        %253 = OpLabel
+        %254 = OpAccessChain %_ptr_Function_float %vPos %uint_0
+               OpStore %254 %float_1
+               OpBranch %252
+        %252 = OpLabel
+        %255 = OpAccessChain %_ptr_Function_float %vPos %uint_0
+        %256 = OpLoad %float %255
+        %257 = OpFOrdGreaterThan %bool %256 %float_1
+               OpSelectionMerge %258 None
+               OpBranchConditional %257 %259 %258
+        %259 = OpLabel
+        %260 = OpAccessChain %_ptr_Function_float %vPos %uint_0
+               OpStore %260 %float_n1
+               OpBranch %258
+        %258 = OpLabel
+        %261 = OpAccessChain %_ptr_Function_float %vPos %uint_1
+        %262 = OpLoad %float %261
+        %263 = OpFOrdLessThan %bool %262 %float_n1
+               OpSelectionMerge %264 None
+               OpBranchConditional %263 %265 %264
+        %265 = OpLabel
+        %266 = OpAccessChain %_ptr_Function_float %vPos %uint_1
+               OpStore %266 %float_1
+               OpBranch %264
+        %264 = OpLabel
+        %267 = OpAccessChain %_ptr_Function_float %vPos %uint_1
+        %268 = OpLoad %float %267
+        %269 = OpFOrdGreaterThan %bool %268 %float_1
+               OpSelectionMerge %270 None
+               OpBranchConditional %269 %271 %270
+        %271 = OpLabel
+        %272 = OpAccessChain %_ptr_Function_float %vPos %uint_1
+               OpStore %272 %float_n1
+               OpBranch %270
+        %270 = OpLabel
+        %273 = OpLoad %uint %index
+        %274 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %273 %uint_0
+        %275 = OpLoad %v2float %vPos
+               OpStore %274 %275
+        %276 = OpLoad %uint %index
+        %277 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %276 %uint_1
+        %278 = OpLoad %v2float %vVel
+               OpStore %277 %278
+               OpReturn
+               OpFunctionEnd
diff --git a/test/samples/compute_boids.wgsl.expected.wgsl b/test/samples/compute_boids.wgsl.expected.wgsl
new file mode 100644
index 0000000..882e263
--- /dev/null
+++ b/test/samples/compute_boids.wgsl.expected.wgsl
@@ -0,0 +1,106 @@
+[[stage(vertex)]]
+fn vert_main([[location(0)]] a_particlePos : vec2<f32>, [[location(1)]] a_particleVel : vec2<f32>, [[location(2)]] a_pos : vec2<f32>) -> [[builtin(position)]] vec4<f32> {
+  var angle : f32 = -(atan2(a_particleVel.x, a_particleVel.y));
+  var pos : vec2<f32> = vec2<f32>(((a_pos.x * cos(angle)) - (a_pos.y * sin(angle))), ((a_pos.x * sin(angle)) + (a_pos.y * cos(angle))));
+  return vec4<f32>((pos + a_particlePos), 0.0, 1.0);
+}
+
+[[stage(fragment)]]
+fn frag_main() -> [[location(0)]] vec4<f32> {
+  return vec4<f32>(1.0, 1.0, 1.0, 1.0);
+}
+
+struct Particle {
+  pos : vec2<f32>;
+  vel : vec2<f32>;
+};
+
+[[block]]
+struct SimParams {
+  deltaT : f32;
+  rule1Distance : f32;
+  rule2Distance : f32;
+  rule3Distance : f32;
+  rule1Scale : f32;
+  rule2Scale : f32;
+  rule3Scale : f32;
+};
+
+[[block]]
+struct Particles {
+  particles : array<Particle, 5>;
+};
+
+[[binding(0), group(0)]] var<uniform> params : SimParams;
+
+[[binding(1), group(0)]] var<storage> particlesA : [[access(read_write)]] Particles;
+
+[[binding(2), group(0)]] var<storage> particlesB : [[access(read_write)]] Particles;
+
+[[stage(compute)]]
+fn comp_main([[builtin(global_invocation_id)]] gl_GlobalInvocationID : vec3<u32>) {
+  var index : u32 = gl_GlobalInvocationID.x;
+  if ((index >= 5u)) {
+    return;
+  }
+  var vPos : vec2<f32> = particlesA.particles[index].pos;
+  var vVel : vec2<f32> = particlesA.particles[index].vel;
+  var cMass : vec2<f32> = vec2<f32>(0.0, 0.0);
+  var cVel : vec2<f32> = vec2<f32>(0.0, 0.0);
+  var colVel : vec2<f32> = vec2<f32>(0.0, 0.0);
+  var cMassCount : i32 = 0;
+  var cVelCount : i32 = 0;
+  var pos : vec2<f32>;
+  var vel : vec2<f32>;
+  {
+    var i : u32 = 0u;
+    loop {
+      if (!((i < 5u))) {
+        break;
+      }
+      if ((i == index)) {
+        continue;
+      }
+      pos = particlesA.particles[i].pos.xy;
+      vel = particlesA.particles[i].vel.xy;
+      if ((distance(pos, vPos) < params.rule1Distance)) {
+        cMass = (cMass + pos);
+        cMassCount = (cMassCount + 1);
+      }
+      if ((distance(pos, vPos) < params.rule2Distance)) {
+        colVel = (colVel - (pos - vPos));
+      }
+      if ((distance(pos, vPos) < params.rule3Distance)) {
+        cVel = (cVel + vel);
+        cVelCount = (cVelCount + 1);
+      }
+
+      continuing {
+        i = (i + 1u);
+      }
+    }
+  }
+  if ((cMassCount > 0)) {
+    cMass = ((cMass / vec2<f32>(f32(cMassCount), f32(cMassCount))) - vPos);
+  }
+  if ((cVelCount > 0)) {
+    cVel = (cVel / vec2<f32>(f32(cVelCount), f32(cVelCount)));
+  }
+  vVel = (((vVel + (cMass * params.rule1Scale)) + (colVel * params.rule2Scale)) + (cVel * params.rule3Scale));
+  vVel = (normalize(vVel) * clamp(length(vVel), 0.0, 0.100000001));
+  vPos = (vPos + (vVel * params.deltaT));
+  if ((vPos.x < -1.0)) {
+    vPos.x = 1.0;
+  }
+  if ((vPos.x > 1.0)) {
+    vPos.x = -1.0;
+  }
+  if ((vPos.y < -1.0)) {
+    vPos.y = 1.0;
+  }
+  if ((vPos.y > 1.0)) {
+    vPos.y = -1.0;
+  }
+  particlesB.particles[index].pos = vPos;
+  particlesB.particles[index].vel = vVel;
+}
diff --git a/test/samples/cube.wgsl.expected.hlsl b/test/samples/cube.wgsl.expected.hlsl
new file mode 100644
index 0000000..c15b578
--- /dev/null
+++ b/test/samples/cube.wgsl.expected.hlsl
@@ -0,0 +1,43 @@
+struct Uniforms {
+  float4x4 modelViewProjectionMatrix;
+};
+struct VertexInput {
+  float4 cur_position;
+  float4 color;
+};
+struct VertexOutput {
+  float4 vtxFragColor;
+  float4 Position;
+};
+struct tint_symbol_1 {
+  float4 cur_position : TEXCOORD0;
+  float4 color : TEXCOORD1;
+};
+struct tint_symbol_2 {
+  float4 vtxFragColor : TEXCOORD0;
+  float4 Position : SV_Position;
+};
+struct tint_symbol_4 {
+  float4 fragColor : TEXCOORD0;
+};
+struct tint_symbol_5 {
+  float4 value : SV_Target0;
+};
+
+ConstantBuffer<Uniforms> uniforms : register(b0, space0);
+
+tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) {
+  const VertexInput input = {tint_symbol.cur_position, tint_symbol.color};
+  VertexOutput output = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)};
+  output.Position = mul(input.cur_position, uniforms.modelViewProjectionMatrix);
+  output.vtxFragColor = input.color;
+  const tint_symbol_2 tint_symbol_6 = {output.vtxFragColor, output.Position};
+  return tint_symbol_6;
+}
+
+tint_symbol_5 frag_main(tint_symbol_4 tint_symbol_3) {
+  const float4 fragColor = tint_symbol_3.fragColor;
+  const tint_symbol_5 tint_symbol_7 = {fragColor};
+  return tint_symbol_7;
+}
+
diff --git a/test/samples/cube.wgsl.expected.msl b/test/samples/cube.wgsl.expected.msl
new file mode 100644
index 0000000..4d86279
--- /dev/null
+++ b/test/samples/cube.wgsl.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct Uniforms {
+  /* 0x0000 */ float4x4 modelViewProjectionMatrix;
+};
+struct VertexInput {
+  float4 cur_position;
+  float4 color;
+};
+struct VertexOutput {
+  float4 vtxFragColor;
+  float4 Position;
+};
+struct tint_symbol_1 {
+  float4 cur_position [[attribute(0)]];
+  float4 color [[attribute(1)]];
+};
+struct tint_symbol_2 {
+  float4 vtxFragColor [[user(locn0)]];
+  float4 Position [[position]];
+};
+struct tint_symbol_4 {
+  float4 fragColor [[user(locn0)]];
+};
+struct tint_symbol_5 {
+  float4 value [[color(0)]];
+};
+
+vertex tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol [[stage_in]], constant Uniforms& uniforms [[buffer(0)]]) {
+  const VertexInput input = {tint_symbol.cur_position, tint_symbol.color};
+  VertexOutput output = {};
+  output.Position = (uniforms.modelViewProjectionMatrix * input.cur_position);
+  output.vtxFragColor = input.color;
+  return {output.vtxFragColor, output.Position};
+}
+
+fragment tint_symbol_5 frag_main(tint_symbol_4 tint_symbol_3 [[stage_in]]) {
+  const float4 fragColor = tint_symbol_3.fragColor;
+  return {fragColor};
+}
+
diff --git a/test/samples/cube.wgsl.expected.spvasm b/test/samples/cube.wgsl.expected.spvasm
new file mode 100644
index 0000000..8323589
--- /dev/null
+++ b/test/samples/cube.wgsl.expected.spvasm
@@ -0,0 +1,123 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 60
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vtx_main "vtx_main" %tint_pointsize %tint_symbol %tint_symbol_1 %tint_symbol_4 %tint_symbol_5
+               OpEntryPoint Fragment %frag_main "frag_main" %tint_symbol_7 %tint_symbol_9
+               OpExecutionMode %frag_main OriginUpperLeft
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %Uniforms "Uniforms"
+               OpMemberName %Uniforms 0 "modelViewProjectionMatrix"
+               OpName %uniforms "uniforms"
+               OpName %tint_symbol "tint_symbol"
+               OpName %tint_symbol_1 "tint_symbol_1"
+               OpName %tint_symbol_4 "tint_symbol_4"
+               OpName %tint_symbol_5 "tint_symbol_5"
+               OpName %tint_symbol_7 "tint_symbol_7"
+               OpName %tint_symbol_9 "tint_symbol_9"
+               OpName %VertexOutput "VertexOutput"
+               OpMemberName %VertexOutput 0 "vtxFragColor"
+               OpMemberName %VertexOutput 1 "Position"
+               OpName %tint_symbol_6 "tint_symbol_6"
+               OpName %tint_symbol_3 "tint_symbol_3"
+               OpName %vtx_main "vtx_main"
+               OpName %VertexInput "VertexInput"
+               OpMemberName %VertexInput 0 "cur_position"
+               OpMemberName %VertexInput 1 "color"
+               OpName %output "output"
+               OpName %tint_symbol_10 "tint_symbol_10"
+               OpName %tint_symbol_8 "tint_symbol_8"
+               OpName %frag_main "frag_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+               OpDecorate %Uniforms Block
+               OpMemberDecorate %Uniforms 0 Offset 0
+               OpMemberDecorate %Uniforms 0 ColMajor
+               OpMemberDecorate %Uniforms 0 MatrixStride 16
+               OpDecorate %uniforms Binding 0
+               OpDecorate %uniforms DescriptorSet 0
+               OpDecorate %tint_symbol Location 0
+               OpDecorate %tint_symbol_1 Location 1
+               OpDecorate %tint_symbol_4 Location 0
+               OpDecorate %tint_symbol_5 BuiltIn Position
+               OpDecorate %tint_symbol_7 Location 0
+               OpDecorate %tint_symbol_9 Location 0
+               OpMemberDecorate %VertexOutput 0 Offset 0
+               OpMemberDecorate %VertexOutput 1 Offset 16
+               OpMemberDecorate %VertexInput 0 Offset 0
+               OpMemberDecorate %VertexInput 1 Offset 16
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+    %v4float = OpTypeVector %float 4
+%mat4v4float = OpTypeMatrix %v4float 4
+   %Uniforms = OpTypeStruct %mat4v4float
+%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
+   %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%tint_symbol = OpVariable %_ptr_Input_v4float Input
+%tint_symbol_1 = OpVariable %_ptr_Input_v4float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+         %15 = OpConstantNull %v4float
+%tint_symbol_4 = OpVariable %_ptr_Output_v4float Output %15
+%tint_symbol_5 = OpVariable %_ptr_Output_v4float Output %15
+%tint_symbol_7 = OpVariable %_ptr_Input_v4float Input
+%tint_symbol_9 = OpVariable %_ptr_Output_v4float Output %15
+       %void = OpTypeVoid
+%VertexOutput = OpTypeStruct %v4float %v4float
+         %19 = OpTypeFunction %void %VertexOutput
+         %27 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+%VertexInput = OpTypeStruct %v4float %v4float
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+         %37 = OpConstantNull %VertexOutput
+       %uint = OpTypeInt 32 0
+     %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+     %uint_0 = OpConstant %uint 0
+%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float
+         %52 = OpTypeFunction %void %v4float
+%tint_symbol_6 = OpFunction %void None %19
+%tint_symbol_3 = OpFunctionParameter %VertexOutput
+         %24 = OpLabel
+         %25 = OpCompositeExtract %v4float %tint_symbol_3 0
+               OpStore %tint_symbol_4 %25
+         %26 = OpCompositeExtract %v4float %tint_symbol_3 1
+               OpStore %tint_symbol_5 %26
+               OpReturn
+               OpFunctionEnd
+   %vtx_main = OpFunction %void None %27
+         %29 = OpLabel
+     %output = OpVariable %_ptr_Function_VertexOutput Function %37
+               OpStore %tint_pointsize %float_1
+         %32 = OpLoad %v4float %tint_symbol
+         %33 = OpLoad %v4float %tint_symbol_1
+         %34 = OpCompositeConstruct %VertexInput %32 %33
+         %41 = OpAccessChain %_ptr_Function_v4float %output %uint_1
+         %44 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_0
+         %45 = OpLoad %mat4v4float %44
+         %46 = OpCompositeExtract %v4float %34 0
+         %47 = OpMatrixTimesVector %v4float %45 %46
+               OpStore %41 %47
+         %48 = OpAccessChain %_ptr_Function_v4float %output %uint_0
+         %49 = OpCompositeExtract %v4float %34 1
+               OpStore %48 %49
+         %51 = OpLoad %VertexOutput %output
+         %50 = OpFunctionCall %void %tint_symbol_6 %51
+               OpReturn
+               OpFunctionEnd
+%tint_symbol_10 = OpFunction %void None %52
+%tint_symbol_8 = OpFunctionParameter %v4float
+         %55 = OpLabel
+               OpStore %tint_symbol_9 %tint_symbol_8
+               OpReturn
+               OpFunctionEnd
+  %frag_main = OpFunction %void None %27
+         %57 = OpLabel
+         %59 = OpLoad %v4float %tint_symbol_7
+         %58 = OpFunctionCall %void %tint_symbol_10 %59
+               OpReturn
+               OpFunctionEnd
diff --git a/test/samples/cube.wgsl.expected.wgsl b/test/samples/cube.wgsl.expected.wgsl
new file mode 100644
index 0000000..a53fdec
--- /dev/null
+++ b/test/samples/cube.wgsl.expected.wgsl
@@ -0,0 +1,33 @@
+[[block]]
+struct Uniforms {
+  modelViewProjectionMatrix : mat4x4<f32>;
+};
+
+[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;
+
+struct VertexInput {
+  [[location(0)]]
+  cur_position : vec4<f32>;
+  [[location(1)]]
+  color : vec4<f32>;
+};
+
+struct VertexOutput {
+  [[location(0)]]
+  vtxFragColor : vec4<f32>;
+  [[builtin(position)]]
+  Position : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn vtx_main(input : VertexInput) -> VertexOutput {
+  var output : VertexOutput;
+  output.Position = (uniforms.modelViewProjectionMatrix * input.cur_position);
+  output.vtxFragColor = input.color;
+  return output;
+}
+
+[[stage(fragment)]]
+fn frag_main([[location(0)]] fragColor : vec4<f32>) -> [[location(0)]] vec4<f32> {
+  return fragColor;
+}
diff --git a/test/samples/function.wgsl.expected.hlsl b/test/samples/function.wgsl.expected.hlsl
new file mode 100644
index 0000000..deace9c
--- /dev/null
+++ b/test/samples/function.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+float main() {
+  return (((2.0f * 3.0f) - 4.0f) / 5.0f);
+}
+
+[numthreads(2, 1, 1)]
+void ep() {
+  return;
+}
+
diff --git a/test/samples/function.wgsl.expected.msl b/test/samples/function.wgsl.expected.msl
new file mode 100644
index 0000000..4ab43dd
--- /dev/null
+++ b/test/samples/function.wgsl.expected.msl
@@ -0,0 +1,11 @@
+#include <metal_stdlib>
+
+using namespace metal;
+float tint_symbol() {
+  return (((2.0f * 3.0f) - 4.0f) / 5.0f);
+}
+
+kernel void ep() {
+  return;
+}
+
diff --git a/test/samples/function.wgsl.expected.spvasm b/test/samples/function.wgsl.expected.spvasm
new file mode 100644
index 0000000..affe051
--- /dev/null
+++ b/test/samples/function.wgsl.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %ep "ep"
+               OpExecutionMode %ep LocalSize 2 1 1
+               OpName %main "main"
+               OpName %ep "ep"
+      %float = OpTypeFloat 32
+          %1 = OpTypeFunction %float
+    %float_2 = OpConstant %float 2
+    %float_3 = OpConstant %float 3
+    %float_4 = OpConstant %float 4
+    %float_5 = OpConstant %float 5
+       %void = OpTypeVoid
+         %12 = OpTypeFunction %void
+       %main = OpFunction %float None %1
+          %4 = OpLabel
+          %7 = OpFMul %float %float_2 %float_3
+          %9 = OpFSub %float %7 %float_4
+         %11 = OpFDiv %float %9 %float_5
+               OpReturnValue %11
+               OpFunctionEnd
+         %ep = OpFunction %void None %12
+         %15 = OpLabel
+               OpReturn
+               OpFunctionEnd
diff --git a/test/samples/function.wgsl.expected.wgsl b/test/samples/function.wgsl.expected.wgsl
new file mode 100644
index 0000000..d8a4c35
--- /dev/null
+++ b/test/samples/function.wgsl.expected.wgsl
@@ -0,0 +1,7 @@
+fn main() -> f32 {
+  return (((2.0 * 3.0) - 4.0) / 5.0);
+}
+
+[[stage(compute), workgroup_size(2, 1, 1)]]
+fn ep() {
+}
diff --git a/test/samples/simple.wgsl.expected.hlsl b/test/samples/simple.wgsl.expected.hlsl
new file mode 100644
index 0000000..f48bbae
--- /dev/null
+++ b/test/samples/simple.wgsl.expected.hlsl
@@ -0,0 +1,14 @@
+struct tint_symbol {
+  float4 value : SV_Target0;
+};
+
+void bar() {
+}
+
+tint_symbol main() {
+  float2 a = float2(0.0f, 0.0f);
+  bar();
+  const tint_symbol tint_symbol_1 = {float4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f)};
+  return tint_symbol_1;
+}
+
diff --git a/test/samples/simple.wgsl.expected.msl b/test/samples/simple.wgsl.expected.msl
new file mode 100644
index 0000000..a132f06
--- /dev/null
+++ b/test/samples/simple.wgsl.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+  float4 value [[color(0)]];
+};
+
+void bar() {
+}
+
+fragment tint_symbol_1 tint_symbol() {
+  float2 a = float2(0.0f);
+  bar();
+  return {float4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f)};
+}
+
diff --git a/test/samples/simple.wgsl.expected.spvasm b/test/samples/simple.wgsl.expected.spvasm
new file mode 100644
index 0000000..ac34752
--- /dev/null
+++ b/test/samples/simple.wgsl.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %tint_symbol_1
+               OpExecutionMode %main OriginUpperLeft
+               OpName %tint_symbol_1 "tint_symbol_1"
+               OpName %bar "bar"
+               OpName %tint_symbol_2 "tint_symbol_2"
+               OpName %tint_symbol "tint_symbol"
+               OpName %main "main"
+               OpName %a "a"
+               OpDecorate %tint_symbol_1 Location 0
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+          %5 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5
+       %void = OpTypeVoid
+          %6 = OpTypeFunction %void
+         %10 = OpTypeFunction %void %v4float
+    %v2float = OpTypeVector %float 2
+         %17 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%float_0_400000006 = OpConstant %float 0.400000006
+%float_0_800000012 = OpConstant %float 0.800000012
+    %float_1 = OpConstant %float 1
+         %25 = OpConstantComposite %v4float %float_0_400000006 %float_0_400000006 %float_0_800000012 %float_1
+        %bar = OpFunction %void None %6
+          %9 = OpLabel
+               OpReturn
+               OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %10
+%tint_symbol = OpFunctionParameter %v4float
+         %13 = OpLabel
+               OpStore %tint_symbol_1 %tint_symbol
+               OpReturn
+               OpFunctionEnd
+       %main = OpFunction %void None %6
+         %15 = OpLabel
+          %a = OpVariable %_ptr_Function_v2float Function %17
+               OpStore %a %17
+         %20 = OpFunctionCall %void %bar
+         %21 = OpFunctionCall %void %tint_symbol_2 %25
+               OpReturn
+               OpFunctionEnd
diff --git a/test/samples/simple.wgsl.expected.wgsl b/test/samples/simple.wgsl.expected.wgsl
new file mode 100644
index 0000000..b5a4dc0
--- /dev/null
+++ b/test/samples/simple.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn bar() {
+}
+
+[[stage(fragment)]]
+fn main() -> [[location(0)]] vec4<f32> {
+  var a : vec2<f32> = vec2<f32>();
+  bar();
+  return vec4<f32>(0.400000006, 0.400000006, 0.800000012, 1.0);
+}
diff --git a/test/samples/simple_vertex.spvasm.expected.hlsl b/test/samples/simple_vertex.spvasm.expected.hlsl
new file mode 100644
index 0000000..40f75d7
--- /dev/null
+++ b/test/samples/simple_vertex.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+struct main_out {
+  float4 gl_Position : SV_Position;
+};
+
+main_out main() {
+  main_out tint_out = (main_out)0;
+  tint_out.gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  return tint_out;
+}
+
diff --git a/test/samples/simple_vertex.spvasm.expected.msl b/test/samples/simple_vertex.spvasm.expected.msl
new file mode 100644
index 0000000..58199d4
--- /dev/null
+++ b/test/samples/simple_vertex.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_out {
+  float4 gl_Position [[position]];
+};
+
+vertex tint_symbol_out tint_symbol() {
+  tint_symbol_out _tint_out = {};
+  _tint_out.gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  return _tint_out;
+}
+
diff --git a/test/samples/simple_vertex.spvasm.expected.spvasm b/test/samples/simple_vertex.spvasm.expected.spvasm
new file mode 100644
index 0000000..89ff63f
--- /dev/null
+++ b/test/samples/simple_vertex.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %main "main" %tint_pointsize %gl_Position
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %gl_Position "gl_Position"
+               OpName %main "main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+               OpDecorate %gl_Position BuiltIn Position
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+          %8 = OpConstantNull %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+    %float_0 = OpConstant %float 0
+         %15 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+       %main = OpFunction %void None %9
+         %12 = OpLabel
+               OpStore %tint_pointsize %float_1
+               OpStore %gl_Position %15
+               OpReturn
+               OpFunctionEnd
diff --git a/test/samples/simple_vertex.spvasm.expected.wgsl b/test/samples/simple_vertex.spvasm.expected.wgsl
new file mode 100644
index 0000000..75c87cd
--- /dev/null
+++ b/test/samples/simple_vertex.spvasm.expected.wgsl
@@ -0,0 +1,7 @@
+[[builtin(position)]] var<out> gl_Position : vec4<f32>;
+
+[[stage(vertex)]]
+fn main() {
+  gl_Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
+  return;
+}
diff --git a/test/samples/triangle.wgsl.expected.hlsl b/test/samples/triangle.wgsl.expected.hlsl
new file mode 100644
index 0000000..803a381
--- /dev/null
+++ b/test/samples/triangle.wgsl.expected.hlsl
@@ -0,0 +1,22 @@
+struct tint_symbol_1 {
+  int VertexIndex : SV_VertexID;
+};
+struct tint_symbol_2 {
+  float4 value : SV_Position;
+};
+struct tint_symbol_3 {
+  float4 value : SV_Target0;
+};
+
+static const float2 pos[3] = {float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)};
+tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) {
+  const int VertexIndex = tint_symbol.VertexIndex;
+  const tint_symbol_2 tint_symbol_4 = {float4(pos[VertexIndex], 0.0f, 1.0f)};
+  return tint_symbol_4;
+}
+
+tint_symbol_3 frag_main() {
+  const tint_symbol_3 tint_symbol_5 = {float4(1.0f, 0.0f, 0.0f, 1.0f)};
+  return tint_symbol_5;
+}
+
diff --git a/test/samples/triangle.wgsl.expected.msl b/test/samples/triangle.wgsl.expected.msl
new file mode 100644
index 0000000..00638c3
--- /dev/null
+++ b/test/samples/triangle.wgsl.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+  int VertexIndex [[vertex_id]];
+};
+struct tint_symbol_2 {
+  float4 value [[position]];
+};
+struct tint_symbol_3 {
+  float4 value [[color(0)]];
+};
+
+constant float2 pos[3] = {float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)};
+vertex tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol [[stage_in]]) {
+  const int VertexIndex = tint_symbol.VertexIndex;
+  return {float4(pos[VertexIndex], 0.0f, 1.0f)};
+}
+
+fragment tint_symbol_3 frag_main() {
+  return {float4(1.0f, 0.0f, 0.0f, 1.0f)};
+}
+
diff --git a/test/samples/triangle.wgsl.expected.spvasm b/test/samples/triangle.wgsl.expected.spvasm
new file mode 100644
index 0000000..8a7bf08
--- /dev/null
+++ b/test/samples/triangle.wgsl.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vtx_main "vtx_main" %tint_pointsize %tint_symbol %tint_symbol_2
+               OpEntryPoint Fragment %frag_main "frag_main" %tint_symbol_5
+               OpExecutionMode %frag_main OriginUpperLeft
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %pos "pos"
+               OpName %tint_symbol "tint_symbol"
+               OpName %tint_symbol_2 "tint_symbol_2"
+               OpName %tint_symbol_5 "tint_symbol_5"
+               OpName %tint_symbol_3 "tint_symbol_3"
+               OpName %tint_symbol_1 "tint_symbol_1"
+               OpName %vtx_main "vtx_main"
+               OpName %tint_symbol_6 "tint_symbol_6"
+               OpName %tint_symbol_4 "tint_symbol_4"
+               OpName %frag_main "frag_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+               OpDecorate %_arr_v2float_uint_3 ArrayStride 8
+               OpDecorate %tint_symbol BuiltIn VertexIndex
+               OpDecorate %tint_symbol_2 BuiltIn Position
+               OpDecorate %tint_symbol_5 Location 0
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+    %v2float = OpTypeVector %float 2
+       %uint = OpTypeInt 32 0
+     %uint_3 = OpConstant %uint 3
+%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
+    %float_0 = OpConstant %float 0
+  %float_0_5 = OpConstant %float 0.5
+         %11 = OpConstantComposite %v2float %float_0 %float_0_5
+ %float_n0_5 = OpConstant %float -0.5
+         %13 = OpConstantComposite %v2float %float_n0_5 %float_n0_5
+         %14 = OpConstantComposite %v2float %float_0_5 %float_n0_5
+        %pos = OpConstantComposite %_arr_v2float_uint_3 %11 %13 %14
+        %int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%tint_symbol = OpVariable %_ptr_Input_int Input
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+         %22 = OpConstantNull %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %22
+%tint_symbol_5 = OpVariable %_ptr_Output_v4float Output %22
+       %void = OpTypeVoid
+         %24 = OpTypeFunction %void %v4float
+         %29 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3
+         %36 = OpConstantNull %_arr_v2float_uint_3
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+         %50 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
+%tint_symbol_3 = OpFunction %void None %24
+%tint_symbol_1 = OpFunctionParameter %v4float
+         %28 = OpLabel
+               OpStore %tint_symbol_2 %tint_symbol_1
+               OpReturn
+               OpFunctionEnd
+   %vtx_main = OpFunction %void None %29
+         %31 = OpLabel
+         %35 = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %36
+               OpStore %tint_pointsize %float_1
+               OpStore %35 %pos
+         %37 = OpLoad %int %tint_symbol
+         %39 = OpAccessChain %_ptr_Function_v2float %35 %37
+         %40 = OpLoad %v2float %39
+         %41 = OpCompositeExtract %float %40 0
+         %42 = OpCompositeExtract %float %40 1
+         %43 = OpCompositeConstruct %v4float %41 %42 %float_0 %float_1
+         %33 = OpFunctionCall %void %tint_symbol_3 %43
+               OpReturn
+               OpFunctionEnd
+%tint_symbol_6 = OpFunction %void None %24
+%tint_symbol_4 = OpFunctionParameter %v4float
+         %46 = OpLabel
+               OpStore %tint_symbol_5 %tint_symbol_4
+               OpReturn
+               OpFunctionEnd
+  %frag_main = OpFunction %void None %29
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_symbol_6 %50
+               OpReturn
+               OpFunctionEnd
diff --git a/test/samples/triangle.wgsl.expected.wgsl b/test/samples/triangle.wgsl.expected.wgsl
new file mode 100644
index 0000000..0085989
--- /dev/null
+++ b/test/samples/triangle.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(vec2<f32>(0.0, 0.5), vec2<f32>(-0.5, -0.5), vec2<f32>(0.5, -0.5));
+
+[[stage(vertex)]]
+fn vtx_main([[builtin(vertex_index)]] VertexIndex : i32) -> [[builtin(position)]] vec4<f32> {
+  return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
+}
+
+[[stage(fragment)]]
+fn frag_main() -> [[location(0)]] vec4<f32> {
+  return vec4<f32>(1.0, 0.0, 0.0, 1.0);
+}