#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 toto() {
  int i, j, k;
  int a[200 + 1][100];
  int b[100];
  int N = foo();
  for (i = 0; i < N + 100; i++)
    for (j = 0; j < 200; j++)
      a[j][i] = a[j + 1][10] + 2;
  return a[3][5] + b[1];
}


x86 assembly (clang, -O0):
<toto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13bc0,%rsp
mov    $0x0,%al
call   1030 <foo@plt>
mov    %eax,-0x13bb4(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x13bb4(%rbp),%ecx
add    $0x64,%ecx
cmp    %ecx,%eax
jge    11b4 <toto+0xa4>
movl   $0x0,-0x8(%rbp)
cmpl   $0xc8,-0x8(%rbp)
jge    11a1 <toto+0x91>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    -0x13a20(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
mov    0x28(%rax),%edx
add    $0x2,%edx
movslq -0x8(%rbp),%rcx
lea    -0x13a20(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <toto+0x3a>
jmp    11a6 <toto+0x96>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <toto+0x1f>
mov    -0x1355c(%rbp),%eax
add    -0x13bac(%rbp),%eax
add    $0x13bc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toto>:
push   %rbx
sub    $0x13a10,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <foo@plt>
cmp    $0xffffff9d,%eax
jl     118b <toto+0x7b>
add    $0x63,%eax
test   %eax,%eax
cmovle %ebx,%eax
add    $0x1,%eax
mov    %rsp,%rcx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x1b8(%rsp,%rdx,1),%esi
add    $0x2,%esi
mov    %esi,(%rcx,%rdx,1)
mov    0x348(%rsp,%rdx,1),%esi
add    $0x2,%esi
mov    %esi,0x190(%rcx,%rdx,1)
add    $0x320,%rdx
cmp    $0x13880,%rdx
jne    1150 <toto+0x40>
add    $0x1,%rbx
add    $0x4,%rcx
cmp    %rax,%rbx
jne    1140 <toto+0x30>
add    $0x13a10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @toto() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [201 x [100 x i32]]
%5 = alloca [100 x i32]
%6 = alloca i32
%7 = call i32 (...) @foo()
store i32 %7, i32* %6
store i32 0, i32* %1
br label %8
8: ; preds = %35, %0
%9 = load i32, i32* %1
%10 = load i32, i32* %6
%11 = add nsw i32 %10, 100
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %38
13: ; preds = %8
store i32 0, i32* %2
br label %14
14: ; preds = %31, %13
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 200
br i1 %16, label %17, label %34
17: ; preds = %14
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [201 x [100 x i32]], [201 x [100 x i32]]* %4, i64 0, i64 %20
%22 = getelementptr inbounds [100 x i32], [100 x i32]* %21, i64 0, i64 10
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 2
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [201 x [100 x i32]], [201 x [100 x i32]]* %4, i64 0, i64 %26
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [100 x i32], [100 x i32]* %27, i64 0, i64 %29
store i32 %24, i32* %30
br label %31
31: ; preds = %17
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %14
34: ; preds = %14
br label %35
35: ; preds = %34
%36 = load i32, i32* %1
%37 = add nsw i32 %36, 1
store i32 %37, i32* %1
br label %8
38: ; preds = %8
%39 = getelementptr inbounds [201 x [100 x i32]], [201 x [100 x i32]]* %4, i64 0, i64 3
%40 = getelementptr inbounds [100 x i32], [100 x i32]* %39, i64 0, i64 5
%41 = load i32, i32* %40
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 1
%43 = load i32, i32* %42
%44 = add nsw i32 %41, %43
ret i32 %44
}

LLVM IR (-O2):
define i32 @toto() {
%1 = alloca [201 x [100 x i32]]
%2 = bitcast [201 x [100 x i32]]* %1 to i8*
%3 = tail call i32 (...) @foo()
%4 = icmp sgt i32 %3, -100
br i1 %4, label %5, label %28
5: ; preds = %0
%6 = add i32 %3, 99
%7 = call i32 @llvm.smax.i32(i32 %6, i32 0)
%8 = add nuw i32 %7, 1
%9 = zext i32 %8 to i64
br label %10
10: ; preds = %5, %25
%11 = phi i64 [ 0, %5 ], [ %26, %25 ]
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %19, %12 ]
%14 = or i64 %13, 1
%15 = getelementptr inbounds [201 x [100 x i32]], [201 x [100 x i32]]* %1, i64 0, i64 %14, i64 10
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 2
%18 = getelementptr inbounds [201 x [100 x i32]], [201 x [100 x i32]]* %1, i64 0, i64 %13, i64 %11
store i32 %17, i32* %18
%19 = add nuw nsw i64 %13, 2
%20 = getelementptr inbounds [201 x [100 x i32]], [201 x [100 x i32]]* %1, i64 0, i64 %19, i64 10
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 2
%23 = getelementptr inbounds [201 x [100 x i32]], [201 x [100 x i32]]* %1, i64 0, i64 %14, i64 %11
store i32 %22, i32* %23
%24 = icmp eq i64 %19, 200
br i1 %24, label %25, label %12
25: ; preds = %12
%26 = add nuw nsw i64 %11, 1
%27 = icmp eq i64 %26, %9
br i1 %27, label %28, label %10
28: ; preds = %25, %0
ret i32 undef
}