xunge/DecIR huggingface dataset:
int fibonacci(int i) {
  switch (i) {
  case 0:
  case 1:
    return i;
  default:
    return fibonacci(i - 1) + fibonacci(i - 2);
  }
}


x86 assembly (clang, -O0):
<fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
ja     1137 <fibonacci+0x27>
jmp    112c <fibonacci+0x1c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <fibonacci+0x4a>
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
jb     1132 <fibonacci+0x22>
xor    %ebp,%ebp
xchg   %ax,%ax
lea    -0x1(%rbx),%edi
call   1030 <fibonacci@plt>
add    $0xfffffffe,%ebx
add    %eax,%ebp
cmp    $0x1,%ebx
ja     1120 <fibonacci+0x10>
add    %ebx,%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
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %5
]
5: ; preds = %1, %1
%6 = load i32, i32* %3
store i32 %6, i32* %2
br label %15
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 1
%10 = call i32 @fibonacci(i32 %9)
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 2
%13 = call i32 @fibonacci(i32 %12)
%14 = add nsw i32 %10, %13
store i32 %14, i32* %2
br label %15
15: ; preds = %7, %5
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @fibonacci(i32 %0) {
%2 = icmp ult 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 %8, 2
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 */
int /*<<< orphan*/ Msp430GpioC__1__GeneralIO__clr();
void CC2420ReceiveP__CSN__clr(void) { Msp430GpioC__1__GeneralIO__clr(); }


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

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

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

LLVM IR (-O2):
define void @CC2420ReceiveP__CSN__clr() {
%1 = tail call i32 (...) @Msp430GpioC__1__GeneralIO__clr()
ret void
}
int test_imm_45int16_mem(short *val) {
  return ((*val) & (-0x45 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_45int16_mem>:
movzwl (%rdi),%eax
test   $0xffbb,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_45int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -69
%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_45int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -69
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage: \n");
  printf("  -n   number of rules to generate\n");
  printf("  -f   file name\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xefb(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Usage: \0A\00"
@.str.1 = [36 x i8] c" -n number of rules to generate\0A\00"
@.str.2 = [18 x i8] c" -f file name\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [8 x i8] c"Usage: \00"
@str.3 = [35 x i8] c" -n number of rules to generate\00"
@str.4 = [17 x i8] c" -f file name\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef uintptr_t uint32_t;

/* Variables and functions */
void resolve(void *pptr, uint32_t *idx, uint32_t *bit) {
  uintptr_t ptr = (uintptr_t)pptr;
  ptr >>= 12;
  *idx = ptr / 32;
  *bit = ptr % 32;
}


x86 assembly (clang, -O0):
<resolve>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
shr    $0xc,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
shr    $0x5,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
and    $0x1f,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<resolve>:
mov    %edi,%eax
shr    $0xc,%eax
and    $0x1f,%eax
shr    $0x11,%rdi
mov    %rdi,(%rsi)
mov    %rax,(%rdx)
ret

LLVM IR (-O0):
define void @resolve(i8* %0, i64* %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i64
store i8* %0, i8** %4
store i64* %1, i64** %5
store i64* %2, i64** %6
%8 = load i8*, i8** %4
%9 = ptrtoint i8* %8 to i64
store i64 %9, i64* %7
%10 = load i64, i64* %7
%11 = lshr i64 %10, 12
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = udiv i64 %12, 32
%14 = load i64*, i64** %5
store i64 %13, i64* %14
%15 = load i64, i64* %7
%16 = urem i64 %15, 32
%17 = load i64*, i64** %6
store i64 %16, i64* %17
ret void
}

LLVM IR (-O2):
define void @resolve(i8* %0, i64* nocapture writeonly %1, i64* nocapture writeonly %2) {
%4 = ptrtoint i8* %0 to i64
%5 = lshr i64 %4, 12
%6 = lshr i64 %4, 17
store i64 %6, i64* %1
%7 = and i64 %5, 31
store i64 %7, i64* %2
ret void
}
void debug_registers() { asm volatile("int $0x30"); }


x86 assembly (clang, -O0):
<debug_registers>:
push   %rbp
mov    %rsp,%rbp
int    $0x30
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_registers>:
int    $0x30
ret

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

LLVM IR (-O2):
define void @debug_registers() {
tail call void asm sideeffect "int $$0x30", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
unsigned darken_output_fmts(unsigned input_fmts) { return input_fmts; }


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

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

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

LLVM IR (-O2):
define i32 @darken_output_fmts(i32 returned %0) {
ret i32 %0
}
int demux_pts_in_window(unsigned int window_start, unsigned int window_end,
                        unsigned int check) {
  if (window_end > window_start)
    return (check >= window_start && check <= window_end);
  else
    return (check >= window_start || check <= window_end);
}


x86 assembly (clang, -O0):
<demux_pts_in_window>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jbe    1146 <demux_pts_in_window+0x46>
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x11(%rbp)
jb     1136 <demux_pts_in_window+0x36>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
setbe  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    116e <demux_pts_in_window+0x6e>
mov    -0x10(%rbp),%ecx
mov    $0x1,%al
cmp    -0x8(%rbp),%ecx
mov    %al,-0x12(%rbp)
jae    1163 <demux_pts_in_window+0x63>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
setbe  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<demux_pts_in_window>:
cmp    %edi,%esi
jbe    1114 <demux_pts_in_window+0x14>
cmp    %esi,%edx
setbe  %cl
cmp    %edi,%edx
setae  %al
and    %cl,%al
movzbl %al,%eax
ret
cmp    %esi,%edx
setbe  %cl
cmp    %edi,%edx
setae  %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @demux_pts_in_window(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp ugt i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %3
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = icmp uge i32 %12, %13
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = icmp ule i32 %16, %17
br label %19
19: ; preds = %15, %11
%20 = phi i1 [ false, %11 ], [ %18, %15 ]
%21 = zext i1 %20 to i32
store i32 %21, i32* %4
br label %33
22: ; preds = %3
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = icmp uge i32 %23, %24
br i1 %25, label %30, label %26
26: ; preds = %22
%27 = load i32, i32* %7
%28 = load i32, i32* %6
%29 = icmp ule i32 %27, %28
br label %30
30: ; preds = %26, %22
%31 = phi i1 [ true, %22 ], [ %29, %26 ]
%32 = zext i1 %31 to i32
store i32 %32, i32* %4
br label %33
33: ; preds = %30, %19
%34 = load i32, i32* %4
ret i32 %34
}

LLVM IR (-O2):
define i32 @demux_pts_in_window(i32 %0, i32 %1, i32 %2) {
%4 = icmp ugt i32 %1, %0
%5 = icmp uge i32 %2, %0
%6 = icmp ule i32 %2, %1
br i1 %4, label %7, label %9
7: ; preds = %3
%8 = and i1 %5, %6
br label %11
9: ; preds = %3
%10 = or i1 %5, %6
br label %11
11: ; preds = %9, %7
%12 = phi i1 [ %8, %7 ], [ %10, %9 ]
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ trap_SendConsoleCommand(char *);
void CG_TauntPraise_f(void) { trap_SendConsoleCommand("cmd vsay praise\n"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"cmd vsay praise\0A\00"
define void @CG_TauntPraise_f() {
%1 = call i32 @trap_SendConsoleCommand(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"cmd vsay praise\0A\00"
define void @CG_TauntPraise_f() {
%1 = tail call i32 @trap_SendConsoleCommand(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}
float DotProduct(float x1, float y1, float x2, float y2) {
  return (x1 * x2 + y1 * y2);
}


x86 assembly (clang, -O0):
<DotProduct>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<DotProduct>:
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @DotProduct(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %7
%11 = load float, float* %6
%12 = load float, float* %8
%13 = fmul float %11, %12
%14 = call float @llvm.fmuladd.f32(float %9, float %10, float %13)
ret float %14
}

LLVM IR (-O2):
define float @DotProduct(float %0, float %1, float %2, float %3) {
%5 = fmul float %1, %3
%6 = tail call float @llvm.fmuladd.f32(float %0, float %2, float %5)
ret float %6
}
int imin(int l, int r) {
  if (l < r)
    return (l);
  return (r);
}


x86 assembly (clang, -O0):
<imin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <imin+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <imin+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imin>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @imin(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, size_t);
int /*<<< orphan*/ warn(char *);
ssize_t read_line(char *out, size_t outmax) {
  ssize_t ret;
  if ((ret = read(STDIN_FILENO, out, outmax)) < 0) {
    warn("read");
  }
  return ret;
}


x86 assembly (clang, -O0):
<read_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <read@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    115e <read_line+0x3e>
lea    0xea7(%rip),%rdi
call   1030 <warn@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_line>:
push   %rbx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
call   1040 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1147 <read_line+0x27>
lea    0xebe(%rip),%rdi
call   1030 <warn@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@.str = [5 x i8] c"read\00"
define i32 @read_line(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 i32, i32* @STDIN_FILENO
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = call i32 @read(i32 %6, i8* %7, i64 %8)
store i32 %9, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @warn(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i32, i32* %5
ret i32 %14
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@.str = [5 x i8] c"read\00"
define i32 @read_line(i8* nocapture %0, i64 %1) {
%3 = load i32, i32* @STDIN_FILENO
%4 = tail call i32 @read(i32 %3, i8* %0, i64 %1)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @warn(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret i32 %4
}
/* Variables and functions */
char *calloc(scalar_t__, int);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
void *strcopykey(const void *key) {
  char *newkey = calloc(strlen((const char *)key) + 1, sizeof(char));
  strcpy(newkey, (const char *)key);
  return (void *)newkey;
}


x86 assembly (clang, -O0):
<strcopykey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcopykey>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strcopykey(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @calloc(i64 %3, i32 1)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct wl_proxy {
  int dummy;
};
struct wl_buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_get_version(struct wl_proxy *);
uint32_t wl_buffer_get_version(struct wl_buffer *wl_buffer) {
  return wl_proxy_get_version((struct wl_proxy *)wl_buffer);
}


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

x86 assembly (clang, -O2):
<wl_buffer_get_version>:
jmp    1030 <wl_proxy_get_version@plt>

LLVM IR (-O0):
%struct.wl_buffer = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_buffer_get_version(%struct.wl_buffer* %0) {
%2 = alloca %struct.wl_buffer*
store %struct.wl_buffer* %0, %struct.wl_buffer** %2
%3 = load %struct.wl_buffer*, %struct.wl_buffer** %2
%4 = bitcast %struct.wl_buffer* %3 to %struct.wl_proxy*
%5 = call i32 @wl_proxy_get_version(%struct.wl_proxy* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.wl_buffer = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_buffer_get_version(%struct.wl_buffer* %0) {
%2 = bitcast %struct.wl_buffer* %0 to %struct.wl_proxy*
%3 = tail call i32 @wl_proxy_get_version(%struct.wl_proxy* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void rec_conv(int n) {
  static int base = 3;
  if (n == 0)
    return;
  int mod = n % base;
  n /= 3;
  rec_conv(n);
  printf("%d", mod);
}


x86 assembly (clang, -O0):
<rec_conv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113a <rec_conv+0x1a>
jmp    116c <rec_conv+0x4c>
mov    -0x4(%rbp),%eax
cltd
idivl  0x2eec(%rip)
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <rec_conv@plt>
mov    -0x8(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rec_conv>:
test   %edi,%edi
je     1157 <rec_conv+0x37>
push   %rbx
mov    %edi,%ebx
movslq %edi,%rax
imul   $0x55555556,%rax,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
shr    $0x20,%rdi
add    %eax,%edi
lea    (%rdi,%rdi,2),%eax
sub    %eax,%ebx
call   1030 <rec_conv@plt>
lea    0xeb1(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <printf@plt>
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @rec_conv(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %4
3: ; preds = %1, %4
ret void
4: ; preds = %1
%5 = srem i32 %0, 3
%6 = sdiv i32 %0, 3
tail call void @rec_conv(i32 %6)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %3
}
unsigned xrop3_126_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk1 = S ^ T;
  stk2 = D ^ S;
  stk1 = stk1 | stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_126_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_126_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
mov    %ecx,%edx
xor    %eax,%edx
mov    %eax,%edi
xor    $0xff,%edi
or     %edx,%edi
not    %ecx
or     %eax,%ecx
and    %edi,%ecx
not    %eax
and    %esi,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_126_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = xor i32 %22, %23
store i32 %24, i32* %8
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = xor i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = or i32 %28, %29
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = load i32, i32* %6
%33 = and i32 %31, %32
%34 = load i32, i32* %8
%35 = load i32, i32* %7
%36 = xor i32 %35, -1
%37 = and i32 %34, %36
%38 = or i32 %33, %37
%39 = load i32, i32* %7
%40 = load i32, i32* %6
%41 = xor i32 %40, -1
%42 = and i32 %39, %41
%43 = load i32, i32* %5
%44 = and i32 %42, %43
%45 = or i32 %38, %44
ret i32 %45
}

LLVM IR (-O2):
define i32 @xrop3_126_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %6, %4
%8 = xor i32 %4, 255
%9 = or i32 %7, %8
%10 = xor i32 %6, -1
%11 = or i32 %4, %10
%12 = and i32 %9, %11
%13 = xor i32 %4, -1
%14 = and i32 %13, %5
%15 = or i32 %12, %14
ret i32 %15
}
void ff_get_cpu_max_align_aarch64() {}


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

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

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

LLVM IR (-O2):
define void @ff_get_cpu_max_align_aarch64() {
ret void
}
/* Type definitions */
struct stat {
  int st_size;
};
typedef int off_t;

/* Variables and functions */
scalar_t__ fstat(int, struct stat *);
int /*<<< orphan*/ perror(char *);
off_t filesize(int fd) {
  struct stat buf;
  if (fstat(fd, &buf) < 0) {
    perror("[ERR]  Checking filesize of input file");
    return -1;
  } else {
    return (buf.st_size);
  }
}


x86 assembly (clang, -O0):
<filesize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <fstat@plt>
cmp    $0x0,%rax
jge    1159 <filesize+0x39>
lea    0xeb8(%rip),%rdi
call   1030 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <filesize+0x3f>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filesize>:
push   %rax
mov    %rsp,%rsi
call   1040 <fstat@plt>
test   %rax,%rax
js     1133 <filesize+0x13>
mov    (%rsp),%eax
pop    %rcx
ret
lea    0xec6(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [39 x i8] c"[ERR] Checking filesize of input file\00"
define i32 @filesize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.stat
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i64 @fstat(i32 %5, %struct.stat* %4)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %13
10: ; preds = %1
%11 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%12 = load i32, i32* %11
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [39 x i8] c"[ERR] Checking filesize of input file\00"
define i32 @filesize(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%10 = load i32, i32* %9
br label %11
11: ; preds = %8, %6
%12 = phi i32 [ -1, %6 ], [ %10, %8 ]
ret i32 %12
}
/* Type definitions */
typedef size_t uint8_t;
typedef size_t uint16_t;

/* Variables and functions */
void set_uint16(uint8_t *buf, uint16_t pos, uint16_t b) {
  buf[pos] = (b >> 8) & 0xff;
  buf[pos + 1] = b & 0xff;
}


x86 assembly (clang, -O0):
<set_uint16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
shr    $0x8,%rdx
and    $0xff,%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rdx
and    $0xff,%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rdx,0x8(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_uint16>:
movzbl %dh,%eax
mov    %rax,(%rdi,%rsi,8)
movzbl %dl,%eax
mov    %rax,0x8(%rdi,%rsi,8)
ret

LLVM IR (-O0):
define void @set_uint16(i64* %0, i64 %1, i64 %2) {
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
store i64* %0, i64** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = lshr i64 %7, 8
%9 = and i64 %8, 255
%10 = load i64*, i64** %4
%11 = load i64, i64* %5
%12 = getelementptr inbounds i64, i64* %10, i64 %11
store i64 %9, i64* %12
%13 = load i64, i64* %6
%14 = and i64 %13, 255
%15 = load i64*, i64** %4
%16 = load i64, i64* %5
%17 = add i64 %16, 1
%18 = getelementptr inbounds i64, i64* %15, i64 %17
store i64 %14, i64* %18
ret void
}

LLVM IR (-O2):
define void @set_uint16(i64* nocapture writeonly %0, i64 %1, i64 %2) {
%4 = lshr i64 %2, 8
%5 = and i64 %4, 255
%6 = getelementptr inbounds i64, i64* %0, i64 %1
store i64 %5, i64* %6
%7 = and i64 %2, 255
%8 = add i64 %1, 1
%9 = getelementptr inbounds i64, i64* %0, i64 %8
store i64 %7, i64* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ byte(int);
int /*<<< orphan*/ newline(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ put(char);
eof() {
  newline(0, 0, 1);
  byte(0xFF);
  put('\n');
}


x86 assembly (clang, -O0):
<eof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1030 <newline@plt>
mov    $0xff,%edi
call   1040 <byte@plt>
mov    $0xa,%edi
call   1050 <put@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eof>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <newline@plt>
mov    $0xff,%edi
call   1040 <byte@plt>
mov    $0xa,%edi
pop    %rax
jmp    1050 <put@plt>

LLVM IR (-O0):
define i32 @eof() {
%1 = alloca i32
%2 = call i32 @newline(i32 0, i32 0, i32 1)
%3 = call i32 @byte(i32 255)
%4 = call i32 @put(i8 signext 10)
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
define i32 @eof() {
%1 = tail call i32 @newline(i32 0, i32 0, i32 1)
%2 = tail call i32 @byte(i32 255)
%3 = tail call i32 @put(i8 signext 10)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
char *strrchr(char *, char);
int string_ends_with_extension(char str[], char extension[]) {
  char *dot;
  dot = strrchr(str, '.');
  if (dot)
    if (!strcmp(++dot, extension))
      return (1 == 1);
  return (1 == 0);
}


x86 assembly (clang, -O0):
<string_ends_with_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     117c <string_ends_with_extension+0x5c>
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1177 <string_ends_with_extension+0x57>
movl   $0x1,-0x4(%rbp)
jmp    1183 <string_ends_with_extension+0x63>
jmp    117c <string_ends_with_extension+0x5c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_ends_with_extension>:
push   %rbx
mov    %rsi,%rbx
mov    $0x2e,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1146 <string_ends_with_extension+0x26>
add    $0x1,%rax
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     114a <string_ends_with_extension+0x2a>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

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


x86 assembly (clang, -O0):
<Op9CM1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1040 <SA1Absolute@plt>
mov    %eax,%edi
call   1030 <STZ8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op9CM1>:
push   %rax
mov    $0x2,%edi
call   1040 <SA1Absolute@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <STZ8@plt>

LLVM IR (-O0):
define void @Op9CM1() {
%1 = call i32 @SA1Absolute(i32 2)
%2 = call i32 @STZ8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op9CM1() {
%1 = tail call i32 @SA1Absolute(i32 2)
%2 = tail call i32 @STZ8(i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ i;

/* Variables and functions */
int read(int /*<<< orphan*/, int *, int);
int /*<<< orphan*/ write(int, int *, int);
int main(int argc, char **argv) {
  int i;
  while (1) {
    if (read(0, &i, sizeof(i)) != sizeof(i))
      break;
    write(1, &i, sizeof(i));
  }
  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)
xor    %edi,%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1040 <read@plt>
cltq
cmp    $0x4,%rax
je     1157 <main+0x37>
jmp    116f <main+0x4f>
mov    $0x1,%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rsi
xor    %edi,%edi
mov    $0x4,%edx
call   1040 <read@plt>
cmp    $0x4,%eax
jne    1166 <main+0x46>
lea    0xc(%rsp),%rbx
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <write@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
cmp    $0x4,%eax
je     1140 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %2, %12
%8 = call i32 @read(i32 0, i32* %6, i32 4)
%9 = sext i32 %8 to i64
%10 = icmp ne i64 %9, 4
br i1 %10, label %11, label %12
11: ; preds = %7
br label %14
12: ; preds = %7
%13 = call i32 @write(i32 1, i32* %6, i32 4)
br label %7
14: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @read(i32 0, i32* %3, i32 4)
%6 = icmp eq i32 %5, 4
br i1 %6, label %7, label %11
7: ; preds = %2, %7
%8 = call i32 @write(i32 1, i32* %3, i32 4)
%9 = call i32 @read(i32 0, i32* %3, i32 4)
%10 = icmp eq i32 %9, 4
br i1 %10, label %7, label %11
11: ; preds = %7, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dc_f(unsigned char *, int, unsigned char);
void ss_decrypt(unsigned char *a, int n, unsigned char *key) {
  int i;
  for (i = 0; i < 4; i++)
    dc_f(a, n, key[3 - i]);
}


x86 assembly (clang, -O0):
<ss_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    1161 <ss_decrypt+0x51>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    $0x3,%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
call   1030 <dc_f@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112a <ss_decrypt+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ss_decrypt>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
movzbl 0x3(%rdx),%edx
call   1030 <dc_f@plt>
movzbl 0x2(%rbx),%edx
mov    %rbp,%rdi
mov    %r14d,%esi
call   1030 <dc_f@plt>
movzbl 0x1(%rbx),%edx
mov    %rbp,%rdi
mov    %r14d,%esi
call   1030 <dc_f@plt>
movzbl (%rbx),%edx
mov    %rbp,%rdi
mov    %r14d,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <dc_f@plt>

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

LLVM IR (-O2):
define void @ss_decrypt(i8* %0, i32 %1, i8* nocapture %2) {
%4 = getelementptr inbounds i8, i8* %2, i64 3
%5 = load i8, i8* %4
%6 = tail call i32 @dc_f(i8* %0, i32 %1, i8 zeroext %5)
%7 = getelementptr inbounds i8, i8* %2, i64 2
%8 = load i8, i8* %7
%9 = tail call i32 @dc_f(i8* %0, i32 %1, i8 zeroext %8)
%10 = getelementptr inbounds i8, i8* %2, i64 1
%11 = load i8, i8* %10
%12 = tail call i32 @dc_f(i8* %0, i32 %1, i8 zeroext %11)
%13 = load i8, i8* %2
%14 = tail call i32 @dc_f(i8* %0, i32 %1, i8 zeroext %13)
ret void
}
int rtl838x_dma_if_rx_cur(int i) { return (0x9F20) + (i << 2); }


x86 assembly (clang, -O0):
<rtl838x_dma_if_rx_cur>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
add    $0x9f20,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtl838x_dma_if_rx_cur>:
lea    0x9f20(,%rdi,4),%eax
ret

LLVM IR (-O0):
define i32 @rtl838x_dma_if_rx_cur(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 2
%5 = add nsw i32 40736, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @rtl838x_dma_if_rx_cur(i32 %0) {
%2 = shl i32 %0, 2
%3 = add nsw i32 %2, 40736
ret i32 %3
}
double absval(double x, double y) {
  double f = (x * x) - y;
  if (f < 0)
    f = -f;
  return f;
}


x86 assembly (clang, -O0):
<absval>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1170 <absval+0x70>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<absval>:
mulsd  %xmm0,%xmm0
subsd  %xmm1,%xmm0
movapd 0xef0(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @absval(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fneg double %8
%10 = call double @llvm.fmuladd.f64(double %6, double %7, double %9)
store double %10, double* %5
%11 = load double, double* %5
%12 = fcmp olt double %11, 0.000000e+00
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load double, double* %5
%15 = fneg double %14
store double %15, double* %5
br label %16
16: ; preds = %13, %2
%17 = load double, double* %5
ret double %17
}

LLVM IR (-O2):
define double @absval(double %0, double %1) {
%3 = fneg double %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %3)
%5 = fcmp olt double %4, 0.000000e+00
%6 = fneg double %4
%7 = select i1 %5, double %6, double %4
ret double %7
}
void gdr_runtime_get_version(int *major, int *minor) {
  *major = 2;
  *minor = 3;
}


x86 assembly (clang, -O0):
<gdr_runtime_get_version>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdr_runtime_get_version>:
movl   $0x2,(%rdi)
movl   $0x3,(%rsi)
ret

LLVM IR (-O0):
define void @gdr_runtime_get_version(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
store i32 2, i32* %5
%6 = load i32*, i32** %4
store i32 3, i32* %6
ret void
}

LLVM IR (-O2):
define void @gdr_runtime_get_version(i32* nocapture writeonly %0, i32* nocapture writeonly %1) {
store i32 2, i32* %0
store i32 3, i32* %1
ret void
}
void foo212(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo212(i32 %0) {
ret void
}
/* Variables and functions */
char *g_getenv(char *);
char *get_log_path() {
  char *log_path = 0;
  log_path = g_getenv("CHANSRV_LOG_PATH");
  if (log_path == 0) {
    log_path = g_getenv("HOME");
  }
  return log_path;
}


x86 assembly (clang, -O0):
<get_log_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
lea    0xed9(%rip),%rdi
call   1030 <g_getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114b <get_log_path+0x3b>
lea    0xecf(%rip),%rdi
call   1030 <g_getenv@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_log_path>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <g_getenv@plt>
test   %rax,%rax
je     1124 <get_log_path+0x14>
pop    %rcx
ret
lea    0xee6(%rip),%rdi
pop    %rax
jmp    1030 <g_getenv@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"CHANSRV_LOG_PATH\00"
@.str.1 = [5 x i8] c"HOME\00"
define i8* @get_log_path() {
%1 = alloca i8*
store i8* null, i8** %1
%2 = call i8* @g_getenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i8* @g_getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8* %6, i8** %1
br label %7
7: ; preds = %5, %0
%8 = load i8*, i8** %1
ret i8* %8
}

LLVM IR (-O2):
@.str = [17 x i8] c"CHANSRV_LOG_PATH\00"
@.str.1 = [5 x i8] c"HOME\00"
define i8* @get_log_path() {
%1 = tail call i8* @g_getenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i8* @g_getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = phi i8* [ %4, %3 ], [ %1, %0 ]
ret i8* %6
}
int do_001() { return 1; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @do_001() {
ret i32 1
}

LLVM IR (-O2):
define i32 @do_001() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
void fin(int n) {
  wait(NULL);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<fin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <wait@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<fin>:
push   %rax
xor    %edi,%edi
call   1040 <wait@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define void @fin(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @wait(i32* null)
%4 = load i32, i32* @EXIT_SUCCESS
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define void @fin(i32 %0) {
%2 = tail call i32 @wait(i32* null)
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
struct Cyc_Absyn_Stmt {
  int dummy;
};

/* Variables and functions */
struct Cyc_Absyn_Stmt *Cyc_Absyn_skip_stmt(unsigned int);
struct Cyc_Absyn_Stmt *Cyc_Toc_skip_stmt_dl(void) {
  struct Cyc_Absyn_Stmt *_T0;
  _T0 = Cyc_Absyn_skip_stmt(0U);
  return _T0;
}


x86 assembly (clang, -O0):
<Cyc_Toc_skip_stmt_dl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <Cyc_Absyn_skip_stmt@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.Cyc_Absyn_Stmt = type { i32 }
define %struct.Cyc_Absyn_Stmt* @Cyc_Toc_skip_stmt_dl() {
%1 = alloca %struct.Cyc_Absyn_Stmt*
%2 = call %struct.Cyc_Absyn_Stmt* @Cyc_Absyn_skip_stmt(i32 0)
store %struct.Cyc_Absyn_Stmt* %2, %struct.Cyc_Absyn_Stmt** %1
%3 = load %struct.Cyc_Absyn_Stmt*, %struct.Cyc_Absyn_Stmt** %1
ret %struct.Cyc_Absyn_Stmt* %3
}

LLVM IR (-O2):
%struct.Cyc_Absyn_Stmt = type { i32 }
define %struct.Cyc_Absyn_Stmt* @Cyc_Toc_skip_stmt_dl() {
%1 = tail call %struct.Cyc_Absyn_Stmt* @Cyc_Absyn_skip_stmt(i32 0)
ret %struct.Cyc_Absyn_Stmt* %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t pci_box_device(int bus, int slot, int func) {
  return (bus << 16) | (slot << 8) | func;
}


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

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

LLVM IR (-O0):
define i32 @pci_box_device(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
%8 = shl i32 %7, 16
%9 = load i32, i32* %5
%10 = shl i32 %9, 8
%11 = or i32 %8, %10
%12 = load i32, i32* %6
%13 = or i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @pci_box_device(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %0, 16
%5 = shl i32 %1, 8
%6 = or i32 %5, %4
%7 = or i32 %6, %2
ret i32 %7
}
int test_imm_D3int8_mem(signed char *val) {
  return ((*val) & (0xD3 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D3int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 211
%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_D3int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -45
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}