#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*/ bar(int);
int foo(void) {
  int a;
  int parm = 11;
  int x;
  int c[100];
  for (a = parm; a < 50; a++) {
    x = a + 5;
    c[x] = c[x + 2] + c[x - 1];
  }
  bar(c[1]);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0xb,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jge    1172 <foo+0x62>
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x2,%eax
cltq
mov    -0x1a0(%rbp,%rax,4),%ecx
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
add    -0x1a0(%rbp,%rax,4),%ecx
movslq -0x10(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1128 <foo+0x18>
mov    -0x19c(%rbp),%edi
call   1030 <bar@plt>
mov    -0x4(%rbp),%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
sub    $0x118,%rsp
mov    $0x14,%eax
nopl   0x0(%rax)
add    -0x88(%rsp,%rax,4),%ecx
mov    %ecx,-0x90(%rsp,%rax,4)
add    -0x84(%rsp,%rax,4),%ecx
mov    %ecx,-0x8c(%rsp,%rax,4)
add    -0x80(%rsp,%rax,4),%ecx
mov    %ecx,-0x88(%rsp,%rax,4)
add    $0x3,%rax
cmp    $0x3b,%rax
jne    1120 <foo+0x10>
mov    -0x7c(%rsp),%edi
add    $0x118,%rsp
jmp    1030 <bar@plt>

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

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