xunge/DecIR huggingface dataset:
void betrans_ptrref_hook_free(void *hook) { return; }


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

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

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

LLVM IR (-O2):
define void @betrans_ptrref_hook_free(i8* nocapture %0) {
ret void
}
main() {
  f(f(), f());
  g(g(), g());
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <f@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <f@plt>
mov    %ebx,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <f@plt>
xor    %eax,%eax
call   1040 <g@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <g@plt>
mov    %ebx,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <g@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @f()
%2 = call i32 (...) @f()
%3 = call i32 (i32, i32, ...) bitcast (i32 (...)* @f to i32 (i32, i32, ...)*)(i32 %1, i32 %2)
%4 = call i32 (...) @g()
%5 = call i32 (...) @g()
%6 = call i32 (i32, i32, ...) bitcast (i32 (...)* @g to i32 (i32, i32, ...)*)(i32 %4, i32 %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = tail call i32 (...) @f()
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @f to i32 (i32, i32, ...)*)(i32 %1, i32 %2)
%4 = tail call i32 (...) @g()
%5 = tail call i32 (...) @g()
%6 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @g to i32 (i32, i32, ...)*)(i32 %4, i32 %5)
ret i32 0
}
float sdnoise_grad1(int hash, float *gx) {
  int h = hash & 15;
  *gx = 1.0f + (h & 7);
  if (h & 8)
    *gx = -*gx;
}


x86 assembly (clang, -O0):
<sdnoise_grad1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0x7,%eax
cvtsi2ss %eax,%xmm1
movss  0xeda(%rip),%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x14(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     115e <sdnoise_grad1+0x5e>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdnoise_grad1>:
mov    %edi,%eax
and    $0x7,%eax
cvtsi2ss %eax,%xmm0
addss  0xeef(%rip),%xmm0
test   $0x8,%dil
je     111e <sdnoise_grad1+0x1e>
xorps  0xef2(%rip),%xmm0
movss  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define float @sdnoise_grad1(i32 %0, float* %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca float*
%6 = alloca i32
store i32 %0, i32* %4
store float* %1, float** %5
%7 = load i32, i32* %4
%8 = and i32 %7, 15
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = and i32 %9, 7
%11 = sitofp i32 %10 to float
%12 = fadd float 1.000000e+00, %11
%13 = load float*, float** %5
store float %12, float* %13
%14 = load i32, i32* %6
%15 = and i32 %14, 8
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %2
%18 = load float*, float** %5
%19 = load float, float* %18
%20 = fneg float %19
%21 = load float*, float** %5
store float %20, float* %21
br label %22
22: ; preds = %17, %2
%23 = load float, float* %3
ret float %23
}

LLVM IR (-O2):
define float @sdnoise_grad1(i32 %0, float* nocapture writeonly %1) {
%3 = and i32 %0, 7
%4 = sitofp i32 %3 to float
%5 = fadd float %4, 1.000000e+00
%6 = and i32 %0, 8
%7 = icmp eq i32 %6, 0
%8 = fneg float %5
%9 = select i1 %7, float %5, float %8
store float %9, float* %1
ret float undef
}
/* Type definitions */
struct buddy {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct buddy *);
void buddy_destroy(struct buddy *b) { free(b); }


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

x86 assembly (clang, -O2):
<buddy_destroy>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.buddy = type { i32 }
define void @buddy_destroy(%struct.buddy* nocapture %0) {
%2 = tail call i32 @free(%struct.buddy* %0)
ret void
}
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  int /*<<< orphan*/ top;
};
typedef TYPE_1__ ERR_STATE;

