xunge/DecIR huggingface dataset:
/* Type definitions */
struct timeval {
  unsigned int tv_sec;
  unsigned int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ select(int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          struct timeval *);
void sleep_us(unsigned int nusecs) {
  struct timeval tv;
  tv.tv_sec = nusecs / 1000000;
  tv.tv_usec = nusecs % 1000000;
  (void)select(0, NULL, NULL, NULL, &tv);
}


x86 assembly (clang, -O0):
<sleep_us>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0xc(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <select@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep_us>:
push   %rax
mov    %edi,%eax
imul   $0x431bde83,%rax,%rax
shr    $0x32,%rax
mov    %eax,(%rsp)
imul   $0xf4240,%eax,%eax
sub    %eax,%edi
mov    %edi,0x4(%rsp)
mov    %rsp,%r8
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <select@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define void @sleep_us(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timeval
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = udiv i32 %4, 1000000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %2
%8 = urem i32 %7, 1000000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i32 %8, i32* %9
%10 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %3)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @sleep_us(i32 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = udiv i32 %0, 1000000
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i32 %4, i32* %5
%6 = urem i32 %0, 1000000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i32 %6, i32* %7
%8 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %2)
ret void
}
/* Variables and functions */
char *strtriml(char *);
char *strtrimr(char *);
char *strtrim(char *pstr) {
  char *p;
  p = strtrimr(pstr);
  return strtriml(p);
}


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

x86 assembly (clang, -O2):
<strtrim>:
push   %rax
call   1040 <strtrimr@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <strtriml@plt>

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

LLVM IR (-O2):
define i8* @strtrim(i8* %0) {
%2 = tail call i8* @strtrimr(i8* %0)
%3 = tail call i8* @strtriml(i8* %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ rcc_enableahb();
int /*<<< orphan*/ rcc_enableapb1();
int /*<<< orphan*/ rcc_enableapb2();
void rcc_enableperipherals(void) {
  rcc_enableahb();
  rcc_enableapb2();
  rcc_enableapb1();
}


x86 assembly (clang, -O0):
<rcc_enableperipherals>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rcc_enableahb@plt>
mov    $0x0,%al
call   1040 <rcc_enableapb2@plt>
mov    $0x0,%al
call   1050 <rcc_enableapb1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rcc_enableperipherals>:
push   %rax
xor    %eax,%eax
call   1030 <rcc_enableahb@plt>
xor    %eax,%eax
call   1040 <rcc_enableapb2@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <rcc_enableapb1@plt>

LLVM IR (-O0):
define void @rcc_enableperipherals() {
%1 = call i32 (...) @rcc_enableahb()
%2 = call i32 (...) @rcc_enableapb2()
%3 = call i32 (...) @rcc_enableapb1()
ret void
}

LLVM IR (-O2):
define void @rcc_enableperipherals() {
%1 = tail call i32 (...) @rcc_enableahb()
%2 = tail call i32 (...) @rcc_enableapb2()
%3 = tail call i32 (...) @rcc_enableapb1()
ret void
}
/* Variables and functions */
double song_command(double, double, double, double, int /*<<< orphan*/);
double modipulategml_song_volume_command(double songid, double ch, double cmd,
                                         double val) {
  return song_command(songid, ch, cmd, val, 0);
}


x86 assembly (clang, -O0):
<modipulategml_song_volume_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
xor    %edi,%edi
call   1030 <song_command@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modipulategml_song_volume_command>:
xor    %edi,%edi
jmp    1030 <song_command@plt>

LLVM IR (-O0):
define double @modipulategml_song_volume_command(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %6
%11 = load double, double* %7
%12 = load double, double* %8
%13 = call double @song_command(double %9, double %10, double %11, double %12, i32 0)
ret double %13
}

LLVM IR (-O2):
define double @modipulategml_song_volume_command(double %0, double %1, double %2, double %3) {
%5 = tail call double @song_command(double %0, double %1, double %2, double %3, i32 0)
ret double %5
}
/* Type definitions */
struct sched_param {
  int dummy;
};
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int pthread_setschedparam(int /*<<< orphan*/, int, struct sched_param const *);
__attribute__((weak)) int
__real_pthread_setschedparam(pthread_t thread, int policy,
                             const struct sched_param *param) {
  return pthread_setschedparam(thread, policy, param);
}


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

x86 assembly (clang, -O2):
<__real_pthread_setschedparam>:
jmp    1030 <pthread_setschedparam@plt>

LLVM IR (-O0):
%struct.sched_param = type { i32 }
define weak i32 @__real_pthread_setschedparam(i32 %0, i32 %1, %struct.sched_param* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sched_param*
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.sched_param* %2, %struct.sched_param** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load %struct.sched_param*, %struct.sched_param** %6
%10 = call i32 @pthread_setschedparam(i32 %7, i32 %8, %struct.sched_param* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
define weak i32 @__real_pthread_setschedparam(i32 %0, i32 %1, %struct.sched_param* %2) {
%4 = tail call i32 @pthread_setschedparam(i32 %0, i32 %1, %struct.sched_param* %2)
ret i32 %4
}
int unpack_byte(int jb, int index) {
  int shift = (index - 1) * 8;
  return (jb >> shift) & 0xff;
}


x86 assembly (clang, -O0):
<unpack_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
shl    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpack_byte>:
lea    0x0(,%rsi,8),%ecx
add    $0xf8,%cl
sar    %cl,%edi
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @unpack_byte(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sub nsw i32 %6, 1
%8 = mul nsw i32 %7, 8
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = ashr i32 %9, %10
%12 = and i32 %11, 255
ret i32 %12
}

LLVM IR (-O2):
define i32 @unpack_byte(i32 %0, i32 %1) {
%3 = shl i32 %1, 3
%4 = add i32 %3, -8
%5 = ashr i32 %0, %4
%6 = and i32 %5, 255
ret i32 %6
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int clock_getres_vdso_wrapper(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ error(int /*<<< orphan*/, int /*<<< orphan*/, char *);
void clock_getres_vdso_nofail(clockid_t id, struct timespec *ts) {
  int err;
  err = clock_getres_vdso_wrapper(id, ts);
  if (err)
    error(EXIT_FAILURE, errno, "clock_getres");
}


x86 assembly (clang, -O0):
<clock_getres_vdso_nofail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <clock_getres_vdso_wrapper@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1166 <clock_getres_vdso_nofail+0x46>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    0x2e88(%rip),%rax
mov    (%rax),%esi
lea    0xe9f(%rip),%rdx
call   1040 <error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock_getres_vdso_nofail>:
push   %rax
call   1030 <clock_getres_vdso_wrapper@plt>
test   %eax,%eax
je     1149 <clock_getres_vdso_nofail+0x29>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
mov    0x2ea6(%rip),%rax
mov    (%rax),%esi
lea    0xebd(%rip),%rdx
pop    %rax
jmp    1040 <error@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@EXIT_FAILURE = global i32 0
@errno = global i32 0
@.str = [13 x i8] c"clock_getres\00"
define void @clock_getres_vdso_nofail(i32 %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
%5 = alloca i32
store i32 %0, i32* %3
store %struct.timespec* %1, %struct.timespec** %4
%6 = load i32, i32* %3
%7 = load %struct.timespec*, %struct.timespec** %4
%8 = call i32 @clock_getres_vdso_wrapper(i32 %6, %struct.timespec* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @EXIT_FAILURE
%13 = load i32, i32* @errno
%14 = call i32 @error(i32 %12, i32 %13, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@EXIT_FAILURE = global i32 0
@errno = global i32 0
@.str = [13 x i8] c"clock_getres\00"
define void @clock_getres_vdso_nofail(i32 %0, %struct.timespec* %1) {
%3 = tail call i32 @clock_getres_vdso_wrapper(i32 %0, %struct.timespec* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @EXIT_FAILURE
%7 = load i32, i32* @errno
%8 = tail call i32 @error(i32 %6, i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ runAllTests_dbqmm();
int main(void) {
  runAllTests_dbqmm();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @runAllTests_dbqmm()
ret i32 0
}
/* Variables and functions */
double pow(double, double);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, double *, double *);
int main(void) {
  double n1, n2, total;
  scanf("%lf %lf", &n1, &n2);
  total = pow(n1, n2);
  printf("%.4lf", total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1050 <pow@plt>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%lf %lf\00"
@.str.1 = [6 x i8] c"%.4lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double* %2, double* %3)
%6 = load double, double* %2
%7 = load double, double* %3
%8 = call double @pow(double %6, double %7)
store double %8, double* %4
%9 = load double, double* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%lf %lf\00"
@.str.1 = [6 x i8] c"%.4lf\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double* %1, double* %2)
%6 = load double, double* %1
%7 = load double, double* %2
%8 = call double @pow(double %6, double %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %8)
ret i32 0
}
/* Type definitions */
struct VectorNumBase {
  int dummy;
};

/* Variables and functions */
void FreeVectorNumBase(struct VectorNumBase *);
void free_vector_num_base(struct VectorNumBase *basev) {
  return FreeVectorNumBase(basev);
}


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

x86 assembly (clang, -O2):
<free_vector_num_base>:
jmp    1030 <FreeVectorNumBase@plt>

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

LLVM IR (-O2):
%struct.VectorNumBase = type { i32 }
define void @free_vector_num_base(%struct.VectorNumBase* %0) {
tail call void @FreeVectorNumBase(%struct.VectorNumBase* %0)
ret void
}
int SCE_Math_Clamp(int a, int min, int max) {
  if (a < min)
    return min;
  else if (a > max)
    return max;
  else
    return a;
}


x86 assembly (clang, -O0):
<SCE_Math_Clamp>:
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 <SCE_Math_Clamp+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <SCE_Math_Clamp+0x41>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    113b <SCE_Math_Clamp+0x3b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <SCE_Math_Clamp+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SCE_Math_Clamp(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 @SCE_Math_Clamp(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
}
/* Variables and functions */
int /*<<< orphan*/ curs_set(int);
int /*<<< orphan*/ endwin();
void CRT_done() {
  curs_set(1);
  endwin();
}


x86 assembly (clang, -O0):
<CRT_done>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1040 <curs_set@plt>
mov    $0x0,%al
call   1030 <endwin@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRT_done>:
push   %rax
mov    $0x1,%edi
call   1040 <curs_set@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <endwin@plt>

LLVM IR (-O0):
define void @CRT_done() {
%1 = call i32 @curs_set(i32 1)
%2 = call i32 (...) @endwin()
ret void
}

LLVM IR (-O2):
define void @CRT_done() {
%1 = tail call i32 @curs_set(i32 1)
%2 = tail call i32 (...) @endwin()
ret void
}
double *vec_mirr(double *const vector, double *const normal) {
  return vec_new(sizeof((double[]){0, 0, 0}) / sizeof(double),
                 (double[]){0, 0, 0});
}


x86 assembly (clang, -O0):
<vec_mirr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
mov    0x2ef1(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2eee(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2eeb(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x28(%rbp),%rsi
mov    $0x3,%edi
mov    $0x0,%al
call   1030 <vec_new@plt>
cltq
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_mirr>:
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
mov    %rsp,%rsi
mov    $0x3,%edi
xor    %eax,%eax
call   1030 <vec_new@plt>
cltq
add    $0x18,%rsp
ret

LLVM IR (-O0):
@constinit = private global [3 x double] zeroinitializer
define double* @vec_mirr(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca [3 x double]
store double* %0, double** %3
store double* %1, double** %4
%6 = bitcast [3 x double]* %5 to i8*
%7 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%8 = bitcast [3 x double]* %5 to i8*
%9 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%10 = call i32 (i64, double*, ...) bitcast (i32 (...)* @vec_new to i32 (i64, double*, ...)*)(i64 3, double* %9)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to double*
ret double* %12
}

LLVM IR (-O2):
define double* @vec_mirr(double* nocapture readnone %0, double* nocapture readnone %1) {
%3 = alloca [3 x double]
%4 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%5 = bitcast [3 x double]* %3 to i8*
%6 = call i32 (i64, double*, ...) bitcast (i32 (...)* @vec_new to i32 (i64, double*, ...)*)(i64 3, double* %4)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to double*
ret double* %8
}
int envelop_init(int argc, char **argv) {
  (void)argc;
  (void)argv;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @envelop_init(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
void amigamfm_validateclock(const unsigned char clock,
                            const unsigned char data) {
  (void)clock;
  (void)data;
}


x86 assembly (clang, -O0):
<amigamfm_validateclock>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @amigamfm_validateclock(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = load i8, i8* %4
ret void
}

LLVM IR (-O2):
define void @amigamfm_validateclock(i8 zeroext %0, i8 zeroext %1) {
ret void
}
/* Variables and functions */
size_t strlen(const char *str) {
  const char *s = str;
  while (*s++)
    ;
  return (size_t)(s - str - 1);
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
je     112d <strlen+0x2d>
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %4 to i64
%9 = ptrtoint i8* %0 to i64
%10 = xor i64 %9, -1
%11 = add i64 %8, %10
ret i64 %11
}
double interpl(double *sample, int i, double y1, double y2, double x) {
  return (y1 * (x - sample[i + 1]) + y2 * (sample[i] - x)) /
         (sample[i] - sample[i + 1]);
}


x86 assembly (clang, -O0):
<interpl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
movsd  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
subsd  -0x28(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpl>:
movslq %esi,%rax
movsd  (%rdi,%rax,8),%xmm3
movsd  0x8(%rdi,%rax,8),%xmm4
movapd %xmm3,%xmm5
subsd  %xmm2,%xmm5
subsd  %xmm4,%xmm2
mulsd  %xmm1,%xmm5
mulsd  %xmm2,%xmm0
addsd  %xmm5,%xmm0
subsd  %xmm4,%xmm3
divsd  %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @interpl(double* %0, i32 %1, double %2, double %3, double %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double* %0, double** %6
store i32 %1, i32* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%11 = load double, double* %8
%12 = load double, double* %10
%13 = load double*, double** %6
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %13, i64 %16
%18 = load double, double* %17
%19 = fsub double %12, %18
%20 = load double, double* %9
%21 = load double*, double** %6
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = load double, double* %10
%27 = fsub double %25, %26
%28 = fmul double %20, %27
%29 = call double @llvm.fmuladd.f64(double %11, double %19, double %28)
%30 = load double*, double** %6
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = load double, double* %33
%35 = load double*, double** %6
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %35, i64 %38
%40 = load double, double* %39
%41 = fsub double %34, %40
%42 = fdiv double %29, %41
ret double %42
}

LLVM IR (-O2):
define double @interpl(double* nocapture %0, i32 %1, double %2, double %3, double %4) {
%6 = add nsw i32 %1, 1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
%10 = fsub double %4, %9
%11 = sext i32 %1 to i64
%12 = getelementptr inbounds double, double* %0, i64 %11
%13 = load double, double* %12
%14 = fsub double %13, %4
%15 = fmul double %14, %3
%16 = tail call double @llvm.fmuladd.f64(double %2, double %10, double %15)
%17 = fsub double %13, %9
%18 = fdiv double %16, %17
ret double %18
}
double myadd(double a, double b) { return a + b; }


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

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

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

LLVM IR (-O2):
define double @myadd(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ freduce_coefficients(int /*<<< orphan*/ *);
int /*<<< orphan*/ freduce_degree(int /*<<< orphan*/ *);
int /*<<< orphan*/ fsquare_inner(int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ const *);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
void fsquare(int64_t *output, const int64_t *in) {
  int64_t t[19];
  fsquare_inner(t, in);
  freduce_degree(t);
  freduce_coefficients(t);
  memcpy(output, t, sizeof(int64_t) * 10);
}


x86 assembly (clang, -O0):
<fsquare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <fsquare_inner@plt>
lea    -0x60(%rbp),%rdi
call   1060 <freduce_degree@plt>
lea    -0x60(%rbp),%rdi
call   1030 <freduce_coefficients@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsquare>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <fsquare_inner@plt>
mov    %rbx,%rdi
call   1060 <freduce_degree@plt>
mov    %rbx,%rdi
call   1030 <freduce_coefficients@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @fsquare(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [19 x i32]
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = getelementptr inbounds [19 x i32], [19 x i32]* %5, i64 0, i64 0
%7 = load i32*, i32** %4
%8 = call i32 @fsquare_inner(i32* %6, i32* %7)
%9 = getelementptr inbounds [19 x i32], [19 x i32]* %5, i64 0, i64 0
%10 = call i32 @freduce_degree(i32* %9)
%11 = getelementptr inbounds [19 x i32], [19 x i32]* %5, i64 0, i64 0
%12 = call i32 @freduce_coefficients(i32* %11)
%13 = load i32*, i32** %3
%14 = getelementptr inbounds [19 x i32], [19 x i32]* %5, i64 0, i64 0
%15 = call i32 @memcpy(i32* %13, i32* %14, i32 40)
ret void
}

LLVM IR (-O2):
define void @fsquare(i32* %0, i32* %1) {
%3 = alloca [19 x i32]
%4 = bitcast [19 x i32]* %3 to i8*
%5 = getelementptr inbounds [19 x i32], [19 x i32]* %3, i64 0, i64 0
%6 = call i32 @fsquare_inner(i32* %5, i32* %1)
%7 = call i32 @freduce_degree(i32* %5)
%8 = call i32 @freduce_coefficients(i32* %5)
%9 = call i32 @memcpy(i32* %0, i32* %5, i32 40)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int, ...);
int main() {
  f(0);
  f(1, 5);
  f(2, "asdf", 4);
  f(3, 4.565f, 6, "abc");
  f(4, 'A', 67.4, 0x80);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
mov    $0x0,%al
call   1030 <f@plt>
mov    $0x1,%edi
mov    $0x5,%esi
mov    $0x0,%al
call   1030 <f@plt>
mov    $0x2,%edi
lea    0xecb(%rip),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <f@plt>
mov    $0x3,%edi
movsd  0xeaa(%rip),%xmm0
mov    $0x6,%esi
lea    0xeab(%rip),%rdx
mov    $0x1,%al
call   1030 <f@plt>
mov    $0x4,%edi
mov    $0x41,%esi
movsd  0xe7d(%rip),%xmm0
mov    $0x80,%edx
mov    $0x1,%al
call   1030 <f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %eax,%eax
call   1030 <f@plt>
mov    $0x1,%edi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <f@plt>
lea    0xede(%rip),%rsi
mov    $0x2,%edi
mov    $0x4,%edx
xor    %eax,%eax
call   1030 <f@plt>
lea    0xecb(%rip),%rdx
movsd  0xeae(%rip),%xmm0
mov    $0x3,%edi
mov    $0x6,%esi
mov    $0x1,%al
call   1030 <f@plt>
movsd  0xe9d(%rip),%xmm0
mov    $0x4,%edi
mov    $0x41,%esi
mov    $0x80,%edx
mov    $0x1,%al
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"asdf\00"
@.str.1 = [4 x i8] c"abc\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i32, ...) @f(i32 0)
%3 = call i32 (i32, ...) @f(i32 1, i32 5)
%4 = call i32 (i32, ...) @f(i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%5 = call i32 (i32, ...) @f(i32 3, double 0x4012428F60000000, i32 6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i32, ...) @f(i32 4, i32 65, double 6.740000e+01, i32 128)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"asdf\00"
@.str.1 = [4 x i8] c"abc\00"
define i32 @main() {
%1 = tail call i32 (i32, ...) @f(i32 0)
%2 = tail call i32 (i32, ...) @f(i32 1, i32 5)
%3 = tail call i32 (i32, ...) @f(i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%4 = tail call i32 (i32, ...) @f(i32 3, double 0x4012428F60000000, i32 6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i32, ...) @f(i32 4, i32 65, double 6.740000e+01, i32 128)
ret i32 0
}
/* Variables and functions */
char *lltoa_wp(long long, char *, int, int, char);
char *lltoa_w(long long val, char *buffer, int base, int width) {
  return lltoa_wp(val, buffer, base, width, ' ');
}


x86 assembly (clang, -O0):
<lltoa_w>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    $0x20,%r8d
call   1030 <lltoa_wp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lltoa_w>:
mov    $0x20,%r8d
jmp    1030 <lltoa_wp@plt>

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

LLVM IR (-O2):
define i8* @lltoa_w(i64 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i8* @lltoa_wp(i64 %0, i8* %1, i32 %2, i32 %3, i8 signext 32)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ err(char *);
void *malloc(unsigned int);
void *mymalloc(unsigned length) {
  void *p = malloc(length);
  if (NULL == p)
    err("Out of memory!\n");
  return p;
}


x86 assembly (clang, -O0):
<mymalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    114f <mymalloc+0x2f>
lea    0xeb6(%rip),%rdi
call   1030 <err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mymalloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <mymalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <err@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Out of memory!\0A\00"
define i8* @mymalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* null, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @err(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [16 x i8] c"Out of memory!\0A\00"
define noalias i8* @mymalloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @err(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
void asn1_Finish(void) {}


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

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

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

LLVM IR (-O2):
define void @asn1_Finish() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printDivider() { printf("-----------------------------\n"); }


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

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

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

LLVM IR (-O2):
@str = [30 x i8] c"-----------------------------\00"
define void @printDivider() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret void
}
upper_case_str(char *s) {
  char *p;
  for (p = s; *p; p++) {
    if (*p >= 'a' && *p <= 'z')
      *p = *p - 'a' + 'A';
  }
}


x86 assembly (clang, -O0):
<upper_case_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1168 <upper_case_str+0x68>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     1152 <upper_case_str+0x52>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     1152 <upper_case_str+0x52>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
jmp    1157 <upper_case_str+0x57>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <upper_case_str+0x10>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<upper_case_str>:
mov    (%rdi),%al
test   %al,%al
je     112a <upper_case_str+0x2a>
add    $0x1,%rdi
jmp    111b <upper_case_str+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     112a <upper_case_str+0x2a>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1110 <upper_case_str+0x10>
add    $0xe0,%al
mov    %al,-0x1(%rdi)
jmp    1110 <upper_case_str+0x10>
ret

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

LLVM IR (-O2):
define i32 @upper_case_str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %13, %11 ], [ %2, %1 ]
%6 = phi i8* [ %12, %11 ], [ %0, %1 ]
%7 = add i8 %5, -97
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nsw i8 %5, -32
store i8 %10, i8* %6
br label %11
11: ; preds = %4, %9
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %11, %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test() { printf("hello\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define void @test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct msgbuf {
  int dummy;
};
struct ibuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ibuf_enqueue(struct msgbuf *, struct ibuf *);
void ibuf_close(struct msgbuf *msgbuf, struct ibuf *buf) {
  ibuf_enqueue(msgbuf, buf);
}


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

x86 assembly (clang, -O2):
<ibuf_close>:
jmp    1030 <ibuf_enqueue@plt>

LLVM IR (-O0):
%struct.msgbuf = type { i32 }
%struct.ibuf = type { i32 }
define void @ibuf_close(%struct.msgbuf* %0, %struct.ibuf* %1) {
%3 = alloca %struct.msgbuf*
%4 = alloca %struct.ibuf*
store %struct.msgbuf* %0, %struct.msgbuf** %3
store %struct.ibuf* %1, %struct.ibuf** %4
%5 = load %struct.msgbuf*, %struct.msgbuf** %3
%6 = load %struct.ibuf*, %struct.ibuf** %4
%7 = call i32 @ibuf_enqueue(%struct.msgbuf* %5, %struct.ibuf* %6)
ret void
}

LLVM IR (-O2):
%struct.msgbuf = type { i32 }
%struct.ibuf = type { i32 }
define void @ibuf_close(%struct.msgbuf* %0, %struct.ibuf* %1) {
%3 = tail call i32 @ibuf_enqueue(%struct.msgbuf* %0, %struct.ibuf* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void or_debug(char *msg) { fprintf(stderr, "ORDEBUG: %s\n", msg); }


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [13 x i8] c"ORDEBUG: %s\0A\00"
define void @or_debug(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"ORDEBUG: %s\0A\00"
define void @or_debug(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
char *eat_space_end(char const *, char const *);
int is_empty_end(const char *p, const char *pend) {
  p = eat_space_end(p, pend);
  return ((p < (pend)) && (*p == '\r' || *p == '\n'));
}


x86 assembly (clang, -O0):
<is_empty_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <eat_space_end@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x11(%rbp)
jae    116f <is_empty_end+0x5f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0x12(%rbp)
je     1169 <is_empty_end+0x59>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_empty_end>:
push   %rbx
mov    %rsi,%rbx
call   1030 <eat_space_end@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
jae    1137 <is_empty_end+0x27>
mov    (%rcx),%cl
mov    $0x1,%eax
cmp    $0xd,%cl
je     1137 <is_empty_end+0x27>
xor    %eax,%eax
cmp    $0xa,%cl
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_empty_end(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8* @eat_space_end(i8* %5, i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = icmp ult i8* %8, %9
br i1 %10, label %11, label %23
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 13
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 10
br label %21
21: ; preds = %16, %11
%22 = phi i1 [ true, %11 ], [ %20, %16 ]
br label %23
23: ; preds = %21, %2
%24 = phi i1 [ false, %2 ], [ %22, %21 ]
%25 = zext i1 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
define i32 @is_empty_end(i8* %0, i8* %1) {
%3 = tail call i8* @eat_space_end(i8* %0, i8* %1)
%4 = icmp ult i8* %3, %1
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i8, i8* %3
%7 = icmp eq i8 %6, 13
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = icmp eq i8 %6, 10
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %5, %8, %2
%12 = phi i32 [ 0, %2 ], [ 1, %5 ], [ %10, %8 ]
ret i32 %12
}
unsigned int
unsignedint_ignoring_unsignedlonglongint(unsigned int x,
                                         unsigned long long int y) {
  return x;
}


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

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

LLVM IR (-O0):
define i32 @unsignedint_ignoring_unsignedlonglongint(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
ret i32 %5
}

LLVM IR (-O2):
define i32 @unsignedint_ignoring_unsignedlonglongint(i32 returned %0, i64 %1) {
ret i32 %0
}
void replace_first_char(char *src, char *destination) {
  destination[0] = src[0];
}


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

x86 assembly (clang, -O2):
<replace_first_char>:
mov    (%rdi),%al
mov    %al,(%rsi)
ret

LLVM IR (-O0):
define void @replace_first_char(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
ret void
}

LLVM IR (-O2):
define void @replace_first_char(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
store i8 %3, i8* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, char *);
void usage(char **argv) {
  printf("%s prefilter_cmd file str\n%s str string\n", argv[0], argv[0]);
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [41 x i8] c"%s prefilter_cmd file str\0A%s str string\0A\00"
define void @usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = load i8**, i8*** %2
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %8)
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [41 x i8] c"%s prefilter_cmd file str\0A%s str string\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct intf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ RTM_DELADDR;
int /*<<< orphan*/ netlink_addr_do(int, int /*<<< orphan*/, struct intf *);
void netlink_addr_del(int nl, struct intf *intf) {
  netlink_addr_do(nl, RTM_DELADDR, intf);
}


x86 assembly (clang, -O0):
<netlink_addr_del>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <netlink_addr_do@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<netlink_addr_del>:
mov    %rsi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%esi
jmp    1030 <netlink_addr_do@plt>

LLVM IR (-O0):
%struct.intf = type { i32 }
@RTM_DELADDR = global i32 0
define void @netlink_addr_del(i32 %0, %struct.intf* %1) {
%3 = alloca i32
%4 = alloca %struct.intf*
store i32 %0, i32* %3
store %struct.intf* %1, %struct.intf** %4
%5 = load i32, i32* %3
%6 = load i32, i32* @RTM_DELADDR
%7 = load %struct.intf*, %struct.intf** %4
%8 = call i32 @netlink_addr_do(i32 %5, i32 %6, %struct.intf* %7)
ret void
}

LLVM IR (-O2):
%struct.intf = type { i32 }
@RTM_DELADDR = global i32 0
define void @netlink_addr_del(i32 %0, %struct.intf* %1) {
%3 = load i32, i32* @RTM_DELADDR
%4 = tail call i32 @netlink_addr_do(i32 %0, i32 %3, %struct.intf* %1)
ret void
}