void allLegalAndSynonymous() {
  short q[4][3][2] = {{1}, {2, 3}, {4, 5, 6}};
  short q2[4][3][2] = {{1, 0, 0, 0, 0, 0}, {2, 3, 0, 0, 0, 0}, {4, 5, 6}};
  short q3[4][3][2] = {
      {
          {1},
      },
      {
          {2, 3},
      },
      {
          {4, 5},
          {6},
      },
  };
}


x86 assembly (clang, -O0):
<allLegalAndSynonymous>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
movw   $0x1,-0x30(%rbp)
movw   $0x2,-0x24(%rbp)
movw   $0x3,-0x22(%rbp)
movw   $0x4,-0x18(%rbp)
movw   $0x5,-0x16(%rbp)
movw   $0x6,-0x14(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
movw   $0x1,-0x60(%rbp)
movw   $0x2,-0x54(%rbp)
movw   $0x3,-0x52(%rbp)
movw   $0x4,-0x48(%rbp)
movw   $0x5,-0x46(%rbp)
movw   $0x6,-0x44(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
movw   $0x1,-0x90(%rbp)
movw   $0x2,-0x84(%rbp)
movw   $0x3,-0x82(%rbp)
movw   $0x4,-0x78(%rbp)
movw   $0x5,-0x76(%rbp)
movw   $0x6,-0x74(%rbp)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allLegalAndSynonymous>:
ret

LLVM IR (-O0):
define void @allLegalAndSynonymous() {
%1 = alloca [4 x [3 x [2 x i16]]]
%2 = alloca [4 x [3 x [2 x i16]]]
%3 = alloca [4 x [3 x [2 x i16]]]
%4 = bitcast [4 x [3 x [2 x i16]]]* %1 to i8*
%5 = bitcast i8* %4 to [4 x [3 x [2 x i16]]]*
%6 = getelementptr inbounds [4 x [3 x [2 x i16]]], [4 x [3 x [2 x i16]]]* %5, i32 0, i32 0
%7 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %6, i32 0, i32 0
%8 = getelementptr inbounds [2 x i16], [2 x i16]* %7, i32 0, i32 0
store i16 1, i16* %8
%9 = getelementptr inbounds [4 x [3 x [2 x i16]]], [4 x [3 x [2 x i16]]]* %5, i32 0, i32 1
%10 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %9, i32 0, i32 0
%11 = getelementptr inbounds [2 x i16], [2 x i16]* %10, i32 0, i32 0
store i16 2, i16* %11
%12 = getelementptr inbounds [2 x i16], [2 x i16]* %10, i32 0, i32 1
store i16 3, i16* %12
%13 = getelementptr inbounds [4 x [3 x [2 x i16]]], [4 x [3 x [2 x i16]]]* %5, i32 0, i32 2
%14 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %13, i32 0, i32 0
%15 = getelementptr inbounds [2 x i16], [2 x i16]* %14, i32 0, i32 0
store i16 4, i16* %15
%16 = getelementptr inbounds [2 x i16], [2 x i16]* %14, i32 0, i32 1
store i16 5, i16* %16
%17 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %13, i32 0, i32 1
%18 = getelementptr inbounds [2 x i16], [2 x i16]* %17, i32 0, i32 0
store i16 6, i16* %18
%19 = bitcast [4 x [3 x [2 x i16]]]* %2 to i8*
%20 = bitcast i8* %19 to [4 x [3 x [2 x i16]]]*
%21 = getelementptr inbounds [4 x [3 x [2 x i16]]], [4 x [3 x [2 x i16]]]* %20, i32 0, i32 0
%22 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %21, i32 0, i32 0
%23 = getelementptr inbounds [2 x i16], [2 x i16]* %22, i32 0, i32 0
store i16 1, i16* %23
%24 = getelementptr inbounds [4 x [3 x [2 x i16]]], [4 x [3 x [2 x i16]]]* %20, i32 0, i32 1
%25 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %24, i32 0, i32 0
%26 = getelementptr inbounds [2 x i16], [2 x i16]* %25, i32 0, i32 0
store i16 2, i16* %26
%27 = getelementptr inbounds [2 x i16], [2 x i16]* %25, i32 0, i32 1
store i16 3, i16* %27
%28 = getelementptr inbounds [4 x [3 x [2 x i16]]], [4 x [3 x [2 x i16]]]* %20, i32 0, i32 2
%29 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %28, i32 0, i32 0
%30 = getelementptr inbounds [2 x i16], [2 x i16]* %29, i32 0, i32 0
store i16 4, i16* %30
%31 = getelementptr inbounds [2 x i16], [2 x i16]* %29, i32 0, i32 1
store i16 5, i16* %31
%32 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %28, i32 0, i32 1
%33 = getelementptr inbounds [2 x i16], [2 x i16]* %32, i32 0, i32 0
store i16 6, i16* %33
%34 = bitcast [4 x [3 x [2 x i16]]]* %3 to i8*
%35 = bitcast i8* %34 to [4 x [3 x [2 x i16]]]*
%36 = getelementptr inbounds [4 x [3 x [2 x i16]]], [4 x [3 x [2 x i16]]]* %35, i32 0, i32 0
%37 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %36, i32 0, i32 0
%38 = getelementptr inbounds [2 x i16], [2 x i16]* %37, i32 0, i32 0
store i16 1, i16* %38
%39 = getelementptr inbounds [4 x [3 x [2 x i16]]], [4 x [3 x [2 x i16]]]* %35, i32 0, i32 1
%40 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %39, i32 0, i32 0
%41 = getelementptr inbounds [2 x i16], [2 x i16]* %40, i32 0, i32 0
store i16 2, i16* %41
%42 = getelementptr inbounds [2 x i16], [2 x i16]* %40, i32 0, i32 1
store i16 3, i16* %42
%43 = getelementptr inbounds [4 x [3 x [2 x i16]]], [4 x [3 x [2 x i16]]]* %35, i32 0, i32 2
%44 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %43, i32 0, i32 0
%45 = getelementptr inbounds [2 x i16], [2 x i16]* %44, i32 0, i32 0
store i16 4, i16* %45
%46 = getelementptr inbounds [2 x i16], [2 x i16]* %44, i32 0, i32 1
store i16 5, i16* %46
%47 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %43, i32 0, i32 1
%48 = getelementptr inbounds [2 x i16], [2 x i16]* %47, i32 0, i32 0
store i16 6, i16* %48
ret void
}

LLVM IR (-O2):
define void @allLegalAndSynonymous() {
ret void
}