#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ foo(int **);
int /*<<< orphan*/ foo2(int, int **);
int /*<<< orphan*/ foo3(int, int **);
int /*<<< orphan*/ foo4(int, int **);
int /*<<< orphan*/ foo5(int, int, int **);
int main(void) {
  int n = 40;
  int b[n][n];
  for (int i = 0; i < 40; i++) {
    for (int j = 0; j < 40; j++) {
      b[i][j] = 0;
    }
  }
  b[7][13] = 23;
  foo(b);
  foo2(40, b);
  foo3(40, b);
  foo4(40, b);
  foo5(40, 40, b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x28,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x10(%rbp)
mov    %rcx,%rdx
imul   %rdx,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x28,-0x24(%rbp)
jge    1206 <main+0xb6>
movl   $0x0,-0x28(%rbp)
cmpl   $0x28,-0x28(%rbp)
jge    11f3 <main+0xa3>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rdx
movslq -0x24(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11b9 <main+0x69>
jmp    11f8 <main+0xa8>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a8 <main+0x58>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rax
imul   $0x7,%rax,%rax
movl   $0x17,0x34(%rdi,%rax,4)
call   1050 <foo@plt>
mov    -0x30(%rbp),%rsi
mov    $0x28,%edi
call   1040 <foo2@plt>
mov    -0x30(%rbp),%rsi
mov    $0x28,%edi
call   1060 <foo3@plt>
mov    -0x30(%rbp),%rsi
mov    $0x28,%edi
call   1030 <foo4@plt>
mov    -0x30(%rbp),%rdx
mov    $0x28,%esi
mov    %esi,%edi
call   1070 <foo5@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1900,%rsp
mov    %rsp,%rbx
mov    $0x1900,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
movl   $0x17,0x494(%rsp)
mov    %rbx,%rdi
call   1060 <foo@plt>
mov    $0x28,%edi
mov    %rbx,%rsi
call   1040 <foo2@plt>
mov    $0x28,%edi
mov    %rbx,%rsi
call   1070 <foo3@plt>
mov    $0x28,%edi
mov    %rbx,%rsi
call   1030 <foo4@plt>
mov    $0x28,%edi
mov    $0x28,%esi
mov    %rbx,%rdx
call   1080 <foo5@plt>
xor    %eax,%eax
add    $0x1900,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 40, i32* %2
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %3
%13 = mul nuw i64 %9, %11
%14 = alloca i32, i64 %13
store i64 %9, i64* %4
store i64 %11, i64* %5
store i32 0, i32* %6
br label %15
15: ; preds = %34, %0
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 40
br i1 %17, label %18, label %37
18: ; preds = %15
store i32 0, i32* %7
br label %19
19: ; preds = %30, %18
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 40
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = mul nsw i64 %24, %11
%26 = getelementptr inbounds i32, i32* %14, i64 %25
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
store i32 0, i32* %29
br label %30
30: ; preds = %22
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %19
33: ; preds = %19
br label %34
34: ; preds = %33
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %15
37: ; preds = %15
%38 = mul nsw i64 7, %11
%39 = getelementptr inbounds i32, i32* %14, i64 %38
%40 = getelementptr inbounds i32, i32* %39, i64 13
store i32 23, i32* %40
%41 = bitcast i32* %14 to i32**
%42 = call i32 @foo(i32** %41)
%43 = bitcast i32* %14 to i32**
%44 = call i32 @foo2(i32 40, i32** %43)
%45 = bitcast i32* %14 to i32**
%46 = call i32 @foo3(i32 40, i32** %45)
%47 = bitcast i32* %14 to i32**
%48 = call i32 @foo4(i32 40, i32** %47)
%49 = bitcast i32* %14 to i32**
%50 = call i32 @foo5(i32 40, i32 40, i32** %49)
%51 = load i8*, i8** %3
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1600 x i32]
%2 = bitcast [1600 x i32]* %1 to i8*
%3 = getelementptr inbounds [1600 x i32], [1600 x i32]* %1, i64 0, i64 293
store i32 23, i32* %3
%4 = bitcast [1600 x i32]* %1 to i32**
%5 = call i32 @foo(i32** %4)
%6 = call i32 @foo2(i32 40, i32** %4)
%7 = call i32 @foo3(i32 40, i32** %4)
%8 = call i32 @foo4(i32 40, i32** %4)
%9 = call i32 @foo5(i32 40, i32 40, i32** %4)
ret i32 0
}