xunge/DecIR huggingface dataset:
void _gfortran_caf_init(int *argc __attribute__((unused)),
                        char ***argv __attribute__((unused)), int *this_image,
                        int *num_images) {
  *this_image = 1;
  *num_images = 1;
}


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

x86 assembly (clang, -O2):
<_gfortran_caf_init>:
movl   $0x1,(%rdx)
movl   $0x1,(%rcx)
ret

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

LLVM IR (-O2):
define void @_gfortran_caf_init(i32* nocapture readnone %0, i8*** nocapture readnone %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
store i32 1, i32* %2
store i32 1, i32* %3
ret void
}
/* Type definitions */
typedef int int8_t;

/* Variables and functions */
int8_t f8i(int8_t x) { return x ^ 1; }


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

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

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

LLVM IR (-O2):
define i32 @f8i(i32 %0) {
%2 = xor i32 %0, 1
ret i32 %2
}
/* Variables and functions */
char EOF;
char fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
char saisieChar() {
  char temp = fgetc(stdin);
  while (temp == '\n' || temp == EOF) {
    temp = fgetc(stdin);
  }
  return temp;
}


x86 assembly (clang, -O0):
<saisieChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     1151 <saisieChar+0x41>
movsbl -0x1(%rbp),%eax
mov    0x2e9a(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1161 <saisieChar+0x51>
jmp    1177 <saisieChar+0x67>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %al,-0x1(%rbp)
jmp    1129 <saisieChar+0x19>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saisieChar>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fgetc@plt>
mov    0x2eb7(%rip),%r14
jmp    1137 <saisieChar+0x27>
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edi
call   1030 <fgetc@plt>
cmp    $0xa,%al
je     1130 <saisieChar+0x20>
cmp    (%r14),%al
je     1130 <saisieChar+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i8 0
define signext i8 @saisieChar() {
%1 = load i32, i32* @stdin
%2 = tail call signext i8 @fgetc(i32 %1)
%3 = icmp eq i8 %2, 10
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %2, %4
%6 = select i1 %3, i1 true, i1 %5
br i1 %6, label %7, label %14
7: ; preds = %0, %7
%8 = load i32, i32* @stdin
%9 = tail call signext i8 @fgetc(i32 %8)
%10 = icmp eq i8 %9, 10
%11 = load i8, i8* @EOF
%12 = icmp eq i8 %9, %11
%13 = select i1 %10, i1 true, i1 %12
br i1 %13, label %7, label %14
14: ; preds = %7, %0
%15 = phi i8 [ %2, %0 ], [ %9, %7 ]
ret i8 %15
}
/* Variables and functions */
void const *GppcFinfoV1();
const void *pg_finfo_spifunc4(void) { return GppcFinfoV1(); }


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

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

LLVM IR (-O0):
define i8* @pg_finfo_spifunc4() {
%1 = call i8* (...) @GppcFinfoV1()
ret i8* %1
}

LLVM IR (-O2):
define i8* @pg_finfo_spifunc4() {
%1 = tail call i8* (...) @GppcFinfoV1()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int i;
  int j;
  i = j;
  while (i < 100) {
    i = i + 1;
    j = j + 1;
  }
  assert(i == j + 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1146 <main+0x36>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <main+0x15>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
void f(int *p) { free(p); }


x86 assembly (clang, -O0):
<f>:
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):
<f>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @f(i32* nocapture %0) {
%2 = tail call i32 @free(i32* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void RB_XMLDB_Generate_Item_End(FILE *dest_doc) {
  (dest_doc = dest_doc);
  ;
}


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

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

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

LLVM IR (-O2):
define void @RB_XMLDB_Generate_Item_End(i32* nocapture %0) {
ret void
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int16_t mul_int16_t(int16_t a, int16_t b) { return a * b; }


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

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

LLVM IR (-O0):
define i32 @mul_int16_t(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 = mul nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @mul_int16_t(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
int packet_format(struct packet_t *p, void *data) {}


x86 assembly (clang, -O0):
<packet_format>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.packet_t = type opaque
define i32 @packet_format(%struct.packet_t* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.packet_t*
%5 = alloca i8*
store %struct.packet_t* %0, %struct.packet_t** %4
store i8* %1, i8** %5
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.packet_t = type opaque
define i32 @packet_format(%struct.packet_t* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 undef
}
void kolibri_window_define(unsigned x, unsigned y, unsigned w, unsigned h,
                           unsigned cs, unsigned b, char *t) {
  asm volatile("int $0x40" ::"a"(0), "b"(x * 65536 + w), "c"(y * 65536 + h),
               "d"(cs), "D"(t), "S"(b));
}


x86 assembly (clang, -O0):
<kolibri_window_define>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    0x10(%rbp),%rax
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0xc(%rbp),%ebx
shl    $0x10,%ebx
add    -0x14(%rbp),%ebx
mov    -0x10(%rbp),%ecx
shl    $0x10,%ecx
add    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%edx
mov    0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
xor    %eax,%eax
int    $0x40
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kolibri_window_define>:
push   %rbx
mov    0x10(%rsp),%r10
shl    $0x10,%edi
lea    (%rdi,%rdx,1),%ebx
shl    $0x10,%esi
add    %esi,%ecx
xor    %eax,%eax
mov    %r10,%rdi
mov    %r9d,%esi
mov    %r8d,%edx
int    $0x40
pop    %rbx
ret

LLVM IR (-O0):
define void @kolibri_window_define(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i8* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8*
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
store i8* %6, i8** %14
%15 = load i32, i32* %8
%16 = mul i32 %15, 65536
%17 = load i32, i32* %10
%18 = add i32 %16, %17
%19 = load i32, i32* %9
%20 = mul i32 %19, 65536
%21 = load i32, i32* %11
%22 = add i32 %20, %21
%23 = load i32, i32* %12
%24 = load i8*, i8** %14
%25 = load i32, i32* %13
ret void
}

LLVM IR (-O2):
define void @kolibri_window_define(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i8* %6) {
%8 = shl i32 %0, 16
%9 = add i32 %8, %2
%10 = shl i32 %1, 16
%11 = add i32 %10, %3
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},{dx},{di},{si},~{dirflag},~{fpsr},~{flags}"(i32 0, i32 %9, i32 %11, i32 %4, i8* %6, i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_cpu();
int /*<<< orphan*/ irq_enter();
int /*<<< orphan*/ irq_exit();
int /*<<< orphan*/ local_irq_disable();
int /*<<< orphan*/ local_irq_enable();
int /*<<< orphan*/ rcu_check_callbacks(int /*<<< orphan*/, int /*<<< orphan*/);
void do_IRQ(void) {
  local_irq_disable();
  irq_enter();
  rcu_check_callbacks(get_cpu(), 0);
  local_irq_enable();
  irq_exit();
}


x86 assembly (clang, -O0):
<do_IRQ>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <local_irq_disable@plt>
mov    $0x0,%al
call   1050 <irq_enter@plt>
mov    $0x0,%al
call   1040 <get_cpu@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1030 <rcu_check_callbacks@plt>
mov    $0x0,%al
call   1070 <local_irq_enable@plt>
mov    $0x0,%al
call   1080 <irq_exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_IRQ>:
push   %rax
xor    %eax,%eax
call   1060 <local_irq_disable@plt>
xor    %eax,%eax
call   1050 <irq_enter@plt>
xor    %eax,%eax
call   1040 <get_cpu@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1030 <rcu_check_callbacks@plt>
xor    %eax,%eax
call   1070 <local_irq_enable@plt>
xor    %eax,%eax
pop    %rcx
jmp    1080 <irq_exit@plt>

LLVM IR (-O0):
define void @do_IRQ() {
%1 = call i32 (...) @local_irq_disable()
%2 = call i32 (...) @irq_enter()
%3 = call i32 (...) @get_cpu()
%4 = call i32 @rcu_check_callbacks(i32 %3, i32 0)
%5 = call i32 (...) @local_irq_enable()
%6 = call i32 (...) @irq_exit()
ret void
}

LLVM IR (-O2):
define void @do_IRQ() {
%1 = tail call i32 (...) @local_irq_disable()
%2 = tail call i32 (...) @irq_enter()
%3 = tail call i32 (...) @get_cpu()
%4 = tail call i32 @rcu_check_callbacks(i32 %3, i32 0)
%5 = tail call i32 (...) @local_irq_enable()
%6 = tail call i32 (...) @irq_exit()
ret void
}
int sd_listen_fds(int unset_environment) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @sd_listen_fds(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ basics();
int /*<<< orphan*/ functions();
int /*<<< orphan*/ multiple();
int /*<<< orphan*/ sizes();
int main(void) {
  basics();
  sizes();
  multiple();
  functions();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <basics@plt>
mov    $0x0,%al
call   1030 <sizes@plt>
mov    $0x0,%al
call   1040 <multiple@plt>
mov    $0x0,%al
call   1050 <functions@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <basics@plt>
xor    %eax,%eax
call   1030 <sizes@plt>
xor    %eax,%eax
call   1040 <multiple@plt>
xor    %eax,%eax
call   1050 <functions@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @basics()
%2 = call i32 (...) @sizes()
%3 = call i32 (...) @multiple()
%4 = call i32 (...) @functions()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @basics()
%2 = tail call i32 (...) @sizes()
%3 = tail call i32 (...) @multiple()
%4 = tail call i32 (...) @functions()
ret i32 0
}
void RAWToRGBARow_SSSE3() {}


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

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

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

LLVM IR (-O2):
define void @RAWToRGBARow_SSSE3() {
ret void
}
double dfn_rd(void) { return 7; }


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

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

LLVM IR (-O0):
define double @dfn_rd() {
ret double 7.000000e+00
}

LLVM IR (-O2):
define double @dfn_rd() {
ret double 7.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_socket_client_unref() {
  printf("NOT IMPLEMENTED:"
         "pa_socket_client_unref"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [39 x i8] c"NOT IMPLEMENTED:pa_socket_client_unref\00"
define i32 @pa_socket_client_unref() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int g(int n) { return 3 * n - 1; }


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

x86 assembly (clang, -O2):
<g>:
lea    (%rdi,%rdi,2),%eax
add    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @g(i32 %0) {
%2 = mul nsw i32 %0, 3
%3 = add nsw i32 %2, -1
ret i32 %3
}
unsigned long long cycles() {
  unsigned long long u;
  asm volatile("rdtscp;shlq $32,%%rdx;orq %%rdx,%%rax;movq %%rax,%0"
               : "=q"(u)::"%rax", "%rdx", "rcx");
  return u;
}


x86 assembly (clang, -O0):
<cycles>:
push   %rbp
mov    %rsp,%rbp
rdtscp
shl    $0x20,%rdx
or     %rdx,%rax
mov    %rax,%rsi
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cycles>:
rdtscp
shl    $0x20,%rdx
or     %rdx,%rax
mov    %rax,%rsi
mov    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @cycles() {
%1 = alloca i64
%2 = call i64 asm sideeffect "rdtscp;shlq $$32,%rdx;orq %rdx,%rax;movq %rax,$0", "=q,~{rax},~{rdx},~{rcx},~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @cycles() {
%1 = tail call i64 asm sideeffect "rdtscp;shlq $$32,%rdx;orq %rdx,%rax;movq %rax,$0", "=q,~{rax},~{rdx},~{rcx},~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned char *ripemd320_file(unsigned char *, int /*<<< orphan*/ *);
unsigned char *hash_file_ripemd320(unsigned char *out, FILE *fp) {
  return ripemd320_file(out, fp);
}


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

x86 assembly (clang, -O2):
<hash_file_ripemd320>:
jmp    1030 <ripemd320_file@plt>

LLVM IR (-O0):
define i8* @hash_file_ripemd320(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 i8* @ripemd320_file(i8* %5, i32* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @hash_file_ripemd320(i8* %0, i32* %1) {
%3 = tail call i8* @ripemd320_file(i8* %0, i32* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void *realloc(void *, size_t);
void *xrealloc(void *pptr, size_t size) {
  void *ptr = realloc(pptr, size);
  if (ptr == NULL) {
    printf("stderr: realloc failed\n");
    exit(1);
  }
  return ptr;
}


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

x86 assembly (clang, -O2):
<xrealloc>:
push   %rax
call   1040 <realloc@plt>
test   %rax,%rax
je     113d <xrealloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@str = [23 x i8] c"stderr: realloc failed\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret i8* %3
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void set_sdram_timings_x(void) {
  *(uint32_t *)(0x4C000018) = (uint32_t)(0x0AAAD4DB);
  *(uint32_t *)(0x4C00001C) = (uint32_t)(0x0AAAD4DB);
  *(uint32_t *)(0x4C000020) = (uint32_t)(0x266B7FDA);
  *(uint32_t *)(0x4C000024) = (uint32_t)(0x266B7FDA);
  *(uint32_t *)(0x4C000028) = (uint32_t)(0x501F867F);
  *(uint32_t *)(0x4C00002C) = (uint32_t)(0x501F867F);
}


x86 assembly (clang, -O0):
<set_sdram_timings_x>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4c000018,%eax
movq   $0xaaad4db,(%rax)
mov    $0x4c00001c,%eax
movq   $0xaaad4db,(%rax)
mov    $0x4c000020,%eax
movq   $0x266b7fda,(%rax)
mov    $0x4c000024,%eax
movq   $0x266b7fda,(%rax)
mov    $0x4c000028,%eax
movq   $0x501f867f,(%rax)
mov    $0x4c00002c,%eax
movq   $0x501f867f,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_sdram_timings_x>:
movq   $0xaaad4db,0x4c000018
4c db d4 aa 0a
movq   $0xaaad4db,0x4c00001c
4c db d4 aa 0a
movq   $0x266b7fda,0x4c000020
4c da 7f 6b 26
movq   $0x266b7fda,0x4c000024
4c da 7f 6b 26
movq   $0x501f867f,0x4c000028
4c 7f 86 1f 50
movq   $0x501f867f,0x4c00002c
4c 7f 86 1f 50
ret

LLVM IR (-O0):
define void @set_sdram_timings_x() {
store i64 178967771, i64* inttoptr (i64 1275068440 to i64*)
store i64 178967771, i64* inttoptr (i64 1275068444 to i64*)
store i64 644579290, i64* inttoptr (i64 1275068448 to i64*)
store i64 644579290, i64* inttoptr (i64 1275068452 to i64*)
store i64 1344243327, i64* inttoptr (i64 1275068456 to i64*)
store i64 1344243327, i64* inttoptr (i64 1275068460 to i64*)
ret void
}

LLVM IR (-O2):
define void @set_sdram_timings_x() {
store i64 178967771, i64* inttoptr (i64 1275068440 to i64*)
store i64 178967771, i64* inttoptr (i64 1275068444 to i64*)
store i64 644579290, i64* inttoptr (i64 1275068448 to i64*)
store i64 644579290, i64* inttoptr (i64 1275068452 to i64*)
store i64 1344243327, i64* inttoptr (i64 1275068456 to i64*)
store i64 1344243327, i64* inttoptr (i64 1275068460 to i64*)
ret void
}
const char *ccnxControlAPIAbout_ShortNotice(void) {
  return "Copyright (c) 2017 Cisco and/or its affiliates.\n";
}


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

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

LLVM IR (-O0):
@.str = [49 x i8] c"Copyright (c) 2017 Cisco and/or its affiliates.\0A\00"
define i8* @ccnxControlAPIAbout_ShortNotice() {
ret i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [49 x i8] c"Copyright (c) 2017 Cisco and/or its affiliates.\0A\00"
define i8* @ccnxControlAPIAbout_ShortNotice() {
ret i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0)
}
void motorisr(void) {}


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

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

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

LLVM IR (-O2):
define void @motorisr() {
ret void
}
void g_string_new() {}


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

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

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

LLVM IR (-O2):
define void @g_string_new() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Sys_failure(char *);
int munmap(void *, size_t);
void Munmap(void *start, size_t length) {
  int retval;
  retval = munmap(start, length);
  if (retval == -1) {
    Sys_failure("munmap");
  }
}


x86 assembly (clang, -O0):
<Munmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <munmap@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1156 <Munmap+0x36>
lea    0xeaf(%rip),%rdi
call   1030 <Sys_failure@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Munmap>:
push   %rax
call   1040 <munmap@plt>
cmp    $0xffffffff,%eax
je     112d <Munmap+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1030 <Sys_failure@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"munmap\00"
define void @Munmap(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i32 @munmap(i8* %6, i64 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @Sys_failure(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"munmap\00"
define void @Munmap(i8* %0, i64 %1) {
%3 = tail call i32 @munmap(i8* %0, i64 %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @Sys_failure(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret void
}
int test_01(unsigned char *a) { return a[0] + (a[0] < 128); }


x86 assembly (clang, -O0):
<test_01>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
cmp    $0x80,%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_01>:
movzbl (%rdi),%ecx
mov    %ecx,%eax
not    %al
shr    $0x7,%al
movzbl %al,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_01(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = icmp slt i32 %10, 128
%12 = zext i1 %11 to i32
%13 = add nsw i32 %6, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @test_01(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = xor i8 %2, -1
%5 = lshr i8 %4, 7
%6 = zext i8 %5 to i32
%7 = add nuw nsw i32 %6, %3
ret i32 %7
}
int chaos_abs(int x) { return x > 0 ? x : -x; }


x86 assembly (clang, -O0):
<chaos_abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    111c <chaos_abs+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <chaos_abs+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @chaos_abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int);
const char *xitoa(int num) {
  static char buf[24];
  snprintf(buf, sizeof(buf), "%d", num);
  return buf;
}


x86 assembly (clang, -O0):
<xitoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
lea    0x2f1b(%rip),%rdi
mov    $0x18,%esi
lea    0xecf(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2f03(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xitoa>:
push   %rbx
mov    %edi,%ecx
lea    0x2f26(%rip),%rbx
lea    0xedf(%rip),%rdx
mov    %rbx,%rdi
mov    $0x18,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@xitoa.buf = internal global [24 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
define i8* @xitoa(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @snprintf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @xitoa.buf, i64 0, i64 0), i32 24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* getelementptr inbounds ([24 x i8], [24 x i8]* @xitoa.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@xitoa.buf = internal global [24 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
define i8* @xitoa(i32 %0) {
%2 = tail call i32 @snprintf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @xitoa.buf, i64 0, i64 0), i32 24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* getelementptr inbounds ([24 x i8], [24 x i8]* @xitoa.buf, i64 0, i64 0)
}
main(void) {
  char *cp = "\"$B1 (B\"";
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    0xeee(%rip),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int test_imm_E3int8_reg(signed char val) {
  return ((val) & (-0xE3 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E3int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffff1d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E3int8_reg>:
test   $0xffffff1d,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_E3int8_reg(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = and i32 %2, -227
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void nebu_debug_memory_CheckLeaksOnExit(void) {}


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

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

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

LLVM IR (-O2):
define void @nebu_debug_memory_CheckLeaksOnExit() {
ret void
}
/* Variables and functions */
double RadToDeg(double);
double MercatorInverseLongitudeSimple(double x) { return RadToDeg(x); }


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

x86 assembly (clang, -O2):
<MercatorInverseLongitudeSimple>:
jmp    1030 <RadToDeg@plt>

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

LLVM IR (-O2):
define double @MercatorInverseLongitudeSimple(double %0) {
%2 = tail call double @RadToDeg(double %0)
ret double %2
}
void __down_read(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<__down_read>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__down_read>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.__down_read = [12 x i8] c"__down_read\00"
define void @__down_read() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.__down_read, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.__down_read = [12 x i8] c"__down_read\00"
define void @__down_read() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.__down_read, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int foo(int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  assert(foo(0, 0) == 1);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1040 <foo@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@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(i32 0, i32 0)
%3 = icmp eq i32 %2, 1
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 0, i32 0)
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void call(int a, int b) { printf("%d %d\n", a, b); }


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

x86 assembly (clang, -O2):
<call>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
define void @call(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 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define void @call(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
double factorial(int n) {
  if (n == 0)
    return 1;
  else
    return (n * factorial(n - 1));
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1137 <factorial+0x27>
movsd  0xed3(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115d <factorial+0x4d>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <factorial@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
push   %rax
test   %edi,%edi
je     112d <factorial+0x1d>
cvtsi2sd %edi,%xmm0
movsd  %xmm0,(%rsp)
add    $0xffffffff,%edi
call   1030 <factorial@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret
movsd  0xecb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @factorial(i32 %0) {
%2 = alloca double
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store double 1.000000e+00, double* %2
br label %14
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to double
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 1
%12 = call double @factorial(i32 %11)
%13 = fmul double %9, %12
store double %13, double* %2
br label %14
14: ; preds = %7, %6
%15 = load double, double* %2
ret double %15
}

LLVM IR (-O2):
define double @factorial(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi double [ %9, %5 ], [ 1.000000e+00, %1 ]
ret double %4
5: ; preds = %1
%6 = sitofp i32 %0 to double
%7 = add nsw i32 %0, -1
%8 = tail call double @factorial(i32 %7)
%9 = fmul double %8, %6
br label %3
}
/* Variables and functions */
int make_f2fs_main(int, char **);
int main(int argc, char **argv) { return make_f2fs_main(argc, argv); }


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

x86 assembly (clang, -O2):
<main>:
jmp    1030 <make_f2fs_main@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @make_f2fs_main(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
int inp_emulate(int);
char TOSH_READ_RADIO_GIO0_PIN() { return 0x01 & (inp_emulate(-2) >> 5); }


x86 assembly (clang, -O0):
<TOSH_READ_RADIO_GIO0_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffe,%edi
call   1030 <inp_emulate@plt>
sar    $0x5,%eax
and    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_READ_RADIO_GIO0_PIN>:
push   %rax
mov    $0xfffffffe,%edi
call   1030 <inp_emulate@plt>
shr    $0x5,%al
and    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @TOSH_READ_RADIO_GIO0_PIN() {
%1 = call i32 @inp_emulate(i32 -2)
%2 = ashr i32 %1, 5
%3 = and i32 1, %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @TOSH_READ_RADIO_GIO0_PIN() {
%1 = tail call i32 @inp_emulate(i32 -2)
%2 = trunc i32 %1 to i8
%3 = lshr i8 %2, 5
%4 = and i8 %3, 1
ret i8 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ read;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fread(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
uint32_t ReadUint32(FILE *file) {
  uint32_t read;
  if (fread(&read, sizeof(read), 1, file) != 1)
    return 0;
  return ntohl(read);
}


x86 assembly (clang, -O0):
<ReadUint32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     1158 <ReadUint32+0x38>
movl   $0x0,-0x4(%rbp)
jmp    1163 <ReadUint32+0x43>
mov    -0x14(%rbp),%edi
call   1040 <ntohl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadUint32>:
push   %rax
mov    %rdi,%rcx
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    1147 <ReadUint32+0x27>
mov    0x4(%rsp),%edi
pop    %rax
jmp    1040 <ntohl@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @ReadUint32(i32* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @fread(i32* %2, i32 4, i32 1, i32* %0)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = tail call i32 @ntohl(i32 %7)
br label %9
9: ; preds = %1, %6
%10 = phi i32 [ %8, %6 ], [ 0, %1 ]
ret i32 %10
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((used)) __attribute__((visibility("default"))) uint32_t
fib(uint32_t n) {
  if (n < 2) {
    return n;
  }
  return fib(n - 1) + fib(n - 2);
}


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

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

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32)* @fib to i8*)], section "llvm.metadata"
define i32 @fib(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* %3
store i32 %7, i32* %2
br label %16
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = call i32 @fib(i32 %10)
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 2
%14 = call i32 @fib(i32 %13)
%15 = add nsw i32 %11, %14
store i32 %15, i32* %2
br label %16
16: ; preds = %8, %6
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32)* @fib to i8*)], section "llvm.metadata"
define i32 @fib(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 4
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %9, %3 ]
%13 = phi i32 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i32 %13, %12
ret i32 %14
}
/* Variables and functions */
void *yella_default_ptr_copier(void *elem, void *udata) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @yella_default_ptr_copier(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *);
int /*<<< orphan*/ output_byte(int);
void emit_cdq() {
  assem_debug("cdq\n");
  output_byte(0x99);
}


x86 assembly (clang, -O0):
<emit_cdq>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0x99,%edi
call   1040 <output_byte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_cdq>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0x99,%edi
pop    %rax
jmp    1040 <output_byte@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"cdq\0A\00"
define void @emit_cdq() {
%1 = call i32 @assem_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @output_byte(i32 153)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"cdq\0A\00"
define void @emit_cdq() {
%1 = tail call i32 @assem_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @output_byte(i32 153)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage:\n");
  printf("	lookup_trace -a NVXX -e event\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [32 x i8] c"\09lookup_trace -a NVXX -e event\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [7 x i8] c"Usage:\00"
@str.2 = [31 x i8] c"\09lookup_trace -a NVXX -e event\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t isqrt(uint64_t x) {
  uint64_t root;
  uint64_t new_root = x;
  do {
    root = new_root;
    new_root = (root + x / root) / 2;
  } while (new_root < root);
  return root;
}


x86 assembly (clang, -O0):
<isqrt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     110d <isqrt+0xd>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isqrt>:
mov    %edi,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %edx,%ecx
mov    %edi,%eax
cltd
idiv   %ecx
add    %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
cmp    %ecx,%edx
jl     1110 <isqrt+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @isqrt(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %6, %2 ]
%4 = sdiv i32 %0, %3
%5 = add nsw i32 %4, %3
%6 = sdiv i32 %5, 2
%7 = icmp slt i32 %6, %3
br i1 %7, label %2, label %8
8: ; preds = %2
ret i32 %3
}