xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void internal(char *s) {
  fprintf(stderr, "Internal error: %s\n", s);
  exit(2);
}


x86 assembly (clang, -O0):
<internal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<internal>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Internal error: %s\0A\00"
define void @internal(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 ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Internal error: %s\0A\00"
define void @internal(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 2)
unreachable
}
int png_mmx_support(void) { return -1; }


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

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

LLVM IR (-O0):
define i32 @png_mmx_support() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @png_mmx_support() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ foo(int /*<<< orphan*/);
__attribute__((no, noclone)) unsigned int f1(unsigned int x, unsigned int y) {
  unsigned int r = x - y;
  if (r >= x)
    foo(0);
  return r;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jb     113a <f1+0x2a>
xor    %edi,%edi
call   1030 <foo@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rbx
mov    %edi,%ebx
sub    %esi,%ebx
cmp    %edi,%ebx
jb     1120 <f1+0x10>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @f1(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* %4
%8 = sub i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = icmp uge i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @foo(i32 0)
br label %14
14: ; preds = %12, %2
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
define i32 @f1(i32 %0, i32 %1) {
%3 = sub i32 %0, %1
%4 = icmp ult i32 %3, %0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @foo(i32 0)
br label %7
7: ; preds = %5, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void necro_announce_phase(const char *phase_name) {
  printf("\n");
  printf("--------------------------------\n");
  printf("-- %s\n", phase_name);
  printf("--------------------------------\n");
}


x86 assembly (clang, -O0):
<necro_announce_phase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xefd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<necro_announce_phase>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xebf(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <puts@plt>

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

LLVM IR (-O2):
@.str.2 = [7 x i8] c"-- %s\0A\00"
@str.3 = [33 x i8] c"--------------------------------\00"
define void @necro_announce_phase(i8* %0) {
%2 = tail call i32 @putchar(i32 10)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
ret void
}
float Q_rsqrt(float x) {
  float xhalf = 0.5f * x;
  int i = *(int *)&x;
  i = 0x5f3759df - (i >> 1);
  x = *(float *)&i;
  x = x * (1.5f - xhalf * x * x);
  x = x * (1.5f - xhalf * x * x);
  return x;
}


x86 assembly (clang, -O0):
<Q_rsqrt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef3(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x1,%ecx
mov    $0x5f3759df,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe98(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe5e(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_rsqrt>:
movd   %xmm0,%eax
sar    %eax
mov    $0x5f3759df,%ecx
sub    %eax,%ecx
movd   %ecx,%xmm1
mulss  0xee7(%rip),%xmm0
movaps %xmm0,%xmm2
mulss  %xmm1,%xmm2
mulss  %xmm1,%xmm2
movss  0xed8(%rip),%xmm3
addss  %xmm3,%xmm2
mulss  %xmm1,%xmm2
mulss  %xmm2,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm3,%xmm0
mulss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @Q_rsqrt(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store float %0, float* %2
%5 = load float, float* %2
%6 = fmul float 5.000000e-01, %5
store float %6, float* %3
%7 = bitcast float* %2 to i32*
%8 = load i32, i32* %7
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = ashr i32 %9, 1
%11 = sub nsw i32 1597463007, %10
store i32 %11, i32* %4
%12 = bitcast i32* %4 to float*
%13 = load float, float* %12
store float %13, float* %2
%14 = load float, float* %2
%15 = load float, float* %3
%16 = load float, float* %2
%17 = fmul float %15, %16
%18 = load float, float* %2
%19 = fneg float %17
%20 = call float @llvm.fmuladd.f32(float %19, float %18, float 1.500000e+00)
%21 = fmul float %14, %20
store float %21, float* %2
%22 = load float, float* %2
%23 = load float, float* %3
%24 = load float, float* %2
%25 = fmul float %23, %24
%26 = load float, float* %2
%27 = fneg float %25
%28 = call float @llvm.fmuladd.f32(float %27, float %26, float 1.500000e+00)
%29 = fmul float %22, %28
store float %29, float* %2
%30 = load float, float* %2
ret float %30
}

LLVM IR (-O2):
define float @Q_rsqrt(float %0) {
%2 = bitcast float %0 to i32
%3 = ashr i32 %2, 1
%4 = sub nsw i32 1597463007, %3
%5 = bitcast i32 %4 to float
%6 = fmul float %0, -5.000000e-01
%7 = fmul float %6, %5
%8 = tail call float @llvm.fmuladd.f32(float %7, float %5, float 1.500000e+00)
%9 = fmul float %8, %5
%10 = fmul float %6, %9
%11 = tail call float @llvm.fmuladd.f32(float %10, float %9, float 1.500000e+00)
%12 = fmul float %9, %11
ret float %12
}
/* Type definitions */
struct timex {
  int freq;
  int /*<<< orphan*/ modes;
};

/* Variables and functions */
int /*<<< orphan*/ ADJ_FREQUENCY;
scalar_t__ __adjtimex(struct timex *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int set_freq(int new_freq) {
  struct timex txc;
  txc.modes = ADJ_FREQUENCY;
  txc.freq = new_freq;
  if (__adjtimex(&txc) < 0) {
    perror("adjtimex");
    exit(1);
  }
  return txc.freq;
}


x86 assembly (clang, -O0):
<set_freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <__adjtimex@plt>
cmp    $0x0,%rax
jge    1176 <set_freq+0x46>
lea    0xe99(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_freq>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %edi,(%rsp)
mov    %rsp,%rdi
call   1030 <__adjtimex@plt>
test   %rax,%rax
js     1153 <set_freq+0x23>
mov    (%rsp),%eax
pop    %rcx
ret
lea    0xea6(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.timex = type { i32, i32 }
@ADJ_FREQUENCY = global i32 0
@.str = [9 x i8] c"adjtimex\00"
define i32 @set_freq(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timex
store i32 %0, i32* %2
%4 = load i32, i32* @ADJ_FREQUENCY
%5 = getelementptr inbounds %struct.timex, %struct.timex* %3, i32 0, i32 1
store i32 %4, i32* %5
%6 = load i32, i32* %2
%7 = getelementptr inbounds %struct.timex, %struct.timex* %3, i32 0, i32 0
store i32 %6, i32* %7
%8 = call i64 @__adjtimex(%struct.timex* %3)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
%14 = getelementptr inbounds %struct.timex, %struct.timex* %3, i32 0, i32 0
%15 = load i32, i32* %14
ret i32 %15
}

LLVM IR (-O2):
%struct.timex = type { i32, i32 }
@ADJ_FREQUENCY = global i32 0
@.str = [9 x i8] c"adjtimex\00"
define i32 @set_freq(i32 %0) {
%2 = alloca %struct.timex
%3 = bitcast %struct.timex* %2 to i8*
%4 = load i32, i32* @ADJ_FREQUENCY
%5 = getelementptr inbounds %struct.timex, %struct.timex* %2, i64 0, i32 1
store i32 %4, i32* %5
%6 = getelementptr inbounds %struct.timex, %struct.timex* %2, i64 0, i32 0
store i32 %0, i32* %6
%7 = call i64 @__adjtimex(%struct.timex* %2)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i32, i32* %6
ret i32 %13
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int64_t smod64(int64_t a, int64_t b) {
  int64_t r;
  if (b == 0) {
    fprintf(stderr, "Should not happen\n");
    exit(EXIT_FAILURE);
  }
  r = a % b;
  return r;
}


x86 assembly (clang, -O0):
<smod64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    115b <smod64+0x3b>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smod64>:
test   %esi,%esi
je     112c <smod64+0xc>
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret
push   %rax
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Should not happen\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @smod64(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 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = srem i32 %14, %15
store i32 %16, i32* %5
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Should not happen\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @smod64(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = srem i32 %0, %1
ret i32 %10
}
void unsigned_char_rem_signed_char_unsigned_char(unsigned char *LHS,
                                                 unsigned char RHS) {
  (*LHS) %= RHS;
}


x86 assembly (clang, -O0):
<unsigned_char_rem_signed_char_unsigned_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movzbl (%rax),%eax
cltd
idiv   %ecx
mov    -0x18(%rbp),%rax
mov    %dl,%cl
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsigned_char_rem_signed_char_unsigned_char>:
movzbl (%rdi),%eax
div    %sil
movzbl %ah,%eax
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @unsigned_char_rem_signed_char_unsigned_char(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = srem i32 %9, %6
%11 = trunc i32 %10 to i8
store i8 %11, i8* %7
ret void
}

LLVM IR (-O2):
define void @unsigned_char_rem_signed_char_unsigned_char(i8* nocapture %0, i8 zeroext %1) {
%3 = load i8, i8* %0
%4 = urem i8 %3, %1
store i8 %4, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int pthread_attr_setinheritsched(pthread_attr_t *a, int b) { assert(0); }


x86 assembly (clang, -O0):
<pthread_attr_setinheritsched>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @pthread_attr_setinheritsched(i32* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @assert(i32 0)
ret i32 undef
}
double comb_trap(double h, double f0, double f1) { return h * (f0 + f1); }


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

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

LLVM IR (-O0):
define double @comb_trap(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fadd double %8, %9
%11 = fmul double %7, %10
ret double %11
}

LLVM IR (-O2):
define double @comb_trap(double %0, double %1, double %2) {
%4 = fadd double %1, %2
%5 = fmul double %4, %0
ret double %5
}
/* Variables and functions */
double floor(double);
double round(double x) { return (x >= 0. ? floor(x + .5) : floor(x - .5)); }


x86 assembly (clang, -O0):
<round>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     114b <round+0x3b>
movsd  0xec9(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1030 <floor@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    1166 <round+0x56>
movsd  -0x8(%rbp),%xmm0
movsd  0xea8(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1030 <floor@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setb   %al
lea    0xedc(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
jmp    1030 <floor@plt>

LLVM IR (-O0):
define double @round(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oge double %3, 0.000000e+00
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load double, double* %2
%7 = fadd double %6, 5.000000e-01
%8 = call double @llvm.floor.f64(double %7)
br label %13
9: ; preds = %1
%10 = load double, double* %2
%11 = fsub double %10, 5.000000e-01
%12 = call double @llvm.floor.f64(double %11)
br label %13
13: ; preds = %9, %5
%14 = phi double [ %8, %5 ], [ %12, %9 ]
ret double %14
}

LLVM IR (-O2):
define double @round(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = select i1 %2, double -5.000000e-01, double 5.000000e-01
%4 = fadd double %3, %0
%5 = tail call double @llvm.floor.f64(double %4)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ llib_rnd_srand(int /*<<< orphan*/, unsigned char *, int);
__attribute__((unused)) void srand(unsigned int seed) {
  llib_rnd_srand(0, (unsigned char *)&seed, sizeof(unsigned int));
}


x86 assembly (clang, -O0):
<srand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rsi
xor    %edi,%edi
mov    $0x4,%edx
call   1030 <llib_rnd_srand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srand>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
xor    %edi,%edi
mov    $0x4,%edx
call   1030 <llib_rnd_srand@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @srand(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = bitcast i32* %2 to i8*
%4 = call i32 @llib_rnd_srand(i32 0, i8* %3, i32 4)
ret void
}

LLVM IR (-O2):
define void @srand(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = bitcast i32* %2 to i8*
%4 = call i32 @llib_rnd_srand(i32 0, i8* %3, i32 4)
ret void
}
/* Variables and functions */
unsigned short si475xAMRX_get_frequency();
unsigned short si47xxAMRX_get_frequency(void) {
  return si475xAMRX_get_frequency();
}


x86 assembly (clang, -O0):
<si47xxAMRX_get_frequency>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <si475xAMRX_get_frequency@plt>
movzwl %ax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @si47xxAMRX_get_frequency() {
%1 = call zeroext i16 (...) @si475xAMRX_get_frequency()
ret i16 %1
}

LLVM IR (-O2):
define zeroext i16 @si47xxAMRX_get_frequency() {
%1 = tail call zeroext i16 (...) @si475xAMRX_get_frequency()
ret i16 %1
}
int fn1(int i) { return i == (-1 << 8); }


x86 assembly (clang, -O0):
<fn1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffff00,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn1>:
xor    %eax,%eax
cmp    $0xffffff00,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @fn1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, -256
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @fn1(i32 %0) {
%2 = icmp eq i32 %0, -256
%3 = zext i1 %2 to i32
ret i32 %3
}
void element2ONEBYTE() {}


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

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

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

LLVM IR (-O2):
define void @element2ONEBYTE() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_sort(int);
int main() {
  int i = 0;
  for (i = 16; i <= 1024 * 1024; i *= 2) {
    test_sort(i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x10,-0x8(%rbp)
cmpl   $0x100000,-0x8(%rbp)
jg     1150 <main+0x40>
mov    -0x8(%rbp),%edi
call   1030 <test_sort@plt>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x10,%edi
call   1030 <test_sort@plt>
mov    $0x20,%edi
call   1030 <test_sort@plt>
mov    $0x40,%edi
call   1030 <test_sort@plt>
mov    $0x80,%edi
call   1030 <test_sort@plt>
mov    $0x100,%edi
call   1030 <test_sort@plt>
mov    $0x200,%edi
call   1030 <test_sort@plt>
mov    $0x400,%edi
call   1030 <test_sort@plt>
mov    $0x800,%edi
call   1030 <test_sort@plt>
mov    $0x1000,%edi
call   1030 <test_sort@plt>
mov    $0x2000,%edi
call   1030 <test_sort@plt>
mov    $0x4000,%edi
call   1030 <test_sort@plt>
mov    $0x8000,%edi
call   1030 <test_sort@plt>
mov    $0x10000,%edi
call   1030 <test_sort@plt>
mov    $0x20000,%edi
call   1030 <test_sort@plt>
mov    $0x40000,%edi
call   1030 <test_sort@plt>
mov    $0x80000,%edi
call   1030 <test_sort@plt>
mov    $0x100000,%edi
call   1030 <test_sort@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 16, i32* %2
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 1048576
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @test_sort(i32 %7)
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = mul nsw i32 %10, 2
store i32 %11, i32* %2
br label %3
12: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_sort(i32 16)
%2 = tail call i32 @test_sort(i32 32)
%3 = tail call i32 @test_sort(i32 64)
%4 = tail call i32 @test_sort(i32 128)
%5 = tail call i32 @test_sort(i32 256)
%6 = tail call i32 @test_sort(i32 512)
%7 = tail call i32 @test_sort(i32 1024)
%8 = tail call i32 @test_sort(i32 2048)
%9 = tail call i32 @test_sort(i32 4096)
%10 = tail call i32 @test_sort(i32 8192)
%11 = tail call i32 @test_sort(i32 16384)
%12 = tail call i32 @test_sort(i32 32768)
%13 = tail call i32 @test_sort(i32 65536)
%14 = tail call i32 @test_sort(i32 131072)
%15 = tail call i32 @test_sort(i32 262144)
%16 = tail call i32 @test_sort(i32 524288)
%17 = tail call i32 @test_sort(i32 1048576)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *float_format(float);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, float);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
void float_print(FILE *pFile, float aFloat, char cDelim) {
  fprintf(pFile, float_format(aFloat), aFloat);
  putc(cDelim, pFile);
}


x86 assembly (clang, -O0):
<float_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <float_format@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
movss  -0xc(%rbp),%xmm0
call   1050 <fprintf@plt>
mov    -0xd(%rbp),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1040 <putc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_print>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
movss  %xmm0,0x4(%rsp)
mov    %rdi,%rbx
call   1030 <float_format@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
movss  0x4(%rsp),%xmm0
call   1050 <fprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <putc@plt>

LLVM IR (-O0):
define void @float_print(i32* %0, float %1, i8 signext %2) {
%4 = alloca i32*
%5 = alloca float
%6 = alloca i8
store i32* %0, i32** %4
store float %1, float* %5
store i8 %2, i8* %6
%7 = load i32*, i32** %4
%8 = load float, float* %5
%9 = call i8* @float_format(float %8)
%10 = load float, float* %5
%11 = call i32 @fprintf(i32* %7, i8* %9, float %10)
%12 = load i8, i8* %6
%13 = load i32*, i32** %4
%14 = call i32 @putc(i8 signext %12, i32* %13)
ret void
}

LLVM IR (-O2):
define void @float_print(i32* nocapture %0, float %1, i8 signext %2) {
%4 = tail call i8* @float_format(float %1)
%5 = tail call i32 @fprintf(i32* %0, i8* %4, float %1)
%6 = tail call i32 @putc(i8 signext %2, i32* %0)
ret void
}
int test_imm_32int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x32 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_32int64_highword_mem>:
testb  $0x32,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_32int64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 32
%6 = and i64 %5, 50
%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_32int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 214748364800
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void gtk_window_present() {}


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

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

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

LLVM IR (-O2):
define void @gtk_window_present() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ client_ending();
void database_close(void) { client_ending(); }


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

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

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

LLVM IR (-O2):
define void @database_close() {
%1 = tail call i32 (...) @client_ending()
ret void
}
/* Variables and functions */
int intel_ich_gpio_set(int, int);
int board_acorp_6a815epd(void) {
  int ret;
  ret = intel_ich_gpio_set(22, 1);
  if (!ret)
    ret = intel_ich_gpio_set(23, 1);
  return ret;
}


x86 assembly (clang, -O0):
<board_acorp_6a815epd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x16,%edi
mov    $0x1,%esi
call   1030 <intel_ich_gpio_set@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1146 <board_acorp_6a815epd+0x36>
mov    $0x17,%edi
mov    $0x1,%esi
call   1030 <intel_ich_gpio_set@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<board_acorp_6a815epd>:
push   %rax
mov    $0x16,%edi
mov    $0x1,%esi
call   1030 <intel_ich_gpio_set@plt>
test   %eax,%eax
je     1126 <board_acorp_6a815epd+0x16>
pop    %rcx
ret
mov    $0x17,%edi
mov    $0x1,%esi
pop    %rax
jmp    1030 <intel_ich_gpio_set@plt>

LLVM IR (-O0):
define i32 @board_acorp_6a815epd() {
%1 = alloca i32
%2 = call i32 @intel_ich_gpio_set(i32 22, i32 1)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @intel_ich_gpio_set(i32 23, i32 1)
store i32 %6, i32* %1
br label %7
7: ; preds = %5, %0
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
define i32 @board_acorp_6a815epd() {
%1 = tail call i32 @intel_ich_gpio_set(i32 22, i32 1)
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @intel_ich_gpio_set(i32 23, i32 1)
br label %5
5: ; preds = %3, %0
%6 = phi i32 [ %1, %0 ], [ %4, %3 ]
ret i32 %6
}
void _xpush() {
  __asm__ __volatile__(".byte 0x0f\n\t.byte 0x24\n\t" : : : "memory", "cc");
}


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

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

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

LLVM IR (-O2):
define void @_xpush() {
tail call void asm sideeffect ".byte 0x0f\0A\09.byte 0x24\0A\09", "~{memory},~{cc},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int compare(const void *a, const void *b) {
  int va = *(const unsigned long *)a;
  int vb = *(const unsigned long *)b;
  return (va > vb) - (va < vb);
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x14(%rbp),%ecx
cmp    -0x18(%rbp),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%ecx
xor    %eax,%eax
xor    %edx,%edx
cmp    (%rsi),%ecx
setg   %al
setl   %dl
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
store i32 %10, i32* %5
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i64*
%13 = load i64, i64* %12
%14 = trunc i64 %13 to i32
store i32 %14, i32* %6
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = icmp sgt i32 %15, %16
%18 = zext i1 %17 to i32
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
%22 = zext i1 %21 to i32
%23 = sub nsw i32 %18, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = trunc i64 %4 to i32
%6 = bitcast i8* %1 to i64*
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = icmp sgt i32 %5, %8
%10 = zext i1 %9 to i32
%11 = icmp slt i32 %5, %8
%12 = sext i1 %11 to i32
%13 = add nsw i32 %12, %10
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int aging(int8_t **page_table, int num_pages, int prev_page, int fifo_frm,
          int num_frames, int clock) {
  return -1;
}


x86 assembly (clang, -O0):
<aging>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @aging(i32** nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
ret i32 -1
}
int vfs_doniks() { return -1; }


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

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

LLVM IR (-O0):
define i32 @vfs_doniks() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @vfs_doniks() {
ret i32 -1
}
int add(int x, int y) {
  int z;
  z = x + y;
  return z;
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @add(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* %4
%8 = add nsw i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
char *do_big_dnum(double, int, int);
char *human_dnum(double dnum, int decimal_digits) {
  extern int human_readable;
  return do_big_dnum(dnum, human_readable, decimal_digits);
}


x86 assembly (clang, -O0):
<human_dnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%esi
call   1030 <do_big_dnum@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<human_dnum>:
mov    %edi,%esi
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
jmp    1030 <do_big_dnum@plt>

LLVM IR (-O0):
@human_readable = external global i32
define i8* @human_dnum(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load double, double* %3
%6 = load i32, i32* @human_readable
%7 = load i32, i32* %4
%8 = call i8* @do_big_dnum(double %5, i32 %6, i32 %7)
ret i8* %8
}

LLVM IR (-O2):
@human_readable = external global i32
define i8* @human_dnum(double %0, i32 %1) {
%3 = load i32, i32* @human_readable
%4 = tail call i8* @do_big_dnum(double %0, i32 %3, i32 %1)
ret i8* %4
}
void bind_x(const double *x) { ; }


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

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

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

LLVM IR (-O2):
define void @bind_x(double* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ elementRepeatedOddTimes(int *, int);
int main() {
  int input[] = {4, 7, 2, 2, 5, 3, 5, 7, 7, 3, 4, 5};
  elementRepeatedOddTimes(input, 12);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xc,%esi
call   1030 <elementRepeatedOddTimes@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xc,%esi
call   1030 <elementRepeatedOddTimes@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.input = [12 x i32] [i32 4, i32 7, i32 2, i32 2, i32 5, i32 3, i32 5, i32 7, i32 7, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca [12 x i32]
%2 = bitcast [12 x i32]* %1 to i8*
%3 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 0
%4 = call i32 @elementRepeatedOddTimes(i32* %3, i32 12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.input = [12 x i32] [i32 4, i32 7, i32 2, i32 2, i32 5, i32 3, i32 5, i32 7, i32 7, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca [12 x i32]
%2 = bitcast [12 x i32]* %1 to i8*
%3 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 0
%4 = call i32 @elementRepeatedOddTimes(i32* %3, i32 12)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, double);
void mcparmprinter_double(char *f, void *vptr) {
  double *v = (double *)vptr;
  sprintf(f, "%g", *v);
}


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

x86 assembly (clang, -O2):
<mcparmprinter_double>:
movsd  (%rsi),%xmm0
lea    0xee5(%rip),%rsi
jmp    1030 <sprintf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%g\00"
define void @mcparmprinter_double(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to double*
%4 = load double, double* %3
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void stack_print_element(int *x) { printf("%d\n", *x); }


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

x86 assembly (clang, -O2):
<stack_print_element>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @stack_print_element(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() { puts("Hello!\n"); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Hello!\0A\00"
define i32 @main() {
%1 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"Hello!\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
unsigned gcd(unsigned m, unsigned n) {
  unsigned r;
  if (m == 0)
    return 0;
  if (n == 0)
    return 0;
  while (1) {
    r = m % n;
    if (r == 0)
      break;
    m = n;
    n = r;
  }
  return n;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1120 <gcd+0x20>
movl   $0x0,-0x4(%rbp)
jmp    116c <gcd+0x6c>
cmpl   $0x0,-0xc(%rbp)
jne    1136 <gcd+0x36>
movl   $0x0,-0x4(%rbp)
jmp    116c <gcd+0x6c>
jmp    113b <gcd+0x3b>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1155 <gcd+0x55>
jmp    1166 <gcd+0x66>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    113b <gcd+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
xor    %ecx,%ecx
test   %edi,%edi
je     111c <gcd+0x1c>
mov    %esi,%edx
test   %esi,%esi
je     111c <gcd+0x1c>
mov    %edi,%eax
xchg   %ax,%ax
mov    %edx,%ecx
xor    %edx,%edx
div    %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = icmp eq i32 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %11, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %8, %6 ], [ %0, %2 ]
%8 = phi i32 [ %9, %6 ], [ %1, %2 ]
%9 = urem i32 %7, %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %2
%12 = phi i32 [ 0, %2 ], [ %8, %6 ]
ret i32 %12
}
void foo333() {}


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

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

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

LLVM IR (-O2):
define void @foo333() {
ret void
}
/* Variables and functions */
int ceil(double);
void ceil_w_d(double *source, int *dest) { *dest = ceil(*source); }


x86 assembly (clang, -O0):
<ceil_w_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <ceil@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil_w_d>:
push   %rbx
mov    %rsi,%rbx
movsd  (%rdi),%xmm0
call   1030 <ceil@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ceil_w_d(double* nocapture %0, i32* nocapture writeonly %1) {
%3 = load double, double* %0
%4 = tail call i32 @ceil(double %3)
store i32 %4, i32* %1
ret void
}
/* Variables and functions */
unsigned int _user_numusers_get();
unsigned int _user_numusers_set(unsigned int);
unsigned int _user_numusers_inc() {
  unsigned int numusers;
  numusers = _user_numusers_get();
  numusers++;
  return _user_numusers_set(numusers);
}


x86 assembly (clang, -O0):
<_user_numusers_inc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <_user_numusers_get@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_user_numusers_set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_user_numusers_inc>:
push   %rax
xor    %eax,%eax
call   1040 <_user_numusers_get@plt>
lea    0x1(%rax),%edi
pop    %rax
jmp    1030 <_user_numusers_set@plt>

LLVM IR (-O0):
define i32 @_user_numusers_inc() {
%1 = alloca i32
%2 = call i32 (...) @_user_numusers_get()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = add i32 %3, 1
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @_user_numusers_set(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @_user_numusers_inc() {
%1 = tail call i32 (...) @_user_numusers_get()
%2 = add i32 %1, 1
%3 = tail call i32 @_user_numusers_set(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ prep_binary(char *);
int /*<<< orphan*/ run();
int main(int argc, const char *argv[]) {
  prep_binary("./test.yex");
  int j = 0;
  run();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <prep_binary@plt>
xor    %eax,%eax
call   1040 <run@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"./test.yex\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @prep_binary(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
%8 = call i32 (...) @run()
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"./test.yex\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @prep_binary(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @run()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: "
                  "luac [-c | -u] [-D name] [-d] [-l] [-o output] [-O] [-p] "
                  "[-q] [-v] [-V] [files]\n"
                  " -c\tcompile (default)\n"
                  " -u\tundump\n"
                  " -d\tgenerate debugging information\n"
                  " -D\tpredefine symbol for conditional compilation\n"
                  " -l\tlist (default for -u)\n"
                  " -o\toutput file for -c (default is \""
                  "luac.out"
                  "\")\n"
                  " -O\toptimize\n"
                  " -p\tparse only\n"
                  " -q\tquiet (default for -c)\n"
                  " -v\tshow version information\n"
                  " -V\tverbose\n"
                  " -\tcompile \"stdin\"\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 = [393 x i8] c"usage: luac [-c | -u] [-D name] [-d] [-l] [-o output] [-O] [-p] [-q] [-v] [-V] [files]\0A -c\09compile (default)\0A -u\09undump\0A -d\09generate debugging information\0A -D\09predefine symbol for conditional compilation\0A -l\09list (default for -u)\0A -o\09output file for -c (default is \22luac.out\22)\0A -O\09optimize\0A -p\09parse only\0A -q\09quiet (default for -c)\0A -v\09show version information\0A -V\09verbose\0A -\09compile \22stdin\22\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([393 x i8], [393 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [393 x i8] c"usage: luac [-c | -u] [-D name] [-d] [-l] [-o output] [-O] [-p] [-q] [-v] [-V] [files]\0A -c\09compile (default)\0A -u\09undump\0A -d\09generate debugging information\0A -D\09predefine symbol for conditional compilation\0A -l\09list (default for -u)\0A -o\09output file for -c (default is \22luac.out\22)\0A -O\09optimize\0A -p\09parse only\0A -q\09quiet (default for -c)\0A -v\09show version information\0A -V\09verbose\0A -\09compile \22stdin\22\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([393 x i8], [393 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}