xunge/DecIR huggingface dataset:
/* Variables and functions */
int id(int);
int id2(int x) {
  if (x == 0)
    return 0;
  int ret = id(x - 1) + 1;
  if (ret > 5)
    return 5;
  return ret;
}


x86 assembly (clang, -O0):
<id2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <id2+0x21>
movl   $0x0,-0x4(%rbp)
jmp    115e <id2+0x4e>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <id@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jle    1158 <id2+0x48>
movl   $0x5,-0x4(%rbp)
jmp    115e <id2+0x4e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<id2>:
test   %edi,%edi
je     1130 <id2+0x20>
push   %rax
add    $0xffffffff,%edi
call   1030 <id@plt>
lea    0x1(%rax),%ecx
cmp    $0x5,%eax
mov    $0x5,%eax
cmovl  %ecx,%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @id2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @id(i32 %4)
%6 = add nsw i32 %5, 1
%7 = icmp slt i32 %5, 5
%8 = select i1 %7, i32 %6, i32 5
br label %9
9: ; preds = %1, %3
%10 = phi i32 [ %8, %3 ], [ 0, %1 ]
ret i32 %10
}
/* Type definitions */
struct mrb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ m_putc(int, int);
int mrb_get(struct mrb *);
int mrb_get_line(struct mrb *q, int line) {
  int ch, found = 0;
  while ((ch = mrb_get(q)) != -1)
    if (ch == 10) {
      m_putc(line, 0);
      found = 1;
      break;
    } else
      m_putc(line, ch);
  return found;
}


x86 assembly (clang, -O0):
<mrb_get_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mrb_get@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xffffffff,%eax
je     117b <mrb_get_line+0x5b>
cmpl   $0xa,-0x10(%rbp)
jne    116b <mrb_get_line+0x4b>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1040 <m_putc@plt>
movl   $0x1,-0x14(%rbp)
jmp    117b <mrb_get_line+0x5b>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <m_putc@plt>
jmp    1136 <mrb_get_line+0x16>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mrb_get_line>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <mrb_get@plt>
cmp    $0xffffffff,%eax
je     114d <mrb_get_line+0x2d>
cmp    $0xa,%eax
je     1151 <mrb_get_line+0x31>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <m_putc@plt>
jmp    1130 <mrb_get_line+0x10>
xor    %eax,%eax
jmp    115f <mrb_get_line+0x3f>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <m_putc@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.mrb = type { i32 }
define i32 @mrb_get_line(%struct.mrb* %0, i32 %1) {
%3 = alloca %struct.mrb*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store %struct.mrb* %0, %struct.mrb** %3
store i32 %1, i32* %4
store i32 0, i32* %6
br label %7
7: ; preds = %21, %2
%8 = load %struct.mrb*, %struct.mrb** %3
%9 = call i32 @mrb_get(%struct.mrb* %8)
store i32 %9, i32* %5
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 10
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* %4
%16 = call i32 @m_putc(i32 %15, i32 0)
store i32 1, i32* %6
br label %22
17: ; preds = %11
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = call i32 @m_putc(i32 %18, i32 %19)
br label %21
21: ; preds = %17
br label %7
22: ; preds = %14, %7
%23 = load i32, i32* %6
ret i32 %23
}

LLVM IR (-O2):
%struct.mrb = type { i32 }
define i32 @mrb_get_line(%struct.mrb* %0, i32 %1) {
br label %3
3: ; preds = %7, %2
%4 = tail call i32 @mrb_get(%struct.mrb* %0)
switch i32 %4, label %7 [
i32 -1, label %9
i32 10, label %5
]
5: ; preds = %3
%6 = tail call i32 @m_putc(i32 %1, i32 0)
br label %9
7: ; preds = %3
%8 = tail call i32 @m_putc(i32 %1, i32 %4)
br label %3
9: ; preds = %3, %5
%10 = phi i32 [ 1, %5 ], [ 0, %3 ]
ret i32 %10
}
/* Variables and functions */
char const *strerror(int);
__attribute__((visibility("default"))) const char *
trio_error(int error_number) {
  return strerror(error_number);
}


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

x86 assembly (clang, -O2):
<trio_error>:
jmp    1030 <strerror@plt>

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

