#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*/ assert(int);
int /*<<< orphan*/ callee(int *);
void example2(void) {
  int arr[20];
  for (int i = 0; i < 20; i++) {
    arr[i] = 42;
    assert(arr[i] == 42);
    callee(arr);
  }
  assert(arr[0] == 100);
  assert(arr[0] == 7);
  assert(arr[0] == 42);
  assert(arr[7] == 100);
  assert(arr[7] == 7);
  assert(arr[7] == 42);
  assert(arr[20] == 100);
  assert(arr[20] == 7);
  assert(arr[20] == 42);
}


x86 assembly (clang, -O0):
<example2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x54(%rbp)
cmpl   $0x14,-0x54(%rbp)
jge    1172 <example2+0x52>
movslq -0x54(%rbp),%rax
movl   $0x2a,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x2a,-0x50(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x50(%rbp),%rdi
call   1040 <callee@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    112f <example2+0xf>
cmpl   $0x64,-0x50(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x7,-0x50(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x2a,-0x50(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x64,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x7,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x2a,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x64,0x0(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x7,0x0(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x2a,0x0(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example2>:
push   %rbx
sub    $0x50,%rsp
movl   $0x2a,(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x4(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x8(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0xc(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x10(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x14(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x18(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x1c(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x20(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x24(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x28(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x2c(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x30(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x34(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x38(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x3c(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x40(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x44(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x48(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
movl   $0x2a,0x4c(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <callee@plt>
xor    %edi,%edi
cmpl   $0x64,(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x7,(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2a,(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x64,0x1c(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x7,0x1c(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2a,0x1c(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x64,0x50(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x7,0x50(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2a,0x50(%rsp)
sete   %dil
call   1030 <assert@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @example2() {
%1 = alloca [20 x i32]
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %19, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 20
br i1 %5, label %6, label %22
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %8
store i32 42, i32* %9
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 42
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%18 = call i32 @callee(i32* %17)
br label %19
19: ; preds = %6
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %3
22: ; preds = %3
%23 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 100
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 7
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 42
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 7
%39 = load i32, i32* %38
%40 = icmp eq i32 %39, 100
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 7
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 7
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 7
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, 42
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 20
%54 = load i32, i32* %53
%55 = icmp eq i32 %54, 100
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
%58 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 20
%59 = load i32, i32* %58
%60 = icmp eq i32 %59, 7
%61 = zext i1 %60 to i32
%62 = call i32 @assert(i32 %61)
%63 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 20
%64 = load i32, i32* %63
%65 = icmp eq i32 %64, 42
%66 = zext i1 %65 to i32
%67 = call i32 @assert(i32 %66)
ret void
}

LLVM IR (-O2):
define void @example2() {
%1 = alloca [20 x i32]
%2 = bitcast [20 x i32]* %1 to i8*
%3 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
store i32 42, i32* %3
%4 = call i32 @assert(i32 1)
%5 = call i32 @callee(i32* %3)
%6 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 1
store i32 42, i32* %6
%7 = call i32 @assert(i32 1)
%8 = call i32 @callee(i32* %3)
%9 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 2
store i32 42, i32* %9
%10 = call i32 @assert(i32 1)
%11 = call i32 @callee(i32* %3)
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 3
store i32 42, i32* %12
%13 = call i32 @assert(i32 1)
%14 = call i32 @callee(i32* %3)
%15 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 4
store i32 42, i32* %15
%16 = call i32 @assert(i32 1)
%17 = call i32 @callee(i32* %3)
%18 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 5
store i32 42, i32* %18
%19 = call i32 @assert(i32 1)
%20 = call i32 @callee(i32* %3)
%21 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 6
store i32 42, i32* %21
%22 = call i32 @assert(i32 1)
%23 = call i32 @callee(i32* %3)
%24 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 7
store i32 42, i32* %24
%25 = call i32 @assert(i32 1)
%26 = call i32 @callee(i32* %3)
%27 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 8
store i32 42, i32* %27
%28 = call i32 @assert(i32 1)
%29 = call i32 @callee(i32* %3)
%30 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 9
store i32 42, i32* %30
%31 = call i32 @assert(i32 1)
%32 = call i32 @callee(i32* %3)
%33 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 10
store i32 42, i32* %33
%34 = call i32 @assert(i32 1)
%35 = call i32 @callee(i32* %3)
%36 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 11
store i32 42, i32* %36
%37 = call i32 @assert(i32 1)
%38 = call i32 @callee(i32* %3)
%39 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 12
store i32 42, i32* %39
%40 = call i32 @assert(i32 1)
%41 = call i32 @callee(i32* %3)
%42 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 13
store i32 42, i32* %42
%43 = call i32 @assert(i32 1)
%44 = call i32 @callee(i32* %3)
%45 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 14
store i32 42, i32* %45
%46 = call i32 @assert(i32 1)
%47 = call i32 @callee(i32* %3)
%48 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 15
store i32 42, i32* %48
%49 = call i32 @assert(i32 1)
%50 = call i32 @callee(i32* %3)
%51 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 16
store i32 42, i32* %51
%52 = call i32 @assert(i32 1)
%53 = call i32 @callee(i32* %3)
%54 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 17
store i32 42, i32* %54
%55 = call i32 @assert(i32 1)
%56 = call i32 @callee(i32* %3)
%57 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 18
store i32 42, i32* %57
%58 = call i32 @assert(i32 1)
%59 = call i32 @callee(i32* %3)
%60 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 19
store i32 42, i32* %60
%61 = call i32 @assert(i32 1)
%62 = call i32 @callee(i32* %3)
%63 = load i32, i32* %3
%64 = icmp eq i32 %63, 100
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = load i32, i32* %3
%68 = icmp eq i32 %67, 7
%69 = zext i1 %68 to i32
%70 = call i32 @assert(i32 %69)
%71 = load i32, i32* %3
%72 = icmp eq i32 %71, 42
%73 = zext i1 %72 to i32
%74 = call i32 @assert(i32 %73)
%75 = load i32, i32* %24
%76 = icmp eq i32 %75, 100
%77 = zext i1 %76 to i32
%78 = call i32 @assert(i32 %77)
%79 = load i32, i32* %24
%80 = icmp eq i32 %79, 7
%81 = zext i1 %80 to i32
%82 = call i32 @assert(i32 %81)
%83 = load i32, i32* %24
%84 = icmp eq i32 %83, 42
%85 = zext i1 %84 to i32
%86 = call i32 @assert(i32 %85)
%87 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 20
%88 = load i32, i32* %87
%89 = icmp eq i32 %88, 100
%90 = zext i1 %89 to i32
%91 = call i32 @assert(i32 %90)
%92 = load i32, i32* %87
%93 = icmp eq i32 %92, 7
%94 = zext i1 %93 to i32
%95 = call i32 @assert(i32 %94)
%96 = load i32, i32* %87
%97 = icmp eq i32 %96, 42
%98 = zext i1 %97 to i32
%99 = call i32 @assert(i32 %98)
ret void
}