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

/* Variables and functions */
char *asctime(int /*<<< orphan*/);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ const *);
char *ctime(const time_t *tim_p) { return asctime(localtime(tim_p)); }


x86 assembly (clang, -O0):
<ctime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctime>:
push   %rax
call   1030 <localtime@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <asctime@plt>

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

LLVM IR (-O2):
define i8* @ctime(i32* %0) {
%2 = tail call i32 @localtime(i32* %0)
%3 = tail call i8* @asctime(i32 %2)
ret i8* %3
}
int two() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @two() {
ret i32 1
}
/* Variables and functions */
unsigned int _readfsbase_u32();
unsigned int read_fs_base32(void) { return _readfsbase_u32(); }


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

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

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

LLVM IR (-O2):
define i32 @read_fs_base32() {
%1 = tail call i32 (...) @_readfsbase_u32()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("main is executing.\n"); }


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

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

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

LLVM IR (-O2):
@str = [19 x i8] c"main is executing.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ glutPostRedisplay();
void refreshDisplay(void) { glutPostRedisplay(); }


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

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

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

LLVM IR (-O2):
define void @refreshDisplay() {
%1 = tail call i32 (...) @glutPostRedisplay()
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ array_of_pointers();
int /*<<< orphan*/ printf(char *);
int main(int argc, char const *argv[]) {
  printf("================================\n");
  printf("ARRAYS #3\n");
  printf("================================\n");
  array_of_pointers();
  return EXIT_SUCCESS;
}


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)
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <array_of_pointers@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee2(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <array_of_pointers@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"================================\0A\00"
@.str.1 = [11 x i8] c"ARRAYS\0A\00"
@EXIT_SUCCESS = global i32 0
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 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @array_of_pointers()
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str.2 = [10 x i8] c"ARRAYS\00"
@str.3 = [33 x i8] c"================================\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
%6 = tail call i32 (...) @array_of_pointers()
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int truncate(const char *path, off_t length) {
  ;
  return -1;
}


x86 assembly (clang, -O0):
<truncate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @truncate(i8* nocapture readnone %0, i32 %1) {
ret i32 -1
}
void i2d_USERNOTICE(void) {}


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

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

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

LLVM IR (-O2):
define void @i2d_USERNOTICE() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void mov_reg64_preg64preg64pimm32(int reg1, int reg2, int reg3,
                                  unsigned int imm32) {
  put8(0x48);
  put8(0x8B);
  put8((reg1 << 3) | 0x84);
  put8(reg2 | (reg3 << 3));
  put32(imm32);
}


x86 assembly (clang, -O0):
<mov_reg64_preg64preg64pimm32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    $0x48,%edi
call   1030 <put8@plt>
mov    $0x8b,%edi
call   1030 <put8@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0x84,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%eax
shl    $0x3,%eax
or     %eax,%edi
call   1030 <put8@plt>
mov    -0x10(%rbp),%edi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mov_reg64_preg64preg64pimm32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r15d
mov    %edi,%ebx
mov    $0x48,%edi
call   1030 <put8@plt>
mov    $0x8b,%edi
call   1030 <put8@plt>
shl    $0x3,%ebx
or     $0x84,%ebx
mov    %ebx,%edi
call   1030 <put8@plt>
shl    $0x3,%ebp
or     %r15d,%ebp
mov    %ebp,%edi
call   1030 <put8@plt>
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @mov_reg64_preg64preg64pimm32(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = call i32 @put8(i32 72)
%10 = call i32 @put8(i32 139)
%11 = load i32, i32* %5
%12 = shl i32 %11, 3
%13 = or i32 %12, 132
%14 = call i32 @put8(i32 %13)
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = shl i32 %16, 3
%18 = or i32 %15, %17
%19 = call i32 @put8(i32 %18)
%20 = load i32, i32* %8
%21 = call i32 @put32(i32 %20)
ret void
}

LLVM IR (-O2):
define void @mov_reg64_preg64preg64pimm32(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @put8(i32 72)
%6 = tail call i32 @put8(i32 139)
%7 = shl i32 %0, 3
%8 = or i32 %7, 132
%9 = tail call i32 @put8(i32 %8)
%10 = shl i32 %2, 3
%11 = or i32 %10, %1
%12 = tail call i32 @put8(i32 %11)
%13 = tail call i32 @put32(i32 %3)
ret void
}
/* Variables and functions */
scalar_t__ cloudvpn_event_finish();
int /*<<< orphan*/ cloudvpn_finish_plugins();
int /*<<< orphan*/ cloudvpn_finish_pool();
scalar_t__ cloudvpn_scheduler_destroy();
int cloudvpn_core_finish() {
  cloudvpn_finish_pool();
  cloudvpn_finish_plugins();
  if (cloudvpn_scheduler_destroy())
    return 2;
  if (cloudvpn_event_finish())
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<cloudvpn_core_finish>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <cloudvpn_finish_pool@plt>
mov    $0x0,%al
call   1040 <cloudvpn_finish_plugins@plt>
mov    $0x0,%al
call   1060 <cloudvpn_scheduler_destroy@plt>
cmp    $0x0,%rax
je     1173 <cloudvpn_core_finish+0x33>
movl   $0x2,-0x4(%rbp)
jmp    1197 <cloudvpn_core_finish+0x57>
mov    $0x0,%al
call   1030 <cloudvpn_event_finish@plt>
cmp    $0x0,%rax
je     1190 <cloudvpn_core_finish+0x50>
movl   $0x1,-0x4(%rbp)
jmp    1197 <cloudvpn_core_finish+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cloudvpn_core_finish>:
push   %rax
xor    %eax,%eax
call   1050 <cloudvpn_finish_pool@plt>
xor    %eax,%eax
call   1040 <cloudvpn_finish_plugins@plt>
xor    %eax,%eax
call   1060 <cloudvpn_scheduler_destroy@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
je     1165 <cloudvpn_core_finish+0x25>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <cloudvpn_event_finish@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cloudvpn_core_finish() {
%1 = alloca i32
%2 = call i32 (...) @cloudvpn_finish_pool()
%3 = call i32 (...) @cloudvpn_finish_plugins()
%4 = call i64 (...) @cloudvpn_scheduler_destroy()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 2, i32* %1
br label %12
7: ; preds = %0
%8 = call i64 (...) @cloudvpn_event_finish()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 1, i32* %1
br label %12
11: ; preds = %7
store i32 0, i32* %1
br label %12
12: ; preds = %11, %10, %6
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @cloudvpn_core_finish() {
%1 = tail call i32 (...) @cloudvpn_finish_pool()
%2 = tail call i32 (...) @cloudvpn_finish_plugins()
%3 = tail call i64 (...) @cloudvpn_scheduler_destroy()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = tail call i64 (...) @cloudvpn_event_finish()
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %0
%10 = phi i32 [ 2, %0 ], [ %8, %5 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ getch();
int getfloat(double *);
int /*<<< orphan*/ printf(char *, double, int);
int main() {
  double a;
  a = 0.0;
  int b;
  b = getfloat(&a);
  printf("%.16f\n %d", a, b);
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <getfloat@plt>
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rdi
call   1040 <getfloat@plt>
movsd  (%rsp),%xmm0
lea    0xeb3(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%.16f\0A %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
store i32 0, i32* %1
store double 0.000000e+00, double* %2
%4 = call i32 @getfloat(double* %2)
store i32 %4, i32* %3
%5 = load double, double* %2
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %5, i32 %6)
%8 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%.16f\0A %d\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%3 = call i32 @getfloat(double* %1)
%4 = load double, double* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %4, i32 %3)
%6 = call i32 (...) @getch()
ret i32 0
}
/* Type definitions */
struct vec2i {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec2i_clamp(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *, int /*<<< orphan*/ *);
__attribute__((always_)) struct vec2i *psvec2i_clamp(struct vec2i *result,
                                                     struct vec2i *a,
                                                     struct vec2i *lower,
                                                     struct vec2i *higher) {
  vec2i_clamp((int32_t *)result, (int32_t *)a, (int32_t *)lower,
              (int32_t *)higher);
  return result;
}


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

x86 assembly (clang, -O2):
<psvec2i_clamp>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec2i_clamp@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec2i = type { i32 }
define %struct.vec2i* @psvec2i_clamp(%struct.vec2i* %0, %struct.vec2i* %1, %struct.vec2i* %2, %struct.vec2i* %3) {
%5 = alloca %struct.vec2i*
%6 = alloca %struct.vec2i*
%7 = alloca %struct.vec2i*
%8 = alloca %struct.vec2i*
store %struct.vec2i* %0, %struct.vec2i** %5
store %struct.vec2i* %1, %struct.vec2i** %6
store %struct.vec2i* %2, %struct.vec2i** %7
store %struct.vec2i* %3, %struct.vec2i** %8
%9 = load %struct.vec2i*, %struct.vec2i** %5
%10 = bitcast %struct.vec2i* %9 to i32*
%11 = load %struct.vec2i*, %struct.vec2i** %6
%12 = bitcast %struct.vec2i* %11 to i32*
%13 = load %struct.vec2i*, %struct.vec2i** %7
%14 = bitcast %struct.vec2i* %13 to i32*
%15 = load %struct.vec2i*, %struct.vec2i** %8
%16 = bitcast %struct.vec2i* %15 to i32*
%17 = call i32 @vec2i_clamp(i32* %10, i32* %12, i32* %14, i32* %16)
%18 = load %struct.vec2i*, %struct.vec2i** %5
ret %struct.vec2i* %18
}

LLVM IR (-O2):
%struct.vec2i = type { i32 }
define %struct.vec2i* @psvec2i_clamp(%struct.vec2i* returned %0, %struct.vec2i* %1, %struct.vec2i* %2, %struct.vec2i* %3) {
%5 = getelementptr %struct.vec2i, %struct.vec2i* %0, i64 0, i32 0
%6 = getelementptr %struct.vec2i, %struct.vec2i* %1, i64 0, i32 0
%7 = getelementptr %struct.vec2i, %struct.vec2i* %2, i64 0, i32 0
%8 = getelementptr %struct.vec2i, %struct.vec2i* %3, i64 0, i32 0
%9 = tail call i32 @vec2i_clamp(i32* %5, i32* %6, i32* %7, i32* %8)
ret %struct.vec2i* %0
}
/* Variables and functions */
int __builtin_ptx_read_ctaid_w();
int __builtin_ptx_read_ctaid_x();
int __builtin_ptx_read_ctaid_y();
int __builtin_ptx_read_ctaid_z();
__attribute__((device)) int read_ctaid() {
  int x = __builtin_ptx_read_ctaid_x();
  int y = __builtin_ptx_read_ctaid_y();
  int z = __builtin_ptx_read_ctaid_z();
  int w = __builtin_ptx_read_ctaid_w();
  return x + y + z + w;
}


x86 assembly (clang, -O0):
<read_ctaid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <__builtin_ptx_read_ctaid_x@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <__builtin_ptx_read_ctaid_y@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <__builtin_ptx_read_ctaid_z@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1060 <__builtin_ptx_read_ctaid_w@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_ctaid>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <__builtin_ptx_read_ctaid_x@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1050 <__builtin_ptx_read_ctaid_y@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <__builtin_ptx_read_ctaid_z@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <__builtin_ptx_read_ctaid_w@plt>
add    %r14d,%ebp
add    %ebx,%ebp
add    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @read_ctaid() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (...) @__builtin_ptx_read_ctaid_x()
store i32 %5, i32* %1
%6 = call i32 (...) @__builtin_ptx_read_ctaid_y()
store i32 %6, i32* %2
%7 = call i32 (...) @__builtin_ptx_read_ctaid_z()
store i32 %7, i32* %3
%8 = call i32 (...) @__builtin_ptx_read_ctaid_w()
store i32 %8, i32* %4
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %3
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %4
%15 = add nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @read_ctaid() {
%1 = tail call i32 (...) @__builtin_ptx_read_ctaid_x()
%2 = tail call i32 (...) @__builtin_ptx_read_ctaid_y()
%3 = tail call i32 (...) @__builtin_ptx_read_ctaid_z()
%4 = tail call i32 (...) @__builtin_ptx_read_ctaid_w()
%5 = add nsw i32 %2, %1
%6 = add nsw i32 %5, %3
%7 = add nsw i32 %6, %4
ret i32 %7
}
void mbc_mbc7_cleanup() {}


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

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

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

LLVM IR (-O2):
define void @mbc_mbc7_cleanup() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FSM_Test();
int main() { FSM_Test(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @FSM_Test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @FSM_Test()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ pmfHald(int, double, int, int, double *);
void pmfHald_R_wrapper(int *gen, double *mu, int *n, int *N0, double *prob) {
  pmfHald(*gen, *mu, *n, *N0, prob);
}


x86 assembly (clang, -O0):
<pmfHald_R_wrapper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    -0x28(%rbp),%rcx
call   1030 <pmfHald@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmfHald_R_wrapper>:
mov    (%rdi),%edi
movsd  (%rsi),%xmm0
mov    (%rdx),%esi
mov    (%rcx),%edx
mov    %r8,%rcx
jmp    1030 <pmfHald@plt>

LLVM IR (-O0):
define void @pmfHald_R_wrapper(i32* %0, double* %1, i32* %2, i32* %3, double* %4) {
%6 = alloca i32*
%7 = alloca double*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca double*
store i32* %0, i32** %6
store double* %1, double** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store double* %4, double** %10
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = load double*, double** %7
%14 = load double, double* %13
%15 = load i32*, i32** %8
%16 = load i32, i32* %15
%17 = load i32*, i32** %9
%18 = load i32, i32* %17
%19 = load double*, double** %10
%20 = call i32 @pmfHald(i32 %12, double %14, i32 %16, i32 %18, double* %19)
ret void
}

LLVM IR (-O2):
define void @pmfHald_R_wrapper(i32* nocapture %0, double* nocapture %1, i32* nocapture %2, i32* nocapture %3, double* %4) {
%6 = load i32, i32* %0
%7 = load double, double* %1
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = tail call i32 @pmfHald(i32 %6, double %7, i32 %8, i32 %9, double* %4)
ret void
}
/* Variables and functions */
double *getVector(double, double, double);
double *subVector(double *a, double *b) {
  return getVector(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
}


x86 assembly (clang, -O0):
<subVector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm2
call   1030 <getVector@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subVector>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
subsd  (%rsi),%xmm0
subsd  0x8(%rsi),%xmm1
movsd  0x10(%rdi),%xmm2
subsd  0x10(%rsi),%xmm2
jmp    1030 <getVector@plt>

LLVM IR (-O0):
define double* @subVector(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 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = fsub double %7, %10
%12 = load double*, double** %3
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = fsub double %14, %17
%19 = load double*, double** %3
%20 = getelementptr inbounds double, double* %19, i64 2
%21 = load double, double* %20
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = fsub double %21, %24
%26 = call double* @getVector(double %11, double %18, double %25)
ret double* %26
}

LLVM IR (-O2):
define double* @subVector(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fsub double %3, %4
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = fsub double %7, %9
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = fsub double %12, %14
%16 = tail call double* @getVector(double %5, double %10, double %15)
ret double* %16
}
/* Variables and functions */
int /*<<< orphan*/ Test4();
void Test3() { Test4(); }


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

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

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

LLVM IR (-O2):
define void @Test3() {
%1 = tail call i32 (...) @Test4()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
void handler1(int signo) {
  printf("in handler 1\n");
  fflush(NULL);
}


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

x86 assembly (clang, -O2):
<handler1>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"in handler 1\0A\00"
define void @handler1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @fflush(i32* null)
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"in handler 1\00"
define void @handler1(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @fflush(i32* null)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
void filecopy(FILE *ifp, FILE *ofp) {
  int c;
  while ((c = getc(ifp)) != EOF)
    (void)putc(c, ofp);
}


x86 assembly (clang, -O0):
<filecopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%eax
je     115c <filecopy+0x3c>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <putc@plt>
jmp    1130 <filecopy+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filecopy>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <getc@plt>
mov    0x2eb1(%rip),%r15
cmp    (%r15),%eax
je     1157 <filecopy+0x37>
nopl   0x0(%rax)
mov    %eax,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    (%r15),%eax
jne    1140 <filecopy+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @filecopy(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
br label %6
6: ; preds = %11, %2
%7 = load i32*, i32** %3
%8 = call i32 @getc(i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = load i32, i32* %5
%13 = load i32*, i32** %4
%14 = call i32 @putc(i32 %12, i32* %13)
br label %6
15: ; preds = %6
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @filecopy(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 @getc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %9, %6 ], [ %3, %2 ]
%8 = tail call i32 @putc(i32 %7, i32* %1)
%9 = tail call i32 @getc(i32* %0)
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
int do_289() { return 289; }


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

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

LLVM IR (-O0):
define i32 @do_289() {
ret i32 289
}

LLVM IR (-O2):
define i32 @do_289() {
ret i32 289
}
void rop3_31_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D | S;
  stk1 = T & stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_31_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_31_1_0>:
mov    (%rdi),%al
mov    %eax,%ecx
or     %sil,%cl
and    %dl,%cl
or     %sil,%cl
not    %cl
and    %sil,%al
or     %cl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_31_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = load i8, i8* %8
%19 = zext i8 %18 to i32
%20 = and i32 %17, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %7
%22 = load i8, i8* %7
%23 = zext i8 %22 to i32
%24 = xor i32 %23, -1
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = zext i8 %26 to i32
%28 = load i8, i8* %5
%29 = zext i8 %28 to i32
%30 = xor i32 %29, -1
%31 = and i32 %27, %30
%32 = load i8*, i8** %4
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = load i8, i8* %5
%36 = zext i8 %35 to i32
%37 = and i32 %34, %36
%38 = or i32 %31, %37
%39 = trunc i32 %38 to i8
%40 = load i8*, i8** %4
store i8 %39, i8* %40
ret void
}

LLVM IR (-O2):
define void @rop3_31_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %4, %1
%6 = and i8 %5, %2
%7 = or i8 %6, %1
%8 = xor i8 %7, -1
%9 = and i8 %4, %1
%10 = or i8 %9, %8
store i8 %10, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct fpga_connection {
  int dummy;
};
typedef int /*<<< orphan*/ data;

/* Variables and functions */
struct fpga_connection *fpga_open_connection(char *);
int /*<<< orphan*/ fpga_read_4k(struct fpga_connection *, int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  struct fpga_connection *c = fpga_open_connection("kosagi-fpga");
  int i;
  while (1) {
    uint8_t data[4096];
    fpga_read_4k(c, data);
    write(1, data, sizeof(data));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
call   1050 <fpga_open_connection@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x4020(%rbp),%rsi
call   1030 <fpga_read_4k@plt>
lea    -0x4020(%rbp),%rsi
mov    $0x1,%edi
mov    $0x4000,%edx
call   1040 <write@plt>
jmp    1159 <main+0x29>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x4008,%rsp
lea    0xebf(%rip),%rdi
call   1050 <fpga_open_connection@plt>
mov    %rax,%r14
mov    %rsp,%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <fpga_read_4k@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x4000,%edx
call   1040 <write@plt>
jmp    1150 <main+0x20>

LLVM IR (-O0):
%struct.fpga_connection = type { i32 }
@.str = [12 x i8] c"kosagi-fpga\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.fpga_connection*
%7 = alloca i32
%8 = alloca [4096 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call %struct.fpga_connection* @fpga_open_connection(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store %struct.fpga_connection* %9, %struct.fpga_connection** %6
br label %10
10: ; preds = %2, %10
%11 = load %struct.fpga_connection*, %struct.fpga_connection** %6
%12 = getelementptr inbounds [4096 x i32], [4096 x i32]* %8, i64 0, i64 0
%13 = call i32 @fpga_read_4k(%struct.fpga_connection* %11, i32* %12)
%14 = getelementptr inbounds [4096 x i32], [4096 x i32]* %8, i64 0, i64 0
%15 = call i32 @write(i32 1, i32* %14, i32 16384)
br label %10
}

LLVM IR (-O2):
%struct.fpga_connection = type { i32 }
@.str = [12 x i8] c"kosagi-fpga\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4096 x i32]
%4 = tail call %struct.fpga_connection* @fpga_open_connection(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = bitcast [4096 x i32]* %3 to i8*
%6 = getelementptr inbounds [4096 x i32], [4096 x i32]* %3, i64 0, i64 0
br label %7
7: ; preds = %7, %2
%8 = call i32 @fpga_read_4k(%struct.fpga_connection* %4, i32* %6)
%9 = call i32 @write(i32 1, i32* %6, i32 16384)
br label %7
}
int l(int n) { return n + n + 1; }


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

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

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

LLVM IR (-O2):
define i32 @l(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ put64(unsigned long long);
int /*<<< orphan*/ put8(int);
void mov_memoffs64_rax(unsigned long long *memoffs64) {
  put8(0x48);
  put8(0xA3);
  put64((unsigned long long)memoffs64);
}


x86 assembly (clang, -O0):
<mov_memoffs64_rax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x48,%edi
call   1030 <put8@plt>
mov    $0xa3,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%rdi
call   1040 <put64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mov_memoffs64_rax>:
push   %rbx
mov    %rdi,%rbx
mov    $0x48,%edi
call   1030 <put8@plt>
mov    $0xa3,%edi
call   1030 <put8@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <put64@plt>

LLVM IR (-O0):
define void @mov_memoffs64_rax(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = call i32 @put8(i32 72)
%4 = call i32 @put8(i32 163)
%5 = load i64*, i64** %2
%6 = ptrtoint i64* %5 to i64
%7 = call i32 @put64(i64 %6)
ret void
}

LLVM IR (-O2):
define void @mov_memoffs64_rax(i64* %0) {
%2 = tail call i32 @put8(i32 72)
%3 = tail call i32 @put8(i32 163)
%4 = ptrtoint i64* %0 to i64
%5 = tail call i32 @put64(i64 %4)
ret void
}
int hammingDistance(int x, int y) {
  int z = x ^ y;
  int d = 0;
  while (z) {
    ++d;
    z &= z - 1;
  }
  return d;
}


x86 assembly (clang, -O0):
<hammingDistance>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113e <hammingDistance+0x3e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
and    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    111a <hammingDistance+0x1a>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hammingDistance>:
xor    %eax,%eax
xor    %esi,%edi
je     111c <hammingDistance+0x1c>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%eax
lea    -0x1(%rdi),%ecx
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <hammingDistance+0x10>
ret

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

LLVM IR (-O2):
define i32 @hammingDistance(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ 0, %2 ]
%7 = phi i32 [ %10, %5 ], [ %3, %2 ]
%8 = add nuw nsw i32 %6, 1
%9 = add nsw i32 %7, -1
%10 = and i32 %9, %7
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = phi i32 [ 0, %2 ], [ %8, %5 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ RandomToggle();
void RandomBoard(short n) {
  while (n > 0) {
    RandomToggle();
    n--;
  }
}


x86 assembly (clang, -O0):
<RandomBoard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x0,%eax
jle    1144 <RandomBoard+0x34>
mov    $0x0,%al
call   1030 <RandomToggle@plt>
mov    -0x2(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x2(%rbp)
jmp    111f <RandomBoard+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomBoard>:
push   %rbx
mov    %edi,%ebx
test   %bx,%bx
jle    1130 <RandomBoard+0x20>
add    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <RandomToggle@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%bx
ja     1120 <RandomBoard+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @RandomBoard(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
br label %3
3: ; preds = %7, %1
%4 = load i16, i16* %2
%5 = sext i16 %4 to i32
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = call i32 (...) @RandomToggle()
%9 = load i16, i16* %2
%10 = add i16 %9, -1
store i16 %10, i16* %2
br label %3
11: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @RandomBoard(i16 signext %0) {
%2 = icmp sgt i16 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i16 [ %6, %3 ], [ %0, %1 ]
%5 = tail call i32 (...) @RandomToggle()
%6 = add nsw i16 %4, -1
%7 = icmp ugt i16 %4, 1
br i1 %7, label %3, label %8
8: ; preds = %3, %1
ret void
}
int swap_num(int *a, int *b) {
  int t;
  t = *a;
  *a = *b;
  *b = t;
}


x86 assembly (clang, -O0):
<swap_num>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @swap_num(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret i32 undef
}
/* Variables and functions */
void **_zero_arr_plus_voidstar_fn(void **, int, int, char const *,
                                  unsigned int);
void **_zero_arr_inplace_plus_post_voidstar_fn(void ***x, int orig_i,
                                               const char *filename,
                                               unsigned lineno) {
  void **_zap_res = *x;
  *x = _zero_arr_plus_voidstar_fn(_zap_res, 1, orig_i, filename, lineno);
  return _zap_res;
}


x86 assembly (clang, -O0):
<_zero_arr_inplace_plus_post_voidstar_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    $0x1,%esi
call   1030 <_zero_arr_plus_voidstar_fn@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_zero_arr_inplace_plus_post_voidstar_fn>:
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rbx
mov    (%rdi),%r14
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <_zero_arr_plus_voidstar_fn@plt>
mov    %rax,(%rbx)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8** @_zero_arr_inplace_plus_post_voidstar_fn(i8*** %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8***
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8**
store i8*** %0, i8**** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i8***, i8**** %5
%11 = load i8**, i8*** %10
store i8** %11, i8*** %9
%12 = load i8**, i8*** %9
%13 = load i32, i32* %6
%14 = load i8*, i8** %7
%15 = load i32, i32* %8
%16 = call i8** @_zero_arr_plus_voidstar_fn(i8** %12, i32 1, i32 %13, i8* %14, i32 %15)
%17 = load i8***, i8**** %5
store i8** %16, i8*** %17
%18 = load i8**, i8*** %9
ret i8** %18
}

LLVM IR (-O2):
define i8** @_zero_arr_inplace_plus_post_voidstar_fn(i8*** nocapture %0, i32 %1, i8* %2, i32 %3) {
%5 = load i8**, i8*** %0
%6 = tail call i8** @_zero_arr_plus_voidstar_fn(i8** %5, i32 1, i32 %1, i8* %2, i32 %3)
store i8** %6, i8*** %0
ret i8** %5
}
int _sys_current_irq_key_get(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @_sys_current_irq_key_get() {
ret i32 0
}

LLVM IR (-O2):
define i32 @_sys_current_irq_key_get() {
ret i32 0
}
signed long _slong(signed long x) { return x; }


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

x86 assembly (clang, -O2):
<_slong>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @_slong(i64 returned %0) {
ret i64 %0
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_size;
};
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
scalar_t__ fstat(int, struct stat *);
int /*<<< orphan*/ seek_filesize(int);
off_t filesize(int f) {
  struct stat statbuf;
  if (fstat(f, &statbuf) >= 0)
    return (statbuf.st_size);
  return (seek_filesize(f));
}


x86 assembly (clang, -O0):
<filesize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <fstat@plt>
cmp    $0x0,%rax
jl     114c <filesize+0x2c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1157 <filesize+0x37>
mov    -0x8(%rbp),%edi
call   1030 <seek_filesize@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filesize>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0x8(%rsp),%rsi
call   1040 <fstat@plt>
test   %rax,%rax
js     1140 <filesize+0x20>
mov    0x8(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    %ebx,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <seek_filesize@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @filesize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.stat
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i64 @fstat(i32 %5, %struct.stat* %4)
%7 = icmp sge i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %2
br label %14
11: ; preds = %1
%12 = load i32, i32* %3
%13 = call i32 @seek_filesize(i32 %12)
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @filesize(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp sgt i64 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
br label %11
9: ; preds = %1
%10 = tail call i32 @seek_filesize(i32 %0)
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ %8, %6 ], [ %10, %9 ]
ret i32 %12
}
/* Type definitions */
struct event {
  int dummy;
};

/* Variables and functions */
int event_open_with_options(struct event *, int, int, int);
int event_open_with_cpu(struct event *e, int cpu) {
  return event_open_with_options(e, -1, cpu, -1);
}


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

x86 assembly (clang, -O2):
<event_open_with_cpu>:
mov    %esi,%edx
mov    $0xffffffff,%esi
mov    $0xffffffff,%ecx
jmp    1030 <event_open_with_options@plt>

LLVM IR (-O0):
%struct.event = type { i32 }
define i32 @event_open_with_cpu(%struct.event* %0, i32 %1) {
%3 = alloca %struct.event*
%4 = alloca i32
store %struct.event* %0, %struct.event** %3
store i32 %1, i32* %4
%5 = load %struct.event*, %struct.event** %3
%6 = load i32, i32* %4
%7 = call i32 @event_open_with_options(%struct.event* %5, i32 -1, i32 %6, i32 -1)
ret i32 %7
}

LLVM IR (-O2):
%struct.event = type { i32 }
define i32 @event_open_with_cpu(%struct.event* %0, i32 %1) {
%3 = tail call i32 @event_open_with_options(%struct.event* %0, i32 -1, i32 %1, i32 -1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *program) {
  printf("%s soubor_s_programem_v_ifj06\n", program);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [31 x i8] c"%s soubor_s_programem_v_ifj06\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
unsigned int hash(char *s) {
  unsigned int h = 0;
  for (; *s; s++)
    h = *s + h * 31;
  return h % 101;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113d <hash+0x3d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x65,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1147 <hash+0x47>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
mov    %eax,%ecx
imul   $0x446f8657,%rcx,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x6,%edx
imul   $0x65,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 31
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 101
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}