xunge/DecIR huggingface dataset:
/* Variables and functions */
double log(int);
int /*<<< orphan*/ track_stats(void *);
double ln_poly(double x, void *params) {
  track_stats(params);
  return log(1 + 3 * x + x * x) / x;
}


x86 assembly (clang, -O0):
<ln_poly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <track_stats@plt>
movsd  -0x8(%rbp),%xmm1
movsd  0xeb9(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xeb5(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log@plt>
divsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_poly>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <track_stats@plt>
movsd  0xecd(%rip),%xmm0
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm0
addsd  0xec4(%rip),%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1040 <log@plt>
divsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ln_poly(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
store double %0, double* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @track_stats(i8* %5)
%7 = load double, double* %3
%8 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %7, double 1.000000e+00)
%9 = load double, double* %3
%10 = load double, double* %3
%11 = call double @llvm.fmuladd.f64(double %9, double %10, double %8)
%12 = fptosi double %11 to i32
%13 = call double @log(i32 %12)
%14 = load double, double* %3
%15 = fdiv double %13, %14
ret double %15
}

LLVM IR (-O2):
define double @ln_poly(double %0, i8* %1) {
%3 = tail call i32 @track_stats(i8* %1)
%4 = tail call double @llvm.fmuladd.f64(double %0, double 3.000000e+00, double 1.000000e+00)
%5 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %4)
%6 = fptosi double %5 to i32
%7 = tail call double @log(i32 %6)
%8 = fdiv double %7, %0
ret double %8
}
const char *minimum_signed_size_type(int lwr, int upr) {
  if (lwr >= -127 && upr <= 127) {
    return "signed char";
  } else if (lwr >= -32767 && upr < 32767) {
    return "short";
  } else {
    return "int";
  }
}


