xunge/DecIR huggingface dataset:
void ASimpleFunction(void) {}


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

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

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

LLVM IR (-O2):
define void @ASimpleFunction() {
ret void
}
/* Variables and functions */
double M_LN2;
double nats2bits(double score) { return score / M_LN2; }


x86 assembly (clang, -O0):
<nats2bits>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ecb(%rip),%rax
divsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<nats2bits>:
mov    0x2ed9(%rip),%rax
divsd  (%rax),%xmm0
ret

LLVM IR (-O0):
@M_LN2 = global double 0.000000e+00
define double @nats2bits(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* @M_LN2
%5 = fdiv double %3, %4
ret double %5
}

LLVM IR (-O2):
@M_LN2 = global double 0.000000e+00
define double @nats2bits(double %0) {
%2 = load double, double* @M_LN2
%3 = fdiv double %0, %2
ret double %3
}
int addOK(int x, int y) {
  int a = x >> 31 & 0x1;
  int b = y >> 31 & 0x1;
  int c = (x + y) >> 31 & 0x1;
  return (a & !b) | (!a & !c) | (b & c);
}


x86 assembly (clang, -O0):
<addOK>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmpl   $0x0,-0x10(%rbp)
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmpl   $0x0,-0xc(%rbp)
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
cmpl   $0x0,-0x14(%rbp)
setne  %dl
xor    $0xff,%dl
and    $0x1,%dl
movzbl %dl,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    -0x14(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addOK>:
lea    (%rsi,%rdi,1),%eax
mov    %esi,%ecx
not    %ecx
and    %edi,%ecx
or     %eax,%edi
not    %edi
and    %esi,%eax
or     %ecx,%eax
or     %edi,%eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @addOK(i32 %0, i32 %1) {
%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
%8 = load i32, i32* %3
%9 = ashr i32 %8, 31
%10 = and i32 %9, 1
store i32 %10, i32* %5
%11 = load i32, i32* %4
%12 = ashr i32 %11, 31
%13 = and i32 %12, 1
store i32 %13, i32* %6
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = add nsw i32 %14, %15
%17 = ashr i32 %16, 31
%18 = and i32 %17, 1
store i32 %18, i32* %7
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
%22 = xor i1 %21, true
%23 = zext i1 %22 to i32
%24 = and i32 %19, %23
%25 = load i32, i32* %5
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
%28 = zext i1 %27 to i32
%29 = load i32, i32* %7
%30 = icmp ne i32 %29, 0
%31 = xor i1 %30, true
%32 = zext i1 %31 to i32
%33 = and i32 %28, %32
%34 = or i32 %24, %33
%35 = load i32, i32* %6
%36 = load i32, i32* %7
%37 = and i32 %35, %36
%38 = or i32 %34, %37
ret i32 %38
}

LLVM IR (-O2):
define i32 @addOK(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = xor i32 %1, -1
%5 = and i32 %4, %0
%6 = or i32 %3, %0
%7 = xor i32 %6, -1
%8 = or i32 %5, %7
%9 = and i32 %3, %1
%10 = or i32 %8, %9
%11 = lshr i32 %10, 31
ret i32 %11
}
adrreg0adrreg1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{
  if ((p0[10000000]) <= (p1[1111111 / 4]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adrreg0adrreg1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2625a00(%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    0x10f444(%rcx),%eax
jg     113e <adrreg0adrreg1+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    1145 <adrreg0adrreg1+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0adrreg1>:
mov    0x2625a00(%r8),%ecx
xor    %eax,%eax
cmp    0x10f444(%r9),%ecx
setle  %al
ret

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

LLVM IR (-O2):
define i32 @adrreg0adrreg1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32* nocapture %5) {
%7 = getelementptr inbounds i32, i32* %4, i64 10000000
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %5, i64 277777
%10 = load i32, i32* %9
%11 = icmp sle i32 %8, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
int power_level(void) { return 8999; }


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

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

LLVM IR (-O0):
define i32 @power_level() {
ret i32 8999
}

LLVM IR (-O2):
define i32 @power_level() {
ret i32 8999
}
/* Variables and functions */
int syscall(int, int, int);
int kill(int sig, int pid) { return syscall(50, sig, pid); }


x86 assembly (clang, -O0):
<kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x32,%edi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0x32,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @kill(i32 %0, i32 %1) {
%3 = tail call i32 @syscall(i32 50, i32 %0, i32 %1)
ret i32 %3
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ visualid;
};
typedef TYPE_1__ XVisualInfo;

/* Variables and functions */
unsigned long get_XVisualInfo_visualid(void *_p) {
  return (unsigned long)((XVisualInfo *)_p)->visualid;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XVisualInfo_visualid(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XVisualInfo_visualid(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMRC0_get(void) { return U_WMRCORENONE_get("U_WMRC0"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMRC0\00"
define i32 @U_WMRC0_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRC0\00"
define i32 @U_WMRC0_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void Swapi(int *a, int *b) {
  int t = *a;
  *a = *b;
  *b = t;
}


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

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

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

LLVM IR (-O2):
define void @Swapi(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
/* Variables and functions */
int system(char *);
int main() { return system("reboot"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"reboot\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}

LLVM IR (-O2):
@.str = [7 x i8] c"reboot\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
unsigned long create_module(const char *name, size_t size) {
  __set_errno(ENOSYS);
  return (unsigned long)-1;
}


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

x86 assembly (clang, -O2):
<create_module>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffffffffffff,%rax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i64 @create_module(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i64 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i64 @create_module(i8* nocapture readnone %0, i64 %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i64 -1
}
__attribute__((__naked__)) void SGVObjcMsgSendSuper2TrampolineObjc(void) {
  asm volatile("addq $"
               "8"
               ", "
               "%%rdi"
               "\n\t"
               "jmp "
               "_objc_msgSendSuper2"
               "\n\t"
               :
               :
               : "rsi", "rdi");
}


x86 assembly (clang, -O0):
<SGVObjcMsgSendSuper2TrampolineObjc>:
add    $0x8,%rdi
jmp    1030 <_objc_msgSendSuper2@plt>

x86 assembly (clang, -O2):
<SGVObjcMsgSendSuper2TrampolineObjc>:
add    $0x8,%rdi
jmp    1030 <_objc_msgSendSuper2@plt>

LLVM IR (-O0):
define void @SGVObjcMsgSendSuper2TrampolineObjc() {
unreachable
}

LLVM IR (-O2):
define void @SGVObjcMsgSendSuper2TrampolineObjc() {
tail call void asm sideeffect "addq $$8, %rdi\0A\09jmp _objc_msgSendSuper2\0A\09", "~{rsi},~{rdi},~{dirflag},~{fpsr},~{flags}"()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ test_cmp();
int /*<<< orphan*/ test_realloc();
int main() {
  test_realloc();
  test_cmp();
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_realloc()
%2 = tail call i32 (...) @test_cmp()
ret i32 0
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ FatalErrnoError(int, int, char *);
int setsid();
pid_t Esetsid() {
  pid_t res = setsid();
  FatalErrnoError(res == -1, 1, "setsid()");
  return res;
}


x86 assembly (clang, -O0):
<Esetsid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <setsid@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x1,%esi
lea    0xeb6(%rip),%rdx
call   1040 <FatalErrnoError@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Esetsid>:
push   %rbx
xor    %eax,%eax
call   1030 <setsid@plt>
mov    %eax,%ebx
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
lea    0xec6(%rip),%rdx
mov    $0x1,%esi
call   1040 <FatalErrnoError@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"setsid()\00"
define i32 @Esetsid() {
%1 = alloca i32
%2 = call i32 (...) @setsid()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, -1
%5 = zext i1 %4 to i32
%6 = call i32 @FatalErrnoError(i32 %5, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [9 x i8] c"setsid()\00"
define i32 @Esetsid() {
%1 = tail call i32 (...) @setsid()
%2 = icmp eq i32 %1, -1
%3 = zext i1 %2 to i32
%4 = tail call i32 @FatalErrnoError(i32 %3, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int get_mem(int);
int is_colour_compatible() { return get_mem(0x143) == 0x80; }


x86 assembly (clang, -O0):
<is_colour_compatible>:
push   %rbp
mov    %rsp,%rbp
mov    $0x143,%edi
call   1030 <get_mem@plt>
cmp    $0x80,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_colour_compatible>:
push   %rax
mov    $0x143,%edi
call   1030 <get_mem@plt>
xor    %ecx,%ecx
cmp    $0x80,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_colour_compatible() {
%1 = call i32 @get_mem(i32 323)
%2 = icmp eq i32 %1, 128
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @is_colour_compatible() {
%1 = tail call i32 @get_mem(i32 323)
%2 = icmp eq i32 %1, 128
%3 = zext i1 %2 to i32
ret i32 %3
}
void foo_1_2_2_1_1_1_1_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_2_1_1_1_1_1_2() {
ret void
}
void test_stats_off(int temp) {}


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

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

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

LLVM IR (-O2):
define void @test_stats_off(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void line_separator() {
  printf("------------------------------------------------------------\n");
}


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

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

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

LLVM IR (-O2):
@str = [61 x i8] c"------------------------------------------------------------\00"
define void @line_separator() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
ret void
}
int shift(int x, int amt) {
  int at32 = amt & ~0x1F;
  return (x == x >> at32) && (x == x << at32);
}


x86 assembly (clang, -O0):
<shift>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xffffffe0,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%ecx
sar    %cl,%edx
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0xd(%rbp)
jne    1146 <shift+0x46>
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @shift(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = and i32 %6, -32
store i32 %7, i32* %5
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = ashr i32 %9, %10
%12 = icmp eq i32 %8, %11
br i1 %12, label %13, label %19
13: ; preds = %2
%14 = load i32, i32* %3
%15 = load i32, i32* %3
%16 = load i32, i32* %5
%17 = shl i32 %15, %16
%18 = icmp eq i32 %14, %17
br label %19
19: ; preds = %13, %2
%20 = phi i1 [ false, %2 ], [ %18, %13 ]
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @shift(i32 %0, i32 %1) {
ret i32 1
}
int inter_homunculus_sql_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @inter_homunculus_sql_init() {
ret i32 0
}
void prune_add2(unsigned int x) {
  int a[10];
  if (x + 1 < 12) {
    a[x] = 0;
  }
}


x86 assembly (clang, -O0):
<prune_add2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cmp    $0xc,%eax
jae    1121 <prune_add2+0x21>
mov    -0x4(%rbp),%eax
movl   $0x0,-0x30(%rbp,%rax,4)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @prune_add2(i32 %0) {
%2 = alloca i32
%3 = alloca [10 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add i32 %4, 1
%6 = icmp ult i32 %5, 12
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %9
store i32 0, i32* %10
br label %11
11: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
define void @prune_add2(i32 %0) {
ret void
}
void _merge_sort_inplace(int arr[], int left, int right) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    _merge_sort_inplace(arr, left, mid);
    _merge_sort_inplace(arr, mid, right);
    int i = left, j = mid, k = left;
  }
}


x86 assembly (clang, -O0):
<_merge_sort_inplace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cmp    -0x10(%rbp),%eax
jge    1172 <_merge_sort_inplace+0x62>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <_merge_sort_inplace@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <_merge_sort_inplace@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_merge_sort_inplace>:
push   %r15
push   %r14
push   %rbx
lea    0x1(%rsi),%eax
cmp    %edx,%eax
jge    1151 <_merge_sort_inplace+0x41>
mov    %edx,%r15d
mov    %rdi,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%rsi,%r15,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %r14,%rdi
mov    %ebx,%edx
call   1030 <_merge_sort_inplace@plt>
lea    0x1(%rbx),%eax
mov    %ebx,%esi
cmp    %r15d,%eax
jl     1130 <_merge_sort_inplace+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @_merge_sort_inplace(i32* nocapture %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, 1
%5 = icmp slt i32 %4, %2
br i1 %5, label %6, label %12
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ %1, %3 ]
%8 = add nsw i32 %7, %2
%9 = sdiv i32 %8, 2
tail call void @_merge_sort_inplace(i32* %0, i32 %7, i32 %9)
%10 = add nsw i32 %9, 1
%11 = icmp slt i32 %10, %2
br i1 %11, label %6, label %12
12: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nokia_lcd_data(int);
int /*<<< orphan*/ nokia_lcd_goto_offset(char, int /*<<< orphan*/);
void nokia_lcd_clear_line(char temp_row) {
  char temp_column;
  nokia_lcd_goto_offset(temp_row, 0);
  for (temp_column = 0; temp_column < 84; temp_column++) {
    nokia_lcd_data(0x00);
  }
}


x86 assembly (clang, -O0):
<nokia_lcd_clear_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
xor    %esi,%esi
movsbl -0x1(%rbp),%edi
call   1040 <nokia_lcd_goto_offset@plt>
movb   $0x0,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x54,%eax
jge    115e <nokia_lcd_clear_line+0x3e>
xor    %edi,%edi
call   1030 <nokia_lcd_data@plt>
mov    -0x2(%rbp),%al
add    $0x1,%al
mov    %al,-0x2(%rbp)
jmp    113d <nokia_lcd_clear_line+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nokia_lcd_clear_line>:
push   %rbx
xor    %esi,%esi
call   1040 <nokia_lcd_goto_offset@plt>
mov    $0x54,%bl
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1030 <nokia_lcd_data@plt>
add    $0xff,%bl
jne    1130 <nokia_lcd_clear_line+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @nokia_lcd_clear_line(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = call i32 @nokia_lcd_goto_offset(i8 signext %4, i32 0)
store i8 0, i8* %3
br label %6
6: ; preds = %12, %1
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = icmp slt i32 %8, 84
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = call i32 @nokia_lcd_data(i32 0)
br label %12
12: ; preds = %10
%13 = load i8, i8* %3
%14 = add i8 %13, 1
store i8 %14, i8* %3
br label %6
15: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @nokia_lcd_clear_line(i8 signext %0) {
%2 = tail call i32 @nokia_lcd_goto_offset(i8 signext %0, i32 0)
br label %3
3: ; preds = %1, %3
%4 = phi i8 [ 0, %1 ], [ %6, %3 ]
%5 = tail call i32 @nokia_lcd_data(i32 0)
%6 = add nuw nsw i8 %4, 1
%7 = icmp eq i8 %6, 84
br i1 %7, label %8, label %3
8: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0x64() {
  Assert_real((iscntrl(100) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_iscntrl.c",
              505, ("iscntrl should be 0 for d"));
}


x86 assembly (clang, -O0):
<t_iscntrl_0x64>:
push   %rbp
mov    %rsp,%rbp
mov    $0x64,%edi
call   1030 <iscntrl@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x1f9,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_iscntrl_0x64>:
push   %rax
mov    $0x64,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x1f9,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [26 x i8] c"iscntrl should be 0 for d\00"
define void @t_iscntrl_0x64() {
%1 = call i64 @iscntrl(i32 100)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 505, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [26 x i8] c"iscntrl should be 0 for d\00"
define void @t_iscntrl_0x64() {
%1 = tail call i64 @iscntrl(i32 100)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 505, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int pow(double, int);
int spow(int n) { return pow(2.0, n) - 1; }


x86 assembly (clang, -O0):
<spow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
movsd  0xeda(%rip),%xmm0
call   1030 <pow@plt>
sub    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spow>:
push   %rax
movsd  0xee7(%rip),%xmm0
call   1030 <pow@plt>
add    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @spow(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @pow(double 2.000000e+00, i32 %3)
%5 = sub nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @spow(i32 %0) {
%2 = tail call i32 @pow(double 2.000000e+00, i32 %0)
%3 = add nsw i32 %2, -1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ print_int(int);
int /*<<< orphan*/ print_string(char *);
void main(void) {
  int num;
  num = 250;
  num = '1';
  print_string("Should get 49, since '1' is equal to 49\n");
  print_int(num);
  print_string("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xfa,-0x4(%rbp)
movl   $0x31,-0x4(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <print_string@plt>
mov    -0x4(%rbp),%edi
call   1040 <print_int@plt>
lea    0xed6(%rip),%rdi
call   1030 <print_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <print_string@plt>
mov    $0x31,%edi
call   1040 <print_int@plt>
lea    0xee9(%rip),%rdi
pop    %rax
jmp    1030 <print_string@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Should get 49, since '1' is equal to 49\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca i32
store i32 250, i32* %1
store i32 49, i32* %1
%2 = call i32 @print_string(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
%4 = call i32 @print_int(i32 %3)
%5 = call i32 @print_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"Should get 49, since '1' is equal to 49\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @main() {
%1 = tail call i32 @print_string(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @print_int(i32 49)
%3 = tail call i32 @print_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int wait(int *);
int builtin_wait(int argc, const char **argv) {
  int status;
  ((void)argc);
  ((void)argv);
  while (wait(&status) != -1)
    ;
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<builtin_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <wait@plt>
cmp    $0xffffffff,%eax
je     1136 <builtin_wait+0x26>
jmp    111f <builtin_wait+0xf>
mov    0x2ea3(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<builtin_wait>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <wait@plt>
cmp    $0xffffffff,%eax
jne    1120 <builtin_wait+0x10>
mov    0x2eac(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @builtin_wait(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
br label %5
5: ; preds = %5, %2
%6 = call i32 @wait(i32* %3)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %5
8: ; preds = %5
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}
int bitXor(int x, int y) { return 2; }


x86 assembly (clang, -O0):
<bitXor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x2,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @bitXor(i32 %0, i32 %1) {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ nsc_assert(int);
void selwakeup(void) {
  nsc_assert(0 && "This function is unimplemented.");
  ;
}


x86 assembly (clang, -O0):
<selwakeup>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<selwakeup>:
xor    %edi,%edi
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
define void @selwakeup() {
%1 = call i32 @nsc_assert(i32 0)
ret void
}

LLVM IR (-O2):
define void @selwakeup() {
%1 = tail call i32 @nsc_assert(i32 0)
ret void
}
/* Variables and functions */
int get_nybble(unsigned char *);
int get_byte(unsigned char *s) {
  return get_nybble(s) * 16 + get_nybble(s + 1);
}


x86 assembly (clang, -O0):
<get_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_nybble@plt>
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1030 <get_nybble@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_byte>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <get_nybble@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
add    $0x1,%rbx
mov    %rbx,%rdi
call   1030 <get_nybble@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_byte(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @get_nybble(i8* %3)
%5 = mul nsw i32 %4, 16
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = call i32 @get_nybble(i8* %7)
%9 = add nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_byte(i8* %0) {
%2 = tail call i32 @get_nybble(i8* %0)
%3 = shl nsw i32 %2, 4
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = tail call i32 @get_nybble(i8* %4)
%6 = add nsw i32 %3, %5
ret i32 %6
}
/* Variables and functions */
int flog_get_level();
int flog_is_fatal_enabled() { return 5 >= flog_get_level(); }


x86 assembly (clang, -O0):
<flog_is_fatal_enabled>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <flog_get_level@plt>
mov    %eax,%ecx
mov    $0x5,%eax
cmp    %ecx,%eax
setge  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flog_is_fatal_enabled>:
push   %rax
xor    %eax,%eax
call   1030 <flog_get_level@plt>
xor    %ecx,%ecx
cmp    $0x6,%eax
setl   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @flog_is_fatal_enabled() {
%1 = call i32 (...) @flog_get_level()
%2 = icmp sge i32 5, %1
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @flog_is_fatal_enabled() {
%1 = tail call i32 (...) @flog_get_level()
%2 = icmp slt i32 %1, 6
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t rgbTo32(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
  return (a << 24) | (r << 16) | (g << 8) | b;
}


x86 assembly (clang, -O0):
<rgbTo32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x18,%eax
mov    -0x4(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgbTo32>:
mov    %ecx,%eax
shl    $0x18,%eax
shl    $0x10,%edi
shl    $0x8,%esi
or     %edi,%esi
or     %edx,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @rgbTo32(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = shl i32 %9, 24
%11 = load i32, i32* %5
%12 = shl i32 %11, 16
%13 = or i32 %10, %12
%14 = load i32, i32* %6
%15 = shl i32 %14, 8
%16 = or i32 %13, %15
%17 = load i32, i32* %7
%18 = or i32 %16, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @rgbTo32(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %3, 24
%6 = shl i32 %0, 16
%7 = shl i32 %1, 8
%8 = or i32 %7, %6
%9 = or i32 %8, %2
%10 = or i32 %9, %5
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ refresh();
void window_refresh() { refresh(); }


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

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

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

LLVM IR (-O2):
define void @window_refresh() {
%1 = tail call i32 (...) @refresh()
ret void
}
void test_stackinit_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @test_stackinit_exit() {
ret void
}
void troca(int *v1, int *v2) {
  int temp;
  temp = *v1;
  *v1 = *v2;
  *v2 = temp;
}


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

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

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

LLVM IR (-O2):
define void @troca(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stdout;
void close_serial(int port) {
  if (port) {
    fprintf(stdout, "[UNINIT] Serial closed on port %d\n", port);
    close(port);
  }
}


x86 assembly (clang, -O0):
<close_serial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1155 <close_serial+0x35>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xeb8(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_serial>:
test   %edi,%edi
je     1146 <close_serial+0x26>
push   %rbx
mov    %edi,%ebx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <close@plt>
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [35 x i8] c"[UNINIT] Serial closed on port %d\0A\00"
define void @close_serial(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* @stdout
%7 = load i32, i32* %2
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @close(i32 %9)
br label %11
11: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [35 x i8] c"[UNINIT] Serial closed on port %d\0A\00"
define void @close_serial(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = load i32, i32* @stdout
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = tail call i32 @close(i32 %0)
br label %7
7: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ num;

/* Variables and functions */
int /*<<< orphan*/ ap_str(char *);
int /*<<< orphan*/ inttoa(int, char *, int);
void ap_int(int num) {
  char buf[((sizeof(num) * 8 - 1) * 302 / 1000 + 1 + 1) + 2];
  inttoa(num, buf, sizeof buf);
  ap_str(buf);
}


x86 assembly (clang, -O0):
<ap_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x11(%rbp),%rsi
mov    $0xd,%edx
call   1030 <inttoa@plt>
lea    -0x11(%rbp),%rdi
call   1040 <ap_str@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ap_int>:
push   %rbx
sub    $0x10,%rsp
lea    0x3(%rsp),%rbx
mov    %rbx,%rsi
mov    $0xd,%edx
call   1030 <inttoa@plt>
mov    %rbx,%rdi
call   1040 <ap_str@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @ap_int(i32 %0) {
%2 = alloca i32
%3 = alloca [13 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%6 = call i32 @inttoa(i32 %4, i8* %5, i32 13)
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%8 = call i32 @ap_str(i8* %7)
ret void
}

LLVM IR (-O2):
define void @ap_int(i32 %0) {
%2 = alloca [13 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%4 = call i32 @inttoa(i32 %0, i8* %3, i32 13)
%5 = call i32 @ap_str(i8* %3)
ret void
}
int sq64_to_sq32(int sq) {
  static const int Mirror[] = {3, 2, 1, 0, 0, 1, 2, 3};
  return ((sq >> 1) & ~0x3) + Mirror[sq & 0x7];
}


x86 assembly (clang, -O0):
<sq64_to_sq32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
and    $0xfffffffc,%eax
mov    -0x4(%rbp),%ecx
and    $0x7,%ecx
movslq %ecx,%rdx
lea    0xee0(%rip),%rcx
add    (%rcx,%rdx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sq64_to_sq32>:
mov    %edi,%eax
sar    %eax
and    $0xfffffffc,%eax
and    $0x7,%edi
lea    0xeef(%rip),%rcx
add    (%rcx,%rdi,4),%eax
ret

LLVM IR (-O0):
@sq64_to_sq32.Mirror = internal constant [8 x i32] [i32 3, i32 2, i32 1, i32 0, i32 0, i32 1, i32 2, i32 3]
define i32 @sq64_to_sq32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
%5 = and i32 %4, -4
%6 = load i32, i32* %2
%7 = and i32 %6, 7
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [8 x i32], [8 x i32]* @sq64_to_sq32.Mirror, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = add nsw i32 %5, %10
ret i32 %11
}

LLVM IR (-O2):
@sq64_to_sq32.Mirror = internal unnamed_addr constant [8 x i32] [i32 3, i32 2, i32 1, i32 0, i32 0, i32 1, i32 2, i32 3]
define i32 @sq64_to_sq32(i32 %0) {
%2 = ashr i32 %0, 1
%3 = and i32 %2, -4
%4 = and i32 %0, 7
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds [8 x i32], [8 x i32]* @sq64_to_sq32.Mirror, i64 0, i64 %5
%7 = load i32, i32* %6
%8 = add nsw i32 %7, %3
ret i32 %8
}
unsigned int LittleLong(unsigned int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @LittleLong(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ MERGE(int, int, int);
int MERGE_SORT(int p, int r) {
  int q;
  if (p < r) {
    q = ((p + r) / 2);
    MERGE_SORT(p, q);
    MERGE_SORT(q + 1, r);
    MERGE(p, q, r);
  }
}


x86 assembly (clang, -O0):
<MERGE_SORT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1172 <MERGE_SORT+0x52>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <MERGE_SORT@plt>
mov    -0x10(%rbp),%edi
add    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1030 <MERGE_SORT@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <MERGE@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MERGE_SORT>:
cmp    %esi,%edi
jge    1160 <MERGE_SORT+0x40>
push   %r15
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%r15d
lea    (%r14,%r15,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%esi
call   1030 <MERGE_SORT@plt>
lea    0x1(%rbx),%edi
mov    %r14d,%esi
call   1030 <MERGE_SORT@plt>
mov    %r15d,%edi
mov    %ebx,%esi
mov    %r14d,%edx
call   1040 <MERGE@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @MERGE_SORT(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %5, label %4
4: ; preds = %2, %5
ret i32 undef
5: ; preds = %2
%6 = add nsw i32 %1, %0
%7 = sdiv i32 %6, 2
%8 = tail call i32 @MERGE_SORT(i32 %0, i32 %7)
%9 = add nsw i32 %7, 1
%10 = tail call i32 @MERGE_SORT(i32 %9, i32 %1)
%11 = tail call i32 @MERGE(i32 %0, i32 %7, i32 %1)
br label %4
}
/* Variables and functions */
int AF_INET6;
int af_inet6() { return AF_INET6; }


x86 assembly (clang, -O0):
<af_inet6>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<af_inet6>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@AF_INET6 = global i32 0
define i32 @af_inet6() {
%1 = load i32, i32* @AF_INET6
ret i32 %1
}

LLVM IR (-O2):
@AF_INET6 = global i32 0
define i32 @af_inet6() {
%1 = load i32, i32* @AF_INET6
ret i32 %1
}
void capturingNameEnd2CAPTURING_NAMED_END() {}


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

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

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

LLVM IR (-O2):
define void @capturingNameEnd2CAPTURING_NAMED_END() {
ret void
}
void CAN2_Handler(void) {
  while (1) {
  }
}


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

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

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

LLVM IR (-O2):
define void @CAN2_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t select_uint64_t() { return 0 | (3 << 1); }


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

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

LLVM IR (-O0):
define i32 @select_uint64_t() {
ret i32 6
}

LLVM IR (-O2):
define i32 @select_uint64_t() {
ret i32 6
}
/* Type definitions */
typedef int /*<<< orphan*/ __ptr_t;

/* Variables and functions */
int __mprotect(__ptr_t addr, size_t len, int prot) { return 0; }


x86 assembly (clang, -O0):
<__mprotect>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @__mprotect(i32 %0, i64 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @__mprotect(i32 %0, i64 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_std(void *ptr, void *baton) {
  (void)baton;
  free(ptr);
}


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

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

LLVM IR (-O0):
define void @free_std(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 = load i8*, i8** %3
%7 = call i32 @free(i8* %6)
ret void
}

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