xunge/DecIR huggingface dataset:
int foo(int *a) {
  int i, j = 0;
#pragma omp target teams distribute simd linear(i) map(a[:10])
  for (i = 0; i < 10; i++)
    a[i] = j;
  return i;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    113c <foo+0x3c>
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <foo+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%rdi)
movups %xmm0,(%rdi)
movq   $0x0,0x20(%rdi)
mov    $0xa,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32* nocapture writeonly %0) {
%2 = bitcast i32* %0 to i8*
ret i32 10
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void intHandler(int d) {
  (void)d;
  fprintf(stderr, "got signal\n");
}


x86 assembly (clang, -O0):
<intHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"got signal\0A\00"
define void @intHandler(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
int foo2(int (*bar)(int a, int b, int c)) { return 7 + 2; }


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

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

LLVM IR (-O0):
define i32 @foo2(i32 (i32, i32, i32)* %0) {
%2 = alloca i32 (i32, i32, i32)*
store i32 (i32, i32, i32)* %0, i32 (i32, i32, i32)** %2
ret i32 9
}

LLVM IR (-O2):
define i32 @foo2(i32 (i32, i32, i32)* nocapture readnone %0) {
ret i32 9
}
/* Variables and functions */
int dup(int);
int outside_dup(int oldfd) { return dup(oldfd); }


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

x86 assembly (clang, -O2):
<outside_dup>:
jmp    1030 <dup@plt>

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

LLVM IR (-O2):
define i32 @outside_dup(i32 %0) {
%2 = tail call i32 @dup(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double CalculateCostOfIntegers(int /*<<< orphan*/ *, int, int, int);
double CalculateCostOfIntegers2(FILE *fh, int count, int shift) {
  return CalculateCostOfIntegers(fh, count, 4, shift);
}


x86 assembly (clang, -O0):
<CalculateCostOfIntegers2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%ecx
mov    $0x4,%edx
call   1030 <CalculateCostOfIntegers@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculateCostOfIntegers2>:
mov    %edx,%ecx
mov    $0x4,%edx
jmp    1030 <CalculateCostOfIntegers@plt>

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

LLVM IR (-O2):
define double @CalculateCostOfIntegers2(i32* %0, i32 %1, i32 %2) {
%4 = tail call double @CalculateCostOfIntegers(i32* %0, i32 %1, i32 4, i32 %2)
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_iochannel_socket_peer_to_string() {
  printf("NOT IMPLEMENTED:"
         "pa_iochannel_socket_peer_to_string"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [52 x i8] c"NOT IMPLEMENTED:pa_iochannel_socket_peer_to_string\0A\00"
define i32 @pa_iochannel_socket_peer_to_string() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [51 x i8] c"NOT IMPLEMENTED:pa_iochannel_socket_peer_to_string\00"
define i32 @pa_iochannel_socket_peer_to_string() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
float __fssub(float a1, float a2) {
  float neg = -a1;
  return -(neg + a2);
}


x86 assembly (clang, -O0):
<__fssub>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fssub>:
subss  %xmm0,%xmm1
xorps  0xef5(%rip),%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @__fssub(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = fneg float %6
store float %7, float* %5
%8 = load float, float* %5
%9 = load float, float* %4
%10 = fadd float %8, %9
%11 = fneg float %10
ret float %11
}

LLVM IR (-O2):
define float @__fssub(float %0, float %1) {
%3 = fsub float %1, %0
%4 = fneg float %3
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ progerr(char *);
void uncompress_worddata(unsigned char **buf, int *buf_size, int saved_bytes) {
  if (saved_bytes)
    progerr("The index was created with zlib compression.\n This version of "
            "swish was not compiled with zlib");
}


x86 assembly (clang, -O0):
<uncompress_worddata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1139 <uncompress_worddata+0x29>
lea    0xecc(%rip),%rdi
call   1030 <progerr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uncompress_worddata>:
test   %edx,%edx
je     1120 <uncompress_worddata+0x10>
lea    0xee5(%rip),%rdi
jmp    1030 <progerr@plt>
ret

LLVM IR (-O0):
@.str = [95 x i8] c"The index was created with zlib compression.\0A This version of swish was not compiled with zlib\00"
define void @uncompress_worddata(i8** %0, i32* %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i32
store i8** %0, i8*** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @progerr(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %3
ret void
}

LLVM IR (-O2):
@.str = [95 x i8] c"The index was created with zlib compression.\0A This version of swish was not compiled with zlib\00"
define void @uncompress_worddata(i8** nocapture readnone %0, i32* nocapture readnone %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @progerr(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret void
}
int is_ucon(x)
int x;
{
  if (x / 20000000 == 2)
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<is_ucon>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x1312d00,%ecx
cltd
idiv   %ecx
cmp    $0x2,%eax
jne    1127 <is_ucon+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <is_ucon+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ucon>:
add    $0xfd9da600,%edi
xor    %eax,%eax
cmp    $0x1312d00,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @is_ucon(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = sdiv i32 %4, 20000000
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @is_ucon(i32 %0) {
%2 = add i32 %0, -40000000
%3 = icmp ult i32 %2, 20000000
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int foo1c();
int foo3b(void) { return foo1c(); }


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

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

LLVM IR (-O0):
define i32 @foo3b() {
%1 = call i32 (...) @foo1c()
ret i32 %1
}

LLVM IR (-O2):
define i32 @foo3b() {
%1 = tail call i32 (...) @foo1c()
ret i32 %1
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ list_end(struct list const *);
scalar_t__ list_is_empty(struct list const *);
struct list *list_prev(int /*<<< orphan*/);
struct list *list_last(const struct list *head) {
  if (list_is_empty(head)) {
    return NULL;
  }
  return list_prev(list_end(head));
}


x86 assembly (clang, -O0):
<list_last>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <list_is_empty@plt>
cmp    $0x0,%rax
je     115c <list_last+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    1170 <list_last+0x40>
mov    -0x10(%rbp),%rdi
call   1030 <list_end@plt>
mov    %eax,%edi
call   1050 <list_prev@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_last>:
push   %rbx
mov    %rdi,%rbx
call   1040 <list_is_empty@plt>
test   %rax,%rax
je     1142 <list_last+0x12>
xor    %eax,%eax
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <list_end@plt>
mov    %eax,%edi
pop    %rbx
jmp    1050 <list_prev@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
define %struct.list* @list_last(%struct.list* %0) {
%2 = alloca %struct.list*
%3 = alloca %struct.list*
store %struct.list* %0, %struct.list** %3
%4 = load %struct.list*, %struct.list** %3
%5 = call i64 @list_is_empty(%struct.list* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store %struct.list* null, %struct.list** %2
br label %12
8: ; preds = %1
%9 = load %struct.list*, %struct.list** %3
%10 = call i32 @list_end(%struct.list* %9)
%11 = call %struct.list* @list_prev(i32 %10)
store %struct.list* %11, %struct.list** %2
br label %12
12: ; preds = %8, %7
%13 = load %struct.list*, %struct.list** %2
ret %struct.list* %13
}

LLVM IR (-O2):
%struct.list = type { i32 }
define %struct.list* @list_last(%struct.list* %0) {
%2 = tail call i64 @list_is_empty(%struct.list* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @list_end(%struct.list* %0)
%6 = tail call %struct.list* @list_prev(i32 %5)
br label %7
7: ; preds = %1, %4
%8 = phi %struct.list* [ %6, %4 ], [ null, %1 ]
ret %struct.list* %8
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
uint32_t extract_signed_bits(uint32_t word, uint32_t low_bit, uint32_t size) {
  uint32_t mask = (1u << size) - 1;
  uint32_t value = (word >> low_bit) & mask;
  if (value & (1u << (size - 1)))
    value |= ~mask;
  return value;
}


x86 assembly (clang, -O0):
<extract_signed_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1154 <extract_signed_bits+0x54>
mov    -0x10(%rbp),%eax
xor    $0xffffffff,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_signed_bits>:
mov    $0xffffffff,%eax
mov    %edx,%ecx
shl    %cl,%eax
mov    %esi,%ecx
mov    %eax,%esi
shr    %cl,%edi
not    %esi
and    %edi,%esi
add    $0xff,%dl
movzbl %dl,%ecx
or     %edi,%eax
bt     %ecx,%esi
cmovae %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @extract_signed_bits(i32 %0, i32 %1, i32 %2) {
%4 = shl nsw i32 -1, %2
%5 = xor i32 %4, -1
%6 = lshr i32 %0, %1
%7 = and i32 %6, %5
%8 = add i32 %2, -1
%9 = shl nuw i32 1, %8
%10 = and i32 %7, %9
%11 = icmp eq i32 %10, 0
%12 = or i32 %4, %6
%13 = select i1 %11, i32 %7, i32 %12
ret i32 %13
}
/* Type definitions */
typedef int u_int8_t;

/* Variables and functions */
int big_end_int(u_int8_t *p) {
  return (*p << 24) | (*(p + 1) << 16) | (*(p + 2) << 8) | *(p + 3);
}


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

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

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

LLVM IR (-O2):
define i32 @big_end_int(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 24
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = shl i32 %5, 16
%7 = or i32 %6, %3
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = or i32 %7, %10
%12 = getelementptr inbounds i32, i32* %0, i64 3
%13 = load i32, i32* %12
%14 = or i32 %11, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ ERR_get_error();
int RAND_bytes(unsigned char *, int);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void generateIv(void *buf) {
  int status = -1;
  status = RAND_bytes((unsigned char *)buf, 16);
  if (status != 1) {
    printf("something wrong with generate IV !!!!!! (%li)\n", ERR_get_error());
    abort();
  }
}


x86 assembly (clang, -O0):
<generateIv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x10,%esi
call   1040 <RAND_bytes@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     118a <generateIv+0x4a>
mov    $0x0,%al
call   1060 <ERR_get_error@plt>
mov    %eax,%esi
lea    0xe82(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateIv>:
push   %rax
mov    $0x10,%esi
call   1040 <RAND_bytes@plt>
cmp    $0x1,%eax
jne    1152 <generateIv+0x12>
pop    %rax
ret
xor    %eax,%eax
call   1060 <ERR_get_error@plt>
lea    0xea0(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"something wrong with generate IV !!!!!! (%li)\0A\00"
define void @generateIv(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 -1, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @RAND_bytes(i8* %4, i32 16)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 (...) @ERR_get_error()
%10 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"something wrong with generate IV !!!!!! (%li)\0A\00"
define void @generateIv(i8* %0) {
%2 = tail call i32 @RAND_bytes(i8* %0, i32 16)
%3 = icmp eq i32 %2, 1
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 (...) @ERR_get_error()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret void
}
/* Variables and functions */
long f1(char, short, int, long);
int f1_Skel(int *argTypes, void **args) {
  *((long *)*args) = f1(*((char *)(*(args + 1))), *((short *)(*(args + 2))),
                        *((int *)(*(args + 3))), *((long *)(*(args + 4))));
  return 0;
}


x86 assembly (clang, -O0):
<f1_Skel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%sil
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%ax
mov    -0x10(%rbp),%rcx
mov    0x18(%rcx),%rcx
mov    (%rcx),%edx
mov    -0x10(%rbp),%rcx
mov    0x20(%rcx),%rcx
mov    (%rcx),%rcx
movsbl %sil,%edi
movswl %ax,%esi
call   1030 <f1@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rcx,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1_Skel>:
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rax
mov    0x10(%rsi),%rcx
movsbl (%rax),%edi
movswl (%rcx),%esi
mov    0x18(%rbx),%rax
mov    (%rax),%edx
mov    0x20(%rbx),%rax
mov    (%rax),%rcx
call   1030 <f1@plt>
mov    (%rbx),%rcx
mov    %rax,(%rcx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @f1_Skel(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 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 2
%11 = load i8*, i8** %10
%12 = bitcast i8* %11 to i16*
%13 = load i16, i16* %12
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 3
%16 = load i8*, i8** %15
%17 = bitcast i8* %16 to i32*
%18 = load i32, i32* %17
%19 = load i8**, i8*** %4
%20 = getelementptr inbounds i8*, i8** %19, i64 4
%21 = load i8*, i8** %20
%22 = bitcast i8* %21 to i64*
%23 = load i64, i64* %22
%24 = call i64 @f1(i8 signext %8, i16 signext %13, i32 %18, i64 %23)
%25 = load i8**, i8*** %4
%26 = load i8*, i8** %25
%27 = bitcast i8* %26 to i64*
store i64 %24, i64* %27
ret i32 0
}

LLVM IR (-O2):
define i32 @f1_Skel(i32* nocapture readnone %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = bitcast i8** %6 to i16**
%8 = load i16*, i16** %7
%9 = load i16, i16* %8
%10 = getelementptr inbounds i8*, i8** %1, i64 3
%11 = bitcast i8** %10 to i32**
%12 = load i32*, i32** %11
%13 = load i32, i32* %12
%14 = getelementptr inbounds i8*, i8** %1, i64 4
%15 = bitcast i8** %14 to i64**
%16 = load i64*, i64** %15
%17 = load i64, i64* %16
%18 = tail call i64 @f1(i8 signext %5, i16 signext %9, i32 %13, i64 %17)
%19 = bitcast i8** %1 to i64**
%20 = load i64*, i64** %19
store i64 %18, i64* %20
ret i32 0
}
void TimerFlagStatusClear(unsigned long ulBase, unsigned long ulFlag) {

  ;

  ;
  (*((volatile unsigned long *)(ulBase + 0x00000010))) = ~ulFlag;
}


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

x86 assembly (clang, -O2):
<TimerFlagStatusClear>:
not    %rsi
mov    %rsi,0x10(%rdi)
ret

LLVM IR (-O0):
define void @TimerFlagStatusClear(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = xor i64 %5, -1
%7 = load i64, i64* %3
%8 = add i64 %7, 16
%9 = inttoptr i64 %8 to i64*
store volatile i64 %6, i64* %9
ret void
}

LLVM IR (-O2):
define void @TimerFlagStatusClear(i64 %0, i64 %1) {
%3 = xor i64 %1, -1
%4 = add i64 %0, 16
%5 = inttoptr i64 %4 to i64*
store volatile i64 %3, i64* %5
ret void
}
void swap_shdr(int *a, int count) {
  int i;
  for (i = 0; i < count; i++) {
    a[i] = (a[i]);
  }
}


x86 assembly (clang, -O0):
<swap_shdr>:
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    1142 <swap_shdr+0x42>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <swap_shdr+0x12>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @swap_shdr(i32* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int get_input(int *, int **);
int /*<<< orphan*/ quick_sort(int, int *);
int set_output(int *, int *);
int main(void) {
  int n = 0, *array;
  int err = get_input(&n, &array);
  quick_sort(n, array);
  err = !err ? set_output(&n, array) : err;
  free(array);
  return err;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <get_input@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <quick_sort@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1191 <main+0x51>
mov    -0x10(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   1040 <set_output@plt>
mov    %eax,-0x18(%rbp)
jmp    1197 <main+0x57>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1060 <get_input@plt>
mov    %eax,%ebx
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%rsi
call   1050 <quick_sort@plt>
test   %ebx,%ebx
jne    1181 <main+0x41>
mov    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdi
call   1040 <set_output@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i32 @get_input(i32* %2, i32** %3)
store i32 %5, i32* %4
%6 = load i32, i32* %2
%7 = load i32*, i32** %3
%8 = call i32 @quick_sort(i32 %6, i32* %7)
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %0
%12 = load i32*, i32** %3
%13 = call i32 @set_output(i32* %2, i32* %12)
br label %16
14: ; preds = %0
%15 = load i32, i32* %4
br label %16
16: ; preds = %14, %11
%17 = phi i32 [ %13, %11 ], [ %15, %14 ]
store i32 %17, i32* %4
%18 = load i32*, i32** %3
%19 = call i32 @free(i32* %18)
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32** %2 to i8*
%5 = call i32 @get_input(i32* %1, i32** %2)
%6 = load i32, i32* %1
%7 = load i32*, i32** %2
%8 = call i32 @quick_sort(i32 %6, i32* %7)
%9 = icmp eq i32 %5, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = load i32*, i32** %2
%12 = call i32 @set_output(i32* %1, i32* %11)
br label %13
13: ; preds = %0, %10
%14 = phi i32 [ %12, %10 ], [ %5, %0 ]
%15 = load i32*, i32** %2
%16 = call i32 @free(i32* %15)
ret i32 %14
}
const char *mvdu_color_mode_str(int color_mode) {
  switch (color_mode) {
  case 1:
    return "RGB565";
  case 2:
    return "RGBA5551";
  case 3:
    return "RGBA4444";
  default:
    return "<undefined>";
  }
}


x86 assembly (clang, -O0):
<mvdu_color_mode_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     113d <mvdu_color_mode_str+0x3d>
jmp    111b <mvdu_color_mode_str+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     114d <mvdu_color_mode_str+0x4d>
jmp    112c <mvdu_color_mode_str+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     115d <mvdu_color_mode_str+0x5d>
jmp    116d <mvdu_color_mode_str+0x6d>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <mvdu_color_mode_str+0x78>
lea    0xeb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <mvdu_color_mode_str+0x78>
lea    0xeac(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <mvdu_color_mode_str+0x78>
lea    0xea5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mvdu_color_mode_str>:
add    $0xffffffff,%edi
cmp    $0x2,%edi
ja     111a <mvdu_color_mode_str+0x1a>
movslq %edi,%rax
lea    0xf16(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xef8(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"RGB565\00"
@.str.1 = [9 x i8] c"RGBA5551\00"
@.str.2 = [9 x i8] c"RGBA4444\00"
@.str.3 = [12 x i8] c"<undefined>\00"
define i8* @mvdu_color_mode_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [7 x i8] c"RGB565\00"
@.str.1 = [9 x i8] c"RGBA5551\00"
@.str.2 = [9 x i8] c"RGBA4444\00"
@.str.3 = [12 x i8] c"<undefined>\00"
@reltable.mvdu_color_mode_str = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.mvdu_color_mode_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.mvdu_color_mode_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.mvdu_color_mode_str to i64)) to i32)]
define i8* @mvdu_color_mode_str(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.mvdu_color_mode_str to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), %1 ]
ret i8* %9
}
/* Type definitions */
struct cpumask {
  int dummy;
};

/* Variables and functions */
int smp_call_function_single(int /*<<< orphan*/, void (*)(void *), void *, int);
int smp_call_function_any(const struct cpumask *mask, void (*func)(void *info),
                          void *info, int wait) {
  return smp_call_function_single(0, func, info, wait);
}


x86 assembly (clang, -O0):
<smp_call_function_any>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
xor    %edi,%edi
call   1030 <smp_call_function_single@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.cpumask = type { i32 }
define i32 @smp_call_function_any(%struct.cpumask* %0, void (i8*)* %1, i8* %2, i32 %3) {
%5 = alloca %struct.cpumask*
%6 = alloca void (i8*)*
%7 = alloca i8*
%8 = alloca i32
store %struct.cpumask* %0, %struct.cpumask** %5
store void (i8*)* %1, void (i8*)** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load void (i8*)*, void (i8*)** %6
%10 = load i8*, i8** %7
%11 = load i32, i32* %8
%12 = call i32 @smp_call_function_single(i32 0, void (i8*)* %9, i8* %10, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
%struct.cpumask = type { i32 }
define i32 @smp_call_function_any(%struct.cpumask* nocapture readnone %0, void (i8*)* %1, i8* %2, i32 %3) {
%5 = tail call i32 @smp_call_function_single(i32 0, void (i8*)* %1, i8* %2, i32 %3)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ BIO;
typedef int /*<<< orphan*/ ASN1_ENUMERATED;

/* Variables and functions */
int i2a_ASN1_INTEGER(int /*<<< orphan*/ *, int /*<<< orphan*/ const *);
int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a) {
  return i2a_ASN1_INTEGER(bp, a);
}


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

x86 assembly (clang, -O2):
<i2a_ASN1_ENUMERATED>:
jmp    1030 <i2a_ASN1_INTEGER@plt>

LLVM IR (-O0):
define i32 @i2a_ASN1_ENUMERATED(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 = call i32 @i2a_ASN1_INTEGER(i32* %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @i2a_ASN1_ENUMERATED(i32* %0, i32* %1) {
%3 = tail call i32 @i2a_ASN1_INTEGER(i32* %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Platform_errch(int);
void Platform_errln(void) {
  Platform_errch(0x0d);
  Platform_errch(0x0a);
}


x86 assembly (clang, -O0):
<Platform_errln>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd,%edi
call   1030 <Platform_errch@plt>
mov    $0xa,%edi
call   1030 <Platform_errch@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Platform_errln>:
push   %rax
mov    $0xd,%edi
call   1030 <Platform_errch@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <Platform_errch@plt>

LLVM IR (-O0):
define void @Platform_errln() {
%1 = call i32 @Platform_errch(i32 13)
%2 = call i32 @Platform_errch(i32 10)
ret void
}

LLVM IR (-O2):
define void @Platform_errln() {
%1 = tail call i32 @Platform_errch(i32 13)
%2 = tail call i32 @Platform_errch(i32 10)
ret void
}
/* Variables and functions */
double asin(double);
double c_asin(double arg0) { return asin(arg0); }


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

x86 assembly (clang, -O2):
<c_asin>:
jmp    1030 <asin@plt>

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

LLVM IR (-O2):
define double @c_asin(double %0) {
%2 = tail call double @asin(double %0)
ret double %2
}
int main() { return 5 / 3; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
void bot_vector_scale_2d(double v[2], double s) {
  v[0] *= s;
  v[1] *= s;
}


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

x86 assembly (clang, -O2):
<bot_vector_scale_2d>:
movupd (%rdi),%xmm1
unpcklpd %xmm0,%xmm0
mulpd  %xmm1,%xmm0
movupd %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @bot_vector_scale_2d(double* %0, double %1) {
%3 = alloca double*
%4 = alloca double
store double* %0, double** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = fmul double %8, %5
store double %9, double* %7
%10 = load double, double* %4
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = fmul double %13, %10
store double %14, double* %12
ret void
}

LLVM IR (-O2):
define void @bot_vector_scale_2d(double* nocapture %0, double %1) {
%3 = bitcast double* %0 to <2 x double>*
%4 = load <2 x double>, <2 x double>* %3
%5 = insertelement <2 x double> poison, double %1, i64 0
%6 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> zeroinitializer
%7 = fmul <2 x double> %4, %6
%8 = bitcast double* %0 to <2 x double>*
store <2 x double> %7, <2 x double>* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_bingham_init();
int /*<<< orphan*/ test_bingham_sample(int, char **);
int main(int argc, char *argv[]) {
  test_bingham_init();
  test_bingham_sample(argc, argv);
  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)
mov    $0x0,%al
call   1040 <test_bingham_init@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_bingham_sample@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <test_bingham_init@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <test_bingham_sample@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
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 = call i32 (...) @test_bingham_init()
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @test_bingham_sample(i32 %7, i8** %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @test_bingham_init()
%4 = tail call i32 @test_bingham_sample(i32 %0, i8** %1)
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int send_event;
};
struct TYPE_4__ {
  TYPE_1__ xgraphicsexpose;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xgraphicsexpose_send_event(void *_p, int _v) {
  ((XEvent *)_p)->xgraphicsexpose.send_event = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XEvent_xgraphicsexpose_send_event>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xgraphicsexpose_send_event(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xgraphicsexpose_send_event(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
unsigned long long asm_rdtsc(void) {
  unsigned hi, lo;
  __asm__ __volatile__("rdtsc" : "=a"(lo), "=d"(hi));
  return ((unsigned long long)lo) | (((unsigned long long)hi) << 32);
}


x86 assembly (clang, -O0):
<asm_rdtsc>:
push   %rbp
mov    %rsp,%rbp
rdtsc
mov    %eax,-0x8(%rbp)
mov    %edx,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x20,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<asm_rdtsc>:
rdtsc
mov    %eax,%eax
shl    $0x20,%rdx
or     %rdx,%rax
ret

LLVM IR (-O0):
define i64 @asm_rdtsc() {
%1 = alloca i32
%2 = alloca i32
%3 = call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%4 = extractvalue { i32, i32 } %3, 0
%5 = extractvalue { i32, i32 } %3, 1
store i32 %4, i32* %2
store i32 %5, i32* %1
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = load i32, i32* %1
%9 = zext i32 %8 to i64
%10 = shl i64 %9, 32
%11 = or i64 %7, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @asm_rdtsc() {
%1 = tail call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = zext i32 %2 to i64
%5 = zext i32 %3 to i64
%6 = shl nuw i64 %5, 32
%7 = or i64 %6, %4
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ log_write(char *, int);
int log_erro(char *msg) { log_write(msg, 2); }


x86 assembly (clang, -O0):
<log_erro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1030 <log_write@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_erro>:
mov    $0x2,%esi
jmp    1030 <log_write@plt>

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

LLVM IR (-O2):
define i32 @log_erro(i8* %0) {
%2 = tail call i32 @log_write(i8* %0, i32 2)
ret i32 undef
}
int fun763() { return 763; }


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

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

LLVM IR (-O0):
define i32 @fun763() {
ret i32 763
}

LLVM IR (-O2):
define i32 @fun763() {
ret i32 763
}
/* Variables and functions */
int strlen(char *);
int my_strlen(char *str) {
  if (str == NULL) {
    return 0;
  }
  return strlen(str);
}


x86 assembly (clang, -O0):
<my_strlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <my_strlen+0x23>
movl   $0x0,-0x4(%rbp)
jmp    113f <my_strlen+0x2f>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strlen>:
test   %rdi,%rdi
je     111a <my_strlen+0xa>
jmp    1030 <strlen@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @my_strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ readUInt32(char const *);
const char *bsonValueToString(const void *valuePtr, uint8_t *len) {
  const char *valueBytes = (const char *)valuePtr;
  uint32_t stringLen = readUInt32(valueBytes);
  if (len) {
    *len = stringLen;
  }
  return valueBytes + 4;
}


x86 assembly (clang, -O0):
<bsonValueToString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <readUInt32@plt>
mov    %eax,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1148 <bsonValueToString+0x38>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bsonValueToString>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <readUInt32@plt>
test   %r14,%r14
je     1127 <bsonValueToString+0x17>
mov    %eax,(%r14)
add    $0x4,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @bsonValueToString(i8* %0, i32* writeonly %1) {
%3 = tail call i32 @readUInt32(i8* %0)
%4 = icmp eq i32* %1, null
br i1 %4, label %6, label %5
5: ; preds = %2
store i32 %3, i32* %1
br label %6
6: ; preds = %5, %2
%7 = getelementptr inbounds i8, i8* %0, i64 4
ret i8* %7
}
int interface() { return 42; }


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

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

LLVM IR (-O0):
define i32 @interface() {
ret i32 42
}

LLVM IR (-O2):
define i32 @interface() {
ret i32 42
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int main() {
  char c[32] = "passwd newpassword";
  system(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.c = [32 x i8] c"passwd newpassword\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i8]
store i32 0, i32* %1
%3 = bitcast [32 x i8]* %2 to i8*
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%5 = call i32 @system(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.c = [32 x i8] c"passwd newpassword\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = call i32 @system(i8* %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ vprintf(char const *, int /*<<< orphan*/);
void print_console(const char *format, va_list arguments) {
  vprintf(format, arguments);
  printf("\n");
}


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

x86 assembly (clang, -O2):
<print_console>:
push   %rax
call   1040 <vprintf@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @print_console(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @vprintf(i8* %0, i32 %1)
%4 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int print_aft_stats_log_mba(double *, int, int *);
int print_aft_stats_mba(double *vertex, int nt, int *tetra) {
  return print_aft_stats_log_mba(vertex, nt, tetra);
}


x86 assembly (clang, -O0):
<print_aft_stats_mba>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <print_aft_stats_log_mba@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_aft_stats_mba>:
jmp    1030 <print_aft_stats_log_mba@plt>

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

LLVM IR (-O2):
define i32 @print_aft_stats_mba(double* %0, i32 %1, i32* %2) {
%4 = tail call i32 @print_aft_stats_log_mba(double* %0, i32 %1, i32* %2)
ret i32 %4
}