x86 assembly (clang, -O0):
<minimum_signed_size_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
cmpl   $0xffffff81,-0xc(%rbp)
jl     112e <minimum_signed_size_type+0x2e>
cmpl   $0x7f,-0x10(%rbp)
jg     112e <minimum_signed_size_type+0x2e>
lea    0xedb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1163 <minimum_signed_size_type+0x63>
cmpl   $0xffff8001,-0xc(%rbp)
jl     1158 <minimum_signed_size_type+0x58>
cmpl   $0x7fff,-0x10(%rbp)
jge    1158 <minimum_signed_size_type+0x58>
lea    0xebd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1163 <minimum_signed_size_type+0x63>
lea    0xeb3(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<minimum_signed_size_type>:
cmp    $0x7fff,%esi
lea    0xeff(%rip),%rcx
lea    0xefe(%rip),%rax
cmovge %rax,%rcx
cmp    $0xffff8001,%edi
cmovl  %rax,%rcx
cmp    $0x80,%esi
lea    0xed1(%rip),%rax
cmovge %rcx,%rax
cmp    $0xffffff81,%edi
cmovl  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"signed char\00"
@.str.1 = [6 x i8] c"short\00"
@.str.2 = [4 x i8] c"int\00"
define i8* @minimum_signed_size_type(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp sge i32 %6, -127
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp sle i32 %9, 127
br i1 %10, label %11, label %12
11: ; preds = %8
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %3
br label %20
12: ; preds = %8, %2
%13 = load i32, i32* %4
%14 = icmp sge i32 %13, -32767
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 32767
br i1 %17, label %18, label %19
18: ; preds = %15
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %20
19: ; preds = %15, %12
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %20
20: ; preds = %19, %18, %11
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
@.str = [12 x i8] c"signed char\00"
@.str.1 = [6 x i8] c"short\00"
@.str.2 = [4 x i8] c"int\00"
define i8* @minimum_signed_size_type(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, -128
%4 = icmp slt i32 %1, 128
%5 = and i1 %3, %4
%6 = icmp sgt i32 %0, -32768
%7 = icmp slt i32 %1, 32767
%8 = and i1 %6, %7
%9 = select i1 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%10 = select i1 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %9
ret i8* %10
}
/* Variables and functions */
int SocketPair(int, int, int, int *);
int socketpair(int d, int type, int protocol, int sv[2]) {
  return SocketPair(d, type, protocol, sv);
}


x86 assembly (clang, -O0):
<socketpair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <SocketPair@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socketpair>:
jmp    1030 <SocketPair@plt>

LLVM IR (-O0):
define i32 @socketpair(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* %6
%11 = load i32, i32* %7
%12 = load i32*, i32** %8
%13 = call i32 @SocketPair(i32 %9, i32 %10, i32 %11, i32* %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @socketpair(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = tail call i32 @SocketPair(i32 %0, i32 %1, i32 %2, i32* %3)
ret i32 %5
}
/* Variables and functions */
bool retro_serialize(void *data, size_t size) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @retro_serialize(i8* nocapture readnone %0, i64 %1) {
ret i32 0
}
unsigned int get_drop_threshold_definition() { return 0x7FFFF; }


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

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

LLVM IR (-O0):
define i32 @get_drop_threshold_definition() {
ret i32 524287
}

LLVM IR (-O2):
define i32 @get_drop_threshold_definition() {
ret i32 524287
}
/* Variables and functions */
int EXIT_SUCCESS;
scalar_t__ arithmetic_shifts();
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(void) {
  if (arithmetic_shifts())
    fputs("Machine with arithmetic shifts", stdout);
  else
    fputs("Machine with logical shifts", stdout);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <arithmetic_shifts@plt>
cmp    $0x0,%rax
je     115a <main+0x3a>
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xeb0(%rip),%rdi
call   1040 <fputs@plt>
jmp    116f <main+0x4f>
mov    0x2e7f(%rip),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <arithmetic_shifts@plt>
test   %rax,%rax
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
lea    0xee4(%rip),%rax
lea    0xebe(%rip),%rdi
cmove  %rax,%rdi
call   1040 <fputs@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Machine with arithmetic shifts\00"
@stdout = global i32 0
@.str.1 = [28 x i8] c"Machine with logical shifts\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @arithmetic_shifts()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* @stdout
%6 = call i32 @fputs(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %10
7: ; preds = %0
%8 = load i32, i32* @stdout
%9 = call i32 @fputs(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %7, %4
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}

LLVM IR (-O2):
@.str = [31 x i8] c"Machine with arithmetic shifts\00"
@stdout = global i32 0
@.str.1 = [28 x i8] c"Machine with logical shifts\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i64 (...) @arithmetic_shifts()
%2 = icmp eq i64 %1, 0
%3 = load i32, i32* @stdout
%4 = select i1 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @fputs(i8* %4, i32 %3)
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int FUTEX_CMP_REQUEUE;
int FUTEX_PRIVATE_FLAG;
int futex(int *, int, int, struct timespec *, int *, int);
int futex_cmp_requeue(int *uaddr, int val, int to_wake, int *uaddr2,
                      unsigned int max_requeue) {
  return futex(uaddr, FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG, to_wake,
               (struct timespec *)(unsigned long)max_requeue, uaddr2, val);
}


x86 assembly (clang, -O0):
<futex_cmp_requeue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
mov    0x2e9a(%rip),%rax
or     (%rax),%esi
mov    -0x10(%rbp),%edx
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%r8
mov    -0xc(%rbp),%r9d
call   1030 <futex@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<futex_cmp_requeue>:
mov    %rcx,%rax
mov    %esi,%r9d
mov    0x2ec3(%rip),%rcx
mov    0x2eb4(%rip),%rsi
mov    (%rsi),%esi
or     (%rcx),%esi
mov    %r8d,%ecx
mov    %rax,%r8
jmp    1030 <futex@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@FUTEX_CMP_REQUEUE = global i32 0
@FUTEX_PRIVATE_FLAG = global i32 0
define i32 @futex_cmp_requeue(i32* %0, i32 %1, i32 %2, i32* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = load i32, i32* @FUTEX_CMP_REQUEUE
%13 = load i32, i32* @FUTEX_PRIVATE_FLAG
%14 = or i32 %12, %13
%15 = load i32, i32* %8
%16 = load i32, i32* %10
%17 = zext i32 %16 to i64
%18 = inttoptr i64 %17 to %struct.timespec*
%19 = load i32*, i32** %9
%20 = load i32, i32* %7
%21 = call i32 @futex(i32* %11, i32 %14, i32 %15, %struct.timespec* %18, i32* %19, i32 %20)
ret i32 %21
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@FUTEX_CMP_REQUEUE = global i32 0
@FUTEX_PRIVATE_FLAG = global i32 0
define i32 @futex_cmp_requeue(i32* %0, i32 %1, i32 %2, i32* %3, i32 %4) {
%6 = load i32, i32* @FUTEX_CMP_REQUEUE
%7 = load i32, i32* @FUTEX_PRIVATE_FLAG
%8 = or i32 %7, %6
%9 = zext i32 %4 to i64
%10 = inttoptr i64 %9 to %struct.timespec*
%11 = tail call i32 @futex(i32* %0, i32 %8, i32 %2, %struct.timespec* %10, i32* %3, i32 %1)
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef void const *b;
typedef void *a;

/* Variables and functions */
int /*<<< orphan*/ cpy4(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int cpy8(void *, void const *);
void cpy12(void *a, const void *b) {
  cpy8(a, b), cpy4((uint8_t *)a + 8, (uint8_t *)b + 8);
}


x86 assembly (clang, -O0):
<cpy12>:
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 <cpy8@plt>
mov    -0x8(%rbp),%rdi
add    $0x20,%rdi
mov    -0x10(%rbp),%rsi
add    $0x20,%rsi
call   1040 <cpy4@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpy12>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <cpy8@plt>
add    $0x20,%rbx
add    $0x20,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <cpy4@plt>

LLVM IR (-O0):
define void @cpy12(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 @cpy8(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
%10 = getelementptr inbounds i32, i32* %9, i64 8
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i32*
%13 = getelementptr inbounds i32, i32* %12, i64 8
%14 = call i32 @cpy4(i32* %10, i32* %13)
ret void
}

LLVM IR (-O2):
define void @cpy12(i8* %0, i8* %1) {
%3 = tail call i32 @cpy8(i8* %0, i8* %1)
%4 = getelementptr inbounds i8, i8* %0, i64 32
%5 = bitcast i8* %4 to i32*
%6 = getelementptr inbounds i8, i8* %1, i64 32
%7 = bitcast i8* %6 to i32*
%8 = tail call i32 @cpy4(i32* %5, i32* %7)
ret void
}
void INT_Excep_SCI11_TXI11(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_SCI11_TXI11() {
ret void
}
void __cxa_pure_virtual(void) {
  while (1) {
  }
}


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

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

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

LLVM IR (-O2):
define void @__cxa_pure_virtual() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int strtol(char *, char **, int);
extern int str_hexdecode(char *str, int *error) {
  char *end = NULL;
  int res = strtol(str, &end, 16);
  *error = (*str == '\0' || *end != '\0');
  return res;
}


x86 assembly (clang, -O0):
<str_hexdecode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x1d(%rbp)
je     1162 <str_hexdecode+0x52>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_hexdecode>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,(%rsp)
mov    %rsp,%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
cmpb   $0x0,(%rbx)
je     1142 <str_hexdecode+0x32>
mov    (%rsp),%rdx
xor    %ecx,%ecx
cmpb   $0x0,(%rdx)
setne  %cl
jmp    1147 <str_hexdecode+0x37>
mov    $0x1,%ecx
mov    %ecx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @str_hexdecode(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
store i8* null, i8** %5
%7 = load i8*, i8** %3
%8 = call i32 @strtol(i8* %7, i8** %5, i32 16)
store i32 %8, i32* %6
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %2
%14 = load i8*, i8** %5
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br label %18
18: ; preds = %13, %2
%19 = phi i1 [ true, %2 ], [ %17, %13 ]
%20 = zext i1 %19 to i32
%21 = load i32*, i32** %4
store i32 %20, i32* %21
%22 = load i32, i32* %6
ret i32 %22
}

LLVM IR (-O2):
define i32 @str_hexdecode(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @strtol(i8* %0, i8** %3, i32 16)
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %8, %2
%14 = phi i32 [ 1, %2 ], [ %12, %8 ]
store i32 %14, i32* %1
ret i32 %5
}
int main() {
  int *ptr;
  ptr = malloc(1024 * 1048576 * sizeof(char));
  int i;
  for (i = 0; i < 100; i++) {
    printf("%d: %d\n", i, *(ptr + i));
  }
  printf("\n%d\n", ptr);
  free(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x40000000,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    1188 <main+0x58>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x24>
mov    -0x10(%rbp),%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
@.str = [8 x i8] c"%d: %d\0A\00"
@.str.1 = [5 x i8] c"\0A%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i8* @malloc(i64 1073741824)
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %2
store i32 0, i32* %3
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 100
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32*, i32** %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %15)
br label %17
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %6
20: ; preds = %6
%21 = load i32*, i32** %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %21)
%23 = load i32*, i32** %2
%24 = bitcast i32* %23 to i8*
ret i32 0
}

LLVM IR (-O2):
double do_ishift(shift, variable)
double shift, variable;
{ return variable + shift; }


x86 assembly (clang, -O0):
<do_ishift>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_ishift>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @do_ishift(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @do_ishift(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ run_all_tests();
int main(int argc, const char *argv[]) {
  run_all_tests();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <run_all_tests@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 (...) @run_all_tests()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @run_all_tests()
ret i32 0
}
void XtGetSubresources() {}


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

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

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

LLVM IR (-O2):
define void @XtGetSubresources() {
ret void
}
/* Variables and functions */
int isdigit(char ch) { return ((ch >= '0') && (ch <= '9')); }


x86 assembly (clang, -O0):
<isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <isdigit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @isdigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isdigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) { printf("main\n"); }


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

LLVM IR (-O2):
@str = [5 x i8] c"main\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int g(int a) { return a; }


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

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

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

LLVM IR (-O2):
define i32 @g(i32 returned %0) {
ret i32 %0
}
main() {
  int x[5];
  x[1] = 2;
  if (f(x) != 2)
    abort();
  g(x);
  int y[1];
  int pipe(int[static 2]);
  pipe((void *)0);
  pipe(y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x2,-0x1c(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1040 <f@plt>
cmp    $0x2,%eax
je     1168 <main+0x28>
call   1030 <abort@plt>
lea    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1060 <g@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <pipe@plt>
lea    -0x24(%rbp),%rdi
call   1050 <pipe@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movl   $0x2,0x14(%rsp)
lea    0x10(%rsp),%rdi
xor    %eax,%eax
call   1040 <f@plt>
cmp    $0x2,%eax
jne    1181 <main+0x41>
lea    0x10(%rsp),%rdi
xor    %eax,%eax
call   1060 <g@plt>
xor    %edi,%edi
call   1050 <pipe@plt>
lea    0xc(%rsp),%rdi
call   1050 <pipe@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [1 x i32]
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
store i32 2, i32* %3
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 (i32*, ...) bitcast (i32 (...)* @f to i32 (i32*, ...)*)(i32* %4)
%6 = icmp ne i32 %5, 2
br i1 %6, label %7, label %8
7: ; preds = %0
unreachable
8: ; preds = %0
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%10 = call i32 (i32*, ...) bitcast (i32 (...)* @g to i32 (i32*, ...)*)(i32* %9)
%11 = call i32 @pipe(i32* null)
%12 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%13 = call i32 @pipe(i32* %12)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [1 x i32]
%3 = bitcast [5 x i32]* %1 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
store i32 2, i32* %4
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = call i32 (i32*, ...) bitcast (i32 (...)* @f to i32 (i32*, ...)*)(i32* %5)
%7 = icmp eq i32 %6, 2
br i1 %7, label %9, label %8
8: ; preds = %0
unreachable
9: ; preds = %0
%10 = call i32 (i32*, ...) bitcast (i32 (...)* @g to i32 (i32*, ...)*)(i32* %5)
%11 = bitcast [1 x i32]* %2 to i8*
%12 = call i32 @pipe(i32* null)
%13 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%14 = call i32 @pipe(i32* %13)
ret i32 0
}
long int f1(int n) {
  if (0 == n)
    return 0;
  else if (1 == n)
    return 1;
  else
    return f1(n - 1) + f1(n - 2);
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
jne    1133 <f1+0x23>
movq   $0x0,-0x8(%rbp)
jmp    1176 <f1+0x66>
mov    $0x1,%eax
cmp    -0xc(%rbp),%eax
jne    114e <f1+0x3e>
movq   $0x1,-0x8(%rbp)
jmp    1176 <f1+0x66>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <f1@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x2,%edi
call   1030 <f1@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %r14d,%r14d
test   %ebx,%ebx
je     1137 <f1+0x27>
nopl   (%rax)
cmp    $0x1,%ebx
je     113b <f1+0x2b>
lea    -0x1(%rbx),%edi
call   1030 <f1@plt>
add    %rax,%r14
add    $0xfffffffe,%ebx
test   %ebx,%ebx
jne    1120 <f1+0x10>
xor    %eax,%eax
jmp    1140 <f1+0x30>
mov    $0x1,%eax
add    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @f1(i32 %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i64 [ 0, %1 ], [ %9, %5 ]
%4 = phi i32 [ %0, %1 ], [ %8, %5 ]
switch i32 %4, label %5 [
i32 0, label %10
i32 1, label %11
]
5: ; preds = %2
%6 = add nsw i32 %4, -1
%7 = tail call i64 @f1(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i64 %7, %3
br label %2
10: ; preds = %2
br label %11
11: ; preds = %2, %10
%12 = phi i64 [ 0, %10 ], [ 1, %2 ]
%13 = add nsw i64 %12, %3
ret i64 %13
}
float get22() { return 22.; }


x86 assembly (clang, -O0):
<get22>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get22>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @get22() {
ret float 2.200000e+01
}

LLVM IR (-O2):
define float @get22() {
ret float 2.200000e+01
}
void foo083(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo083(i32 %0) {
ret void
}
/* Type definitions */
typedef int __u8;
typedef int __u16;

/* Variables and functions */
__u8 pn_addr(__u16 handle) { return (handle >> 8) & 0xfc; }


x86 assembly (clang, -O0):
<pn_addr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xfc,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_addr>:
mov    %edi,%eax
shr    $0x8,%eax
and    $0xfc,%eax
ret

LLVM IR (-O0):
define i32 @pn_addr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 8
%5 = and i32 %4, 252
ret i32 %5
}

LLVM IR (-O2):
define i32 @pn_addr(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 252
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, char *, int);
void rd(void *buff, int size, int count, char **ptr) {
  memcpy(buff, *ptr, size * count);
  *ptr += (size * count);
}


x86 assembly (clang, -O0):
<rd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0xc(%rbp),%edx
imul   -0x10(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%edx
imul   -0x10(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rd>:
push   %rbp
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %edx,%ebp
mov    (%rcx),%rax
imul   %esi,%ebp
mov    %rax,%rsi
mov    %ebp,%edx
call   1030 <memcpy@plt>
movslq %ebp,%rax
add    %rax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @rd(i8* %0, i32 %1, i32 %2, i8** nocapture %3) {
%5 = load i8*, i8** %3
%6 = mul nsw i32 %2, %1
%7 = tail call i32 @memcpy(i8* %0, i8* %5, i32 %6)
%8 = load i8*, i8** %3
%9 = sext i32 %6 to i64
%10 = getelementptr inbounds i8, i8* %8, i64 %9
store i8* %10, i8** %3
ret void
}
int isspace(int c) { return (c == ' ' || c == '\r' || c == '\n'); }


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112f <isspace+0x2f>
mov    $0x1,%al
cmpl   $0xd,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112f <isspace+0x2f>
cmpl   $0xa,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
mov    $0x1,%eax
cmp    $0xd,%edi
je     110f <isspace+0xf>
cmp    $0x20,%edi
jne    1110 <isspace+0x10>
ret
xor    %eax,%eax
cmp    $0xa,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
switch i32 %0, label %2 [
i32 32, label %5
i32 13, label %5
]
2: ; preds = %1
%3 = icmp eq i32 %0, 10
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
/* Type definitions */
typedef int const uint32_t;

/* Variables and functions */
const uint32_t ch(uint32_t x, uint32_t y, uint32_t z) {
  return ((x & y) ^ ((~x) & z));
}


x86 assembly (clang, -O0):
<ch>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
xor    $0xffffffff,%ecx
and    -0xc(%rbp),%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ch>:
mov    %esi,%eax
xor    %edx,%eax
and    %edi,%eax
xor    %edx,%eax
ret

LLVM IR (-O0):
define i32 @ch(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = and i32 %7, %8
%10 = load i32, i32* %4
%11 = xor i32 %10, -1
%12 = load i32, i32* %6
%13 = and i32 %11, %12
%14 = xor i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @ch(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %1, %0
%5 = xor i32 %0, -1
%6 = and i32 %5, %2
%7 = or i32 %6, %4
ret i32 %7
}
long arch_calledby(long xt) { return xt + 3 + 5 + ((long *)xt)[1]; }


x86 assembly (clang, -O0):
<arch_calledby>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x3,%rax
add    $0x5,%rax
mov    -0x8(%rbp),%rcx
add    0x8(%rcx),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<arch_calledby>:
lea    0x8(%rdi),%rax
add    0x8(%rdi),%rax
ret

LLVM IR (-O0):
define i64 @arch_calledby(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 3
%5 = add nsw i64 %4, 5
%6 = load i64, i64* %2
%7 = inttoptr i64 %6 to i64*
%8 = getelementptr inbounds i64, i64* %7, i64 1
%9 = load i64, i64* %8
%10 = add nsw i64 %5, %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @arch_calledby(i64 %0) {
%2 = add nsw i64 %0, 8
%3 = inttoptr i64 %0 to i64*
%4 = getelementptr inbounds i64, i64* %3, i64 1
%5 = load i64, i64* %4
%6 = add nsw i64 %2, %5
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *allocate(size_t size) {
  void *p = malloc(size);
  if (!p) {
    fputs("memory allocation failed\n", stderr);
    exit(EXIT_FAILURE);
  }
  return p;
}


x86 assembly (clang, -O0):
<allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1177 <allocate+0x47>
mov    0x2e85(%rip),%rax
mov    (%rax),%esi
lea    0xe9c(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocate>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <allocate+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
lea    0xeb3(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"memory allocation failed\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define i8* @allocate(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fputs(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [26 x i8] c"memory allocation failed\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define noalias i8* @allocate(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int R_OK;
int W_OK;
int access(char *, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int acc = access("/someFile", W_OK);
  printf("%d\n%d\n%d\n", acc, R_OK, W_OK);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
call   1040 <access@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    0x2e8e(%rip),%rax
mov    (%rax),%edx
mov    0x2e95(%rip),%rax
mov    (%rax),%ecx
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec0(%rip),%rbx
mov    (%rbx),%esi
lea    0xecf(%rip),%rdi
call   1040 <access@plt>
mov    0x2e9b(%rip),%rcx
mov    (%rcx),%edx
mov    (%rbx),%ecx
lea    0xec2(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"/someFile\00"
@W_OK = global i32 0
@.str.1 = [10 x i8] c"%d\0A%d\0A%d\0A\00"
@R_OK = global i32 0
define i32 @main() {
%1 = load i32, i32* @W_OK
%2 = tail call i32 @access(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @R_OK
%4 = load i32, i32* @W_OK
%5 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3, i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void DispUsage() {
  printf(
      "\n"
      " Usage       :   PassBreaker [arguments]\n"
      "\n"
      " Arguments   :   <shadow file>\n"
      "                 <shadow file> <dictionary file>\n"
      "\n"
      " Description :\n"
      "	When invoked with only one argument (shadow file)\n"
      "	it tries to brute-force the shadow file passwords\n"
      "\n"
      "	When invoked with two arguments (shadow file + dictionary file)\n"
      "	uses the dictionary to crack the shadow file passwords\n"
      "\n"
      " Examples    :\n"
      "  (Brute force method) $ nice -n 15 ./PassBreaker shadow\n"
      "  (Dictionary method)  $ nice -n 5  ./PassBreaker shadow D8.dic\n"
      "\n"
      " Output      : \"Results\" file contains cracked passwords\n"
      "\n\n");
}


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

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

LLVM IR (-O0):
@.str = [561 x i8] c"\0A Usage : PassBreaker [arguments]\0A\0A Arguments : <shadow file>\0A <shadow file> <dictionary file>\0A\0A Description :\0A\09When invoked with only one argument (shadow file)\0A\09it tries to brute-force the shadow file passwords\0A\0A\09When invoked with two arguments (shadow file + dictionary file)\0A\09uses the dictionary to crack the shadow file passwords\0A\0A Examples :\0A (Brute force method) $ nice -n 15 ./PassBreaker shadow\0A (Dictionary method) $ nice -n 5 ./PassBreaker shadow D8.dic\0A\0A Output : \22Results\22 file contains cracked passwords\0A\0A\0A\00"
define void @DispUsage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([561 x i8], [561 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [560 x i8] c"\0A Usage : PassBreaker [arguments]\0A\0A Arguments : <shadow file>\0A <shadow file> <dictionary file>\0A\0A Description :\0A\09When invoked with only one argument (shadow file)\0A\09it tries to brute-force the shadow file passwords\0A\0A\09When invoked with two arguments (shadow file + dictionary file)\0A\09uses the dictionary to crack the shadow file passwords\0A\0A Examples :\0A (Brute force method) $ nice -n 15 ./PassBreaker shadow\0A (Dictionary method) $ nice -n 5 ./PassBreaker shadow D8.dic\0A\0A Output : \22Results\22 file contains cracked passwords\0A\0A\00"
define void @DispUsage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([560 x i8], [560 x i8]* @str, i64 0, i64 0))
ret void
}
void ARGBAddRow_Any_AVX2() {}


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

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

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

LLVM IR (-O2):
define void @ARGBAddRow_Any_AVX2() {
ret void
}
int system_print_display_resolution_by_X11() { return 0; }


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

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

LLVM IR (-O0):
define i32 @system_print_display_resolution_by_X11() {
ret i32 0
}

LLVM IR (-O2):
define i32 @system_print_display_resolution_by_X11() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DisableKeyRepeat();
int /*<<< orphan*/ ReconnectKeyCodes3();
void LeaveBackground(void) {
  ReconnectKeyCodes3();
  DisableKeyRepeat();
}


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

x86 assembly (clang, -O2):
<LeaveBackground>:
push   %rax
xor    %eax,%eax
call   1030 <ReconnectKeyCodes3@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <DisableKeyRepeat@plt>

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

LLVM IR (-O2):
define void @LeaveBackground() {
%1 = tail call i32 (...) @ReconnectKeyCodes3()
%2 = tail call i32 (...) @DisableKeyRepeat()
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t min(uint32_t x, uint32_t y) { return x < y ? x : y; }


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <min+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <min+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @min(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, void const *, int);
int /*<<< orphan*/ ntoh64(int /*<<< orphan*/);
int64_t readInt64(const void *p) {
  int64_t v;
  memcpy(&v, p, 8);
  return ntoh64(v);
}


x86 assembly (clang, -O0):
<readInt64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    -0xc(%rbp),%edi
call   1030 <ntoh64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readInt64>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    0x4(%rsp),%edi
call   1030 <ntoh64@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @readInt64(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i32* %2, i8* %0, i32 8)
%5 = load i32, i32* %2
%6 = call i32 @ntoh64(i32 %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void menu_clear(void) { system("clear"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @menu_clear() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
void smc_callback_func(void) {}


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

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

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

LLVM IR (-O2):
define void @smc_callback_func() {
ret void
}
void Cube_tearDownGL() {}


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

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

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

LLVM IR (-O2):
define void @Cube_tearDownGL() {
ret void
}
float df(float x) { return (1.0 + (1.0 / x)); }


x86 assembly (clang, -O0):
<df>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xeda(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<df>:
cvtss2sd %xmm0,%xmm0
movsd  0xef4(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @df(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fdiv double 1.000000e+00, %4
%6 = fadd double 1.000000e+00, %5
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @df(float %0) {
%2 = fpext float %0 to double
%3 = fdiv double 1.000000e+00, %2
%4 = fadd double %3, 1.000000e+00
%5 = fptrunc double %4 to float
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ I2C1_Init();
void EEPROM_24C02_Init() { I2C1_Init(); }


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

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

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

LLVM IR (-O2):
define void @EEPROM_24C02_Init() {
%1 = tail call i32 (...) @I2C1_Init()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() {
  printf("hello unanao\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%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 = [14 x i8] c"hello unanao\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"hello unanao\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}