int main() {
  int x[10][20];
  int(*y)[20] = &x[4];
  x[4][15] = 201;
  assertEq(x[4][15], (*y)[15]);
  int values[10];
  for (int i = 0; i < 10; i++)
    values[i] = i * i - 2 * i + 3;
  assertEq(225, sum(values));
  int values2[2][5];
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 5; j++)
      values2[i][j] = i * i * j * j + 2 * i * j + 3;
  assertEq(80, sum(values2));
  endTest();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3a0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x330(%rbp),%rax
add    $0x140,%rax
mov    %rax,-0x338(%rbp)
movl   $0xc9,-0x1b4(%rbp)
mov    -0x1b4(%rbp),%edi
mov    -0x338(%rbp),%rax
mov    0x3c(%rax),%esi
mov    $0x0,%al
call   1050 <assertEq@plt>
movl   $0x0,-0x364(%rbp)
cmpl   $0xa,-0x364(%rbp)
jge    11cb <main+0x9b>
mov    -0x364(%rbp),%ecx
imul   -0x364(%rbp),%ecx
mov    -0x364(%rbp),%eax
shl    $0x1,%eax
sub    %eax,%ecx
add    $0x3,%ecx
movslq -0x364(%rbp),%rax
mov    %ecx,-0x360(%rbp,%rax,4)
mov    -0x364(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x364(%rbp)
jmp    1181 <main+0x51>
lea    -0x360(%rbp),%rdi
mov    $0x0,%al
call   1040 <sum@plt>
mov    %eax,%esi
mov    $0xe1,%edi
mov    $0x0,%al
call   1050 <assertEq@plt>
movl   $0x0,-0x394(%rbp)
cmpl   $0x2,-0x394(%rbp)
jge    1291 <main+0x161>
movl   $0x0,-0x398(%rbp)
cmpl   $0x5,-0x398(%rbp)
jge    1278 <main+0x148>
mov    -0x394(%rbp),%edx
imul   -0x394(%rbp),%edx
imul   -0x398(%rbp),%edx
imul   -0x398(%rbp),%edx
mov    -0x394(%rbp),%eax
shl    $0x1,%eax
imul   -0x398(%rbp),%eax
add    %eax,%edx
add    $0x3,%edx
movslq -0x394(%rbp),%rcx
lea    -0x390(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x398(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x398(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x398(%rbp)
jmp    1208 <main+0xd8>
jmp    127d <main+0x14d>
mov    -0x394(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x394(%rbp)
jmp    11f1 <main+0xc1>
lea    -0x390(%rbp),%rdi
mov    $0x0,%al
call   1040 <sum@plt>
mov    %eax,%esi
mov    $0x50,%edi
mov    $0x0,%al
call   1050 <assertEq@plt>
mov    $0x0,%al
call   1030 <endTest@plt>
xor    %eax,%eax
add    $0x3a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
mov    $0xc9,%edi
mov    $0xc9,%esi
xor    %eax,%eax
call   1050 <assertEq@plt>
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movabs $0x4200000033,%rax
mov    %rax,0x50(%rsp)
lea    0x30(%rsp),%rdi
xor    %eax,%eax
call   1040 <sum@plt>
mov    $0xe1,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <assertEq@plt>
movaps 0xe93(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x1b00000012,%rax
mov    %rax,0x20(%rsp)
mov    %rsp,%rdi
xor    %eax,%eax
call   1040 <sum@plt>
mov    $0x50,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <assertEq@plt>
xor    %eax,%eax
call   1030 <endTest@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [20 x i32]]
%3 = alloca [20 x i32]*
%4 = alloca [10 x i32]
%5 = alloca i32
%6 = alloca [2 x [5 x i32]]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = getelementptr inbounds [10 x [20 x i32]], [10 x [20 x i32]]* %2, i64 0, i64 4
store [20 x i32]* %9, [20 x i32]** %3
%10 = getelementptr inbounds [10 x [20 x i32]], [10 x [20 x i32]]* %2, i64 0, i64 4
%11 = getelementptr inbounds [20 x i32], [20 x i32]* %10, i64 0, i64 15
store i32 201, i32* %11
%12 = getelementptr inbounds [10 x [20 x i32]], [10 x [20 x i32]]* %2, i64 0, i64 4
%13 = getelementptr inbounds [20 x i32], [20 x i32]* %12, i64 0, i64 15
%14 = load i32, i32* %13
%15 = load [20 x i32]*, [20 x i32]** %3
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %15, i64 0, i64 15
%17 = load i32, i32* %16
%18 = call i32 (i32, i32, ...) bitcast (i32 (...)* @assertEq to i32 (i32, i32, ...)*)(i32 %14, i32 %17)
store i32 0, i32* %5
br label %19
19: ; preds = %33, %0
%20 = load i32, i32* %5
%21 = icmp slt i32 %20, 10
br i1 %21, label %22, label %36
22: ; preds = %19
%23 = load i32, i32* %5
%24 = load i32, i32* %5
%25 = mul nsw i32 %23, %24
%26 = load i32, i32* %5
%27 = mul nsw i32 2, %26
%28 = sub nsw i32 %25, %27
%29 = add nsw i32 %28, 3
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %31
store i32 %29, i32* %32
br label %33
33: ; preds = %22
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %19
36: ; preds = %19
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%38 = call i32 (i32*, ...) bitcast (i32 (...)* @sum to i32 (i32*, ...)*)(i32* %37)
%39 = call i32 (i32, i32, ...) bitcast (i32 (...)* @assertEq to i32 (i32, i32, ...)*)(i32 225, i32 %38)
store i32 0, i32* %7
br label %40
40: ; preds = %71, %36
%41 = load i32, i32* %7
%42 = icmp slt i32 %41, 2
br i1 %42, label %43, label %74
43: ; preds = %40
store i32 0, i32* %8
br label %44
44: ; preds = %67, %43
%45 = load i32, i32* %8
%46 = icmp slt i32 %45, 5
br i1 %46, label %47, label %70
47: ; preds = %44
%48 = load i32, i32* %7
%49 = load i32, i32* %7
%50 = mul nsw i32 %48, %49
%51 = load i32, i32* %8
%52 = mul nsw i32 %50, %51
%53 = load i32, i32* %8
%54 = mul nsw i32 %52, %53
%55 = load i32, i32* %7
%56 = mul nsw i32 2, %55
%57 = load i32, i32* %8
%58 = mul nsw i32 %56, %57
%59 = add nsw i32 %54, %58
%60 = add nsw i32 %59, 3
%61 = load i32, i32* %7
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %6, i64 0, i64 %62
%64 = load i32, i32* %8
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [5 x i32], [5 x i32]* %63, i64 0, i64 %65
store i32 %60, i32* %66
br label %67
67: ; preds = %47
%68 = load i32, i32* %8
%69 = add nsw i32 %68, 1
store i32 %69, i32* %8
br label %44
70: ; preds = %44
br label %71
71: ; preds = %70
%72 = load i32, i32* %7
%73 = add nsw i32 %72, 1
store i32 %73, i32* %7
br label %40
74: ; preds = %40
%75 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %6, i64 0, i64 0
%76 = call i32 ([5 x i32]*, ...) bitcast (i32 (...)* @sum to i32 ([5 x i32]*, ...)*)([5 x i32]* %75)
%77 = call i32 (i32, i32, ...) bitcast (i32 (...)* @assertEq to i32 (i32, i32, ...)*)(i32 80, i32 %76)
%78 = call i32 (...) @endTest()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [2 x [5 x i32]]
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @assertEq to i32 (i32, i32, ...)*)(i32 201, i32 201)
%4 = bitcast [10 x i32]* %1 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 3, i32 2, i32 3, i32 6>, <4 x i32>* %6
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 11, i32 18, i32 27, i32 38>, <4 x i32>* %8
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
store i32 51, i32* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
store i32 66, i32* %10
%11 = call i32 (i32*, ...) bitcast (i32 (...)* @sum to i32 (i32*, ...)*)(i32* %5)
%12 = call i32 (i32, i32, ...) bitcast (i32 (...)* @assertEq to i32 (i32, i32, ...)*)(i32 225, i32 %11)
%13 = bitcast [2 x [5 x i32]]* %2 to i8*
%14 = bitcast [2 x [5 x i32]]* %2 to <4 x i32>*
store <4 x i32> <i32 3, i32 3, i32 3, i32 3>, <4 x i32>* %14
%15 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 0, i64 4
%16 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> <i32 3, i32 3, i32 6, i32 11>, <4 x i32>* %16
%17 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 1, i64 3
store i32 18, i32* %17
%18 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 1, i64 4
store i32 27, i32* %18
%19 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 0
%20 = call i32 ([5 x i32]*, ...) bitcast (i32 (...)* @sum to i32 ([5 x i32]*, ...)*)([5 x i32]* %19)
%21 = call i32 (i32, i32, ...) bitcast (i32 (...)* @assertEq to i32 (i32, i32, ...)*)(i32 80, i32 %20)
%22 = call i32 (...) @endTest()
ret i32 0
}