xunge/DecIR huggingface dataset:
/* Variables and functions */
double atan2(double const, double const);
void doubles_mat44_to_xyt(const double M[16], double xyt[3]) {
  xyt[0] = M[3];
  xyt[1] = M[7];
  xyt[2] = atan2(M[4], M[0]);
}


x86 assembly (clang, -O0):
<doubles_mat44_to_xyt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
call   1030 <atan2@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubles_mat44_to_xyt>:
push   %rbx
mov    %rsi,%rbx
movsd  0x18(%rdi),%xmm0
movsd  %xmm0,(%rsi)
movsd  0x38(%rdi),%xmm0
movsd  %xmm0,0x8(%rsi)
movsd  (%rdi),%xmm1
movsd  0x20(%rdi),%xmm0
call   1030 <atan2@plt>
movsd  %xmm0,0x10(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @doubles_mat44_to_xyt(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 3
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
store double %7, double* %9
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 7
%12 = load double, double* %11
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 1
store double %12, double* %14
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i64 4
%17 = load double, double* %16
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = call double @atan2(double %17, double %20)
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 2
store double %21, double* %23
ret void
}

LLVM IR (-O2):
define void @doubles_mat44_to_xyt(double* nocapture %0, double* nocapture writeonly %1) {
%3 = getelementptr inbounds double, double* %0, i64 3
%4 = load double, double* %3
store double %4, double* %1
%5 = getelementptr inbounds double, double* %0, i64 7
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
store double %6, double* %7
%8 = getelementptr inbounds double, double* %0, i64 4
%9 = load double, double* %8
%10 = load double, double* %0
%11 = tail call double @atan2(double %9, double %10)
%12 = getelementptr inbounds double, double* %1, i64 2
store double %11, double* %12
ret void
}
/* Variables and functions */
void *malloc(int size) { return ((void *)0); }


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

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

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

LLVM IR (-O2):
define noalias i8* @malloc(i32 %0) {
ret i8* null
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int file_exists(const char *dst) {
  FILE *fp;
  fp = fopen(dst, "rb");
  if (fp) {
    fclose(fp);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1160 <file_exists+0x40>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1167 <file_exists+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <file_exists+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define i32 @file_exists(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ BOARD_ConfigMPU();
void BOARD_InitBootPeripherals(void) { BOARD_ConfigMPU(); }


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

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

LLVM IR (-O0):
define void @BOARD_InitBootPeripherals() {
%1 = call i32 (...) @BOARD_ConfigMPU()
ret void
}

LLVM IR (-O2):
define void @BOARD_InitBootPeripherals() {
%1 = tail call i32 (...) @BOARD_ConfigMPU()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ funlockfile(int /*<<< orphan*/ *);
int main(void) {
  FILE *file = NULL;
  funlockfile(file);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @funlockfile(i32* null)
ret i32 0
}
/* Variables and functions */
int close(int);
int /*<<< orphan*/ put_error(char *, int);
void x_close(int fd) {
  if (close(fd) == -1)
    put_error("Can't close a file\n", 1);
}


x86 assembly (clang, -O0):
<x_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
cmp    $0xffffffff,%eax
jne    114d <x_close+0x2d>
lea    0xebd(%rip),%rdi
mov    $0x1,%esi
call   1040 <put_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_close>:
push   %rax
call   1030 <close@plt>
cmp    $0xffffffff,%eax
je     112d <x_close+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rdi
mov    $0x1,%esi
pop    %rax
jmp    1040 <put_error@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Can't close a file\0A\00"
define void @x_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @close(i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @put_error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 1)
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Can't close a file\0A\00"
define void @x_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @put_error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 1)
br label %6
6: ; preds = %4, %1
ret void
}
void show_hash_slots(struct hash_table *table) {}


x86 assembly (clang, -O0):
<show_hash_slots>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.hash_table = type opaque
define void @show_hash_slots(%struct.hash_table* %0) {
%2 = alloca %struct.hash_table*
store %struct.hash_table* %0, %struct.hash_table** %2
ret void
}

LLVM IR (-O2):
%struct.hash_table = type opaque
define void @show_hash_slots(%struct.hash_table* nocapture %0) {
ret void
}
void foo() {
  do
    ;
  while (1);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <foo+0x9>
jmp    110e <foo+0xe>
mov    $0x1,%al
test   $0x1,%al
jne    1109 <foo+0x9>
jmp    111d <foo+0x1d>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo() {
br label %1
1: ; preds = %2, %0
br label %2
2: ; preds = %1
br i1 true, label %1, label %3
3: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @foo() {
br label %1
1: ; preds = %1, %0
br label %1
}
int lsearch(int array[], int needle, int size) {
  for (int i = 0; i < size; i++) {
    if (array[i] == needle) {
      return i;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<lsearch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1153 <lsearch+0x53>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jne    1140 <lsearch+0x40>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <lsearch+0x5a>
jmp    1145 <lsearch+0x45>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <lsearch+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsearch>:
mov    $0xffffffff,%eax
test   %edx,%edx
jle    111e <lsearch+0x1e>
mov    %edx,%edx
xor    %ecx,%ecx
nopl   (%rax)
cmp    %esi,(%rdi,%rcx,4)
je     111f <lsearch+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1110 <lsearch+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @lsearch(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %1
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, unsigned int);
void print_io_error(char *s, unsigned blk) {
  printf("\nCAN NOT %s: BLK %d\n", s, blk);
}


x86 assembly (clang, -O0):
<print_io_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_io_error>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"\0ACAN NOT %s: BLK %d\0A\00"
define void @print_io_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0ACAN NOT %s: BLK %d\0A\00"
define void @print_io_error(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ random_init();
int random_in_range(int min, int max) {
  static int initialized = 0;
  if (!initialized) {
    random_init();
    initialized = 1;
  }
  return rand() % (max - min + 1) + min;
}


x86 assembly (clang, -O0):
<random_in_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,0x2eff(%rip)
jne    114c <random_in_range+0x2c>
mov    $0x0,%al
call   1030 <random_init@plt>
movl   $0x1,0x2ee8(%rip)
mov    $0x0,%al
call   1040 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_in_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
cmpb   $0x0,0x2f06(%rip)
jne    113e <random_in_range+0x1e>
xor    %eax,%eax
call   1030 <random_init@plt>
movb   $0x1,0x2ef6(%rip)
xor    %eax,%eax
call   1040 <rand@plt>
sub    %ebx,%ebp
add    $0x1,%ebp
cltd
idiv   %ebp
add    %edx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@random_in_range.initialized = internal global i32 0
define i32 @random_in_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @random_in_range.initialized
%6 = icmp ne i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 (...) @random_init()
store i32 1, i32* @random_in_range.initialized
br label %9
9: ; preds = %7, %2
%10 = call i32 (...) @rand()
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = sub nsw i32 %11, %12
%14 = add nsw i32 %13, 1
%15 = srem i32 %10, %14
%16 = load i32, i32* %3
%17 = add nsw i32 %15, %16
ret i32 %17
}

LLVM IR (-O2):
@random_in_range.initialized = internal unnamed_addr global i1 false
define i32 @random_in_range(i32 %0, i32 %1) {
%3 = load i1, i1* @random_in_range.initialized
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @random_init()
store i1 true, i1* @random_in_range.initialized
br label %6
6: ; preds = %4, %2
%7 = tail call i32 (...) @rand()
%8 = sub i32 1, %0
%9 = add i32 %8, %1
%10 = srem i32 %7, %9
%11 = add nsw i32 %10, %0
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void indent(short depth, short tab_stop) {
  short spaces = depth * tab_stop;
  for (short i = 0; i < spaces; i++) {
    putchar(' ');
  }
}


x86 assembly (clang, -O0):
<indent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
imul   %ecx,%eax
mov    %ax,-0x6(%rbp)
movw   $0x0,-0x8(%rbp)
movswl -0x8(%rbp),%eax
movswl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jge    1166 <indent+0x56>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x8(%rbp)
jmp    113b <indent+0x2b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indent>:
push   %rbx
mov    %edi,%ebx
imul   %esi,%ebx
test   %bx,%bx
jle    1130 <indent+0x20>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffff,%bx
jne    1120 <indent+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @indent(i16 signext %0, i16 signext %1) {
%3 = mul i16 %1, %0
%4 = icmp sgt i16 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %6, %2
ret void
6: ; preds = %2, %6
%7 = phi i16 [ %9, %6 ], [ 0, %2 ]
%8 = tail call i32 @putchar(i8 signext 32)
%9 = add nuw nsw i16 %7, 1
%10 = icmp eq i16 %9, %3
br i1 %10, label %5, label %6
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: trace-tune <trace> <injection\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"usage: trace-tune <trace> <injection\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"usage: trace-tune <trace> <injection\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void XSUM_setBinaryMode(FILE *stream) { ((void)stream); }


x86 assembly (clang, -O0):
<XSUM_setBinaryMode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @XSUM_setBinaryMode(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void i8042_write_command(int val) {
  outb(val, 0x64);
  return;
}


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

x86 assembly (clang, -O2):
<i8042_write_command>:
mov    $0x64,%esi
jmp    1030 <outb@plt>

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

LLVM IR (-O2):
define void @i8042_write_command(i32 %0) {
%2 = tail call i32 @outb(i32 %0, i32 100)
ret void
}
void libart_postinit(void *app, void *modinfo) {}


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

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

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

LLVM IR (-O2):
define void @libart_postinit(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(unsigned short, int);
void serial_configure_fifo(unsigned short com) { outb((com + 2), 0xC7); }


x86 assembly (clang, -O0):
<serial_configure_fifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x2,%eax
mov    $0xc7,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_configure_fifo>:
add    $0x2,%edi
movzwl %di,%edi
mov    $0xc7,%esi
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @serial_configure_fifo(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = add nsw i32 %4, 2
%6 = trunc i32 %5 to i16
%7 = call i32 @outb(i16 zeroext %6, i32 199)
ret void
}

LLVM IR (-O2):
define void @serial_configure_fifo(i16 zeroext %0) {
%2 = add i16 %0, 2
%3 = tail call i32 @outb(i16 zeroext %2, i32 199)
ret void
}
int try_module_get(struct module *module) { return 1; }


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

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

LLVM IR (-O0):
%struct.module = type opaque
define i32 @try_module_get(%struct.module* %0) {
%2 = alloca %struct.module*
store %struct.module* %0, %struct.module** %2
ret i32 1
}

LLVM IR (-O2):
%struct.module = type opaque
define i32 @try_module_get(%struct.module* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
scalar_t__ test();
int main() {
  if (test())
    printf("ok");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <test@plt>
cmp    $0x0,%rax
je     114c <main+0x2c>
lea    0xeb9(%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 <test@plt>
test   %rax,%rax
je     1139 <main+0x19>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"ok\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @test()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"ok\00"
define i32 @main() {
%1 = tail call i64 (...) @test()
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ asm_fun();
int main() {
  asm_fun();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @asm_fun()
ret i32 0
}
/* Type definitions */
struct svc_req {
  int dummy;
};

/* Variables and functions */
int l2tp_session_profile_get_1_svc(char *, void *, struct svc_req *);
int _l2tp_session_profile_get_1(char **argp, void *result,
                                struct svc_req *rqstp) {
  return (l2tp_session_profile_get_1_svc(*argp, result, rqstp));
}


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

x86 assembly (clang, -O2):
<_l2tp_session_profile_get_1>:
mov    (%rdi),%rdi
jmp    1030 <l2tp_session_profile_get_1_svc@plt>

LLVM IR (-O0):
%struct.svc_req = type { i32 }
define i32 @_l2tp_session_profile_get_1(i8** %0, i8* %1, %struct.svc_req* %2) {
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca %struct.svc_req*
store i8** %0, i8*** %4
store i8* %1, i8** %5
store %struct.svc_req* %2, %struct.svc_req** %6
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = load i8*, i8** %5
%10 = load %struct.svc_req*, %struct.svc_req** %6
%11 = call i32 @l2tp_session_profile_get_1_svc(i8* %8, i8* %9, %struct.svc_req* %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.svc_req = type { i32 }
define i32 @_l2tp_session_profile_get_1(i8** nocapture %0, i8* %1, %struct.svc_req* %2) {
%4 = load i8*, i8** %0
%5 = tail call i32 @l2tp_session_profile_get_1_svc(i8* %4, i8* %1, %struct.svc_req* %2)
ret i32 %5
}
void gtk_selection_owner_set_for_display() {}


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

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

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

LLVM IR (-O2):
define void @gtk_selection_owner_set_for_display() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ xlInfo(char *, char *);
void oserror(char *msg) { xlInfo("error: %s\n", msg); }


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

x86 assembly (clang, -O2):
<oserror>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <xlInfo@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"error: %s\0A\00"
define void @oserror(i8* %0) {
%2 = tail call i32 @xlInfo(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void EEPROMIntEnable(uint32_t ui32IntFlags) {
  ASSERT(ui32IntFlags == 0x00000004);
  (*((volatile uint32_t *)(0x400AF040))) |= 0x00000001;
  (*((volatile uint32_t *)(0x400FD010))) |= 0x00000004;
}


x86 assembly (clang, -O0):
<EEPROMIntEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    $0x400af040,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0x400af040,%eax
mov    %ecx,(%rax)
mov    $0x400fd010,%eax
mov    (%rax),%ecx
or     $0x4,%ecx
mov    $0x400fd010,%eax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROMIntEnable>:
push   %rax
xor    %eax,%eax
cmp    $0x4,%edi
sete   %al
mov    %eax,%edi
call   1030 <ASSERT@plt>
orl    $0x1,0x400af040
01
orl    $0x4,0x400fd010
04
pop    %rax
ret

LLVM IR (-O0):
define void @EEPROMIntEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 4
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
%7 = load volatile i32, i32* inttoptr (i64 1074458688 to i32*)
%8 = or i32 %7, 1
store volatile i32 %8, i32* inttoptr (i64 1074458688 to i32*)
%9 = load volatile i32, i32* inttoptr (i64 1074778128 to i32*)
%10 = or i32 %9, 4
store volatile i32 %10, i32* inttoptr (i64 1074778128 to i32*)
ret void
}

LLVM IR (-O2):
define void @EEPROMIntEnable(i32 %0) {
%2 = icmp eq i32 %0, 4
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = load volatile i32, i32* inttoptr (i64 1074458688 to i32*)
%6 = or i32 %5, 1
store volatile i32 %6, i32* inttoptr (i64 1074458688 to i32*)
%7 = load volatile i32, i32* inttoptr (i64 1074778128 to i32*)
%8 = or i32 %7, 4
store volatile i32 %8, i32* inttoptr (i64 1074778128 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit_wrapper();
void indirect_exit_example_ok() {
  int *p = NULL;
  exit_wrapper();
  *p = 42;
}


x86 assembly (clang, -O0):
<indirect_exit_example_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <exit_wrapper@plt>
mov    -0x8(%rbp),%rax
movl   $0x2a,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indirect_exit_example_ok>:
push   %rax
xor    %eax,%eax
call   1030 <exit_wrapper@plt>

LLVM IR (-O0):
define void @indirect_exit_example_ok() {
%1 = alloca i32*
store i32* null, i32** %1
%2 = call i32 (...) @exit_wrapper()
%3 = load i32*, i32** %1
store i32 42, i32* %3
ret void
}

LLVM IR (-O2):
define void @indirect_exit_example_ok() {
%1 = tail call i32 (...) @exit_wrapper()
unreachable
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_message_close_container(void *m) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_message_close_container>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    0x2ecf(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_bus_message_close_container>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_message_close_container(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_message_close_container(i8* nocapture readnone %0) {
%2 = load i32, i32* @EINVAL
%3 = sub nsw i32 0, %2
ret i32 %3
}
int test_peek() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @test_peek() {
ret i32 1
}
long long zssu() { return 0x0000ffffffff7fffLL; }


x86 assembly (clang, -O0):
<zssu>:
push   %rbp
mov    %rsp,%rbp
movabs $0xffffffff7fff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zssu>:
movabs $0xffffffff7fff,%rax
ret

LLVM IR (-O0):
define i64 @zssu() {
ret i64 281474976677887
}

LLVM IR (-O2):
define i64 @zssu() {
ret i64 281474976677887
}
/* Variables and functions */
void *_memcpy(void *, void *, int);
void *memcpy(void *d, void *s, int size) { return _memcpy(d, s, size); }


x86 assembly (clang, -O0):
<memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <_memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memcpy>:
jmp    1030 <_memcpy@plt>

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

LLVM IR (-O2):
define i8* @memcpy(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @_memcpy(i8* %0, i8* %1, i32 %2)
ret i8* %4
}
void gdk_pixmap_lookup_for_display() {}


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

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

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

LLVM IR (-O2):
define void @gdk_pixmap_lookup_for_display() {
ret void
}
void chipcon_ioctl(void) {}


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

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

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

LLVM IR (-O2):
define void @chipcon_ioctl() {
ret void
}
double *(wcheck_double_ptr)(double *to_check) { return to_check; }


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

x86 assembly (clang, -O2):
<wcheck_double_ptr>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define double* @wcheck_double_ptr(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
ret double* %3
}

LLVM IR (-O2):
define double* @wcheck_double_ptr(double* readnone returned %0) {
ret double* %0
}
/* Variables and functions */
int /*<<< orphan*/ f();
void main_main() { f(); }


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

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

LLVM IR (-O0):
define void @main_main() {
%1 = call i32 (...) @f()
ret void
}

LLVM IR (-O2):
define void @main_main() {
%1 = tail call i32 (...) @f()
ret void
}
int test_imm_1Buint16_reg(unsigned short val) {
  return ((val) & (-0x1B << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_1Buint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffffe5,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_1Buint16_reg>:
test   $0xffe5,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_1Buint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -27
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char *strstr(char *, char *);
int search_str(char *strDestination, char *searchstr) {
  char *buffer;
  int strPosition = -1;
  buffer = strstr(strDestination, searchstr);
  if (buffer != NULL)
    strPosition = buffer - strDestination;
  return strPosition;
}


x86 assembly (clang, -O0):
<search_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1151 <search_str+0x41>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<search_str>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strstr@plt>
mov    %eax,%ecx
sub    %ebx,%ecx
cmp    $0x1,%rax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @search_str(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = select i1 %4, i32 -1, i32 %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_strbuf_tostring() {
  printf("NOT IMPLEMENTED:"
         "pa_strbuf_tostring"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [35 x i8] c"NOT IMPLEMENTED:pa_strbuf_tostring\00"
define i32 @pa_strbuf_tostring() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
void cleanup_exit(int i) { _exit(i); }


x86 assembly (clang, -O0):
<cleanup_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<cleanup_exit>:
push   %rax
call   1030 <_exit@plt>

LLVM IR (-O0):
define void @cleanup_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_exit(i32 %3)
unreachable
}

LLVM IR (-O2):
define void @cleanup_exit(i32 %0) {
%2 = tail call i32 @_exit(i32 %0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ vetor;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int soma(int, int *);
void main(void) {
  int vetor[] = {1, 2, 3};
  int y = sizeof(vetor) / sizeof(int);
  printf("A soma é igual a %d\n", soma(y, vetor));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x4(%rbp)
movl   $0x3,-0x10(%rbp)
mov    -0x10(%rbp),%edi
lea    -0xc(%rbp),%rsi
call   1040 <soma@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    $0x3,%edi
call   1040 <soma@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.vetor = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [22 x i8] c"A soma \C3\A9 igual a %d\0A\00"
define void @main() {
%1 = alloca [3 x i32]
%2 = alloca i32
%3 = bitcast [3 x i32]* %1 to i8*
store i32 3, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%6 = call i32 @soma(i32 %4, i32* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@__const.main.vetor = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [22 x i8] c"A soma \C3\A9 igual a %d\0A\00"
define void @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @soma(i32 3, i32* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
double log(double);
double log10(double x) { return log(x) * 0.43429448190325182765; }


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

x86 assembly (clang, -O2):
<log10>:
push   %rax
call   1030 <log@plt>
mulsd  0xee2(%rip),%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define double @log10(double %0) {
%2 = tail call double @log(double %0)
%3 = fmul double %2, 0x3FDBCB7B1526E50E
ret double %3
}
int pivot(char op) {
  switch (op) {
  case '+':
    return 1;
    break;
  case '-':
    return 1;
    break;
  case '*':
    return 11;
    break;
  case '/':
    return 11;
    break;
  case '(':
    return -1;
    break;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<pivot>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffd8,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     1170 <pivot+0x70>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    1177 <pivot+0x77>
movl   $0x1,-0x4(%rbp)
jmp    1177 <pivot+0x77>
movl   $0xb,-0x4(%rbp)
jmp    1177 <pivot+0x77>
movl   $0xb,-0x4(%rbp)
jmp    1177 <pivot+0x77>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <pivot+0x77>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pivot>:
add    $0xffffffd8,%edi
xor    %eax,%eax
cmp    $0x7,%edi
ja     1117 <pivot+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @pivot(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %11 [
i32 43, label %6
i32 45, label %7
i32 42, label %8
i32 47, label %9
i32 40, label %10
]
6: ; preds = %1
store i32 1, i32* %2
br label %12
7: ; preds = %1
store i32 1, i32* %2
br label %12
8: ; preds = %1
store i32 11, i32* %2
br label %12
9: ; preds = %1
store i32 11, i32* %2
br label %12
10: ; preds = %1
store i32 -1, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10, %9, %8, %7, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@switch.table.pivot = [8 x i32] [i32 -1, i32 0, i32 11, i32 1, i32 0, i32 1, i32 0, i32 11]
define i32 @pivot(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -40
%4 = icmp ult i32 %3, 8
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.pivot, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 0, %1 ]
ret i32 %10
}
void SPICRCEnble(unsigned long ulBase) {

  ;
  (*((volatile unsigned long *)(ulBase + 0x00000000))) |= 0x00002000;
}


x86 assembly (clang, -O0):
<SPICRCEnble>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
or     $0x2000,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPICRCEnble>:
orq    $0x2000,(%rdi)
ret

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

LLVM IR (-O2):
define void @SPICRCEnble(i64 %0) {
%2 = inttoptr i64 %0 to i64*
%3 = load volatile i64, i64* %2
%4 = or i64 %3, 8192
store volatile i64 %4, i64* %2
ret void
}
/* Variables and functions */
double ln_get_saturn_earth_dist(double);
double ln_get_saturn_solar_dist(double);
double log10(double);
double ln_get_saturn_magnitude(double JD) {
  double delta, r;
  r = ln_get_saturn_solar_dist(JD);
  delta = ln_get_saturn_earth_dist(JD);
  return -8.88 + 5.0 * log10(r * delta);
}


x86 assembly (clang, -O0):
<ln_get_saturn_magnitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <ln_get_saturn_solar_dist@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <ln_get_saturn_earth_dist@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1040 <log10@plt>
movsd  0xe8e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe8a(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_get_saturn_magnitude>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <ln_get_saturn_solar_dist@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <ln_get_saturn_earth_dist@plt>
mulsd  0x10(%rsp),%xmm0
call   1040 <log10@plt>
mulsd  0xe9d(%rip),%xmm0
addsd  0xe9d(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @ln_get_saturn_magnitude(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = call double @ln_get_saturn_solar_dist(double %5)
store double %6, double* %4
%7 = load double, double* %2
%8 = call double @ln_get_saturn_earth_dist(double %7)
store double %8, double* %3
%9 = load double, double* %4
%10 = load double, double* %3
%11 = fmul double %9, %10
%12 = call double @log10(double %11)
%13 = call double @llvm.fmuladd.f64(double 5.000000e+00, double %12, double -8.880000e+00)
ret double %13
}

LLVM IR (-O2):
define double @ln_get_saturn_magnitude(double %0) {
%2 = tail call double @ln_get_saturn_solar_dist(double %0)
%3 = tail call double @ln_get_saturn_earth_dist(double %0)
%4 = fmul double %2, %3
%5 = tail call double @log10(double %4)
%6 = tail call double @llvm.fmuladd.f64(double %5, double 5.000000e+00, double -8.880000e+00)
ret double %6
}
/* Variables and functions */
int port_inb(int);
int /*<<< orphan*/ port_outb(int, int);
void gled_off(void) { port_outb((2), port_inb((2)) & ~(1 << 1)); }


x86 assembly (clang, -O0):
<gled_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <port_inb@plt>
mov    %eax,%esi
and    $0xfffffffd,%esi
mov    $0x2,%edi
call   1040 <port_outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gled_off>:
push   %rax
mov    $0x2,%edi
call   1030 <port_inb@plt>
and    $0xfffffffd,%eax
mov    $0x2,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <port_outb@plt>

LLVM IR (-O0):
define void @gled_off() {
%1 = call i32 @port_inb(i32 2)
%2 = and i32 %1, -3
%3 = call i32 @port_outb(i32 2, i32 %2)
ret void
}

LLVM IR (-O2):
define void @gled_off() {
%1 = tail call i32 @port_inb(i32 2)
%2 = and i32 %1, -3
%3 = tail call i32 @port_outb(i32 2, i32 %2)
ret void
}
int ws_list_comparator_float(const void *a, const void *b) {
  return (*(float *)a < *(float *)b) - (*(float *)a > *(float *)b);
}


x86 assembly (clang, -O0):
<ws_list_comparator_float>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x8(%rbp),%rcx
movss  (%rcx),%xmm0
mov    -0x10(%rbp),%rcx
ucomiss (%rcx),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ws_list_comparator_float>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
seta   %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ws_list_comparator_float(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to float*
%7 = load float, float* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to float*
%10 = load float, float* %9
%11 = fcmp olt float %7, %10
%12 = zext i1 %11 to i32
%13 = load i8*, i8** %3
%14 = bitcast i8* %13 to float*
%15 = load float, float* %14
%16 = load i8*, i8** %4
%17 = bitcast i8* %16 to float*
%18 = load float, float* %17
%19 = fcmp ogt float %15, %18
%20 = zext i1 %19 to i32
%21 = sub nsw i32 %12, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @ws_list_comparator_float(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = load float, float* %3
%5 = bitcast i8* %1 to float*
%6 = load float, float* %5
%7 = fcmp olt float %4, %6
%8 = zext i1 %7 to i32
%9 = fcmp ogt float %4, %6
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}