#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 foo(int, int **);
int printf(char *, int);
int main(void) {
  int a[2][42] = {0}, i;
  for (i = 0; i < 42; ++i)
    a[0][i] = i + 1;
  return printf("%d\n", foo(42, a));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x160(%rbp),%rdi
xor    %esi,%esi
mov    $0x150,%edx
call   1040 <memset@plt>
movl   $0x0,-0x164(%rbp)
cmpl   $0x2a,-0x164(%rbp)
jge    1197 <main+0x67>
mov    -0x164(%rbp),%ecx
add    $0x1,%ecx
movslq -0x164(%rbp),%rax
mov    %ecx,-0x160(%rbp,%rax,4)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    115f <main+0x2f>
lea    -0x160(%rbp),%rsi
mov    $0x2a,%edi
call   1050 <foo@plt>
mov    %eax,%esi
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x158,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps 0xe77(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xe7c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe80(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe84(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe88(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe8c(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe90(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe94(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe99(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movabs $0x2a00000029,%rax
mov    %rax,0xa0(%rsp)
mov    %rsp,%rsi
mov    $0x2a,%edi
call   1040 <foo@plt>
lea    0xe7b(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x158,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [42 x i32]]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [2 x [42 x i32]]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %15, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 42
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %2, i64 0, i64 0
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [42 x i32], [42 x i32]* %11, i64 0, i64 %13
store i32 %10, i32* %14
br label %15
15: ; preds = %8
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %5
18: ; preds = %5
%19 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %2, i64 0, i64 0
%20 = bitcast [42 x i32]* %19 to i32**
%21 = call i32 @foo(i32 42, i32** %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
ret i32 %22
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [2 x [42 x i32]]
%2 = bitcast [2 x [42 x i32]]* %1 to i8*
%3 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 40
%4 = bitcast i32* %3 to i8*
%5 = bitcast [2 x [42 x i32]]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %5
%6 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 4
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %7
%8 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 8
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 9, i32 10, i32 11, i32 12>, <4 x i32>* %9
%10 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 12
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 13, i32 14, i32 15, i32 16>, <4 x i32>* %11
%12 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 16
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 17, i32 18, i32 19, i32 20>, <4 x i32>* %13
%14 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 20
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> <i32 21, i32 22, i32 23, i32 24>, <4 x i32>* %15
%16 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 24
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 25, i32 26, i32 27, i32 28>, <4 x i32>* %17
%18 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 28
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> <i32 29, i32 30, i32 31, i32 32>, <4 x i32>* %19
%20 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 32
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> <i32 33, i32 34, i32 35, i32 36>, <4 x i32>* %21
%22 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 36
%23 = bitcast i32* %22 to <4 x i32>*
store <4 x i32> <i32 37, i32 38, i32 39, i32 40>, <4 x i32>* %23
%24 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 40
store i32 41, i32* %24
%25 = getelementptr inbounds [2 x [42 x i32]], [2 x [42 x i32]]* %1, i64 0, i64 0, i64 41
store i32 42, i32* %25
%26 = bitcast [2 x [42 x i32]]* %1 to i32**
%27 = call i32 @foo(i32 42, i32** %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
ret i32 %28
}