xunge/DecIR huggingface dataset:
/* Type definitions */
typedef char *uint16_t;

/* Variables and functions */
__attribute__((always_)) uint16_t __attribute__((const))
OF_BSWAP16_NONCONST(uint16_t i) {
  __asm__("xchgb  %h0, %b0" : "=Q"(i) : "0"(i));
  return i;
}


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

x86 assembly (clang, -O2):
<OF_BSWAP16_NONCONST>:
mov    %rdi,%rax
xchg   %al,%ah
ret

LLVM IR (-O0):
define i8* @OF_BSWAP16_NONCONST(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* asm "xchgb ${0:h}, ${0:b}", "=Q,0,~{dirflag},~{fpsr},~{flags}"(i8* %3)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define i8* @OF_BSWAP16_NONCONST(i8* readnone %0) {
%2 = tail call i8* asm "xchgb ${0:h}, ${0:b}", "=Q,0,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *, int, int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ output_w32(int);
void emit_fcvt_d_s(int rs, int rd) {
  assert(rs == 31);
  assert(rd == 31);
  assem_debug("fcvt d%d,s%d", rd, rs);
  output_w32(0x1e22c000 | rs << 5 | rd);
}


x86 assembly (clang, -O0):
<emit_fcvt_d_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1f,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x1f,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe93(%rip),%rdi
call   1030 <assem_debug@plt>
mov    -0x4(%rbp),%edi
shl    $0x5,%edi
or     $0x1e22c000,%edi
or     -0x8(%rbp),%edi
call   1040 <output_w32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fcvt_d_s>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x1f,%ebx
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmp    $0x1f,%ebp
sete   %dil
call   1050 <assert@plt>
lea    0xea6(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <assem_debug@plt>
shl    $0x5,%ebx
or     %ebp,%ebx
or     $0x1e22c000,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <output_w32@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"fcvt d%d,s%d\00"
define void @emit_fcvt_d_s(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 = icmp eq i32 %5, 31
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 31
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = call i32 @assem_debug(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* %3
%17 = shl i32 %16, 5
%18 = or i32 505593856, %17
%19 = load i32, i32* %4
%20 = or i32 %18, %19
%21 = call i32 @output_w32(i32 %20)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"fcvt d%d,s%d\00"
define void @emit_fcvt_d_s(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 31
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp eq i32 %1, 31
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @assem_debug(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0)
%10 = shl i32 %0, 5
%11 = or i32 %10, %1
%12 = or i32 %11, 505593856
%13 = tail call i32 @output_w32(i32 %12)
ret void
}
int ld_bgt_cr1(long double a1) { return (__builtin_isgreater(100, a1)); }


x86 assembly (clang, -O0):
<ld_bgt_cr1>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
flds   0xeed(%rip)
fucomip %st(1),%st
fstp   %st(0)
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_bgt_cr1>:
fldt   0x8(%rsp)
flds   0xef6(%rip)
xor    %eax,%eax
fucomip %st(1),%st
fstp   %st(0)
seta   %al
ret

LLVM IR (-O0):
define i32 @ld_bgt_cr1(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fcmp ogt x86_fp80 0xK4005C800000000000000, %3
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @ld_bgt_cr1(x86_fp80 %0) {
%2 = fcmp olt x86_fp80 %0, 0xK4005C800000000000000
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
void *oomalloc(size_t n, const void *f) { return 0; }


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

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

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

LLVM IR (-O2):
define noalias i8* @oomalloc(i64 %0, i8* nocapture readnone %1) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ garglk_unput_string_count(char *);
void garglk_unput_string(char *s) {
  garglk_unput_string_count((char *)s);
  return;
}


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

x86 assembly (clang, -O2):
<garglk_unput_string>:
jmp    1030 <garglk_unput_string_count@plt>

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

LLVM IR (-O2):
define void @garglk_unput_string(i8* %0) {
%2 = tail call i32 @garglk_unput_string_count(i8* %0)
ret void
}
void set_start_line(int line) {
  int start_addr = line * 80;
  asm volatile("outb %0, %1\n\t" ::"a"((unsigned char)(0xd)),
               "dN"((unsigned short)(0x3d4)));
  asm volatile("outb %0, %1\n\t" ::"a"((unsigned char)(start_addr & 0xff)),
               "dN"((unsigned short)(0x3d5)));
  asm volatile("outb %0, %1\n\t" ::"a"((unsigned char)(0xc)),
               "dN"((unsigned short)(0x3d4)));
  asm volatile(
      "outb %0, %1\n\t" ::"a"((unsigned char)((start_addr >> 8) & 0xff)),
      "dN"((unsigned short)(0x3d5)));
}


x86 assembly (clang, -O0):
<set_start_line>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x50,-0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0xd,%al
mov    $0x3d4,%dx
out    %al,(%dx)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    $0x3d5,%dx
out    %al,(%dx)
mov    $0xc,%al
mov    $0x3d4,%dx
out    %al,(%dx)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    $0x3d5,%dx
out    %al,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_start_line>:
shl    $0x4,%edi
lea    (%rdi,%rdi,4),%ecx
mov    $0xd,%al
mov    $0x3d4,%dx
out    %al,(%dx)
mov    %ecx,%eax
mov    $0x3d5,%dx
out    %al,(%dx)
mov    $0xc,%al
mov    $0x3d4,%dx
out    %al,(%dx)
shr    $0x8,%ecx
mov    %ecx,%eax
mov    $0x3d5,%dx
out    %al,(%dx)
ret

LLVM IR (-O0):
define void @set_start_line(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %4, 80
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = load i32, i32* %3
%10 = ashr i32 %9, 8
%11 = and i32 %10, 255
%12 = trunc i32 %11 to i8
ret void
}

LLVM IR (-O2):
define void @set_start_line(i32 %0) {
%2 = mul nsw i32 %0, 80
tail call void asm sideeffect "outb $0, $1\0A\09", "{ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i8 13, i16 980)
%3 = trunc i32 %2 to i8
tail call void asm sideeffect "outb $0, $1\0A\09", "{ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i8 %3, i16 981)
tail call void asm sideeffect "outb $0, $1\0A\09", "{ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i8 12, i16 980)
%4 = lshr i32 %2, 8
%5 = trunc i32 %4 to i8
tail call void asm sideeffect "outb $0, $1\0A\09", "{ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i8 %5, i16 981)
ret void
}
int test_imm_A1uint8_mem(unsigned char *val) {
  return ((*val) & (-0xA1 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A1uint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xffffff5f,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A1uint8_mem>:
testb  $0x5f,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A1uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 95
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void child_function(void) {}


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

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

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

LLVM IR (-O2):
define void @child_function() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
scalar_t__ sw_sync_timeline_is_valid(int);
void sw_sync_timeline_destroy(int fd) {
  if (sw_sync_timeline_is_valid(fd))
    close(fd);
}


x86 assembly (clang, -O0):
<sw_sync_timeline_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sw_sync_timeline_is_valid@plt>
cmp    $0x0,%rax
je     1145 <sw_sync_timeline_destroy+0x25>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sw_sync_timeline_destroy>:
push   %rbx
mov    %edi,%ebx
call   1040 <sw_sync_timeline_is_valid@plt>
test   %rax,%rax
je     1135 <sw_sync_timeline_destroy+0x15>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <close@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @sw_sync_timeline_destroy(i32 %0) {
%2 = tail call i64 @sw_sync_timeline_is_valid(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @close(i32 %0)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ xfer_log_init_by_cfg(char *);
void xfer_log_init() {
  xfer_log_init_by_cfg("xfer.conf");
  return;
}


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"xfer.conf\00"
define void @xfer_log_init() {
%1 = call i32 @xfer_log_init_by_cfg(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"xfer.conf\00"
define void @xfer_log_init() {
%1 = tail call i32 @xfer_log_init_by_cfg(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int x(unsigned int);
unsigned int g(unsigned int a) { return x(a) << 24; }


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

x86 assembly (clang, -O2):
<g>:
push   %rax
call   1030 <x@plt>
shl    $0x18,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @g(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @x(i32 %3)
%5 = shl i32 %4, 24
ret i32 %5
}

LLVM IR (-O2):
define i32 @g(i32 %0) {
%2 = tail call i32 @x(i32 %0)
%3 = shl i32 %2, 24
ret i32 %3
}
void producer(int *x) {
  for (int i = 0; i < 1000; i++) {
    for (int j = 0; j < 1000; j++) {
    }
  }
  *x = 1;
}


x86 assembly (clang, -O0):
<producer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1156 <producer+0x56>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3e8,-0x10(%rbp)
jge    1143 <producer+0x43>
jmp    1135 <producer+0x35>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <producer+0x23>
jmp    1148 <producer+0x48>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <producer+0xf>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<producer>:
movl   $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @producer(i32* nocapture writeonly %0) {
store i32 1, i32* %0
ret void
}
/* Type definitions */
struct _pdinstance {
  int dummy;
};

/* Variables and functions */
struct _pdinstance *pdinstance_donew(int);
extern struct _pdinstance *pdinstance_new(void) {
  return (pdinstance_donew(1));
}


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

x86 assembly (clang, -O2):
<pdinstance_new>:
mov    $0x1,%edi
jmp    1030 <pdinstance_donew@plt>

LLVM IR (-O0):
%struct._pdinstance = type { i32 }
define %struct._pdinstance* @pdinstance_new() {
%1 = call %struct._pdinstance* @pdinstance_donew(i32 1)
ret %struct._pdinstance* %1
}

LLVM IR (-O2):
%struct._pdinstance = type { i32 }
define %struct._pdinstance* @pdinstance_new() {
%1 = tail call %struct._pdinstance* @pdinstance_donew(i32 1)
ret %struct._pdinstance* %1
}
int filesym(int arg) { return arg; }


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

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

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

LLVM IR (-O2):
define i32 @filesym(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ control_tsung(char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ parse_argv(int const, char const **, char **, int *);
int /*<<< orphan*/ print_help_for_start_or_stop();
int main(const int argc, const char **argv) {
  char *prefix;
  int daemonize;
  if (!parse_argv(argc, argv, &prefix, &daemonize)) {
    print_help_for_start_or_stop();
  }
  control_tsung("status", prefix);
  free(prefix);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1050 <parse_argv@plt>
cmp    $0x0,%eax
jne    117a <main+0x3a>
mov    $0x0,%al
call   1040 <print_help_for_start_or_stop@plt>
mov    -0x18(%rbp),%rsi
lea    0xe7b(%rip),%rdi
call   1060 <control_tsung@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdx
lea    0x14(%rsp),%rcx
call   1050 <parse_argv@plt>
test   %eax,%eax
jne    115e <main+0x1e>
xor    %eax,%eax
call   1040 <print_help_for_start_or_stop@plt>
mov    0x8(%rsp),%rsi
lea    0xe96(%rip),%rdi
call   1060 <control_tsung@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"status\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @parse_argv(i32 %8, i8** %9, i8** %6, i32* %7)
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 (...) @print_help_for_start_or_stop()
br label %14
14: ; preds = %12, %2
%15 = load i8*, i8** %6
%16 = call i32 @control_tsung(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %6
%18 = call i32 @free(i8* %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"status\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = bitcast i8** %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 @parse_argv(i32 %0, i8** %1, i8** %3, i32* %4)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @print_help_for_start_or_stop()
br label %11
11: ; preds = %9, %2
%12 = load i8*, i8** %3
%13 = call i32 @control_tsung(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %3
%15 = call i32 @free(i8* %14)
ret i32 0
}
int test_imm_5Auint8_mem(unsigned char *val) {
  return ((*val) & (-0x5A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_5Auint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xffffffa6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_5Auint8_mem>:
testb  $0xa6,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_5Auint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -90
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void calc_direz(int direz, int *newposx, int *newposy) {
  switch (direz) {
  case 0:
    (*newposy) -= 1;
    break;
  case 1:
    (*newposx) += 1;
    break;
  case 2:
    (*newposy) += 1;
    break;
  case 3:
    (*newposx) -= 1;
    break;
  }
}


x86 assembly (clang, -O0):
<calc_direz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x3,%rax
ja     116f <calc_direz+0x6f>
mov    -0x20(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
jmp    116f <calc_direz+0x6f>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    116f <calc_direz+0x6f>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    116f <calc_direz+0x6f>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_direz>:
cmp    $0x3,%edi
ja     112d <calc_direz+0x2d>
mov    $0xffffffff,%eax
mov    %edi,%ecx
lea    0xeed(%rip),%rdi
movslq (%rdi,%rcx,4),%rcx
add    %rdi,%rcx
jmp    *%rcx
mov    $0x1,%eax
mov    %rsi,%rdx
jmp    112b <calc_direz+0x2b>
mov    $0x1,%eax
add    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @calc_direz(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
switch i32 %7, label %24 [
i32 0, label %8
i32 1, label %12
i32 2, label %16
i32 3, label %20
]
8: ; preds = %3
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %9
br label %24
12: ; preds = %3
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %13
br label %24
16: ; preds = %3
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1
store i32 %19, i32* %17
br label %24
20: ; preds = %3
%21 = load i32*, i32** %5
%22 = load i32, i32* %21
%23 = sub nsw i32 %22, 1
store i32 %23, i32* %21
br label %24
24: ; preds = %3, %20, %16, %12, %8
ret void
}

LLVM IR (-O2):
define void @calc_direz(i32 %0, i32* nocapture %1, i32* nocapture %2) {
switch i32 %0, label %12 [
i32 0, label %7
i32 1, label %4
i32 2, label %5
i32 3, label %6
]
4: ; preds = %3
br label %7
5: ; preds = %3
br label %7
6: ; preds = %3
br label %7
7: ; preds = %3, %4, %5, %6
%8 = phi i32* [ %1, %6 ], [ %2, %5 ], [ %1, %4 ], [ %2, %3 ]
%9 = phi i32 [ -1, %6 ], [ 1, %5 ], [ 1, %4 ], [ -1, %3 ]
%10 = load i32, i32* %8
%11 = add nsw i32 %10, %9
store i32 %11, i32* %8
br label %12
12: ; preds = %7, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ start1();
_start() { start1(); }


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

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

LLVM IR (-O0):
define i32 @_start() {
%1 = alloca i32
%2 = call i32 (...) @start1()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @_start() {
%1 = tail call i32 (...) @start1()
ret i32 undef
}
void g_slist_alloc() {}


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

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

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

LLVM IR (-O2):
define void @g_slist_alloc() {
ret void
}
int fibonacci(int i) {
  if (i < 2) {
    return i;
  } else {
    return fibonacci(i - 1) + fibonacci(i - 2);
  }
}


x86 assembly (clang, -O0):
<fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1130 <fibonacci+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <fibonacci+0x43>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fibonacci@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fibonacci@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):
<fibonacci>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jge    1120 <fibonacci+0x10>
mov    %ebx,%ecx
jmp    1144 <fibonacci+0x34>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbx),%edi
call   1030 <fibonacci@plt>
lea    -0x2(%rbx),%ecx
add    %eax,%ebp
cmp    $0x3,%ebx
mov    %ecx,%ebx
ja     1130 <fibonacci+0x20>
add    %ecx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fibonacci(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 @fibonacci(i32 %10)
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 2
%14 = call i32 @fibonacci(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):
define i32 @fibonacci(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 @fibonacci(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 */
scalar_t__ toupper(int /*<<< orphan*/);
char *pstrcpyupper(char *dst, const char *src) {
  char *p = dst;
  while (*src) {
    *p++ = (char)toupper(*src++);
  }
  *p = '\0';
  return dst;
}


x86 assembly (clang, -O0):
<pstrcpyupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1164 <pstrcpyupper+0x54>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1128 <pstrcpyupper+0x18>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pstrcpyupper>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    (%rsi),%al
mov    %rdi,%rbx
test   %al,%al
je     114a <pstrcpyupper+0x3a>
mov    %rsi,%r15
add    $0x1,%r15
mov    %r14,%rbx
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
movzbl (%r15),%eax
add    $0x1,%r15
test   %al,%al
jne    1130 <pstrcpyupper+0x20>
movb   $0x0,(%rbx)
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @pstrcpyupper(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %14, %5 ], [ %3, %2 ]
%7 = phi i8* [ %13, %5 ], [ %0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = sext i8 %6 to i32
%11 = tail call i64 @toupper(i32 %10)
%12 = trunc i64 %11 to i8
%13 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %12, i8* %7
%14 = load i8, i8* %9
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i8* [ %0, %2 ], [ %13, %5 ]
store i8 0, i8* %17
ret i8* %0
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int S_ISDIR(int /*<<< orphan*/);
scalar_t__ stat(char const *, struct stat *);
int validate_path(const char *path) {
  struct stat s = {0};
  if (stat(path, &s) < 0)
    return 0;
  return S_ISDIR(s.st_mode);
}


x86 assembly (clang, -O0):
<validate_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <stat@plt>
cmp    $0x0,%rax
jge    116f <validate_path+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    117a <validate_path+0x4a>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_path>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %rax,%rax
js     1140 <validate_path+0x20>
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
define i32 @validate_path(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = bitcast %struct.stat* %4 to i8*
%6 = load i8*, i8** %3
%7 = call i64 @stat(i8* %6, %struct.stat* %4)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %14
10: ; preds = %1
%11 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @S_ISDIR(i32 %12)
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
define i32 @validate_path(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to %struct.stat*
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%5 = call i64 @stat(i8* %0, %struct.stat* %3)
%6 = icmp slt i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = bitcast i64* %2 to i32*
%9 = load i32, i32* %8
%10 = call i32 @S_ISDIR(i32 %9)
br label %11
11: ; preds = %1, %7
%12 = phi i32 [ %10, %7 ], [ 0, %1 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int8_t mcnet_read_int8(uint8_t *in) { return *((int8_t *)(in)); }


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

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

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

LLVM IR (-O2):
define i32 @mcnet_read_int8(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
int ta_string_hash_code(const char *str) {
  int i, res;
  res = 0;
  for (i = 0; str[i] != 0; i++)
    res = res ^ str[i];
  return (res & (256 - 1));
}


x86 assembly (clang, -O0):
<ta_string_hash_code>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114d <ta_string_hash_code+0x4d>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
xor    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <ta_string_hash_code+0x16>
mov    -0x10(%rbp),%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ta_string_hash_code>:
mov    (%rdi),%al
test   %al,%al
je     1124 <ta_string_hash_code+0x24>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
movzbl %al,%eax
xor    %eax,%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <ta_string_hash_code+0x10>
movzbl %cl,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ta_string_hash_code(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %10, %4 ], [ 0, %1 ]
%6 = phi i8 [ %12, %4 ], [ %2, %1 ]
%7 = phi i32 [ %9, %4 ], [ 0, %1 ]
%8 = zext i8 %6 to i32
%9 = xor i32 %7, %8
%10 = add nuw nsw i64 %5, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %9, 255
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ decompose(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  int value;
  scanf("%d", &value);
  printf("%d\n", value);
  decompose(value, 0);
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %3
%9 = call i32 @decompose(i32 %8, i32 0)
ret i32 0
}
const char *dbg_cstate(int cmt_state) { return ""; }


x86 assembly (clang, -O0):
<dbg_cstate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xef2(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @dbg_cstate(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @dbg_cstate(i32 %0) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int *GetTokenCounterAddress();
int IncrementTokenCount(void) {
  int *pcount = GetTokenCounterAddress();
  *pcount = *pcount + 1;
  return *pcount;
}


x86 assembly (clang, -O0):
<IncrementTokenCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <GetTokenCounterAddress@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IncrementTokenCount>:
push   %rax
xor    %eax,%eax
call   1030 <GetTokenCounterAddress@plt>
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @IncrementTokenCount() {
%1 = alloca i32*
%2 = call i32* (...) @GetTokenCounterAddress()
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
%6 = load i32*, i32** %1
store i32 %5, i32* %6
%7 = load i32*, i32** %1
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @IncrementTokenCount() {
%1 = tail call i32* (...) @GetTokenCounterAddress()
%2 = load i32, i32* %1
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ recMTC0();
void recCTC0() { recMTC0(); }


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

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

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

LLVM IR (-O2):
define void @recCTC0() {
%1 = tail call i32 (...) @recMTC0()
ret void
}
/* Variables and functions */
int errno;
int mkdir(char const *, int);
int do_mkdir(const char *file, int mode) {
  int err;
  err = mkdir(file, mode);
  if (err)
    return -errno;
  return 0;
}


x86 assembly (clang, -O0):
<do_mkdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <mkdir@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     114b <do_mkdir+0x3b>
xor    %eax,%eax
mov    0x2e9f(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <do_mkdir+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_mkdir>:
push   %rax
call   1030 <mkdir@plt>
mov    0x2ec3(%rip),%rcx
xor    %edx,%edx
sub    (%rcx),%edx
test   %eax,%eax
cmovne %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @do_mkdir(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = call i32 @mkdir(i8* %7, i32 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* @errno
%14 = sub nsw i32 0, %13
store i32 %14, i32* %3
br label %16
15: ; preds = %2
store i32 0, i32* %3
br label %16
16: ; preds = %15, %12
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @do_mkdir(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @mkdir(i8* %0, i32 %1)
%4 = icmp eq i32 %3, 0
%5 = load i32, i32* @errno
%6 = sub nsw i32 0, %5
%7 = select i1 %4, i32 0, i32 %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;
typedef int /*<<< orphan*/ dev_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int mknod(const char *pathname, mode_t mode, dev_t dev) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<mknod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
mov    0x2eba(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mknod>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @mknod(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @mknod(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
int gcd(int a, int b) {
  int c, t;
  if (b > a)
    t = b, b = a, a = t;
  c = b % a;
  while (c != 0) {
    b = a, a = c, c = b % a;
  }
  return a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    1128 <gcd+0x28>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1157 <gcd+0x57>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,-0xc(%rbp)
jmp    1132 <gcd+0x32>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
cmp    %edi,%esi
mov    %esi,%eax
cmovg  %edi,%eax
cmovg  %esi,%edi
cltd
idiv   %edi
test   %edx,%edx
je     1130 <gcd+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
mov    %edi,%eax
cltd
idiv   %ecx
mov    %ecx,%edi
test   %edx,%edx
jne    1120 <gcd+0x20>
mov    %ecx,%eax
ret
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, %0
%4 = select i1 %3, i32 %0, i32 %1
%5 = select i1 %3, i32 %1, i32 %0
%6 = srem i32 %4, %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %2, %8
%9 = phi i32 [ %10, %8 ], [ %5, %2 ]
%10 = phi i32 [ %11, %8 ], [ %6, %2 ]
%11 = srem i32 %9, %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %8
13: ; preds = %8, %2
%14 = phi i32 [ %5, %2 ], [ %10, %8 ]
ret i32 %14
}
/* Variables and functions */
int snprintf(char *, int, char *, int);
int senFunc3(char *s, int n, int a) { return snprintf(s, n, "None: %d", a); }


x86 assembly (clang, -O0):
<senFunc3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%ecx
lea    0xecd(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<senFunc3>:
mov    %edx,%ecx
lea    0xee7(%rip),%rdx
jmp    1030 <snprintf@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"None: %d\00"
define i32 @senFunc3(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 %4
}
/* Variables and functions */
char *emalloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *byte_toString(signed char x) {
  char *s = emalloc(4);
  sprintf(s, "%d", (int)x);
  return s;
}


x86 assembly (clang, -O0):
<byte_toString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x4,%edi
call   1030 <emalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movsbl -0x1(%rbp),%edx
lea    0xeb5(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<byte_toString>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x4,%edi
call   1030 <emalloc@plt>
mov    %rax,%rbx
lea    0xec7(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i8* @byte_toString(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8*
store i8 %0, i8* %2
%4 = call i8* @emalloc(i32 4)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i8* @byte_toString(i8 signext %0) {
%2 = tail call i8* @emalloc(i32 4)
%3 = sext i8 %0 to i32
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* %2
}
/* Type definitions */
struct timespec {
  int tv_sec;
  scalar_t__ tv_nsec;
};

/* Variables and functions */
int nanosleep(struct timespec *, int /*<<< orphan*/ *);
__attribute__((visibility("hidden"))) int SYS_Sleep(int iTimeVal) {
  struct timespec mrqtp;
  mrqtp.tv_sec = iTimeVal;
  mrqtp.tv_nsec = 0;
  return nanosleep(&mrqtp, NULL);
}


x86 assembly (clang, -O0):
<SYS_Sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SYS_Sleep>:
sub    $0x18,%rsp
mov    %edi,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
define hidden i32 @SYS_Sleep(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i32 %4, i32* %5
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 0, i64* %6
%7 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
ret i32 %7
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define hidden i32 @SYS_Sleep(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 %0, i32* %4
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 0, i64* %5
%6 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
ret i32 %6
}
void user_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @user_exit() {
ret void
}
int bit_swap(int number) {
  return ((number & 0xaaaaaaaa) >> 1) | ((number & 0x55555555) << 1);
}


x86 assembly (clang, -O0):
<bit_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xaaaaaaaa,%eax
shr    $0x1,%eax
mov    -0x4(%rbp),%ecx
and    $0x55555555,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_swap>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
and    $0xd5555555,%edi
lea    (%rax,%rdi,2),%eax
ret

LLVM IR (-O0):
define i32 @bit_swap(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -1431655766
%5 = lshr i32 %4, 1
%6 = load i32, i32* %2
%7 = and i32 %6, 1431655765
%8 = shl i32 %7, 1
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @bit_swap(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = shl i32 %0, 1
%5 = and i32 %4, -1431655766
%6 = or i32 %3, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ s2slw(float);
void s2slw_(float *width) { s2slw(*width); }


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

x86 assembly (clang, -O2):
<s2slw_>:
movss  (%rdi),%xmm0
jmp    1030 <s2slw@plt>

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

LLVM IR (-O2):
define void @s2slw_(float* nocapture %0) {
%2 = load float, float* %0
%3 = tail call i32 @s2slw(float %2)
ret void
}