xunge/DecIR huggingface dataset:
int adv_ws(char *buffer, int *pos) {
  bwx_DEBUG(__FUNCTION__);
  while (buffer[*pos] == ' ')
    (*pos)++;
  return 0;
}


x86 assembly (clang, -O0):
<adv_ws>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <bwx_DEBUG@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1156 <adv_ws+0x46>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    112e <adv_ws+0x1e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adv_ws>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xedf(%rip),%rdi
xor    %eax,%eax
call   1030 <bwx_DEBUG@plt>
movslq (%rbx),%rcx
cmpb   $0x20,(%r14,%rcx,1)
jne    114e <adv_ws+0x3e>
lea    (%rcx,%r14,1),%rax
add    $0x1,%rax
add    $0x1,%ecx
nopl   (%rax)
mov    %ecx,(%rbx)
add    $0x1,%ecx
cmpb   $0x20,(%rax)
lea    0x1(%rax),%rax
je     1140 <adv_ws+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__FUNCTION__.adv_ws = [7 x i8] c"adv_ws\00"
define i32 @adv_ws(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @bwx_DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__FUNCTION__.adv_ws, i64 0, i64 0))
br label %6
6: ; preds = %15, %2
%7 = load i8*, i8** %3
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %19
15: ; preds = %6
%16 = load i32*, i32** %4
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
store i32 %18, i32* %16
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@__FUNCTION__.adv_ws = [7 x i8] c"adv_ws\00"
define i32 @adv_ws(i8* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @bwx_DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__FUNCTION__.adv_ws, i64 0, i64 0))
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 32
br i1 %8, label %9, label %16
9: ; preds = %2, %9
%10 = phi i64 [ %11, %9 ], [ %5, %2 ]
%11 = add i64 %10, 1
%12 = trunc i64 %11 to i32
store i32 %12, i32* %1
%13 = getelementptr inbounds i8, i8* %0, i64 %11
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 32
br i1 %15, label %9, label %16
16: ; preds = %9, %2
ret i32 0
}
void flip_page(void) { return; }


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

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

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

LLVM IR (-O2):
define void @flip_page() {
ret void
}
void multi_gt() {
  register int out0 = 0;
  register int in1 = 1;
  asm("foo %1,%0" : "=r,r"(out0) : "r,>r"(in1));
  asm("foo %1,%0" : "=r,r"(out0) : "r,r>"(in1));
}


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

