#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 /*<<< orphan*/ foo(int *);
int main() {
  int array[100];
  long i;
  for (i = 0; i < 100; ++i)
    array[i] = -1;
  foo(array);
  for (i = 0; i < 100; ++i)
    if (array[i])
      abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x1a8(%rbp)
cmpq   $0x64,-0x1a8(%rbp)
64
jge    1174 <main+0x54>
mov    -0x1a8(%rbp),%rax
movl   $0xffffffff,-0x1a0(%rbp,%rax,4)
ff ff ff ff
mov    -0x1a8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1a8(%rbp)
jmp    113d <main+0x1d>
lea    -0x1a0(%rbp),%rdi
call   1040 <foo@plt>
movq   $0x0,-0x1a8(%rbp)
cmpq   $0x64,-0x1a8(%rbp)
64
jge    11d1 <main+0xb1>
mov    -0x1a8(%rbp),%rax
cmpl   $0x0,-0x1a0(%rbp,%rax,4)
je     11b5 <main+0x95>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    11ba <main+0x9a>
mov    -0x1a8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1a8(%rbp)
jmp    118b <main+0x6b>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x190,%rsp
mov    %rsp,%rbx
mov    $0x190,%edx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1050 <foo@plt>
mov    $0x4,%eax
nopw   0x0(%rax,%rax,1)
cmpl   $0x0,-0x10(%rsp,%rax,4)
jne    1197 <main+0x67>
cmpl   $0x0,-0xc(%rsp,%rax,4)
jne    1197 <main+0x67>
cmpl   $0x0,-0x8(%rsp,%rax,4)
jne    1197 <main+0x67>
cmpl   $0x0,-0x4(%rsp,%rax,4)
jne    1197 <main+0x67>
cmpl   $0x0,(%rsp,%rax,4)
jne    1197 <main+0x67>
add    $0x5,%rax
cmp    $0x68,%rax
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%4 = call i32 @foo(i32* %3)
br label %28
5: ; preds = %28
%6 = add nuw nsw i64 %29, 1
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %6
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %33
10: ; preds = %5
%11 = add nuw nsw i64 %29, 2
%12 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %33
15: ; preds = %10
%16 = add nuw nsw i64 %29, 3
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %33
20: ; preds = %15
%21 = add nuw nsw i64 %29, 4
%22 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %33
25: ; preds = %20
%26 = add nuw nsw i64 %29, 5
%27 = icmp eq i64 %26, 100
br i1 %27, label %35, label %28
28: ; preds = %25, %0
%29 = phi i64 [ 0, %0 ], [ %26, %25 ]
%30 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 0
br i1 %32, label %5, label %33
33: ; preds = %20, %15, %10, %5, %28
%34 = call i32 (...) @abort()
unreachable
35: ; preds = %25
ret i32 0
}