#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*/ abort();
int foo(int **);
int /*<<< orphan*/ init(int *, int);
int main(void) {
  int A[100][200];
  int i, j, res;
  for (i = 0; i < 100; i++)
    init(A[i], i);
  res = foo(A);
  if (res != 8)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x138a0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x13894(%rbp)
cmpl   $0x64,-0x13894(%rbp)
jge    1190 <main+0x60>
movslq -0x13894(%rbp),%rax
lea    -0x13890(%rbp),%rdi
imul   $0x320,%rax,%rax
add    %rax,%rdi
mov    -0x13894(%rbp),%esi
call   1040 <init@plt>
mov    -0x13894(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13894(%rbp)
jmp    114c <main+0x1c>
lea    -0x13890(%rbp),%rdi
call   1050 <foo@plt>
mov    %eax,-0x1389c(%rbp)
cmpl   $0x8,-0x1389c(%rbp)
je     11b6 <main+0x86>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x138a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x13888,%rsp
mov    %rsp,%r14
xor    %ebx,%ebx
nop
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <init@plt>
add    $0x1,%rbx
add    $0x320,%r14
cmp    $0x64,%rbx
jne    1140 <main+0x10>
mov    %rsp,%rdi
call   1050 <foo@plt>
cmp    $0x8,%eax
jne    1175 <main+0x45>
xor    %eax,%eax
add    $0x13888,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x [200 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 100
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [100 x [200 x i32]], [100 x [200 x i32]]* %2, i64 0, i64 %11
%13 = getelementptr inbounds [200 x i32], [200 x i32]* %12, i64 0, i64 0
%14 = load i32, i32* %3
%15 = call i32 @init(i32* %13, i32 %14)
br label %16
16: ; preds = %9
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %6
19: ; preds = %6
%20 = getelementptr inbounds [100 x [200 x i32]], [100 x [200 x i32]]* %2, i64 0, i64 0
%21 = bitcast [200 x i32]* %20 to i32**
%22 = call i32 @foo(i32** %21)
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = icmp ne i32 %23, 8
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = call i32 (...) @abort()
unreachable
27: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100 x [200 x i32]]
%2 = bitcast [100 x [200 x i32]]* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %8, %3 ]
%5 = getelementptr inbounds [100 x [200 x i32]], [100 x [200 x i32]]* %1, i64 0, i64 %4, i64 0
%6 = trunc i64 %4 to i32
%7 = call i32 @init(i32* %5, i32 %6)
%8 = add nuw nsw i64 %4, 1
%9 = icmp eq i64 %8, 100
br i1 %9, label %10, label %3
10: ; preds = %3
%11 = bitcast [100 x [200 x i32]]* %1 to i32**
%12 = call i32 @foo(i32** %11)
%13 = icmp eq i32 %12, 8
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %10
ret i32 0
}