LLVM IR (-O0):
LLVM IR (-O2):
define void @multi_gt() {
%1 = tail call i32 asm "foo $1,$0", "=r|r,r|>r,~{dirflag},~{fpsr},~{flags}"(i32 1)
%2 = tail call i32 asm "foo $1,$0", "=r|r,r|r>,~{dirflag},~{fpsr},~{flags}"(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int fnet_set_reuse_addr(int fd) {
  int optval = 0x1;
  return setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(int));
}


x86 assembly (clang, -O0):
<fnet_set_reuse_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnet_set_reuse_addr>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @fnet_set_reuse_addr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @SOL_SOCKET
%6 = load i32, i32* @SO_REUSEADDR
%7 = call i32 @setsockopt(i32 %4, i32 %5, i32 %6, i32* %3, i32 4)
ret i32 %7
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @fnet_set_reuse_addr(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_REUSEADDR
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
ret i32 %6
}
/* Variables and functions */
int partition(int **, int, int);
void quickSort(int **arr, int low, int high) {
  int pivot;
  if (high - low > 0) {
    pivot = partition(arr, low, high);
    quickSort(arr, low, pivot - 1);
    quickSort(arr, pivot + 1, high);
  }
}


x86 assembly (clang, -O0):
<quickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x0,%eax
jle    1177 <quickSort+0x57>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quickSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quickSort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickSort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %esi,%edx
jle    1166 <quickSort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quickSort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quickSort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quickSort(i32** %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, %1
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32** %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quickSort(i32** %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Variables and functions */
int PMI_Abort(int, char const *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int map_pmi_error(int);
int /*<<< orphan*/ stderr;
int PMI2_Abort(int flag, const char msg[]) {
  if (flag) {
    int e;
    e = PMI_Abort(1, msg);
    return map_pmi_error(e);
  } else {
    fprintf(stderr, "PMI2_Abort: %s\n", msg);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<PMI2_Abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1178 <PMI2_Abort+0x38>
mov    -0x10(%rbp),%rsi
mov    $0x1,%edi
call   1040 <PMI_Abort@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <map_pmi_error@plt>
add    $0x20,%rsp
pop    %rbp
ret
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe74(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<PMI2_Abort>:
push   %rax
mov    %rsi,%rdx
test   %edi,%edi
je     115d <PMI2_Abort+0x1d>
mov    $0x1,%edi
mov    %rdx,%rsi
call   1040 <PMI_Abort@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <map_pmi_error@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xe93(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"PMI2_Abort: %s\0A\00"
define i32 @PMI2_Abort(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i32 @PMI_Abort(i32 1, i8* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = call i32 @map_pmi_error(i32 %11)
ret i32 %12
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %4
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"PMI2_Abort: %s\0A\00"
define i32 @PMI2_Abort(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @PMI_Abort(i32 1, i8* %1)
%6 = tail call i32 @map_pmi_error(i32 %5)
ret i32 %6
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %1)
%10 = tail call i32 @exit(i32 1)
unreachable
}
void LibraryFunction(void) {}


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

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

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

LLVM IR (-O2):
define void @LibraryFunction() {
ret void
}
void get_var_count(int *n) { *n = 3; }


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

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

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

LLVM IR (-O2):
define void @get_var_count(i32* nocapture writeonly %0) {
store i32 3, i32* %0
ret void
}
int power(int n) {
  int i, p = 1;
  for (i = 0; i < n; i++)
    p *= 2;
  return p;
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1138 <power+0x38>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <power+0x15>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
test   %edi,%edi
jle    1118 <power+0x18>
lea    -0x1(%rdi),%eax
mov    %edi,%ecx
and    $0x7,%ecx
cmp    $0x7,%eax
jae    111e <power+0x1e>
mov    $0x1,%eax
jmp    1138 <power+0x38>
mov    $0x1,%eax
ret
and    $0xfffffff8,%edi
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
shl    $0x8,%eax
add    $0xfffffff8,%edi
jne    1130 <power+0x30>
test   %ecx,%ecx
je     1147 <power+0x47>
nopl   0x0(%rax)
add    %eax,%eax
add    $0xffffffff,%ecx
jne    1140 <power+0x40>
ret

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

LLVM IR (-O2):
define i32 @power(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %25
3: ; preds = %1
%4 = add i32 %0, -1
%5 = and i32 %0, 7
%6 = icmp ult i32 %4, 7
br i1 %6, label %15, label %7
7: ; preds = %3
%8 = and i32 %0, -8
br label %9
9: ; preds = %9, %7
%10 = phi i32 [ 1, %7 ], [ %12, %9 ]
%11 = phi i32 [ 0, %7 ], [ %13, %9 ]
%12 = shl i32 %10, 8
%13 = add i32 %11, 8
%14 = icmp eq i32 %13, %8
br i1 %14, label %15, label %9
15: ; preds = %9, %3
%16 = phi i32 [ undef, %3 ], [ %12, %9 ]
%17 = phi i32 [ 1, %3 ], [ %12, %9 ]
%18 = icmp eq i32 %5, 0
br i1 %18, label %25, label %19
19: ; preds = %15, %19
%20 = phi i32 [ %22, %19 ], [ %17, %15 ]
%21 = phi i32 [ %23, %19 ], [ 0, %15 ]
%22 = shl nsw i32 %20, 1
%23 = add i32 %21, 1
%24 = icmp eq i32 %23, %5
br i1 %24, label %25, label %19
25: ; preds = %15, %19, %1
%26 = phi i32 [ 1, %1 ], [ %16, %15 ], [ %22, %19 ]
ret i32 %26
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ewe(char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
void safe_file(char *name) {
  FILE *file;
  file = fopen(name, "rb");
  if (!file) {
    ewe("File %s not found\n", name);
  }
  fclose(file);
}


x86 assembly (clang, -O0):
<safe_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116b <safe_file+0x3b>
mov    -0x8(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1040 <ewe@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_file>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115a <safe_file+0x2a>
lea    0xeb1(%rip),%rdi
mov    %r14,%rsi
call   1040 <ewe@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [19 x i8] c"File %s not found\0A\00"
define void @safe_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @ewe(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %1
%12 = load i32*, i32** %3
%13 = call i32 @fclose(i32* %12)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [19 x i8] c"File %s not found\0A\00"
define void @safe_file(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @ewe(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @fclose(i32* %2)
ret void
}
/* Type definitions */
struct ir_remote {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ clear_rec_buffer();
char *decode_all(struct ir_remote *);
char *i2cuser_rec(struct ir_remote *remotes) {
  if (!clear_rec_buffer())
    return NULL;
  return decode_all(remotes);
}


x86 assembly (clang, -O0):
<i2cuser_rec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <clear_rec_buffer@plt>
cmp    $0x0,%eax
jne    1149 <i2cuser_rec+0x29>
movq   $0x0,-0x8(%rbp)
jmp    1156 <i2cuser_rec+0x36>
mov    -0x10(%rbp),%rdi
call   1040 <decode_all@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2cuser_rec>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <clear_rec_buffer@plt>
test   %eax,%eax
je     1138 <i2cuser_rec+0x18>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <decode_all@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ir_remote = type { i32 }
define i8* @i2cuser_rec(%struct.ir_remote* %0) {
%2 = alloca i8*
%3 = alloca %struct.ir_remote*
store %struct.ir_remote* %0, %struct.ir_remote** %3
%4 = call i32 (...) @clear_rec_buffer()
%5 = icmp ne i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
store i8* null, i8** %2
br label %10
7: ; preds = %1
%8 = load %struct.ir_remote*, %struct.ir_remote** %3
%9 = call i8* @decode_all(%struct.ir_remote* %8)
store i8* %9, i8** %2
br label %10
10: ; preds = %7, %6
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
%struct.ir_remote = type { i32 }
define i8* @i2cuser_rec(%struct.ir_remote* %0) {
%2 = tail call i32 (...) @clear_rec_buffer()
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i8* @decode_all(%struct.ir_remote* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i8* [ %5, %4 ], [ null, %1 ]
ret i8* %7
}
/* Variables and functions */
void *a(size_t);
void *b2(size_t n) { return a(n); }


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

x86 assembly (clang, -O2):
<b2>:
jmp    1030 <a@plt>

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

LLVM IR (-O2):
define i8* @b2(i64 %0) {
%2 = tail call i8* @a(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void clear() { system("@cls||clear"); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"@cls||clear\00"
define void @clear() {
%1 = call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"@cls||clear\00"
define void @clear() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
__attribute__((always_)) void write8(volatile void *addr, uint8_t value) {
  *((volatile uint8_t *)(addr)) = value;
}


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

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

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

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


x86 assembly (clang, -O0):
<test_printing>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_printing>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"(Writing to stdout)\00"
@stdout = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define void @test_printing() {
%1 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"(Writing to stdout)\00"
@stdout = global i32 0
define void @test_printing() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fail(char *, char *);
unsigned long strtol(char *, char **, int);
unsigned long htol(char *hex) {
  char *end;
  unsigned long l = strtol(hex, &end, 16);
  if (*end)
    fail("bad hex number: %s", hex);
  return l;
}


x86 assembly (clang, -O0):
<htol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115f <htol+0x3f>
mov    -0x8(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1030 <fail@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<htol>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsp,%rsi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %rax,%r14
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
je     114f <htol+0x2f>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <fail@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"bad hex number: %s\00"
define i64 @htol(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strtol(i8* %5, i8** %3, i32 16)
store i64 %6, i64* %4
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @fail(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %10, %1
%14 = load i64, i64* %4
ret i64 %14
}

LLVM IR (-O2):
@.str = [19 x i8] c"bad hex number: %s\00"
define i64 @htol(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i64 @strtol(i8* %0, i8** %2, i32 16)
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 @fail(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %8, %1
ret i64 %4
}
int is_far(int operand) { return operand <= 0xFFFFFF; }


x86 assembly (clang, -O0):
<is_far>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffff,-0x4(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_far>:
xor    %eax,%eax
cmp    $0x1000000,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @is_far(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 16777215
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @is_far(i32 %0) {
%2 = icmp slt i32 %0, 16777216
%3 = zext i1 %2 to i32
ret i32 %3
}
void foo367() {}


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

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

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

LLVM IR (-O2):
define void @foo367() {
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int __semihost(int, scalar_t__ *);
scalar_t__ strlen(char const *);
int semihost_remove(const char *name) {
  uint32_t args[2];
  args[0] = (uint32_t)name;
  args[1] = (uint32_t)strlen(name);
  return __semihost((0xe), args);
}


x86 assembly (clang, -O0):
<semihost_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0xe,%edi
call   1040 <__semihost@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<semihost_remove>:
sub    $0x18,%rsp
mov    %rdi,(%rsp)
call   1030 <strlen@plt>
mov    %rax,0x8(%rsp)
mov    %rsp,%rsi
mov    $0xe,%edi
call   1040 <__semihost@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @semihost_remove(i8* %0) {
%2 = alloca i8*
%3 = alloca [2 x i64]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
%6 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 0
store i64 %5, i64* %6
%7 = load i8*, i8** %2
%8 = call i64 @strlen(i8* %7)
%9 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 1
store i64 %8, i64* %9
%10 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 0
%11 = call i32 @__semihost(i32 14, i64* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @semihost_remove(i8* %0) {
%2 = alloca [2 x i64]
%3 = bitcast [2 x i64]* %2 to i8*
%4 = ptrtoint i8* %0 to i64
%5 = getelementptr inbounds [2 x i64], [2 x i64]* %2, i64 0, i64 0
store i64 %4, i64* %5
%6 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%7 = getelementptr inbounds [2 x i64], [2 x i64]* %2, i64 0, i64 1
store i64 %6, i64* %7
%8 = call i32 @__semihost(i32 14, i64* %5)
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int SHUT_RD;
int SHUT_RDWR;
int SHUT_WR;
int /*<<< orphan*/ shutdown(int, int);
ssize_t test(void) {
  int sockfd = 4;
  int how;
  how = SHUT_RD;
  how = SHUT_WR;
  how = SHUT_RDWR;
  return shutdown(sockfd, how);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x4,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <shutdown@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edi
jmp    1030 <shutdown@plt>

LLVM IR (-O0):
@SHUT_RD = global i32 0
@SHUT_WR = global i32 0
@SHUT_RDWR = global i32 0
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
store i32 4, i32* %1
%3 = load i32, i32* @SHUT_RD
store i32 %3, i32* %2
%4 = load i32, i32* @SHUT_WR
store i32 %4, i32* %2
%5 = load i32, i32* @SHUT_RDWR
store i32 %5, i32* %2
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @shutdown(i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@SHUT_RD = global i32 0
@SHUT_WR = global i32 0
@SHUT_RDWR = global i32 0
define i32 @test() {
%1 = load i32, i32* @SHUT_RDWR
%2 = tail call i32 @shutdown(i32 4, i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ func_loopfb();
int /*<<< orphan*/ func_nofb();
int main(void) {
  int main_var = 1;
  func_nofb();
  func_loopfb();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @func_nofb()
%2 = tail call i32 (...) @func_loopfb()
ret i32 0
}
/* Variables and functions */
size_t HUF_compressBound(size_t size) {
  return (129 + (size + (size >> 8) + 8));
}


x86 assembly (clang, -O0):
<HUF_compressBound>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x8,%rcx
add    %rcx,%rax
add    $0x8,%rax
add    $0x81,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HUF_compressBound>:
mov    %rdi,%rax
shr    $0x8,%rax
add    %rdi,%rax
add    $0x89,%rax
ret

LLVM IR (-O0):
define i64 @HUF_compressBound(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* %2
%5 = lshr i64 %4, 8
%6 = add i64 %3, %5
%7 = add i64 %6, 8
%8 = add i64 129, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @HUF_compressBound(i64 %0) {
%2 = lshr i64 %0, 8
%3 = add i64 %0, 137
%4 = add i64 %3, %2
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("hello World"); }


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"hello World\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DrawScreenElementExt(int, int, int, int, int, int,
                                        int /*<<< orphan*/);
void DrawScreenElementShifted(int x, int y, int dx, int dy, int element,
                              int cut_mode) {
  DrawScreenElementExt(x, y, dx, dy, element, cut_mode, 0);
}


x86 assembly (clang, -O0):
<DrawScreenElementShifted>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1030 <DrawScreenElementExt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawScreenElementShifted>:
push   %rax
movl   $0x0,(%rsp)
call   1030 <DrawScreenElementExt@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @DrawScreenElementShifted(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = load i32, i32* %12
%19 = call i32 @DrawScreenElementExt(i32 %13, i32 %14, i32 %15, i32 %16, i32 %17, i32 %18, i32 0)
ret void
}

LLVM IR (-O2):
define void @DrawScreenElementShifted(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @DrawScreenElementExt(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *, int);
void usage(const char *pname) {
  printf("usage:\n  %s <ncores> <nterm> <philosophers> <bites>\n\n      "
         "where:\n    <ncores> is the number of cpu cores to use,\n    <nterm> "
         "is the number of terminals to use,\n    <philosiphers> is from 1 to "
         "%d\n    <bites> is the number of times each philisopher eats.\n",
         pname, 65536);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x10000,%edx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
mov    $0x10000,%edx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [255 x i8] c"usage:\0A %s <ncores> <nterm> <philosophers> <bites>\0A\0A where:\0A <ncores> is the number of cpu cores to use,\0A <nterm> is the number of terminals to use,\0A <philosiphers> is from 1 to %d\0A <bites> is the number of times each philisopher eats.\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([255 x i8], [255 x i8]* @.str, i64 0, i64 0), i8* %3, i32 65536)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [255 x i8] c"usage:\0A %s <ncores> <nterm> <philosophers> <bites>\0A\0A where:\0A <ncores> is the number of cpu cores to use,\0A <nterm> is the number of terminals to use,\0A <philosiphers> is from 1 to %d\0A <bites> is the number of times each philisopher eats.\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([255 x i8], [255 x i8]* @.str, i64 0, i64 0), i8* %0, i32 65536)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void SysCtlBrownOutConfigSet(unsigned long ulConfig, unsigned long ulDelay) {
  ;
  ;
  (*((volatile unsigned long *)(0x400FE030))) = (ulDelay << 2) | ulConfig;
}


x86 assembly (clang, -O0):
<SysCtlBrownOutConfigSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
shl    $0x2,%rcx
or     -0x8(%rbp),%rcx
mov    $0x400fe030,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlBrownOutConfigSet>:
shl    $0x2,%rsi
or     %rdi,%rsi
mov    %rsi,0x400fe030
40
ret

LLVM IR (-O0):
define void @SysCtlBrownOutConfigSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = shl i64 %5, 2
%7 = load i64, i64* %3
%8 = or i64 %6, %7
store volatile i64 %8, i64* inttoptr (i64 1074782256 to i64*)
ret void
}

LLVM IR (-O2):
define void @SysCtlBrownOutConfigSet(i64 %0, i64 %1) {
%3 = shl i64 %1, 2
%4 = or i64 %3, %0
store volatile i64 %4, i64* inttoptr (i64 1074782256 to i64*)
ret void
}
int test_imm_E4int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xE4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E4int64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0xe4,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_E4int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 228
%7 = icmp ne i64 %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_E4int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 14942208
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void check_stack(void) {}


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

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

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

LLVM IR (-O2):
define void @check_stack() {
ret void
}
int increment(void) {
  static int i = 0;
  return i++;
}


x86 assembly (clang, -O0):
<increment>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f0f(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<increment>:
mov    0x2f1e(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2f15(%rip)
ret

LLVM IR (-O0):
@increment.i = internal global i32 0
define i32 @increment() {
%1 = load i32, i32* @increment.i
%2 = add nsw i32 %1, 1
store i32 %2, i32* @increment.i
ret i32 %1
}

LLVM IR (-O2):
@increment.i = internal unnamed_addr global i32 0
define i32 @increment() {
%1 = load i32, i32* @increment.i
%2 = add nsw i32 %1, 1
store i32 %2, i32* @increment.i
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ notify_pvcall(char *);
int pvSetPortNumber(char byBoardNum, char byPortNum) {
  notify_pvcall("f");
  return (0);
}


x86 assembly (clang, -O0):
<pvSetPortNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <notify_pvcall@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [2 x i8] c"f\00"
define i32 @pvSetPortNumber(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"f\00"
define i32 @pvSetPortNumber(i8 signext %0, i8 signext %1) {
%3 = tail call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int product(int a, int b) { return a * b; }


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

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

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

LLVM IR (-O2):
define i32 @product(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ arch_hard_reset();
void arch_reset(char mode) {
  (void)mode;
  arch_hard_reset();
}


x86 assembly (clang, -O0):
<arch_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1030 <arch_hard_reset@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @arch_reset(i8 signext %0) {
%2 = tail call i32 (...) @arch_hard_reset()
ret void
}
unsigned char hexval(char c) {
  unsigned char v = 0;
  if (c <= '9')
    v = c - '0';
  else if (c <= 'F')
    v = c + 10 - 'A';
  else if (c <= 'f')
    v = c + 10 - 'a';
  return v;
}


x86 assembly (clang, -O0):
<hexval>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     112a <hexval+0x2a>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x2(%rbp)
jmp    116d <hexval+0x6d>
movsbl -0x1(%rbp),%eax
cmp    $0x46,%eax
jg     1149 <hexval+0x49>
movsbl -0x1(%rbp),%eax
add    $0xa,%eax
sub    $0x41,%eax
mov    %al,-0x2(%rbp)
jmp    1168 <hexval+0x68>
movsbl -0x1(%rbp),%eax
cmp    $0x66,%eax
jg     1163 <hexval+0x63>
movsbl -0x1(%rbp),%eax
add    $0xa,%eax
sub    $0x61,%eax
mov    %al,-0x2(%rbp)
jmp    1168 <hexval+0x68>
jmp    116d <hexval+0x6d>
movzbl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexval>:
mov    %edi,%eax
cmp    $0x39,%al
jg     1109 <hexval+0x9>
add    $0xd0,%al
ret
cmp    $0x46,%al
ja     1110 <hexval+0x10>
add    $0xc9,%al
ret
lea    -0x57(%rax),%ecx
xor    %edx,%edx
cmp    $0x67,%al
movzbl %cl,%eax
cmovae %edx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @hexval(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
store i8 0, i8* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp sle i32 %5, 57
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 48
%11 = trunc i32 %10 to i8
store i8 %11, i8* %3
br label %34
12: ; preds = %1
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp sle i32 %14, 70
br i1 %15, label %16, label %22
16: ; preds = %12
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = add nsw i32 %18, 10
%20 = sub nsw i32 %19, 65
%21 = trunc i32 %20 to i8
store i8 %21, i8* %3
br label %33
22: ; preds = %12
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 102
br i1 %25, label %26, label %32
26: ; preds = %22
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = add nsw i32 %28, 10
%30 = sub nsw i32 %29, 97
%31 = trunc i32 %30 to i8
store i8 %31, i8* %3
br label %32
32: ; preds = %26, %22
br label %33
33: ; preds = %32, %16
br label %34
34: ; preds = %33, %7
%35 = load i8, i8* %3
ret i8 %35
}

LLVM IR (-O2):
define zeroext i8 @hexval(i8 signext %0) {
%2 = icmp slt i8 %0, 58
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = add i8 %0, -48
br label %13
5: ; preds = %1
%6 = icmp ult i8 %0, 71
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = add nsw i8 %0, -55
br label %13
9: ; preds = %5
%10 = icmp ult i8 %0, 103
%11 = add nsw i8 %0, -87
%12 = select i1 %10, i8 %11, i8 0
br label %13
13: ; preds = %9, %7, %3
%14 = phi i8 [ %4, %3 ], [ %8, %7 ], [ %12, %9 ]
ret i8 %14
}
/* Variables and functions */
int /*<<< orphan*/ armfunc(int);
void cpufunc(void) { armfunc(17); }


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

x86 assembly (clang, -O2):
<cpufunc>:
mov    $0x11,%edi
jmp    1030 <armfunc@plt>

LLVM IR (-O0):
define void @cpufunc() {
%1 = call i32 @armfunc(i32 17)
ret void
}

LLVM IR (-O2):
define void @cpufunc() {
%1 = tail call i32 @armfunc(i32 17)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void print_help(char *name) {
  fprintf(
      stderr,
      "\nUsage:\t%s { [-B -l length] address | address data }\n"
      "\t-B      : enable binary data output (e.g. for dumping memory to "
      "file)\n"
      "\tlength  : length of data in bytes to act upon, starting at address\n"
      "\taddress : memory address to act upon\n"
      "\tdata    : data word to be written\n\n",
      name);
}


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [267 x i8] c"\0AUsage:\09%s { [-B -l length] address | address data }\0A\09-B : enable binary data output (e.g. for dumping memory to file)\0A\09length : length of data in bytes to act upon, starting at address\0A\09address : memory address to act upon\0A\09data : data word to be written\0A\0A\00"
define void @print_help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([267 x i8], [267 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [267 x i8] c"\0AUsage:\09%s { [-B -l length] address | address data }\0A\09-B : enable binary data output (e.g. for dumping memory to file)\0A\09length : length of data in bytes to act upon, starting at address\0A\09address : memory address to act upon\0A\09data : data word to be written\0A\0A\00"
define void @print_help(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([267 x i8], [267 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fwrite(void *, size_t, size_t, int /*<<< orphan*/ *);
size_t write_chunk_to_file(void *ptr, size_t size, size_t nmemb, void *stream) {
  return fwrite(ptr, size, nmemb, (FILE *)stream);
}


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

x86 assembly (clang, -O2):
<write_chunk_to_file>:
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
define i64 @write_chunk_to_file(i8* %0, i64 %1, i64 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load i8*, i8** %8
%13 = bitcast i8* %12 to i32*
%14 = call i64 @fwrite(i8* %9, i64 %10, i64 %11, i32* %13)
ret i64 %14
}

LLVM IR (-O2):
define i64 @write_chunk_to_file(i8* nocapture %0, i64 %1, i64 %2, i8* nocapture %3) {
%5 = bitcast i8* %3 to i32*
%6 = tail call i64 @fwrite(i8* %0, i64 %1, i64 %2, i32* %5)
ret i64 %6
}
int sim_cambri_read(int c, char *buf, int len) { return 0; }


x86 assembly (clang, -O0):
<sim_cambri_read>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @sim_cambri_read(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Type definitions */
typedef int __u8;

/* Variables and functions */
int hea_u8_bit(int);
int hea_test_u8_bit(__u8 v, int b) { return !!(v & hea_u8_bit(b)); }


x86 assembly (clang, -O0):
<hea_test_u8_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <hea_u8_bit@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hea_test_u8_bit>:
push   %rbx
mov    %edi,%ebx
mov    %esi,%edi
call   1030 <hea_u8_bit@plt>
xor    %ecx,%ecx
test   %ebx,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @hea_test_u8_bit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @hea_u8_bit(i32 %6)
%8 = and i32 %5, %7
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @hea_test_u8_bit(i32 %0, i32 %1) {
%3 = tail call i32 @hea_u8_bit(i32 %1)
%4 = and i32 %3, %0
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
unsigned g(int x) {
  x += 123;
  unsigned y = x;
  y -= 99;
  return y;
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7b,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x63,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @g(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 123
store i32 %5, i32* %2
%6 = load i32, i32* %2
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = sub i32 %7, 99
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @g(i32 %0) {
%2 = add i32 %0, 24
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ app_message_deregister_callbacks();
void moonModule_deinit() { app_message_deregister_callbacks(); }


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

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

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

LLVM IR (-O2):
define void @moonModule_deinit() {
%1 = tail call i32 (...) @app_message_deregister_callbacks()
ret void
}