LLVM IR (-O2):
define i8* @trio_error(i32 %0) {
%2 = tail call i8* @strerror(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printhello() { printf("print hello\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"print hello\00"
define void @printhello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
void INT_Excep_PERIB_INTB131(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB131() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SCB_1_UartStop();
void SCB_1_ScbModeStop(void) { SCB_1_UartStop(); }


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

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

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

LLVM IR (-O2):
define void @SCB_1_ScbModeStop() {
%1 = tail call i32 (...) @SCB_1_UartStop()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XStoreColor() {
  printf("XStoreColor called\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<XStoreColor>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [19 x i8] c"XStoreColor called\00"
define i32 @XStoreColor() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct delete_args_info {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ delete_cmdline_parser_release(struct delete_args_info *);
void delete_cmdline_parser_free(struct delete_args_info *args_info) {
  delete_cmdline_parser_release(args_info);
}


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

x86 assembly (clang, -O2):
<delete_cmdline_parser_free>:
jmp    1030 <delete_cmdline_parser_release@plt>

LLVM IR (-O0):
%struct.delete_args_info = type { i32 }
define void @delete_cmdline_parser_free(%struct.delete_args_info* %0) {
%2 = alloca %struct.delete_args_info*
store %struct.delete_args_info* %0, %struct.delete_args_info** %2
%3 = load %struct.delete_args_info*, %struct.delete_args_info** %2
%4 = call i32 @delete_cmdline_parser_release(%struct.delete_args_info* %3)
ret void
}

LLVM IR (-O2):
%struct.delete_args_info = type { i32 }
define void @delete_cmdline_parser_free(%struct.delete_args_info* %0) {
%2 = tail call i32 @delete_cmdline_parser_release(%struct.delete_args_info* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
void Test5() {
  (void *)0;
  char *c = (char *)malloc(sizeof(char));
  (void *)0;
  (void *)0;
  free(c);
  (void *)0;
}


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

x86 assembly (clang, -O2):
<Test5>:
push   %rax
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @Test5() {
%1 = alloca i8*
%2 = call i64 @malloc(i32 1)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @free(i8* %4)
ret void
}

LLVM IR (-O2):
define void @Test5() {
%1 = tail call i64 @malloc(i32 1)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @free(i8* %2)
ret void
}
int uninitialized_variable_usage_function() {
  int x;
  return x > 9000;
}


x86 assembly (clang, -O0):
<uninitialized_variable_usage_function>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x2328,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @uninitialized_variable_usage_function() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = icmp sgt i32 %2, 9000
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @uninitialized_variable_usage_function() {
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t reverse_bytes(uint64_t value) {
  return (value & 0xFF) << 56 | (value >> 8 & 0xFF) << 48 |
         (value >> 16 & 0xFF) << 40 | (value >> 24 & 0xFF) << 32 |
         (value >> 32 & 0xFF) << 24 | (value >> 40 & 0xFF) << 16 |
         (value >> 48 & 0xFF) << 8 | (value >> 56 & 0xFF);
}


x86 assembly (clang, -O0):
<reverse_bytes>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    $0x38,%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
sar    $0x8,%edx
and    $0xff,%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
sar    $0x10,%edx
and    $0xff,%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
sar    $0x18,%edx
and    $0xff,%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
mov    $0x28,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
mov    $0x30,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
mov    $0x38,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @reverse_bytes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 56
%6 = load i32, i32* %2
%7 = ashr i32 %6, 8
%8 = and i32 %7, 255
%9 = shl i32 %8, 48
%10 = or i32 %5, %9
%11 = load i32, i32* %2
%12 = ashr i32 %11, 16
%13 = and i32 %12, 255
%14 = shl i32 %13, 40
%15 = or i32 %10, %14
%16 = load i32, i32* %2
%17 = ashr i32 %16, 24
%18 = and i32 %17, 255
%19 = shl i32 %18, 32
%20 = or i32 %15, %19
%21 = load i32, i32* %2
%22 = ashr i32 %21, 32
%23 = and i32 %22, 255
%24 = shl i32 %23, 24
%25 = or i32 %20, %24
%26 = load i32, i32* %2
%27 = ashr i32 %26, 40
%28 = and i32 %27, 255
%29 = shl i32 %28, 16
%30 = or i32 %25, %29
%31 = load i32, i32* %2
%32 = ashr i32 %31, 48
%33 = and i32 %32, 255
%34 = shl i32 %33, 8
%35 = or i32 %30, %34
%36 = load i32, i32* %2
%37 = ashr i32 %36, 56
%38 = and i32 %37, 255
%39 = or i32 %35, %38
ret i32 %39
}

LLVM IR (-O2):
define i32 @reverse_bytes(i32 %0) {
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ uart_send_hex_nibble(int);
void uart_send_hex_byte(int val) {
  uart_send_hex_nibble((val >> 4) & 0x0f);
  uart_send_hex_nibble(val & 0x0f);
}


x86 assembly (clang, -O0):
<uart_send_hex_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
sar    $0x4,%edi
and    $0xf,%edi
call   1030 <uart_send_hex_nibble@plt>
mov    -0x4(%rbp),%edi
and    $0xf,%edi
call   1030 <uart_send_hex_nibble@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_send_hex_byte>:
push   %rbx
mov    %edi,%ebx
shr    $0x4,%edi
and    $0xf,%edi
call   1030 <uart_send_hex_nibble@plt>
and    $0xf,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <uart_send_hex_nibble@plt>

LLVM IR (-O0):
define void @uart_send_hex_byte(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 4
%5 = and i32 %4, 15
%6 = call i32 @uart_send_hex_nibble(i32 %5)
%7 = load i32, i32* %2
%8 = and i32 %7, 15
%9 = call i32 @uart_send_hex_nibble(i32 %8)
ret void
}

LLVM IR (-O2):
define void @uart_send_hex_byte(i32 %0) {
%2 = lshr i32 %0, 4
%3 = and i32 %2, 15
%4 = tail call i32 @uart_send_hex_nibble(i32 %3)
%5 = and i32 %0, 15
%6 = tail call i32 @uart_send_hex_nibble(i32 %5)
ret void
}
int ZopfliGetLengthSymbolExtraBits(int s) {
  static const int table[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2,
                                2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
  return table[s - 257];
}


x86 assembly (clang, -O0):
<ZopfliGetLengthSymbolExtraBits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x101,%eax
movslq %eax,%rcx
lea    0xee7(%rip),%rax
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZopfliGetLengthSymbolExtraBits>:
movslq %edi,%rax
lea    0xef6(%rip),%rcx
mov    -0x404(%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
@ZopfliGetLengthSymbolExtraBits.table = internal constant [29 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 3, i32 3, i32 3, i32 3, i32 4, i32 4, i32 4, i32 4, i32 5, i32 5, i32 5, i32 5, i32 0]
define i32 @ZopfliGetLengthSymbolExtraBits(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 257
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [29 x i32], [29 x i32]* @ZopfliGetLengthSymbolExtraBits.table, i64 0, i64 %5
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
@ZopfliGetLengthSymbolExtraBits.table = internal unnamed_addr constant [29 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 3, i32 3, i32 3, i32 3, i32 4, i32 4, i32 4, i32 4, i32 5, i32 5, i32 5, i32 5, i32 0]
define i32 @ZopfliGetLengthSymbolExtraBits(i32 %0) {
%2 = add nsw i32 %0, -257
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds [29 x i32], [29 x i32]* @ZopfliGetLengthSymbolExtraBits.table, i64 0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
int isupper(int c) { return (unsigned int)(c - 'A') < 26; }


x86 assembly (clang, -O0):
<isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x41,%eax
cmp    $0x1a,%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isupper>:
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 65
%5 = icmp ult i32 %4, 26
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @isupper(i32 %0) {
%2 = add nsw i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printk(char *);
int module_init(void) {
  printk("[kmod] Hello World :)\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<module_init>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printk@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"[kmod] Hello World :)\0A\00"
define i32 @module_init() {
%1 = call i32 @printk(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"[kmod] Hello World :)\0A\00"
define i32 @module_init() {
%1 = tail call i32 @printk(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
unsigned test5(unsigned x) {
  return ((x >> 8) & 0x00FF0000) | ((x >> 8) & 0x000000FF);
}


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff0000,%eax
mov    -0x4(%rbp),%ecx
shr    $0x8,%ecx
and    $0xff,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5>:
mov    %edi,%eax
shr    $0x8,%eax
and    $0xff00ff,%eax
ret

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

LLVM IR (-O2):
define i32 @test5(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 16711935
ret i32 %3
}
/* Type definitions */
struct ipv6_ext {
  int dummy;
};
struct ip {
  int dummy;
};

/* Variables and functions */
int findheader(int, struct ip *, void **, void **);
int getroutingheader(struct ip *pip, struct ipv6_ext **ppipv6_ext,
                     void **pplast) {
  int ret_val = findheader(43, pip, (void **)ppipv6_ext, pplast);
  return (ret_val);
}


x86 assembly (clang, -O0):
<getroutingheader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x2b,%edi
call   1030 <findheader@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getroutingheader>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x2b,%edi
jmp    1030 <findheader@plt>

LLVM IR (-O0):
%struct.ip = type { i32 }
%struct.ipv6_ext = type { i32 }
define i32 @getroutingheader(%struct.ip* %0, %struct.ipv6_ext** %1, i8** %2) {
%4 = alloca %struct.ip*
%5 = alloca %struct.ipv6_ext**
%6 = alloca i8**
%7 = alloca i32
store %struct.ip* %0, %struct.ip** %4
store %struct.ipv6_ext** %1, %struct.ipv6_ext*** %5
store i8** %2, i8*** %6
%8 = load %struct.ip*, %struct.ip** %4
%9 = load %struct.ipv6_ext**, %struct.ipv6_ext*** %5
%10 = bitcast %struct.ipv6_ext** %9 to i8**
%11 = load i8**, i8*** %6
%12 = call i32 @findheader(i32 43, %struct.ip* %8, i8** %10, i8** %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
ret i32 %13
}

LLVM IR (-O2):
%struct.ip = type { i32 }
%struct.ipv6_ext = type { i32 }
define i32 @getroutingheader(%struct.ip* %0, %struct.ipv6_ext** %1, i8** %2) {
%4 = bitcast %struct.ipv6_ext** %1 to i8**
%5 = tail call i32 @findheader(i32 43, %struct.ip* %0, i8** %4, i8** %2)
ret i32 %5
}
int name_to_num(char name) {
  switch (name) {
  case 'T':
    return (10);
  case 'J':
    return (11);
  case 'Q':
    return (12);
  case 'K':
    return (13);
  case 'A':
    return (14);
  case 'C':
    return (0);
  case 'D':
    return (1);
  case 'H':
    return (2);
  case 'S':
    return (3);
  }
}


x86 assembly (clang, -O0):
<name_to_num>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x13,%eax
ja     119b <name_to_num+0x9b>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xa,-0x4(%rbp)
jmp    119b <name_to_num+0x9b>
movl   $0xb,-0x4(%rbp)
jmp    119b <name_to_num+0x9b>
movl   $0xc,-0x4(%rbp)
jmp    119b <name_to_num+0x9b>
movl   $0xd,-0x4(%rbp)
jmp    119b <name_to_num+0x9b>
movl   $0xe,-0x4(%rbp)
jmp    119b <name_to_num+0x9b>
movl   $0x0,-0x4(%rbp)
jmp    119b <name_to_num+0x9b>
movl   $0x1,-0x4(%rbp)
jmp    119b <name_to_num+0x9b>
movl   $0x2,-0x4(%rbp)
jmp    119b <name_to_num+0x9b>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<name_to_num>:
add    $0xffffffbf,%edi
mov    $0xa,%eax
cmp    $0x12,%edi
ja     111a <name_to_num+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @name_to_num(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %15 [
i32 84, label %6
i32 74, label %7
i32 81, label %8
i32 75, label %9
i32 65, label %10
i32 67, label %11
i32 68, label %12
i32 72, label %13
i32 83, label %14
]
6: ; preds = %1
store i32 10, i32* %2
br label %15
7: ; preds = %1
store i32 11, i32* %2
br label %15
8: ; preds = %1
store i32 12, i32* %2
br label %15
9: ; preds = %1
store i32 13, i32* %2
br label %15
10: ; preds = %1
store i32 14, i32* %2
br label %15
11: ; preds = %1
store i32 0, i32* %2
br label %15
12: ; preds = %1
store i32 1, i32* %2
br label %15
13: ; preds = %1
store i32 2, i32* %2
br label %15
14: ; preds = %1
store i32 3, i32* %2
br label %15
15: ; preds = %6, %7, %8, %9, %10, %11, %12, %13, %14, %1
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@switch.table.name_to_num = [19 x i32] [i32 14, i32 10, i32 0, i32 1, i32 10, i32 10, i32 10, i32 2, i32 10, i32 11, i32 13, i32 10, i32 10, i32 10, i32 10, i32 10, i32 12, i32 10, i32 3]
define i32 @name_to_num(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -65
%4 = icmp ult i32 %3, 19
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [19 x i32], [19 x i32]* @switch.table.name_to_num, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %5, %1
%10 = phi i32 [ 10, %1 ], [ %8, %5 ]
ret i32 %10
}
unsigned long insert_mb6(unsigned long insn, long value, const char **errmsg) {
  return insn | ((value & 0x1f) << 6) | (value & 0x20);
}


x86 assembly (clang, -O0):
<insert_mb6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
and    $0x1f,%rcx
shl    $0x6,%rcx
or     %rcx,%rax
mov    -0x10(%rbp),%rcx
and    $0x20,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_mb6>:
mov    %esi,%eax
and    $0x1f,%eax
shl    $0x6,%rax
and    $0x20,%esi
or     %rdi,%rsi
or     %rsi,%rax
ret

LLVM IR (-O0):
define i64 @insert_mb6(i64 %0, i64 %1, i8** %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8**
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8** %2, i8*** %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = and i64 %8, 31
%10 = shl i64 %9, 6
%11 = or i64 %7, %10
%12 = load i64, i64* %5
%13 = and i64 %12, 32
%14 = or i64 %11, %13
ret i64 %14
}

LLVM IR (-O2):
define i64 @insert_mb6(i64 %0, i64 %1, i8** nocapture readnone %2) {
%4 = shl i64 %1, 6
%5 = and i64 %4, 1984
%6 = and i64 %1, 32
%7 = or i64 %6, %0
%8 = or i64 %7, %5
ret i64 %8
}
int main(void) {
  int a = 1;
  float b = 1.0;
  a == b;
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movss  0xee6(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store i32 0, i32* %1
store i32 1, i32* %2
store float 1.000000e+00, float* %3
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to float
%6 = load float, float* %3
%7 = fcmp oeq float %5, %6
%8 = zext i1 %7 to i32
ret i32 1
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
void _Parse_csd(void) {}


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

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

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

LLVM IR (-O2):
define void @_Parse_csd() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void SAR_L_IMM(int reg, int count) {
  addbyte(0xc1);
  addbyte(0xc0 | reg | 0x38);
  addbyte(count);
}


x86 assembly (clang, -O0):
<SAR_L_IMM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0xc1,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
or     $0xc0,%edi
or     $0x38,%edi
call   1030 <addbyte@plt>
mov    -0x8(%rbp),%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SAR_L_IMM>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0xc1,%edi
call   1030 <addbyte@plt>
or     $0xf8,%ebp
mov    %ebp,%edi
call   1030 <addbyte@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @SAR_L_IMM(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 193)
%6 = load i32, i32* %3
%7 = or i32 192, %6
%8 = or i32 %7, 56
%9 = call i32 @addbyte(i32 %8)
%10 = load i32, i32* %4
%11 = call i32 @addbyte(i32 %10)
ret void
}

LLVM IR (-O2):
define void @SAR_L_IMM(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 193)
%4 = or i32 %0, 248
%5 = tail call i32 @addbyte(i32 %4)
%6 = tail call i32 @addbyte(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ smbhash(unsigned char *, unsigned char *, unsigned char *);
void cred_hash1(unsigned char *out, unsigned char *in, unsigned char *key) {
  unsigned char buf[8];
  smbhash(buf, in, key);
  smbhash(out, buf, key + 9);
}


x86 assembly (clang, -O0):
<cred_hash1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <smbhash@plt>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x9,%rdx
call   1030 <smbhash@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cred_hash1>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rdi,%r14
lea    0x8(%rsp),%r15
mov    %r15,%rdi
call   1030 <smbhash@plt>
add    $0x9,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <smbhash@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @cred_hash1(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [8 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i32 @smbhash(i8* %8, i8* %9, i8* %10)
%12 = load i8*, i8** %4
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%14 = load i8*, i8** %6
%15 = getelementptr inbounds i8, i8* %14, i64 9
%16 = call i32 @smbhash(i8* %12, i8* %13, i8* %15)
ret void
}

LLVM IR (-O2):
define void @cred_hash1(i8* %0, i8* %1, i8* %2) {
%4 = alloca [8 x i8]
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%6 = call i32 @smbhash(i8* %5, i8* %1, i8* %2)
%7 = getelementptr inbounds i8, i8* %2, i64 9
%8 = call i32 @smbhash(i8* %0, i8* %5, i8* %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _SC_ASYNCHRONOUS_IO;
int /*<<< orphan*/ _SC_MONOTONIC_CLOCK;
int /*<<< orphan*/ exit(int);
long sysconf(int /*<<< orphan*/);
int main(void) {
  if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L ||
      sysconf(_SC_MONOTONIC_CLOCK) < 200112L)
    exit(4);
  exit(5);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
cmp    $0x30db0,%rax
jne    1163 <main+0x43>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
cmp    $0x30db0,%rax
jge    116d <main+0x4d>
mov    $0x4,%edi
call   1040 <exit@plt>
mov    $0x5,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
cmp    $0x30db0,%rax
jne    114d <main+0x2d>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
cmp    $0x30daf,%rax
jg     1157 <main+0x37>
mov    $0x4,%edi
call   1040 <exit@plt>
mov    $0x5,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@_SC_ASYNCHRONOUS_IO = global i32 0
@_SC_MONOTONIC_CLOCK = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @_SC_ASYNCHRONOUS_IO
%3 = call i64 @sysconf(i32 %2)
%4 = icmp ne i64 %3, 200112
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = load i32, i32* @_SC_MONOTONIC_CLOCK
%7 = call i64 @sysconf(i32 %6)
%8 = icmp slt i64 %7, 200112
br i1 %8, label %9, label %11
9: ; preds = %5, %0
%10 = call i32 @exit(i32 4)
unreachable
11: ; preds = %5
%12 = call i32 @exit(i32 5)
unreachable
}

LLVM IR (-O2):
@_SC_ASYNCHRONOUS_IO = global i32 0
@_SC_MONOTONIC_CLOCK = global i32 0
define i32 @main() {
%1 = load i32, i32* @_SC_ASYNCHRONOUS_IO
%2 = tail call i64 @sysconf(i32 %1)
%3 = icmp eq i64 %2, 200112
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = load i32, i32* @_SC_MONOTONIC_CLOCK
%6 = tail call i64 @sysconf(i32 %5)
%7 = icmp slt i64 %6, 200112
br i1 %7, label %8, label %10
8: ; preds = %4, %0
%9 = tail call i32 @exit(i32 4)
unreachable
10: ; preds = %4
%11 = tail call i32 @exit(i32 5)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exec(char **);
int /*<<< orphan*/ updateisrandom();
void togglerandom() {
  char *random[3] = {"mmusicd", "random", NULL};
  exec(random);
  updateisrandom();
}


x86 assembly (clang, -O0):
<togglerandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2cd1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cce(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2ccb(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <exec@plt>
mov    $0x0,%al
call   1030 <updateisrandom@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<togglerandom>:
sub    $0x18,%rsp
mov    0x2ce5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2cc9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <exec@plt>
xor    %eax,%eax
call   1030 <updateisrandom@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"mmusicd\00"
@.str.1 = [7 x i8] c"random\00"
@__const.togglerandom.random = [3 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* null]
define void @togglerandom() {
%1 = alloca [3 x i8*]
%2 = bitcast [3 x i8*]* %1 to i8*
%3 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
%4 = call i32 @exec(i8** %3)
%5 = call i32 (...) @updateisrandom()
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"mmusicd\00"
@.str.1 = [7 x i8] c"random\00"
@__const.togglerandom.random = [3 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* null]
define void @togglerandom() {
%1 = alloca [3 x i8*]
%2 = bitcast [3 x i8*]* %1 to i8*
%3 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
%4 = call i32 @exec(i8** %3)
%5 = call i32 (...) @updateisrandom()
ret void
}
int main(void) {
  "a" != 'b';
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
void ixp2000_reg_write(volatile void *reg, unsigned long val) {
  *((volatile unsigned long *)reg) = val;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
define void @ixp2000_reg_write(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i64*
store volatile i64 %5, i64* %7
ret void
}

LLVM IR (-O2):
define void @ixp2000_reg_write(i8* %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store volatile i64 %1, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void my_exit_func_1(void) { printf("my_exit_func_1\n"); }


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

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

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

LLVM IR (-O2):
@str = [15 x i8] c"my_exit_func_1\00"
define void @my_exit_func_1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int fileSize(FILE *stream) {
  int pos;
  int end;
  pos = ftell(stream);
  fseek(stream, 0, SEEK_END);
  end = ftell(stream);
  fseek(stream, pos, SEEK_SET);
  return end;
}


x86 assembly (clang, -O0):
<fileSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea5(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2e72(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileSize>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <ftell@plt>
mov    %eax,%r14d
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %eax,%ebp
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <fseek@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @fileSize(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @ftell(i32* %5)
store i32 %6, i32* %3
%7 = load i32*, i32** %2
%8 = load i32, i32* @SEEK_END
%9 = call i32 @fseek(i32* %7, i32 0, i32 %8)
%10 = load i32*, i32** %2
%11 = call i32 @ftell(i32* %10)
store i32 %11, i32* %4
%12 = load i32*, i32** %2
%13 = load i32, i32* %3
%14 = load i32, i32* @SEEK_SET
%15 = call i32 @fseek(i32* %12, i32 %13, i32 %14)
%16 = load i32, i32* %4
ret i32 %16
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @fileSize(i32* nocapture %0) {
%2 = tail call i32 @ftell(i32* %0)
%3 = load i32, i32* @SEEK_END
%4 = tail call i32 @fseek(i32* %0, i32 0, i32 %3)
%5 = tail call i32 @ftell(i32* %0)
%6 = load i32, i32* @SEEK_SET
%7 = tail call i32 @fseek(i32* %0, i32 %2, i32 %6)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int /*<<< orphan*/ const *, int);
uint16_t get16bit(const uint8_t **ptr) {
  uint32_t t16;
  memcpy(&t16, *ptr, 2);
  (*ptr) += 2;
  return ((((t16) << 8) & 0xFF00) | (((t16) >> 8) & 0xFF));
}


x86 assembly (clang, -O0):
<get16bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x2,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x8,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
and    $0xff00,%eax
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get16bit>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    (%rdi),%rsi
lea    0xc(%rsp),%rdi
mov    $0x2,%edx
call   1030 <memcpy@plt>
addq   $0x8,(%rbx)
movzwl 0xc(%rsp),%eax
rol    $0x8,%ax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get16bit(i32** %0) {
%2 = alloca i32**
%3 = alloca i32
store i32** %0, i32*** %2
%4 = load i32**, i32*** %2
%5 = load i32*, i32** %4
%6 = call i32 @memcpy(i32* %3, i32* %5, i32 2)
%7 = load i32**, i32*** %2
%8 = load i32*, i32** %7
%9 = getelementptr inbounds i32, i32* %8, i64 2
store i32* %9, i32** %7
%10 = load i32, i32* %3
%11 = shl i32 %10, 8
%12 = and i32 %11, 65280
%13 = load i32, i32* %3
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
%16 = or i32 %12, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @get16bit(i32** nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32*, i32** %0
%5 = call i32 @memcpy(i32* %2, i32* %4, i32 2)
%6 = load i32*, i32** %0
%7 = getelementptr inbounds i32, i32* %6, i64 2
store i32* %7, i32** %0
%8 = load i32, i32* %2
%9 = trunc i32 %8 to i16
%10 = call i16 @llvm.bswap.i16(i16 %9)
%11 = zext i16 %10 to i32
ret i32 %11
}
void write_dword(unsigned char *p, unsigned long v) {
  p[0] = v & 0xff;
  p[1] = (v >> 8) & 0xff;
  p[2] = (v >> 16) & 0xff;
  p[3] = (v >> 24) & 0xff;
}


x86 assembly (clang, -O0):
<write_dword>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x10(%rbp),%rax
shr    $0x18,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_dword>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @write_dword(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = and i64 %5, 255
%7 = trunc i64 %6 to i8
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i64, i64* %4
%11 = lshr i64 %10, 8
%12 = and i64 %11, 255
%13 = trunc i64 %12 to i8
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %13, i8* %15
%16 = load i64, i64* %4
%17 = lshr i64 %16, 16
%18 = and i64 %17, 255
%19 = trunc i64 %18 to i8
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 2
store i8 %19, i8* %21
%22 = load i64, i64* %4
%23 = lshr i64 %22, 24
%24 = and i64 %23, 255
%25 = trunc i64 %24 to i8
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 3
store i8 %25, i8* %27
ret void
}

LLVM IR (-O2):
define void @write_dword(i8* nocapture writeonly %0, i64 %1) {
%3 = trunc i64 %1 to i8
store i8 %3, i8* %0
%4 = lshr i64 %1, 8
%5 = trunc i64 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i64 %1, 16
%8 = trunc i64 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = lshr i64 %1, 24
%11 = trunc i64 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
/* Variables and functions */
unsigned char *random_bytes(unsigned char *, size_t);
unsigned char *generate_bytes_random(unsigned char *out, size_t len) {
  return random_bytes(out, len);
}


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

x86 assembly (clang, -O2):
<generate_bytes_random>:
jmp    1030 <random_bytes@plt>

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

LLVM IR (-O2):
define i8* @generate_bytes_random(i8* %0, i64 %1) {
%3 = tail call i8* @random_bytes(i8* %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ bounce_error(long);
void bounce_drop_error(void) { bounce_error(8l); }


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

x86 assembly (clang, -O2):
<bounce_drop_error>:
mov    $0x8,%edi
jmp    1030 <bounce_error@plt>

LLVM IR (-O0):
define void @bounce_drop_error() {
%1 = call i32 @bounce_error(i64 8)
ret void
}

LLVM IR (-O2):
define void @bounce_drop_error() {
%1 = tail call i32 @bounce_error(i64 8)
ret void
}
/* Variables and functions */
int connect_robot(int);
int server_is_running() { return (connect_robot(1)); }


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

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

LLVM IR (-O0):
define i32 @server_is_running() {
%1 = call i32 @connect_robot(i32 1)
ret i32 %1
}

LLVM IR (-O2):
define i32 @server_is_running() {
%1 = tail call i32 @connect_robot(i32 1)
ret i32 %1
}
/* Variables and functions */
int rom_present(char *);
int mach64gx_vlb_available(void) {
  return rom_present(L"roms/video/mach64/mach64_vlb_vram.bin");
}


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

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

LLVM IR (-O0):
@.str = [38 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 109, i32 97, i32 99, i32 104, i32 54, i32 52, i32 47, i32 109, i32 97, i32 99, i32 104, i32 54, i32 52, i32 95, i32 118, i32 108, i32 98, i32 95, i32 118, i32 114, i32 97, i32 109, i32 46, i32 98, i32 105, i32 110, i32 0]
define i32 @mach64gx_vlb_available() {
%1 = call i32 @rom_present(i8* bitcast ([38 x i32]* @.str to i8*))
ret i32 %1
}

LLVM IR (-O2):
@.str = [38 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 109, i32 97, i32 99, i32 104, i32 54, i32 52, i32 47, i32 109, i32 97, i32 99, i32 104, i32 54, i32 52, i32 95, i32 118, i32 108, i32 98, i32 95, i32 118, i32 114, i32 97, i32 109, i32 46, i32 98, i32 105, i32 110, i32 0]
define i32 @mach64gx_vlb_available() {
%1 = tail call i32 @rom_present(i8* bitcast ([38 x i32]* @.str to i8*))
ret i32 %1
}
/* Variables and functions */
int answer();
int main(int argc, char *argv[]) { return answer(); }


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @answer()
ret i32 %3
}
int add(int a, int b) {
  if (b == 0) {
    return a;
  }
  int sum = a ^ b;
  int carry = (a & b) << 1;
  a = sum;
  b = carry;
  return add(a, b);
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <add+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <add+0x52>
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <add@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
test   %esi,%esi
je     111d <add+0x1d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %esi,%eax
xor    %edi,%eax
and    %edi,%esi
mov    %eax,%edi
add    %esi,%esi
jne    1110 <add+0x10>
ret
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %9, %4 ], [ %1, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = xor i32 %5, %6
%8 = and i32 %5, %6
%9 = shl i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = phi i32 [ %0, %2 ], [ %7, %4 ]
ret i32 %12
}