/* Variables and functions */
int /*<<< orphan*/ err_clear(TYPE_1__ *, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ err_get_slot(TYPE_1__ *);
TYPE_1__ *ossl_err_get_state_int();
void ERR_new(void) {
  ERR_STATE *es;
  es = ossl_err_get_state_int();
  if (es == NULL)
    return;
  err_get_slot(es);
  err_clear(es, es->top, 0);
}


x86 assembly (clang, -O0):
<ERR_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <ossl_err_get_state_int@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1153 <ERR_new+0x23>
jmp    116d <ERR_new+0x3d>
mov    -0x8(%rbp),%rdi
call   1030 <err_get_slot@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <err_clear@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ERR_new>:
push   %rbx
xor    %eax,%eax
call   1050 <ossl_err_get_state_int@plt>
test   %rax,%rax
je     1155 <ERR_new+0x25>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <err_get_slot@plt>
mov    (%rbx),%esi
mov    %rbx,%rdi
xor    %edx,%edx
pop    %rbx
jmp    1040 <err_clear@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32 }
define void @ERR_new() {
%1 = alloca %struct.TYPE_5__*
%2 = call %struct.TYPE_5__* (...) @ossl_err_get_state_int()
store %struct.TYPE_5__* %2, %struct.TYPE_5__** %1
%3 = load %struct.TYPE_5__*, %struct.TYPE_5__** %1
%4 = icmp eq %struct.TYPE_5__* %3, null
br i1 %4, label %5, label %6
5: ; preds = %0
br label %14
6: ; preds = %0
%7 = load %struct.TYPE_5__*, %struct.TYPE_5__** %1
%8 = call i32 @err_get_slot(%struct.TYPE_5__* %7)
%9 = load %struct.TYPE_5__*, %struct.TYPE_5__** %1
%10 = load %struct.TYPE_5__*, %struct.TYPE_5__** %1
%11 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @err_clear(%struct.TYPE_5__* %9, i32 %12, i32 0)
br label %14
14: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32 }
define void @ERR_new() {
%1 = tail call %struct.TYPE_5__* (...) @ossl_err_get_state_int()
%2 = icmp eq %struct.TYPE_5__* %1, null
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = tail call i32 @err_get_slot(%struct.TYPE_5__* %1)
%5 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = tail call i32 @err_clear(%struct.TYPE_5__* %1, i32 %6, i32 0)
br label %8
8: ; preds = %0, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char const *);
void printStr(const char *str) { puts(str); }


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

x86 assembly (clang, -O2):
<printStr>:
jmp    1030 <puts@plt>

LLVM IR (-O0):
define void @printStr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @puts(i8* %3)
ret void
}

