xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pthread_yield();
void *new_thread(void *new_buf) {
  int i;
  for (i = 0; i < 10; i++) {
    pthread_yield();
  }
  printf("test_preemption PASSED\n");
  exit(0);
}


x86 assembly (clang, -O0):
<new_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1162 <new_thread+0x32>
mov    $0x0,%al
call   1040 <pthread_yield@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <new_thread+0x13>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<new_thread>:
push   %rax
xor    %eax,%eax
call   1040 <pthread_yield@plt>
xor    %eax,%eax
call   1040 <pthread_yield@plt>
xor    %eax,%eax
call   1040 <pthread_yield@plt>
xor    %eax,%eax
call   1040 <pthread_yield@plt>
xor    %eax,%eax
call   1040 <pthread_yield@plt>
xor    %eax,%eax
call   1040 <pthread_yield@plt>
xor    %eax,%eax
call   1040 <pthread_yield@plt>
xor    %eax,%eax
call   1040 <pthread_yield@plt>
xor    %eax,%eax
call   1040 <pthread_yield@plt>
xor    %eax,%eax
call   1040 <pthread_yield@plt>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"test_preemption PASSED\0A\00"
define i8* @new_thread(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = call i32 (...) @pthread_yield()
br label %9
9: ; preds = %7
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [23 x i8] c"test_preemption PASSED\00"
define noalias i8* @new_thread(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @pthread_yield()
%3 = tail call i32 (...) @pthread_yield()
%4 = tail call i32 (...) @pthread_yield()
%5 = tail call i32 (...) @pthread_yield()
%6 = tail call i32 (...) @pthread_yield()
%7 = tail call i32 (...) @pthread_yield()
%8 = tail call i32 (...) @pthread_yield()
%9 = tail call i32 (...) @pthread_yield()
%10 = tail call i32 (...) @pthread_yield()
%11 = tail call i32 (...) @pthread_yield()
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 0)
unreachable
}
unsigned char xtime(unsigned char b) {
  if ((b & 0x80) == 0) {
    return (b << 1);
  } else {
    return (((b << 1) ^ 0x1B) & 0xFF);
  }
}


