xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ mpz_pow_ui(int /*<<< orphan*/, int /*<<< orphan*/,
                              unsigned long);
void gmpint_powui(mpz_t *rop, mpz_t *op, unsigned long exp) {
  mpz_pow_ui(*rop, *op, exp);
}


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

x86 assembly (clang, -O2):
<gmpint_powui>:
mov    (%rdi),%edi
mov    (%rsi),%esi
jmp    1030 <mpz_pow_ui@plt>

LLVM IR (-O0):
define void @gmpint_powui(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = load i64, i64* %6
%12 = call i32 @mpz_pow_ui(i32 %8, i32 %10, i64 %11)
ret void
}

LLVM IR (-O2):
define void @gmpint_powui(i32* nocapture %0, i32* nocapture %1, i64 %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %1
%6 = tail call i32 @mpz_pow_ui(i32 %4, i32 %5, i64 %2)
ret void
}
int ifunc12(int a, int b) { return a + b + 2; }


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

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

LLVM IR (-O0):
define i32 @ifunc12(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
%8 = add nsw i32 %7, 2
ret i32 %8
}

LLVM IR (-O2):
define i32 @ifunc12(i32 %0, i32 %1) {
%3 = add i32 %0, 2
%4 = add i32 %3, %1
ret i32 %4
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ writememl(scalar_t__, scalar_t__, int);
void writememq(uint32_t s, uint32_t a, uint64_t v) {
  writememl(s, a, v & 0xffffffff);
  writememl(s, a + 4, v >> 32);
}


x86 assembly (clang, -O0):
<writememq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
and    $0xffffffff,%edx
call   1030 <writememl@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
mov    -0x14(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
call   1030 <writememl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writememq>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <writememl@plt>
add    $0x4,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <writememl@plt>

LLVM IR (-O0):
define void @writememq(i64 %0, i64 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i64 %0, i64* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = load i32, i32* %6
%10 = and i32 %9, -1
%11 = call i32 @writememl(i64 %7, i64 %8, i32 %10)
%12 = load i64, i64* %4
%13 = load i64, i64* %5
%14 = add nsw i64 %13, 4
%15 = load i32, i32* %6
%16 = ashr i32 %15, 32
%17 = call i32 @writememl(i64 %12, i64 %14, i32 %16)
ret void
}

LLVM IR (-O2):
define void @writememq(i64 %0, i64 %1, i32 %2) {
%4 = tail call i32 @writememl(i64 %0, i64 %1, i32 %2)
%5 = add nsw i64 %1, 4
%6 = tail call i32 @writememl(i64 %0, i64 %5, i32 poison)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glClearColor(float, float, float, double);
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ gluOrtho2D(double, double, double, double);
void init2D(float r, float g, float b) {
  glClearColor(r, g, b, 0.0);
  glMatrixMode(GL_PROJECTION);
  gluOrtho2D(0.0, 1000.0, 0.0, 1000.0);
}


x86 assembly (clang, -O0):
<init2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
xorps  %xmm3,%xmm3
call   1040 <glClearColor@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xorps  %xmm2,%xmm2
movsd  0xe89(%rip),%xmm3
movaps %xmm2,%xmm0
movaps %xmm3,%xmm1
call   1050 <gluOrtho2D@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init2D>:
push   %rax
xorps  %xmm3,%xmm3
call   1040 <glClearColor@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
movsd  0xeb1(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
movaps %xmm1,%xmm3
pop    %rax
jmp    1050 <gluOrtho2D@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
define void @init2D(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %6
%10 = call i32 @glClearColor(float %7, float %8, float %9, double 0.000000e+00)
%11 = load i32, i32* @GL_PROJECTION
%12 = call i32 @glMatrixMode(i32 %11)
%13 = call i32 @gluOrtho2D(double 0.000000e+00, double 1.000000e+03, double 0.000000e+00, double 1.000000e+03)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
define void @init2D(float %0, float %1, float %2) {
%4 = tail call i32 @glClearColor(float %0, float %1, float %2, double 0.000000e+00)
%5 = load i32, i32* @GL_PROJECTION
%6 = tail call i32 @glMatrixMode(i32 %5)
%7 = tail call i32 @gluOrtho2D(double 0.000000e+00, double 1.000000e+03, double 0.000000e+00, double 1.000000e+03)
ret void
}
/* Variables and functions */
int ap_do_command_only(int, int);
int ap_play(int session) { return (ap_do_command_only(session, 0xcc00)); }


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

x86 assembly (clang, -O2):
<ap_play>:
mov    $0xcc00,%esi
jmp    1030 <ap_do_command_only@plt>

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

LLVM IR (-O2):
define i32 @ap_play(i32 %0) {
%2 = tail call i32 @ap_do_command_only(i32 %0, i32 52224)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ gnss_disable_irq(int);
void noInterrupts(void) {
  gnss_disable_irq(6);
  gnss_disable_irq(7);
  gnss_disable_irq(5);
  gnss_disable_irq(14);
}


x86 assembly (clang, -O0):
<noInterrupts>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
call   1030 <gnss_disable_irq@plt>
mov    $0x7,%edi
call   1030 <gnss_disable_irq@plt>
mov    $0x5,%edi
call   1030 <gnss_disable_irq@plt>
mov    $0xe,%edi
call   1030 <gnss_disable_irq@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<noInterrupts>:
push   %rax
mov    $0x6,%edi
call   1030 <gnss_disable_irq@plt>
mov    $0x7,%edi
call   1030 <gnss_disable_irq@plt>
mov    $0x5,%edi
call   1030 <gnss_disable_irq@plt>
mov    $0xe,%edi
pop    %rax
jmp    1030 <gnss_disable_irq@plt>

LLVM IR (-O0):
define void @noInterrupts() {
%1 = call i32 @gnss_disable_irq(i32 6)
%2 = call i32 @gnss_disable_irq(i32 7)
%3 = call i32 @gnss_disable_irq(i32 5)
%4 = call i32 @gnss_disable_irq(i32 14)
ret void
}

LLVM IR (-O2):
define void @noInterrupts() {
%1 = tail call i32 @gnss_disable_irq(i32 6)
%2 = tail call i32 @gnss_disable_irq(i32 7)
%3 = tail call i32 @gnss_disable_irq(i32 5)
%4 = tail call i32 @gnss_disable_irq(i32 14)
ret void
}
double modsq(double *a) {
  double ans;
  ans = a[1] * a[1] + a[2] * a[2] + a[3] * a[3];
  return ans;
}


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

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

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

LLVM IR (-O2):
define double @modsq(double* nocapture %0) {
%2 = getelementptr inbounds double, double* %0, i64 1
%3 = load double, double* %2
%4 = getelementptr inbounds double, double* %0, i64 2
%5 = load double, double* %4
%6 = fmul double %5, %5
%7 = tail call double @llvm.fmuladd.f64(double %3, double %3, double %6)
%8 = getelementptr inbounds double, double* %0, i64 3
%9 = load double, double* %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %7)
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ *getexpr(char *, unsigned int *);
int resolve_abs(char *a) {
  static unsigned int tmp;
  if (getexpr(a, &tmp) == NULL) {
    ;
    return 0x0100;
  }
  if (tmp > 0xff) {
    ;
    return 0x0100;
  } else {
    return tmp;
  }
}


x86 assembly (clang, -O0):
<resolve_abs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0x2f05(%rip),%rsi
call   1030 <getexpr@plt>
cmp    $0x0,%rax
jne    1142 <resolve_abs+0x32>
movl   $0x100,-0x4(%rbp)
jmp    1167 <resolve_abs+0x57>
cmpl   $0xff,0x2ee0(%rip)
jbe    115e <resolve_abs+0x4e>
movl   $0x100,-0x4(%rbp)
jmp    1167 <resolve_abs+0x57>
mov    0x2ec8(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resolve_abs>:
push   %rax
lea    0x2f14(%rip),%rsi
call   1030 <getexpr@plt>
mov    0x2f09(%rip),%ecx
cmp    $0x100,%ecx
mov    $0x100,%edx
cmovae %edx,%ecx
test   %rax,%rax
cmove  %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@resolve_abs.tmp = internal global i32 0
define i32 @resolve_abs(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32* @getexpr(i8* %4, i32* @resolve_abs.tmp)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 256, i32* %2
br label %14
8: ; preds = %1
%9 = load i32, i32* @resolve_abs.tmp
%10 = icmp ugt i32 %9, 255
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 256, i32* %2
br label %14
12: ; preds = %8
%13 = load i32, i32* @resolve_abs.tmp
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %11, %7
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@resolve_abs.tmp = internal global i32 0
define i32 @resolve_abs(i8* %0) {
%2 = tail call i32* @getexpr(i8* %0, i32* @resolve_abs.tmp)
%3 = icmp eq i32* %2, null
%4 = load i32, i32* @resolve_abs.tmp
%5 = icmp ult i32 %4, 256
%6 = select i1 %5, i32 %4, i32 256
%7 = select i1 %3, i32 256, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ handle_EMT(int /*<<< orphan*/);
int gen_EMT() { handle_EMT(0); }


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

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

LLVM IR (-O0):
define i32 @gen_EMT() {
%1 = alloca i32
%2 = call i32 @handle_EMT(i32 0)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @gen_EMT() {
%1 = tail call i32 @handle_EMT(i32 0)
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int EINVAL;
int /*<<< orphan*/ INT_MAX;
int vsnprintf(char *, int /*<<< orphan*/, char const *, int /*<<< orphan*/);
int vsprintf(char *s, const char *format, va_list arg) {
  int retval;
  if (!s || !format) {
    return (EINVAL);
  }
  retval = vsnprintf(s, INT_MAX, format, arg);
  return (retval);
}


x86 assembly (clang, -O0):
<vsprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1139 <vsprintf+0x29>
cmpq   $0x0,-0x18(%rbp)
jne    114a <vsprintf+0x3a>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    116c <vsprintf+0x5c>
mov    -0x10(%rbp),%rdi
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <vsnprintf@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vsprintf>:
test   %rdi,%rdi
je     112d <vsprintf+0x1d>
mov    %edx,%ecx
mov    %rsi,%rdx
test   %rsi,%rsi
je     112d <vsprintf+0x1d>
mov    0x2ec2(%rip),%rax
mov    (%rax),%esi
jmp    1030 <vsnprintf@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%eax
ret

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

LLVM IR (-O2):
@EINVAL = global i32 0
@INT_MAX = global i32 0
define i32 @vsprintf(i8* %0, i8* %1, i32 %2) {
%4 = icmp ne i8* %0, null
%5 = icmp ne i8* %1, null
%6 = and i1 %4, %5
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = load i32, i32* @EINVAL
br label %12
9: ; preds = %3
%10 = load i32, i32* @INT_MAX
%11 = tail call i32 @vsnprintf(i8* %0, i32 %10, i8* %1, i32 %2)
br label %12
12: ; preds = %9, %7
%13 = phi i32 [ %11, %9 ], [ %8, %7 ]
ret i32 %13
}
int is_in_bound(int *arr, int size, int *ptr) {
  if (ptr < size + arr) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_in_bound>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
movslq %edx,%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1139 <is_in_bound+0x39>
movl   $0x1,-0x4(%rbp)
jmp    1140 <is_in_bound+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_bound>:
movslq %esi,%rax
lea    (%rdi,%rax,4),%rcx
xor    %eax,%eax
cmp    %rdx,%rcx
seta   %al
ret

LLVM IR (-O0):
define i32 @is_in_bound(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** %7
%9 = load i32, i32* %6
%10 = load i32*, i32** %5
%11 = sext i32 %9 to i64
%12 = getelementptr inbounds i32, i32* %10, i64 %11
%13 = icmp ult i32* %8, %12
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 1, i32* %4
br label %16
15: ; preds = %3
store i32 0, i32* %4
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %4
ret i32 %17
}

LLVM IR (-O2):
define i32 @is_in_bound(i32* readnone %0, i32 %1, i32* readnone %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = icmp ugt i32* %5, %2
%7 = zext i1 %6 to i32
ret i32 %7
}
char *lab2str(char *p, int n) {
  do {
    *--p = '0' + n % 10;
    n /= 10;
  } while (n);
  return p;
}


x86 assembly (clang, -O0):
<lab2str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,-0x1(%rax)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    110b <lab2str+0xb>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lab2str>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %esi,%rcx
imul   $0x66666667,%rcx,%rsi
mov    %rsi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rsi
add    %edx,%esi
lea    (%rsi,%rsi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%edi
sub    %edx,%edi
add    $0x30,%dil
mov    %dil,-0x1(%rax)
add    $0xffffffffffffffff,%rax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <lab2str+0x10>
ret

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

LLVM IR (-O2):
define i8* @lab2str(i8* writeonly %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %9, %3 ]
%5 = phi i32 [ %1, %2 ], [ %10, %3 ]
%6 = srem i32 %5, 10
%7 = trunc i32 %6 to i8
%8 = add nsw i8 %7, 48
%9 = getelementptr inbounds i8, i8* %4, i64 -1
store i8 %8, i8* %9
%10 = sdiv i32 %5, 10
%11 = add i32 %5, 9
%12 = icmp ult i32 %11, 19
br i1 %12, label %13, label %3
13: ; preds = %3
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ ENOMEM;
int /*<<< orphan*/ errno;
int execve(char *name, char **argv, char **env) {
  errno = ENOMEM;
  return -1;
}


x86 assembly (clang, -O0):
<execve>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb8(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<execve>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOMEM = global i32 0
@errno = global i32 0
define i32 @execve(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i32, i32* @ENOMEM
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOMEM = global i32 0
@errno = global i32 0
define i32 @execve(i8* nocapture readnone %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = load i32, i32* @ENOMEM
store i32 %4, i32* @errno
ret i32 -1
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t load32_littleendian(const uint8_t *x) {
  uint32_t r;
  r = (uint32_t)x[0];
  r |= (uint32_t)x[1] << 8;
  r |= (uint32_t)x[2] << 16;
  r |= (uint32_t)x[3] << 24;
  return r;
}


x86 assembly (clang, -O0):
<load32_littleendian>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
shl    $0x10,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
shl    $0x18,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<load32_littleendian>:
mov    0x8(%rdi),%ecx
mov    0x10(%rdi),%edx
shl    $0x8,%ecx
or     (%rdi),%ecx
shl    $0x10,%edx
mov    0x18(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @load32_littleendian(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = getelementptr inbounds i64, i64* %0, i64 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i64, i64* %0, i64 2
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = shl i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i64, i64* %0, i64 3
%15 = load i64, i64* %14
%16 = trunc i64 %15 to i32
%17 = shl i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
/* Variables and functions */
unsigned int get32(int);
unsigned int uart_lsr(void) {
  return (get32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00015054)));
}


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

x86 assembly (clang, -O2):
<uart_lsr>:
mov    $0x3f215054,%edi
jmp    1030 <get32@plt>

LLVM IR (-O0):
define i32 @uart_lsr() {
%1 = call i32 @get32(i32 1059147860)
ret i32 %1
}

LLVM IR (-O2):
define i32 @uart_lsr() {
%1 = tail call i32 @get32(i32 1059147860)
ret i32 %1
}
/* Variables and functions */
scalar_t__ write(int, float *, int);
int write_float4(int f, float x) {
  float y;
  y = (float)x;
  return write(f, &y, 4) > 0;
}


x86 assembly (clang, -O0):
<write_float4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_float4>:
push   %rax
movss  %xmm0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
xor    %ecx,%ecx
test   %rax,%rax
setg   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @write_float4(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store i32 %0, i32* %3
store float %1, float* %4
%6 = load float, float* %4
store float %6, float* %5
%7 = load i32, i32* %3
%8 = call i64 @write(i32 %7, float* %5, i32 4)
%9 = icmp sgt i64 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @write_float4(i32 %0, float %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
store float %1, float* %3
%5 = call i64 @write(i32 %0, float* %3, i32 4)
%6 = icmp sgt i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128d;

/* Variables and functions */
__m128d __attribute__((__always___, __nodebug__))
_mm_load_pd(double const *dp) {
  return *(__m128d *)dp;
}


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

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

LLVM IR (-O0):
define i32 @_mm_load_pd(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = bitcast double* %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @_mm_load_pd(double* nocapture %0) {
%2 = bitcast double* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x63() {
  Assert_real((isdigit(99) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              500, ("isdigit should be 0 for c"));
}


x86 assembly (clang, -O0):
<t_isdigit_0x63>:
push   %rbp
mov    %rsp,%rbp
mov    $0x63,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x1f4,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0x63>:
push   %rax
mov    $0x63,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x1f4,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for c\00"
define void @t_isdigit_0x63() {
%1 = call i64 @isdigit(i32 99)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 500, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for c\00"
define void @t_isdigit_0x63() {
%1 = tail call i64 @isdigit(i32 99)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 500, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rst(int);
void opcode_e7() { rst(0x20); }


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

x86 assembly (clang, -O2):
<opcode_e7>:
mov    $0x20,%edi
jmp    1030 <rst@plt>

LLVM IR (-O0):
define void @opcode_e7() {
%1 = call i32 @rst(i32 32)
ret void
}

LLVM IR (-O2):
define void @opcode_e7() {
%1 = tail call i32 @rst(i32 32)
ret void
}
void __mem_manage_handler() {
  for (;;) {
    __asm__ volatile("nop");
  }
}


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

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

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

LLVM IR (-O2):
define void @__mem_manage_handler() {
br label %1
1: ; preds = %1, %0
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
br label %1
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *make_path(char *fpath) {
  char *p = malloc(strlen("filedir") + strlen(fpath) + 2);
  strcpy(p, "filedir");
  strcat(p, "/");
  strcat(p, fpath);
  return p;
}


x86 assembly (clang, -O0):
<make_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
add    %rax,%rdi
add    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe7c(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_path>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x9(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xea1(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
lea    0xe9a(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"filedir\00"
@.str.1 = [2 x i8] c"/\00"
define i8* @make_path(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i64 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %4, %6
%8 = add nsw i64 %7, 2
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%12 = load i8*, i8** %3
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = load i8*, i8** %3
%15 = load i8*, i8** %2
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@.str = [8 x i8] c"filedir\00"
@.str.1 = [2 x i8] c"/\00"
define i8* @make_path(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 9
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @strcat(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ putch(int /*<<< orphan*/);
void putstr(char *p) {
  while (*p)
    putch(*p++);
}


x86 assembly (clang, -O0):
<putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <putstr+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putch@plt>
jmp    111c <putstr+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putstr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <putstr+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putch@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <putstr+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @putstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @putch(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
void foo_1_2_1_2_1_1_1_1_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_1_2_1_1_1_1_1() {
ret void
}
int gcd(int u, int v) {
  int temp;
  while (u > 0) {
    if (u < v) {
      temp = u;
      u = v;
      v = temp;
    }
    u -= v;
  }
  return v;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1142 <gcd+0x42>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1132 <gcd+0x32>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    110a <gcd+0xa>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
test   %edi,%edi
jle    111f <gcd+0x1f>
mov    %esi,%eax
cs nopw 0x0(%rax,%rax,1)
cmp    %esi,%edi
cmovl  %edi,%eax
cmovl  %esi,%edi
mov    %eax,%esi
sub    %eax,%edi
jg     1110 <gcd+0x10>
ret
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i32 [ %10, %4 ], [ %0, %2 ]
%6 = phi i32 [ %8, %4 ], [ %1, %2 ]
%7 = icmp slt i32 %5, %6
%8 = select i1 %7, i32 %5, i32 %6
%9 = select i1 %7, i32 %6, i32 %5
%10 = sub nsw i32 %9, %8
%11 = icmp sgt i32 %10, 0
br i1 %11, label %4, label %12
12: ; preds = %4, %2
%13 = phi i32 [ %1, %2 ], [ %8, %4 ]
ret i32 %13
}
void write_keysig(sf, mi) int sf, mi;
{
  char data[2];
  data[0] = (char)(0xff & sf);
  data[1] = (char)mi;
  mf_write_meta_event(0L, 0x59, data, 2);
}


x86 assembly (clang, -O0):
<write_keysig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x9(%rbp)
lea    -0xa(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%edi
mov    $0x59,%esi
mov    $0x2,%ecx
mov    $0x0,%al
call   1030 <mf_write_meta_event@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_keysig>:
push   %rax
mov    %dil,0x6(%rsp)
mov    %sil,0x7(%rsp)
lea    0x6(%rsp),%rdx
xor    %edi,%edi
mov    $0x59,%esi
mov    $0x2,%ecx
xor    %eax,%eax
call   1030 <mf_write_meta_event@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @write_keysig(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = and i32 255, %6
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 %8, i8* %9
%10 = load i32, i32* %4
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
store i8 %11, i8* %12
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%14 = call i32 (i64, i32, i8*, i32, ...) bitcast (i32 (...)* @mf_write_meta_event to i32 (i64, i32, i8*, i32, ...)*)(i64 0, i32 89, i8* %13, i32 2)
ret void
}

LLVM IR (-O2):
define void @write_keysig(i32 %0, i32 %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = trunc i32 %0 to i8
store i8 %5, i8* %4
%6 = trunc i32 %1 to i8
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 %6, i8* %7
%8 = call i32 (i64, i32, i8*, i32, ...) bitcast (i32 (...)* @mf_write_meta_event to i32 (i64, i32, i8*, i32, ...)*)(i64 0, i32 89, i8* %4, i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void memoryFailure() { fprintf(stderr, "Out of memory.\n"); }


x86 assembly (clang, -O0):
<memoryFailure>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<memoryFailure>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
define void @memoryFailure() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
define void @memoryFailure() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}
void f1() { int x; }


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

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

LLVM IR (-O0):
define void @f1() {
%1 = alloca i32
ret void
}

LLVM IR (-O2):
define void @f1() {
ret void
}
int imul(int i, int j) { return i * j; }


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

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

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

LLVM IR (-O2):
define i32 @imul(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void handle(int s) { printf("signal ...\n"); }


x86 assembly (clang, -O0):
<handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [11 x i8] c"signal ...\00"
define void @handle(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
void __change_bit(int nr, volatile void *addr) {
  asm volatile("btcl %1,%0"
               : "=m"((*(volatile long *)addr))
               : "Ir"(nr), "m"((*(volatile long *)addr))
               : "memory");
}


x86 assembly (clang, -O0):
<__change_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rdx
btc    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__change_bit>:
btc    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define void @__change_bit(i32 %0, i8* %1) {
%3 = bitcast i8* %1 to i64*
tail call void asm sideeffect "btcl $1,$0", "=*m,Ir,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %3, i32 %0, i64* elementtype(i64) %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_RAW;
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int getSock() {
  int s = socket(PF_INET, SOCK_RAW, IPPROTO_TCP);
  return s;
}


x86 assembly (clang, -O0):
<getSock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
call   1030 <socket@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSock>:
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
jmp    1030 <socket@plt>

LLVM IR (-O0):
@PF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_TCP = global i32 0
define i32 @getSock() {
%1 = alloca i32
%2 = load i32, i32* @PF_INET
%3 = load i32, i32* @SOCK_RAW
%4 = load i32, i32* @IPPROTO_TCP
%5 = call i32 @socket(i32 %2, i32 %3, i32 %4)
store i32 %5, i32* %1
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
@PF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_TCP = global i32 0
define i32 @getSock() {
%1 = load i32, i32* @PF_INET
%2 = load i32, i32* @SOCK_RAW
%3 = load i32, i32* @IPPROTO_TCP
%4 = tail call i32 @socket(i32 %1, i32 %2, i32 %3)
ret i32 %4
}
/* Type definitions */
struct sg_alloc_s {
  int dummy;
};

/* Variables and functions */
void *a_malloc(struct sg_alloc_s *, size_t);
int /*<<< orphan*/ bzero(void *, size_t);
void *a_calloc(struct sg_alloc_s *a, size_t nmemb, size_t size) {
  void *ptr;
  size_t sz = nmemb * size;
  ptr = a_malloc(a, sz);
  bzero(ptr, sz);
  return ptr;
}


x86 assembly (clang, -O0):
<a_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <a_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <bzero@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
imul   %rdx,%rbx
mov    %rbx,%rsi
call   1040 <a_malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <bzero@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sg_alloc_s = type { i32 }
define i8* @a_calloc(%struct.sg_alloc_s* %0, i64 %1, i64 %2) {
%4 = alloca %struct.sg_alloc_s*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store %struct.sg_alloc_s* %0, %struct.sg_alloc_s** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = mul i64 %9, %10
store i64 %11, i64* %8
%12 = load %struct.sg_alloc_s*, %struct.sg_alloc_s** %4
%13 = load i64, i64* %8
%14 = call i8* @a_malloc(%struct.sg_alloc_s* %12, i64 %13)
store i8* %14, i8** %7
%15 = load i8*, i8** %7
%16 = load i64, i64* %8
%17 = call i32 @bzero(i8* %15, i64 %16)
%18 = load i8*, i8** %7
ret i8* %18
}

LLVM IR (-O2):
%struct.sg_alloc_s = type { i32 }
define i8* @a_calloc(%struct.sg_alloc_s* %0, i64 %1, i64 %2) {
%4 = mul i64 %2, %1
%5 = tail call i8* @a_malloc(%struct.sg_alloc_s* %0, i64 %4)
%6 = tail call i32 @bzero(i8* %5, i64 %4)
ret i8* %5
}
double rmax(int n, double *arr) {
  double maybemax;
  if (n == 1)
    return *arr;
  maybemax = rmax(n - 1, arr + 1);
  if (*arr >= maybemax)
    return *arr;
  else
    return maybemax;
}


x86 assembly (clang, -O0):
<rmax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    113b <rmax+0x2b>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1182 <rmax+0x72>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
call   1030 <rmax@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     1178 <rmax+0x68>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1182 <rmax+0x72>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rmax>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jne    111f <rmax+0xf>
movsd  (%rbx),%xmm0
pop    %rbx
ret
add    $0xffffffff,%edi
lea    0x8(%rbx),%rsi
call   1030 <rmax@plt>
movapd %xmm0,%xmm1
movsd  (%rbx),%xmm2
cmplesd %xmm2,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm1,%xmm3
andpd  %xmm2,%xmm0
orpd   %xmm3,%xmm0
pop    %rbx
ret

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

LLVM IR (-O2):
define double @rmax(i32 %0, double* nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load double, double* %1
br label %6
6: ; preds = %4, %8
%7 = phi double [ %14, %8 ], [ %5, %4 ]
ret double %7
8: ; preds = %2
%9 = add nsw i32 %0, -1
%10 = getelementptr inbounds double, double* %1, i64 1
%11 = tail call double @rmax(i32 %9, double* %10)
%12 = load double, double* %1
%13 = fcmp oge double %12, %11
%14 = select i1 %13, double %12, double %11
br label %6
}
int getaddrinfo(const char *node, const char *service, const void *hints,
                void **res) {
  return -4;
}


x86 assembly (clang, -O0):
<getaddrinfo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0xfffffffc,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @getaddrinfo(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8** nocapture readnone %3) {
ret i32 -4
}