xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  for (int i = 0; i < argc; i++) {
    puts(argv[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1158 <main+0x48>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <puts@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1142 <main+0x32>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %7
6: ; preds = %7, %2
ret i32 0
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Variables and functions */
unsigned int sleep(unsigned int);
unsigned int sca_sleep(unsigned int sleep_time) {
  unsigned int time_remaining;
  time_remaining = sleep_time;
  do {
    time_remaining = sleep(time_remaining);
  } while (time_remaining > 0);
}


x86 assembly (clang, -O0):
<sca_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <sleep@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
ja     1121 <sca_sleep+0x11>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sca_sleep>:
push   %rax
mov    %edi,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edi
call   1030 <sleep@plt>
test   %eax,%eax
jne    1120 <sca_sleep+0x10>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @sca_sleep(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
store i32 %5, i32* %4
br label %6
6: ; preds = %9, %1
%7 = load i32, i32* %4
%8 = call i32 @sleep(i32 %7)
store i32 %8, i32* %4
br label %9
9: ; preds = %6
%10 = load i32, i32* %4
%11 = icmp ugt i32 %10, 0
br i1 %11, label %6, label %12
12: ; preds = %9
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @sca_sleep(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %4, %2 ]
%4 = tail call i32 @sleep(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
ret i32 undef
}
void *thr_func(void *arg) { printf("New Thread: %s\n", arg); }


x86 assembly (clang, -O0):
<thr_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thr_func>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"New Thread: %s\0A\00"
define i8* @thr_func(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %2
ret i8* %6
}

LLVM IR (-O2):
@.str = [16 x i8] c"New Thread: %s\0A\00"
define noalias i8* @thr_func(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* undef
}
/* Variables and functions */
int climbStairs(int);
int /*<<< orphan*/ printf(char *, int);
void test(int n) { printf("comb = %d\n", climbStairs(n)); }


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

x86 assembly (clang, -O2):
<test>:
push   %rax
call   1040 <climbStairs@plt>
lea    0xed3(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"comb = %d\0A\00"
define void @test(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @climbStairs(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"comb = %d\0A\00"
define void @test(i32 %0) {
%2 = tail call i32 @climbStairs(i32 %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  int n = 0;
  while (1) {
    sleep(2);
    printf("HELLO FROM C: %d\n", n++);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x2,%edi
call   1040 <sleep@plt>
mov    -0x14(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    %eax,-0x14(%rbp)
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
jmp    113d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
nopl   (%rax)
mov    $0x2,%edi
call   1040 <sleep@plt>
lea    0x1(%rbx),%ebp
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebp,%ebx
jmp    1130 <main+0x10>

LLVM IR (-O0):
@.str = [18 x i8] c"HELLO FROM C: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %7
7: ; preds = %2, %7
%8 = call i32 @sleep(i32 2)
%9 = load i32, i32* %6
%10 = add nsw i32 %9, 1
store i32 %10, i32* %6
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %7
}

LLVM IR (-O2):
@.str = [18 x i8] c"HELLO FROM C: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 0, %2 ], [ %6, %3 ]
%5 = tail call i32 @sleep(i32 2)
%6 = add nuw nsw i32 %4, 1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %3
}
/* Type definitions */
typedef scalar_t__ uint64_t;
typedef scalar_t__ uint32_t;
typedef int int32_t;

/* Variables and functions */
int32_t uint32_comparator(const void *l, const void *r) {
  uint32_t lv = (uint32_t)(uint32_t)(uint64_t)(l);
  uint32_t rv = (uint32_t)(uint32_t)(uint64_t)(r);
  if (lv < rv)
    return -1;
  else if (lv == rv)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<uint32_comparator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    1136 <uint32_comparator+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1157 <uint32_comparator+0x57>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    1150 <uint32_comparator+0x50>
movl   $0x0,-0x4(%rbp)
jmp    1157 <uint32_comparator+0x57>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint32_comparator>:
xor    %ecx,%ecx
cmp    %rsi,%rdi
setne  %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @uint32_comparator(i8* readnone %0, i8* readnone %1) {
%3 = icmp slt i8* %0, %1
%4 = icmp ne i8* %0, %1
%5 = zext i1 %4 to i32
%6 = select i1 %3, i32 -1, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ gal_fun_test_f2(int *);
void gal_fun_test_f4(int *p, int x) {
  int i;
  for (i = 0; i < x; i += 10) {
    gal_fun_test_f2(&p[i]);
  }
}


x86 assembly (clang, -O0):
<gal_fun_test_f4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1154 <gal_fun_test_f4+0x44>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <gal_fun_test_f2@plt>
mov    -0x10(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <gal_fun_test_f4+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gal_fun_test_f4>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    1134 <gal_fun_test_f4+0x24>
mov    %esi,%r14d
mov    %rdi,%rbx
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1030 <gal_fun_test_f2@plt>
add    $0x28,%rbx
add    $0xa,%ebp
cmp    %r14d,%ebp
jl     1120 <gal_fun_test_f4+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @gal_fun_test_f4(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2, %4
%5 = phi i64 [ %8, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = tail call i32 @gal_fun_test_f2(i32* %6)
%8 = add nuw i64 %5, 10
%9 = trunc i64 %8 to i32
%10 = icmp slt i32 %9, %1
br i1 %10, label %4, label %11
11: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear_bit_unlock(int, void *);
int /*<<< orphan*/ smp_mb__after_atomic();
int /*<<< orphan*/ wake_up_bit(void *, int);
void clear_and_wake_up_bit(int bit, void *word) {
  clear_bit_unlock(bit, word);
  smp_mb__after_atomic();
  wake_up_bit(word, bit);
}


x86 assembly (clang, -O0):
<clear_and_wake_up_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <clear_bit_unlock@plt>
mov    $0x0,%al
call   1050 <smp_mb__after_atomic@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <wake_up_bit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_and_wake_up_bit>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <clear_bit_unlock@plt>
xor    %eax,%eax
call   1050 <smp_mb__after_atomic@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <wake_up_bit@plt>

LLVM IR (-O0):
define void @clear_and_wake_up_bit(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = call i32 @clear_bit_unlock(i32 %5, i8* %6)
%8 = call i32 (...) @smp_mb__after_atomic()
%9 = load i8*, i8** %4
%10 = load i32, i32* %3
%11 = call i32 @wake_up_bit(i8* %9, i32 %10)
ret void
}

LLVM IR (-O2):
define void @clear_and_wake_up_bit(i32 %0, i8* %1) {
%3 = tail call i32 @clear_bit_unlock(i32 %0, i8* %1)
%4 = tail call i32 (...) @smp_mb__after_atomic()
%5 = tail call i32 @wake_up_bit(i8* %1, i32 %0)
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef int uint16_t;

/* Variables and functions */
void UARTFIFOEnable(uint32_t ui32Base) {
  ;
  (*((volatile uint16_t *)(ui32Base + 0xA))) |= 0x4000;
}


x86 assembly (clang, -O0):
<UARTFIFOEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xa(%rax),%ecx
or     $0x4000,%ecx
mov    %ecx,0xa(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTFIFOEnable>:
orl    $0x4000,0xa(%rdi)
ret

LLVM IR (-O0):
define void @UARTFIFOEnable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 10
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = or i32 %6, 16384
store volatile i32 %7, i32* %5
ret void
}

LLVM IR (-O2):
define void @UARTFIFOEnable(i64 %0) {
%2 = add nsw i64 %0, 10
%3 = inttoptr i64 %2 to i32*
%4 = load volatile i32, i32* %3
%5 = or i32 %4, 16384
store volatile i32 %5, i32* %3
ret void
}
int count_digits(long value) {
  int digits = 0;
  while (value > 0) {
    value /= 10;
    digits++;
  }
  return digits;
}


x86 assembly (clang, -O0):
<count_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jle    113a <count_digits+0x3a>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <count_digits+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_digits>:
xor    %ecx,%ecx
test   %rdi,%rdi
jle    1136 <count_digits+0x36>
movabs $0xcccccccccccccccd,%rsi
cc cc cc
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rdi,%rax
mul    %rsi
shr    $0x3,%rdx
add    $0x1,%ecx
cmp    $0x9,%rdi
mov    %rdx,%rdi
ja     1120 <count_digits+0x20>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @count_digits(i64 %0) {
%2 = icmp sgt i64 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i64 [ %6, %3 ], [ %0, %1 ]
%6 = udiv i64 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i64 %5, 10
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
int g1(int j, unsigned char *b, long long i) { return j + b[i]; }


x86 assembly (clang, -O0):
<g1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<g1>:
movzbl (%rsi,%rdx,1),%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @g1(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = getelementptr inbounds i8, i8* %8, i64 %9
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = add nsw i32 %7, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @g1(i32 %0, i8* nocapture %1, i64 %2) {
%4 = getelementptr inbounds i8, i8* %1, i64 %2
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ CallBack2(int, void *, void *);
int /*<<< orphan*/ CheckRunningInMainThread(char *);
void PutCmdLine(const char *cmd, int mode) {
  if (!CheckRunningInMainThread("PutCmdLine"))
    return;
  CallBack2(49, (void *)cmd, (void *)mode);
}


x86 assembly (clang, -O0):
<PutCmdLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <CheckRunningInMainThread@plt>
cmp    $0x0,%eax
jne    1149 <PutCmdLine+0x29>
jmp    115b <PutCmdLine+0x3b>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rdx
mov    $0x31,%edi
call   1040 <CallBack2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PutCmdLine>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed1(%rip),%rdi
call   1030 <CheckRunningInMainThread@plt>
test   %eax,%eax
je     114e <PutCmdLine+0x2e>
movslq %ebp,%rdx
mov    $0x31,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <CallBack2@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"PutCmdLine\00"
define void @PutCmdLine(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @CheckRunningInMainThread(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %2
br label %14
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i8*
%13 = call i32 @CallBack2(i32 49, i8* %9, i8* %12)
br label %14
14: ; preds = %8, %7
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"PutCmdLine\00"
define void @PutCmdLine(i8* %0, i32 %1) {
%3 = tail call i32 @CheckRunningInMainThread(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = sext i32 %1 to i64
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @CallBack2(i32 49, i8* %0, i8* %7)
br label %9
9: ; preds = %2, %5
ret void
}
void mx35_gpio_set(unsigned int gpio, unsigned int value) {}


x86 assembly (clang, -O0):
<mx35_gpio_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @mx35_gpio_set(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getloadavg(double *, int);
int generic_read_loadavg() {
  double load[1];
  getloadavg(load, 1);
  return (int)(load[0] * 1000.0);
}


x86 assembly (clang, -O0):
<generic_read_loadavg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <getloadavg@plt>
movsd  0xed2(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generic_read_loadavg>:
push   %rax
mov    %rsp,%rdi
mov    $0x1,%esi
call   1030 <getloadavg@plt>
movsd  (%rsp),%xmm0
mulsd  0xed5(%rip),%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @generic_read_loadavg() {
%1 = alloca [1 x double]
%2 = getelementptr inbounds [1 x double], [1 x double]* %1, i64 0, i64 0
%3 = call i32 @getloadavg(double* %2, i32 1)
%4 = getelementptr inbounds [1 x double], [1 x double]* %1, i64 0, i64 0
%5 = load double, double* %4
%6 = fmul double %5, 1.000000e+03
%7 = fptosi double %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @generic_read_loadavg() {
%1 = alloca [1 x double]
%2 = bitcast [1 x double]* %1 to i8*
%3 = getelementptr inbounds [1 x double], [1 x double]* %1, i64 0, i64 0
%4 = call i32 @getloadavg(double* %3, i32 1)
%5 = load double, double* %3
%6 = fmul double %5, 1.000000e+03
%7 = fptosi double %6 to i32
ret i32 %7
}
int tegra_pinctrl_config_prod(struct device *dev, const char *prod_name) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.device = type opaque
define i32 @tegra_pinctrl_config_prod(%struct.device* %0, i8* %1) {
%3 = alloca %struct.device*
%4 = alloca i8*
store %struct.device* %0, %struct.device** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
%struct.device = type opaque
define i32 @tegra_pinctrl_config_prod(%struct.device* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int pm8xxx_mpp_cfg(unsigned int, int, unsigned int, unsigned int);
int pm8xxx_mpp_config_digital_out(unsigned mpp, unsigned level,
                                  unsigned control) {
  return pm8xxx_mpp_cfg(mpp, 1, level, control);
}


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

x86 assembly (clang, -O2):
<pm8xxx_mpp_config_digital_out>:
mov    %edx,%ecx
mov    %esi,%edx
mov    $0x1,%esi
jmp    1030 <pm8xxx_mpp_cfg@plt>

LLVM IR (-O0):
define i32 @pm8xxx_mpp_config_digital_out(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @pm8xxx_mpp_cfg(i32 %7, i32 1, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @pm8xxx_mpp_config_digital_out(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @pm8xxx_mpp_cfg(i32 %0, i32 1, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int Can_Init();
int init_can(void) { return Can_Init(); }


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

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

LLVM IR (-O0):
define i32 @init_can() {
%1 = call i32 (...) @Can_Init()
ret i32 %1
}

LLVM IR (-O2):
define i32 @init_can() {
%1 = tail call i32 (...) @Can_Init()
ret i32 %1
}
/* Variables and functions */
unsigned int ejtag_dma_read(unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int);
void mscan(void) {
  unsigned int addr = 0x18000000, val = 0, i;
  for (i = 0; i < 20000; i++) {
    val = ejtag_dma_read(addr);
    printf("data 0x%08x addr 0x%08x\n", val, addr);
    addr += 0x100;
  }
}


x86 assembly (clang, -O0):
<mscan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x18000000,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4e20,-0xc(%rbp)
jae    1180 <mscan+0x60>
mov    -0x4(%rbp),%edi
call   1030 <ejtag_dma_read@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x100,%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <mscan+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mscan>:
push   %r14
push   %rbx
push   %rax
mov    $0x18000000,%ebx
lea    0xed0(%rip),%r14
mov    %ebx,%edi
call   1030 <ejtag_dma_read@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    %ebx,%edx
call   1040 <printf@plt>
add    $0x100,%ebx
cmp    $0x184e2000,%ebx
jne    1130 <mscan+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"data 0x%08x addr 0x%08x\0A\00"
define void @mscan() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 402653184, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %15, %0
%5 = load i32, i32* %3
%6 = icmp ult i32 %5, 20000
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = load i32, i32* %1
%9 = call i32 @ejtag_dma_read(i32 %8)
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = load i32, i32* %1
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
%13 = load i32, i32* %1
%14 = add i32 %13, 256
store i32 %14, i32* %1
br label %15
15: ; preds = %7
%16 = load i32, i32* %3
%17 = add i32 %16, 1
store i32 %17, i32* %3
br label %4
18: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"data 0x%08x addr 0x%08x\0A\00"
define void @mscan() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %7, %1 ]
%3 = phi i32 [ 402653184, %0 ], [ %6, %1 ]
%4 = tail call i32 @ejtag_dma_read(i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %3)
%6 = add nuw nsw i32 %3, 256
%7 = add nuw nsw i32 %2, 1
%8 = icmp eq i32 %7, 20000
br i1 %8, label %9, label %1
9: ; preds = %1
ret void
}
int IntCmp(const void *a, const void *b) {
  const int *ia = (const int *)a;
  const int *ib = (const int *)b;
  return *ia - *ib;
}


x86 assembly (clang, -O0):
<IntCmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%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*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = sub nsw i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @IntCmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
double log2(double);
double log(double x) {
  double ln2;
  return ln2 * log2(x);
}


x86 assembly (clang, -O0):
<log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log2@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    1125 <log+0x15>
movsd  0xedd(%rip),%xmm0
pop    %rax
ret
call   1030 <log2@plt>
jmp    111b <log+0xb>

LLVM IR (-O0):
define double @log(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %3
%5 = load double, double* %2
%6 = call double @log2(double %5)
%7 = fmul double %4, %6
ret double %7
}

LLVM IR (-O2):
define double @log(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call double @log2(double %0)
br label %5
5: ; preds = %1, %3
ret double 0x7FF8000000000000
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void assert(_Bool b) {
  if (!b)
    abort();
}


x86 assembly (clang, -O0):
<assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
testb  $0x1,-0x1(%rbp)
jne    1131 <assert+0x21>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert>:
test   %edi,%edi
je     1115 <assert+0x5>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @assert(i1 zeroext %0) {
%2 = alloca i8
%3 = zext i1 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = trunc i8 %4 to i1
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @assert(i1 zeroext %0) {
br i1 %0, label %4, label %2
2: ; preds = %1
%3 = tail call i32 (...) @abort()
unreachable
4: ; preds = %1
ret void
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
scalar_t__ nanosleep(struct timespec *, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
void waitmics(int musec) {
  struct timespec delay;
  delay.tv_sec = 0;
  delay.tv_nsec = musec * 1000L;
  if (nanosleep(&delay, NULL))
    perror("nanosleep: ");
}


x86 assembly (clang, -O0):
<waitmics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movslq -0x4(%rbp),%rax
imul   $0x3e8,%rax,%rax
mov    %eax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
cmp    $0x0,%rax
je     1164 <waitmics+0x44>
lea    0xea1(%rip),%rdi
call   1040 <perror@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waitmics>:
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
imul   $0x3e8,%edi,%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
test   %rax,%rax
jne    114d <waitmics+0x2d>
add    $0x18,%rsp
ret
lea    0xeac(%rip),%rdi
call   1040 <perror@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
@.str = [12 x i8] c"nanosleep: \00"
define void @waitmics(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
store i32 %0, i32* %2
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 0, i64* %4
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = mul nsw i64 %6, 1000
%8 = trunc i64 %7 to i32
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i32 %8, i32* %9
%10 = call i64 @nanosleep(%struct.timespec* %3, i32* null)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %1
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
@.str = [12 x i8] c"nanosleep: \00"
define void @waitmics(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 0, i64* %4
%5 = mul i32 %0, 1000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 %5, i32* %6
%7 = call i64 @nanosleep(%struct.timespec* %2, i32* null)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void error(char *error) {
  printf("%s\n", error);
  exit(0);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
_Bool h(_Bool b3) { return !b3; }


x86 assembly (clang, -O0):
<h>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<h>:
mov    %edi,%eax
xor    $0x1,%al
ret

LLVM IR (-O0):
define zeroext i1 @h(i1 zeroext %0) {
%2 = alloca i8
%3 = zext i1 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = trunc i8 %4 to i1
%6 = xor i1 %5, true
ret i1 %6
}

LLVM IR (-O2):
define zeroext i1 @h(i1 zeroext %0) {
%2 = xor i1 %0, true
ret i1 %2
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int cmp_string(char *a, char *b) { return (strcmp(a, b) == 0); }


x86 assembly (clang, -O0):
<cmp_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_string>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cmp_string(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 = load i8*, i8** %4
%7 = call i64 @strcmp(i8* %5, i8* %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @cmp_string(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int write(int, char *, int /*<<< orphan*/);
int writeport(int fd, char t[]) {
  int n = write(fd, t, strlen(t));
  if (n < 0)
    fputs("write() failed!\n", stderr);
  return 0;
}


x86 assembly (clang, -O0):
<writeport>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1186 <writeport+0x56>
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
lea    0xe7f(%rip),%rdi
call   1050 <fputs@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeport>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %eax,%eax
jns    1165 <writeport+0x35>
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
lea    0xea0(%rip),%rdi
call   1050 <fputs@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"write() failed!\0A\00"
@stderr = global i32 0
define i32 @writeport(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = load i8*, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @write(i32 %6, i8* %7, i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 @fputs(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %13, %2
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"write() failed!\0A\00"
@stderr = global i32 0
define i32 @writeport(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6, %2
ret i32 0
}
void setInt16(unsigned char *array, int offset, unsigned int value) {
  array[offset + 0] = value >> 0;
  array[offset + 1] = value >> 8;
}


x86 assembly (clang, -O0):
<setInt16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shr    $0x0,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
shr    $0x8,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setInt16>:
movslq %esi,%rax
mov    %dx,(%rdi,%rax,1)
ret

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

LLVM IR (-O2):
define void @setInt16(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = trunc i32 %2 to i8
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %4, i8* %6
%7 = lshr i32 %2, 8
%8 = trunc i32 %7 to i8
%9 = add nsw i32 %1, 1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
store i8 %8, i8* %11
ret void
}
/* Variables and functions */
int main();
int _start(void) { return main(); }


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

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

LLVM IR (-O0):
define i32 @_start() {
%1 = call i32 (...) @main()
ret i32 %1
}

LLVM IR (-O2):
define i32 @_start() {
%1 = tail call i32 (...) @main()
ret i32 %1
}
/* Variables and functions */
scalar_t__ pow(float, float);
float SCE_Math_InvSqrt(float number) {
  return 1.0F / ((float)pow((number), (0.5F)));
}


x86 assembly (clang, -O0):
<SCE_Math_InvSqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeda(%rip),%xmm1
call   1030 <pow@plt>
cvtsi2ss %rax,%xmm1
movss  0xec4(%rip),%xmm0
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCE_Math_InvSqrt>:
push   %rax
movss  0xee7(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
movss  0xed6(%rip),%xmm0
divss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @SCE_Math_InvSqrt(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @pow(float %3, float 5.000000e-01)
%5 = sitofp i64 %4 to float
%6 = fdiv float 1.000000e+00, %5
ret float %6
}

LLVM IR (-O2):
define float @SCE_Math_InvSqrt(float %0) {
%2 = tail call i64 @pow(float %0, float 5.000000e-01)
%3 = sitofp i64 %2 to float
%4 = fdiv float 1.000000e+00, %3
ret float %4
}
int bar() { return 5; }


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

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

LLVM IR (-O0):
define i32 @bar() {
ret i32 5
}

LLVM IR (-O2):
define i32 @bar() {
ret i32 5
}
/* Type definitions */
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned int);
const char *get_rx_queue_name(unsigned id) {
  static char buffer[sizeof("MProc_Client_%u_RX") + 2];
  snprintf(buffer, sizeof(buffer), "MProc_Client_%u_RX", id);
  return buffer;
}


x86 assembly (clang, -O0):
<get_rx_queue_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
lea    0x2f1b(%rip),%rdi
mov    $0x15,%esi
lea    0xecf(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2f03(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rx_queue_name>:
push   %rbx
mov    %edi,%ecx
lea    0x2f26(%rip),%rbx
lea    0xedf(%rip),%rdx
mov    %rbx,%rdi
mov    $0x15,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@get_rx_queue_name.buffer = internal global [21 x i8] zeroinitializer
@.str = [19 x i8] c"MProc_Client_%u_RX\00"
define i8* @get_rx_queue_name(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @snprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @get_rx_queue_name.buffer, i64 0, i64 0), i32 21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* getelementptr inbounds ([21 x i8], [21 x i8]* @get_rx_queue_name.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
@get_rx_queue_name.buffer = internal global [21 x i8] zeroinitializer
@.str = [19 x i8] c"MProc_Client_%u_RX\00"
define i8* @get_rx_queue_name(i32 %0) {
%2 = tail call i32 @snprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @get_rx_queue_name.buffer, i64 0, i64 0), i32 21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* getelementptr inbounds ([21 x i8], [21 x i8]* @get_rx_queue_name.buffer, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void iface1_ver1_func1(void) { printf("B - version 1 func1\n"); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"B - version 1 func1\0A\00"
define void @iface1_ver1_func1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"B - version 1 func1\00"
define void @iface1_ver1_func1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ _gettemp(char *, int *, int /*<<< orphan*/);
int bsd_mkstemp(char *path) {
  int fd;
  return (_gettemp(path, &fd, 0) ? fd : -1);
}


x86 assembly (clang, -O0):
<bsd_mkstemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
xor    %edx,%edx
call   1030 <_gettemp@plt>
cmp    $0x0,%rax
je     1140 <bsd_mkstemp+0x30>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    114d <bsd_mkstemp+0x3d>
mov    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    114d <bsd_mkstemp+0x3d>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bsd_mkstemp>:
push   %rax
lea    0x4(%rsp),%rsi
xor    %edx,%edx
call   1030 <_gettemp@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
or     0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @bsd_mkstemp(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i64 @_gettemp(i8* %0, i32* %2, i32 0)
%5 = icmp eq i64 %4, 0
%6 = load i32, i32* %2
%7 = select i1 %5, i32 -1, i32 %6
ret i32 %7
}
int scaleRange(int x, int srcFrom, int srcTo, int destFrom, int destTo) {
  long int a = ((long int)destTo - (long int)destFrom) *
               ((long int)x - (long int)srcFrom);
  long int b = (long int)srcTo - (long int)srcFrom;
  return (a / b) + destFrom;
}


x86 assembly (clang, -O0):
<scaleRange>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
movslq -0x14(%rbp),%rax
movslq -0x10(%rbp),%rcx
sub    %rcx,%rax
movslq -0x4(%rbp),%rcx
movslq -0x8(%rbp),%rdx
sub    %rdx,%rcx
imul   %rcx,%rax
mov    %rax,-0x20(%rbp)
movslq -0xc(%rbp),%rax
movslq -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cqto
idivq  -0x28(%rbp)
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scaleRange>:
movslq %r8d,%r8
movslq %ecx,%rax
sub    %rax,%r8
movslq %edi,%rax
movslq %esi,%rdi
sub    %rdi,%rax
imul   %r8,%rax
movslq %edx,%rsi
sub    %rdi,%rsi
mov    %rax,%rdx
or     %rsi,%rdx
shr    $0x20,%rdx
je     1130 <scaleRange+0x30>
cqto
idiv   %rsi
add    %ecx,%eax
ret
xor    %edx,%edx
div    %esi
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @scaleRange(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load i32, i32* %10
%14 = sext i32 %13 to i64
%15 = load i32, i32* %9
%16 = sext i32 %15 to i64
%17 = sub nsw i64 %14, %16
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = sub nsw i64 %19, %21
%23 = mul nsw i64 %17, %22
store i64 %23, i64* %11
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = sub nsw i64 %25, %27
store i64 %28, i64* %12
%29 = load i64, i64* %11
%30 = load i64, i64* %12
%31 = sdiv i64 %29, %30
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = add nsw i64 %31, %33
%35 = trunc i64 %34 to i32
ret i32 %35
}

LLVM IR (-O2):
define i32 @scaleRange(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = sext i32 %4 to i64
%7 = sext i32 %3 to i64
%8 = sub nsw i64 %6, %7
%9 = sext i32 %0 to i64
%10 = sext i32 %1 to i64
%11 = sub nsw i64 %9, %10
%12 = mul nsw i64 %8, %11
%13 = sext i32 %2 to i64
%14 = sub nsw i64 %13, %10
%15 = sdiv i64 %12, %14
%16 = trunc i64 %15 to i32
%17 = add i32 %16, %3
ret i32 %17
}
int main(int argc, char *argv[]) {
  int i, j;
  i = argc * 2;
  j = i + 1;
  return i + j;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0x1(,%rdi,4),%eax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = mul nsw i32 %8, 2
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = add nsw i32 %10, 1
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = add nsw i32 %12, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = shl i32 %0, 2
%4 = or i32 %3, 1
ret i32 %4
}