xunge/DecIR huggingface dataset:
int __ocl_clamp_int_int(int src, int minval, int maxval) {
  if (src < minval) {
    return minval;
  }
  if (src > maxval) {
    return maxval;
  }
  return src;
}


x86 assembly (clang, -O0):
<__ocl_clamp_int_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1124 <__ocl_clamp_int_int+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <__ocl_clamp_int_int+0x41>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    113b <__ocl_clamp_int_int+0x3b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <__ocl_clamp_int_int+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_clamp_int_int>:
mov    %edx,%eax
cmp    %edx,%edi
cmovle %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @__ocl_clamp_int_int(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ mergesort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printArr(int *, int);
int main() {
  int a[] = {5, 7, 11, 2, 44, 8, 34, 78, 16};
  int sz = sizeof(a) / sizeof(int);
  printArr(a, sz);
  mergesort(a, 0, sz);
  printArr(a, sz);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x24,%edx
call   1030 <memcpy@plt>
movl   $0x9,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <printArr@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
xor    %esi,%esi
call   1050 <mergesort@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <printArr@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef5(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printArr@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1040 <mergesort@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printArr@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [9 x i32] [i32 5, i32 7, i32 11, i32 2, i32 44, i32 8, i32 34, i32 78, i32 16]
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [9 x i32]* %2 to i8*
store i32 9, i32* %3
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @printArr(i32* %5, i32 %6)
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 @mergesort(i32* %8, i32 0, i32 %9)
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %3
%13 = call i32 @printArr(i32* %11, i32 %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [9 x i32] [i32 5, i32 7, i32 11, i32 2, i32 44, i32 8, i32 34, i32 78, i32 16]
define i32 @main() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i32 @printArr(i32* %3, i32 9)
%5 = call i32 @mergesort(i32* %3, i32 0, i32 9)
%6 = call i32 @printArr(i32* %3, i32 9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ BSP_WriteIsr(unsigned long);
int /*<<< orphan*/ printf(char *, unsigned int);
void BSP_SetDspInterrupt(unsigned int dspInt) {
  unsigned long tmp;
  if (dspInt > 15 || dspInt < 4) {
    printf("bad dsp_int%d\n", dspInt);
    return;
  }
  tmp = 0;
  tmp |= (1 << dspInt);
  BSP_WriteIsr(tmp);
}


x86 assembly (clang, -O0):
<BSP_SetDspInterrupt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xf,-0x4(%rbp)
ja     113f <BSP_SetDspInterrupt+0x1f>
cmpl   $0x4,-0x4(%rbp)
jae    1153 <BSP_SetDspInterrupt+0x33>
mov    -0x4(%rbp),%esi
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
jmp    1178 <BSP_SetDspInterrupt+0x58>
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <BSP_WriteIsr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_SetDspInterrupt>:
mov    %edi,%ecx
lea    -0x10(%rcx),%eax
cmp    $0xfffffff3,%eax
ja     1138 <BSP_SetDspInterrupt+0x18>
lea    0xecf(%rip),%rdi
mov    %ecx,%esi
jmp    1040 <printf@plt>
mov    $0x1,%edi
shl    %cl,%edi
jmp    1030 <BSP_WriteIsr@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"bad dsp_int%d\0A\00"
define void @BSP_SetDspInterrupt(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ugt i32 %4, 15
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp ult i32 %7, 4
br i1 %8, label %9, label %12
9: ; preds = %6, %1
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %20
12: ; preds = %6
store i64 0, i64* %3
%13 = load i32, i32* %2
%14 = shl i32 1, %13
%15 = sext i32 %14 to i64
%16 = load i64, i64* %3
%17 = or i64 %16, %15
store i64 %17, i64* %3
%18 = load i64, i64* %3
%19 = call i32 @BSP_WriteIsr(i64 %18)
br label %20
20: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"bad dsp_int%d\0A\00"
define void @BSP_SetDspInterrupt(i32 %0) {
%2 = add i32 %0, -16
%3 = icmp ult i32 %2, -12
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %10
6: ; preds = %1
%7 = shl nuw nsw i32 1, %0
%8 = zext i32 %7 to i64
%9 = tail call i32 @BSP_WriteIsr(i64 %8)
br label %10
10: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, float);
char *float_to_char(float n, char *s) {
  sprintf(s, "%f", n);
  return (s);
}


x86 assembly (clang, -O0):
<float_to_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movss  -0x4(%rbp),%xmm0
lea    0xecf(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_to_char>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define i8* @float_to_char(float %0, i8* %1) {
%3 = alloca float
%4 = alloca i8*
store float %0, float* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load float, float* %3
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %6)
%8 = load i8*, i8** %4
ret i8* %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i8* @float_to_char(float %0, i8* returned writeonly %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %0)
ret i8* %1
}
wmv(a, b) int a, b;
{ mvcur(a, b); }


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

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

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

LLVM IR (-O2):
define i32 @wmv(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @mvcur to i32 (i32, i32, ...)*)(i32 %0, i32 %1)
ret i32 undef
}
void left_position_encoder_interrupt_init(void) {}


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

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

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

LLVM IR (-O2):
define void @left_position_encoder_interrupt_init() {
ret void
}
void genbc1fl() {}


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

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

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

LLVM IR (-O2):
define void @genbc1fl() {
ret void
}
/* Variables and functions */
double modf(double, double *);
double inpart(double param) {
  double intpart;
  double frapart = modf(param, &intpart);
  return intpart;
}


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

x86 assembly (clang, -O2):
<inpart>:
push   %rax
mov    %rsp,%rdi
call   1030 <modf@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @inpart(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = call double @modf(double %5, double* %3)
store double %6, double* %4
%7 = load double, double* %3
ret double %7
}

LLVM IR (-O2):
define double @inpart(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = call double @modf(double %0, double* %2)
%5 = load double, double* %2
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ fmtdeg(char *, double);
double nutation(double);
int /*<<< orphan*/ printf(char *, char *);
void testnutation(void) {
  double jd = 2411545.0;
  char deg[30];
  double d;
  d = nutation(jd) * 57.295779513082320876798;
  fmtdeg(deg, d);
  printf("%s\n", deg);
}


x86 assembly (clang, -O0):
<testnutation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <nutation@plt>
movsd  0xea9(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
movsd  -0x38(%rbp),%xmm0
call   1050 <fmtdeg@plt>
lea    -0x30(%rbp),%rsi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testnutation>:
push   %rbx
sub    $0x20,%rsp
movsd  0xec3(%rip),%xmm0
call   1040 <nutation@plt>
mulsd  0xebe(%rip),%xmm0
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <fmtdeg@plt>
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @testnutation() {
%1 = alloca double
%2 = alloca [30 x i8]
%3 = alloca double
store double 0x4142660C80000000, double* %1
%4 = load double, double* %1
%5 = call double @nutation(double %4)
%6 = fmul double %5, 0x404CA5DC1A63C1F8
store double %6, double* %3
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%8 = load double, double* %3
%9 = call i32 @fmtdeg(i8* %7, double %8)
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @testnutation() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = tail call double @nutation(double 0x4142660C80000000)
%4 = fmul double %3, 0x404CA5DC1A63C1F8
%5 = call i32 @fmtdeg(i8* %2, double %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
void do_gettimeofday(struct timeval *tp) { gettimeofday(tp, 0); }


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

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

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

LLVM IR (-O2):
%struct.timeval = type { i32 }
define void @do_gettimeofday(%struct.timeval* %0) {
%2 = tail call i32 @gettimeofday(%struct.timeval* %0, i32 0)
ret void
}
/* Variables and functions */
char *getenv(char *);
char *android_tmpdir_path(void) { return getenv("TMPDIR"); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"TMPDIR\00"
define i8* @android_tmpdir_path() {
%1 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [7 x i8] c"TMPDIR\00"
define i8* @android_tmpdir_path() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t h264avcc_get_length_size_1(const uint8_t *p) { return p[4] & 0x3; }


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

x86 assembly (clang, -O2):
<h264avcc_get_length_size_1>:
mov    0x10(%rdi),%eax
and    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @h264avcc_get_length_size_1(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = load i32, i32* %2
%4 = and i32 %3, 3
ret i32 %4
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int create_dobldobl_cascade_homotopy(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(178, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<create_dobldobl_cascade_homotopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xb2,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_dobldobl_cascade_homotopy>:
mov    $0xb2,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @create_dobldobl_cascade_homotopy() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 178, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @create_dobldobl_cascade_homotopy() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 178, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
double floor(double);
int /*<<< orphan*/ printf(char *, double);
int main() {
  printf("floor of 2.3 is %.1f\n", floor(2.3));
  printf("floor of 3.8 is %.1f\n", floor(3.8));
  printf("floor of -2.3 is %.1f\n", floor(-2.3));
  printf("floor of -3.8 is %.1f\n", floor(-3.8));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xef1(%rip),%xmm0
lea    0xef2(%rip),%rdi
call   1030 <printf@plt>
movsd  0xed5(%rip),%xmm0
lea    0xef4(%rip),%rdi
call   1030 <printf@plt>
movsd  0xeb9(%rip),%xmm0
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe9d(%rip),%xmm0
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf08(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf0a(%rip),%rdi
movsd  0xed4(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
movsd  0xec8(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf0f(%rip),%rdi
movsd  0xebc(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"floor of 2.3 is %.1f\0A\00"
@.str.1 = [22 x i8] c"floor of 3.8 is %.1f\0A\00"
@.str.2 = [23 x i8] c"floor of -2.3 is %.1f\0A\00"
@.str.3 = [23 x i8] c"floor of -3.8 is %.1f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double @llvm.floor.f64(double 2.300000e+00)
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %2)
%4 = call double @llvm.floor.f64(double 3.800000e+00)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = call double @llvm.floor.f64(double -2.300000e+00)
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), double %6)
%8 = call double @llvm.floor.f64(double -3.800000e+00)
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"floor of 2.3 is %.1f\0A\00"
@.str.1 = [22 x i8] c"floor of 3.8 is %.1f\0A\00"
@.str.2 = [23 x i8] c"floor of -2.3 is %.1f\0A\00"
@.str.3 = [23 x i8] c"floor of -3.8 is %.1f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 2.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double 3.000000e+00)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), double -3.000000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), double -4.000000e+00)
ret i32 0
}
int color_clip(int color) {
  color = (((color) > (0)) ? (color) : (0));
  color = (((color) < (255)) ? (color) : (255));
  return color;
}


x86 assembly (clang, -O0):
<color_clip>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    111c <color_clip+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <color_clip+0x26>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <color_clip+0x26>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jge    1144 <color_clip+0x44>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <color_clip+0x51>
mov    $0xff,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <color_clip+0x51>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<color_clip>:
xor    %ecx,%ecx
test   %edi,%edi
cmovns %edi,%ecx
cmp    $0xff,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @color_clip(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
%4 = icmp ult i32 %3, 255
%5 = select i1 %4, i32 %3, i32 255
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void swap(int *c, int *d) {
  int z = *c;
  *c = *d;
  *d = z;
  printf("Swapped!\n");
  printf("inside swap: %d %d\n", *c, *d);
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%esi
mov    (%r14),%edx
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Swapped!\0A\00"
@.str.1 = [20 x i8] c"inside swap: %d %d\0A\00"
define void @swap(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
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = load i32*, i32** %3
%15 = load i32, i32* %14
%16 = load i32*, i32** %4
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %17)
ret void
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"inside swap: %d %d\0A\00"
@str = [9 x i8] c"Swapped!\00"
define void @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* %0
%7 = load i32, i32* %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
ret void
}
void dcTest_initPlatform() {}


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

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

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

LLVM IR (-O2):
define void @dcTest_initPlatform() {
ret void
}
/* Variables and functions */
int fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102(
    char const *);
int fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102(
    const char *text) {
  int pos = 0;
  pos =
      fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102(
          text);
  if (pos != -1)
    return pos;
  return -1;
}


x86 assembly (clang, -O0):
<fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     1144 <fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102>:
jmp    1030 <fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102@plt>

LLVM IR (-O0):
define i32 @fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102(i8* %0) {
%2 = tail call i32 @fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_72_ch_97_ch_115_ch_83_ch_101_ch_108_ch_102(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fcloseall();
int getpid();
int /*<<< orphan*/ printf(char *, int);
void closing_clnt_srvr_LogManager() {
  printf(" K:'%d' ", getpid());
  fcloseall();
  exit(2);
}


x86 assembly (clang, -O0):
<closing_clnt_srvr_LogManager>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <fcloseall@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<closing_clnt_srvr_LogManager>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <fcloseall@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c" K:'%d' \00"
define void @closing_clnt_srvr_LogManager() {
%1 = call i32 (...) @getpid()
%2 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 (...) @fcloseall()
%4 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@.str = [9 x i8] c" K:'%d' \00"
define void @closing_clnt_srvr_LogManager() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @fcloseall()
%4 = tail call i32 @exit(i32 2)
unreachable
}
/* Variables and functions */
char *calloc(int, int);
char *malloc(int);
int /*<<< orphan*/ mlock(char *, int);
int init_buffer(char **buffer, const unsigned int zero) {
  if (zero) {
    *buffer = calloc(32 + 1, sizeof(char));
  } else {
    *buffer = malloc((32 + 1) * sizeof(char));
  }
  return !mlock(*buffer, (32 + 1) * sizeof(char));
}


x86 assembly (clang, -O0):
<init_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1167 <init_buffer+0x37>
mov    $0x21,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    117b <init_buffer+0x4b>
mov    $0x21,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0x21,%esi
call   1030 <mlock@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_buffer>:
push   %rbx
mov    %rdi,%rbx
mov    $0x21,%edi
test   %esi,%esi
je     1149 <init_buffer+0x19>
mov    $0x1,%esi
call   1040 <calloc@plt>
jmp    114e <init_buffer+0x1e>
call   1050 <malloc@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
mov    $0x21,%esi
call   1030 <mlock@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @init_buffer(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = call i8* @calloc(i32 33, i32 1)
%9 = load i8**, i8*** %3
store i8* %8, i8** %9
br label %13
10: ; preds = %2
%11 = call i8* @malloc(i32 33)
%12 = load i8**, i8*** %3
store i8* %11, i8** %12
br label %13
13: ; preds = %10, %7
%14 = load i8**, i8*** %3
%15 = load i8*, i8** %14
%16 = call i32 @mlock(i8* %15, i32 33)
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @init_buffer(i8** nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call dereferenceable_or_null(33) i8* @calloc(i32 33, i32 1)
br label %8
6: ; preds = %2
%7 = tail call dereferenceable_or_null(33) i8* @malloc(i32 33)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %7, %6 ], [ %5, %4 ]
store i8* %9, i8** %0
%10 = tail call i32 @mlock(i8* %9, i32 33)
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_mday;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int date_get_day(void) {
  time_t t;
  struct tm *lt;
  t = time(NULL);
  lt = localtime(&t);
  return lt->tm_mday;
}


x86 assembly (clang, -O0):
<date_get_day>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_get_day>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @date_get_day() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @date_get_day() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void timefunc(int value) {
  printf("\nFAIL: test16\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"\0AFAIL: test16\0A\00"
define void @timefunc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [14 x i8] c"\0AFAIL: test16\00"
define void @timefunc(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ munmap(void *, size_t);
void unmap_physical(void *virt_addr, size_t len) { munmap(virt_addr, len); }


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

x86 assembly (clang, -O2):
<unmap_physical>:
jmp    1030 <munmap@plt>

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

LLVM IR (-O2):
define void @unmap_physical(i8* %0, i64 %1) {
%3 = tail call i32 @munmap(i8* %0, i64 %1)
ret void
}
/* Variables and functions */
int atoi(char *);
char *getenv(char *);
int linedit_terminal_lines(int def) {
  char *lin;
  if ((lin = getenv("LINES")))
    return atoi(lin);
  else
    return def;
}


x86 assembly (clang, -O0):
<linedit_terminal_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xece(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1156 <linedit_terminal_lines+0x36>
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    115c <linedit_terminal_lines+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linedit_terminal_lines>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     113d <linedit_terminal_lines+0x1d>
mov    %rax,%rdi
pop    %rbx
jmp    1040 <atoi@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"LINES\00"
define i32 @linedit_terminal_lines(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %4
%9 = call i32 @atoi(i8* %8)
store i32 %9, i32* %2
br label %12
10: ; preds = %1
%11 = load i32, i32* %3
store i32 %11, i32* %2
br label %12
12: ; preds = %10, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [6 x i8] c"LINES\00"
define i32 @linedit_terminal_lines(i32 %0) {
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @atoi(i8* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %0, %1 ]
ret i32 %7
}
double determine_discount(double cost) {
  double discount = 0.1;
  if (cost >= 100) {
    discount = 0.12;
  }
  return discount;
}


x86 assembly (clang, -O0):
<determine_discount>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xedd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     113a <determine_discount+0x3a>
movsd  0xedb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<determine_discount>:
xor    %eax,%eax
ucomisd 0xef6(%rip),%xmm0
setb   %al
lea    0xef4(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
ret

LLVM IR (-O0):
define double @determine_discount(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 1.000000e-01, double* %3
%4 = load double, double* %2
%5 = fcmp oge double %4, 1.000000e+02
br i1 %5, label %6, label %7
6: ; preds = %1
store double 1.200000e-01, double* %3
br label %7
7: ; preds = %6, %1
%8 = load double, double* %3
ret double %8
}

LLVM IR (-O2):
define double @determine_discount(double %0) {
%2 = fcmp ult double %0, 1.000000e+02
%3 = select i1 %2, double 1.000000e-01, double 1.200000e-01
ret double %3
}
int foo2(int x) { return x * 2; }


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo2>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @foo2(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
bool h264naltype_is_slice(uint8_t type) {
  switch (type) {
  case 5:
  case 1:
  case 2:
  case 3:
  case 4:
    return true;
  default:
    return false;
  }
}


x86 assembly (clang, -O0):
<h264naltype_is_slice>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
sub    $0x4,%eax
ja     1127 <h264naltype_is_slice+0x27>
jmp    111b <h264naltype_is_slice+0x1b>
movl   $0x1,-0x4(%rbp)
jmp    112e <h264naltype_is_slice+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<h264naltype_is_slice>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x5,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @h264naltype_is_slice(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 5, label %5
i32 1, label %5
i32 2, label %5
i32 3, label %5
i32 4, label %5
]
5: ; preds = %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @h264naltype_is_slice(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 5
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: armhost [prog]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"usage: armhost [prog]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"usage: armhost [prog]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
double test_exp2(double x) { return __builtin_exp2(x); }


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

x86 assembly (clang, -O2):
<test_exp2>:
jmp    1030 <exp2@plt>

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

LLVM IR (-O2):
define double @test_exp2(double %0) {
%2 = tail call double @exp2(double %0)
ret double %2
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ subwindow;
};
typedef TYPE_1__ XCrossingEvent;

/* Variables and functions */
unsigned long get_XCrossingEvent_subwindow(void *_p) {
  return (unsigned long)((XCrossingEvent *)_p)->subwindow;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XCrossingEvent_subwindow(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XCrossingEvent_subwindow(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
double M_PI;
double deg2rad(double deg) { return (deg * M_PI / 180); }


x86 assembly (clang, -O0):
<deg2rad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ed3(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xedf(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<deg2rad>:
mov    0x2ee1(%rip),%rax
mulsd  (%rax),%xmm0
divsd  0xeed(%rip),%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @deg2rad(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* @M_PI
%5 = fmul double %3, %4
%6 = fdiv double %5, 1.800000e+02
ret double %6
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @deg2rad(double %0) {
%2 = load double, double* @M_PI
%3 = fmul double %2, %0
%4 = fdiv double %3, 1.800000e+02
ret double %4
}
char *stpcpy(char *to, const char *from) {
  for (; (*to = *from) != '\0'; ++from, ++to)
    ;
  return (to);
}


x86 assembly (clang, -O0):
<stpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1146 <stpcpy+0x46>
jmp    1129 <stpcpy+0x29>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <stpcpy+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stpcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %cl,(%rdi)
test   %cl,%cl
je     1122 <stpcpy+0x22>
add    $0x1,%rsi
nop
movzbl (%rsi),%ecx
mov    %cl,0x1(%rax)
add    $0x1,%rax
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <stpcpy+0x10>
ret

LLVM IR (-O0):
define i8* @stpcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %12, %2
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = load i8*, i8** %3
store i8 %7, i8* %8
%9 = sext i8 %7 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %5
br label %12
12: ; preds = %11
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %4
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
br label %5
17: ; preds = %5
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @stpcpy(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
store i8 %3, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %8, %5 ], [ %1, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %8
store i8 %10, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = phi i8* [ %0, %2 ], [ %9, %5 ]
ret i8* %13
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage_display() {
  fprintf(stderr, "Usage: upackddir [OPTIONS] FILENAME...\n"
                  "Try `upackddir --help' for "
                  "more informations.\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage_display>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage_display>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [86 x i8] c"Usage: upackddir [OPTIONS] FILENAME...\0ATry `upackddir --help' for more informations.\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage_display() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [86 x i8] c"Usage: upackddir [OPTIONS] FILENAME...\0ATry `upackddir --help' for more informations.\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage_display() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
int test_imm_DFuint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xDF << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_DFuint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 14614528
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char *pop(char *line) {
  line++;
  return line;
}


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

x86 assembly (clang, -O2):
<pop>:
lea    0x1(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @pop(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i32 1
store i8* %4, i8** %2
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define i8* @pop(i8* readnone %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ channel_usage();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(
      stderr,
      "Usage:   transmit encoded-file|n-zeros received-file seed channel\n");
  channel_usage();
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x0,%al
call   1040 <channel_usage@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
call   1040 <channel_usage@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [67 x i8] c"Usage: transmit encoded-file|n-zeros received-file seed channel\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @channel_usage()
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [67 x i8] c"Usage: transmit encoded-file|n-zeros received-file seed channel\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @channel_usage()
%4 = tail call i32 @exit(i32 1)
unreachable
}