xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("\nOi! Eu sou um programa compilado :)\n\n"); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"\0AOi! Eu sou um programa compilado :)\0A\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [38 x i8] c"\0AOi! Eu sou um programa compilado :)\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void toxic() {
  system("/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome "
         "--app https://www.youtube.com/watch?v=39YUXIKrOFk");
}


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

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

LLVM IR (-O0):
@.str = [113 x i8] c"/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --app https://www.youtube.com/watch?v=39YUXIKrOFk\00"
define void @toxic() {
%1 = call i32 @system(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [113 x i8] c"/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --app https://www.youtube.com/watch?v=39YUXIKrOFk\00"
define void @toxic() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str, i64 0, i64 0))
ret void
}
void vec_subtract(double A[3], double B[3], double output[3]) {
  output[0] = A[0] - B[0];
  output[1] = A[1] - B[1];
  output[2] = A[2] - B[2];
}


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

x86 assembly (clang, -O2):
<vec_subtract>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
movsd  %xmm0,(%rdx)
movsd  0x8(%rdi),%xmm0
subsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  0x10(%rdi),%xmm0
subsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x10(%rdx)
ret

LLVM IR (-O0):
define void @vec_subtract(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %4
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = fsub double %9, %12
%14 = load double*, double** %6
%15 = getelementptr inbounds double, double* %14, i64 0
store double %13, double* %15
%16 = load double*, double** %4
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = load double*, double** %5
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = fsub double %18, %21
%23 = load double*, double** %6
%24 = getelementptr inbounds double, double* %23, i64 1
store double %22, double* %24
%25 = load double*, double** %4
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
%28 = load double*, double** %5
%29 = getelementptr inbounds double, double* %28, i64 2
%30 = load double, double* %29
%31 = fsub double %27, %30
%32 = load double*, double** %6
%33 = getelementptr inbounds double, double* %32, i64 2
store double %31, double* %33
ret void
}

LLVM IR (-O2):
define void @vec_subtract(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = fsub double %4, %5
store double %6, double* %2
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
%11 = fsub double %8, %10
%12 = getelementptr inbounds double, double* %2, i64 1
store double %11, double* %12
%13 = getelementptr inbounds double, double* %0, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %1, i64 2
%16 = load double, double* %15
%17 = fsub double %14, %16
%18 = getelementptr inbounds double, double* %2, i64 2
store double %17, double* %18
ret void
}
void CRYPTO_destroy_dynlockid(int i) { return; }


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

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

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

LLVM IR (-O2):
define void @CRYPTO_destroy_dynlockid(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bcm476x_reset_system();
void arch_reset(char mode) { bcm476x_reset_system(); }


x86 assembly (clang, -O0):
<arch_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1030 <bcm476x_reset_system@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @arch_reset(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 (...) @bcm476x_reset_system()
ret void
}

LLVM IR (-O2):
define void @arch_reset(i8 signext %0) {
%2 = tail call i32 (...) @bcm476x_reset_system()
ret void
}
/* Type definitions */
struct BuffList {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct BuffList *);
void BuffList_Destroy(struct BuffList *self) {
  do {
    if (self != 0)
      free(self);
  } while (0);
}


x86 assembly (clang, -O0):
<BuffList_Destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <BuffList_Destroy+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
jmp    1135 <BuffList_Destroy+0x25>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BuffList_Destroy>:
test   %rdi,%rdi
je     111a <BuffList_Destroy+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
%struct.BuffList = type { i32 }
define void @BuffList_Destroy(%struct.BuffList* %0) {
%2 = icmp eq %struct.BuffList* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.BuffList* %0)
br label %5
5: ; preds = %1, %3
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int);
void RgbToStr(uint32_t rgb, char rgbs[], int len) {
  int b = (rgb & 0x0000FF);
  int g = (rgb & 0x00FF00) >> 8;
  int r = (rgb & 0xFF0000) >> 16;
  snprintf(rgbs, len, "rgb:%02x/%02x/%02x", r, g, b);
}


