xunge/DecIR huggingface dataset:
float fx(x)
float x;
{ return 1.0 + 3.0 / (2.302585093 * x); }


x86 assembly (clang, -O0):
<fx>:
push   %rbp
mov    %rsp,%rbp
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xef2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xede(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fx>:
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xef0(%rip),%xmm0
movsd  0xef0(%rip),%xmm1
divsd  %xmm0,%xmm1
addsd  0xeec(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @fx(double %0) {
%2 = fptrunc double %0 to float
%3 = fpext float %2 to double
%4 = fmul double %3, 0x40026BB1BBB58975
%5 = fdiv double 3.000000e+00, %4
%6 = fadd double %5, 1.000000e+00
%7 = fptrunc double %6 to float
ret float %7
}
/* Variables and functions */
unsigned long binomial_d(int, int);
double log2(unsigned long);
double dicho_si_leaf(int m, int t, int l) {
  unsigned long u;
  u = binomial_d(1 << m, t);
  u &= (((unsigned)-1) << l);
  return log2(u);
}


x86 assembly (clang, -O0):
<dicho_si_leaf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
mov    -0x8(%rbp),%esi
call   1040 <binomial_d@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
mov    %eax,%eax
and    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <log2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dicho_si_leaf>:
push   %rbx
mov    %edx,%ebx
mov    %edi,%ecx
mov    $0x1,%edi
shl    %cl,%edi
call   1040 <binomial_d@plt>
mov    %ebx,%ecx
shr    %cl,%eax
shl    %cl,%eax
mov    %rax,%rdi
pop    %rbx
jmp    1030 <log2@plt>

LLVM IR (-O0):
define double @dicho_si_leaf(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = shl i32 1, %8
%10 = load i32, i32* %5
%11 = call i64 @binomial_d(i32 %9, i32 %10)
store i64 %11, i64* %7
%12 = load i32, i32* %6
%13 = shl i32 -1, %12
%14 = zext i32 %13 to i64
%15 = load i64, i64* %7
%16 = and i64 %15, %14
store i64 %16, i64* %7
%17 = load i64, i64* %7
%18 = call double @log2(i64 %17)
ret double %18
}

LLVM IR (-O2):
define double @dicho_si_leaf(i32 %0, i32 %1, i32 %2) {
%4 = shl nuw i32 1, %0
%5 = tail call i64 @binomial_d(i32 %4, i32 %1)
%6 = shl nsw i32 -1, %2
%7 = zext i32 %6 to i64
%8 = and i64 %5, %7
%9 = tail call double @log2(i64 %8)
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cleareos() { printf("\x1b[J'"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[J'\00"
define void @cleareos() {
%1 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[J'\00"
define void @cleareos() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
scalar_t__ clock();
clock_t InchiClock(void) {
  clock_t c = clock();
  if (c != (clock_t)-1) {
    return c;
  }
  return 0;
}


x86 assembly (clang, -O0):
<InchiClock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0xffffffffffffffff,-0x10(%rbp)
je     113b <InchiClock+0x2b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1143 <InchiClock+0x33>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InchiClock>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <clock@plt>
cmp    $0xffffffffffffffff,%rax
cmove  %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @InchiClock() {
%1 = tail call i64 (...) @clock()
%2 = icmp eq i64 %1, -1
%3 = select i1 %2, i64 0, i64 %1
ret i64 %3
}
/* Variables and functions */
int close(int);
int stop_tcp_client(int sock) { return close(sock); }


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

x86 assembly (clang, -O2):
<stop_tcp_client>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @stop_tcp_client(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ xip_fpo_flttoflt_flt_d(float *, double);
float xil_fpo_flttoflt_flt_d(double a) {
  float res_flt;
  xip_fpo_flttoflt_flt_d(&res_flt, a);
  return res_flt;
}


x86 assembly (clang, -O0):
<xil_fpo_flttoflt_flt_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0xc(%rbp),%rdi
call   1030 <xip_fpo_flttoflt_flt_d@plt>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xil_fpo_flttoflt_flt_d>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <xip_fpo_flttoflt_flt_d@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @xil_fpo_flttoflt_flt_d(double %0) {
%2 = alloca double
%3 = alloca float
store double %0, double* %2
%4 = load double, double* %2
%5 = call i32 @xip_fpo_flttoflt_flt_d(float* %3, double %4)
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
define float @xil_fpo_flttoflt_flt_d(double %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = call i32 @xip_fpo_flttoflt_flt_d(float* %2, double %0)
%5 = load float, float* %2
ret float %5
}
_spc(x) int x;
{
  while (x-- > 0)
    _out(" ");
}


x86 assembly (clang, -O0):
<_spc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    1142 <_spc+0x32>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <_out@plt>
jmp    111b <_spc+0xb>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_spc>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1142 <_spc+0x32>
mov    %edi,%ebx
add    $0x1,%ebx
lea    0xedc(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <_out@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1130 <_spc+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i32 @_spc(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @_out to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp ugt i32 %4, 1
br i1 %7, label %3, label %8
8: ; preds = %3, %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ is_prime(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  printf("\n Enter Number: ");
  scanf("%d", &num);
  if (num > 1)
    is_prime(num);
  else
    printf("\n -1 ");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1172 <main+0x42>
mov    -0x8(%rbp),%edi
call   1040 <is_prime@plt>
jmp    117e <main+0x4e>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
cmp    $0x2,%edi
jl     115e <main+0x2e>
call   1040 <is_prime@plt>
jmp    116a <main+0x3a>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0A Enter Number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"\0A -1 \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = call i32 @is_prime(i32 %8)
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0A Enter Number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"\0A -1 \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @is_prime(i32 %5)
br label %11
9: ; preds = %0
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
ret i32 0
}
int RTco_initSemaphore(__attribute__((unused)) int value) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @RTco_initSemaphore(i32 %0) {
ret i32 0
}
long dt_time_to_m(long t) { return (t / 60) % 60; }


x86 assembly (clang, -O0):
<dt_time_to_m>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dt_time_to_m>:
movabs $0x8888888888888889,%rsi
88 88 88
mov    %rdi,%rax
imul   %rsi
lea    (%rdx,%rdi,1),%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x5,%rcx
add    %rax,%rcx
mov    %rcx,%rax
imul   %rsi
add    %rcx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x5,%rdx
add    %rax,%rdx
imul   $0x3c,%rdx,%rax
sub    %rax,%rcx
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @dt_time_to_m(i64 %0) {
%2 = sdiv i64 %0, 60
%3 = srem i64 %2, 60
ret i64 %3
}
void XDisplayKeycodes() {}


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

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

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

LLVM IR (-O2):
define void @XDisplayKeycodes() {
ret void
}
signed int _sint(signed int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @_sint(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int digits(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  scanf("%d", &num);
  printf("%d\n", digits(num));
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1030 <digits@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
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() {
%1 = alloca i32
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
%4 = call i32 @digits(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
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() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @digits(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
void devmgr_unregister_mitigation_client(struct device *dev,
                                         struct device_clnt_data *clnt) {}


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

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

LLVM IR (-O0):
%struct.device = type opaque
%struct.device_clnt_data = type opaque
define void @devmgr_unregister_mitigation_client(%struct.device* %0, %struct.device_clnt_data* %1) {
%3 = alloca %struct.device*
%4 = alloca %struct.device_clnt_data*
store %struct.device* %0, %struct.device** %3
store %struct.device_clnt_data* %1, %struct.device_clnt_data** %4
ret void
}

LLVM IR (-O2):
%struct.device = type opaque
%struct.device_clnt_data = type opaque
define void @devmgr_unregister_mitigation_client(%struct.device* nocapture %0, %struct.device_clnt_data* nocapture %1) {
ret void
}
int old_dosemu_compatibility(void) {
  static unsigned long *given = (void *)0x000FFFF5;
  static unsigned long *expected = (unsigned long *)"02/25/93";
  return (given[0] == expected[0] && given[1] == expected[1]);
}


x86 assembly (clang, -O0):
<old_dosemu_compatibility>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f15(%rip),%rax
mov    (%rax),%rcx
mov    0x2f13(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
mov    %al,-0x1(%rbp)
jne    113f <old_dosemu_compatibility+0x3f>
mov    0x2ef6(%rip),%rax
mov    0x8(%rax),%rax
mov    0x2ef3(%rip),%rcx
cmp    0x8(%rcx),%rax
sete   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<old_dosemu_compatibility>:
xor    %eax,%eax
movabs $0x33392f35322f3230,%rcx
2f 39 33
cmp    %rcx,0xffff5
jne    1124 <old_dosemu_compatibility+0x24>
xor    %eax,%eax
cmpq   $0x0,0xffffd
sete   %al
ret

LLVM IR (-O0):
@old_dosemu_compatibility.given = internal global i64* inttoptr (i64 1048565 to i64*)
@old_dosemu_compatibility.expected = internal global i64* bitcast ([9 x i8]* @.str to i64*)
@.str = [9 x i8] c"02/25/93\00"
define i32 @old_dosemu_compatibility() {
%1 = load i64*, i64** @old_dosemu_compatibility.given
%2 = getelementptr inbounds i64, i64* %1, i64 0
%3 = load i64, i64* %2
%4 = load i64*, i64** @old_dosemu_compatibility.expected
%5 = getelementptr inbounds i64, i64* %4, i64 0
%6 = load i64, i64* %5
%7 = icmp eq i64 %3, %6
br i1 %7, label %8, label %16
8: ; preds = %0
%9 = load i64*, i64** @old_dosemu_compatibility.given
%10 = getelementptr inbounds i64, i64* %9, i64 1
%11 = load i64, i64* %10
%12 = load i64*, i64** @old_dosemu_compatibility.expected
%13 = getelementptr inbounds i64, i64* %12, i64 1
%14 = load i64, i64* %13
%15 = icmp eq i64 %11, %14
br label %16
16: ; preds = %8, %0
%17 = phi i1 [ false, %0 ], [ %15, %8 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @old_dosemu_compatibility() {
%1 = load i64, i64* inttoptr (i64 1048565 to i64*)
%2 = icmp eq i64 %1, 3691033275128558128
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = load i64, i64* inttoptr (i64 1048573 to i64*)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ 0, %0 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char const *, int /*<<< orphan*/);
int open_watchdog(const char *path) { return open(path, O_RDWR); }


x86 assembly (clang, -O0):
<open_watchdog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_watchdog>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <open@plt>

LLVM IR (-O0):
@O_RDWR = global i32 0
define i32 @open_watchdog(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @O_RDWR
%5 = call i32 @open(i8* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@O_RDWR = global i32 0
define i32 @open_watchdog(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
ret i32 %3
}
/* Type definitions */
struct Ability {
  int dummy;
};

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


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

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

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

LLVM IR (-O2):
%struct.Ability = type { i32 }
define void @Ability_Destroy(%struct.Ability* %0) {
%2 = icmp eq %struct.Ability* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.Ability* %0)
br label %5
5: ; preds = %1, %3
ret void
}
void rmv_(dx, dy, dz) float *dx, *dy, *dz;
{ rmv(*dx, *dy, *dz); }


x86 assembly (clang, -O0):
<rmv_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
cvtss2sd %xmm2,%xmm2
mov    $0x3,%al
call   1030 <rmv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rmv_>:
movss  (%rdi),%xmm0
cvtss2sd %xmm0,%xmm0
movss  (%rsi),%xmm1
cvtss2sd %xmm1,%xmm1
movss  (%rdx),%xmm2
cvtss2sd %xmm2,%xmm2
mov    $0x3,%al
jmp    1030 <rmv@plt>

LLVM IR (-O0):
define void @rmv_(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%7 = load float*, float** %4
%8 = load float, float* %7
%9 = fpext float %8 to double
%10 = load float*, float** %5
%11 = load float, float* %10
%12 = fpext float %11 to double
%13 = load float*, float** %6
%14 = load float, float* %13
%15 = fpext float %14 to double
%16 = call i32 (double, double, double, ...) bitcast (i32 (...)* @rmv to i32 (double, double, double, ...)*)(double %9, double %12, double %15)
ret void
}

LLVM IR (-O2):
define void @rmv_(float* nocapture %0, float* nocapture %1, float* nocapture %2) {
%4 = load float, float* %0
%5 = fpext float %4 to double
%6 = load float, float* %1
%7 = fpext float %6 to double
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @rmv to i32 (double, double, double, ...)*)(double %5, double %7, double %9)
ret void
}
/* Type definitions */
struct fb_cmap {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ FBIOGETCMAP;
scalar_t__ ioctl(int, int /*<<< orphan*/, struct fb_cmap *);
int /*<<< orphan*/ perror(char *);
int fb_cmap_get(int fbfp, struct fb_cmap *cmap) {
  if (ioctl(fbfp, FBIOGETCMAP, cmap)) {
    perror("ioctl FBIOGETCMAP error\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<fb_cmap_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eaf(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
je     1166 <fb_cmap_get+0x46>
lea    0xeab(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    116d <fb_cmap_get+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_cmap_get>:
push   %rax
mov    %rsi,%rdx
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    113e <fb_cmap_get+0x1e>
pop    %rcx
ret
lea    0xebb(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.fb_cmap = type { i32 }
@FBIOGETCMAP = global i32 0
@.str = [25 x i8] c"ioctl FBIOGETCMAP error\0A\00"
define i32 @fb_cmap_get(i32 %0, %struct.fb_cmap* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.fb_cmap*
store i32 %0, i32* %4
store %struct.fb_cmap* %1, %struct.fb_cmap** %5
%6 = load i32, i32* %4
%7 = load i32, i32* @FBIOGETCMAP
%8 = load %struct.fb_cmap*, %struct.fb_cmap** %5
%9 = call i64 @ioctl(i32 %6, i32 %7, %struct.fb_cmap* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %14
13: ; preds = %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %11
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
%struct.fb_cmap = type { i32 }
@FBIOGETCMAP = global i32 0
@.str = [25 x i8] c"ioctl FBIOGETCMAP error\0A\00"
define i32 @fb_cmap_get(i32 %0, %struct.fb_cmap* %1) {
%3 = load i32, i32* @FBIOGETCMAP
%4 = tail call i64 @ioctl(i32 %0, i32 %3, %struct.fb_cmap* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ -1, %6 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ emit_string(char *, void *);
int /*<<< orphan*/ sprintf(char *, char *, int);
void emit_int(int n, void *data) {
  char buf[128];
  sprintf(buf, "%d", n);
  emit_string(buf, data);
}


x86 assembly (clang, -O0):
<emit_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xebd(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <emit_string@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_int>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
mov    %edi,%edx
lea    0xeca(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <emit_string@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @emit_int(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [128 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = call i32 @emit_string(i8* %9, i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @emit_int(i32 %0, i8* %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = call i32 @emit_string(i8* %4, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int main() {
  char name[30];
  printf("\n Insert name: ");
  gets(name);
  puts(name);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x20(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0A Insert name: \00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%4 = call i32 @gets(i8* %3)
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%6 = call i32 @puts(i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0A Insert name: \00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @puts(i8* %2)
ret i32 0
}
int idx_lsb(unsigned int x) { return __builtin_ffs(x); }


x86 assembly (clang, -O0):
<idx_lsb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
bsf    %edx,%eax
add    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<idx_lsb>:
bsf    %edi,%ecx
mov    $0xffffffff,%eax
cmovne %ecx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @idx_lsb(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.cttz.i32(i32 %3, i1 true)
%5 = add i32 %4, 1
%6 = icmp eq i32 %3, 0
%7 = select i1 %6, i32 0, i32 %5
ret i32 %7
}

LLVM IR (-O2):
define i32 @idx_lsb(i32 %0) {
%2 = tail call i32 @llvm.cttz.i32(i32 %0, i1 true)
%3 = add nuw nsw i32 %2, 1
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i32 0, i32 %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void print_array(int rand_array[10000]) {
  int i = 0;
  for (i = 0; i < 10000; i++) {
    printf("rand_array [ %d ] = %d;\n", i, rand_array[i]);
  };
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2710,-0xc(%rbp)
jge    115f <print_array+0x4f>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <print_array+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xedf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x2710,%rbx
jne    1130 <print_array+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"rand_array [ %d ] = %d;\0A\00"
define void @print_array(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
store i32 0, i32* %3
br label %4
4: ; preds = %15, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10000
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %13)
br label %15
15: ; preds = %7
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %4
18: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"rand_array [ %d ] = %d;\0A\00"
define void @print_array(i32* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %8, %2 ]
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = trunc i64 %3 to i32
%7 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %5)
%8 = add nuw nsw i64 %3, 1
%9 = icmp eq i64 %8, 10000
br i1 %9, label %10, label %2
10: ; preds = %2
ret void
}
int DB_CheckFileNum_Native(int filenum, void *db) { return 1; }


x86 assembly (clang, -O0):
<DB_CheckFileNum_Native>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @DB_CheckFileNum_Native(i32 %0, i8* nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ Test_SOFMTest();
int /*<<< orphan*/ printf(char *);
int main(void) {
  Test_SOFMTest();
  printf("\nHello World!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"\0AHello World!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @Test_SOFMTest()
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"\0AHello World!\00"
define i32 @main() {
%1 = tail call i32 (...) @Test_SOFMTest()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ cpuinfo_by_procfs(int /*<<< orphan*/ *);
int /*<<< orphan*/ cpuinfo_by_sysctl();
int /*<<< orphan*/ *fopen(char *, char *);
void cpuinfo() {
  FILE *file = fopen("/proc/cpuinfo", "r");
  if (file) {
    cpuinfo_by_procfs(file);
  } else {
    cpuinfo_by_sysctl();
  }
}


x86 assembly (clang, -O0):
<cpuinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec8(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1168 <cpuinfo+0x38>
mov    -0x8(%rbp),%rdi
call   1040 <cpuinfo_by_procfs@plt>
jmp    116f <cpuinfo+0x3f>
mov    $0x0,%al
call   1030 <cpuinfo_by_sysctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuinfo>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xecf(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1152 <cpuinfo+0x22>
mov    %rax,%rdi
pop    %rax
jmp    1040 <cpuinfo_by_procfs@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <cpuinfo_by_sysctl@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"/proc/cpuinfo\00"
@.str.1 = [2 x i8] c"r\00"
define void @cpuinfo() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @cpuinfo_by_procfs(i32* %1)
br label %7
5: ; preds = %0
%6 = tail call i32 (...) @cpuinfo_by_sysctl()
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parson_free(char *);
void json_free_serialized_string(char *string) { parson_free(string); }


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

x86 assembly (clang, -O2):
<json_free_serialized_string>:
jmp    1030 <parson_free@plt>

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

LLVM IR (-O2):
define void @json_free_serialized_string(i8* %0) {
%2 = tail call i32 @parson_free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
unsigned short f();
main() {
  if (f() != (unsigned short)-1)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <f@plt>
movzwl %ax,%eax
cmp    $0xffff,%eax
je     115b <main+0x2b>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <f@plt>
cmp    $0xffff,%ax
jne    1145 <main+0x15>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call zeroext i16 (...) @f()
%3 = zext i16 %2 to i32
%4 = icmp ne i32 %3, 65535
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %0
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call zeroext i16 (...) @f()
%2 = icmp eq i16 %1, -1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
char *langDbgDevScsiGouda() { return "Gouda SCSI"; }


x86 assembly (clang, -O0):
<langDbgDevScsiGouda>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"Gouda SCSI\00"
define i8* @langDbgDevScsiGouda() {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [11 x i8] c"Gouda SCSI\00"
define i8* @langDbgDevScsiGouda() {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double get_seconds() {
  struct timeval tv;
  double s;
  assert(0 == gettimeofday(&tv, NULL));
  return (double)tv.tv_sec + 1.0e-6 * ((double)tv.tv_usec);
}


x86 assembly (clang, -O0):
<get_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xea2(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_seconds>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xeac(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @get_seconds() {
%1 = alloca %struct.timeval
%2 = alloca double
%3 = call i64 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i64 0, %3
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to double
%13 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %12, double %9)
ret double %13
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @get_seconds() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i64 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to double
%13 = tail call double @llvm.fmuladd.f64(double %12, double 0x3EB0C6F7A0B5ED8D, double %9)
ret double %13
}
/* Variables and functions */
int safestrlen(char *);
int Lastchar(char *s) {
  int c = 0;
  if (s && *s) {
    s += safestrlen(s) - 1;
    c = (int)(*(unsigned const char *)(s));
  }
  return (c);
}


x86 assembly (clang, -O0):
<Lastchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1164 <Lastchar+0x54>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1164 <Lastchar+0x54>
mov    -0x8(%rbp),%rdi
call   1030 <safestrlen@plt>
mov    %eax,%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lastchar>:
push   %rbx
xor    %eax,%eax
test   %rdi,%rdi
je     112f <Lastchar+0x1f>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     112f <Lastchar+0x1f>
mov    %rbx,%rdi
call   1030 <safestrlen@plt>
cltq
movzbl -0x1(%rax,%rbx,1),%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @Lastchar(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i32 @safestrlen(i8* %0)
%8 = add nsw i32 %7, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
br label %13
13: ; preds = %6, %3, %1
%14 = phi i32 [ %12, %6 ], [ 0, %3 ], [ 0, %1 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct wl_proxy {
  int dummy;
};
struct wl_data_offer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_get_version(struct wl_proxy *);
uint32_t wl_data_offer_get_version(struct wl_data_offer *wl_data_offer) {
  return wl_proxy_get_version((struct wl_proxy *)wl_data_offer);
}


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

x86 assembly (clang, -O2):
<wl_data_offer_get_version>:
jmp    1030 <wl_proxy_get_version@plt>

LLVM IR (-O0):
%struct.wl_data_offer = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_data_offer_get_version(%struct.wl_data_offer* %0) {
%2 = alloca %struct.wl_data_offer*
store %struct.wl_data_offer* %0, %struct.wl_data_offer** %2
%3 = load %struct.wl_data_offer*, %struct.wl_data_offer** %2
%4 = bitcast %struct.wl_data_offer* %3 to %struct.wl_proxy*
%5 = call i32 @wl_proxy_get_version(%struct.wl_proxy* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.wl_data_offer = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_data_offer_get_version(%struct.wl_data_offer* %0) {
%2 = bitcast %struct.wl_data_offer* %0 to %struct.wl_proxy*
%3 = tail call i32 @wl_proxy_get_version(%struct.wl_proxy* %2)
ret i32 %3
}
/* Type definitions */
struct sigaction {
  void (*sa_handler)(int);
  scalar_t__ sa_flags;
  int /*<<< orphan*/ sa_mask;
};

/* Variables and functions */
int /*<<< orphan*/ sigaction(int, struct sigaction *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
void util_catch_signal(int signum, void (*handler)(int)) {
  struct sigaction act;
  sigemptyset(&act.sa_mask);
  act.sa_flags = 0;
  act.sa_handler = handler;
  sigaction(signum, &act, NULL);
}


x86 assembly (clang, -O0):
<util_catch_signal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x28(%rbp),%rdi
add    $0x10,%rdi
call   1040 <sigemptyset@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigaction@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_catch_signal>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x10(%rsp),%rdi
call   1040 <sigemptyset@plt>
movq   $0x0,0x8(%rsp)
mov    %rbx,(%rsp)
mov    %rsp,%rsi
mov    %ebp,%edi
xor    %edx,%edx
call   1030 <sigaction@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.sigaction = type { void (i32)*, i64, i32 }
define void @util_catch_signal(i32 %0, void (i32)* %1) {
%3 = alloca i32
%4 = alloca void (i32)*
%5 = alloca %struct.sigaction
store i32 %0, i32* %3
store void (i32)* %1, void (i32)** %4
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 2
%7 = call i32 @sigemptyset(i32* %6)
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 1
store i64 0, i64* %8
%9 = load void (i32)*, void (i32)** %4
%10 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 0
store void (i32)* %9, void (i32)** %10
%11 = load i32, i32* %3
%12 = call i32 @sigaction(i32 %11, %struct.sigaction* %5, i32* null)
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { void (i32)*, i64, i32 }
define void @util_catch_signal(i32 %0, void (i32)* %1) {
%3 = alloca %struct.sigaction
%4 = bitcast %struct.sigaction* %3 to i8*
%5 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 2
%6 = call i32 @sigemptyset(i32* %5)
%7 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 1
store i64 0, i64* %7
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 0
store void (i32)* %1, void (i32)** %8
%9 = call i32 @sigaction(i32 %0, %struct.sigaction* %3, i32* null)
ret void
}
int Fibonacci(int n) {
  int a = 1, b = 1;
  int i, temp;
  if (n == 0 || n == 1)
    return 1;
  for (i = 0; i < n - 2; i++) {
    temp = b;
    a += b;
    b = temp;
  }
  return a;
}


x86 assembly (clang, -O0):
<Fibonacci>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1129 <Fibonacci+0x29>
cmpl   $0x1,-0x8(%rbp)
jne    1135 <Fibonacci+0x35>
movl   $0x1,-0x4(%rbp)
jmp    1176 <Fibonacci+0x76>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    1170 <Fibonacci+0x70>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113c <Fibonacci+0x3c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fibonacci>:
lea    -0x1(%rdi),%ecx
cmp    $0x3,%edi
mov    $0x1,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Fibonacci(i32 %0) {
%2 = icmp sgt i32 %0, 2
%3 = add nsw i32 %0, -1
%4 = select i1 %2, i32 %3, i32 1
ret i32 %4
}