xunge/DecIR huggingface dataset:
/* Variables and functions */
int EINVAL;
int unoctchar(char c) {
  if (c >= '0' && c <= '7')
    return c - '0';
  return -EINVAL;
}


x86 assembly (clang, -O0):
<unoctchar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <unoctchar+0x33>
movsbl -0x5(%rbp),%eax
cmp    $0x37,%eax
jg     1133 <unoctchar+0x33>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <unoctchar+0x41>
xor    %eax,%eax
mov    0x2ea4(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unoctchar>:
lea    -0x30(%rdi),%ecx
mov    %edi,%edx
mov    0x2ed4(%rip),%rsi
xor    %eax,%eax
sub    (%rsi),%eax
and    $0xf8,%dl
cmp    $0x30,%dl
cmove  %ecx,%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @unoctchar(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 55
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
store i32 %14, i32* %2
br label %18
15: ; preds = %7, %1
%16 = load i32, i32* @EINVAL
%17 = sub nsw i32 0, %16
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %11
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @unoctchar(i8 signext %0) {
%2 = and i8 %0, -8
%3 = icmp eq i8 %2, 48
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -48
%6 = load i32, i32* @EINVAL
%7 = sub nsw i32 0, %6
%8 = select i1 %3, i32 %5, i32 %7
ret i32 %8
}
void init_scsi() {}


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

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

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

LLVM IR (-O2):
define void @init_scsi() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int *);
void look(int x) {
  printf("x=%d, &x=%p \n", x, &x);
  return;
}


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

x86 assembly (clang, -O2):
<look>:
push   %rax
mov    %edi,%esi
mov    %edi,0x4(%rsp)
lea    0xee2(%rip),%rdi
lea    0x4(%rsp),%rdx
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"x=%d, &x=%p \0A\00"
define void @look(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %2)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"x=%d, &x=%p \0A\00"
define void @look(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0, i32* %2)
ret void
}
int intlog2(int x) {
  int log = 0;
  if (x < 0) {
    x = 0;
  }
  while ((x >> log) > 0) {
    log++;
  }
  if (log > 0 && x == 1 << (log - 1)) {
    log--;
  }
  return log;
}