x86 assembly (clang, -O0):
<xtime>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    112b <xtime+0x2b>
movzbl -0x2(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x1(%rbp)
jmp    113d <xtime+0x3d>
movzbl -0x2(%rbp),%eax
shl    $0x1,%eax
xor    $0x1b,%eax
and    $0xff,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtime>:
lea    (%rdi,%rdi,1),%eax
movzbl %al,%ecx
xor    $0x1b,%al
test   %dil,%dil
movzbl %al,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @xtime(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 128
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %2
br label %20
13: ; preds = %1
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = shl i32 %15, 1
%17 = xor i32 %16, 27
%18 = and i32 %17, 255
%19 = trunc i32 %18 to i8
store i8 %19, i8* %2
br label %20
20: ; preds = %13, %8
%21 = load i8, i8* %2
ret i8 %21
}

LLVM IR (-O2):
define zeroext i8 @xtime(i8 zeroext %0) {
%2 = icmp sgt i8 %0, -1
%3 = shl i8 %0, 1
%4 = xor i8 %3, 27
%5 = select i1 %2, i8 %3, i8 %4
ret i8 %5
}
void element2BEL() {}


x86 assembly (clang, -O0):
<element2BEL>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<element2BEL>:
ret

LLVM IR (-O0):
define void @element2BEL() {
ret void
}

LLVM IR (-O2):
define void @element2BEL() {
ret void
}
/* Variables and functions */
size_t min(size_t nb1, size_t nb2) { return nb1 < nb2 ? nb1 : nb2; }


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1127 <min+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <min+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovb  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @min(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ult i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @min(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
char *test_helloworld_fail(void) { return "hello world"; }


x86 assembly (clang, -O0):
<test_helloworld_fail>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_helloworld_fail>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"hello world\00"
define i8* @test_helloworld_fail() {
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
define i8* @test_helloworld_fail() {
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
}
int fun519() { return 519; }


x86 assembly (clang, -O0):
<fun519>:
push   %rbp
mov    %rsp,%rbp
mov    $0x207,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun519>:
mov    $0x207,%eax
ret

LLVM IR (-O0):
define i32 @fun519() {
ret i32 519
}

LLVM IR (-O2):
define i32 @fun519() {
ret i32 519
}
int mali_platform_init(void) { return 0; }


x86 assembly (clang, -O0):
<mali_platform_init>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mali_platform_init>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @mali_platform_init() {
ret i32 0
}

LLVM IR (-O2):
define i32 @mali_platform_init() {
ret i32 0
}
int __attribute__((no)) su_get_stack_growth(char *stack_addr) {
  char new_stack_var;
  return (int)((&new_stack_var) - stack_addr);
}


x86 assembly (clang, -O0):
<su_get_stack_growth>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x9(%rbp),%rax
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<su_get_stack_growth>:
lea    -0x1(%rsp),%rax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @su_get_stack_growth(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %4 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @su_get_stack_growth(i8* %0) {
%2 = alloca i8
%3 = ptrtoint i8* %2 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
int compare(const void *a, const void *b) { return *((int *)a) < *((int *)b); }


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
setl   %al
ret

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = icmp slt i32 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
void test45_Test9_targetInit__I() {}


x86 assembly (clang, -O0):
<test45_Test9_targetInit__I>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test45_Test9_targetInit__I>:
ret

LLVM IR (-O0):
define void @test45_Test9_targetInit__I() {
ret void
}

LLVM IR (-O2):
define void @test45_Test9_targetInit__I() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ corrupt_block(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mcheck_regions(int /*<<< orphan*/);
char *mmalloc(int);
void func3() {
  char *p = mmalloc(120);
  corrupt_block(p, 120, 0);
  mcheck_regions(0);
  mcheck_regions(0);
  mcheck_regions(0);
}


x86 assembly (clang, -O0):
<func3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x78,%edi
call   1050 <mmalloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x78,%esi
xor    %edx,%edx
call   1040 <corrupt_block@plt>
xor    %edi,%edi
call   1030 <mcheck_regions@plt>
xor    %edi,%edi
call   1030 <mcheck_regions@plt>
xor    %edi,%edi
call   1030 <mcheck_regions@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func3>:
push   %rax
mov    $0x78,%edi
call   1050 <mmalloc@plt>
mov    %rax,%rdi
mov    $0x78,%esi
xor    %edx,%edx
call   1040 <corrupt_block@plt>
xor    %edi,%edi
call   1030 <mcheck_regions@plt>
xor    %edi,%edi
call   1030 <mcheck_regions@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <mcheck_regions@plt>

LLVM IR (-O0):
define void @func3() {
%1 = alloca i8*
%2 = call i8* @mmalloc(i32 120)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @corrupt_block(i8* %3, i32 120, i32 0)
%5 = call i32 @mcheck_regions(i32 0)
%6 = call i32 @mcheck_regions(i32 0)
%7 = call i32 @mcheck_regions(i32 0)
ret void
}

LLVM IR (-O2):
define void @func3() {
%1 = tail call i8* @mmalloc(i32 120)
%2 = tail call i32 @corrupt_block(i8* %1, i32 120, i32 0)
%3 = tail call i32 @mcheck_regions(i32 0)
%4 = tail call i32 @mcheck_regions(i32 0)
%5 = tail call i32 @mcheck_regions(i32 0)
ret void
}
int test_imm_42uint32_reg(unsigned int val) {
  return ((val) & (0x42 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_42uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x42,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_42uint32_reg>:
test   $0x42,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_42uint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 66
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_42uint32_reg(i32 %0) {
%2 = and i32 %0, 66
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void swap(float *ptr1, float *ptr2) {
  float temp;
  temp = *ptr1;
  *ptr1 = *ptr2;
  *ptr2 = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x14(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
movss  %xmm1,(%rdi)
movss  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define void @swap(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%6 = load float*, float** %3
%7 = load float, float* %6
store float %7, float* %5
%8 = load float*, float** %4
%9 = load float, float* %8
%10 = load float*, float** %3
store float %9, float* %10
%11 = load float, float* %5
%12 = load float*, float** %4
store float %11, float* %12
ret void
}

LLVM IR (-O2):
define void @swap(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
store float %4, float* %0
store float %3, float* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int edad;
  printf("Introduce un numero:");
  scanf("%d", &edad);
  printf("%d", edad);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecb(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Introduce un numero:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [21 x i8] c"Introduce un numero:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 @exit(i32 0)
unreachable
}
int get_dock_bat_cap_byhw(void) {
  int bat_cap = -1;
  if (bat_cap < 0) {
    pr_err("[BAT]error!! in %s(), read bat capacity error\n", __FUNCTION__);
  }
  return bat_cap;
}


x86 assembly (clang, -O0):
<get_dock_bat_cap_byhw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    113e <get_dock_bat_cap_byhw+0x2e>
lea    0xed0(%rip),%rdi
lea    0xef8(%rip),%rsi
mov    $0x0,%al
call   1030 <pr_err@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_dock_bat_cap_byhw>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xf10(%rip),%rsi
xor    %eax,%eax
call   1030 <pr_err@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"[BAT]error!! in %s(), read bat capacity error\0A\00"
@__FUNCTION__.get_dock_bat_cap_byhw = [22 x i8] c"get_dock_bat_cap_byhw\00"
define i32 @get_dock_bat_cap_byhw() {
%1 = alloca i32
store i32 -1, i32* %1
%2 = load i32, i32* %1
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @pr_err to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.get_dock_bat_cap_byhw, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [47 x i8] c"[BAT]error!! in %s(), read bat capacity error\0A\00"
@__FUNCTION__.get_dock_bat_cap_byhw = [22 x i8] c"get_dock_bat_cap_byhw\00"
define i32 @get_dock_bat_cap_byhw() {
%1 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @pr_err to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.get_dock_bat_cap_byhw, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ setlocale(int, char *);
void uninitvar_setlocale(void) {
  int category;
  char *locale;
  (void)setlocale(category, locale);
}


x86 assembly (clang, -O0):
<uninitvar_setlocale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <setlocale@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_setlocale>:
jmp    1030 <setlocale@plt>

LLVM IR (-O0):
define void @uninitvar_setlocale() {
%1 = alloca i32
%2 = alloca i8*
%3 = load i32, i32* %1
%4 = load i8*, i8** %2
%5 = call i32 @setlocale(i32 %3, i8* %4)
ret void
}

LLVM IR (-O2):
define void @uninitvar_setlocale() {
%1 = tail call i32 @setlocale(i32 undef, i8* undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void print_usage(void) {
  puts("\nUsage:"
       "\n"
       "\n\trun_with_timeout <timeout in seconds> '<command>'"
       "\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"\0AUsage:\0A\0A\09run_with_timeout <timeout in seconds> '<command>'\0A\00"
define void @print_usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [61 x i8] c"\0AUsage:\0A\0A\09run_with_timeout <timeout in seconds> '<command>'\0A\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
__int128 addmem(__int128 *a, __int128_t *b) { return *a + *b; }


x86 assembly (clang, -O0):
<addmem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
mov    0x8(%rax),%rax
mov    -0x20(%rbp),%rdx
mov    (%rdx),%rsi
mov    0x8(%rdx),%rdx
add    %rsi,%rcx
adc    %rdx,%rax
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<addmem>:
mov    (%rsi),%rax
add    (%rdi),%rax
mov    0x8(%rsi),%rdx
adc    0x8(%rdi),%rdx
ret

LLVM IR (-O0):
define { i64, i64 } @addmem(i128* %0, i128* %1) {
%3 = alloca i128
%4 = alloca i128*
%5 = alloca i128*
store i128* %0, i128** %4
store i128* %1, i128** %5
%6 = load i128*, i128** %4
%7 = load i128, i128* %6
%8 = load i128*, i128** %5
%9 = load i128, i128* %8
%10 = add nsw i128 %7, %9
store i128 %10, i128* %3
%11 = bitcast i128* %3 to { i64, i64 }*
%12 = load { i64, i64 }, { i64, i64 }* %11
ret { i64, i64 } %12
}

LLVM IR (-O2):
define { i64, i64 } @addmem(i128* nocapture %0, i128* nocapture %1) {
%3 = load i128, i128* %0
%4 = load i128, i128* %1
%5 = add nsw i128 %4, %3
%6 = trunc i128 %5 to i64
%7 = lshr i128 %5, 64
%8 = trunc i128 %7 to i64
%9 = insertvalue { i64, i64 } poison, i64 %6, 0
%10 = insertvalue { i64, i64 } %9, i64 %8, 1
ret { i64, i64 } %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void ACUTE_testMethodDummy(void) { printf("This is a test method\n"); }


x86 assembly (clang, -O0):
<ACUTE_testMethodDummy>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ACUTE_testMethodDummy>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"This is a test method\0A\00"
define void @ACUTE_testMethodDummy() {
%1 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [22 x i8] c"This is a test method\00"
define void @ACUTE_testMethodDummy() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ web_atou(char *, unsigned int, unsigned int *);
char *web_get_str_param(char const *, unsigned int, char const *,
                        unsigned int *);
unsigned int web_get_int_param(const char *head, unsigned int head_size,
                               const char *param) {
  char *cur_txt;
  unsigned int cur_len;
  unsigned int res = 0;
  cur_txt = web_get_str_param(head, head_size, param, &cur_len);
  if (cur_txt != 0)
    web_atou(cur_txt, cur_len, &res);
  return res;
}


x86 assembly (clang, -O0):
<web_get_int_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1030 <web_get_str_param@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     116d <web_get_int_param+0x4d>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    -0x28(%rbp),%rdx
call   1040 <web_atou@plt>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<web_get_int_param>:
push   %rax
movl   $0x0,(%rsp)
lea    0x4(%rsp),%rcx
call   1030 <web_get_str_param@plt>
test   %rax,%rax
je     114b <web_get_int_param+0x2b>
mov    0x4(%rsp),%esi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1040 <web_atou@plt>
mov    (%rsp),%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @web_get_int_param(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32 0, i32* %9
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = load i8*, i8** %6
%13 = call i8* @web_get_str_param(i8* %10, i32 %11, i8* %12, i32* %8)
store i8* %13, i8** %7
%14 = load i8*, i8** %7
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %20
16: ; preds = %3
%17 = load i8*, i8** %7
%18 = load i32, i32* %8
%19 = call i32 @web_atou(i8* %17, i32 %18, i32* %9)
br label %20
20: ; preds = %16, %3
%21 = load i32, i32* %9
ret i32 %21
}

LLVM IR (-O2):
define i32 @web_get_int_param(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
%7 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%8 = call i8* @web_get_str_param(i8* %0, i32 %1, i8* %2, i32* %4)
%9 = icmp eq i8* %8, null
br i1 %9, label %14, label %10
10: ; preds = %3
%11 = load i32, i32* %4
%12 = call i32 @web_atou(i8* %8, i32 %11, i32* %5)
%13 = load i32, i32* %5
br label %14
14: ; preds = %10, %3
%15 = phi i32 [ %13, %10 ], [ 0, %3 ]
ret i32 %15
}
/* Variables and functions */
int ArgNum();
int GetFlag(int);
int Cnd_BitTest(void) {
  int v = ArgNum();
  int x = ArgNum();
  if ((GetFlag(v) & (1 << x)) == 0)
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<Cnd_BitTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <ArgNum@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <ArgNum@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <GetFlag@plt>
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jne    1167 <Cnd_BitTest+0x47>
movl   $0x0,-0x4(%rbp)
jmp    116e <Cnd_BitTest+0x4e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cnd_BitTest>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <ArgNum@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <ArgNum@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <GetFlag@plt>
mov    %ebp,%ecx
shr    %cl,%eax
and    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Cnd_BitTest() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @ArgNum()
store i32 %4, i32* %2
%5 = call i32 (...) @ArgNum()
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = call i32 @GetFlag(i32 %6)
%8 = load i32, i32* %3
%9 = shl i32 1, %8
%10 = and i32 %7, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %0
store i32 0, i32* %1
br label %14
13: ; preds = %0
store i32 1, i32* %1
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
define i32 @Cnd_BitTest() {
%1 = tail call i32 (...) @ArgNum()
%2 = tail call i32 (...) @ArgNum()
%3 = tail call i32 @GetFlag(i32 %1)
%4 = lshr i32 %3, %2
%5 = and i32 %4, 1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ gl_err(char *);
void *malloc(int);
void *gl_malloc(int size) {
  void *ptr;
  ptr = malloc(size);
  if (ptr == 0 && size)
    gl_err("No more memory");
  return ptr;
}


x86 assembly (clang, -O0):
<gl_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1158 <gl_malloc+0x38>
cmpl   $0x0,-0x4(%rbp)
je     1158 <gl_malloc+0x38>
lea    0xead(%rip),%rdi
call   1040 <gl_err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl_malloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %ebp,%ebp
je     1142 <gl_malloc+0x22>
test   %rbx,%rbx
jne    1142 <gl_malloc+0x22>
lea    0xec3(%rip),%rdi
call   1040 <gl_err@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"No more memory\00"
define i8* @gl_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @gl_err(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8, %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [15 x i8] c"No more memory\00"
define noalias i8* @gl_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
%4 = icmp ne i32 %0, 0
%5 = and i1 %4, %3
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @gl_err(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret i8* %2
}
/* Type definitions */
struct list_node {
  int dummy;
};
struct list {
  int dummy;
};

/* Variables and functions */
struct list_node *list_delete(struct list *, int);
struct list_node *list_pop_back(struct list *self) {
  return list_delete(self, -1);
}


x86 assembly (clang, -O0):
<list_pop_back>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xffffffff,%esi
call   1030 <list_delete@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_pop_back>:
mov    $0xffffffff,%esi
jmp    1030 <list_delete@plt>

LLVM IR (-O0):
%struct.list_node = type { i32 }
%struct.list = type { i32 }
define %struct.list_node* @list_pop_back(%struct.list* %0) {
%2 = alloca %struct.list*
store %struct.list* %0, %struct.list** %2
%3 = load %struct.list*, %struct.list** %2
%4 = call %struct.list_node* @list_delete(%struct.list* %3, i32 -1)
ret %struct.list_node* %4
}

LLVM IR (-O2):
%struct.list_node = type { i32 }
%struct.list = type { i32 }
define %struct.list_node* @list_pop_back(%struct.list* %0) {
%2 = tail call %struct.list_node* @list_delete(%struct.list* %0, i32 -1)
ret %struct.list_node* %2
}
int within(char chr, char *str) {
  while (*str)
    if (chr == *str++)
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<within>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114a <within+0x4a>
movsbl -0x5(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1145 <within+0x45>
movl   $0x1,-0x4(%rbp)
jmp    1151 <within+0x51>
jmp    110e <within+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<within>:
movzbl (%rsi),%eax
test   %al,%al
je     1116 <within+0x16>
add    $0x1,%rsi
cmp    %dil,%al
jne    1100 <within>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @within(i8 signext %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8*
store i8 %0, i8* %4
store i8* %1, i8** %5
br label %6
6: ; preds = %19, %2
%7 = load i8*, i8** %5
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %5
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %12, %16
br i1 %17, label %18, label %19
18: ; preds = %10
store i32 1, i32* %3
br label %21
19: ; preds = %10
br label %6
20: ; preds = %6
store i32 0, i32* %3
br label %21
21: ; preds = %20, %18
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @within(i8 signext %0, i8* nocapture %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %1, %2 ], [ %8, %7 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = icmp eq i8 %5, %0
br i1 %9, label %10, label %3
10: ; preds = %3, %7
%11 = phi i32 [ 1, %7 ], [ 0, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ PTHREAD_CANCEL_DEFERRED;
int /*<<< orphan*/ PTHREAD_CANCEL_ENABLE;
int pthread_setcancelstate(int /*<<< orphan*/, int /*<<< orphan*/ *);
int pthread_setcanceltype(int /*<<< orphan*/, int /*<<< orphan*/ *);
int setup_io_thread(void) {
  if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == -1)
    return -1;
  if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) == -1)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<setup_io_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <pthread_setcancelstate@plt>
cmp    $0xffffffff,%eax
jne    114f <setup_io_thread+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    117d <setup_io_thread+0x5d>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <pthread_setcanceltype@plt>
cmp    $0xffffffff,%eax
jne    1176 <setup_io_thread+0x56>
movl   $0xffffffff,-0x4(%rbp)
jmp    117d <setup_io_thread+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_io_thread>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <pthread_setcancelstate@plt>
cmp    $0xffffffff,%eax
je     1154 <setup_io_thread+0x34>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <pthread_setcanceltype@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
sete   %al
neg    %eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@PTHREAD_CANCEL_ENABLE = global i32 0
@PTHREAD_CANCEL_DEFERRED = global i32 0
define i32 @setup_io_thread() {
%1 = alloca i32
%2 = load i32, i32* @PTHREAD_CANCEL_ENABLE
%3 = call i32 @pthread_setcancelstate(i32 %2, i32* null)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 -1, i32* %1
br label %12
6: ; preds = %0
%7 = load i32, i32* @PTHREAD_CANCEL_DEFERRED
%8 = call i32 @pthread_setcanceltype(i32 %7, i32* null)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %6
store i32 -1, i32* %1
br label %12
11: ; preds = %6
store i32 0, i32* %1
br label %12
12: ; preds = %11, %10, %5
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@PTHREAD_CANCEL_ENABLE = global i32 0
@PTHREAD_CANCEL_DEFERRED = global i32 0
define i32 @setup_io_thread() {
%1 = load i32, i32* @PTHREAD_CANCEL_ENABLE
%2 = tail call i32 @pthread_setcancelstate(i32 %1, i32* null)
%3 = icmp eq i32 %2, -1
br i1 %3, label %9, label %4
4: ; preds = %0
%5 = load i32, i32* @PTHREAD_CANCEL_DEFERRED
%6 = tail call i32 @pthread_setcanceltype(i32 %5, i32* null)
%7 = icmp eq i32 %6, -1
%8 = sext i1 %7 to i32
br label %9
9: ; preds = %4, %0
%10 = phi i32 [ -1, %0 ], [ %8, %4 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int getc(int /*<<< orphan*/ *const);
int /*<<< orphan*/ pm_error(char *);
unsigned char pm_getrawbyte(FILE *const file) {
  int iby;
  iby = getc(file);
  if (iby == EOF)
    pm_error("EOF / read error reading a one-byte sample");
  return (unsigned char)iby;
}


x86 assembly (clang, -O0):
<pm_getrawbyte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ea6(%rip),%rcx
cmp    (%rcx),%eax
jne    1156 <pm_getrawbyte+0x36>
lea    0xeaf(%rip),%rdi
call   1040 <pm_error@plt>
mov    -0xc(%rbp),%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pm_getrawbyte>:
push   %rbx
call   1030 <getc@plt>
mov    %eax,%ebx
mov    0x2eb9(%rip),%rax
cmp    (%rax),%ebx
jne    113f <pm_getrawbyte+0x1f>
lea    0xec6(%rip),%rdi
call   1040 <pm_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [43 x i8] c"EOF / read error reading a one-byte sample\00"
define zeroext i8 @pm_getrawbyte(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @getc(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @pm_error(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = load i32, i32* %3
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [43 x i8] c"EOF / read error reading a one-byte sample\00"
define zeroext i8 @pm_getrawbyte(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @pm_error(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = trunc i32 %2 to i8
ret i8 %8
}
/* Type definitions */
struct linger {
  int l_onoff;
  scalar_t__ l_linger;
};
typedef int /*<<< orphan*/ linger;

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_LINGER;
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              char const *, int);
void disable_socket_linger(int s) {
  struct linger linger;
  linger.l_onoff = 1;
  linger.l_linger = 0;
  setsockopt(s, SOL_SOCKET, SO_LINGER, (const char *)&linger, sizeof(linger));
}


x86 assembly (clang, -O0):
<disable_socket_linger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable_socket_linger>:
sub    $0x18,%rsp
movl   $0x1,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.linger = type { i32, i64 }
@SOL_SOCKET = global i32 0
@SO_LINGER = global i32 0
define void @disable_socket_linger(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.linger
store i32 %0, i32* %2
%4 = getelementptr inbounds %struct.linger, %struct.linger* %3, i32 0, i32 0
store i32 1, i32* %4
%5 = getelementptr inbounds %struct.linger, %struct.linger* %3, i32 0, i32 1
store i64 0, i64* %5
%6 = load i32, i32* %2
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_LINGER
%9 = bitcast %struct.linger* %3 to i8*
%10 = call i32 @setsockopt(i32 %6, i32 %7, i32 %8, i8* %9, i32 16)
ret void
}

LLVM IR (-O2):
%struct.linger = type { i32, i64 }
@SOL_SOCKET = global i32 0
@SO_LINGER = global i32 0
define void @disable_socket_linger(i32 %0) {
%2 = alloca %struct.linger
%3 = bitcast %struct.linger* %2 to i8*
%4 = getelementptr inbounds %struct.linger, %struct.linger* %2, i64 0, i32 0
store i32 1, i32* %4
%5 = getelementptr inbounds %struct.linger, %struct.linger* %2, i64 0, i32 1
store i64 0, i64* %5
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_LINGER
%8 = call i32 @setsockopt(i32 %0, i32 %6, i32 %7, i8* %3, i32 16)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
int /*<<< orphan*/ free(char *);
void path_free(char *pszPath) {
  assert(pszPath);
  free(pszPath);
}


x86 assembly (clang, -O0):
<path_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @path_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @assert(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @path_free(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i32 @free(i8* %0)
ret void
}
void XLowerWindow() {}


x86 assembly (clang, -O0):
<XLowerWindow>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XLowerWindow>:
ret

LLVM IR (-O0):
define void @XLowerWindow() {
ret void
}

LLVM IR (-O2):
define void @XLowerWindow() {
ret void
}
/* Variables and functions */
int VerboseLevelEx(int, int);
int VerboseLevel(int level) { return VerboseLevelEx((1), level); }


x86 assembly (clang, -O0):
<VerboseLevel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1030 <VerboseLevelEx@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VerboseLevel>:
mov    %edi,%esi
mov    $0x1,%edi
jmp    1030 <VerboseLevelEx@plt>

LLVM IR (-O0):
define i32 @VerboseLevel(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @VerboseLevelEx(i32 1, i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @VerboseLevel(i32 %0) {
%2 = tail call i32 @VerboseLevelEx(i32 1, i32 %0)
ret i32 %2
}
int intcmp(const void *v1, const void *v2) { return *(int *)v1 - *(int *)v2; }


x86 assembly (clang, -O0):
<intcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intcmp>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @intcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @intcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
char *chomp(char *s) {
  char *p = s;
  while (*p && *p != '\n' && *p != '\r')
    p++;
  *p = 0;
  return s;
}


x86 assembly (clang, -O0):
<chomp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     114a <chomp+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x11(%rbp)
je     114a <chomp+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115a <chomp+0x5a>
jmp    116b <chomp+0x6b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <chomp+0x10>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp>:
mov    %rdi,%rax
mov    $0x2401,%edx
mov    %rdi,%rcx
jmp    1114 <chomp+0x14>
nopl   (%rax)
add    $0x1,%rcx
movzbl (%rcx),%esi
cmp    $0xd,%rsi
ja     1110 <chomp+0x10>
bt     %rsi,%rdx
jae    1110 <chomp+0x10>
movb   $0x0,(%rcx)
ret

LLVM IR (-O0):
define i8* @chomp(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %22, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 10
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 13
br label %20
20: ; preds = %15, %10, %5
%21 = phi i1 [ false, %10 ], [ false, %5 ], [ %19, %15 ]
br i1 %21, label %22, label %25
22: ; preds = %20
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %3
br label %5
25: ; preds = %20
%26 = load i8*, i8** %3
store i8 0, i8* %26
%27 = load i8*, i8** %2
ret i8* %27
}

LLVM IR (-O2):
define i8* @chomp(i8* returned %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 10, label %7
i8 13, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2, %2
store i8 0, i8* %3
ret i8* %0
}
void RTMsgErrorExit(void) {}


x86 assembly (clang, -O0):
<RTMsgErrorExit>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RTMsgErrorExit>:
ret

LLVM IR (-O0):
define void @RTMsgErrorExit() {
ret void
}

LLVM IR (-O2):
define void @RTMsgErrorExit() {
ret void
}
/* Variables and functions */
int rand();
int ConditionRandom(int Range) { return rand() % Range == 0; }


x86 assembly (clang, -O0):
<ConditionRandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConditionRandom>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
xor    %eax,%eax
test   %edx,%edx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ConditionRandom(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @ConditionRandom(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
int main() {
  char *s = "hello, linux!";
  write(1, s, strlen(s));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"hello, linux!\00"
define i32 @main() {
%1 = alloca i8*
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @strlen(i8* %3)
%5 = call i32 @write(i32 1, i8* %2, i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"hello, linux!\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void crc_zap(buf, bufsz) char *buf;
int bufsz;
{
  for (; bufsz > 0; bufsz--, buf++)
    *buf = 0;
  return;
}


x86 assembly (clang, -O0):
<crc_zap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1136 <crc_zap+0x36>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110b <crc_zap+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc_zap>:
test   %esi,%esi
jle    1122 <crc_zap+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @crc_zap(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %10, %2
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i8*, i8** %3
store i8 0, i8* %9
br label %10
10: ; preds = %8
%11 = load i32, i32* %4
%12 = add nsw i32 %11, -1
store i32 %12, i32* %4
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
br label %5
15: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @crc_zap(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int /*<<< orphan*/ foo();
int main() {
  bar();
  foo();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bar@plt>
mov    $0x0,%al
call   1040 <foo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1040 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @bar()
%3 = call i32 (...) @foo()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @bar()
%2 = tail call i32 (...) @foo()
ret i32 0
}