x86 assembly (clang, -O0):
<RgbToStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0xe9e(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RgbToStr>:
push   %rbx
mov    %edi,%eax
movzbl %al,%r9d
movzbl %ah,%ebx
shr    $0x10,%eax
movzbl %al,%ecx
lea    0xed9(%rip),%rax
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rax,%rdx
mov    %ebx,%r8d
pop    %rbx
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"rgb:%02x/%02x/%02x\00"
define void @RgbToStr(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
%11 = and i32 %10, 255
store i32 %11, i32* %7
%12 = load i32, i32* %4
%13 = and i32 %12, 65280
%14 = ashr i32 %13, 8
store i32 %14, i32* %8
%15 = load i32, i32* %4
%16 = and i32 %15, 16711680
%17 = ashr i32 %16, 16
store i32 %17, i32* %9
%18 = load i8*, i8** %5
%19 = load i32, i32* %6
%20 = load i32, i32* %9
%21 = load i32, i32* %8
%22 = load i32, i32* %7
%23 = call i32 @snprintf(i8* %18, i32 %19, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21, i32 %22)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"rgb:%02x/%02x/%02x\00"
define void @RgbToStr(i32 %0, i8* %1, i32 %2) {
%4 = and i32 %0, 255
%5 = lshr i32 %0, 8
%6 = and i32 %5, 255
%7 = lshr i32 %0, 16
%8 = and i32 %7, 255
%9 = tail call i32 @snprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %6, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _ellipse(int, int, int, int, int);
int _getcolor();
int /*<<< orphan*/ _setvideomode(int);
char getchar();
int /*<<< orphan*/ printf(char *, int);
main() {
  int x;
  _setvideomode(4);
  _ellipse(3, 80, 50, 240, 150);
  x = _getcolor();
  while (getchar() != '\n')
    ;
  _setvideomode(-1);
  printf("Current color = %d\n", x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <_setvideomode@plt>
mov    $0x3,%edi
mov    $0x50,%esi
mov    $0x32,%edx
mov    $0xf0,%ecx
mov    $0x96,%r8d
call   1070 <_ellipse@plt>
mov    $0x0,%al
call   1030 <_getcolor@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11aa <main+0x5a>
jmp    1192 <main+0x42>
mov    $0xffffffff,%edi
call   1040 <_setvideomode@plt>
mov    -0x8(%rbp),%esi
lea    0xe42(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1040 <_setvideomode@plt>
mov    $0x3,%edi
mov    $0x50,%esi
mov    $0x32,%edx
mov    $0xf0,%ecx
mov    $0x96,%r8d
call   1070 <_ellipse@plt>
xor    %eax,%eax
call   1030 <_getcolor@plt>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
jne    1190 <main+0x40>
mov    $0xffffffff,%edi
call   1040 <_setvideomode@plt>
lea    0xe54(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Current color = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @_setvideomode(i32 4)
%4 = call i32 @_ellipse(i32 3, i32 80, i32 50, i32 240, i32 150)
%5 = call i32 (...) @_getcolor()
store i32 %5, i32* %2
br label %6
6: ; preds = %10, %0
%7 = call signext i8 (...) @getchar()
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 10
br i1 %9, label %10, label %11
10: ; preds = %6
br label %6
11: ; preds = %6
%12 = call i32 @_setvideomode(i32 -1)
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [20 x i8] c"Current color = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @_setvideomode(i32 4)
%2 = tail call i32 @_ellipse(i32 3, i32 80, i32 50, i32 240, i32 150)
%3 = tail call i32 (...) @_getcolor()
br label %4
4: ; preds = %4, %0
%5 = tail call signext i8 (...) @getchar()
%6 = icmp eq i8 %5, 10
br i1 %6, label %7, label %4
7: ; preds = %4
%8 = tail call i32 @_setvideomode(i32 -1)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
int fun1079() { return 1079; }


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

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

LLVM IR (-O0):
define i32 @fun1079() {
ret i32 1079
}

LLVM IR (-O2):
define i32 @fun1079() {
ret i32 1079
}
/* Type definitions */
struct jpeg_decompress_struct {
  int dummy;
};

/* Variables and functions */
struct jpeg_decompress_struct *init_jpeg();
int /*<<< orphan*/ pic_chunk(struct jpeg_decompress_struct *);
int main() {
  struct jpeg_decompress_struct *a = init_jpeg();
  pic_chunk(a);
  return 0;
}


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

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

LLVM IR (-O0):
%struct.jpeg_decompress_struct = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.jpeg_decompress_struct*
store i32 0, i32* %1
%3 = call %struct.jpeg_decompress_struct* (...) @init_jpeg()
store %struct.jpeg_decompress_struct* %3, %struct.jpeg_decompress_struct** %2
%4 = load %struct.jpeg_decompress_struct*, %struct.jpeg_decompress_struct** %2
%5 = call i32 @pic_chunk(%struct.jpeg_decompress_struct* %4)
ret i32 0
}

LLVM IR (-O2):
%struct.jpeg_decompress_struct = type { i32 }
define i32 @main() {
%1 = tail call %struct.jpeg_decompress_struct* (...) @init_jpeg()
%2 = tail call i32 @pic_chunk(%struct.jpeg_decompress_struct* %1)
ret i32 0
}
/* Type definitions */
struct integer_stack_head {
  int dummy;
};

/* Variables and functions */
struct integer_stack_head *init_integer_stack(int);
int /*<<< orphan*/ pop(struct integer_stack_head *);
void TEST_should_abort_when_empty_integer_stack_popped() {
  struct integer_stack_head *head = init_integer_stack(1);
  pop(head);
}


x86 assembly (clang, -O0):
<TEST_should_abort_when_empty_integer_stack_popped>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1030 <init_integer_stack@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TEST_should_abort_when_empty_integer_stack_popped>:
push   %rax
mov    $0x1,%edi
call   1030 <init_integer_stack@plt>
mov    %rax,%rdi
pop    %rax
jmp    1040 <pop@plt>

LLVM IR (-O0):
%struct.integer_stack_head = type { i32 }
define void @TEST_should_abort_when_empty_integer_stack_popped() {
%1 = alloca %struct.integer_stack_head*
%2 = call %struct.integer_stack_head* @init_integer_stack(i32 1)
store %struct.integer_stack_head* %2, %struct.integer_stack_head** %1
%3 = load %struct.integer_stack_head*, %struct.integer_stack_head** %1
%4 = call i32 @pop(%struct.integer_stack_head* %3)
ret void
}

LLVM IR (-O2):
%struct.integer_stack_head = type { i32 }
define void @TEST_should_abort_when_empty_integer_stack_popped() {
%1 = tail call %struct.integer_stack_head* @init_integer_stack(i32 1)
%2 = tail call i32 @pop(%struct.integer_stack_head* %1)
ret void
}
/* Type definitions */
struct Value {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ psage_snuff();
void builtin_exit(struct Value *argument, struct Value *env,
                  struct Value **out) {
  (void)argument;
  (void)env;
  (void)out;
  psage_snuff();
}


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

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

LLVM IR (-O0):
%struct.Value = type { i32 }
define void @builtin_exit(%struct.Value* %0, %struct.Value* %1, %struct.Value** %2) {
%4 = alloca %struct.Value*
%5 = alloca %struct.Value*
%6 = alloca %struct.Value**
store %struct.Value* %0, %struct.Value** %4
store %struct.Value* %1, %struct.Value** %5
store %struct.Value** %2, %struct.Value*** %6
%7 = load %struct.Value*, %struct.Value** %4
%8 = load %struct.Value*, %struct.Value** %5
%9 = load %struct.Value**, %struct.Value*** %6
%10 = call i32 (...) @psage_snuff()
ret void
}

LLVM IR (-O2):
%struct.Value = type { i32 }
define void @builtin_exit(%struct.Value* nocapture readnone %0, %struct.Value* nocapture readnone %1, %struct.Value** nocapture readnone %2) {
%4 = tail call i32 (...) @psage_snuff()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int pivot_root(const char *new_root, const char *put_old) {
  fprintf(stderr,
          "\n\nTo make this application work, you will need to recompile\n");
  fprintf(stderr,
          "with a kernel supporting the pivot_root system call. -Erik\n\n");
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<pivot_root>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xef8(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%ecx
mov    0x2e76(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pivot_root>:
push   %rbx
mov    0x2ec0(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf0e(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    0x2e8c(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [61 x i8] c"\0A\0ATo make this application work, you will need to recompile\0A\00"
@.str.1 = [61 x i8] c"with a kernel supporting the pivot_root system call. -Erik\0A\0A\00"
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @pivot_root(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @ENOSYS
store i32 %9, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [61 x i8] c"\0A\0ATo make this application work, you will need to recompile\0A\00"
@.str.1 = [61 x i8] c"with a kernel supporting the pivot_root system call. -Erik\0A\0A\00"
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @pivot_root(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}
int fun681() { return 681; }


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

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

LLVM IR (-O0):
define i32 @fun681() {
ret i32 681
}

LLVM IR (-O2):
define i32 @fun681() {
ret i32 681
}
/* Variables and functions */
int /*<<< orphan*/ daemon(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ dodo();
int main(int argc, const char *argv[]) {
  daemon(0, 0);
  dodo();
  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)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <daemon@plt>
mov    $0x0,%al
call   1030 <dodo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
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 @daemon(i32 0, i32 0)
%7 = call i32 (...) @dodo()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @daemon(i32 0, i32 0)
%4 = tail call i32 (...) @dodo()
ret i32 0
}
unsigned int log2above(unsigned int v) {
  unsigned int l;
  unsigned int r;
  for (l = 0, r = 0; (v >> 1); ++l, v >>= 1)
    r |= (v & 1);
  return (l + r);
}


x86 assembly (clang, -O0):
<log2above>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
cmp    $0x0,%eax
je     1147 <log2above+0x47>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1115 <log2above+0x15>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2above>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     1125 <log2above+0x25>
xor    %eax,%eax
xor    %ecx,%ecx
mov    %edi,%edx
nopl   (%rax)
shr    %edx
mov    %edi,%esi
and    $0x1,%esi
or     %esi,%eax
add    $0x1,%ecx
cmp    $0x3,%edi
mov    %edx,%edi
ja     1110 <log2above+0x10>
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @log2above(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %14, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 0, %1 ]
%5 = phi i32 [ %10, %3 ], [ 0, %1 ]
%6 = phi i32 [ %7, %3 ], [ %0, %1 ]
%7 = lshr i32 %6, 1
%8 = and i32 %6, 1
%9 = or i32 %4, %8
%10 = add nuw nsw i32 %5, 1
%11 = icmp ult i32 %6, 4
br i1 %11, label %12, label %3
12: ; preds = %3
%13 = add i32 %9, %10
br label %14
14: ; preds = %12, %1
%15 = phi i32 [ %13, %12 ], [ 0, %1 ]
ret i32 %15
}
/* Variables and functions */
int dup(int);
int txc_libc_dup(int oldfd) { return dup(oldfd); }


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

x86 assembly (clang, -O2):
<txc_libc_dup>:
jmp    1030 <dup@plt>

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

LLVM IR (-O2):
define i32 @txc_libc_dup(i32 %0) {
%2 = tail call i32 @dup(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ put_raw_ch(int);
void ochar(int ch) { put_raw_ch(ch); }


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

x86 assembly (clang, -O2):
<ochar>:
jmp    1030 <put_raw_ch@plt>

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

LLVM IR (-O2):
define void @ochar(i32 %0) {
%2 = tail call i32 @put_raw_ch(i32 %0)
ret void
}
/* Type definitions */
struct sockaddr_storage {
  int dummy;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ ss;
typedef int socklen_t;

/* Variables and functions */
int ___sane_accept(int, struct sockaddr *, int *);
int zinet_accept(int fd) {
  struct sockaddr_storage ss;
  socklen_t ss_len = sizeof(ss);
  return (___sane_accept(fd, (struct sockaddr *)&ss, &ss_len));
}


x86 assembly (clang, -O0):
<zinet_accept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <___sane_accept@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zinet_accept>:
sub    $0x18,%rsp
movl   $0x4,0xc(%rsp)
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1030 <___sane_accept@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @zinet_accept(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr_storage
%4 = alloca i32
store i32 %0, i32* %2
store i32 4, i32* %4
%5 = load i32, i32* %2
%6 = bitcast %struct.sockaddr_storage* %3 to %struct.sockaddr*
%7 = call i32 @___sane_accept(i32 %5, %struct.sockaddr* %6, i32* %4)
ret i32 %7
}

LLVM IR (-O2):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @zinet_accept(i32 %0) {
%2 = alloca %struct.sockaddr_storage
%3 = alloca i32
%4 = bitcast %struct.sockaddr_storage* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = bitcast %struct.sockaddr_storage* %2 to %struct.sockaddr*
%7 = call i32 @___sane_accept(i32 %0, %struct.sockaddr* %6, i32* %3)
ret i32 %7
}
void strength_result9(int *data) {
  int i = 0;
  int j = 0;
  do {
    data[data[2]] = i;
    i = i + 1;
    j = j + 21;
  } while (j < data[3]);
}


x86 assembly (clang, -O0):
<strength_result9>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq 0x8(%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x15,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    0xc(%rcx),%eax
jl     1116 <strength_result9+0x16>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strength_result9>:
xor    %eax,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq 0x8(%rdi),%rdx
mov    %eax,(%rdi,%rdx,4)
add    $0x1,%eax
add    $0x15,%ecx
cmp    0xc(%rdi),%ecx
jl     1110 <strength_result9+0x10>
ret

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

LLVM IR (-O2):
define void @strength_result9(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = getelementptr inbounds i32, i32* %0, i64 3
br label %4
4: ; preds = %4, %1
%5 = phi i32 [ 0, %1 ], [ %10, %4 ]
%6 = phi i32 [ 0, %1 ], [ %11, %4 ]
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
store i32 %5, i32* %9
%10 = add nuw nsw i32 %5, 1
%11 = add nuw nsw i32 %6, 21
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %4, label %14
14: ; preds = %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void modifyElement(int e) { printf("Value in modifyElement is %d\n", e *= 2); }


x86 assembly (clang, -O0):
<modifyElement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
shl    $0x1,%esi
mov    %esi,-0x4(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modifyElement>:
lea    (%rdi,%rdi,1),%esi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Value in modifyElement is %d\0A\00"
define void @modifyElement(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 2
store i32 %4, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Value in modifyElement is %d\0A\00"
define void @modifyElement(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
void LoadGreys(void) {}


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

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

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

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

/* Variables and functions */
scalar_t__ cmpxchg_32(int /*<<< orphan*/ *, int /*<<< orphan*/,
                      int /*<<< orphan*/);
void *cmpxchg_ptr(void *p, void *old, void *new) {
  return (void *)cmpxchg_32((uint32_t *)p, (uint32_t)old, (uint32_t) new);
}


x86 assembly (clang, -O0):
<cmpxchg_ptr>:
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),%rax
mov    %eax,%esi
mov    -0x18(%rbp),%rax
mov    %eax,%edx
call   1030 <cmpxchg_32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpxchg_ptr>:
jmp    1030 <cmpxchg_32@plt>

LLVM IR (-O0):
define i8* @cmpxchg_ptr(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to i32*
%9 = load i8*, i8** %5
%10 = ptrtoint i8* %9 to i32
%11 = load i8*, i8** %6
%12 = ptrtoint i8* %11 to i32
%13 = call i64 @cmpxchg_32(i32* %8, i32 %10, i32 %12)
%14 = inttoptr i64 %13 to i8*
ret i8* %14
}

LLVM IR (-O2):
define i8* @cmpxchg_ptr(i8* %0, i8* %1, i8* %2) {
%4 = bitcast i8* %0 to i32*
%5 = ptrtoint i8* %1 to i64
%6 = trunc i64 %5 to i32
%7 = ptrtoint i8* %2 to i64
%8 = trunc i64 %7 to i32
%9 = tail call i64 @cmpxchg_32(i32* %4, i32 %6, i32 %8)
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ lcdWriteCmd(int);
void lcdClear(void) { lcdWriteCmd(0x01); }


x86 assembly (clang, -O0):
<lcdClear>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <lcdWriteCmd@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @lcdClear() {
%1 = call i32 @lcdWriteCmd(i32 1)
ret void
}

LLVM IR (-O2):
define void @lcdClear() {
%1 = tail call i32 @lcdWriteCmd(i32 1)
ret void
}
char *procprt_VSTACK_e(struct tstat *curstat, int avgval, int nsecs) {
  return "    0K";
}


x86 assembly (clang, -O0):
<procprt_VSTACK_e>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xeeb(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.tstat = type opaque
@.str = [7 x i8] c" 0K\00"
define i8* @procprt_VSTACK_e(%struct.tstat* %0, i32 %1, i32 %2) {
%4 = alloca %struct.tstat*
%5 = alloca i32
%6 = alloca i32
store %struct.tstat* %0, %struct.tstat** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tstat = type opaque
@.str = [7 x i8] c" 0K\00"
define i8* @procprt_VSTACK_e(%struct.tstat* nocapture readnone %0, i32 %1, i32 %2) {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
int ddr3_get_size(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @ddr3_get_size() {
ret i32 2
}

LLVM IR (-O2):
define i32 @ddr3_get_size() {
ret i32 2
}
int test_imm_85uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x85 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_85uint64_highword_reg>:
movabs $0x8500000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_85uint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 133
%6 = icmp ne i64 %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_85uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 571230650368
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef void *pthread_t;

/* Variables and functions */
pthread_t pthread_self(void) { return (void *)0xdeadbeef; }


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

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

LLVM IR (-O0):
define i8* @pthread_self() {
ret i8* inttoptr (i64 3735928559 to i8*)
}

LLVM IR (-O2):
define i8* @pthread_self() {
ret i8* inttoptr (i64 3735928559 to i8*)
}
unsigned bit_mask_nf(unsigned bits) { return (1 << bits) - 1; }


x86 assembly (clang, -O0):
<bit_mask_nf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_mask_nf>:
mov    %edi,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @bit_mask_nf(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 1, %3
%5 = sub nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @bit_mask_nf(i32 %0) {
%2 = shl nsw i32 -1, %0
%3 = xor i32 %2, -1
ret i32 %3
}
void PTR_SWAP(void **a, void **b) {
  void *t = *a;
  *a = *b;
  *b = t;
}


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

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

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

LLVM IR (-O2):
define void @PTR_SWAP(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
store i8* %4, i8** %0
store i8* %3, i8** %1
ret void
}
int test_imm_F9uint32_reg(unsigned int val) {
  return ((val) & (0xF9 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_F9uint32_reg(i32 %0) {
%2 = and i32 %0, 249
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
bool is_primitive_array(const char *name) {
  if (*name != '[')
    return false;
  while (*name == '[')
    name++;
  return *name != 'L';
}


x86 assembly (clang, -O0):
<is_primitive_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
je     1124 <is_primitive_array+0x24>
movl   $0x0,-0x4(%rbp)
jmp    115f <is_primitive_array+0x5f>
jmp    1129 <is_primitive_array+0x29>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
jne    114a <is_primitive_array+0x4a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1129 <is_primitive_array+0x29>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x4c,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_primitive_array>:
xor    %eax,%eax
cmpb   $0x5b,(%rdi)
jne    1124 <is_primitive_array+0x24>
add    $0x1,%rdi
nopl   0x0(%rax,%rax,1)
movzbl (%rdi),%ecx
add    $0x1,%rdi
cmp    $0x5b,%cl
je     1110 <is_primitive_array+0x10>
xor    %eax,%eax
cmp    $0x4c,%cl
setne  %al
ret

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

LLVM IR (-O2):
define i32 @is_primitive_array(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 91
br i1 %3, label %4, label %12
4: ; preds = %1, %4
%5 = phi i8* [ %6, %4 ], [ %0, %1 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 91
br i1 %8, label %4, label %9
9: ; preds = %4
%10 = icmp ne i8 %7, 76
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %1, %9
%13 = phi i32 [ %11, %9 ], [ 0, %1 ]
ret i32 %13
}
int test_imm_3Duint32_mem(unsigned int *val) {
  return ((*val) & (0x3D << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_3Duint32_mem>:
testb  $0x3d,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_3Duint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 61
%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_3Duint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 61
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void zero_array(int ar[], int len) {
  for (int i = 0; i < len; i++) {
    ar[i] = 0;
  }
}


x86 assembly (clang, -O0):
<zero_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <zero_array+0x3b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <zero_array+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero_array>:
test   %esi,%esi
jle    1126 <zero_array+0x16>
push   %rax
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @zero_array(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i32* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret void
}
int mystrcpy(s1, s2)
char *s1;
char *s2;
{
  while (*s2)
    *s1++ = *s2++;
  *s1 = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<mystrcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1140 <mystrcpy+0x40>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    110c <mystrcpy+0xc>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrcpy>:
mov    (%rsi),%al
test   %al,%al
je     1121 <mystrcpy+0x21>
add    $0x1,%rsi
nopw   0x0(%rax,%rax,1)
mov    %al,(%rdi)
add    $0x1,%rdi
movzbl (%rsi),%eax
add    $0x1,%rsi
test   %al,%al
jne    1110 <mystrcpy+0x10>
movb   $0x0,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @mystrcpy(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret i32 0
}
void htc_xo_block_clks_count(void) { return; }


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

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

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

LLVM IR (-O2):
define void @htc_xo_block_clks_count() {
ret void
}
int RECOIL_ClampByte(int x) { return x <= 0 ? 0 : x >= 255 ? 255 : x; }


x86 assembly (clang, -O0):
<RECOIL_ClampByte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     111b <RECOIL_ClampByte+0x1b>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <RECOIL_ClampByte+0x41>
cmpl   $0xff,-0x4(%rbp)
jl     1135 <RECOIL_ClampByte+0x35>
mov    $0xff,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <RECOIL_ClampByte+0x3b>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RECOIL_ClampByte>:
cmp    $0xff,%edi
mov    $0xff,%ecx
cmovl  %edi,%ecx
xor    %eax,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @RECOIL_ClampByte(i32 %0) {
%2 = icmp slt i32 %0, 255
%3 = select i1 %2, i32 %0, i32 255
%4 = icmp sgt i32 %3, 0
%5 = select i1 %4, i32 %3, i32 0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *prg) {
  fprintf(stderr, "# Usage: %s [-c] <delta days>\n", prg);
  exit(EINVAL);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
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>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"# Usage: %s [-c] <delta days>\0A\00"
@EINVAL = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EINVAL
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"# Usage: %s [-c] <delta days>\0A\00"
@EINVAL = global i32 0
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EINVAL
%5 = tail call i32 @exit(i32 %4)
unreachable
}