x86 assembly (clang, -O0):
<intlog2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111f <intlog2+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    1124 <intlog2+0x24>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
cmp    $0x0,%eax
jle    1143 <intlog2+0x43>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <intlog2+0x24>
cmpl   $0x0,-0x8(%rbp)
jle    1170 <intlog2+0x70>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jne    1170 <intlog2+0x70>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intlog2>:
xor    %eax,%eax
test   %edi,%edi
cmovns %edi,%eax
mov    $0xffffffff,%edx
nopl   0x0(%rax)
add    $0x1,%edx
mov    %eax,%esi
mov    %edx,%ecx
shr    %cl,%esi
test   %esi,%esi
jg     1110 <intlog2+0x10>
lea    -0x1(%rdx),%ecx
mov    $0x1,%esi
shl    %cl,%esi
lea    -0x1(%rdx),%ecx
cmp    %esi,%eax
cmovne %edx,%ecx
xor    %eax,%eax
cmp    $0x1,%edx
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @intlog2(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
br label %4
4: ; preds = %4, %1
%5 = phi i32 [ 0, %1 ], [ %8, %4 ]
%6 = lshr i32 %3, %5
%7 = icmp sgt i32 %6, 0
%8 = add nuw nsw i32 %5, 1
br i1 %7, label %4, label %9
9: ; preds = %4
%10 = icmp eq i32 %5, 0
%11 = add nsw i32 %5, -1
%12 = shl nuw i32 1, %11
%13 = icmp eq i32 %3, %12
%14 = select i1 %13, i32 %11, i32 %5
%15 = select i1 %10, i32 0, i32 %14
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ SendInterrupt(int, int, int, int);
void ScuSendExternalInterrupt05(void) {
  SendInterrupt(0x55, 0x4, 0x8000, 0x00200000);
}


x86 assembly (clang, -O0):
<ScuSendExternalInterrupt05>:
push   %rbp
mov    %rsp,%rbp
mov    $0x55,%edi
mov    $0x4,%esi
mov    $0x8000,%edx
mov    $0x200000,%ecx
call   1030 <SendInterrupt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ScuSendExternalInterrupt05>:
mov    $0x55,%edi
mov    $0x4,%esi
mov    $0x8000,%edx
mov    $0x200000,%ecx
jmp    1030 <SendInterrupt@plt>

LLVM IR (-O0):
define void @ScuSendExternalInterrupt05() {
%1 = call i32 @SendInterrupt(i32 85, i32 4, i32 32768, i32 2097152)
ret void
}

LLVM IR (-O2):
define void @ScuSendExternalInterrupt05() {
%1 = tail call i32 @SendInterrupt(i32 85, i32 4, i32 32768, i32 2097152)
ret void
}
/* Variables and functions */
scalar_t__ islower(int const);
scalar_t__ isupper(int const);
int isalpha(const int c) { return isupper(c) || islower(c); }


x86 assembly (clang, -O0):
<isalpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <isupper@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1157 <isalpha+0x37>
mov    -0x4(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalpha>:
push   %rbx
mov    %edi,%ebx
call   1040 <isupper@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <isalpha+0x17>
pop    %rbx
ret
mov    %ebx,%edi
call   1030 <islower@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @isalpha(i32 %0) {
%2 = tail call i64 @isupper(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @islower(i32 %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int labs(long);
long randm(int);
long expr_armor_add_crtcl(long lev) { return (randm(labs(lev) / 20 + 1)); }


x86 assembly (clang, -O0):
<expr_armor_add_crtcl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <labs@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x1,%edi
call   1040 <randm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expr_armor_add_crtcl>:
push   %rax
call   1030 <labs@plt>
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
sar    $0x23,%rcx
shr    $0x3f,%rax
lea    (%rcx,%rax,1),%edi
add    $0x1,%edi
pop    %rax
jmp    1040 <randm@plt>

LLVM IR (-O0):
define i64 @expr_armor_add_crtcl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @labs(i64 %3)
%5 = sdiv i32 %4, 20
%6 = add nsw i32 %5, 1
%7 = call i64 @randm(i32 %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @expr_armor_add_crtcl(i64 %0) {
%2 = tail call i32 @labs(i64 %0)
%3 = sdiv i32 %2, 20
%4 = add nsw i32 %3, 1
%5 = tail call i64 @randm(i32 %4)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ getPrecessionAnglesVondrak(double const, double *, double *,
                                              double *, double *);
double getPrecessionAngleVondrakEpsilon(const double jde) {
  double epsilon_A, dummy_chi_A, dummy_omega_A, dummy_psi_A;
  getPrecessionAnglesVondrak(jde, &epsilon_A, &dummy_chi_A, &dummy_omega_A,
                             &dummy_psi_A);
  return epsilon_A;
}


x86 assembly (clang, -O0):
<getPrecessionAngleVondrakEpsilon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1030 <getPrecessionAnglesVondrak@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPrecessionAngleVondrakEpsilon>:
sub    $0x28,%rsp
lea    0x8(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1030 <getPrecessionAnglesVondrak@plt>
movsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @getPrecessionAngleVondrakEpsilon(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %2
%7 = load double, double* %2
%8 = call i32 @getPrecessionAnglesVondrak(double %7, double* %3, double* %4, double* %5, double* %6)
%9 = load double, double* %3
ret double %9
}

LLVM IR (-O2):
define double @getPrecessionAngleVondrakEpsilon(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = bitcast double* %5 to i8*
%10 = call i32 @getPrecessionAnglesVondrak(double %0, double* %2, double* %3, double* %4, double* %5)
%11 = load double, double* %2
ret double %11
}
void *lrt_trans_gmem(void) { return (void *)(0xFFE00000); }


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

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

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

LLVM IR (-O2):
define i8* @lrt_trans_gmem() {
ret i8* inttoptr (i64 4292870144 to i8*)
}
/* Variables and functions */
scalar_t__ INT_MIN;
unsigned int test5u(unsigned int x) {
  unsigned int y = (unsigned int)INT_MIN;
  return x + y;
}


x86 assembly (clang, -O0):
<test5u>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eda(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5u>:
mov    %edi,%eax
mov    0x2edf(%rip),%rcx
add    (%rcx),%eax
ret

LLVM IR (-O0):
@INT_MIN = global i64 0
define i32 @test5u(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i64, i64* @INT_MIN
%5 = trunc i64 %4 to i32
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
@INT_MIN = global i64 0
define i32 @test5u(i32 %0) {
%2 = load i64, i64* @INT_MIN
%3 = trunc i64 %2 to i32
%4 = add i32 %3, %0
ret i32 %4
}
void fastboot_progress_display(const char *s) {}


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

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

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

LLVM IR (-O2):
define void @fastboot_progress_display(i8* nocapture %0) {
ret void
}
int test_imm_B6int64_highword_reg(long long val) {
  return ((val >> 32) & (0xB6 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_B6int64_highword_reg(i64 %0) {
%2 = and i64 %0, 781684047872
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ASL8(int /*<<< orphan*/);
int /*<<< orphan*/ DirectIndexedXE0(int);
void Op16E0M1(void) { ASL8(DirectIndexedXE0(3)); }


x86 assembly (clang, -O0):
<Op16E0M1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1040 <DirectIndexedXE0@plt>
mov    %eax,%edi
call   1030 <ASL8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op16E0M1>:
push   %rax
mov    $0x3,%edi
call   1040 <DirectIndexedXE0@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <ASL8@plt>

LLVM IR (-O0):
define void @Op16E0M1() {
%1 = call i32 @DirectIndexedXE0(i32 3)
%2 = call i32 @ASL8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op16E0M1() {
%1 = tail call i32 @DirectIndexedXE0(i32 3)
%2 = tail call i32 @ASL8(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printSpaces(int);
void printMargin(int value) {
  if (value < 10) {
    printSpaces(4);
  } else if (value < 100) {
    printSpaces(3);
  } else if (value < 1000) {
    printSpaces(2);
  } else if (value < 1000) {
    printSpaces(1);
  }
}


x86 assembly (clang, -O0):
<printMargin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1134 <printMargin+0x24>
mov    $0x4,%edi
call   1030 <printSpaces@plt>
jmp    118f <printMargin+0x7f>
cmpl   $0x64,-0x4(%rbp)
jge    114d <printMargin+0x3d>
mov    $0x3,%edi
call   1030 <printSpaces@plt>
jmp    118a <printMargin+0x7a>
cmpl   $0x3e8,-0x4(%rbp)
jge    1169 <printMargin+0x59>
mov    $0x2,%edi
call   1030 <printSpaces@plt>
jmp    1185 <printMargin+0x75>
cmpl   $0x3e8,-0x4(%rbp)
jge    1180 <printMargin+0x70>
mov    $0x1,%edi
call   1030 <printSpaces@plt>
jmp    1185 <printMargin+0x75>
jmp    118a <printMargin+0x7a>
jmp    118f <printMargin+0x7f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMargin>:
mov    %edi,%eax
mov    $0x4,%edi
cmp    $0xa,%eax
jl     1132 <printMargin+0x22>
mov    $0x3,%edi
cmp    $0x64,%eax
jb     1132 <printMargin+0x22>
mov    $0x2,%edi
cmp    $0x3e7,%eax
ja     1137 <printMargin+0x27>
jmp    1030 <printSpaces@plt>
ret

LLVM IR (-O0):
define void @printMargin(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 10
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printSpaces(i32 4)
br label %25
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 100
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printSpaces(i32 3)
br label %24
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 1000
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printSpaces(i32 2)
br label %23
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 1000
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @printSpaces(i32 1)
br label %22
22: ; preds = %20, %17
br label %23
23: ; preds = %22, %15
br label %24
24: ; preds = %23, %10
br label %25
25: ; preds = %24, %5
ret void
}

LLVM IR (-O2):
define void @printMargin(i32 %0) {
%2 = icmp slt i32 %0, 10
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 100
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 1000
br i1 %6, label %7, label %10
7: ; preds = %5, %3, %1
%8 = phi i32 [ 4, %1 ], [ 3, %3 ], [ 2, %5 ]
%9 = tail call i32 @printSpaces(i32 %8)
br label %10
10: ; preds = %7, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ trap_UpdateScreen();
void UI_UpdateScreen(void) { trap_UpdateScreen(); }


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

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

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

LLVM IR (-O2):
define void @UI_UpdateScreen() {
%1 = tail call i32 (...) @trap_UpdateScreen()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ funcion(unsigned long long, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned long long *);
void main() {
  unsigned long long numero;
  printf("Numero: ");
  scanf("%llu", &numero);
  printf("Mayor factor primo: %llu\n", funcion(numero, 0));
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%rdi
xor    %esi,%esi
call   1040 <funcion@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Numero: \00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [26 x i8] c"Mayor factor primo: %llu\0A\00"
define void @main() {
%1 = alloca i64
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = call i32 @funcion(i64 %4, i32 0)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Numero: \00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [26 x i8] c"Mayor factor primo: %llu\0A\00"
define void @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%5 = load i64, i64* %1
%6 = call i32 @funcion(i64 %5, i32 0)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int yyerror(char const *a) {
  printf("yyerror: (%s)\n", a);
  return 1;
}


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

x86 assembly (clang, -O2):
<yyerror>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"yyerror: (%s)\0A\00"
define i32 @yyerror(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 1
}
void gensubu() {}


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

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

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

LLVM IR (-O2):
define void @gensubu() {
ret void
}
char *bindtextdomain(domainname, dirname) const char *domainname;
const char *dirname;
{ return bindtextdomain__(domainname, dirname); }


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

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

LLVM IR (-O0):
define i8* @bindtextdomain(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 (i8*, i8*, ...) bitcast (i32 (...)* @bindtextdomain__ to i32 (i8*, i8*, ...)*)(i8* %5, i8* %6)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
ret i8* %9
}

LLVM IR (-O2):
define i8* @bindtextdomain(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @bindtextdomain__ to i32 (i8*, i8*, ...)*)(i8* %0, i8* %1)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Variables and functions */
int log10(double);
double convert_to_decibel(double value) { return 10 * log10(value); }


x86 assembly (clang, -O0):
<convert_to_decibel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log10@plt>
imul   $0xa,%eax,%eax
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_to_decibel>:
push   %rax
call   1030 <log10@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @convert_to_decibel(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @log10(double %3)
%5 = mul nsw i32 10, %4
%6 = sitofp i32 %5 to double
ret double %6
}

LLVM IR (-O2):
define double @convert_to_decibel(double %0) {
%2 = tail call i32 @log10(double %0)
%3 = mul nsw i32 %2, 10
%4 = sitofp i32 %3 to double
ret double %4
}
int another_function(float a) { return 5 * a; }


x86 assembly (clang, -O0):
<another_function>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<another_function>:
mulss  0xef8(%rip),%xmm0
cvttss2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @another_function(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float 5.000000e+00, %3
%5 = fptosi float %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @another_function(float %0) {
%2 = fmul float %0, 5.000000e+00
%3 = fptosi float %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char ch;
  printf("Please enter a character:");
  scanf("%c", &ch);
  printf("The code for %c is %hd.\n", ch, ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%esi
movsbl -0x5(%rbp),%edx
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
movsbl 0x7(%rsp),%edx
lea    0xed1(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please enter a character:\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [25 x i8] c"The code for %c is %hd.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 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), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please enter a character:\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [25 x i8] c"The code for %c is %hd.\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %5)
ret i32 0
}
void memdump(unsigned long start, unsigned long size) {}


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

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

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

LLVM IR (-O2):
define void @memdump(i64 %0, i64 %1) {
ret void
}
int main() {
  unsigned long arg1 = 0x123456789ABCDEF0;
  unsigned long arg2 = 0xFEDCBA9876543210;
  unsigned long out1 = 0;
  unsigned long out2 = 0;
  __asm__("xaddq %%rax, %%rcx" : "=a"(out1), "=c"(out2) : "a"(arg1), "c"(arg2));
  return (out1 == 0xFEDCBA9876543210) && (out2 == 0x1111111111111100);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movabs $0x123456789abcdef0,%rax
56 34 12
mov    %rax,-0x10(%rbp)
movabs $0xfedcba9876543210,%rax
ba dc fe
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
xadd   %rax,%rcx
mov    %rax,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
xor    %eax,%eax
movabs $0xfedcba9876543210,%rcx
ba dc fe
cmp    %rcx,-0x20(%rbp)
mov    %al,-0x29(%rbp)
jne    1178 <main+0x78>
movabs $0x1111111111111100,%rax
11 11 11
cmp    %rax,-0x28(%rbp)
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movabs $0x123456789abcdef0,%rax
56 34 12
movabs $0xfedcba9876543210,%rdx
ba dc fe
mov    %rdx,%rcx
xadd   %rax,%rcx
xor    %rdx,%rax
movabs $0x1111111111111100,%rdx
11 11 11
xor    %rcx,%rdx
xor    %ecx,%ecx
or     %rax,%rdx
sete   %cl
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
store i64 1311768467463790320, i64* %2
store i64 -81985529216486896, i64* %3
store i64 0, i64* %4
store i64 0, i64* %5
%6 = load i64, i64* %2
%7 = load i64, i64* %3
%8 = call { i64, i64 } asm "xaddq %rax, %rcx", "={ax},={cx},{ax},{cx},~{dirflag},~{fpsr},~{flags}"(i64 %6, i64 %7)
%9 = extractvalue { i64, i64 } %8, 0
%10 = extractvalue { i64, i64 } %8, 1
store i64 %9, i64* %4
store i64 %10, i64* %5
%11 = load i64, i64* %4
%12 = icmp eq i64 %11, -81985529216486896
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i64, i64* %5
%15 = icmp eq i64 %14, 1229782938247303424
br label %16
16: ; preds = %13, %0
%17 = phi i1 [ false, %0 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call { i64, i64 } asm "xaddq %rax, %rcx", "={ax},={cx},{ax},{cx},~{dirflag},~{fpsr},~{flags}"(i64 1311768467463790320, i64 -81985529216486896)
%2 = extractvalue { i64, i64 } %1, 0
%3 = extractvalue { i64, i64 } %1, 1
%4 = icmp eq i64 %2, -81985529216486896
%5 = icmp eq i64 %3, 1229782938247303424
%6 = select i1 %4, i1 %5, i1 false
%7 = zext i1 %6 to i32
ret i32 %7
}
void parser_close() {}


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

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

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

LLVM IR (-O2):
define void @parser_close() {
ret void
}
int PyThread_set_key_value(int key, void *value) {
  int ok;
  if (!ok)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<PyThread_set_key_value>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1121 <PyThread_set_key_value+0x21>
movl   $0xffffffff,-0x4(%rbp)
jmp    1128 <PyThread_set_key_value+0x28>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @PyThread_set_key_value(i32 %0, i8* nocapture readnone %1) {
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void set_64bit(volatile uint64_t *ptr, uint64_t val) { *ptr = val; }


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

x86 assembly (clang, -O2):
<set_64bit>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @set_64bit(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
store volatile i32 %5, i32* %6
ret void
}

LLVM IR (-O2):
define void @set_64bit(i32* %0, i32 %1) {
store volatile i32 %1, i32* %0
ret void
}
int descending(const void *a, const void *b) { return *(int *)b - *(int *)a; }


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

x86 assembly (clang, -O2):
<descending>:
mov    (%rsi),%eax
sub    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @descending(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @descending(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ err(int /*<<< orphan*/, char *, char *);
char *realpath(char *, int /*<<< orphan*/ *);
char *absolute_path(char *path) {
  char *abs;
  assert(path != NULL);
  abs = realpath(path, NULL);
  if (abs == NULL)
    err(EXIT_FAILURE, "%s", path);
  return abs;
}


x86 assembly (clang, -O0):
<absolute_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <realpath@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1183 <absolute_path+0x53>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe82(%rip),%rsi
call   1050 <err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<absolute_path>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <realpath@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    116f <absolute_path+0x3f>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
lea    0xe99(%rip),%rsi
mov    %r14,%rdx
call   1050 <err@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c"%s\00"
define i8* @absolute_path(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i8*, i8** %2
%9 = call i8* @realpath(i8* %8, i32* null)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %1
%13 = load i32, i32* @EXIT_FAILURE
%14 = load i8*, i8** %2
%15 = call i32 @err(i32 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %12, %1
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c"%s\00"
define i8* @absolute_path(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i8* @realpath(i8* %0, i32* null)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @err(i32 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %7, %1
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ gomaincaller(int, char **);
int main(int argc, char *argv[]) {
  gomaincaller(argc, argv);
  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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <gomaincaller@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <gomaincaller@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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @gomaincaller(i32 %6, i8** %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @gomaincaller(i32 %0, i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_third_greetings(void) { printf("Hello from PATCHED binary!\n"); }


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"Hello from PATCHED binary!\0A\00"
define void @print_third_greetings() {
%1 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [27 x i8] c"Hello from PATCHED binary!\00"
define void @print_third_greetings() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
void syslog_close() { closelog(); }


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

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

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

LLVM IR (-O2):
define void @syslog_close() {
%1 = tail call i32 (...) @closelog()
ret void
}
/* Variables and functions */
char *strdup(char const *);
char *strip_newline(const char *src) {
  char *dst = strdup(src);
  char *p = dst;
  while (*p != '\0') {
    if (*p == '\n') {
      *p = '\0';
      break;
    }
    p++;
  }
  return dst;
}


x86 assembly (clang, -O0):
<strip_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116e <strip_newline+0x5e>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    115d <strip_newline+0x4d>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
jmp    116e <strip_newline+0x5e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1131 <strip_newline+0x21>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strip_newline>:
push   %rax
call   1030 <strdup@plt>
mov    %rax,%rcx
nopl   0x0(%rax)
movzbl (%rcx),%edx
test   %dl,%dl
je     1135 <strip_newline+0x25>
cmp    $0xa,%dl
je     1132 <strip_newline+0x22>
add    $0x1,%rcx
jmp    1120 <strip_newline+0x10>
movb   $0x0,(%rcx)
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i8* @strip_newline(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
br label %3
3: ; preds = %7, %1
%4 = phi i8* [ %2, %1 ], [ %8, %7 ]
%5 = load i8, i8* %4
switch i8 %5, label %7 [
i8 0, label %9
i8 10, label %6
]
6: ; preds = %3
store i8 0, i8* %4
br label %9
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
9: ; preds = %3, %6
ret i8* %2
}
/* Type definitions */
struct list {
  int dummy;
};
struct boper {
  int dummy;
};

/* Variables and functions */
struct list *bins_asr_(int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ object_copy(struct boper const *);
struct list *bins_asr(const struct boper *dst, const struct boper *operand,
                      const struct boper *bits) {
  return bins_asr_(object_copy(dst), object_copy(operand), object_copy(bits));
}


x86 assembly (clang, -O0):
<bins_asr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <object_copy@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <object_copy@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <object_copy@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
call   1030 <bins_asr_@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bins_asr>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
call   1040 <object_copy@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <object_copy@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1040 <object_copy@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <bins_asr_@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
%struct.boper = type { i32 }
define %struct.list* @bins_asr(%struct.boper* %0, %struct.boper* %1, %struct.boper* %2) {
%4 = alloca %struct.boper*
%5 = alloca %struct.boper*
%6 = alloca %struct.boper*
store %struct.boper* %0, %struct.boper** %4
store %struct.boper* %1, %struct.boper** %5
store %struct.boper* %2, %struct.boper** %6
%7 = load %struct.boper*, %struct.boper** %4
%8 = call i32 @object_copy(%struct.boper* %7)
%9 = load %struct.boper*, %struct.boper** %5
%10 = call i32 @object_copy(%struct.boper* %9)
%11 = load %struct.boper*, %struct.boper** %6
%12 = call i32 @object_copy(%struct.boper* %11)
%13 = call %struct.list* @bins_asr_(i32 %8, i32 %10, i32 %12)
ret %struct.list* %13
}

LLVM IR (-O2):
%struct.list = type { i32 }
%struct.boper = type { i32 }
define %struct.list* @bins_asr(%struct.boper* %0, %struct.boper* %1, %struct.boper* %2) {
%4 = tail call i32 @object_copy(%struct.boper* %0)
%5 = tail call i32 @object_copy(%struct.boper* %1)
%6 = tail call i32 @object_copy(%struct.boper* %2)
%7 = tail call %struct.list* @bins_asr_(i32 %4, i32 %5, i32 %6)
ret %struct.list* %7
}
/* Variables and functions */
void *calloc(size_t, size_t);
void *xcalloc(size_t nmemb, size_t size, char *s) {
  void *ret = calloc(nmemb, size);
  return ret;
}


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

x86 assembly (clang, -O2):
<xcalloc>:
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define noalias i8* @xcalloc(i64 %0, i64 %1, i8* nocapture readnone %2) {
%4 = tail call i8* @calloc(i64 %0, i64 %1)
ret i8* %4
}
int bit_is_set(int reg, int bit) {
  if (reg & (1 << bit)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<bit_is_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1130 <bit_is_set+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <bit_is_set+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_is_set>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @bit_is_set(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = and i32 %3, 1
ret i32 %4
}
int fib(int n) {
  int x, y;
  if (n < 2)
    return n;
  else {
#pragma omp task shared(x) firstprivate(n)
    x = fib(n - 1);
#pragma omp task shared(y) firstprivate(n)
    y = fib(n - 2);
#pragma omp taskwait
    return x + y;
  }
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1130 <fib+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1155 <fib+0x45>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jge    1120 <fib+0x10>
mov    %ebx,%ecx
jmp    1144 <fib+0x34>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbx),%edi
call   1030 <fib@plt>
lea    -0x2(%rbx),%ecx
add    %eax,%ebp
cmp    $0x3,%ebx
mov    %ecx,%ebx
ja     1130 <fib+0x20>
add    %ecx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 4
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %9, %3 ]
%13 = phi i32 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i32 %13, %12
ret i32 %14
}