xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ strlcpy(void *, char *, int);
void f4() { strlcpy(((void *)0), "abcdef", 6); }


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
lea    0xee1(%rip),%rsi
mov    $0x6,%edx
call   1030 <strlcpy@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
mov    $0x6,%edx
jmp    1030 <strlcpy@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"abcdef\00"
define void @f4() {
%1 = call i32 @strlcpy(i8* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"abcdef\00"
define void @f4() {
%1 = tail call i32 @strlcpy(i8* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
ret void
}
/* Variables and functions */
int f435(int *);
int f436(int *p) { return f435(p); }


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

x86 assembly (clang, -O2):
<f436>:
jmp    1030 <f435@plt>

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

LLVM IR (-O2):
define i32 @f436(i32* %0) {
%2 = tail call i32 @f435(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ print_combinations(int *, int *, int /*<<< orphan*/, int,
                                      int /*<<< orphan*/, int);
void find_combinations(int arr[], int n, int r) {
  int data[r];
  print_combinations(arr, data, 0, n - 1, 0, r);
}


x86 assembly (clang, -O0):
<find_combinations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%r9d
xor    %r8d,%r8d
mov    %r8d,%edx
call   1030 <print_combinations@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_combinations>:
push   %rbp
mov    %rsp,%rbp
mov    %edx,%r9d
mov    %edx,%ecx
mov    %rsp,%rax
lea    0xf(,%rcx,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rax
mov    %rax,%rsp
lea    -0x1(%rsi),%ecx
mov    %rax,%rsi
xor    %edx,%edx
xor    %r8d,%r8d
call   1030 <print_combinations@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
define void @find_combinations(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i32, i64 %10
store i64 %10, i64* %8
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = load i32, i32* %6
%17 = call i32 @print_combinations(i32* %13, i32* %12, i32 0, i32 %15, i32 0, i32 %16)
%18 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
define void @find_combinations(i32* %0, i32 %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = alloca i32, i64 %4
%6 = add nsw i32 %1, -1
%7 = call i32 @print_combinations(i32* %0, i32* %5, i32 0, i32 %6, i32 0, i32 %2)
ret void
}
/* Variables and functions */
size_t modulo_unsigned(unsigned int, unsigned int);
void modulo_call_Good(unsigned int len, unsigned int i) {
  char arr[len];
  arr[modulo_unsigned(i, len)] = 123;
}


x86 assembly (clang, -O0):
<modulo_call_Good>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <modulo_unsigned@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
movb   $0x7b,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modulo_call_Good>:
mov    %edi,%eax
mov    %esi,%edi
mov    %eax,%esi
jmp    1030 <modulo_unsigned@plt>

LLVM IR (-O0):
define void @modulo_call_Good(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %5
%10 = alloca i8, i64 %8
store i64 %8, i64* %6
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = call i64 @modulo_unsigned(i32 %11, i32 %12)
%14 = getelementptr inbounds i8, i8* %10, i64 %13
store i8 123, i8* %14
%15 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
define void @modulo_call_Good(i32 %0, i32 %1) {
%3 = tail call i64 @modulo_unsigned(i32 %1, i32 %0)
ret void
}
dounknown() {}


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

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

LLVM IR (-O0):
define i32 @dounknown() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @dounknown() {
ret i32 undef
}
void main() {
  int x;
  x = 10;
  while (1) {
    x -= 1;
  }
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
jmp    110b <main+0xb>

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

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
store i32 10, i32* %1
br label %2
2: ; preds = %0, %2
%3 = load i32, i32* %1
%4 = sub nsw i32 %3, 1
store i32 %4, i32* %1
br label %2
}

LLVM IR (-O2):
define void @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_poly1305_carry_mul(uintptr_t, uintptr_t,
                                                    uintptr_t);
void fiat_poly1305_carry_mul(uint32_t out1[5], const uint32_t arg1[5],
                             const uint32_t arg2[5]) {
  internal_fiat_poly1305_carry_mul((uintptr_t)out1, (uintptr_t)arg1,
                                   (uintptr_t)arg2);
}


x86 assembly (clang, -O0):
<fiat_poly1305_carry_mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <internal_fiat_poly1305_carry_mul@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiat_poly1305_carry_mul>:
jmp    1030 <internal_fiat_poly1305_carry_mul@plt>

LLVM IR (-O0):
define void @fiat_poly1305_carry_mul(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 = ptrtoint i32* %7 to i64
%9 = load i32*, i32** %5
%10 = ptrtoint i32* %9 to i64
%11 = load i32*, i32** %6
%12 = ptrtoint i32* %11 to i64
%13 = call i32 @internal_fiat_poly1305_carry_mul(i64 %8, i64 %10, i64 %12)
ret void
}

LLVM IR (-O2):
define void @fiat_poly1305_carry_mul(i32* %0, i32* %1, i32* %2) {
%4 = ptrtoint i32* %0 to i64
%5 = ptrtoint i32* %1 to i64
%6 = ptrtoint i32* %2 to i64
%7 = tail call i32 @internal_fiat_poly1305_carry_mul(i64 %4, i64 %5, i64 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ proc1();
int /*<<< orphan*/ proc2();
int /*<<< orphan*/ proc3();
int main(int argc, char *argv[], char *envp[]) {
  proc1();
  proc2();
  proc3();
  proc1();
  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)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1040 <proc1@plt>
mov    $0x0,%al
call   1030 <proc2@plt>
mov    $0x0,%al
call   1050 <proc3@plt>
mov    $0x0,%al
call   1040 <proc1@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = call i32 (...) @proc1()
%9 = call i32 (...) @proc2()
%10 = call i32 (...) @proc3()
%11 = call i32 (...) @proc1()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 (...) @proc1()
%5 = tail call i32 (...) @proc2()
%6 = tail call i32 (...) @proc3()
%7 = tail call i32 (...) @proc1()
ret i32 0
}
int c(int n, int k) {
  if (k == 0)
    return 1;
  else if (n == 0)
    return 0;
  else
    return c(n - 1, k - 1) + c(n - 1, k);
}


x86 assembly (clang, -O0):
<c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1134 <c+0x24>
movl   $0x1,-0x4(%rbp)
jmp    1176 <c+0x66>
cmpl   $0x0,-0x8(%rbp)
jne    114a <c+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1176 <c+0x66>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <c@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1030 <c@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
je     1143 <c+0x33>
mov    %edi,%ebp
test   %edi,%edi
je     114a <c+0x3a>
mov    %esi,%r14d
add    $0xffffffff,%r14d
add    $0xffffffff,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <c@plt>
add    %eax,%ebx
add    $0xffffffff,%ebp
jb     1130 <c+0x20>
jmp    114c <c+0x3c>
mov    $0x1,%ebx
jmp    114c <c+0x3c>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @c(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = add nsw i32 %1, -1
%6 = icmp eq i32 %0, 0
br i1 %6, label %14, label %7
7: ; preds = %4, %7
%8 = phi i32 [ %12, %7 ], [ 0, %4 ]
%9 = phi i32 [ %10, %7 ], [ %0, %4 ]
%10 = add nsw i32 %9, -1
%11 = tail call i32 @c(i32 %10, i32 %5)
%12 = add nsw i32 %11, %8
%13 = icmp eq i32 %10, 0
br i1 %13, label %14, label %7
14: ; preds = %7, %4, %2
%15 = phi i32 [ 1, %2 ], [ 0, %4 ], [ %12, %7 ]
ret i32 %15
}
int int_abs(int n) { return (n >= 0) ? n : -n; }


x86 assembly (clang, -O0):
<int_abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     111c <int_abs+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <int_abs+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_abs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @int_abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
unsigned long long fib(int);
int omp_get_num_threads();
int /*<<< orphan*/ printf(char *, unsigned long long);
int main(void) {
  unsigned long long n;
#pragma offload target(mic)
#pragma omp parallel
  {
#pragma omp single
    {
      printf("Running %d threads\n", omp_get_num_threads());
      fflush(0);
      n = fib(30);
    }
  }
  printf("%llu\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <omp_get_num_threads@plt>
movslq %eax,%rsi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <fflush@plt>
mov    $0x1e,%edi
call   1060 <fib@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <omp_get_num_threads@plt>
movslq %eax,%rsi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <fflush@plt>
mov    $0x1e,%edi
call   1060 <fib@plt>
lea    0xea5(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Running %d threads\0A\00"
@.str.1 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i32 (...) @omp_get_num_threads()
%4 = sext i32 %3 to i64
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %4)
%6 = call i32 @fflush(i32 0)
%7 = call i64 @fib(i32 30)
store i64 %7, i64* %2
%8 = load i64, i64* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Running %d threads\0A\00"
@.str.1 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @omp_get_num_threads()
%2 = sext i32 %1 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @fflush(i32 0)
%5 = tail call i64 @fib(i32 30)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
scalar_t__ strncmp(char *, char *, int);
void jelio_prot(char *str) {
  if (strncmp(str, "$@10", 4))
    _exit(3);
}


x86 assembly (clang, -O0):
<jelio_prot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1155 <jelio_prot+0x35>
mov    $0x3,%edi
call   1040 <_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jelio_prot>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1139 <jelio_prot+0x19>
pop    %rax
ret
mov    $0x3,%edi
call   1040 <_exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"$@10\00"
define void @jelio_prot(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @_exit(i32 3)
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"$@10\00"
define void @jelio_prot(i8* %0) {
%2 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @_exit(i32 3)
unreachable
6: ; preds = %1
ret void
}
int main(void) {
  __complex__ double d[1];
  d[0] = foo();
  if (__real__ d[0] != 1.0 || __imag__ d[0] != -1.0)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <foo@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe9c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1196 <main+0x66>
jp     1196 <main+0x66>
movsd  -0x18(%rbp),%xmm0
movsd  0xe87(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1196 <main+0x66>
jp     1196 <main+0x66>
jmp    119b <main+0x6b>
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x { double, double }]
store i32 0, i32* %1
%3 = call i32 (...) @foo()
%4 = sitofp i32 %3 to double
%5 = getelementptr inbounds [1 x { double, double }], [1 x { double, double }]* %2, i64 0, i64 0
%6 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 0
%7 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 1
store double %4, double* %6
store double 0.000000e+00, double* %7
%8 = getelementptr inbounds [1 x { double, double }], [1 x { double, double }]* %2, i64 0, i64 0
%9 = getelementptr inbounds { double, double }, { double, double }* %8, i32 0, i32 0
%10 = load double, double* %9
%11 = fcmp une double %10, 1.000000e+00
br i1 %11, label %17, label %12
12: ; preds = %0
%13 = getelementptr inbounds [1 x { double, double }], [1 x { double, double }]* %2, i64 0, i64 0
%14 = getelementptr inbounds { double, double }, { double, double }* %13, i32 0, i32 1
%15 = load double, double* %14
%16 = fcmp une double %15, -1.000000e+00
br i1 %16, label %17, label %18
17: ; preds = %12, %0
unreachable
18: ; preds = %12
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
tail call void @abort()
unreachable
}
int int_cmp(void *a, void *b) {
  int c;
  int d;
  c = *(int *)a;
  d = *(int *)b;
  return (c - d);
}


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

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

LLVM IR (-O0):
define i32 @int_cmp(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*
%9 = load i32, i32* %8
store i32 %9, i32* %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = sub nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @int_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int derefint(int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i = 10;
  int *address = &i;
  printf("%d\n", derefint(address));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <derefint@plt>
mov    %eax,%esi
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0xa,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <derefint@plt>
lea    0xec6(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%3 = call i32 @derefint(i32* %1)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ done(int /*<<< orphan*/);
int /*<<< orphan*/ getargs(int, char **);
int /*<<< orphan*/ lalr();
int /*<<< orphan*/ lr0();
int /*<<< orphan*/ make_parser();
int /*<<< orphan*/ open_files();
int /*<<< orphan*/ output();
int /*<<< orphan*/ reader();
int /*<<< orphan*/ set_signals();
int /*<<< orphan*/ verbose();
int main(int argc, char *argv[]) {
  set_signals();
  getargs(argc, argv);
  open_files();
  reader();
  lr0();
  lalr();
  make_parser();
  verbose();
  output();
  done(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10c0 <set_signals@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10b0 <getargs@plt>
mov    $0x0,%al
call   1070 <open_files@plt>
mov    $0x0,%al
call   1060 <reader@plt>
mov    $0x0,%al
call   1030 <lr0@plt>
mov    $0x0,%al
call   1090 <lalr@plt>
mov    $0x0,%al
call   1080 <make_parser@plt>
mov    $0x0,%al
call   10a0 <verbose@plt>
mov    $0x0,%al
call   1040 <output@plt>
xor    %edi,%edi
call   1050 <done@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   10c0 <set_signals@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   10b0 <getargs@plt>
xor    %eax,%eax
call   1070 <open_files@plt>
xor    %eax,%eax
call   1060 <reader@plt>
xor    %eax,%eax
call   1030 <lr0@plt>
xor    %eax,%eax
call   1090 <lalr@plt>
xor    %eax,%eax
call   1080 <make_parser@plt>
xor    %eax,%eax
call   10a0 <verbose@plt>
xor    %eax,%eax
call   1040 <output@plt>
xor    %edi,%edi
call   1050 <done@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @set_signals()
%6 = load i32, i32* %3
%7 = load i8**, i8*** %4
%8 = call i32 @getargs(i32 %6, i8** %7)
%9 = call i32 (...) @open_files()
%10 = call i32 (...) @reader()
%11 = call i32 (...) @lr0()
%12 = call i32 (...) @lalr()
%13 = call i32 (...) @make_parser()
%14 = call i32 (...) @verbose()
%15 = call i32 (...) @output()
%16 = call i32 @done(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @set_signals()
%4 = tail call i32 @getargs(i32 %0, i8** %1)
%5 = tail call i32 (...) @open_files()
%6 = tail call i32 (...) @reader()
%7 = tail call i32 (...) @lr0()
%8 = tail call i32 (...) @lalr()
%9 = tail call i32 (...) @make_parser()
%10 = tail call i32 (...) @verbose()
%11 = tail call i32 (...) @output()
%12 = tail call i32 @done(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void exitVM() {
  printf("\nVM exit\n\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"\0AVM exit\0A\0A\00"
define void @exitVM() {
%1 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [10 x i8] c"\0AVM exit\0A\00"
define void @exitVM() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
int is_in_bound(int *arr, int size, int *ptr) {
  if (ptr >= arr && ptr < &arr[size]) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_in_bound>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     1145 <is_in_bound+0x45>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1145 <is_in_bound+0x45>
movl   $0x1,-0x4(%rbp)
jmp    114c <is_in_bound+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_bound>:
cmp    %rdi,%rdx
setae  %al
movslq %esi,%rcx
lea    (%rdi,%rcx,4),%rcx
cmp    %rdx,%rcx
seta   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @is_in_bound(i32* readnone %0, i32 %1, i32* readnone %2) {
%4 = icmp uge i32* %2, %0
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = icmp ugt i32* %6, %2
%8 = select i1 %4, i1 %7, i1 false
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
scalar_t__ gc_alloc(int, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *dynamic_strcpy(char *str) {
  char *tmp =
      (char *)gc_alloc(sizeof(char) * (strlen(str) + 1), "dynamic_strcpy");
  strcpy(tmp, str);
  return tmp;
}


x86 assembly (clang, -O0):
<dynamic_strcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
lea    0xea9(%rip),%rsi
call   1050 <gc_alloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dynamic_strcpy>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
lea    0xeba(%rip),%rsi
call   1050 <gc_alloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"dynamic_strcpy\00"
define i8* @dynamic_strcpy(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = mul i64 1, %7
%9 = trunc i64 %8 to i32
%10 = call i64 @gc_alloc(i32 %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [15 x i8] c"dynamic_strcpy\00"
define i8* @dynamic_strcpy(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @gc_alloc(i32 %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
int _XMP_modi_ll_i(long long value, int cycle) {
  int mod = value % cycle;
  if (mod < 0) {
    return (mod += cycle) % cycle;
  } else {
    return mod;
  }
}


x86 assembly (clang, -O0):
<_XMP_modi_ll_i>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    113c <_XMP_modi_ll_i+0x3c>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
cltd
idivl  -0x14(%rbp)
mov    %edx,-0x4(%rbp)
jmp    1142 <_XMP_modi_ll_i+0x42>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_XMP_modi_ll_i>:
mov    %rdi,%rax
movslq %esi,%rcx
mov    %rdi,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     111f <_XMP_modi_ll_i+0x1f>
cqto
idiv   %rcx
mov    %rdx,%rax
test   %eax,%eax
js     1129 <_XMP_modi_ll_i+0x29>
ret
xor    %edx,%edx
div    %esi
mov    %edx,%eax
test   %eax,%eax
jns    111e <_XMP_modi_ll_i+0x1e>
add    %esi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @_XMP_modi_ll_i(i64 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = srem i64 %0, %3
%5 = trunc i64 %4 to i32
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = add nsw i32 %5, %1
%9 = srem i32 %8, %1
br label %10
10: ; preds = %2, %7
%11 = phi i32 [ %9, %7 ], [ %5, %2 ]
ret i32 %11
}
double test_3(double x) { return __builtin_fabs(x); }


x86 assembly (clang, -O0):
<test_3>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xeeb(%rip),%xmm1
pand   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_3>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define double @test_3(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fabs.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @test_3(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
ret double %2
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t rte_arch_bswap16(uint16_t _x) {
  return (_x >> 8) | ((_x << 8) & 0xff00);
}


x86 assembly (clang, -O0):
<rte_arch_bswap16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rte_arch_bswap16>:
mov    %edi,%ecx
sar    $0x8,%ecx
shl    $0x8,%edi
movzwl %di,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @rte_arch_bswap16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 8
%5 = load i32, i32* %2
%6 = shl i32 %5, 8
%7 = and i32 %6, 65280
%8 = or i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @rte_arch_bswap16(i32 %0) {
%2 = ashr i32 %0, 8
%3 = shl i32 %0, 8
%4 = and i32 %3, 65280
%5 = or i32 %4, %2
ret i32 %5
}
int test_imm_C6uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xC6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C6uint64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0xc6,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_C6uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 198
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int ieee80211_freq_to_ofdm_chan(int s_freq, int freq) {
  if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) && (s_freq >= 4000))
    return (freq + 2 - s_freq) / 5;
  else
    return -1;
}


x86 assembly (clang, -O0):
<ieee80211_freq_to_ofdm_chan>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jle    1155 <ieee80211_freq_to_ofdm_chan+0x55>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x4b2,%ecx
cmp    %ecx,%eax
jg     1155 <ieee80211_freq_to_ofdm_chan+0x55>
cmpl   $0xfa0,-0x8(%rbp)
jl     1155 <ieee80211_freq_to_ofdm_chan+0x55>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
sub    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    115c <ieee80211_freq_to_ofdm_chan+0x5c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieee80211_freq_to_ofdm_chan>:
lea    0x2(%rdi),%ecx
mov    $0xffffffff,%eax
cmp    %esi,%ecx
jge    113a <ieee80211_freq_to_ofdm_chan+0x3a>
cmp    $0xfa0,%edi
jl     113a <ieee80211_freq_to_ofdm_chan+0x3a>
lea    0x4b2(%rdi),%ecx
cmp    %esi,%ecx
jl     113a <ieee80211_freq_to_ofdm_chan+0x3a>
sub    %edi,%esi
add    $0x2,%esi
movslq %esi,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ieee80211_freq_to_ofdm_chan(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 2
%4 = icmp slt i32 %3, %1
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = add nsw i32 %0, 1202
%7 = icmp sge i32 %6, %1
%8 = icmp sgt i32 %0, 3999
%9 = and i1 %8, %7
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = sub nsw i32 2, %0
%12 = add i32 %11, %1
%13 = sdiv i32 %12, 5
br label %14
14: ; preds = %2, %5, %10
%15 = phi i32 [ %13, %10 ], [ -1, %5 ], [ -1, %2 ]
ret i32 %15
}
int abs(int j) { return j >= 0 ? j : -j; }


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     111c <abs+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(int argc __attribute__((unused)), char **argv) {
  fprintf(stderr, "Usage : %s -i input_filename [-o output_filename]  \n",
          argv[0]);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [53 x i8] c"Usage : %s -i input_filename [-o output_filename] \0A\00"
define void @usage(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @stderr
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %8)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"Usage : %s -i input_filename [-o output_filename] \0A\00"
define void @usage(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %1
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ecb_vt(int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  ecb_vt(128);
  ecb_vt(192);
  ecb_vt(256);
  printf("\n==========");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x80,%edi
call   1030 <ecb_vt@plt>
mov    $0xc0,%edi
call   1030 <ecb_vt@plt>
mov    $0x100,%edi
call   1030 <ecb_vt@plt>
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x80,%edi
call   1030 <ecb_vt@plt>
mov    $0xc0,%edi
call   1030 <ecb_vt@plt>
mov    $0x100,%edi
call   1030 <ecb_vt@plt>
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"\0A==========\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @ecb_vt(i32 128)
%7 = call i32 @ecb_vt(i32 192)
%8 = call i32 @ecb_vt(i32 256)
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"\0A==========\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @ecb_vt(i32 128)
%4 = tail call i32 @ecb_vt(i32 192)
%5 = tail call i32 @ecb_vt(i32 256)
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint8_t BSP_Button2_Input(void) { return (*((volatile uint32_t *)0x40007200)); }


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

x86 assembly (clang, -O2):
<BSP_Button2_Input>:
mov    0x40007200,%eax
ret

LLVM IR (-O0):
define i32 @BSP_Button2_Input() {
%1 = load volatile i32, i32* inttoptr (i64 1073771008 to i32*)
ret i32 %1
}

LLVM IR (-O2):
define i32 @BSP_Button2_Input() {
%1 = load volatile i32, i32* inttoptr (i64 1073771008 to i32*)
ret i32 %1
}
void ADC_ISR(void) {}


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

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

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

LLVM IR (-O2):
define void @ADC_ISR() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int s_isreg(mode_t mode) { return -1; }


x86 assembly (clang, -O0):
<s_isreg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @s_isreg(i32 %0) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *getcwd(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *wd = NULL;
  wd = getcwd(NULL, 0);
  if (NULL == wd) {
    perror("getcwd");
    return 1;
  }
  printf("%s\n", wd);
  free(wd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   1050 <getcwd@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    118a <main+0x4a>
lea    0xe87(%rip),%rdi
call   1060 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    11aa <main+0x6a>
mov    -0x10(%rbp),%rsi
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %edi,%edi
xor    %esi,%esi
call   1050 <getcwd@plt>
test   %rax,%rax
je     117a <main+0x3a>
mov    %rax,%rbx
lea    0xea8(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe7f(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%r14d
jmp    116f <main+0x2f>

LLVM IR (-O0):
@.str = [7 x i8] c"getcwd\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %2
%3 = call i8* @getcwd(i32* null, i32 0)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp eq i8* null, %4
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %13
8: ; preds = %0
%9 = load i8*, i8** %2
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %2
%12 = call i32 @free(i8* %11)
store i32 0, i32* %1
br label %13
13: ; preds = %8, %6
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [7 x i8] c"getcwd\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i8* @getcwd(i32* null, i32 0)
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %8
5: ; preds = %0
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%7 = tail call i32 @free(i8* %1)
br label %8
8: ; preds = %5, %3
%9 = phi i32 [ 1, %3 ], [ 0, %5 ]
ret i32 %9
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void EMACReset(uint32_t ui32Base) {
  (*((volatile uint32_t *)(ui32Base + 0x00000C00))) |= 0x00000001;
  while ((*((volatile uint32_t *)(ui32Base + 0x00000C00))) & 0x00000001) {
  }
}


x86 assembly (clang, -O0):
<EMACReset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc00,%eax
cltq
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0xc00,%eax
cltq
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1135 <EMACReset+0x35>
jmp    1118 <EMACReset+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACReset>:
movslq %edi,%rax
orl    $0x1,0xc00(%rax)
nopw   0x0(%rax,%rax,1)
mov    0xc00(%rax),%ecx
test   $0x1,%cl
jne    1110 <EMACReset+0x10>
ret

LLVM IR (-O0):
define void @EMACReset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 3072
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = or i32 %7, 1
store volatile i32 %8, i32* %6
br label %9
9: ; preds = %17, %1
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 3072
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, 1
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %9
br label %9
18: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @EMACReset(i32 %0) {
%2 = add nsw i32 %0, 3072
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = or i32 %5, 1
store volatile i32 %6, i32* %4
br label %7
7: ; preds = %7, %1
%8 = load volatile i32, i32* %4
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %7
11: ; preds = %7
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t rotl(const uint64_t x, const int k) {
  return (x << k) | (x >> (64 - k));
}


x86 assembly (clang, -O0):
<rotl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x40,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotl>:
mov    %esi,%ecx
mov    %edi,%eax
shl    %cl,%eax
neg    %cl
sar    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @rotl(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 = shl i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 64, %9
%11 = ashr i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rotl(i32 %0, i32 %1) {
%3 = shl i32 %0, %1
%4 = sub nsw i32 64, %1
%5 = ashr i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
void XSyncValueGreaterThan() {}


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

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

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

LLVM IR (-O2):
define void @XSyncValueGreaterThan() {
ret void
}
__attribute__((no)) unsigned int andc_pp(unsigned int *a, unsigned int *b) {
  return ~*b & *a;
}


x86 assembly (clang, -O0):
<andc_pp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
mov    -0x8(%rbp),%rcx
and    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<andc_pp>:
mov    (%rsi),%eax
not    %eax
and    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @andc_pp(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load i32, i32* %5
%7 = xor i32 %6, -1
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = and i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @andc_pp(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = xor i32 %3, -1
%5 = load i32, i32* %0
%6 = and i32 %5, %4
ret i32 %6
}
/* Variables and functions */
double log(double);
double hlife(double val) { return -log(2.0) / log(val); }


x86 assembly (clang, -O0):
<hlife>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
call   1030 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hlife>:
push   %rax
call   1030 <log@plt>
movsd  0xee2(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @hlife(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call double @log(double 2.000000e+00)
%4 = fneg double %3
%5 = load double, double* %2
%6 = call double @log(double %5)
%7 = fdiv double %4, %6
ret double %7
}

LLVM IR (-O2):
define double @hlife(double %0) {
%2 = tail call double @log(double %0)
%3 = fdiv double 0xBFE62E42FEFA39EF, %2
ret double %3
}