xunge/DecIR huggingface dataset:
/* Variables and functions */
void *malloc(int);
char **initChannelArray(void) {
  char **ret = malloc(5 * sizeof(char *));
  for (unsigned i = 0; i < 5; ++i)
    ret[i] = malloc(1024 * sizeof(char));
  return ret;
}


x86 assembly (clang, -O0):
<initChannelArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jae    115d <initChannelArray+0x4d>
mov    $0x400,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <initChannelArray+0x1d>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initChannelArray>:
push   %rbx
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    $0x400,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
mov    $0x400,%edi
call   1030 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    $0x400,%edi
call   1030 <malloc@plt>
mov    %rax,0x10(%rbx)
mov    $0x400,%edi
call   1030 <malloc@plt>
mov    %rax,0x18(%rbx)
mov    $0x400,%edi
call   1030 <malloc@plt>
mov    %rax,0x20(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8** @initChannelArray() {
%1 = alloca i8**
%2 = alloca i32
%3 = call i8* @malloc(i32 40)
%4 = bitcast i8* %3 to i8**
store i8** %4, i8*** %1
store i32 0, i32* %2
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %2
%7 = icmp ult i32 %6, 5
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = call i8* @malloc(i32 1024)
%10 = load i8**, i8*** %1
%11 = load i32, i32* %2
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %10, i64 %12
store i8* %9, i8** %13
br label %14
14: ; preds = %8
%15 = load i32, i32* %2
%16 = add i32 %15, 1
store i32 %16, i32* %2
br label %5
17: ; preds = %5
%18 = load i8**, i8*** %1
ret i8** %18
}

LLVM IR (-O2):
define noalias i8** @initChannelArray() {
%1 = tail call dereferenceable_or_null(40) i8* @malloc(i32 40)
%2 = bitcast i8* %1 to i8**
%3 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
store i8* %3, i8** %2
%4 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%5 = getelementptr inbounds i8*, i8** %2, i64 1
store i8* %4, i8** %5
%6 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%7 = getelementptr inbounds i8*, i8** %2, i64 2
store i8* %6, i8** %7
%8 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%9 = getelementptr inbounds i8*, i8** %2, i64 3
store i8* %8, i8** %9
%10 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%11 = getelementptr inbounds i8*, i8** %2, i64 4
store i8* %10, i8** %11
ret i8** %2
}
void signals_ignore(int signal, short event, void *arg) {
  struct signals *signals = arg;
  (void)signal;
  (void)event;
  (void)arg;
  (void)signals;
}


x86 assembly (clang, -O0):
<signals_ignore>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.signals = type opaque
define void @signals_ignore(i32 %0, i16 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i16
%6 = alloca i8*
%7 = alloca %struct.signals*
store i32 %0, i32* %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = bitcast i8* %8 to %struct.signals*
store %struct.signals* %9, %struct.signals** %7
%10 = load i32, i32* %4
%11 = load i16, i16* %5
%12 = load i8*, i8** %6
%13 = load %struct.signals*, %struct.signals** %7
ret void
}

LLVM IR (-O2):
define void @signals_ignore(i32 %0, i16 signext %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void sighandler(int sig) { exit(0); }


x86 assembly (clang, -O0):
<sighandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<sighandler>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @sighandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @sighandler(i32 %0) {
%2 = tail call i32 @exit(i32 0)
unreachable
}
struct {
  float a;
} f23(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<f23>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <f23+0x9>
jmp    1109 <f23+0x9>

x86 assembly (clang, -O2):
<f23>:
jmp    1100 <f23>

LLVM IR (-O0):
define float @f23() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define float @f23() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ esc(char *);
int /*<<< orphan*/ padding(int);
void ind(void) {
  esc("D");
  padding(20);
}


x86 assembly (clang, -O0):
<ind>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <esc@plt>
mov    $0x14,%edi
call   1030 <padding@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ind>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <esc@plt>
mov    $0x14,%edi
pop    %rax
jmp    1030 <padding@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"D\00"
define void @ind() {
%1 = call i32 @esc(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @padding(i32 20)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"D\00"
define void @ind() {
%1 = tail call i32 @esc(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @padding(i32 20)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ handle_TTOU(int /*<<< orphan*/);
int gen_TTOU(void) {
  handle_TTOU(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_TTOU>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_TTOU@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_TTOU>:
push   %rax
xor    %edi,%edi
call   1030 <handle_TTOU@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gen_TTOU() {
%1 = call i32 @handle_TTOU(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_TTOU() {
%1 = tail call i32 @handle_TTOU(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ init_hires_timer();
void INIT_HIRES_TIMER__() { init_hires_timer(); }


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

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

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

LLVM IR (-O2):
define void @INIT_HIRES_TIMER__() {
%1 = tail call i32 (...) @init_hires_timer()
ret void
}
double mymin(double a, double b) {
  if (a <= b)
    return a;
  return b;
}


x86 assembly (clang, -O0):
<mymin>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1131 <mymin+0x31>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    113b <mymin+0x3b>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mymin>:
movapd %xmm0,%xmm2
cmplesd %xmm1,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

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

LLVM IR (-O2):
define double @mymin(double %0, double %1) {
%3 = fcmp ole double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int test_imm_73uint16_mem(unsigned short *val) {
  return ((*val) & (-0x73 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_73uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -115
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_73uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -115
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ arm_memio_ldrb(int /*<<< orphan*/);
int /*<<< orphan*/ t16_memio_imm5_op(int);
void t16_ldrb_imm5() { arm_memio_ldrb(t16_memio_imm5_op(1)); }


x86 assembly (clang, -O0):
<t16_ldrb_imm5>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1040 <t16_memio_imm5_op@plt>
mov    %eax,%edi
call   1030 <arm_memio_ldrb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t16_ldrb_imm5>:
push   %rax
mov    $0x1,%edi
call   1040 <t16_memio_imm5_op@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <arm_memio_ldrb@plt>

LLVM IR (-O0):
define void @t16_ldrb_imm5() {
%1 = call i32 @t16_memio_imm5_op(i32 1)
%2 = call i32 @arm_memio_ldrb(i32 %1)
ret void
}

LLVM IR (-O2):
define void @t16_ldrb_imm5() {
%1 = tail call i32 @t16_memio_imm5_op(i32 1)
%2 = tail call i32 @arm_memio_ldrb(i32 %1)
ret void
}
void roadmap_gps_detect_receiver(void) {}


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

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

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

LLVM IR (-O2):
define void @roadmap_gps_detect_receiver() {
ret void
}
double dot_product(double a[3], double b[3]) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}


x86 assembly (clang, -O0):
<dot_product>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dot_product>:
movsd  0x8(%rdi),%xmm0
mulsd  0x8(%rsi),%xmm0
movsd  (%rdi),%xmm1
mulsd  (%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  0x10(%rsi),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dot_product(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 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = fmul double %13, %16
%18 = call double @llvm.fmuladd.f64(double %7, double %10, double %17)
%19 = load double*, double** %3
%20 = getelementptr inbounds double, double* %19, i64 2
%21 = load double, double* %20
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = call double @llvm.fmuladd.f64(double %21, double %24, double %18)
ret double %25
}

LLVM IR (-O2):
define double @dot_product(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %9)
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %10)
ret double %15
}
/* Type definitions */
struct aFILE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _get_actual_fp(struct aFILE *);
int getw(int /*<<< orphan*/);
int my_getw(struct aFILE *fp) { return getw(_get_actual_fp(fp)); }


x86 assembly (clang, -O0):
<my_getw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_get_actual_fp@plt>
mov    %eax,%edi
call   1040 <getw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_getw>:
push   %rax
call   1030 <_get_actual_fp@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <getw@plt>

LLVM IR (-O0):
%struct.aFILE = type { i32 }
define i32 @my_getw(%struct.aFILE* %0) {
%2 = alloca %struct.aFILE*
store %struct.aFILE* %0, %struct.aFILE** %2
%3 = load %struct.aFILE*, %struct.aFILE** %2
%4 = call i32 @_get_actual_fp(%struct.aFILE* %3)
%5 = call i32 @getw(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.aFILE = type { i32 }
define i32 @my_getw(%struct.aFILE* %0) {
%2 = tail call i32 @_get_actual_fp(%struct.aFILE* %0)
%3 = tail call i32 @getw(i32 %2)
ret i32 %3
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_message_set_auto_start(void *m, int b) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_message_set_auto_start>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    0x2ecc(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_bus_message_set_auto_start>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_message_set_auto_start(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_message_set_auto_start(i8* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ getcwd(char *, size_t);
void c_getcwd_(char *path, int pathlen) { getcwd(path, (size_t)pathlen); }


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

x86 assembly (clang, -O2):
<c_getcwd_>:
movslq %esi,%rsi
jmp    1030 <getcwd@plt>

LLVM IR (-O0):
define void @c_getcwd_(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 = sext i32 %6 to i64
%8 = call i32 @getcwd(i8* %5, i64 %7)
ret void
}

LLVM IR (-O2):
define void @c_getcwd_(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = tail call i32 @getcwd(i8* %0, i64 %3)
ret void
}
/* Variables and functions */
int gt_ht_ul_elem_cmp(unsigned long const *, unsigned long const *);
int rev_key_cmp(const unsigned long a, const unsigned long b) {
  return -gt_ht_ul_elem_cmp(&a, &b);
}


x86 assembly (clang, -O0):
<rev_key_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <gt_ht_ul_elem_cmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev_key_cmp>:
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <gt_ht_ul_elem_cmp@plt>
neg    %eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @rev_key_cmp(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = call i32 @gt_ht_ul_elem_cmp(i64* %3, i64* %4)
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @rev_key_cmp(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = call i32 @gt_ht_ul_elem_cmp(i64* %3, i64* %4)
%6 = sub nsw i32 0, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
void g() { f(10); }


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

x86 assembly (clang, -O2):
<g>:
mov    $0xa,%edi
jmp    1030 <f@plt>

LLVM IR (-O0):
define void @g() {
%1 = call i32 @f(i32 10)
ret void
}

LLVM IR (-O2):
define void @g() {
%1 = tail call i32 @f(i32 10)
ret void
}
void swap(int a[], int i, int j) {
  int tmp = a[i];
  a[i] = a[j];
  a[j] = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @swap(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 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
void mutex_set_owner(struct mutex *lock) {}


x86 assembly (clang, -O0):
<mutex_set_owner>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.mutex = type opaque
define void @mutex_set_owner(%struct.mutex* %0) {
%2 = alloca %struct.mutex*
store %struct.mutex* %0, %struct.mutex** %2
ret void
}

LLVM IR (-O2):
%struct.mutex = type opaque
define void @mutex_set_owner(%struct.mutex* nocapture %0) {
ret void
}
/* Variables and functions */
int mcfioC_GetNTupleIds(int, int *, int);
int mcfio_getntupleids_(int *stream, int *ids, int *max) {
  return mcfioC_GetNTupleIds(*stream, ids, *max);
}


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

x86 assembly (clang, -O2):
<mcfio_getntupleids_>:
mov    (%rdi),%edi
mov    (%rdx),%edx
jmp    1030 <mcfioC_GetNTupleIds@plt>

LLVM IR (-O0):
define i32 @mcfio_getntupleids_(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* %7
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = load i32, i32* %10
%12 = call i32 @mcfioC_GetNTupleIds(i32 %8, i32* %9, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @mcfio_getntupleids_(i32* nocapture %0, i32* %1, i32* nocapture %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %2
%6 = tail call i32 @mcfioC_GetNTupleIds(i32 %4, i32* %1, i32 %5)
ret i32 %6
}
void main() { int testInt = 0; }


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

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __gethostname(char *name, size_t len) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__gethostname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__gethostname>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @__gethostname(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @__gethostname(i8* nocapture readnone %0, i64 %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t mp2vpicx_get_fcode11(const uint8_t *p_mp2vpicx) {
  return (p_mp2vpicx[6] >> 4);
}


x86 assembly (clang, -O0):
<mp2vpicx_get_fcode11>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%eax
sar    $0x4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2vpicx_get_fcode11>:
mov    0x18(%rdi),%eax
sar    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @mp2vpicx_get_fcode11(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 6
%5 = load i32, i32* %4
%6 = ashr i32 %5, 4
ret i32 %6
}

LLVM IR (-O2):
define i32 @mp2vpicx_get_fcode11(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 6
%3 = load i32, i32* %2
%4 = ashr i32 %3, 4
ret i32 %4
}
/* Variables and functions */
int do_sum(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int sum;
  sum = do_sum(1000);
  printf("Total sum is: %d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x3e8,%edi
call   1040 <do_sum@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3e8,%edi
call   1040 <do_sum@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Total sum is: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @do_sum(i32 1000)
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Total sum is: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @do_sum(i32 1000)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int execvp(char *, char **);
int /*<<< orphan*/ perror(char *);
int main() {
  char *a[] = {"ps", "-ef", NULL};
  if (execvp("ps", a) == -1)
    perror("execvp");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cc7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cc4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1040 <execvp@plt>
cmp    $0xffffffff,%eax
jne    1175 <main+0x55>
lea    0xe97(%rip),%rdi
call   1030 <perror@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0x2ce5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2cc9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xebe(%rip),%rdi
mov    %rsp,%rsi
call   1040 <execvp@plt>
cmp    $0xffffffff,%eax
je     1156 <main+0x36>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xeaa(%rip),%rdi
call   1030 <perror@plt>
jmp    114f <main+0x2f>

LLVM IR (-O0):
@.str = [3 x i8] c"ps\00"
@.str.1 = [4 x i8] c"-ef\00"
@__const.main.a = [3 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* null]
@.str.2 = [7 x i8] c"execvp\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8*]
store i32 0, i32* %1
%3 = bitcast [3 x i8*]* %2 to i8*
%4 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
%5 = call i32 @execvp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"ps\00"
@.str.1 = [4 x i8] c"-ef\00"
@__const.main.a = [3 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* null]
@.str.2 = [7 x i8] c"execvp\00"
define i32 @main() {
%1 = alloca [3 x i8*]
%2 = bitcast [3 x i8*]* %1 to i8*
%3 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
%4 = call i32 @execvp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret i32 0
}
/* Variables and functions */
double ln(int);
double log(double m) { return ln(m) / ln(10); }


x86 assembly (clang, -O0):
<log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%edi
call   1030 <ln@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0xa,%edi
call   1030 <ln@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log>:
push   %rax
cvttsd2si %xmm0,%edi
call   1030 <ln@plt>
movsd  %xmm0,(%rsp)
mov    $0xa,%edi
call   1030 <ln@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @log(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
%5 = call double @ln(i32 %4)
%6 = call double @ln(i32 10)
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @log(double %0) {
%2 = fptosi double %0 to i32
%3 = tail call double @ln(i32 %2)
%4 = tail call double @ln(i32 10)
%5 = fdiv double %3, %4
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void end_me(int signum) {
  printf("Shutting down the server...\n");
  exit(0);
}


x86 assembly (clang, -O0):
<end_me>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<end_me>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Shutting down the server...\0A\00"
define void @end_me(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [28 x i8] c"Shutting down the server...\00"
define void @end_me(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int functionCalled();
int main() { return (functionCalled()); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @functionCalled()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int CheckEndian() {
  int type = -1;
  union {
    int b;
    char a[4];
  } u;
  u.b = 1;
  if (u.a[3] == 1) {
    type = 1;
  } else if (u.a[0] == 1) {
    type = 0;
  } else {
    printf("Error: Unknown Endian!\n");
    exit(-1);
  }
  return (type);
}


x86 assembly (clang, -O0):
<CheckEndian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x1,%eax
jne    114f <CheckEndian+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1183 <CheckEndian+0x63>
movsbl -0x8(%rbp),%eax
cmp    $0x1,%eax
jne    1168 <CheckEndian+0x48>
movl   $0x0,-0x4(%rbp)
jmp    117e <CheckEndian+0x5e>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
jmp    1183 <CheckEndian+0x63>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i32 }
@.str = [24 x i8] c"Error: Unknown Endian!\0A\00"
define i32 @CheckEndian() {
%1 = alloca i32
%2 = alloca %union.anon
store i32 -1, i32* %1
%3 = bitcast %union.anon* %2 to i32*
store i32 1, i32* %3
%4 = bitcast %union.anon* %2 to [4 x i8]*
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 1, i32* %1
br label %21
10: ; preds = %0
%11 = bitcast %union.anon* %2 to [4 x i8]*
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %11, i64 0, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 0, i32* %1
br label %20
17: ; preds = %10
%18 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %16
br label %21
21: ; preds = %20, %9
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
define i32 @CheckEndian() {
ret i32 0
}
/* Type definitions */
struct client_attr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ recv_request_data(struct client_attr *);
int /*<<< orphan*/ recv_request_header(struct client_attr *);
void recv_request(struct client_attr *attr) {
  recv_request_header(attr);
  recv_request_data(attr);
}


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

x86 assembly (clang, -O2):
<recv_request>:
push   %rbx
mov    %rdi,%rbx
call   1030 <recv_request_header@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <recv_request_data@plt>

LLVM IR (-O0):
%struct.client_attr = type { i32 }
define void @recv_request(%struct.client_attr* %0) {
%2 = alloca %struct.client_attr*
store %struct.client_attr* %0, %struct.client_attr** %2
%3 = load %struct.client_attr*, %struct.client_attr** %2
%4 = call i32 @recv_request_header(%struct.client_attr* %3)
%5 = load %struct.client_attr*, %struct.client_attr** %2
%6 = call i32 @recv_request_data(%struct.client_attr* %5)
ret void
}

LLVM IR (-O2):
%struct.client_attr = type { i32 }
define void @recv_request(%struct.client_attr* %0) {
%2 = tail call i32 @recv_request_header(%struct.client_attr* %0)
%3 = tail call i32 @recv_request_data(%struct.client_attr* %0)
ret void
}
/* Variables and functions */
scalar_t__ getenv(char const *);
int /*<<< orphan*/ strcpy(char *, char *);
void getenv_f_(const char *name, char *value, int *ierr) {
  char *lvalue;
  lvalue = (char *)getenv(name);
  if (lvalue == NULL)
    *ierr = -1;
  else {
    *ierr = 0;
    strcpy(value, lvalue);
  }
}


x86 assembly (clang, -O0):
<getenv_f_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115b <getenv_f_+0x3b>
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    1172 <getenv_f_+0x52>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getenv_f_>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
call   1030 <getenv@plt>
test   %rax,%rax
je     114c <getenv_f_+0x2c>
movl   $0x0,(%rbx)
mov    %r14,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcpy@plt>
movl   $0xffffffff,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @getenv_f_(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = call i64 @getenv(i8* %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = load i32*, i32** %6
store i32 -1, i32* %14
br label %20
15: ; preds = %3
%16 = load i32*, i32** %6
store i32 0, i32* %16
%17 = load i8*, i8** %5
%18 = load i8*, i8** %7
%19 = call i32 @strcpy(i8* %17, i8* %18)
br label %20
20: ; preds = %15, %13
ret void
}

LLVM IR (-O2):
define void @getenv_f_(i8* nocapture %0, i8* %1, i32* nocapture writeonly %2) {
%4 = tail call i64 @getenv(i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %3
store i32 -1, i32* %2
br label %10
7: ; preds = %3
%8 = inttoptr i64 %4 to i8*
store i32 0, i32* %2
%9 = tail call i32 @strcpy(i8* %1, i8* %8)
br label %10
10: ; preds = %7, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_MAKE_RFM_CTL1_OUTPUT() { set_io_bit(0x45, 6); }


x86 assembly (clang, -O0):
<TOSH_MAKE_RFM_CTL1_OUTPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0x45,%edi
mov    $0x6,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_RFM_CTL1_OUTPUT>:
mov    $0x45,%edi
mov    $0x6,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_RFM_CTL1_OUTPUT() {
%1 = call i32 @set_io_bit(i32 69, i32 6)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_RFM_CTL1_OUTPUT() {
%1 = tail call i32 @set_io_bit(i32 69, i32 6)
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int timediff_msec(struct timeval t1, struct timeval t2) {
  return (t1.tv_sec - t2.tv_sec) * 1000 + (t1.tv_usec - t2.tv_usec) / 1000;
}


x86 assembly (clang, -O0):
<timediff_msec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
imul   $0x3e8,%eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timediff_msec>:
mov    %rdi,%rax
shr    $0x20,%rax
sub    %esi,%edi
shr    $0x20,%rsi
imul   $0x3e8,%edi,%ecx
sub    %esi,%eax
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @timediff_msec(i64 %0, i64 %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = bitcast %struct.timeval* %3 to i64*
store i64 %0, i64* %5
%6 = bitcast %struct.timeval* %4 to i64*
store i64 %1, i64* %6
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%10 = load i32, i32* %9
%11 = sub nsw i32 %8, %10
%12 = mul nsw i32 %11, 1000
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 1
%16 = load i32, i32* %15
%17 = sub nsw i32 %14, %16
%18 = sdiv i32 %17, 1000
%19 = add nsw i32 %12, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @timediff_msec(i64 %0, i64 %1) {
%3 = trunc i64 %0 to i32
%4 = lshr i64 %0, 32
%5 = trunc i64 %4 to i32
%6 = trunc i64 %1 to i32
%7 = lshr i64 %1, 32
%8 = trunc i64 %7 to i32
%9 = sub nsw i32 %3, %6
%10 = mul nsw i32 %9, 1000
%11 = sub nsw i32 %5, %8
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %12, %10
ret i32 %13
}
fgt(float x, float y) {
  if (x > y)
    return 13;
  else
    return 140;
}


x86 assembly (clang, -O0):
<fgt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1129 <fgt+0x29>
movl   $0xd,-0x4(%rbp)
jmp    1130 <fgt+0x30>
movl   $0x8c,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgt>:
ucomiss %xmm1,%xmm0
mov    $0xd,%ecx
mov    $0x8c,%eax
cmova  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @fgt(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, i32 13, i32 140
ret i32 %4
}
int wres_err_to_index(int err) { return -err - 1000; }


x86 assembly (clang, -O0):
<wres_err_to_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
sub    $0x3e8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wres_err_to_index>:
mov    $0xfffffc18,%eax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @wres_err_to_index(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 0, %3
%5 = sub nsw i32 %4, 1000
ret i32 %5
}

LLVM IR (-O2):
define i32 @wres_err_to_index(i32 %0) {
%2 = sub i32 -1000, %0
ret i32 %2
}
int lcm(int x, int y) {
  int i;
  for (i = x;; i++) {
    if (i % x == 0 && i % y == 0) {
      return i;
    }
  }
}


x86 assembly (clang, -O0):
<lcm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x4(%rbp)
cmp    $0x0,%edx
jne    1135 <lcm+0x35>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    1135 <lcm+0x35>
mov    -0xc(%rbp),%eax
pop    %rbp
ret
jmp    113a <lcm+0x3a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1110 <lcm+0x10>

x86 assembly (clang, -O2):
<lcm>:
mov    %edi,%ecx
jmp    1113 <lcm+0x13>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ecx
mov    %ecx,%eax
cltd
idiv   %edi
test   %edx,%edx
jne    1110 <lcm+0x10>
mov    %ecx,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1110 <lcm+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @lcm(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* %3
store i32 %6, i32* %5
br label %7
7: ; preds = %20, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = srem i32 %8, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %7
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = srem i32 %13, %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = load i32, i32* %5
ret i32 %18
19: ; preds = %12, %7
br label %20
20: ; preds = %19
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %7
}

LLVM IR (-O2):
define i32 @lcm(i32 %0, i32 %1) {
br label %3
3: ; preds = %11, %2
%4 = phi i32 [ %0, %2 ], [ %12, %11 ]
%5 = srem i32 %4, %0
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = srem i32 %4, %1
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
ret i32 %4
11: ; preds = %3, %7
%12 = add nsw i32 %4, 1
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ gluPerspective(double, double, double, double);
int /*<<< orphan*/ glutPostRedisplay();
void reshape(int w, int h) {
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(60.0, 1.0, 1.0, 1024.0);
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
movsd  0xe95(%rip),%xmm0
movsd  0xe95(%rip),%xmm2
movsd  0xe95(%rip),%xmm3
movaps %xmm2,%xmm1
call   1040 <gluPerspective@plt>
mov    $0x0,%al
call   1060 <glutPostRedisplay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %rax
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
movsd  0xea2(%rip),%xmm0
movsd  0xea2(%rip),%xmm1
movsd  0xea2(%rip),%xmm3
movaps %xmm1,%xmm2
call   1040 <gluPerspective@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <glutPostRedisplay@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
define void @reshape(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @GL_PROJECTION
%6 = call i32 @glMatrixMode(i32 %5)
%7 = call i32 (...) @glLoadIdentity()
%8 = call i32 @gluPerspective(double 6.000000e+01, double 1.000000e+00, double 1.000000e+00, double 1.024000e+03)
%9 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
define void @reshape(i32 %0, i32 %1) {
%3 = load i32, i32* @GL_PROJECTION
%4 = tail call i32 @glMatrixMode(i32 %3)
%5 = tail call i32 (...) @glLoadIdentity()
%6 = tail call i32 @gluPerspective(double 6.000000e+01, double 1.000000e+00, double 1.000000e+00, double 1.024000e+03)
%7 = tail call i32 (...) @glutPostRedisplay()
ret void
}
/* Variables and functions */
int strlen(char *);
char *Blanks(int cnt) {
  static char *BlkStr = "                                                      "
                        "                                                     ";
  if (cnt < 0)
    cnt = 0;
  return BlkStr + (strlen(BlkStr) - cnt);
}


x86 assembly (clang, -O0):
<Blanks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    112c <Blanks+0x1c>
movl   $0x0,-0x4(%rbp)
mov    0x2ef5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2eea(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
sub    -0x4(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Blanks>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %edi,%edi
cmovns %edi,%ebp
lea    0xedf(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
sub    %ebp,%eax
cltq
add    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@Blanks.BlkStr = internal global i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str, i32 0, i32 0)
@.str = [108 x i8] c" \00"
define i8* @Blanks(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
store i32 0, i32* %2
br label %6
6: ; preds = %5, %1
%7 = load i8*, i8** @Blanks.BlkStr
%8 = load i8*, i8** @Blanks.BlkStr
%9 = call i32 @strlen(i8* %8)
%10 = load i32, i32* %2
%11 = sub nsw i32 %9, %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %7, i64 %12
ret i8* %13
}

LLVM IR (-O2):
@.str = [108 x i8] c" \00"
define i8* @Blanks(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str, i64 0, i64 0))
%5 = sub nsw i32 %4, %3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [108 x i8], [108 x i8]* @.str, i64 0, i64 %6
ret i8* %7
}
int feclearexcept(int excepts) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @feclearexcept(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cpc_key_press(int);
int /*<<< orphan*/ cpc_key_unpress(int);
void Joy_Gamma_Fire2(int value) {
  if (value) {
    cpc_key_press(0x75);
  } else {
    cpc_key_unpress(0x75);
  };
}


x86 assembly (clang, -O0):
<Joy_Gamma_Fire2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1144 <Joy_Gamma_Fire2+0x24>
mov    $0x75,%edi
call   1030 <cpc_key_press@plt>
jmp    114e <Joy_Gamma_Fire2+0x2e>
mov    $0x75,%edi
call   1040 <cpc_key_unpress@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Joy_Gamma_Fire2>:
test   %edi,%edi
je     112e <Joy_Gamma_Fire2+0xe>
mov    $0x75,%edi
jmp    1030 <cpc_key_press@plt>
mov    $0x75,%edi
jmp    1040 <cpc_key_unpress@plt>

LLVM IR (-O0):
define void @Joy_Gamma_Fire2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @cpc_key_press(i32 117)
br label %9
7: ; preds = %1
%8 = call i32 @cpc_key_unpress(i32 117)
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
define void @Joy_Gamma_Fire2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @cpc_key_press(i32 117)
br label %7
5: ; preds = %1
%6 = tail call i32 @cpc_key_unpress(i32 117)
br label %7
7: ; preds = %5, %3
ret void
}
void usage_fault_exception(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<usage_fault_exception>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <usage_fault_exception+0x9>
jmp    1109 <usage_fault_exception+0x9>

x86 assembly (clang, -O2):
<usage_fault_exception>:
jmp    1100 <usage_fault_exception>

LLVM IR (-O0):
define void @usage_fault_exception() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @usage_fault_exception() {
br label %1
1: ; preds = %0, %1
br label %1
}
unsigned FSE_32bits(void) { return sizeof(void *) == 4; }


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

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

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

LLVM IR (-O2):
define i32 @FSE_32bits() {
ret i32 0
}