xunge/DecIR huggingface dataset:
/* Type definitions */
struct sched_param {
  int /*<<< orphan*/ sched_priority;
};

/* Variables and functions */
int /*<<< orphan*/ SCHED_RR;
int /*<<< orphan*/ sched_get_priority_max(int /*<<< orphan*/);
scalar_t__ sched_setscheduler(int /*<<< orphan*/, int /*<<< orphan*/,
                              struct sched_param *);
int set_rr_scheduler(void) {
  struct sched_param param;
  param.sched_priority = sched_get_priority_max(SCHED_RR);
  if (sched_setscheduler(0, SCHED_RR, &param) != 0) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<set_rr_scheduler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <sched_get_priority_max@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x8(%rbp),%rdx
call   1030 <sched_setscheduler@plt>
cmp    $0x0,%rax
je     1163 <set_rr_scheduler+0x43>
movl   $0xffffffff,-0x4(%rbp)
jmp    116a <set_rr_scheduler+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_rr_scheduler>:
push   %rbx
sub    $0x10,%rsp
mov    0x2eac(%rip),%rbx
mov    (%rbx),%edi
call   1040 <sched_get_priority_max@plt>
mov    %eax,0x8(%rsp)
mov    (%rbx),%esi
lea    0x8(%rsp),%rdx
xor    %edi,%edi
call   1030 <sched_setscheduler@plt>
neg    %rax
sbb    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@SCHED_RR = global i32 0
define i32 @set_rr_scheduler() {
%1 = alloca i32
%2 = alloca %struct.sched_param
%3 = load i32, i32* @SCHED_RR
%4 = call i32 @sched_get_priority_max(i32 %3)
%5 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %2, i32 0, i32 0
store i32 %4, i32* %5
%6 = load i32, i32* @SCHED_RR
%7 = call i64 @sched_setscheduler(i32 0, i32 %6, %struct.sched_param* %2)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 -1, i32* %1
br label %11
10: ; preds = %0
store i32 0, i32* %1
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@SCHED_RR = global i32 0
define i32 @set_rr_scheduler() {
%1 = alloca %struct.sched_param
%2 = bitcast %struct.sched_param* %1 to i8*
%3 = load i32, i32* @SCHED_RR
%4 = tail call i32 @sched_get_priority_max(i32 %3)
%5 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i64 0, i32 0
store i32 %4, i32* %5
%6 = load i32, i32* @SCHED_RR
%7 = call i64 @sched_setscheduler(i32 0, i32 %6, %struct.sched_param* %1)
%8 = icmp ne i64 %7, 0
%9 = sext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void gps_serial_close(int fd) {
  close(fd);
  return;
}


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

x86 assembly (clang, -O2):
<gps_serial_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @gps_serial_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
int pp_testbit(int *vec, int bit) {
  int byte = bit >> 5;
  int offset = 1 << (bit & 31);
  return (vec[byte] & offset) ? 1 : 0;
}


x86 assembly (clang, -O0):
<pp_testbit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x5,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
and    -0x14(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pp_testbit>:
mov    %esi,%ecx
mov    %esi,%eax
sar    $0x5,%eax
cltq
mov    (%rdi,%rax,4),%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @pp_testbit(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = ashr i32 %7, 5
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = and i32 %9, 31
%11 = shl i32 1, %10
store i32 %11, i32* %6
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = load i32, i32* %6
%18 = and i32 %16, %17
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 1, i32 0
ret i32 %21
}

LLVM IR (-O2):
define i32 @pp_testbit(i32* nocapture %0, i32 %1) {
%3 = ashr i32 %1, 5
%4 = and i32 %1, 31
%5 = sext i32 %3 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = lshr i32 %7, %4
%9 = and i32 %8, 1
ret i32 %9
}
void WARN() {}


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

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

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

LLVM IR (-O2):
define void @WARN() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *);
int /*<<< orphan*/ output_w32(int);
void emit_fcmps(int x, int y) {
  assem_debug("fcmps s14, s15");
  output_w32(0xeeb47a67);
}


x86 assembly (clang, -O0):
<emit_fcmps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xecb(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xeeb47a67,%edi
call   1040 <output_w32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fcmps>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xeeb47a67,%edi
pop    %rax
jmp    1040 <output_w32@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"fcmps s14, s15\00"
define void @emit_fcmps(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @assem_debug(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @output_w32(i32 -290162073)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"fcmps s14, s15\00"
define void @emit_fcmps(i32 %0, i32 %1) {
%3 = tail call i32 @assem_debug(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @output_w32(i32 -290162073)
ret void
}
unsigned short inw(unsigned short port) {
  unsigned short _v;
  asm volatile("in"
               "w"
               " %"
               "w"
               "1,%"
               ""
               "0"
               : "=a"(_v)
               : "Nd"(port));
  return _v;
}


x86 assembly (clang, -O0):
<inw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw>:
mov    %edi,%edx
in     (%dx),%ax
ret

LLVM IR (-O0):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i16 asm sideeffect "inw ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = tail call i16 asm sideeffect "inw ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i16 %2
}
/* Variables and functions */
unsigned long long __tzmsk_u64(unsigned long long);
unsigned long long test__tzmsk_u64(unsigned long long a) {
  return __tzmsk_u64(a);
}


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

x86 assembly (clang, -O2):
<test__tzmsk_u64>:
jmp    1030 <__tzmsk_u64@plt>

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

LLVM IR (-O2):
define i64 @test__tzmsk_u64(i64 %0) {
%2 = tail call i64 @__tzmsk_u64(i64 %0)
ret i64 %2
}
/* Type definitions */
typedef int off_t;

/* Variables and functions */
int mus_bytes_per_sample(int);
off_t mus_bytes_to_samples(int format, off_t size) {
  return ((off_t)(size / (mus_bytes_per_sample(format))));
}


x86 assembly (clang, -O0):
<mus_bytes_to_samples>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <mus_bytes_per_sample@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mus_bytes_to_samples>:
push   %rbx
mov    %esi,%ebx
call   1030 <mus_bytes_per_sample@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i32 @mus_bytes_to_samples(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @mus_bytes_per_sample(i32 %6)
%8 = sdiv i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @mus_bytes_to_samples(i32 %0, i32 %1) {
%3 = tail call i32 @mus_bytes_per_sample(i32 %0)
%4 = sdiv i32 %1, %3
ret i32 %4
}
void gtk_tree_drag_dest_row_drop_possible() {}


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

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

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

LLVM IR (-O2):
define void @gtk_tree_drag_dest_row_drop_possible() {
ret void
}
double a55(double a) { return 5 + a + 5; }


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

x86 assembly (clang, -O2):
<a55>:
movsd  0xef8(%rip),%xmm1
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @a55(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double 5.000000e+00, %3
%5 = fadd double %4, 5.000000e+00
ret double %5
}

LLVM IR (-O2):
define double @a55(double %0) {
%2 = fadd double %0, 5.000000e+00
%3 = fadd double %2, 5.000000e+00
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void clear_screen() { system("busybox clear"); }


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

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"busybox clear\00"
define void @clear_screen() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, double *, int);
void setR8(unsigned char *p, double r) { memcpy(p, &r, 8); }


x86 assembly (clang, -O0):
<setR8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setR8>:
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @setR8(i8* %0, double %1) {
%3 = alloca double
store double %1, double* %3
%4 = call i32 @memcpy(i8* %0, double* %3, i32 8)
ret void
}
/* Variables and functions */
int abs(int);
__attribute__((__weak__, __always___)) int softboundmpx_abs(int j) {
  return abs(j);
}


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

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

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

LLVM IR (-O2):
define weak i32 @softboundmpx_abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
unsigned addval_436(unsigned x) { return x + 2425409161U; }


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

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

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

LLVM IR (-O2):
define i32 @addval_436(i32 %0) {
%2 = add i32 %0, -1869558135
ret i32 %2
}
/* Variables and functions */
int utf8_contains(char const *, char const *);
int _xte_utf8_contains(const char *in_string1, const char *in_string2) {
  return utf8_contains(in_string1, in_string2);
}


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

x86 assembly (clang, -O2):
<_xte_utf8_contains>:
jmp    1030 <utf8_contains@plt>

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

LLVM IR (-O2):
define i32 @_xte_utf8_contains(i8* %0, i8* %1) {
%3 = tail call i32 @utf8_contains(i8* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void f9(void) {
  int array[3];
  typedef int arr[3];
  arr *b;
  b = &array;
  (*b)[0] = 'a';
  putchar((*b)[0]);
}


x86 assembly (clang, -O0):
<f9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x61,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f9>:
mov    $0x61,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @f9() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]*
store [3 x i32]* %1, [3 x i32]** %2
%3 = load [3 x i32]*, [3 x i32]** %2
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
store i32 97, i32* %4
%5 = load [3 x i32]*, [3 x i32]** %2
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%7 = load i32, i32* %6
%8 = call i32 @putchar(i32 %7)
ret void
}

LLVM IR (-O2):
define void @f9() {
%1 = tail call i32 @putchar(i32 97)
ret void
}
unsigned int setBit(unsigned int byte, int i) {
  unsigned int mask = 1 << i;
  return (mask | byte);
}


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

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

LLVM IR (-O0):
define i32 @setBit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = shl i32 1, %6
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = or i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @setBit(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = or i32 %3, %0
ret i32 %4
}
int compare(const void *a, const void *b) {
  int *aa = (int *)a;
  int *bb = (int *)b;
  return (*aa - *bb);
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = sub nsw i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int f(int);
int h(int n) {
  int m = n + f(3);
  {
    int x = n + f(6);
    if (x < 6)
      return x;
  }
  return n * f(n - 1);
}


x86 assembly (clang, -O0):
<h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x3,%edi
call   1030 <f@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x6,%edi
call   1030 <f@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x6,-0x10(%rbp)
jge    1164 <h+0x54>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1180 <h+0x70>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <f@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h>:
push   %rbx
mov    %edi,%ebx
mov    $0x3,%edi
call   1030 <f@plt>
mov    $0x6,%edi
call   1030 <f@plt>
add    %ebx,%eax
cmp    $0x6,%eax
jl     1139 <h+0x29>
lea    -0x1(%rbx),%edi
call   1030 <f@plt>
imul   %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @h(i32 %0) {
%2 = tail call i32 @f(i32 3)
%3 = tail call i32 @f(i32 6)
%4 = add nsw i32 %3, %0
%5 = icmp slt i32 %4, 6
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = add nsw i32 %0, -1
%8 = tail call i32 @f(i32 %7)
%9 = mul nsw i32 %8, %0
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ %4, %1 ]
ret i32 %11
}
unsigned int f20(unsigned int x, int y __attribute__((unused))) {
  return (x >> 1) ^ (x << ((-1) & (8 * 4 - 1)));
}


x86 assembly (clang, -O0):
<f20>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1f,%ecx
xor    %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f20(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 = lshr i32 %5, 1
%7 = load i32, i32* %3
%8 = shl i32 %7, 31
%9 = xor i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @f20(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.fshl.i32(i32 %0, i32 %0, i32 31)
ret i32 %3
}
/* Type definitions */
struct TreeNode {
  int dummy;
};

/* Variables and functions */
int sumLeft(struct TreeNode *, int /*<<< orphan*/);
int sumOfLeftLeaves(struct TreeNode *root) { return sumLeft(root, 0); }


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

x86 assembly (clang, -O2):
<sumOfLeftLeaves>:
xor    %esi,%esi
jmp    1030 <sumLeft@plt>

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

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
define i32 @sumOfLeftLeaves(%struct.TreeNode* %0) {
%2 = tail call i32 @sumLeft(%struct.TreeNode* %0, i32 0)
ret i32 %2
}
/* Type definitions */
struct termpair {
  int dummy;
};
struct termp {
  int dummy;
};
struct roff_node {
  int dummy;
};
struct roff_meta {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ term_newln(struct termp *);
void termp_fd_post(struct termp *p, struct termpair *pair,
                   const struct roff_meta *meta, struct roff_node *n) {
  term_newln(p);
}


x86 assembly (clang, -O0):
<termp_fd_post>:
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
call   1030 <term_newln@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<termp_fd_post>:
jmp    1030 <term_newln@plt>

LLVM IR (-O0):
%struct.termp = type { i32 }
%struct.termpair = type { i32 }
%struct.roff_meta = type { i32 }
%struct.roff_node = type { i32 }
define void @termp_fd_post(%struct.termp* %0, %struct.termpair* %1, %struct.roff_meta* %2, %struct.roff_node* %3) {
%5 = alloca %struct.termp*
%6 = alloca %struct.termpair*
%7 = alloca %struct.roff_meta*
%8 = alloca %struct.roff_node*
store %struct.termp* %0, %struct.termp** %5
store %struct.termpair* %1, %struct.termpair** %6
store %struct.roff_meta* %2, %struct.roff_meta** %7
store %struct.roff_node* %3, %struct.roff_node** %8
%9 = load %struct.termp*, %struct.termp** %5
%10 = call i32 @term_newln(%struct.termp* %9)
ret void
}

LLVM IR (-O2):
%struct.termp = type { i32 }
%struct.termpair = type { i32 }
%struct.roff_meta = type { i32 }
%struct.roff_node = type { i32 }
define void @termp_fd_post(%struct.termp* %0, %struct.termpair* nocapture readnone %1, %struct.roff_meta* nocapture readnone %2, %struct.roff_node* nocapture readnone %3) {
%5 = tail call i32 @term_newln(%struct.termp* %0)
ret void
}
/* Variables and functions */
int foo(int);
int *malloc(int);
int main() {
  int *k = malloc(5);
  int j = foo(k[8]);
  return j;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%edi
call   1040 <foo@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1030 <malloc@plt>
mov    0x20(%rax),%edi
pop    %rax
jmp    1040 <foo@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32* @malloc(i32 5)
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 8
%7 = load i32, i32* %6
%8 = call i32 @foo(i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 5)
%2 = getelementptr inbounds i32, i32* %1, i64 8
%3 = load i32, i32* %2
%4 = tail call i32 @foo(i32 %3)
ret i32 %4
}
char *check(void *p) {
  if (!p)
    exit(1);
  return p;
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1131 <check+0x21>
mov    $0x1,%edi
call   1030 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
test   %rdi,%rdi
je     1119 <check+0x9>
mov    %rdi,%rax
ret
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i8* @check(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
unreachable
6: ; preds = %1
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
define i8* @check(i8* readnone returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %4
3: ; preds = %1
tail call void @exit(i32 1)
unreachable
4: ; preds = %1
ret i8* %0
}
/* Variables and functions */
int port_inb(int);
int /*<<< orphan*/ port_outb(int, int);
void rled_off(void) { port_outb((2), port_inb((2)) & ~(1 << 0)); }


x86 assembly (clang, -O0):
<rled_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <port_inb@plt>
mov    %eax,%esi
and    $0xfffffffe,%esi
mov    $0x2,%edi
call   1040 <port_outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rled_off>:
push   %rax
mov    $0x2,%edi
call   1030 <port_inb@plt>
and    $0xfffffffe,%eax
mov    $0x2,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <port_outb@plt>

LLVM IR (-O0):
define void @rled_off() {
%1 = call i32 @port_inb(i32 2)
%2 = and i32 %1, -2
%3 = call i32 @port_outb(i32 2, i32 %2)
ret void
}

LLVM IR (-O2):
define void @rled_off() {
%1 = tail call i32 @port_inb(i32 2)
%2 = and i32 %1, -2
%3 = tail call i32 @port_outb(i32 2, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void invalid_decoder(const char *decoder) {
  printf("Error!\nThere is no %s decoder! Exiting...\n", decoder);
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [43 x i8] c"Error!\0AThere is no %s decoder! Exiting...\0A\00"
define void @invalid_decoder(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [43 x i8] c"Error!\0AThere is no %s decoder! Exiting...\0A\00"
define void @invalid_decoder(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void widget_area_set(struct widget *widget, const char *key, char *value) {}


x86 assembly (clang, -O0):
<widget_area_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.widget = type opaque
define void @widget_area_set(%struct.widget* %0, i8* %1, i8* %2) {
%4 = alloca %struct.widget*
%5 = alloca i8*
%6 = alloca i8*
store %struct.widget* %0, %struct.widget** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
ret void
}

LLVM IR (-O2):
%struct.widget = type opaque
define void @widget_area_set(%struct.widget* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
ret void
}
int f_work(long long int *sz_arg, long long int *sz_res, long long int *sz_iw,
           long long int *sz_w) {
  if (sz_arg)
    *sz_arg = 2;
  if (sz_res)
    *sz_res = 2;
  if (sz_iw)
    *sz_iw = 0;
  if (sz_w)
    *sz_w = 1;
  return 0;
}


x86 assembly (clang, -O0):
<f_work>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     112a <f_work+0x2a>
mov    -0x8(%rbp),%rax
movq   $0x2,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     1140 <f_work+0x40>
mov    -0x10(%rbp),%rax
movq   $0x2,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1156 <f_work+0x56>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     116c <f_work+0x6c>
mov    -0x20(%rbp),%rax
movq   $0x1,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_work>:
test   %rdi,%rdi
je     110c <f_work+0xc>
movq   $0x2,(%rdi)
test   %rsi,%rsi
je     1118 <f_work+0x18>
movq   $0x2,(%rsi)
test   %rdx,%rdx
je     1124 <f_work+0x24>
movq   $0x0,(%rdx)
test   %rcx,%rcx
je     1130 <f_work+0x30>
movq   $0x1,(%rcx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @f_work(i64* writeonly %0, i64* writeonly %1, i64* writeonly %2, i64* writeonly %3) {
%5 = icmp eq i64* %0, null
br i1 %5, label %7, label %6
6: ; preds = %4
store i64 2, i64* %0
br label %7
7: ; preds = %6, %4
%8 = icmp eq i64* %1, null
br i1 %8, label %10, label %9
9: ; preds = %7
store i64 2, i64* %1
br label %10
10: ; preds = %9, %7
%11 = icmp eq i64* %2, null
br i1 %11, label %13, label %12
12: ; preds = %10
store i64 0, i64* %2
br label %13
13: ; preds = %12, %10
%14 = icmp eq i64* %3, null
br i1 %14, label %16, label %15
15: ; preds = %13
store i64 1, i64* %3
br label %16
16: ; preds = %15, %13
ret i32 0
}
/* Variables and functions */
int lrint(double);
int main(void) {
  double fval;
  int k, ival;
  fval = -8.0 * 0x10000000;
  for (k = 0; k < 100; k++) {
    ival = (lrint(fval)) >> 24;
    if (ival != -128)
      return 1;
    fval *= 1.2499999;
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    1183 <main+0x73>
movsd  -0x10(%rbp),%xmm0
call   1030 <lrint@plt>
sar    $0x18,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0xffffff80,-0x18(%rbp)
je     1163 <main+0x53>
movl   $0x1,-0x4(%rbp)
jmp    118a <main+0x7a>
movsd  0xe9d(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <main+0x23>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movsd  0xee3(%rip),%xmm0
mov    $0x64,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,0x8(%rsp)
call   1030 <lrint@plt>
and    $0xff000000,%eax
cmp    $0x80000000,%eax
jne    115e <main+0x4e>
movsd  0x8(%rsp),%xmm0
mulsd  0xeb3(%rip),%xmm0
add    $0xffffffff,%ebx
jne    1130 <main+0x20>
xor    %eax,%eax
jmp    1163 <main+0x53>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store double 0xC1E0000000000000, double* %2
store i32 0, i32* %3
br label %5
5: ; preds = %18, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load double, double* %2
%10 = call i32 @lrint(double %9)
%11 = ashr i32 %10, 24
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, -128
br i1 %13, label %14, label %15
14: ; preds = %8
store i32 1, i32* %1
br label %22
15: ; preds = %8
%16 = load double, double* %2
%17 = fmul double %16, 0x3FF3FFFFE5280D65
store double %17, double* %2
br label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %5
21: ; preds = %5
store i32 0, i32* %1
br label %22
22: ; preds = %21, %14
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 0, %0 ], [ %9, %7 ]
%3 = phi double [ 0xC1E0000000000000, %0 ], [ %8, %7 ]
%4 = tail call i32 @lrint(double %3)
%5 = and i32 %4, -16777216
%6 = icmp eq i32 %5, -2147483648
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = fmul double %3, 0x3FF3FFFFE5280D65
%9 = add nuw nsw i32 %2, 1
%10 = icmp eq i32 %9, 100
br i1 %10, label %11, label %1
11: ; preds = %7, %1
%12 = phi i32 [ 1, %1 ], [ 0, %7 ]
ret i32 %12
}
/* Variables and functions */
int F(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("F(10,100) => %Ld\n", F(10, 100));
  printf("F(10^8,10^9) + F(10^9,10^8) = %Ld\n", 2 * F(100000000, 1000000000));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
mov    $0x64,%esi
call   1030 <F@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5f5e100,%edi
mov    $0x3b9aca00,%esi
call   1030 <F@plt>
mov    %eax,%esi
shl    $0x1,%esi
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
mov    $0x64,%esi
call   1030 <F@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x5f5e100,%edi
mov    $0x3b9aca00,%esi
call   1030 <F@plt>
lea    (%rax,%rax,1),%esi
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"F(10,100) => %Ld\0A\00"
@.str.1 = [35 x i8] c"F(10^8,10^9) + F(10^9,10^8) = %Ld\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @F(i32 10, i32 100)
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @F(i32 100000000, i32 1000000000)
%5 = mul nsw i32 2, %4
%6 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"F(10,100) => %Ld\0A\00"
@.str.1 = [35 x i8] c"F(10^8,10^9) + F(10^9,10^8) = %Ld\0A\00"
define i32 @main() {
%1 = tail call i32 @F(i32 10, i32 100)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @F(i32 100000000, i32 1000000000)
%4 = shl nsw i32 %3, 1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
unsigned int byte_order(void) {
  unsigned long test = 0x04030201;
  unsigned char *ptr;
  unsigned int order;
  ptr = (unsigned char *)(&test);
  order = (ptr[0] << 12) | (ptr[1] << 8) | (ptr[2] << 4) | ptr[3];
  return order;
}


x86 assembly (clang, -O0):
<byte_order>:
push   %rbp
mov    %rsp,%rbp
movq   $0x4030201,-0x8(%rbp)
04
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
shl    $0xc,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @byte_order() {
ret i32 4660
}
/* Type definitions */
struct cpu {
  int dummy;
};

/* Variables and functions */
unsigned char cpu_get_b(struct cpu *);
unsigned char cpu_get_c(struct cpu *);
unsigned short cpu_get_bc(struct cpu *cpu) {
  unsigned char b = cpu_get_b(cpu);
  unsigned char c = cpu_get_c(cpu);
  return (((unsigned short)((unsigned char)(c))) |
          (((unsigned short)((unsigned char)(b))) << 8));
}


x86 assembly (clang, -O0):
<cpu_get_bc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <cpu_get_b@plt>
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <cpu_get_c@plt>
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzwl %ax,%eax
movzbl -0x9(%rbp),%ecx
movzwl %cx,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_get_bc>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <cpu_get_b@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <cpu_get_c@plt>
movzbl %al,%ecx
movzbl %bpl,%eax
shl    $0x8,%eax
or     %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.cpu = type { i32 }
define zeroext i16 @cpu_get_bc(%struct.cpu* %0) {
%2 = alloca %struct.cpu*
%3 = alloca i8
%4 = alloca i8
store %struct.cpu* %0, %struct.cpu** %2
%5 = load %struct.cpu*, %struct.cpu** %2
%6 = call zeroext i8 @cpu_get_b(%struct.cpu* %5)
store i8 %6, i8* %3
%7 = load %struct.cpu*, %struct.cpu** %2
%8 = call zeroext i8 @cpu_get_c(%struct.cpu* %7)
store i8 %8, i8* %4
%9 = load i8, i8* %4
%10 = zext i8 %9 to i16
%11 = zext i16 %10 to i32
%12 = load i8, i8* %3
%13 = zext i8 %12 to i16
%14 = zext i16 %13 to i32
%15 = shl i32 %14, 8
%16 = or i32 %11, %15
%17 = trunc i32 %16 to i16
ret i16 %17
}

LLVM IR (-O2):
%struct.cpu = type { i32 }
define zeroext i16 @cpu_get_bc(%struct.cpu* %0) {
%2 = tail call zeroext i8 @cpu_get_b(%struct.cpu* %0)
%3 = tail call zeroext i8 @cpu_get_c(%struct.cpu* %0)
%4 = zext i8 %3 to i16
%5 = zext i8 %2 to i16
%6 = shl nuw i16 %5, 8
%7 = or i16 %6, %4
ret i16 %7
}
/* Variables and functions */
int /*<<< orphan*/ messErr(int);
void i2c_write(int id, int add, int off, int val) { messErr(49); }


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

x86 assembly (clang, -O2):
<i2c_write>:
mov    $0x31,%edi
jmp    1030 <messErr@plt>

LLVM IR (-O0):
define void @i2c_write(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = call i32 @messErr(i32 49)
ret void
}

LLVM IR (-O2):
define void @i2c_write(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @messErr(i32 49)
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int igcomp(const void *l, const void *r) {
  return (strcmp(*(char **)l, *(char **)r));
}


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

x86 assembly (clang, -O2):
<igcomp>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @igcomp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @igcomp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, unsigned int, unsigned int);
void print_u64_hex(char *text, unsigned long long int arg) {
  printf("%s%08x%08x\n", text, (unsigned int)(arg >> 32),
         (unsigned int)(arg & 0x00000000ffffffffULL));
}


x86 assembly (clang, -O0):
<print_u64_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
shr    $0x20,%rax
mov    %eax,%edx
movabs $0xffffffff,%rax
and    -0x10(%rbp),%rax
mov    %eax,%ecx
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_u64_hex>:
mov    %rsi,%rcx
mov    %rdi,%rsi
mov    %rcx,%rdx
shr    $0x20,%rdx
lea    0xedc(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%s%08x%08x\0A\00"
define void @print_u64_hex(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 = lshr i64 %6, 32
%8 = trunc i64 %7 to i32
%9 = load i64, i64* %4
%10 = and i64 %9, 4294967295
%11 = trunc i64 %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %8, i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s%08x%08x\0A\00"
define void @print_u64_hex(i8* %0, i64 %1) {
%3 = lshr i64 %1, 32
%4 = trunc i64 %3 to i32
%5 = trunc i64 %1 to i32
%6 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %4, i32 %5)
ret void
}
/* Type definitions */
struct state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ randomizeAllOrientations(struct state *);
int /*<<< orphan*/ randomizeAllVelocities(struct state *);
void randomizeEverything(struct state *st) {
  randomizeAllVelocities(st);
  randomizeAllOrientations(st);
}


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

x86 assembly (clang, -O2):
<randomizeEverything>:
push   %rbx
mov    %rdi,%rbx
call   1030 <randomizeAllVelocities@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <randomizeAllOrientations@plt>

LLVM IR (-O0):
%struct.state = type { i32 }
define void @randomizeEverything(%struct.state* %0) {
%2 = alloca %struct.state*
store %struct.state* %0, %struct.state** %2
%3 = load %struct.state*, %struct.state** %2
%4 = call i32 @randomizeAllVelocities(%struct.state* %3)
%5 = load %struct.state*, %struct.state** %2
%6 = call i32 @randomizeAllOrientations(%struct.state* %5)
ret void
}

LLVM IR (-O2):
%struct.state = type { i32 }
define void @randomizeEverything(%struct.state* %0) {
%2 = tail call i32 @randomizeAllVelocities(%struct.state* %0)
%3 = tail call i32 @randomizeAllOrientations(%struct.state* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printHelp() {
  printf("Programm beenden: q/Q\n");
  printf("Producer 1 blocken/starten: 1\n");
  printf("Producer 2 blocken/starten: 2\n");
  printf("Consumer blocken/starten: c\n");
  printf("Hilfe anzeigen: h\n");
}


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

x86 assembly (clang, -O2):
<printHelp>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xf16(%rip),%rdi
call   1030 <puts@plt>
lea    0xf26(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Programm beenden: q/Q\0A\00"
@.str.1 = [31 x i8] c"Producer 1 blocken/starten: 1\0A\00"
@.str.2 = [31 x i8] c"Producer 2 blocken/starten: 2\0A\00"
@.str.3 = [29 x i8] c"Consumer blocken/starten: c\0A\00"
@.str.4 = [19 x i8] c"Hilfe anzeigen: h\0A\00"
define void @printHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [22 x i8] c"Programm beenden: q/Q\00"
@str.5 = [30 x i8] c"Producer 1 blocken/starten: 1\00"
@str.6 = [30 x i8] c"Producer 2 blocken/starten: 2\00"
@str.7 = [28 x i8] c"Consumer blocken/starten: c\00"
@str.8 = [18 x i8] c"Hilfe anzeigen: h\00"
define void @printHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.8, i64 0, i64 0))
ret void
}