xunge/DecIR huggingface dataset:
void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi, struct bio *bio,
                               struct bio_post_read_ctx *ctx) {}


x86 assembly (clang, -O0):
<iostat_alloc_and_bind_ctx>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.f2fs_sb_info = type opaque
%struct.bio = type opaque
%struct.bio_post_read_ctx = type opaque
define void @iostat_alloc_and_bind_ctx(%struct.f2fs_sb_info* %0, %struct.bio* %1, %struct.bio_post_read_ctx* %2) {
%4 = alloca %struct.f2fs_sb_info*
%5 = alloca %struct.bio*
%6 = alloca %struct.bio_post_read_ctx*
store %struct.f2fs_sb_info* %0, %struct.f2fs_sb_info** %4
store %struct.bio* %1, %struct.bio** %5
store %struct.bio_post_read_ctx* %2, %struct.bio_post_read_ctx** %6
ret void
}

LLVM IR (-O2):
%struct.f2fs_sb_info = type opaque
%struct.bio = type opaque
%struct.bio_post_read_ctx = type opaque
define void @iostat_alloc_and_bind_ctx(%struct.f2fs_sb_info* nocapture %0, %struct.bio* nocapture %1, %struct.bio_post_read_ctx* nocapture %2) {
ret void
}
/* Type definitions */
struct lvalue {
  int dummy;
};

/* Variables and functions */
scalar_t__ dbltest(struct lvalue *, struct lvalue *);
int /*<<< orphan*/ gen_pop();
int /*<<< orphan*/ output_line(char *);
void gen_add(struct lvalue *lval, struct lvalue *lval2) {
  if (dbltest(lval2, lval)) {
    output_line("addd ,s");
    output_line("addd ,s");
  } else
    output_line("addd ,s");
  gen_pop();
}


x86 assembly (clang, -O0):
<gen_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <dbltest@plt>
cmp    $0x0,%rax
je     1174 <gen_add+0x44>
lea    0xea2(%rip),%rdi
call   1040 <output_line@plt>
lea    0xe96(%rip),%rdi
call   1040 <output_line@plt>
jmp    1180 <gen_add+0x50>
lea    0xe85(%rip),%rdi
call   1040 <output_line@plt>
mov    $0x0,%al
call   1030 <gen_pop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_add>:
push   %rbx
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1050 <dbltest@plt>
mov    %rax,%rbx
lea    0xeb7(%rip),%rdi
call   1040 <output_line@plt>
test   %rbx,%rbx
je     115f <gen_add+0x2f>
lea    0xea6(%rip),%rdi
call   1040 <output_line@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <gen_pop@plt>

