#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*/ foo_alloc(int);
int /*<<< orphan*/ pthread_exit(void *);
void id_entry(int x) {
  int i;
  for (i = 0; i < 20; i++) {
    foo_alloc(x + i);
  }
  pthread_exit((void *)2);
}


x86 assembly (clang, -O0):
<id_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    1155 <id_entry+0x35>
mov    -0x4(%rbp),%edi
add    -0x8(%rbp),%edi
call   1030 <foo_alloc@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <id_entry+0x12>
mov    $0x2,%edi
call   1040 <pthread_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<id_entry>:
push   %rbx
mov    %edi,%ebx
call   1030 <foo_alloc@plt>
lea    0x1(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x2(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x3(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x4(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x5(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x6(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x7(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x8(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x9(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0xa(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0xb(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0xc(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0xd(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0xe(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0xf(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x10(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x11(%rbx),%edi
call   1030 <foo_alloc@plt>
lea    0x12(%rbx),%edi
call   1030 <foo_alloc@plt>
add    $0x13,%ebx
mov    %ebx,%edi
call   1030 <foo_alloc@plt>
mov    $0x2,%edi
pop    %rbx
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
define void @id_entry(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 20
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
%11 = call i32 @foo_alloc(i32 %10)
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = call i32 @pthread_exit(i8* inttoptr (i64 2 to i8*))
ret void
}

LLVM IR (-O2):
define void @id_entry(i32 %0) {
%2 = tail call i32 @foo_alloc(i32 %0)
%3 = add nsw i32 %0, 1
%4 = tail call i32 @foo_alloc(i32 %3)
%5 = add nsw i32 %0, 2
%6 = tail call i32 @foo_alloc(i32 %5)
%7 = add nsw i32 %0, 3
%8 = tail call i32 @foo_alloc(i32 %7)
%9 = add nsw i32 %0, 4
%10 = tail call i32 @foo_alloc(i32 %9)
%11 = add nsw i32 %0, 5
%12 = tail call i32 @foo_alloc(i32 %11)
%13 = add nsw i32 %0, 6
%14 = tail call i32 @foo_alloc(i32 %13)
%15 = add nsw i32 %0, 7
%16 = tail call i32 @foo_alloc(i32 %15)
%17 = add nsw i32 %0, 8
%18 = tail call i32 @foo_alloc(i32 %17)
%19 = add nsw i32 %0, 9
%20 = tail call i32 @foo_alloc(i32 %19)
%21 = add nsw i32 %0, 10
%22 = tail call i32 @foo_alloc(i32 %21)
%23 = add nsw i32 %0, 11
%24 = tail call i32 @foo_alloc(i32 %23)
%25 = add nsw i32 %0, 12
%26 = tail call i32 @foo_alloc(i32 %25)
%27 = add nsw i32 %0, 13
%28 = tail call i32 @foo_alloc(i32 %27)
%29 = add nsw i32 %0, 14
%30 = tail call i32 @foo_alloc(i32 %29)
%31 = add nsw i32 %0, 15
%32 = tail call i32 @foo_alloc(i32 %31)
%33 = add nsw i32 %0, 16
%34 = tail call i32 @foo_alloc(i32 %33)
%35 = add nsw i32 %0, 17
%36 = tail call i32 @foo_alloc(i32 %35)
%37 = add nsw i32 %0, 18
%38 = tail call i32 @foo_alloc(i32 %37)
%39 = add nsw i32 %0, 19
%40 = tail call i32 @foo_alloc(i32 %39)
%41 = tail call i32 @pthread_exit(i8* inttoptr (i64 2 to i8*))
ret void
}