xunge/DecIR huggingface dataset:
void intmap(int array[], int arrayLength, int (*function)(int)) {
  for (int i = 0; i < arrayLength; i++) {
    array[i] = function(array[i]);
  }
}


x86 assembly (clang, -O0):
<intmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1152 <intmap+0x52>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
mov    (%rcx,%rdx,4),%edi
call   *%rax
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111a <intmap+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intmap>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1134 <intmap+0x34>
mov    %rdx,%r14
mov    %rdi,%r12
mov    %esi,%r15d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rbx,4),%edi
call   *%r14
mov    %eax,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1120 <intmap+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @intmap(i32* nocapture %0, i32 %1, i32 (i32)* nocapture %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %8
7: ; preds = %8, %3
ret void
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %13, %8 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 %2(i32 %11)
store i32 %12, i32* %10
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %7, label %8
}
/* Type definitions */
struct cmd_arg {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ showStatus();
void cmdShowSystemStatus(int cmdType, struct cmd_arg *pCmdArg) { showStatus(); }


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

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

LLVM IR (-O0):
%struct.cmd_arg = type { i32 }
define void @cmdShowSystemStatus(i32 %0, %struct.cmd_arg* %1) {
%3 = alloca i32
%4 = alloca %struct.cmd_arg*
store i32 %0, i32* %3
store %struct.cmd_arg* %1, %struct.cmd_arg** %4
%5 = call i32 (...) @showStatus()
ret void
}

LLVM IR (-O2):
%struct.cmd_arg = type { i32 }
define void @cmdShowSystemStatus(i32 %0, %struct.cmd_arg* nocapture readnone %1) {
%3 = tail call i32 (...) @showStatus()
ret void
}
/* Variables and functions */
int pigpio_command(int, int, int /*<<< orphan*/, int /*<<< orphan*/, int);
int wave_tx_busy(int pi) { return pigpio_command(pi, 32, 0, 0, 1); }


x86 assembly (clang, -O0):
<wave_tx_busy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%esi
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %ecx,%edx
call   1030 <pigpio_command@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wave_tx_busy>:
mov    $0x20,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
jmp    1030 <pigpio_command@plt>

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

LLVM IR (-O2):
define i32 @wave_tx_busy(i32 %0) {
%2 = tail call i32 @pigpio_command(i32 %0, i32 32, i32 0, i32 0, i32 1)
ret i32 %2
}
/* Type definitions */
struct token_tree_s {
  int dummy;
};
struct token_queue_s {
  int dummy;
};

/* Variables and functions */
struct token_tree_s *expr(struct token_queue_s *);
struct token_tree_s *parse(struct token_queue_s *tkn_list) {
  return expr(tkn_list);
}


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

x86 assembly (clang, -O2):
<parse>:
jmp    1030 <expr@plt>

LLVM IR (-O0):
%struct.token_tree_s = type { i32 }
%struct.token_queue_s = type { i32 }
define %struct.token_tree_s* @parse(%struct.token_queue_s* %0) {
%2 = alloca %struct.token_queue_s*
store %struct.token_queue_s* %0, %struct.token_queue_s** %2
%3 = load %struct.token_queue_s*, %struct.token_queue_s** %2
%4 = call %struct.token_tree_s* @expr(%struct.token_queue_s* %3)
ret %struct.token_tree_s* %4
}

LLVM IR (-O2):
%struct.token_tree_s = type { i32 }
%struct.token_queue_s = type { i32 }
define %struct.token_tree_s* @parse(%struct.token_queue_s* %0) {
%2 = tail call %struct.token_tree_s* @expr(%struct.token_queue_s* %0)
ret %struct.token_tree_s* %2
}
int sysSave(char *dst, int i, int ldst, char *filename, int j, int len) {}


x86 assembly (clang, -O0):
<sysSave>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @sysSave(i8* %0, i32 %1, i32 %2, i8* %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i8* %3, i8** %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%14 = load i32, i32* %7
ret i32 %14
}

LLVM IR (-O2):
define i32 @sysSave(i8* nocapture readnone %0, i32 %1, i32 %2, i8* nocapture readnone %3, i32 %4, i32 %5) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ fclose(void *);
int /*<<< orphan*/ printf(char *);
void cleanup_routine(void *arg) {
  printf("Called clean-up handler\n");
  fclose(arg);
}


x86 assembly (clang, -O0):
<cleanup_routine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup_routine>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fclose@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Called clean-up handler\0A\00"
define void @cleanup_routine(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @fclose(i8* %4)
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"Called clean-up handler\00"
define void @cleanup_routine(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @fclose(i8* %0)
ret void
}
void caam_qi_algapi_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @caam_qi_algapi_exit() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
long lseek(int, int /*<<< orphan*/, int);
long fseek(int i, off_t pos, int wh) { return lseek(i, pos, wh); }


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

x86 assembly (clang, -O2):
<fseek>:
jmp    1030 <lseek@plt>

LLVM IR (-O0):
define i64 @fseek(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i64 @lseek(i32 %7, i32 %8, i32 %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @fseek(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @lseek(i32 %0, i32 %1, i32 %2)
ret i64 %4
}
/* Variables and functions */
int rand();
int random_priority() {
  int r = rand() % 5;
  return r;
}


x86 assembly (clang, -O0):
<random_priority>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_priority>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @random_priority() {
%1 = alloca i32
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 5
store i32 %3, i32* %1
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @random_priority() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 5
ret i32 %2
}
float bin_to_freq(int i, float samp_rate, int N) {
  return (float)i * (samp_rate / N / 2.f);
}


x86 assembly (clang, -O0):
<bin_to_freq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
cvtsi2ssl -0xc(%rbp),%xmm2
divss  %xmm2,%xmm1
movss  0xed6(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_to_freq>:
cvtsi2ss %edi,%xmm1
cvtsi2ss %esi,%xmm2
divss  %xmm2,%xmm0
mulss  0xeec(%rip),%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @bin_to_freq(i32 %0, float %1, i32 %2) {
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
store i32 %0, i32* %4
store float %1, float* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to float
%9 = load float, float* %5
%10 = load i32, i32* %6
%11 = sitofp i32 %10 to float
%12 = fdiv float %9, %11
%13 = fdiv float %12, 2.000000e+00
%14 = fmul float %8, %13
ret float %14
}

LLVM IR (-O2):
define float @bin_to_freq(i32 %0, float %1, i32 %2) {
%4 = sitofp i32 %0 to float
%5 = sitofp i32 %2 to float
%6 = fdiv float %1, %5
%7 = fmul float %6, 5.000000e-01
%8 = fmul float %7, %4
ret float %8
}
void RTAvlHCPhysRemove(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlHCPhysRemove() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ str_printf(char *, int *, char *, unsigned long);
void write_ulong(char *out, int *written, void *lu) {
  str_printf(out, written, "%lu", (unsigned long)lu);
}


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

x86 assembly (clang, -O2):
<write_ulong>:
mov    %rdx,%rcx
lea    0xee6(%rip),%rdx
jmp    1030 <str_printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
define void @write_ulong(i8* %0, i32* %1, i8* %2) {
%4 = ptrtoint i8* %2 to i64
%5 = tail call i32 @str_printf(i8* %0, i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "Usage: ploop copy -s DEVICE [-F STOPCMD] { [-d FILE] | [-o OFD] [-f "
          "FFD]}\n"
          "       ploop copy -d FILE [-i IFD] [-f FFD]\n"
          "       DEVICE  := source ploop device, e.g. /dev/ploop0\n"
          "       STOPCMD := a command to stop disk activity, e.g. \"vzctl "
          "chkpnt\"\n"
          "       FILE    := destination file name\n"
          "       OFD     := output file descriptor\n"
          "       IFD     := input file descriptor\n"
          "       FFD     := feedback file descriptor\n"
          "Action: effectively copy top ploop delta with write tracker\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [470 x i8] c"Usage: ploop copy -s DEVICE [-F STOPCMD] { [-d FILE] | [-o OFD] [-f FFD]}\0A ploop copy -d FILE [-i IFD] [-f FFD]\0A DEVICE := source ploop device, e.g. /dev/ploop0\0A STOPCMD := a command to stop disk activity, e.g. \22vzctl chkpnt\22\0A FILE := destination file name\0A OFD := output file descriptor\0A IFD := input file descriptor\0A FFD := feedback file descriptor\0AAction: effectively copy top ploop delta with write tracker\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([470 x i8], [470 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [470 x i8] c"Usage: ploop copy -s DEVICE [-F STOPCMD] { [-d FILE] | [-o OFD] [-f FFD]}\0A ploop copy -d FILE [-i IFD] [-f FFD]\0A DEVICE := source ploop device, e.g. /dev/ploop0\0A STOPCMD := a command to stop disk activity, e.g. \22vzctl chkpnt\22\0A FILE := destination file name\0A OFD := output file descriptor\0A IFD := input file descriptor\0A FFD := feedback file descriptor\0AAction: effectively copy top ploop delta with write tracker\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([470 x i8], [470 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int gob_end_struct(char *, size_t);
int gob_end_struct_type(char *buf, size_t buf_size) {
  return gob_end_struct(buf, buf_size);
}


x86 assembly (clang, -O0):
<gob_end_struct_type>:
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 <gob_end_struct@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gob_end_struct_type>:
jmp    1030 <gob_end_struct@plt>

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

LLVM IR (-O2):
define i32 @gob_end_struct_type(i8* %0, i64 %1) {
%3 = tail call i32 @gob_end_struct(i8* %0, i64 %1)
ret i32 %3
}
/* Variables and functions */
scalar_t__ malloc(int);
void malloc_out_parameter_ok(int **x) { *x = (int *)malloc(sizeof(int)); }


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

x86 assembly (clang, -O2):
<malloc_out_parameter_ok>:
push   %rbx
mov    %rdi,%rbx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @malloc_out_parameter_ok(i32** nocapture writeonly %0) {
%2 = tail call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %0
ret void
}
/* Variables and functions */
int __builtin_rx_mvfc(int);
int get_stack_pointer(void) { return __builtin_rx_mvfc(2); }


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

x86 assembly (clang, -O2):
<get_stack_pointer>:
mov    $0x2,%edi
jmp    1030 <__builtin_rx_mvfc@plt>

LLVM IR (-O0):
define i32 @get_stack_pointer() {
%1 = call i32 @__builtin_rx_mvfc(i32 2)
ret i32 %1
}

LLVM IR (-O2):
define i32 @get_stack_pointer() {
%1 = tail call i32 @__builtin_rx_mvfc(i32 2)
ret i32 %1
}
void svc_backlight_start(void) {}


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

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

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

LLVM IR (-O2):
define void @svc_backlight_start() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void mem_write_null(uint32_t addr, uint8_t val, void *p) {}


x86 assembly (clang, -O0):
<mem_write_null>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @mem_write_null(i32 %0, i32 %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ err_sys(char *);
int socket(int, int, int);
int Socket(int family, int type, int protocol) {
  int n;
  if ((n = socket(family, type, protocol)) < 0)
    err_sys("socket error");
  return (n);
}


x86 assembly (clang, -O0):
<Socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <socket@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jge    1157 <Socket+0x37>
lea    0xeae(%rip),%rdi
call   1030 <err_sys@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Socket>:
push   %rbx
call   1040 <socket@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1138 <Socket+0x18>
lea    0xecd(%rip),%rdi
call   1030 <err_sys@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"socket error\00"
define i32 @Socket(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @socket(i32 %0, i32 %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @err_sys(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 %4
}
/* Variables and functions */
double RAND_MAX;
double rand();
unsigned long getrandom(unsigned long max) {
  return (1 + (unsigned long)(((double)max) * (rand() / (RAND_MAX + 1.0))));
}


x86 assembly (clang, -O0):
<getrandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movaps 0xedd(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xedc(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xor    %eax,%eax
call   1030 <rand@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mov    0x2e8a(%rip),%rax
movsd  (%rax),%xmm2
movsd  0xeb6(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
movsd  0xe9b(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
add    $0x1,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrandom>:
sub    $0x18,%rsp
movq   %rdi,%xmm0
punpckldq 0xedf(%rip),%xmm0
subpd  0xee7(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ea0(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xecc(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  (%rsp),%xmm0
cvttsd2si %xmm0,%rcx
mov    %rcx,%rdx
subsd  0xebb(%rip),%xmm0
cvttsd2si %xmm0,%rax
sar    $0x3f,%rdx
and    %rdx,%rax
or     %rcx,%rax
add    $0x1,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i64 @getrandom(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = uitofp i64 %3 to double
%5 = call double (...) @rand()
%6 = load double, double* @RAND_MAX
%7 = fadd double %6, 1.000000e+00
%8 = fdiv double %5, %7
%9 = fmul double %4, %8
%10 = fptoui double %9 to i64
%11 = add i64 1, %10
ret i64 %11
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i64 @getrandom(i64 %0) {
%2 = uitofp i64 %0 to double
%3 = tail call double (...) @rand()
%4 = load double, double* @RAND_MAX
%5 = fadd double %4, 1.000000e+00
%6 = fdiv double %3, %5
%7 = fmul double %6, %2
%8 = fptoui double %7 to i64
%9 = add i64 %8, 1
ret i64 %9
}
void __attribute__((weak)) cortex_a57_cpu_power_down(int l2_flush) {}


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

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

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

LLVM IR (-O2):
define weak void @cortex_a57_cpu_power_down(i32 %0) {
ret void
}
/* Variables and functions */
int db_add_process(unsigned int *, unsigned int, char const *,
                   int /*<<< orphan*/);
int db_add_first_process(unsigned int *id, const char *working_dir) {
  return db_add_process(id, ((unsigned int)-2), working_dir, 0);
}


x86 assembly (clang, -O0):
<db_add_first_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0xfffffffe,%esi
xor    %ecx,%ecx
call   1030 <db_add_process@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_add_first_process>:
mov    %rsi,%rdx
mov    $0xfffffffe,%esi
xor    %ecx,%ecx
jmp    1030 <db_add_process@plt>

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

LLVM IR (-O2):
define i32 @db_add_first_process(i32* %0, i8* %1) {
%3 = tail call i32 @db_add_process(i32* %0, i32 -2, i8* %1, i32 0)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ EPERM;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ printf(char *);
int kill(pid_t pid __attribute__((unused)), int sig __attribute__((unused))) {
  printf("kill\n");
  errno = EPERM;
  return -1;
}


x86 assembly (clang, -O0):
<kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea6(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%eax
mov    0x2eb3(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"kill\0A\00"
@EPERM = global i32 0
@errno = global i32 0
define i32 @kill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EPERM
store i32 %6, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EPERM = global i32 0
@errno = global i32 0
@str = [5 x i8] c"kill\00"
define i32 @kill(i32 %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @EPERM
store i32 %4, i32* @errno
ret i32 -1
}
int do_987() { return 987; }


x86 assembly (clang, -O0):
<do_987>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3db,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @do_987() {
ret i32 987
}

LLVM IR (-O2):
define i32 @do_987() {
ret i32 987
}
/* Type definitions */
struct usb_hcd {
  int dummy;
};

/* Variables and functions */
int xen_dbgp_reset_prep(struct usb_hcd *);
int dbgp_reset_prep(struct usb_hcd *hcd) { return xen_dbgp_reset_prep(hcd); }


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

x86 assembly (clang, -O2):
<dbgp_reset_prep>:
jmp    1030 <xen_dbgp_reset_prep@plt>

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

LLVM IR (-O2):
%struct.usb_hcd = type { i32 }
define i32 @dbgp_reset_prep(%struct.usb_hcd* %0) {
%2 = tail call i32 @xen_dbgp_reset_prep(%struct.usb_hcd* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ logerror(char *);
void illegal(void) { logerror("M6805: illegal opcode\n"); }


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

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

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

LLVM IR (-O2):
@.str = [23 x i8] c"M6805: illegal opcode\0A\00"
define void @illegal() {
%1 = tail call i32 @logerror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}
double f2(double x, double y) { return x + y; }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @f2(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
void *thread_fcn(void *parameter) {
  int i = 0;
  for (i = 0; i < 5; i++) {
    printf("i currently equals %d \n", i);
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<thread_fcn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    116b <thread_fcn+0x4b>
mov    -0xc(%rbp),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <thread_fcn+0x1a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_fcn>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"i currently equals %d \0A\00"
define i8* @thread_fcn(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %3
br label %4
4: ; preds = %11, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @sleep(i32 1)
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
ret i8* null
}

LLVM IR (-O2):
@.str = [24 x i8] c"i currently equals %d \0A\00"
define noalias i8* @thread_fcn(i8* nocapture readnone %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0)
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = tail call i32 @sleep(i32 1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 3)
%9 = tail call i32 @sleep(i32 1)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 4)
%11 = tail call i32 @sleep(i32 1)
ret i8* null
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void LCDIntClear(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ASSERT(ui32Base == 0x44050000);
  ASSERT(
      !(ui32IntFlags & ~(0x00000001 | 0x00000004 | 0x00000008 | 0x00000020 |
                         0x00000040 | 0x00000100 | 0x00000200 | 0x00000002)));
  (*((volatile uint32_t *)(ui32Base + 0x0000005C))) = ui32IntFlags;
}


x86 assembly (clang, -O0):
<LCDIntClear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x44050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%eax
and    $0xfffffc90,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x5c,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDIntClear>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x44050000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
test   $0xfffffc90,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
mov    %ebx,0x5c(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @LCDIntClear(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1141178368
%7 = zext i1 %6 to i32
%8 = call i32 @ASSERT(i32 %7)
%9 = load i32, i32* %4
%10 = and i32 %9, -880
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
%14 = call i32 @ASSERT(i32 %13)
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 92
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
store volatile i32 %15, i32* %19
ret void
}

LLVM IR (-O2):
define void @LCDIntClear(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1141178368
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = and i32 %1, -880
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @ASSERT(i32 %8)
%10 = add nsw i32 %0, 92
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
store volatile i32 %1, i32* %12
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int clock_gettime(int /*<<< orphan*/, struct timespec *);
void my_gettime(clockid_t clk_id, struct timespec *ts) {
  int res;
  res = clock_gettime(clk_id, ts);
  assert(res == 0);
}


x86 assembly (clang, -O0):
<my_gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_gettime>:
push   %rax
call   1030 <clock_gettime@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
define void @my_gettime(i32 %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
%5 = alloca i32
store i32 %0, i32* %3
store %struct.timespec* %1, %struct.timespec** %4
%6 = load i32, i32* %3
%7 = load %struct.timespec*, %struct.timespec** %4
%8 = call i32 @clock_gettime(i32 %6, %struct.timespec* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define void @my_gettime(i32 %0, %struct.timespec* %1) {
%3 = tail call i32 @clock_gettime(i32 %0, %struct.timespec* %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
ret void
}
int test1() {
  int x = 6;
  int y = x / 2;
  int z;
  while (y > 0) {
    if (y < x) {
      x = x / y;
      y = y - 1;
    } else {
      z = x - y;
    }
    x = x - 1;
    x = x - 1;
  }
  z = x + y;
  z = 3;
  return 0;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1167 <test1+0x67>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1147 <test1+0x47>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <test1+0x50>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1119 <test1+0x19>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x3,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test1() {
ret i32 0
}
int main() {
  int a, b, c, d;
  while (a < 50) {
    if (b < c)
      d = 100;
    else
      d = 50;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x32,-0x8(%rbp)
jge    1139 <main+0x39>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    112d <main+0x2d>
movl   $0x64,-0x14(%rbp)
jmp    1134 <main+0x34>
movl   $0x32,-0x14(%rbp)
jmp    110b <main+0xb>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Atom;

/* Variables and functions */
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
void useXlib(char **names, Display *display) {
  Atom atoms[500];
  for (int i = 0; i < 500; ++i) {
    atoms[i] = XInternAtom(display, names[i], 0);
  }
}


x86 assembly (clang, -O0):
<useXlib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x7e4(%rbp)
cmpl   $0x1f4,-0x7e4(%rbp)
jge    117b <useXlib+0x6b>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x7e4(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
xor    %edx,%edx
call   1030 <XInternAtom@plt>
mov    %eax,%ecx
movslq -0x7e4(%rbp),%rax
mov    %ecx,-0x7e0(%rbp,%rax,4)
mov    -0x7e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7e4(%rbp)
jmp    112d <useXlib+0x1d>
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<useXlib>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %edx,%edx
call   1030 <XInternAtom@plt>
add    $0x1,%rbx
cmp    $0x1f4,%rbx
jne    1120 <useXlib+0x10>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @useXlib(i8** nocapture %0, i32* %1) {
br label %4
3: ; preds = %4
ret void
4: ; preds = %2, %4
%5 = phi i64 [ 0, %2 ], [ %9, %4 ]
%6 = getelementptr inbounds i8*, i8** %0, i64 %5
%7 = load i8*, i8** %6
%8 = tail call i32 @XInternAtom(i32* %1, i8* %7, i32 0)
%9 = add nuw nsw i64 %5, 1
%10 = icmp eq i64 %9, 500
br i1 %10, label %3, label %4
}
/* Variables and functions */
int /*<<< orphan*/ GyroStateHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void GyroStateUpdated() { UAVObjUpdated(GyroStateHandle()); }


x86 assembly (clang, -O0):
<GyroStateUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <GyroStateHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GyroStateUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <GyroStateHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @GyroStateUpdated() {
%1 = call i32 (...) @GyroStateHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @GyroStateUpdated() {
%1 = tail call i32 (...) @GyroStateHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
extern int gui_ksys_check_event(void) {
  int value;
  __asm__ __volatile__("int $0x40" : "=a"(value) : "a"(11));
  return (value);
}


x86 assembly (clang, -O0):
<gui_ksys_check_event>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb,%eax
int    $0x40
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_ksys_check_event>:
mov    $0xb,%eax
int    $0x40
ret

LLVM IR (-O0):
define i32 @gui_ksys_check_event() {
%1 = alloca i32
%2 = call i32 asm sideeffect "int $$0x40", "={ax},{ax},~{dirflag},~{fpsr},~{flags}"(i32 11)
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @gui_ksys_check_event() {
%1 = tail call i32 asm sideeffect "int $$0x40", "={ax},{ax},~{dirflag},~{fpsr},~{flags}"(i32 11)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
main() {
  while (1) {
    printf("going\n");
    fflush(stdout);
    sleep(3);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x3,%edi
call   1050 <sleep@plt>
jmp    113f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%r14
mov    0x2e9e(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    (%rbx),%edi
call   1040 <fflush@plt>
mov    $0x3,%edi
call   1050 <sleep@plt>
jmp    1150 <main+0x20>

LLVM IR (-O0):
@.str = [7 x i8] c"going\0A\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = call i32 @fflush(i32 %4)
%6 = call i32 @sleep(i32 3)
br label %2
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [6 x i8] c"going\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32 @sleep(i32 3)
br label %1
}
void XShmDetach() {}


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

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

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

LLVM IR (-O2):
define void @XShmDetach() {
ret void
}
yywrap() { return 0; }


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

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

LLVM IR (-O0):
define i32 @yywrap() {
ret i32 0
}

LLVM IR (-O2):
define i32 @yywrap() {
ret i32 0
}
unsigned int inl(unsigned long int port) {
  return *((volatile unsigned long *)((0x7c000000 + ((port) << 0))));
}


x86 assembly (clang, -O0):
<inl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x0,%rax
add    $0x7c000000,%rax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inl>:
mov    0x7c000000(%rdi),%rax
ret

LLVM IR (-O0):
define i32 @inl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = shl i64 %3, 0
%5 = add i64 2080374784, %4
%6 = inttoptr i64 %5 to i64*
%7 = load volatile i64, i64* %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @inl(i64 %0) {
%2 = add i64 %0, 2080374784
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int mgetline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *);
int main(void) {
  int len;
  char line[1000];
  while ((len = mgetline(line, 1000)) > 0) {
    reverse(line);
    printf("%s", line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <mgetline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1183 <main+0x53>
lea    -0x3f0(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1050 <mgetline@plt>
test   %eax,%eax
jle    1184 <main+0x54>
mov    %rsp,%rbx
lea    0xeab(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1050 <mgetline@plt>
test   %eax,%eax
jg     1160 <main+0x30>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @mgetline(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = call i32 @reverse(i8* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%8 = call i32 @mgetline(i8* %2, i32 1000)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %5, label %10
10: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ core4_swap(char *, int);
void U_EMREXCLUDECLIPRECT_swap(char *record, int torev) {
  core4_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_EMREXCLUDECLIPRECT_swap>:
jmp    1030 <core4_swap@plt>

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

LLVM IR (-O2):
define void @U_EMREXCLUDECLIPRECT_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core4_swap(i8* %0, i32 %1)
ret void
}