xunge/DecIR huggingface dataset:
int test_imm_53int16_mem(short *val) {
  return ((*val) & (0x53 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_53int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 83
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ move_Y(int);
void Ymove(int dir, unsigned int Nsteps) {
  if (Nsteps == 0) {
    move_Y(dir);
  } else {
  }
}


x86 assembly (clang, -O0):
<Ymove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1135 <Ymove+0x25>
mov    -0x4(%rbp),%edi
call   1030 <move_Y@plt>
jmp    113a <Ymove+0x2a>
jmp    113a <Ymove+0x2a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ymove>:
test   %esi,%esi
je     1115 <Ymove+0x5>
ret
jmp    1030 <move_Y@plt>

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

LLVM IR (-O2):
define void @Ymove(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @move_Y(i32 %0)
br label %6
6: ; preds = %2, %4
ret void
}
/* Type definitions */
struct ThreadContext {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct ThreadContext *);
void free_thread_context(struct ThreadContext *context) { free(context); }


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

x86 assembly (clang, -O2):
<free_thread_context>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.ThreadContext = type { i32 }
define void @free_thread_context(%struct.ThreadContext* nocapture %0) {
%2 = tail call i32 @free(%struct.ThreadContext* %0)
ret void
}
void default_handler(void) {
  while (1)
    ;
}


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

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

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

LLVM IR (-O2):
define void @default_handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
zero_value(exp, filep, file_red) register char *exp;
register struct filepointer *filep;
register struct inclist *file_red;
{ return (1); }


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

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

LLVM IR (-O0):
%struct.filepointer = type opaque
%struct.inclist = type opaque
define i32 @zero_value(i8* %0, %struct.filepointer* %1, %struct.inclist* %2) {
%4 = alloca i8*
%5 = alloca %struct.filepointer*
%6 = alloca %struct.inclist*
store i8* %0, i8** %4
store %struct.filepointer* %1, %struct.filepointer** %5
store %struct.inclist* %2, %struct.inclist** %6
ret i32 1
}

LLVM IR (-O2):
%struct.filepointer = type opaque
%struct.inclist = type opaque
define i32 @zero_value(i8* nocapture readnone %0, %struct.filepointer* nocapture readnone %1, %struct.inclist* nocapture readnone %2) {
ret i32 1
}
long reloc_imm(long offset) { return ((((offset)-8) >> 2) & 0x00ffffff); }


x86 assembly (clang, -O0):
<reloc_imm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x8,%rax
sar    $0x2,%rax
and    $0xffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reloc_imm>:
lea    0x3fffff8(%rdi),%eax
shr    $0x2,%eax
and    $0xffffff,%eax
ret

LLVM IR (-O0):
define i64 @reloc_imm(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub nsw i64 %3, 8
%5 = ashr i64 %4, 2
%6 = and i64 %5, 16777215
ret i64 %6
}

LLVM IR (-O2):
define i64 @reloc_imm(i64 %0) {
%2 = add i64 %0, 67108856
%3 = lshr i64 %2, 2
%4 = and i64 %3, 16777215
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ bar(char const *, long double, ...);
void foo(const char *x, long double y, int z) {
  if (z >= 0)
    bar(x, z, y);
  else
    bar(x, y);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
fldt   0x10(%rbp)
mov    %rdi,-0x8(%rbp)
fstpt  -0x20(%rbp)
mov    %esi,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     1153 <foo+0x43>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
fildl  -0x28(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
xor    %eax,%eax
call   1030 <bar@plt>
jmp    1166 <foo+0x56>
mov    -0x8(%rbp),%rdi
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
xor    %eax,%eax
call   1030 <bar@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
sub    $0x28,%rsp
fldt   0x30(%rsp)
test   %esi,%esi
js     112a <foo+0x1a>
mov    %esi,0x24(%rsp)
fildl  0x24(%rsp)
fxch   %st(1)
fstpt  0x10(%rsp)
fstpt  (%rsp)
xor    %eax,%eax
call   1030 <bar@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @foo(i8* %0, x86_fp80 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca x86_fp80
%6 = alloca i32
store i8* %0, i8** %4
store x86_fp80 %1, x86_fp80* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = load i8*, i8** %4
%11 = load i32, i32* %6
%12 = sitofp i32 %11 to x86_fp80
%13 = load x86_fp80, x86_fp80* %5
%14 = call i32 (i8*, x86_fp80, ...) @bar(i8* %10, x86_fp80 %12, x86_fp80 %13)
br label %19
15: ; preds = %3
%16 = load i8*, i8** %4
%17 = load x86_fp80, x86_fp80* %5
%18 = call i32 (i8*, x86_fp80, ...) @bar(i8* %16, x86_fp80 %17)
br label %19
19: ; preds = %15, %9
ret void
}

LLVM IR (-O2):
define void @foo(i8* %0, x86_fp80 %1, i32 %2) {
%4 = icmp sgt i32 %2, -1
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = sitofp i32 %2 to x86_fp80
%7 = tail call i32 (i8*, x86_fp80, ...) @bar(i8* %0, x86_fp80 %6, x86_fp80 %1)
br label %10
8: ; preds = %3
%9 = tail call i32 (i8*, x86_fp80, ...) @bar(i8* %0, x86_fp80 %1)
br label %10
10: ; preds = %8, %5
ret void
}
char *cstrlwr(char *s) {
  char *p;
  for (p = s; *p; p++)
    *p = ((((*p) >= 'A') && ((*p) <= 'Z')) ? ((*p) + ' ') : (*p));
  return s;
}


x86 assembly (clang, -O0):
<cstrlwr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1175 <cstrlwr+0x75>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     114f <cstrlwr+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     114f <cstrlwr+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0x20,%eax
mov    %eax,-0x14(%rbp)
jmp    1159 <cstrlwr+0x59>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <cstrlwr+0x10>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cstrlwr>:
mov    %rdi,%rax
mov    (%rdi),%dl
test   %dl,%dl
je     1133 <cstrlwr+0x33>
lea    0x1(%rax),%rcx
nopl   (%rax)
lea    -0x41(%rdx),%esi
lea    0x20(%rdx),%edi
cmp    $0x1a,%sil
movzbl %dl,%edx
movzbl %dil,%esi
cmovae %edx,%esi
mov    %sil,-0x1(%rcx)
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <cstrlwr+0x10>
ret

LLVM IR (-O0):
define i8* @cstrlwr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %32, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %35
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %24
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 90
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = add nsw i32 %22, 32
br label %28
24: ; preds = %14, %9
%25 = load i8*, i8** %3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
br label %28
28: ; preds = %24, %19
%29 = phi i32 [ %23, %19 ], [ %27, %24 ]
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %3
store i8 %30, i8* %31
br label %32
32: ; preds = %28
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %3
br label %5
35: ; preds = %5
%36 = load i8*, i8** %2
ret i8* %36
}

LLVM IR (-O2):
define i8* @cstrlwr(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %11, %4 ], [ %0, %1 ]
%7 = add i8 %5, -65
%8 = icmp ult i8 %7, 26
%9 = add nuw nsw i8 %5, 32
%10 = select i1 %8, i8 %9, i8 %5
store i8 %10, i8* %6
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, const char *argv[]) {
  printf("hello world\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
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 = [13 x i8] c"hello world\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"hello world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int core3_safe(char const *);
int U_EMRDELETECOLORSPACE_safe(const char *record) {
  return (core3_safe(record));
}


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

x86 assembly (clang, -O2):
<U_EMRDELETECOLORSPACE_safe>:
jmp    1030 <core3_safe@plt>

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

LLVM IR (-O2):
define i32 @U_EMRDELETECOLORSPACE_safe(i8* %0) {
%2 = tail call i32 @core3_safe(i8* %0)
ret i32 %2
}
void __lyos_libpthread_dummy(void) {}


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

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

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

LLVM IR (-O2):
define void @__lyos_libpthread_dummy() {
ret void
}
void scribe_post_schedule(void) {}


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

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

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

LLVM IR (-O2):
define void @scribe_post_schedule() {
ret void
}
void dd_pbl_ios_localytics_session_resume() {}


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

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

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

LLVM IR (-O2):
define void @dd_pbl_ios_localytics_session_resume() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void fig04_01() {
  unsigned int counter = 1;
  while (counter <= 10) {
    printf("%u\n", counter);
    ++counter;
  }
}


x86 assembly (clang, -O0):
<fig04_01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
ja     1146 <fig04_01+0x36>
mov    -0x4(%rbp),%esi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <fig04_01+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fig04_01>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%u\0A\00"
define void @fig04_01() {
%1 = alloca i32
store i32 1, i32* %1
br label %2
2: ; preds = %5, %0
%3 = load i32, i32* %1
%4 = icmp ule i32 %3, 10
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %1
%9 = add i32 %8, 1
store i32 %9, i32* %1
br label %2
10: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define void @fig04_01() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 7)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 9)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}
int putDebugCharReady() { return ((*(volatile char *)(0x05FFFECC)) & 0x80); }


x86 assembly (clang, -O0):
<putDebugCharReady>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5fffecc,%eax
mov    (%rax),%al
movsbl %al,%eax
and    $0x80,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<putDebugCharReady>:
movzbl 0x5fffecc,%eax
05
and    $0xffffff80,%eax
ret

LLVM IR (-O0):
define i32 @putDebugCharReady() {
%1 = load volatile i8, i8* inttoptr (i64 100662988 to i8*)
%2 = sext i8 %1 to i32
%3 = and i32 %2, 128
ret i32 %3
}

LLVM IR (-O2):
define i32 @putDebugCharReady() {
%1 = load volatile i8, i8* inttoptr (i64 100662988 to i8*)
%2 = and i8 %1, -128
%3 = zext i8 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
int mbsinit(const mbstate_t *st) { return !st || !*(unsigned *)st; }


x86 assembly (clang, -O0):
<mbsinit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1127 <mbsinit+0x27>
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mbsinit>:
test   %rdi,%rdi
je     110e <mbsinit+0xe>
xor    %eax,%eax
cmpl   $0x0,(%rdi)
sete   %al
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @mbsinit(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br label %10
10: ; preds = %5, %1
%11 = phi i1 [ true, %1 ], [ %9, %5 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @mbsinit(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = load i32, i32* %0
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 1, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ display_to_fb(unsigned char *, int);
int /*<<< orphan*/ printf(char *);
void process_image(const void *p, int aLength) {
  printf(".");
  display_to_fb((unsigned char *)p, aLength);
}


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

x86 assembly (clang, -O2):
<process_image>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <display_to_fb@plt>

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
define void @process_image(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @display_to_fb(i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
define void @process_image(i8* %0, i32 %1) {
%3 = tail call i32 @putchar(i32 46)
%4 = tail call i32 @display_to_fb(i8* %0, i32 %1)
ret void
}
int test_imm_0Eint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x0E << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_0Eint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 917504
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ foobar();
void bar() {
  foobar();
  foobar();
}


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

x86 assembly (clang, -O2):
<bar>:
push   %rax
xor    %eax,%eax
call   1030 <foobar@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <foobar@plt>

LLVM IR (-O0):
define void @bar() {
%1 = call i32 (...) @foobar()
%2 = call i32 (...) @foobar()
ret void
}

LLVM IR (-O2):
define void @bar() {
%1 = tail call i32 (...) @foobar()
%2 = tail call i32 (...) @foobar()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ l1_cache_operate_on_line(int /*<<< orphan*/, unsigned int);
__attribute__((always_)) void l1_cache_invalidate(unsigned addr) {
  l1_cache_operate_on_line((0), addr);
}


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

x86 assembly (clang, -O2):
<l1_cache_invalidate>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <l1_cache_operate_on_line@plt>

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

LLVM IR (-O2):
define void @l1_cache_invalidate(i32 %0) {
%2 = tail call i32 @l1_cache_operate_on_line(i32 0, i32 %0)
ret void
}
/* Variables and functions */
scalar_t__ YabauseExec();
int /*<<< orphan*/ check_pad();
int psp_per_handle_events(void) {
  check_pad();
  if (YabauseExec() != 0) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<psp_per_handle_events>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <check_pad@plt>
mov    $0x0,%al
call   1030 <YabauseExec@plt>
cmp    $0x0,%rax
je     114c <psp_per_handle_events+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1153 <psp_per_handle_events+0x33>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psp_per_handle_events>:
push   %rax
xor    %eax,%eax
call   1040 <check_pad@plt>
xor    %eax,%eax
call   1030 <YabauseExec@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @psp_per_handle_events() {
%1 = alloca i32
%2 = call i32 (...) @check_pad()
%3 = call i64 (...) @YabauseExec()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 -1, i32* %1
br label %7
6: ; preds = %0
store i32 0, i32* %1
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
define i32 @psp_per_handle_events() {
%1 = tail call i32 (...) @check_pad()
%2 = tail call i64 (...) @YabauseExec()
%3 = icmp ne i64 %2, 0
%4 = sext i1 %3 to i32
ret i32 %4
}
void I422AlphaToARGBRow_Any_AVX2() {}


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

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

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

LLVM IR (-O2):
define void @I422AlphaToARGBRow_Any_AVX2() {
ret void
}
unsigned long __fixunsdfdi(double a) {
  if (a < 0)
    return 0;
  return (unsigned long)((unsigned int)a);
}


x86 assembly (clang, -O0):
<__fixunsdfdi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1124 <__fixunsdfdi+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1130 <__fixunsdfdi+0x30>
cvttsd2si -0x10(%rbp),%rax
mov    %eax,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fixunsdfdi>:
xor    %eax,%eax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
cvttsd2si %xmm0,%rcx
mov    %ecx,%ecx
cmovbe %rcx,%rax
ret

LLVM IR (-O0):
define i64 @__fixunsdfdi(double %0) {
%2 = alloca i64
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 0, i64* %2
br label %11
7: ; preds = %1
%8 = load double, double* %3
%9 = fptoui double %8 to i32
%10 = zext i32 %9 to i64
store i64 %10, i64* %2
br label %11
11: ; preds = %7, %6
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
define i64 @__fixunsdfdi(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fptoui double %0 to i32
%4 = zext i32 %3 to i64
%5 = select i1 %2, i64 0, i64 %4
ret i64 %5
}
/* Variables and functions */
unsigned int hash_ulong(void const *);
unsigned int hash_uint(const void *key) { return hash_ulong(key); }


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

x86 assembly (clang, -O2):
<hash_uint>:
jmp    1030 <hash_ulong@plt>

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

LLVM IR (-O2):
define i32 @hash_uint(i8* %0) {
%2 = tail call i32 @hash_ulong(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void linenoiseFree(void *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<linenoiseFree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @linenoiseFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int get(int array[], int n, int row, int col) { return array[row * n + col]; }


x86 assembly (clang, -O0):
<get>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get>:
imul   %edx,%esi
add    %ecx,%esi
movslq %esi,%rax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @get(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = mul nsw i32 %10, %11
%13 = load i32, i32* %8
%14 = add nsw i32 %12, %13
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %9, i64 %15
%17 = load i32, i32* %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @get(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = mul nsw i32 %2, %1
%6 = add nsw i32 %5, %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int foo(void) {
  bar();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @foo() {
%1 = call i32 (...) @bar()
ret i32 0
}

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 (...) @bar()
ret i32 0
}
unsigned int gsl_version_id(void) { return 0x20131106; }


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

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

LLVM IR (-O0):
define i32 @gsl_version_id() {
ret i32 538120454
}

LLVM IR (-O2):
define i32 @gsl_version_id() {
ret i32 538120454
}
/* Variables and functions */
int /*<<< orphan*/ adns2080_reset();
void adns2080_wakeup(void) { adns2080_reset(); }


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

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

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

LLVM IR (-O2):
define void @adns2080_wakeup() {
%1 = tail call i32 (...) @adns2080_reset()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen(char *);
void cgentry(void) {
  gen("pushl\t%ebp");
  gen("movl\t%esp,%ebp");
}


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"pushl\09%ebp\00"
@.str.1 = [15 x i8] c"movl\09%esp,%ebp\00"
define void @cgentry() {
%1 = call i32 @gen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @gen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"pushl\09%ebp\00"
@.str.1 = [15 x i8] c"movl\09%esp,%ebp\00"
define void @cgentry() {
%1 = tail call i32 @gen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @gen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned char _ucAsyncTest(void) { return (0); }


x86 assembly (clang, -O0):
<_ucAsyncTest>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i8 @_ucAsyncTest() {
ret i8 0
}

LLVM IR (-O2):
define zeroext i8 @_ucAsyncTest() {
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ my_fn();
int main(void) { my_fn(); }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned int Sys_MillisecondsRaw(void) {
  struct timeval tp;
  gettimeofday(&tp, NULL);
  return tp.tv_sec * 1000 + tp.tv_usec / 1000;
}


x86 assembly (clang, -O0):
<Sys_MillisecondsRaw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sys_MillisecondsRaw>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,(%rsp),%ecx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @Sys_MillisecondsRaw() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = sdiv i32 %7, 1000
%9 = add nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @Sys_MillisecondsRaw() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
ret i32 %10
}
int a_treMax(int x, int y) { return x < y ? y : x; }


x86 assembly (clang, -O0):
<a_treMax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <a_treMax+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <a_treMax+0x27>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_treMax>:
mov    %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @a_treMax(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
void SetFPSHandler(void) {}


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

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

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

LLVM IR (-O2):
define void @SetFPSHandler() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rename(char const *, char const *);
void ActualFileRename(const char *origname, const char *newname) {
  rename(origname, newname);
  return;
}


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

x86 assembly (clang, -O2):
<ActualFileRename>:
jmp    1030 <rename@plt>

LLVM IR (-O0):
define void @ActualFileRename(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @rename(i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
define void @ActualFileRename(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @rename(i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int PROT_EXEC;
int PROT_READ;
int mprotect(void *, size_t, int);
int /*<<< orphan*/ perror(char *);
int make_memory_executable(void *m, size_t size) {
  if (mprotect(m, size, PROT_READ | PROT_EXEC) == -1) {
    perror("mprotect");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<make_memory_executable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x2eb9(%rip),%rax
mov    (%rax),%edx
mov    0x2e98(%rip),%rax
or     (%rax),%edx
call   1030 <mprotect@plt>
cmp    $0xffffffff,%eax
jne    1170 <make_memory_executable+0x50>
lea    0xea1(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <make_memory_executable+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_memory_executable>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    0x2eb1(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
call   1030 <mprotect@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     1143 <make_memory_executable+0x23>
pop    %rcx
ret
lea    0xeb6(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@PROT_READ = global i32 0
@PROT_EXEC = global i32 0
@.str = [9 x i8] c"mprotect\00"
define i32 @make_memory_executable(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%6 = load i8*, i8** %4
%7 = load i64, i64* %5
%8 = load i32, i32* @PROT_READ
%9 = load i32, i32* @PROT_EXEC
%10 = or i32 %8, %9
%11 = call i32 @mprotect(i8* %6, i64 %7, i32 %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %16
15: ; preds = %2
store i32 0, i32* %3
br label %16
16: ; preds = %15, %13
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@PROT_READ = global i32 0
@PROT_EXEC = global i32 0
@.str = [9 x i8] c"mprotect\00"
define i32 @make_memory_executable(i8* %0, i64 %1) {
%3 = load i32, i32* @PROT_READ
%4 = load i32, i32* @PROT_EXEC
%5 = or i32 %4, %3
%6 = tail call i32 @mprotect(i8* %0, i64 %1, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %2, %8
%11 = phi i32 [ -1, %8 ], [ 0, %2 ]
ret i32 %11
}
unsigned long to_minutes(unsigned long milliseconds) {
  return milliseconds / 1000 / 60;
}


x86 assembly (clang, -O0):
<to_minutes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    $0x3c,%ecx
xor    %edx,%edx
div    %rcx
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_minutes>:
mov    %rdi,%rax
shr    $0x5,%rax
movabs $0x45e7b272f608771,%rcx
7b 5e 04
mul    %rcx
mov    %rdx,%rax
shr    $0x5,%rax
ret

LLVM IR (-O0):
define i64 @to_minutes(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = udiv i64 %3, 1000
%5 = udiv i64 %4, 60
ret i64 %5
}

LLVM IR (-O2):
define i64 @to_minutes(i64 %0) {
%2 = udiv i64 %0, 60000
ret i64 %2
}
int main() {
  int foo = 0;
  if (!foo) {
    foo = foo / foo;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1126 <main+0x26>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = sdiv i32 %6, %7
store i32 %8, i32* %2
br label %9
9: ; preds = %5, %0
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int main(int n) { scanf("%d", &n), printf("%d\n", f(n)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <f@plt>
mov    %eax,%esi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0xec4(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
xor    %eax,%eax
call   1030 <f@plt>
lea    0xea9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = call i32 (i32, ...) bitcast (i32 (...)* @f to i32 (i32, ...)*)(i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
int fun2(char *a, char *b) {
  while (*a == *b) {
    a++;
    b++;
  }
  if (*b)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<fun2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    113f <fun2+0x3f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <fun2+0xc>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1158 <fun2+0x58>
movl   $0x0,-0x4(%rbp)
jmp    115f <fun2+0x5f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun2>:
mov    (%rsi),%cl
cmp    %cl,(%rdi)
jne    1120 <fun2+0x20>
mov    $0x1,%eax
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rax,1),%ecx
lea    0x1(%rax),%rdx
cmp    %cl,(%rdi,%rax,1)
mov    %rdx,%rax
je     1110 <fun2+0x10>
xor    %eax,%eax
test   %cl,%cl
sete   %al
ret

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

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


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

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

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

LLVM IR (-O2):
define void @X509_issuer_and_serial_hash() {
ret void
}
int fun691() { return 691; }


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

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

LLVM IR (-O0):
define i32 @fun691() {
ret i32 691
}

LLVM IR (-O2):
define i32 @fun691() {
ret i32 691
}
_Bool __atomic_compare_exchange_2(volatile void *atom, void *ref,
                                  unsigned short xchg, _Bool weak,
                                  int success_memorder, int failure_memorder) {
  unsigned short rv;
  unsigned short cmp = *(unsigned short *)ref;
  asm volatile("lock cmpxchg"
               "w"
               " %2,%1\n"
               : "=a"(rv), "+m"(*(unsigned short *)atom)
               : "q"(xchg), "0"(cmp)
               : "memory");
  *(unsigned short *)ref = rv;
  return (rv == cmp);
}


x86 assembly (clang, -O0):
<__atomic_compare_exchange_2>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %dx,%cx
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %cx,-0x12(%rbp)
and    $0x1,%al
mov    %al,-0x13(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ax
mov    %ax,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x12(%rbp),%dx
mov    -0x20(%rbp),%ax
lock cmpxchg %dx,(%rcx)
mov    %ax,-0x1e(%rbp)
mov    -0x1e(%rbp),%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
movzwl -0x1e(%rbp),%eax
movzwl -0x20(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__atomic_compare_exchange_2>:
movzwl (%rsi),%ecx
mov    %ecx,%eax
lock cmpxchg %dx,(%rdi)
mov    %ax,(%rsi)
cmp    %cx,%ax
sete   %al
ret

LLVM IR (-O0):
define zeroext i1 @__atomic_compare_exchange_2(i8* %0, i8* %1, i16 zeroext %2, i1 zeroext %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i16
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca i16
%14 = alloca i16
store i8* %0, i8** %7
store i8* %1, i8** %8
store i16 %2, i16* %9
%15 = zext i1 %3 to i8
store i8 %15, i8* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%16 = load i8*, i8** %8
%17 = bitcast i8* %16 to i16*
%18 = load i16, i16* %17
store i16 %18, i16* %14
%19 = load i8*, i8** %7
%20 = bitcast i8* %19 to i16*
%21 = load i16, i16* %9
%22 = load i16, i16* %14
%23 = call i16 asm sideeffect "lock cmpxchgw $2,$1\0A", "={ax},=*m,q,0,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i16* elementtype(i16) %20, i16 %21, i16 %22, i16* elementtype(i16) %20)
store i16 %23, i16* %13
%24 = load i16, i16* %13
%25 = load i8*, i8** %8
%26 = bitcast i8* %25 to i16*
store i16 %24, i16* %26
%27 = load i16, i16* %13
%28 = zext i16 %27 to i32
%29 = load i16, i16* %14
%30 = zext i16 %29 to i32
%31 = icmp eq i32 %28, %30
ret i1 %31
}

LLVM IR (-O2):
define zeroext i1 @__atomic_compare_exchange_2(i8* %0, i8* nocapture %1, i16 zeroext %2, i1 zeroext %3, i32 %4, i32 %5) {
%7 = bitcast i8* %1 to i16*
%8 = load i16, i16* %7
%9 = bitcast i8* %0 to i16*
%10 = tail call i16 asm sideeffect "lock cmpxchgw $2,$1\0A", "={ax},=*m,q,0,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i16* elementtype(i16) %9, i16 %2, i16 %8, i16* elementtype(i16) %9)
store i16 %10, i16* %7
%11 = icmp eq i16 %10, %8
ret i1 %11
}