LLVM IR (-O0):
%struct.lvalue = type { i32 }
@.str = [8 x i8] c"addd ,s\00"
define void @gen_add(%struct.lvalue* %0, %struct.lvalue* %1) {
%3 = alloca %struct.lvalue*
%4 = alloca %struct.lvalue*
store %struct.lvalue* %0, %struct.lvalue** %3
store %struct.lvalue* %1, %struct.lvalue** %4
%5 = load %struct.lvalue*, %struct.lvalue** %4
%6 = load %struct.lvalue*, %struct.lvalue** %3
%7 = call i64 @dbltest(%struct.lvalue* %5, %struct.lvalue* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @output_line(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @output_line(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %14
12: ; preds = %2
%13 = call i32 @output_line(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = call i32 (...) @gen_pop()
ret void
}

LLVM IR (-O2):
%struct.lvalue = type { i32 }
@.str = [8 x i8] c"addd ,s\00"
define void @gen_add(%struct.lvalue* %0, %struct.lvalue* %1) {
%3 = tail call i64 @dbltest(%struct.lvalue* %1, %struct.lvalue* %0)
%4 = icmp eq i64 %3, 0
%5 = tail call i32 @output_line(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br i1 %4, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @output_line(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = tail call i32 (...) @gen_pop()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ I2S0_Tx_DriverIRQHandler();
__attribute__((weak)) void I2S0_Tx_IRQHandler(void) {
  I2S0_Tx_DriverIRQHandler();
}


x86 assembly (clang, -O0):
<I2S0_Tx_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <I2S0_Tx_DriverIRQHandler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2S0_Tx_IRQHandler>:
xor    %eax,%eax
jmp    1030 <I2S0_Tx_DriverIRQHandler@plt>

LLVM IR (-O0):
define weak void @I2S0_Tx_IRQHandler() {
%1 = call i32 (...) @I2S0_Tx_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @I2S0_Tx_IRQHandler() {
%1 = tail call i32 (...) @I2S0_Tx_DriverIRQHandler()
ret void
}
/* Type definitions */
struct image_contents_s {
  int dummy;
};

/* Variables and functions */
struct image_contents_s *diskcontents_iec_read(unsigned int);
struct image_contents_s *machine_diskcontents_bus_read(unsigned int unit) {
  return diskcontents_iec_read(unit);
}


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

x86 assembly (clang, -O2):
<machine_diskcontents_bus_read>:
jmp    1030 <diskcontents_iec_read@plt>

LLVM IR (-O0):
%struct.image_contents_s = type { i32 }
define %struct.image_contents_s* @machine_diskcontents_bus_read(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call %struct.image_contents_s* @diskcontents_iec_read(i32 %3)
ret %struct.image_contents_s* %4
}

LLVM IR (-O2):
%struct.image_contents_s = type { i32 }
define %struct.image_contents_s* @machine_diskcontents_bus_read(i32 %0) {
%2 = tail call %struct.image_contents_s* @diskcontents_iec_read(i32 %0)
ret %struct.image_contents_s* %2
}
int rlDidEnvironmentConnect() { return 1; }


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

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

LLVM IR (-O0):
define i32 @rlDidEnvironmentConnect() {
ret i32 1
}

LLVM IR (-O2):
define i32 @rlDidEnvironmentConnect() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ findFreeFdSlotReturnsFreeSlots();
int /*<<< orphan*/ getHostnameFromAddress();
int /*<<< orphan*/ test(char *, int /*<<< orphan*/);
int /*<<< orphan*/ wrapFdFillsSlot();
void runTests() {
  test("find free slots", findFreeFdSlotReturnsFreeSlots());
  test("wrap fd fills up free slot", wrapFdFillsSlot());
  test("get hostname from address", getHostnameFromAddress());
}


x86 assembly (clang, -O0):
<runTests>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <findFreeFdSlotReturnsFreeSlots@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1060 <test@plt>
mov    $0x0,%al
call   1050 <wrapFdFillsSlot@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1060 <test@plt>
mov    $0x0,%al
call   1040 <getHostnameFromAddress@plt>
mov    %eax,%esi
lea    0xead(%rip),%rdi
call   1060 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<runTests>:
push   %rax
xor    %eax,%eax
call   1030 <findFreeFdSlotReturnsFreeSlots@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1060 <test@plt>
xor    %eax,%eax
call   1050 <wrapFdFillsSlot@plt>
lea    0xeac(%rip),%rdi
mov    %eax,%esi
call   1060 <test@plt>
xor    %eax,%eax
call   1040 <getHostnameFromAddress@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1060 <test@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"find free slots\00"
@.str.1 = [27 x i8] c"wrap fd fills up free slot\00"
@.str.2 = [26 x i8] c"get hostname from address\00"
define void @runTests() {
%1 = call i32 (...) @findFreeFdSlotReturnsFreeSlots()
%2 = call i32 @test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 (...) @wrapFdFillsSlot()
%4 = call i32 @test(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @getHostnameFromAddress()
%6 = call i32 @test(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"find free slots\00"
@.str.1 = [27 x i8] c"wrap fd fills up free slot\00"
@.str.2 = [26 x i8] c"get hostname from address\00"
define void @runTests() {
%1 = tail call i32 (...) @findFreeFdSlotReturnsFreeSlots()
%2 = tail call i32 @test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @wrapFdFillsSlot()
%4 = tail call i32 @test(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @getHostnameFromAddress()
%6 = tail call i32 @test(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret void
}
int CLemma_IsCharacter(unsigned char const *byte) {
  if ((*byte < (unsigned char const)0x80) ||
      (*byte > (unsigned char const)0xBF))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<CLemma_IsCharacter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x80,%eax
jl     112c <CLemma_IsCharacter+0x2c>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xbf,%eax
jle    1138 <CLemma_IsCharacter+0x38>
movl   $0x1,-0x4(%rbp)
jmp    113f <CLemma_IsCharacter+0x3f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CLemma_IsCharacter>:
xor    %eax,%eax
cmpb   $0xc0,(%rdi)
setge  %al
ret

LLVM IR (-O0):
define i32 @CLemma_IsCharacter(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = icmp slt i32 %6, 128
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = icmp sgt i32 %11, 191
br i1 %12, label %13, label %14
13: ; preds = %8, %1
store i32 1, i32* %2
br label %15
14: ; preds = %8
store i32 0, i32* %2
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @CLemma_IsCharacter(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp sgt i8 %2, -65
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
char *calloc(int, int);
int rand();
int /*<<< orphan*/ strcpy(char *, char *);
char *fn100() {
  char *result;
  result = calloc(5 + rand() % 5, 4);
  strcpy((char *)result, "fn100");
  return result;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x5,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x5,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
lea    0xe93(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"fn100\00"
define i8* @fn100() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 5
%4 = add nsw i32 5, %3
%5 = call i8* @calloc(i32 %4, i32 4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %1
ret i8* %8
}

LLVM IR (-O2):
@.str = [6 x i8] c"fn100\00"
define i8* @fn100() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 5
%3 = add nsw i32 %2, 5
%4 = tail call i8* @calloc(i32 %3, i32 4)
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}
int ay_image_window_add_data(int tag, const unsigned char *buf, long count,
                             int new) {
  return 0;
}


x86 assembly (clang, -O0):
<ay_image_window_add_data>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ay_image_window_add_data(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @ay_image_window_add_data(i32 %0, i8* nocapture readnone %1, i64 %2, i32 %3) {
ret i32 0
}
int exact_square(int num1) {
  int isit, mult = 0;
  while (1) {
    if (mult * mult > num1) {
      isit = 0;
      break;
    }
    if (mult * mult == num1) {
      isit = 1;
      break;
    } else
      mult++;
  }
  return isit;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    112a <exact_square+0x2a>
movl   $0x0,-0x8(%rbp)
jmp    1154 <exact_square+0x54>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    1146 <exact_square+0x46>
movl   $0x1,-0x8(%rbp)
jmp    1154 <exact_square+0x54>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <exact_square+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
test   %edi,%edi
js     1120 <exact_square+0x20>
xor    %edx,%edx
mov    $0x1,%eax
mov    $0x1,%ecx
cmp    %edi,%edx
je     1122 <exact_square+0x22>
mov    %ecx,%edx
imul   %ecx,%edx
add    $0x1,%ecx
cmp    %edi,%edx
jle    1110 <exact_square+0x10>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @exact_square(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
br label %5
5: ; preds = %1, %22
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = mul nsw i32 %6, %7
%9 = load i32, i32* %2
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %5
store i32 0, i32* %3
br label %23
12: ; preds = %5
%13 = load i32, i32* %4
%14 = load i32, i32* %4
%15 = mul nsw i32 %13, %14
%16 = load i32, i32* %2
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 1, i32* %3
br label %23
19: ; preds = %12
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %22
22: ; preds = %19
br label %5
23: ; preds = %18, %11
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @exact_square(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %11, label %6
3: ; preds = %6
%4 = mul nsw i32 %10, %10
%5 = icmp sgt i32 %4, %0
br i1 %5, label %11, label %6
6: ; preds = %1, %3
%7 = phi i32 [ %4, %3 ], [ 0, %1 ]
%8 = phi i32 [ %10, %3 ], [ 0, %1 ]
%9 = icmp eq i32 %7, %0
%10 = add nuw nsw i32 %8, 1
br i1 %9, label %11, label %3
11: ; preds = %3, %6, %1
%12 = phi i32 [ 0, %1 ], [ 1, %6 ], [ 0, %3 ]
ret i32 %12
}
void fn2() {
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<fn2>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <fn2+0x9>
jmp    1109 <fn2+0x9>

x86 assembly (clang, -O2):
<fn2>:
jmp    1100 <fn2>

LLVM IR (-O0):
define void @fn2() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @fn2() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ monitor_put(char);
void monitor_write(char *c) {
  int i;
  while (c[i]) {
    monitor_put(c[i++]);
  }
}


x86 assembly (clang, -O0):
<monitor_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     114e <monitor_write+0x3e>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <monitor_put@plt>
jmp    111c <monitor_write+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<monitor_write>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <monitor_write+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <monitor_put@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <monitor_write+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @monitor_write(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = add i64 %5, 1
%8 = tail call i32 @monitor_put(i8 signext %6)
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glColor4ui(unsigned int, unsigned int, unsigned int,
                              unsigned int);
void Color4ui(unsigned int r, unsigned int g, unsigned int b, unsigned int a) {
  glColor4ui(r, g, b, a);
}


x86 assembly (clang, -O0):
<Color4ui>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <glColor4ui@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Color4ui>:
jmp    1030 <glColor4ui@plt>

LLVM IR (-O0):
define void @Color4ui(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @glColor4ui(i32 %9, i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @Color4ui(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @glColor4ui(i32 %0, i32 %1, i32 %2, i32 %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ av_log_callback(void *, int, char const *,
                                   int /*<<< orphan*/);
void av_vlog(void *avcl, int level, const char *fmt, va_list vl) {
  av_log_callback(avcl, level, fmt, vl);
}


x86 assembly (clang, -O0):
<av_vlog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <av_log_callback@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_vlog>:
jmp    1030 <av_log_callback@plt>

LLVM IR (-O0):
define void @av_vlog(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @av_log_callback(i8* %9, i32 %10, i8* %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @av_vlog(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 @av_log_callback(i8* %0, i32 %1, i8* %2, i32 %3)
ret void
}
/* Variables and functions */
double RAND_MAX;
double rand();
int aleatoire(int maximum) {
  double d;
  d = (double)maximum * rand();
  d = d / (RAND_MAX + 1.0);
  return ((int)d);
}


x86 assembly (clang, -O0):
<aleatoire>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeb6(%rip),%xmm1
mov    0x2e97(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aleatoire>:
push   %rax
cvtsi2sd %edi,%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ec0(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xecc(%rip),%xmm1
mulsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i32 @aleatoire(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to double
%6 = call double (...) @rand()
%7 = fmul double %5, %6
store double %7, double* %3
%8 = load double, double* %3
%9 = load double, double* @RAND_MAX
%10 = fadd double %9, 1.000000e+00
%11 = fdiv double %8, %10
store double %11, double* %3
%12 = load double, double* %3
%13 = fptosi double %12 to i32
ret i32 %13
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i32 @aleatoire(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = tail call double (...) @rand()
%4 = fmul double %3, %2
%5 = load double, double* @RAND_MAX
%6 = fadd double %5, 1.000000e+00
%7 = fdiv double %4, %6
%8 = fptosi double %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ usleep(int);
void *job_task(void *argc) {
  int *i = (int *)argc;
  printf("Job %d ... Processed\n", *i);
  usleep(1000);
  return 0;
}


x86 assembly (clang, -O0):
<job_task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3e8,%edi
call   1040 <usleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<job_task>:
push   %rax
mov    (%rdi),%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3e8,%edi
call   1040 <usleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Job %d ... Processed\0A\00"
define i8* @job_task(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @usleep(i32 1000)
ret i8* null
}

LLVM IR (-O2):
@.str = [22 x i8] c"Job %d ... Processed\0A\00"
define noalias i8* @job_task(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @usleep(i32 1000)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void get_cpuconfig(void) {
  printf("#define V9\n");
  printf("#define DTB_DEFAULT_ENTRIES 32\n");
}


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

x86 assembly (clang, -O2):
<get_cpuconfig>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee7(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"#define V9\0A\00"
@.str.1 = [32 x i8] c"#define DTB_DEFAULT_ENTRIES 32\0A\00"
define void @get_cpuconfig() {
%1 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [11 x i8] c"#define V9\00"
@str.2 = [31 x i8] c"#define DTB_DEFAULT_ENTRIES 32\00"
define void @get_cpuconfig() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.2, i64 0, i64 0))
ret void
}
__attribute__((nodebug)) void foo(int *a) { *a = 1; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movl   $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @foo(i32* nocapture writeonly %0) {
store i32 1, i32* %0
ret void
}
/* Variables and functions */
int EOF;
int getchar();
void purge_stdin(void) {
  int c = 0;
  while (c != '\n' && c != EOF)
    c = getchar();
}


x86 assembly (clang, -O0):
<purge_stdin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1140 <purge_stdin+0x30>
mov    -0x4(%rbp),%eax
mov    0x2eb0(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1150 <purge_stdin+0x40>
jmp    115f <purge_stdin+0x4f>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
jmp    111f <purge_stdin+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<purge_stdin>:
push   %rbx
mov    0x2ed0(%rip),%rbx
cmpl   $0x0,(%rbx)
je     1130 <purge_stdin+0x20>
nopl   (%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1130 <purge_stdin+0x20>
cmp    (%rbx),%eax
jne    1120 <purge_stdin+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @purge_stdin() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %11, %0
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 10
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* %1
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br label %9
9: ; preds = %5, %2
%10 = phi i1 [ false, %2 ], [ %8, %5 ]
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = call i32 (...) @getchar()
store i32 %12, i32* %1
br label %2
13: ; preds = %9
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @purge_stdin() {
%1 = load i32, i32* @EOF
%2 = icmp eq i32 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0, %3
%4 = tail call i32 (...) @getchar()
%5 = icmp ne i32 %4, 10
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %4, %6
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %3, label %9
9: ; preds = %3, %0
ret void
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, int, int);
void printPids() {
  pid_t Pid = getpid();
  pid_t ParentPid = getppid();
  printf("PID: %d\n└ Parent PID: %d\n\n", Pid, ParentPid);
}


x86 assembly (clang, -O0):
<printPids>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPids>:
push   %rbx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <getppid@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"PID: %d\0A\E2\94\94 Parent PID: %d\0A\0A\00"
define void @printPids() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @getpid()
store i32 %3, i32* %1
%4 = call i32 (...) @getppid()
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"PID: %d\0A\E2\94\94 Parent PID: %d\0A\0A\00"
define void @printPids() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 (...) @getppid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret void
}
int doy2tsi(year, doy)
int year;
double doy;
{
  double dj;
  dj = doy2jd(year, doy);
  return ((int)jd2tsi(dj));
}


x86 assembly (clang, -O0):
<doy2tsi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1030 <doy2jd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%al
call   1040 <jd2tsi@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doy2tsi>:
push   %rax
mov    $0x1,%al
call   1030 <doy2jd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    $0x1,%al
pop    %rcx
jmp    1040 <jd2tsi@plt>

LLVM IR (-O0):
define i32 @doy2tsi(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%6 = load i32, i32* %3
%7 = load double, double* %4
%8 = call i32 (i32, double, ...) bitcast (i32 (...)* @doy2jd to i32 (i32, double, ...)*)(i32 %6, double %7)
%9 = sitofp i32 %8 to double
store double %9, double* %5
%10 = load double, double* %5
%11 = call i32 (double, ...) bitcast (i32 (...)* @jd2tsi to i32 (double, ...)*)(double %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @doy2tsi(i32 %0, double %1) {
%3 = tail call i32 (i32, double, ...) bitcast (i32 (...)* @doy2jd to i32 (i32, double, ...)*)(i32 %0, double %1)
%4 = sitofp i32 %3 to double
%5 = tail call i32 (double, ...) bitcast (i32 (...)* @jd2tsi to i32 (double, ...)*)(double %4)
ret i32 %5
}
void swap(char s[], int i, int j) {
  char temp = s[i];
  s[i] = s[j];
  s[j] = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%sil
movslq %edx,%rdx
mov    (%rdi,%rdx,1),%cl
mov    %cl,(%rdi,%rax,1)
mov    %sil,(%rdi,%rdx,1)
ret

LLVM IR (-O0):
define void @swap(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %7
%13 = load i8*, i8** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
%22 = load i8, i8* %7
%23 = load i8*, i8** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 %22, i8* %26
ret void
}

LLVM IR (-O2):
define void @swap(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* %5
store i8 %6, i8* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printValue(int, int);
int /*<<< orphan*/ printf(char *);
int identifyRightmostSetAndTrailingZeros(int value) {
  value ^= (value - 1);
  printValue(value, 8);
  printf(" IRSTZS\n");
  return value;
}


x86 assembly (clang, -O0):
<identifyRightmostSetAndTrailingZeros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1040 <printValue@plt>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<identifyRightmostSetAndTrailingZeros>:
push   %rbx
lea    -0x1(%rdi),%ebx
xor    %edi,%ebx
mov    %ebx,%edi
mov    $0x8,%esi
call   1040 <printValue@plt>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c" IRSTZS\0A\00"
define i32 @identifyRightmostSetAndTrailingZeros(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @printValue(i32 %7, i32 8)
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@str = [8 x i8] c" IRSTZS\00"
define i32 @identifyRightmostSetAndTrailingZeros(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = xor i32 %2, %0
%4 = tail call i32 @printValue(i32 %3, i32 8)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ free(char *);
char *get_string(int /*<<< orphan*/ *);
int get_integer(FILE *f) {
  char *s = get_string(f);
  int v = atoi(s);
  free(s);
  return v;
}


x86 assembly (clang, -O0):
<get_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <get_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_integer>:
push   %rbp
push   %rbx
push   %rax
call   1040 <get_string@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_integer(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i8* @get_string(i32* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @atoi(i8* %7)
store i32 %8, i32* %4
%9 = load i8*, i8** %3
%10 = call i32 @free(i8* %9)
%11 = load i32, i32* %4
ret i32 %11
}

LLVM IR (-O2):
define i32 @get_integer(i32* %0) {
%2 = tail call i8* @get_string(i32* %0)
%3 = tail call i32 @atoi(i8* %2)
%4 = tail call i32 @free(i8* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_sample_spec_equal() {
  printf("NOT IMPLEMENTED:"
         "pa_sample_spec_equal"
         "\n");
}


x86 assembly (clang, -O0):
<pa_sample_spec_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [38 x i8] c"NOT IMPLEMENTED:pa_sample_spec_equal\0A\00"
define i32 @pa_sample_spec_equal() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [37 x i8] c"NOT IMPLEMENTED:pa_sample_spec_equal\00"
define i32 @pa_sample_spec_equal() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int send_data(size_t, char *);
int /*<<< orphan*/ usleep(int);
void *send_func(void *param) {
  int n = 0;
  while (n >= 0) {
    printf("Sending measure request.\n");
    n = send_data((size_t)param, "Reserved:\"for future request flags\"");
    usleep(100000);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<send_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     117b <send_func+0x4b>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <send_data@plt>
mov    %eax,-0xc(%rbp)
mov    $0x186a0,%edi
call   1050 <usleep@plt>
jmp    1143 <send_func+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_func>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee3(%rip),%r14
lea    0xeb8(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <send_data@plt>
mov    %eax,%ebp
mov    $0x186a0,%edi
call   1050 <usleep@plt>
test   %ebp,%ebp
jns    1150 <send_func+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Sending measure request.\0A\00"
@.str.1 = [36 x i8] c"Reserved:\22for future request flags\22\00"
define i8* @send_func(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = ptrtoint i8* %9 to i64
%11 = call i32 @send_data(i64 %10, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
store i32 %11, i32* %3
%12 = call i32 @usleep(i32 100000)
br label %4
13: ; preds = %4
ret i8* null
}

LLVM IR (-O2):
@.str.1 = [36 x i8] c"Reserved:\22for future request flags\22\00"
@str = [25 x i8] c"Sending measure request.\00"
define noalias i8* @send_func(i8* %0) {
%2 = ptrtoint i8* %0 to i64
br label %3
3: ; preds = %1, %3
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @send_data(i64 %2, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @usleep(i32 100000)
%7 = icmp sgt i32 %5, -1
br i1 %7, label %3, label %8
8: ; preds = %3
ret i8* null
}
int foo1(int *A, int N) { return A[N]; }


x86 assembly (clang, -O0):
<foo1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo1>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @foo1(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @foo1(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void print_version(void) {
  printf("sreadahead version %s\n", "1.0");
  printf("Copyright (C) 2008, 2009 Intel Corporation\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xee5(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_version>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xed8(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"sreadahead version %s\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
@.str.2 = [44 x i8] c"Copyright (C) 2008, 2009 Intel Corporation\0A\00"
@EXIT_SUCCESS = global i32 0
define void @print_version() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@.str = [23 x i8] c"sreadahead version %s\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
@EXIT_SUCCESS = global i32 0
@str = [43 x i8] c"Copyright (C) 2008, 2009 Intel Corporation\00"
define void @print_version() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
struct cop_csb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cop_csb_valid(struct cop_csb *);
void cop_csb_spin(struct cop_csb *csb) {
  do {
  } while (!cop_csb_valid(csb));
}


x86 assembly (clang, -O0):
<cop_csb_spin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
jmp    1121 <cop_csb_spin+0x11>
mov    -0x8(%rbp),%rdi
call   1030 <cop_csb_valid@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    111c <cop_csb_spin+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cop_csb_spin>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <cop_csb_valid@plt>
test   %eax,%eax
je     1120 <cop_csb_spin+0x10>
pop    %rbx
ret

LLVM IR (-O0):
%struct.cop_csb = type { i32 }
define void @cop_csb_spin(%struct.cop_csb* %0) {
%2 = alloca %struct.cop_csb*
store %struct.cop_csb* %0, %struct.cop_csb** %2
br label %3
3: ; preds = %4, %1
br label %4
4: ; preds = %3
%5 = load %struct.cop_csb*, %struct.cop_csb** %2
%6 = call i32 @cop_csb_valid(%struct.cop_csb* %5)
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %3, label %9
9: ; preds = %4
ret void
}

LLVM IR (-O2):
%struct.cop_csb = type { i32 }
define void @cop_csb_spin(%struct.cop_csb* %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @cop_csb_valid(%struct.cop_csb* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %2, label %5
5: ; preds = %2
ret void
}
int yalex_strlen(const char *str) {
  if (str == 0)
    return 0;
  int len = 0;
  while (str[len])
    len++;
  return len;
}


x86 assembly (clang, -O0):
<yalex_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <yalex_strlen+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    114c <yalex_strlen+0x4c>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1146 <yalex_strlen+0x46>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <yalex_strlen+0x26>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<yalex_strlen>:
test   %rdi,%rdi
je     111d <yalex_strlen+0x1d>
mov    $0xffffffff,%eax
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <yalex_strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @yalex_strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = trunc i64 %4 to i32
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 0, %1 ], [ %10, %9 ]
ret i32 %12
}
void rop3_30_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D | S;
  stk1 = T ^ stk2;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_30_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_30_0_0>:
or     (%rdi),%sil
xor    %dl,%sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_30_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = load i8, i8* %8
%19 = zext i8 %18 to i32
%20 = xor i32 %17, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %7
%22 = load i8, i8* %7
%23 = load i8*, i8** %4
store i8 %22, i8* %23
ret void
}

LLVM IR (-O2):
define void @rop3_30_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %4, %1
%6 = xor i8 %5, %2
store i8 %6, i8* %0
ret void
}
/* Variables and functions */
unsigned int ioread32(void *);
unsigned int M4U_ReadReg32(unsigned int M4uBase, unsigned int Offset) {
  unsigned int val;
  val = ioread32((void *)(M4uBase + Offset));
  return val;
}


x86 assembly (clang, -O0):
<M4U_ReadReg32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,%eax
mov    %eax,%edi
call   1030 <ioread32@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M4U_ReadReg32>:
add    %esi,%edi
jmp    1030 <ioread32@plt>

LLVM IR (-O0):
define i32 @M4U_ReadReg32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add i32 %6, %7
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
%11 = call i32 @ioread32(i8* %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @M4U_ReadReg32(i32 %0, i32 %1) {
%3 = add i32 %1, %0
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @ioread32(i8* %5)
ret i32 %6
}