xunge/DecIR huggingface dataset:
double r12(void *x) { return *(double *)(x + 32756); }


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

x86 assembly (clang, -O2):
<r12>:
movsd  0x7ff4(%rdi),%xmm0
ret

LLVM IR (-O0):
define double @r12(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr i8, i8* %3, i64 32756
%5 = bitcast i8* %4 to double*
%6 = load double, double* %5
ret double %6
}

LLVM IR (-O2):
define double @r12(i8* nocapture %0) {
%2 = getelementptr i8, i8* %0, i64 32756
%3 = bitcast i8* %2 to double*
%4 = load double, double* %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
main() {
  float f = -3.0;
  int x = *(int *)&f;
  x &= 0x7FFFFFFF;
  printf("%f\n", *(float *)&x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xee0(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float 3.000000e+00)
ret i32 0
}
/* Variables and functions */
int is_fib(int);
int /*<<< orphan*/ printf(char *, int, int);
void check(int n) { printf("%d -> %d\n", n, is_fib(n)); }


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <is_fib@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbx
mov    %edi,%ebx
call   1030 <is_fib@plt>
lea    0xed1(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
pop    %rbx
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"%d -> %d\0A\00"
define void @check(i32 %0) {
%2 = tail call i32 @is_fib(i32 %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2)
ret void
}
void jumpfunc(void *p) {
  void *l = &&jumplabel;
jumplabel:
  __builtin_memcpy(p, l, 1);
}


x86 assembly (clang, -O0):
<jumpfunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0x4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%cl
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<jumpfunc>:
mov    -0x6(%rip),%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @jumpfunc(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* blockaddress(@jumpfunc, %4), i8** %3
br label %4
4: ; preds = %1, %7
%5 = load i8*, i8** %2
%6 = load i8*, i8** %3
ret void
7: ; No predecessors!
indirectbr i8* undef, [label %4]
}

LLVM IR (-O2):
define void @jumpfunc(i8* nocapture writeonly %0) {
br label %2
2: ; preds = %1
%3 = load i8, i8* blockaddress(@jumpfunc, %2)
store i8 %3, i8* %0
ret void
}
void cam_interrupt_attach(const int c, const int n, void (*isr)(void)) {}


x86 assembly (clang, -O0):
<cam_interrupt_attach>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @cam_interrupt_attach(i32 %0, i32 %1, void ()* nocapture %2) {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ border_width;
};
typedef TYPE_1__ XConfigureEvent;

/* Variables and functions */
int get_XConfigureEvent_border_width(void *_p) {
  return (int)((XConfigureEvent *)_p)->border_width;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XConfigureEvent_border_width(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
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XConfigureEvent_border_width(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
unsigned short fractionOfDayToMinute(double fraction) {
  unsigned short minute = (unsigned short)(fraction * 24 * 60 + 0.5);
  return minute;
}


x86 assembly (clang, -O0):
<fractionOfDayToMinute>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fractionOfDayToMinute>:
mulsd  0xef8(%rip),%xmm0
mulsd  0xef8(%rip),%xmm0
addsd  0xef8(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define zeroext i16 @fractionOfDayToMinute(double %0) {
%2 = alloca double
%3 = alloca i16
store double %0, double* %2
%4 = load double, double* %2
%5 = fmul double %4, 2.400000e+01
%6 = call double @llvm.fmuladd.f64(double %5, double 6.000000e+01, double 5.000000e-01)
%7 = fptoui double %6 to i16
store i16 %7, i16* %3
%8 = load i16, i16* %3
ret i16 %8
}

LLVM IR (-O2):
define zeroext i16 @fractionOfDayToMinute(double %0) {
%2 = fmul double %0, 2.400000e+01
%3 = tail call double @llvm.fmuladd.f64(double %2, double 6.000000e+01, double 5.000000e-01)
%4 = fptoui double %3 to i16
ret i16 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
gid_t getgid(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @getgid() {
ret i32 0
}
void CG_DrawNotebook(void) {}


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

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

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

LLVM IR (-O2):
define void @CG_DrawNotebook() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ level2();
void level1() { level2(); }


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

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

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

LLVM IR (-O2):
define void @level1() {
%1 = tail call i32 (...) @level2()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ run_reg_requires();
int main() {
  run_reg_requires();
#pragma omp target
  {}
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @run_reg_requires()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @run_reg_requires()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ my_strlen(char *);
scalar_t__ my_strncmp(char *, char *, int /*<<< orphan*/);
int my_str_startswith(char *str, char *start) {
  if (my_strncmp(str, start, my_strlen(start)) == 0)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<my_str_startswith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <my_strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1040 <my_strncmp@plt>
cmp    $0x0,%rax
jne    116e <my_str_startswith+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1175 <my_str_startswith+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_str_startswith>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <my_strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <my_strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @my_str_startswith(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %5
%8 = load i8*, i8** %5
%9 = call i32 @my_strlen(i8* %8)
%10 = call i64 @my_strncmp(i8* %6, i8* %7, i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %14
13: ; preds = %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @my_str_startswith(i8* %0, i8* %1) {
%3 = tail call i32 @my_strlen(i8* %1)
%4 = tail call i64 @my_strncmp(i8* %0, i8* %1, i32 %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
int dcr_read(unsigned long regaddr, unsigned int *data) { return 0; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ *ASN1_item_dup(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_REQ_it;
X509_REQ *X509_REQ_dup(X509_REQ *x) { return ASN1_item_dup(&X509_REQ_it, x); }


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

x86 assembly (clang, -O2):
<X509_REQ_dup>:
mov    %rdi,%rsi
mov    0x2ede(%rip),%rdi
jmp    1030 <ASN1_item_dup@plt>

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

LLVM IR (-O2):
@X509_REQ_it = global i32 0
define i32* @X509_REQ_dup(i32* %0) {
%2 = tail call i32* @ASN1_item_dup(i32* @X509_REQ_it, i32* %0)
ret i32* %2
}
int in_kernel() {
  unsigned short code_segment;
  __asm__("movw	%%cs, %%ax" : "=a"(code_segment));
  return code_segment == 8;
}


x86 assembly (clang, -O0):
<in_kernel>:
push   %rbp
mov    %rsp,%rbp
mov    %cs,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_kernel>:
mov    %cs,%ax
xor    %ecx,%ecx
cmp    $0x8,%ax
sete   %cl
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @in_kernel() {
%1 = alloca i16
%2 = call i16 asm "movw\09%cs, %ax", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i16 %2, i16* %1
%3 = load i16, i16* %1
%4 = zext i16 %3 to i32
%5 = icmp eq i32 %4, 8
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @in_kernel() {
%1 = tail call i16 asm "movw\09%cs, %ax", "={ax},~{dirflag},~{fpsr},~{flags}"()
%2 = icmp eq i16 %1, 8
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void xfree(void *Block) { free(Block); }


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

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

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

LLVM IR (-O2):
define void @xfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int fail();
int pass();
int assert(int perhaps) { return perhaps ? pass() : fail(); }


x86 assembly (clang, -O0):
<assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1144 <assert+0x24>
mov    $0x0,%al
call   1040 <pass@plt>
mov    %eax,-0x8(%rbp)
jmp    114e <assert+0x2e>
mov    $0x0,%al
call   1030 <fail@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert>:
xor    %eax,%eax
test   %edi,%edi
je     112b <assert+0xb>
jmp    1040 <pass@plt>
jmp    1030 <fail@plt>

LLVM IR (-O0):
define i32 @assert(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 %7
5: ; preds = %1
%6 = call i32 (...) @pass()
br label %9
7: ; preds = %1
%8 = call i32 (...) @fail()
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @assert(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @pass()
br label %7
5: ; preds = %1
%6 = tail call i32 (...) @fail()
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ %4, %3 ], [ %6, %5 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ abort();
char *strdup(char const *);
char *sstrdup(const char *str) {
  char *s = NULL;
  if (!str)
    str = "";
  s = strdup(str);
  if (s)
    return s;
  abort();
}


x86 assembly (clang, -O0):
<sstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114a <sstrdup+0x2a>
lea    0xeba(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116c <sstrdup+0x4c>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<sstrdup>:
push   %rax
test   %rdi,%rdi
lea    0xed5(%rip),%rax
cmove  %rax,%rdi
call   1040 <strdup@plt>
test   %rax,%rax
je     113b <sstrdup+0x1b>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @sstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %3
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %7
7: ; preds = %6, %1
%8 = load i8*, i8** %2
%9 = call i8* @strdup(i8* %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = load i8*, i8** %3
ret i8* %13
14: ; preds = %7
%15 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define noalias i8* @sstrdup(i8* %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
%4 = tail call i8* @strdup(i8* %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
ret i8* %4
7: ; preds = %1
%8 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ pthread_self();
void cleanup_handler(void *data) {
  printf("cleanup thread %lu\n", pthread_self());
}


x86 assembly (clang, -O0):
<cleanup_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup_handler>:
push   %rax
xor    %eax,%eax
call   1040 <pthread_self@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"cleanup thread %lu\0A\00"
define void @cleanup_handler(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @pthread_self()
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"cleanup thread %lu\0A\00"
define void @cleanup_handler(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
int charToInt(char c) { return c - '0'; }


x86 assembly (clang, -O0):
<charToInt>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<charToInt>:
lea    -0x30(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @charToInt(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 48
ret i32 %5
}

LLVM IR (-O2):
define i32 @charToInt(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ numero;

/* Variables and functions */
int getint(char *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int numero = getint("Introduce un numero en binario: ");
  printf("%d", sizeof(numero));
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <getint@plt>
lea    0xeed(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Introduce un numero en binario: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 @getint(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 4)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Introduce un numero en binario: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @getint(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 4)
ret i32 0
}
void testFloat(_Atomic(float) *fp) {
  __c11_atomic_init(fp, 1.0f);
  _Atomic(float) x = 2.0f;
  float f = *fp;
  *fp = f;
}


x86 assembly (clang, -O0):
<testFloat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x3f800000,(%rax)
movl   $0x40000000,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%eax
xchg   %eax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<testFloat>:
movl   $0x3f800000,(%rdi)
mov    (%rdi),%eax
xchg   %eax,(%rdi)
ret

LLVM IR (-O0):
define void @testFloat(float* %0) {
%2 = alloca float*
%3 = alloca float
%4 = alloca float
store float* %0, float** %2
%5 = load float*, float** %2
store float 1.000000e+00, float* %5
store float 2.000000e+00, float* %3
%6 = load float*, float** %2
%7 = bitcast float* %6 to i32*
%8 = load atomic i32, i32* %7 seq_cst
%9 = bitcast i32 %8 to float
store float %9, float* %4
%10 = load float, float* %4
%11 = load float*, float** %2
%12 = bitcast float %10 to i32
%13 = bitcast float* %11 to i32*
store atomic i32 %12, i32* %13 seq_cst
ret void
}

LLVM IR (-O2):
define void @testFloat(float* nocapture %0) {
store float 1.000000e+00, float* %0
%2 = bitcast float* %0 to i32*
%3 = load atomic i32, i32* %2 seq_cst
store atomic i32 %3, i32* %2 seq_cst
ret void
}
/* Variables and functions */
int path_is_extension_tree(char const *, int /*<<< orphan*/ *);
int path_is_os_tree(const char *path) {
  return path_is_extension_tree(path, NULL);
}


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

x86 assembly (clang, -O2):
<path_is_os_tree>:
xor    %esi,%esi
jmp    1030 <path_is_extension_tree@plt>

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

LLVM IR (-O2):
define i32 @path_is_os_tree(i8* %0) {
%2 = tail call i32 @path_is_extension_tree(i8* %0, i32* null)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *checkedmalloc(size_t n) {
  void *p;
  if ((p = malloc(n)) == NULL) {
    fprintf(stderr, "Sorry, not enough memory available!\n");
    exit(1);
  }
  return p;
}


x86 assembly (clang, -O0):
<checkedmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1172 <checkedmalloc+0x42>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkedmalloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <checkedmalloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Sorry, not enough memory available!\0A\00"
define i8* @checkedmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Sorry, not enough memory available!\0A\00"
define noalias i8* @checkedmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
void dummy_fBGetFrameBufferInfo(void *p) {}


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

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

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

LLVM IR (-O2):
define void @dummy_fBGetFrameBufferInfo(i8* nocapture %0) {
ret void
}
void g_type_default_interface_ref() {}


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

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

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

LLVM IR (-O2):
define void @g_type_default_interface_ref() {
ret void
}
unsigned gameboy4x_generic_input_fmts(void) { return (1 << 0) | (1 << 1); }


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

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

LLVM IR (-O0):
define i32 @gameboy4x_generic_input_fmts() {
ret i32 3
}

LLVM IR (-O2):
define i32 @gameboy4x_generic_input_fmts() {
ret i32 3
}
float rho_theta(int number_of_blocks, int number_of_snps) {
  if (number_of_snps == 0 || number_of_blocks == 0) {
    return 0;
  }
  return (number_of_blocks * 1.0) / (number_of_snps * 1.0);
}


x86 assembly (clang, -O0):
<rho_theta>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     111e <rho_theta+0x1e>
cmpl   $0x0,-0x8(%rbp)
jne    112b <rho_theta+0x2b>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115a <rho_theta+0x5a>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xec8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xeb7(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rho_theta>:
xorps  %xmm0,%xmm0
test   %edi,%edi
je     111e <rho_theta+0x1e>
test   %esi,%esi
je     111e <rho_theta+0x1e>
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
cvtsi2sd %esi,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @rho_theta(i32 %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store float 0.000000e+00, float* %3
br label %21
12: ; preds = %8
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 1.000000e+00
%16 = load i32, i32* %5
%17 = sitofp i32 %16 to double
%18 = fmul double %17, 1.000000e+00
%19 = fdiv double %15, %18
%20 = fptrunc double %19 to float
store float %20, float* %3
br label %21
21: ; preds = %12, %11
%22 = load float, float* %3
ret float %22
}

LLVM IR (-O2):
define float @rho_theta(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = icmp eq i32 %0, 0
%5 = or i1 %4, %3
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = sitofp i32 %0 to double
%8 = sitofp i32 %1 to double
%9 = fdiv double %7, %8
%10 = fptrunc double %9 to float
br label %11
11: ; preds = %2, %6
%12 = phi float [ %10, %6 ], [ 0.000000e+00, %2 ]
ret float %12
}
/* Type definitions */
typedef int uint64_t;
typedef size_t uint32_t;

/* Variables and functions */
void increment_count(uint64_t *buffer, uint32_t pin) { buffer[pin] += 1; }


x86 assembly (clang, -O0):
<increment_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<increment_count>:
addl   $0x1,(%rdi,%rsi,4)
ret

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

LLVM IR (-O2):
define void @increment_count(i32* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 %1
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
store i32 %5, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RB_AUTOBOOT;
int /*<<< orphan*/ printf(char *);
int reboot(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  printf("rebooting... please wait.");
  return reboot(RB_AUTOBOOT);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
call   1040 <reboot@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <reboot@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"rebooting... please wait.\00"
@RB_AUTOBOOT = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @RB_AUTOBOOT
%8 = call i32 @reboot(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [26 x i8] c"rebooting... please wait.\00"
@RB_AUTOBOOT = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @RB_AUTOBOOT
%5 = tail call i32 @reboot(i32 %4)
ret i32 %5
}
void raise(int signal) {}


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

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

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

LLVM IR (-O2):
define void @raise(i32 %0) {
ret void
}
/* Variables and functions */
int strlen(char *);
char *strrchr(char *, char);
char *getFileExtension(char *path) {
  char *fext = strrchr(path, '.');
  if (fext)
    return fext + 1;
  return path + strlen(path);
}


x86 assembly (clang, -O0):
<getFileExtension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115a <getFileExtension+0x3a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    117b <getFileExtension+0x5b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileExtension>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2e,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     1139 <getFileExtension+0x19>
add    $0x1,%rax
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
add    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @getFileExtension(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
br label %10
6: ; preds = %1
%7 = tail call i32 @strlen(i8* %0)
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
br label %10
10: ; preds = %6, %4
%11 = phi i8* [ %5, %4 ], [ %9, %6 ]
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ xxx();
int main(void) {
  foo();
  xxx();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @foo()
%3 = call i32 (...) @xxx()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @xxx()
ret i32 0
}
/* Variables and functions */
char *modifyNickMode(int, void *);
char *opCmd(void *args) { return modifyNickMode(1, args); }


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

x86 assembly (clang, -O2):
<opCmd>:
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <modifyNickMode@plt>

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

LLVM IR (-O2):
define i8* @opCmd(i8* %0) {
%2 = tail call i8* @modifyNickMode(i32 1, i8* %0)
ret i8* %2
}
long fib(long n) {
  if (n == 0 || n == 1)
    return 1;
  else
    return fib(n - 1) + fib(n - 2);
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1132 <fib+0x22>
cmpq   $0x1,-0x10(%rbp)
jne    113f <fib+0x2f>
movq   $0x1,-0x8(%rbp)
jmp    116b <fib+0x5b>
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <fib@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x2,%rdi
call   1030 <fib@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
cmp    $0x2,%rdi
jb     114a <fib+0x3a>
mov    %rdi,%rbx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rbx),%rdi
call   1030 <fib@plt>
add    $0xfffffffffffffffe,%rbx
add    %rax,%r14
cmp    $0x1,%rbx
ja     1130 <fib+0x20>
add    $0x1,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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


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

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

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

LLVM IR (-O2):
define void @gdk_display_manager_get() {
ret void
}
/* Variables and functions */
int range_rand(int, int);
int rand5(void) { return range_rand(1, 5); }


x86 assembly (clang, -O0):
<rand5>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x5,%esi
call   1030 <range_rand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand5>:
mov    $0x1,%edi
mov    $0x5,%esi
jmp    1030 <range_rand@plt>

LLVM IR (-O0):
define i32 @rand5() {
%1 = call i32 @range_rand(i32 1, i32 5)
ret i32 %1
}

LLVM IR (-O2):
define i32 @rand5() {
%1 = tail call i32 @range_rand(i32 1, i32 5)
ret i32 %1
}
/* Variables and functions */
char *get_arg_ptr(char const *, int);
unsigned int get_args_count(const char *arg_str) {
  unsigned int count = 1;
  while ((arg_str = get_arg_ptr(arg_str, 1)) != 0)
    ++count;
  return count;
}


x86 assembly (clang, -O0):
<get_args_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <get_arg_ptr@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     114d <get_args_count+0x3d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <get_args_count+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_args_count>:
push   %rbx
mov    %rdi,%rax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %rax,%rdi
mov    $0x1,%esi
call   1030 <get_arg_ptr@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    1120 <get_args_count+0x10>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @get_args_count(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %5, %2 ]
%4 = phi i32 [ 1, %1 ], [ %7, %2 ]
%5 = tail call i8* @get_arg_ptr(i8* %3, i32 1)
%6 = icmp eq i8* %5, null
%7 = add i32 %4, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i32 %4
}
void pmu_set_sleep_low() {}


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

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

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

LLVM IR (-O2):
define void @pmu_set_sleep_low() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                          int);
uint64_t _wyr16(const uint8_t *p) {
  uint16_t v;
  memcpy(&v, p, 2);
  return v;
}


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

x86 assembly (clang, -O2):
<_wyr16>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x2,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @_wyr16(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i32* %2, i32* %0, i32 2)
%5 = load i32, i32* %2
ret i32 %5
}
double btic1g_ssqr(double f) { return ((f >= 0) ? (f * f) : (-f * f)); }


x86 assembly (clang, -O0):
<btic1g_ssqr>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     112f <btic1g_ssqr+0x2f>
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1155 <btic1g_ssqr+0x55>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<btic1g_ssqr>:
movapd 0xef8(%rip),%xmm1
xorpd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
cmpnlesd %xmm0,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
mulsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @btic1g_ssqr(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oge double %3, 0.000000e+00
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load double, double* %2
%7 = load double, double* %2
%8 = fmul double %6, %7
br label %14
9: ; preds = %1
%10 = load double, double* %2
%11 = fneg double %10
%12 = load double, double* %2
%13 = fmul double %11, %12
br label %14
14: ; preds = %9, %5
%15 = phi double [ %8, %5 ], [ %13, %9 ]
ret double %15
}

LLVM IR (-O2):
define double @btic1g_ssqr(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
%5 = fmul double %4, %0
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ cgincglob(char *, char *, int);
void cgdecpg(char *s, int v) { cgincglob("sub", s, v); }


x86 assembly (clang, -O0):
<cgdecpg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <cgincglob@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgdecpg>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <cgincglob@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"sub\00"
define void @cgdecpg(i8* %0, i32 %1) {
%3 = tail call i32 @cgincglob(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
void nseel_asm_booltofp(void) {
  __asm__("testl %eax, %eax\n"
          "jz 0f\n"
          "fld1\n"
          "jmp 1f\n"
          "0:\n"
          "fldz\n"
          "1:\n");
}


x86 assembly (clang, -O0):
<nseel_asm_booltofp>:
push   %rbp
mov    %rsp,%rbp
test   %eax,%eax
je     1113 <nseel_asm_booltofp+0x13>
fld1
jmp    1115 <nseel_asm_booltofp+0x15>
fldz
pop    %rbp
ret

x86 assembly (clang, -O2):
<nseel_asm_booltofp>:
test   %eax,%eax
je     1108 <nseel_asm_booltofp+0x8>
fld1
jmp    110a <nseel_asm_booltofp+0xa>
fldz
ret

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

LLVM IR (-O2):
define void @nseel_asm_booltofp() {
tail call void asm sideeffect "testl %eax, %eax\0Ajz 0f\0Afld1\0Ajmp 1f\0A0:\0Afldz\0A1:\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
unsigned inportb(unsigned port) {
  unsigned ret_val;
  asm volatile("inb %w1, %b0" : "=a"(ret_val) : "d"(port));
  return ret_val;
}


x86 assembly (clang, -O0):
<inportb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
in     (%dx),%al
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inportb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define i32 @inportb(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 asm sideeffect "inb ${1:w}, ${0:b}", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @inportb(i32 %0) {
%2 = tail call i32 asm sideeffect "inb ${1:w}, ${0:b}", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i32 %2
}
/* Variables and functions */
int check_arg_count(int, int /*<<< orphan*/);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
int /*<<< orphan*/ standout();
void cmd_standout(int nargs, char **args) {
  if (check_arg_count(nargs, 0) == 1)
    return;
  report_count(1);
  report_return(standout());
}


x86 assembly (clang, -O0):
<cmd_standout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1167 <cmd_standout+0x27>
jmp    117f <cmd_standout+0x3f>
mov    $0x1,%edi
call   1050 <report_count@plt>
mov    $0x0,%al
call   1060 <standout@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_standout>:
push   %rax
xor    %esi,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    114f <cmd_standout+0xf>
pop    %rax
ret
mov    $0x1,%edi
call   1050 <report_count@plt>
xor    %eax,%eax
call   1060 <standout@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <report_return@plt>

LLVM IR (-O0):
define void @cmd_standout(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 0)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %13
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 (...) @standout()
%12 = call i32 @report_return(i32 %11)
br label %13
13: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
define void @cmd_standout(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 0)
%4 = icmp eq i32 %3, 1
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 (...) @standout()
%8 = tail call i32 @report_return(i32 %7)
br label %9
9: ; preds = %2, %5
ret void
}
void d_fetchsb(const unsigned char **ptr, signed char *dest) {
  *dest = *(*ptr)++;
}


x86 assembly (clang, -O0):
<d_fetchsb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_fetchsb>:
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
mov    (%rax),%al
mov    %al,(%rsi)
ret

LLVM IR (-O0):
define void @d_fetchsb(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** %5
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %5
%8 = load i8, i8* %6
%9 = load i8*, i8** %4
store i8 %8, i8* %9
ret void
}

LLVM IR (-O2):
define void @d_fetchsb(i8** nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8*, i8** %0
%4 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %4, i8** %0
%5 = load i8, i8* %3
store i8 %5, i8* %1
ret void
}
/* Variables and functions */
int f398(int *);
int f399(int *p) { return f398(p); }


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

x86 assembly (clang, -O2):
<f399>:
jmp    1030 <f398@plt>

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

LLVM IR (-O2):
define i32 @f399(i32* %0) {
%2 = tail call i32 @f398(i32* %0)
ret i32 %2
}