LLVM IR (-O2):
define void @printStr(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
__attribute__((__unused__, __always___)) __attribute__((__artificial__)) void
rdpmc(uint32_t *low, uint32_t *high,
      const unsigned int selector __attribute__((unused))) {
  *low = *high = 0;
}


x86 assembly (clang, -O0):
<rdpmc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdpmc>:
movq   $0x0,(%rsi)
movq   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @rdpmc(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** %5
store i64 0, i64* %7
%8 = load i64*, i64** %4
store i64 0, i64* %8
ret void
}

LLVM IR (-O2):
define void @rdpmc(i64* nocapture writeonly %0, i64* nocapture writeonly %1, i32 %2) {
store i64 0, i64* %1
store i64 0, i64* %0
ret void
}
int _pointer_compare(const void *a, const void *b) {
  return ((long)a) - ((long)b);
}


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

x86 assembly (clang, -O2):
<_pointer_compare>:
mov    %rdi,%rax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @_pointer_compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i64
%9 = sub nsw i64 %6, %8
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @_pointer_compare(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = sub nsw i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
void getBinary(char hex, int *result) {
  int t;
  if (hex >= '0' && hex <= '9') {
    t = hex - '0';
  } else {
    t = hex - 'A' + 10;
  }
  *result = t;
}


x86 assembly (clang, -O0):
<getBinary>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1137 <getBinary+0x37>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     1137 <getBinary+0x37>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <getBinary+0x44>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBinary>:
lea    -0x30(%rdi),%eax
lea    -0x37(%rdi),%ecx
add    $0xffffffd0,%edi
cmp    $0xa,%al
cmovae %ecx,%edi
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @getBinary(i8 signext %0, i32* %1) {
%3 = alloca i8
%4 = alloca i32*
%5 = alloca i32
store i8 %0, i8* %3
store i32* %1, i32** %4
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp sge i32 %7, 48
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 57
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 48
store i32 %16, i32* %5
br label %22
17: ; preds = %9, %2
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %19, 65
%21 = add nsw i32 %20, 10
store i32 %21, i32* %5
br label %22
22: ; preds = %17, %13
%23 = load i32, i32* %5
%24 = load i32*, i32** %4
store i32 %23, i32* %24
ret void
}

LLVM IR (-O2):
define void @getBinary(i8 signext %0, i32* nocapture writeonly %1) {
%3 = sext i8 %0 to i32
%4 = add i8 %0, -48
%5 = icmp ult i8 %4, 10
%6 = select i1 %5, i32 -48, i32 -55
%7 = add nsw i32 %6, %3
store i32 %7, i32* %1
ret void
}
char *strcpy(char *s1, const char *s2) {
  char *rs = s1;
  *s1 = *s2;
  while (*s2 != 0) {
    s1++;
    s2++;
    *s1 = *s2;
  }
  return rs;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1159 <strcpy+0x59>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    1120 <strcpy+0x20>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %cl,(%rdi)
cmpb   $0x0,(%rsi)
je     1131 <strcpy+0x31>
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
cmpb   $0x0,(%rsi,%rcx,1)
lea    0x1(%rcx),%rcx
jne    1120 <strcpy+0x20>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
store i8 %3, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %2, %6
%7 = phi i8* [ %9, %6 ], [ %0, %2 ]
%8 = phi i8* [ %10, %6 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %10
store i8 %11, i8* %9
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printRepeating(int *, int);
int main() {
  int arr[] = {1, 2, 3, 1, 3, 6, 6};
  int arr_size = sizeof(arr) / sizeof(arr[0]);
  printRepeating(arr, arr_size);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x7,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <printRepeating@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xee1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <printRepeating@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [7 x i32] [i32 1, i32 2, i32 3, i32 1, i32 3, i32 6, i32 6]
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [7 x i32]* %2 to i8*
store i32 7, i32* %3
%5 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @printRepeating(i32* %5, i32 %6)
%8 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [7 x i32] [i32 1, i32 2, i32 3, i32 1, i32 3, i32 6, i32 6]
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @printRepeating(i32* %3, i32 7)
%5 = call i32 (...) @getchar()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ printArray(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quickSort(int *, int /*<<< orphan*/, int);
int main() {
  int arr[] = {81, 27, 38, 99, 51, 5};
  int n = sizeof(arr) / sizeof(arr[0]);
  quickSort(arr, 0, n - 1);
  printf("Sorted array: ");
  printArray(arr, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x6,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1040 <quickSort@plt>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <printArray@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xed4(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <quickSort@plt>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <printArray@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [6 x i32] [i32 81, i32 27, i32 38, i32 99, i32 51, i32 5]
@.str = [15 x i8] c"Sorted array: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [6 x i32]* %2 to i8*
store i32 6, i32* %3
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = sub nsw i32 %6, 1
%8 = call i32 @quickSort(i32* %5, i32 0, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%11 = load i32, i32* %3
%12 = call i32 @printArray(i32* %10, i32 %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [6 x i32] [i32 81, i32 27, i32 38, i32 99, i32 51, i32 5]
@.str = [15 x i8] c"Sorted array: \00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @quickSort(i32* %3, i32 0, i32 5)
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printArray(i32* %3, i32 6)
ret i32 0
}
/* Variables and functions */
int SIGUSR1;
int /*<<< orphan*/ err_sys(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ vn_log_info(char *);
void vn_sig_usr1_handler(int signum) {
  if (signum != SIGUSR1) {
    err_sys("[vn_sig_usr1_handler] signum must be SIGUSR1");
  }
  vn_log_info("Exiting on SIGUSR1...");
  exit(0);
}


x86 assembly (clang, -O0):
<vn_sig_usr1_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%eax
je     1159 <vn_sig_usr1_handler+0x29>
lea    0xeac(%rip),%rdi
call   1030 <err_sys@plt>
lea    0xecd(%rip),%rdi
call   1040 <vn_log_info@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<vn_sig_usr1_handler>:
push   %rax
mov    0x2eb0(%rip),%rax
cmp    %edi,(%rax)
je     1148 <vn_sig_usr1_handler+0x18>
lea    0xebd(%rip),%rdi
call   1030 <err_sys@plt>
lea    0xede(%rip),%rdi
call   1040 <vn_log_info@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SIGUSR1 = global i32 0
@.str = [45 x i8] c"[vn_sig_usr1_handler] signum must be SIGUSR1\00"
@.str.1 = [22 x i8] c"Exiting on SIGUSR1...\00"
define void @vn_sig_usr1_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGUSR1
%5 = icmp ne i32 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @err_sys(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = call i32 @vn_log_info(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@SIGUSR1 = global i32 0
@.str = [45 x i8] c"[vn_sig_usr1_handler] signum must be SIGUSR1\00"
@.str.1 = [22 x i8] c"Exiting on SIGUSR1...\00"
define void @vn_sig_usr1_handler(i32 %0) {
%2 = load i32, i32* @SIGUSR1
%3 = icmp eq i32 %2, %0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @err_sys(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @vn_log_info(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
}
int seteuid(int euid) {}


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

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

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

LLVM IR (-O2):
define i32 @seteuid(i32 %0) {
ret i32 undef
}
void zeros_double_vec(double *vec, int x) {
  int i;
  for (i = 0; i < x; i++) {
    vec[i] = 0.0;
  }
}


x86 assembly (clang, -O0):
<zeros_double_vec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113c <zeros_double_vec+0x3c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <zeros_double_vec+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zeros_double_vec>:
test   %esi,%esi
jle    1126 <zeros_double_vec+0x16>
push   %rax
mov    %esi,%edx
shl    $0x3,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @zeros_double_vec(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %15, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load double*, double** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %11, i64 %13
store double 0.000000e+00, double* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %6
18: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @zeros_double_vec(double* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast double* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 3
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
int isspace(const char c) {
  switch (c) {
  case ' ':
  case '\f':
  case '\n':
  case '\r':
  case '\t':
  case '\v':
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xfffffff7,%eax
sub    $0x5,%eax
jb     1133 <isspace+0x33>
jmp    1122 <isspace+0x22>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
jne    113f <isspace+0x3f>
jmp    1133 <isspace+0x33>
movl   $0x1,-0x4(%rbp)
jmp    1146 <isspace+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
mov    $0x1,%eax
lea    -0x9(%rdi),%ecx
cmp    $0x5,%ecx
jae    110e <isspace+0xe>
ret
cmp    $0x20,%edi
je     110d <isspace+0xd>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isspace(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %7 [
i32 32, label %6
i32 12, label %6
i32 10, label %6
i32 13, label %6
i32 9, label %6
i32 11, label %6
]
6: ; preds = %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @isspace(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %3 [
i32 32, label %4
i32 12, label %4
i32 10, label %4
i32 13, label %4
i32 9, label %4
i32 11, label %4
]
3: ; preds = %1
br label %4
4: ; preds = %1, %1, %1, %1, %1, %1, %3
%5 = phi i32 [ 0, %3 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %5
}
unsigned short SIO1readBaud16(void) { return 0; }


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

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

LLVM IR (-O0):
define zeroext i16 @SIO1readBaud16() {
ret i16 0
}

LLVM IR (-O2):
define zeroext i16 @SIO1readBaud16() {
ret i16 0
}
/* Variables and functions */
int /*<<< orphan*/ sendInterrupt(int);
void createPageFault() { sendInterrupt(0x0E); }


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

x86 assembly (clang, -O2):
<createPageFault>:
mov    $0xe,%edi
jmp    1030 <sendInterrupt@plt>

LLVM IR (-O0):
define void @createPageFault() {
%1 = call i32 @sendInterrupt(i32 14)
ret void
}

LLVM IR (-O2):
define void @createPageFault() {
%1 = tail call i32 @sendInterrupt(i32 14)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Die(char *);
void *realloc(void *, size_t);
void *ReallocOrDie(void *p, size_t size) {
  void *ptr;
  if ((ptr = realloc(p, size)) == NULL)
    Die("realloc failed");
  return ptr;
}


x86 assembly (clang, -O0):
<ReallocOrDie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1157 <ReallocOrDie+0x37>
lea    0xeae(%rip),%rdi
call   1030 <Die@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [15 x i8] c"realloc failed\00"
define noalias i8* @ReallocOrDie(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @Die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
ISR(EE_READY_vect) {
  DEBUG("ISR "
        "EE_READY"
        " occured");
}


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

x86 assembly (clang, -O2):
<ISR>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <DEBUG@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"ISR EE_READY occured\00"
define i32 @ISR(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
@.str = [21 x i8] c"ISR EE_READY occured\00"
define i32 @ISR(i32 %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
void f5(int a) {
  if (a != 28) {
    if (4 / a == 5)
      link_error();
  }
}


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1c,-0x4(%rbp)
je     1143 <f5+0x33>
mov    $0x4,%eax
cltd
idivl  -0x4(%rbp)
cmp    $0x5,%eax
jne    113e <f5+0x2e>
mov    $0x0,%al
call   1030 <link_error@plt>
jmp    1143 <f5+0x33>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f5(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 28
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sdiv i32 4, %6
%8 = icmp eq i32 %7, 5
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 (...) @link_error()
br label %11
11: ; preds = %9, %5
br label %12
12: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
define void @f5(i32 %0) {
ret void
}
unsigned int scale_by_zoom_factor(unsigned int value, int z) {
  if (z > 0)
    return value << z;
  else if (z < 0)
    return value >> -z;
  else
    return value;
}


x86 assembly (clang, -O0):
<scale_by_zoom_factor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1124 <scale_by_zoom_factor+0x24>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <scale_by_zoom_factor+0x46>
cmpl   $0x0,-0xc(%rbp)
jge    1140 <scale_by_zoom_factor+0x40>
mov    -0x8(%rbp),%eax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <scale_by_zoom_factor+0x46>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_by_zoom_factor>:
mov    %edi,%eax
test   %esi,%esi
jle    110b <scale_by_zoom_factor+0xb>
mov    %esi,%ecx
shl    %cl,%eax
ret
js     110e <scale_by_zoom_factor+0xe>
ret
neg    %sil
mov    %esi,%ecx
shr    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @scale_by_zoom_factor(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = shl i32 %0, %1
br label %11
6: ; preds = %2
%7 = icmp slt i32 %1, 0
br i1 %7, label %8, label %11
8: ; preds = %6
%9 = sub nsw i32 0, %1
%10 = lshr i32 %0, %9
br label %11
11: ; preds = %6, %8, %4
%12 = phi i32 [ %5, %4 ], [ %10, %8 ], [ %0, %6 ]
ret i32 %12
}
void sync() { asm volatile("movl $0xF, %%eax; int $0x80" : : : "eax"); }


x86 assembly (clang, -O0):
<sync>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%eax
int    $0x80
pop    %rbp
ret

x86 assembly (clang, -O2):
<sync>:
mov    $0xf,%eax
int    $0x80
ret

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

LLVM IR (-O2):
define void @sync() {
tail call void asm sideeffect "movl $$0xF, %eax; int $$0x80", "~{eax},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fgetc(int /*<<< orphan*/ *);
uint32_t fget32(FILE *fp) {
  uint32_t v = fgetc(fp);
  v |= fgetc(fp) << 8;
  v |= fgetc(fp) << 16;
  v |= fgetc(fp) << 24;
  return v;
}


x86 assembly (clang, -O0):
<fget32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
shl    $0x10,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
shl    $0x18,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fget32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <fgetc@plt>
mov    %eax,%r14d
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
or     %r14d,%ebp
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
mov    %r15,%rdi
call   1030 <fgetc@plt>
shl    $0x18,%eax
or     %ebx,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fget32(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fgetc(i32* %4)
store i32 %5, i32* %3
%6 = load i32*, i32** %2
%7 = call i32 @fgetc(i32* %6)
%8 = shl i32 %7, 8
%9 = load i32, i32* %3
%10 = or i32 %9, %8
store i32 %10, i32* %3
%11 = load i32*, i32** %2
%12 = call i32 @fgetc(i32* %11)
%13 = shl i32 %12, 16
%14 = load i32, i32* %3
%15 = or i32 %14, %13
store i32 %15, i32* %3
%16 = load i32*, i32** %2
%17 = call i32 @fgetc(i32* %16)
%18 = shl i32 %17, 24
%19 = load i32, i32* %3
%20 = or i32 %19, %18
store i32 %20, i32* %3
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @fget32(i32* nocapture %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = tail call i32 @fgetc(i32* %0)
%4 = shl i32 %3, 8
%5 = or i32 %4, %2
%6 = tail call i32 @fgetc(i32* %0)
%7 = shl i32 %6, 16
%8 = or i32 %5, %7
%9 = tail call i32 @fgetc(i32* %0)
%10 = shl i32 %9, 24
%11 = or i32 %8, %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printAsm(int);
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *);
int main() {
  int inst;
  printf(".text\n.syntax unified\n.thumb\n");
  while (scanf("%x", &inst) == 1) {
    printAsm(inst);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1171 <main+0x41>
mov    -0x8(%rbp),%edi
call   1050 <printAsm@plt>
jmp    114b <main+0x1b>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1189 <main+0x59>
lea    0xea3(%rip),%r14
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x4(%rsp),%edi
call   1050 <printAsm@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [30 x i8] c".text\0A.syntax unified\0A.thumb\0A\00"
@.str.1 = [3 x i8] c"%x\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %7, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 @printAsm(i32 %8)
br label %4
10: ; preds = %4
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%x\00"
@str = [29 x i8] c".text\0A.syntax unified\0A.thumb\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %11
6: ; preds = %0, %6
%7 = load i32, i32* %1
%8 = call i32 @printAsm(i32 %7)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = icmp eq i32 %9, 1
br i1 %10, label %6, label %11
11: ; preds = %6, %0
ret i32 0
}
/* Variables and functions */
int F2_cc_nu_n(double, double);
double F1_cc_anu_n(double xx, double Q2) { return F2_cc_nu_n(xx, Q2) / 2 / xx; }


x86 assembly (clang, -O0):
<F1_cc_anu_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <F2_cc_nu_n@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
divsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<F1_cc_anu_n>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <F2_cc_nu_n@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
divsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @F1_cc_anu_n(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call i32 @F2_cc_nu_n(double %5, double %6)
%8 = sdiv i32 %7, 2
%9 = sitofp i32 %8 to double
%10 = load double, double* %3
%11 = fdiv double %9, %10
ret double %11
}

LLVM IR (-O2):
define double @F1_cc_anu_n(double %0, double %1) {
%3 = tail call i32 @F2_cc_nu_n(double %0, double %1)
%4 = sdiv i32 %3, 2
%5 = sitofp i32 %4 to double
%6 = fdiv double %5, %0
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ printVersion();
int /*<<< orphan*/ startMenu();
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc == 2 && strcmp(*++argv, "--version") == 0) {
    printVersion();
    return 0;
  }
  startMenu();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    118c <main+0x5c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe96(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    118c <main+0x5c>
mov    $0x0,%al
call   1050 <printVersion@plt>
movl   $0x0,-0x4(%rbp)
jmp    119a <main+0x6a>
mov    $0x0,%al
call   1040 <startMenu@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    114b <main+0x1b>
mov    0x8(%rsi),%rdi
lea    0xebf(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1154 <main+0x24>
xor    %eax,%eax
call   1040 <startMenu@plt>
jmp    115b <main+0x2b>
xor    %eax,%eax
call   1050 <printVersion@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"--version\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i32 1
store i8** %10, i8*** %5
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = call i32 (...) @printVersion()
store i32 0, i32* %3
br label %18
16: ; preds = %8, %2
%17 = call i32 (...) @startMenu()
store i32 0, i32* %3
br label %18
18: ; preds = %16, %14
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [10 x i8] c"--version\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 (...) @printVersion()
br label %13
11: ; preds = %4, %2
%12 = tail call i32 (...) @startMenu()
br label %13
13: ; preds = %11, %9
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sgen(char *, char *, char *);
void cgstorgb(char *s) { sgen("%s\t%s,al", "mov", s); }


x86 assembly (clang, -O0):
<cgstorgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xedb(%rip),%rsi
call   1030 <sgen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgstorgb>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xee8(%rip),%rsi
jmp    1030 <sgen@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"%s\09%s,al\00"
@.str.1 = [4 x i8] c"mov\00"
define void @cgstorgb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sgen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s\09%s,al\00"
@.str.1 = [4 x i8] c"mov\00"
define void @cgstorgb(i8* %0) {
%2 = tail call i32 @sgen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
unsigned int hweight16(unsigned int w) {
  unsigned int res = w - ((w >> 1) & 0x5555);
  res = (res & 0x3333) + ((res >> 2) & 0x3333);
  res = (res + (res >> 4)) & 0x0F0F;
  return (res + (res >> 8)) & 0x00FF;
}


x86 assembly (clang, -O0):
<hweight16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
and    $0x5555,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3333,%eax
mov    -0x8(%rbp),%ecx
shr    $0x2,%ecx
and    $0x3333,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x8,%ecx
add    %ecx,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hweight16>:
mov    %edi,%eax
shr    %eax
and    $0x5555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x3333,%eax
shr    $0x2,%edi
and    $0x3333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
add    %eax,%ecx
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @hweight16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = lshr i32 %5, 1
%7 = and i32 %6, 21845
%8 = sub i32 %4, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = and i32 %9, 13107
%11 = load i32, i32* %3
%12 = lshr i32 %11, 2
%13 = and i32 %12, 13107
%14 = add i32 %10, %13
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = lshr i32 %16, 4
%18 = add i32 %15, %17
%19 = and i32 %18, 3855
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = load i32, i32* %3
%22 = lshr i32 %21, 8
%23 = add i32 %20, %22
%24 = and i32 %23, 255
ret i32 %24
}

LLVM IR (-O2):
define i32 @hweight16(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 21845
%4 = sub i32 %0, %3
%5 = and i32 %4, 13107
%6 = lshr i32 %4, 2
%7 = and i32 %6, 13107
%8 = add nuw nsw i32 %7, %5
%9 = lshr i32 %8, 4
%10 = add nuw nsw i32 %9, %8
%11 = and i32 %10, 3855
%12 = lshr i32 %11, 8
%13 = add nuw nsw i32 %12, %11
%14 = and i32 %13, 31
ret i32 %14
}
/* Type definitions */
struct timeval {
  int tv_sec;
  long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long int get_time() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return tv.tv_sec * 1000000 + tv.tv_usec;
}


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

x86 assembly (clang, -O2):
<get_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @get_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000000
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add nsw i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @get_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %9, %7
ret i64 %10
}
/* Variables and functions */
char getchr(int);
void getstrbe(char string[], int offset) {
  int i;
  for (i = 0; i < 4; i++) {
    string[i] = getchr(offset + i);
  }
  string[4] = 0;
}


x86 assembly (clang, -O0):
<getstrbe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1156 <getstrbe+0x46>
mov    -0xc(%rbp),%edi
add    -0x10(%rbp),%edi
call   1030 <getchr@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <getstrbe+0x16>
mov    -0x8(%rbp),%rax
movb   $0x0,0x4(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getstrbe>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
call   1030 <getchr@plt>
mov    %al,(%r14)
lea    0x1(%rbx),%edi
call   1030 <getchr@plt>
mov    %al,0x1(%r14)
lea    0x2(%rbx),%edi
call   1030 <getchr@plt>
mov    %al,0x2(%r14)
add    $0x3,%ebx
mov    %ebx,%edi
call   1030 <getchr@plt>
mov    %al,0x3(%r14)
movb   $0x0,0x4(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @getstrbe(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = add nsw i32 %10, %11
%13 = call signext i8 @getchr(i32 %12)
%14 = load i8*, i8** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 %13, i8* %17
br label %18
18: ; preds = %9
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 4
store i8 0, i8* %23
ret void
}

LLVM IR (-O2):
define void @getstrbe(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call signext i8 @getchr(i32 %1)
store i8 %3, i8* %0
%4 = add i32 %1, 1
%5 = tail call signext i8 @getchr(i32 %4)
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = add i32 %1, 2
%8 = tail call signext i8 @getchr(i32 %7)
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = add i32 %1, 3
%11 = tail call signext i8 @getchr(i32 %10)
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
%13 = getelementptr inbounds i8, i8* %0, i64 4
store i8 0, i8* %13
ret void
}