#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*/ foo2(int, int **);
int main(void) {
  int r = 40;
  int c[40][40];
  int d[r][r];
  for (int i = 0; i < 40; i++) {
    for (int j = 0; j < 40; j++) {
      c[i][j] = 0;
      d[i][j] = 0;
    }
  }
  c[7][13] = 23;
  d[7][13] = 23;
  foo2(40, c);
  foo2(40, d);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1940,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x28,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rax,-0x1940(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x1918(%rbp)
mov    %rcx,%rdx
imul   %rdx,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x1938(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x1920(%rbp)
mov    %rax,-0x1928(%rbp)
movl   $0x0,-0x192c(%rbp)
cmpl   $0x28,-0x192c(%rbp)
jge    1222 <main+0x112>
movl   $0x0,-0x1930(%rbp)
cmpl   $0x28,-0x1930(%rbp)
jge    1209 <main+0xf9>
mov    -0x1938(%rbp),%rax
mov    -0x1940(%rbp),%rdx
movslq -0x192c(%rbp),%rsi
lea    -0x1910(%rbp),%rcx
imul   $0xa0,%rsi,%rsi
add    %rsi,%rcx
movslq -0x1930(%rbp),%rsi
movl   $0x0,(%rcx,%rsi,4)
movslq -0x192c(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x1930(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x1930(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1930(%rbp)
jmp    1194 <main+0x84>
jmp    120e <main+0xfe>
mov    -0x192c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x192c(%rbp)
jmp    117d <main+0x6d>
mov    -0x1938(%rbp),%rax
mov    -0x1940(%rbp),%rcx
movl   $0x17,-0x147c(%rbp)
imul   $0x7,%rcx,%rcx
movl   $0x17,0x34(%rax,%rcx,4)
lea    -0x1910(%rbp),%rsi
mov    $0x28,%edi
call   1030 <foo2@plt>
mov    -0x1938(%rbp),%rsi
mov    $0x28,%edi
call   1030 <foo2@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x1918(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x3200,%rsp
mov    %rsp,%r15
lea    0x1900(%rsp),%r14
mov    $0x1900,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rsp,%rbx
mov    $0x1900,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
movl   $0x17,0x1d94(%rsp)
movl   $0x17,0x494(%rsp)
mov    $0x28,%edi
mov    %r14,%rsi
call   1030 <foo2@plt>
mov    $0x28,%edi
mov    %rbx,%rsi
call   1030 <foo2@plt>
mov    %r15,%rsp
xor    %eax,%eax
add    $0x3200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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