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

/* Variables and functions */
int /*<<< orphan*/ __copy_str(char *, char *);
int /*<<< orphan*/ memset(char *, char, int);
void __copy_arg2buf(char *argv) {
  char buffer[256];
  memset(buffer, '\0', sizeof(buffer));
  __copy_str(buffer, argv);
}


x86 assembly (clang, -O0):
<__copy_arg2buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <__copy_str@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__copy_arg2buf>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <__copy_str@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @__copy_arg2buf(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i8 signext 0, i32 256)
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 @__copy_str(i8* %6, i8* %7)
ret void
}

LLVM IR (-O2):
define void @__copy_arg2buf(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i8 signext 0, i32 256)
%5 = call i32 @__copy_str(i8* %3, i8* %0)
ret void
}
int cpu_to_node(int cpu) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @cpu_to_node(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XSetClassHint() {
  printf("XSetClassHint called\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [21 x i8] c"XSetClassHint called\00"
define i32 @XSetClassHint() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
void *__coverity_alloc__(int);
int /*<<< orphan*/ __coverity_mark_as_afm_allocated__(void *, char *);
void *H5Pcreate(void *cls_id) {
  void *id = __coverity_alloc__(10);
  __coverity_mark_as_afm_allocated__(id, "H5Pclose");
  return id;
}


x86 assembly (clang, -O0):
<H5Pcreate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xa,%edi
call   1040 <__coverity_alloc__@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xebb(%rip),%rsi
call   1030 <__coverity_mark_as_afm_allocated__@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<H5Pcreate>:
push   %rbx
mov    $0xa,%edi
call   1040 <__coverity_alloc__@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rsi
mov    %rax,%rdi
call   1030 <__coverity_mark_as_afm_allocated__@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"H5Pclose\00"
define i8* @H5Pcreate(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i8* @__coverity_alloc__(i32 10)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @__coverity_mark_as_afm_allocated__(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %3
ret i8* %7
}

LLVM IR (-O2):
@.str = [9 x i8] c"H5Pclose\00"
define i8* @H5Pcreate(i8* nocapture readnone %0) {
%2 = tail call i8* @__coverity_alloc__(i32 10)
%3 = tail call i32 @__coverity_mark_as_afm_allocated__(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *pthread_setschedprio;
int main(int argc, char *argv[]) {
  void *p;
  (void)argc;
  (void)argv;
  p = pthread_setschedprio;
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb3(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@pthread_setschedprio = global i8* null
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = load i8*, i8** @pthread_setschedprio
store i8* %9, i8** %6
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@pthread_setschedprio = global i8* null
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t hex_c(uint8_t n) {
  n -= '0';
  if (n > 9)
    n -= 7;
  n &= 0x0F;
  return n;
}


x86 assembly (clang, -O0):
<hex_c>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jle    1123 <hex_c+0x23>
mov    -0x4(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_c>:
lea    0x39(%rdi),%eax
cmp    $0x3a,%edi
cmovl  %edi,%eax
and    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @hex_c(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 48
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 9
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 7
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %1
%11 = load i32, i32* %2
%12 = and i32 %11, 15
store i32 %12, i32* %2
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @hex_c(i32 %0) {
%2 = icmp sgt i32 %0, 57
%3 = select i1 %2, i32 57, i32 0
%4 = add i32 %3, %0
%5 = and i32 %4, 15
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  printf("s: ");
  char a;
  scanf("%c", &a);
  printf("%c", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%esi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"s: \00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = call i32 @putchar(i32 %5)
ret i32 0
}
int CRYPTO_is_mem_check_on(void) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @CRYPTO_is_mem_check_on() {
ret i32 0
}
int function_A(int p, int q) {
  int c = p + q;
  return c;
}


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

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

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

LLVM IR (-O2):
define i32 @function_A(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Type definitions */
struct map_node {
  int dummy;
};
struct map {
  int dummy;
};

/* Variables and functions */
struct map_node *map_end(struct map *map) {
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.map_node = type { i32 }
%struct.map = type { i32 }
define %struct.map_node* @map_end(%struct.map* %0) {
%2 = alloca %struct.map*
store %struct.map* %0, %struct.map** %2
ret %struct.map_node* null
}

LLVM IR (-O2):
%struct.map_node = type { i32 }
%struct.map = type { i32 }
define noalias %struct.map_node* @map_end(%struct.map* nocapture readnone %0) {
ret %struct.map_node* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, char const *);
double gouble(double d, const char *foo) {
  printf("double is %f with label %s\n", d, foo);
  return 5.5;
}


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

x86 assembly (clang, -O2):
<gouble>:
push   %rax
mov    %rdi,%rsi
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
movsd  0xed8(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [28 x i8] c"double is %f with label %s\0A\00"
define double @gouble(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
store double %0, double* %3
store i8* %1, i8** %4
%5 = load double, double* %3
%6 = load i8*, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %5, i8* %6)
ret double 5.500000e+00
}

LLVM IR (-O2):
@.str = [28 x i8] c"double is %f with label %s\0A\00"
define double @gouble(double %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %0, i8* %1)
ret double 5.500000e+00
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void h264nal_set_type(uint8_t *p_h264nal, uint8_t type) {
  p_h264nal[3] &= 0xe0;
  p_h264nal[3] |= type;
}


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

x86 assembly (clang, -O2):
<h264nal_set_type>:
mov    $0xe0,%eax
and    0xc(%rdi),%eax
or     %esi,%eax
mov    %eax,0xc(%rdi)
ret

LLVM IR (-O0):
define void @h264nal_set_type(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 = getelementptr inbounds i32, i32* %5, i64 3
%7 = load i32, i32* %6
%8 = and i32 %7, 224
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 3
%12 = load i32, i32* %11
%13 = or i32 %12, %9
store i32 %13, i32* %11
ret void
}

LLVM IR (-O2):
define void @h264nal_set_type(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 3
%4 = load i32, i32* %3
%5 = and i32 %4, 224
%6 = or i32 %5, %1
store i32 %6, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int, int, int);
void foo(int a, int b, int c, int d, int e, int f, int g, int h) {
  printf("%d, %d, %d, %d, %d, %d, %d, %d\n", a, b, c, d, e, f, g, h);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%r11d
mov    0x10(%rbp),%r10d
mov    0x18(%rbp),%eax
lea    0xeab(%rip),%rdi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    %r9d,%eax
mov    %r8d,%r9d
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    0x10(%rsp),%r10d
mov    0x18(%rsp),%r11d
sub    $0x8,%rsp
lea    0xecb(%rip),%rdi
push   %r11
push   %r10
push   %rax
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rax
ret

LLVM IR (-O0):
@.str = [32 x i8] c"%d, %d, %d, %d, %d, %d, %d, %d\0A\00"
define void @foo(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = load i32, i32* %11
%20 = load i32, i32* %12
%21 = load i32, i32* %13
%22 = load i32, i32* %14
%23 = load i32, i32* %15
%24 = load i32, i32* %16
%25 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18, i32 %19, i32 %20, i32 %21, i32 %22, i32 %23, i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"%d, %d, %d, %d, %d, %d, %d, %d\0A\00"
define void @foo(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ prg8setBank0(int);
void namco_setParamsE0XX(uint16_t addr, uint8_t val) {
  (void)addr;
  prg8setBank0((val & 0x3F) << 13);
}


x86 assembly (clang, -O0):
<namco_setParamsE0XX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
and    $0x3f,%edi
shl    $0xd,%edi
call   1030 <prg8setBank0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<namco_setParamsE0XX>:
mov    %esi,%edi
and    $0x3f,%edi
shl    $0xd,%edi
jmp    1030 <prg8setBank0@plt>

LLVM IR (-O0):
define void @namco_setParamsE0XX(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 = and i32 %6, 63
%8 = shl i32 %7, 13
%9 = call i32 @prg8setBank0(i32 %8)
ret void
}

LLVM IR (-O2):
define void @namco_setParamsE0XX(i32 %0, i32 %1) {
%3 = shl i32 %1, 13
%4 = and i32 %3, 516096
%5 = tail call i32 @prg8setBank0(i32 %4)
ret void
}
void polymode_(onoff) int *onoff;
{ polymode((long)*onoff); }


x86 assembly (clang, -O0):
<polymode_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rdi
mov    $0x0,%al
call   1030 <polymode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polymode_>:
movslq (%rdi),%rdi
xor    %eax,%eax
jmp    1030 <polymode@plt>

LLVM IR (-O0):
define void @polymode_(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
%6 = call i32 (i64, ...) bitcast (i32 (...)* @polymode to i32 (i64, ...)*)(i64 %5)
ret void
}

LLVM IR (-O2):
define void @polymode_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = sext i32 %2 to i64
%4 = tail call i32 (i64, ...) bitcast (i32 (...)* @polymode to i32 (i64, ...)*)(i64 %3)
ret void
}
/* Type definitions */
struct jit_state {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ emit4(struct jit_state *, int /*<<< orphan*/);
int /*<<< orphan*/ emit_alu64(struct jit_state *, int, int, int);
void emit_alu64_imm32(struct jit_state *state, int op, int src, int dst,
                      int32_t imm) {
  emit_alu64(state, op, src, dst);
  emit4(state, imm);
}


x86 assembly (clang, -O0):
<emit_alu64_imm32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <emit_alu64@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1040 <emit4@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_alu64_imm32>:
push   %rbp
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    %rdi,%rbx
call   1030 <emit_alu64@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <emit4@plt>

LLVM IR (-O0):
%struct.jit_state = type { i32 }
define void @emit_alu64_imm32(%struct.jit_state* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.jit_state*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.jit_state* %0, %struct.jit_state** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.jit_state*, %struct.jit_state** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = call i32 @emit_alu64(%struct.jit_state* %11, i32 %12, i32 %13, i32 %14)
%16 = load %struct.jit_state*, %struct.jit_state** %6
%17 = load i32, i32* %10
%18 = call i32 @emit4(%struct.jit_state* %16, i32 %17)
ret void
}

LLVM IR (-O2):
%struct.jit_state = type { i32 }
define void @emit_alu64_imm32(%struct.jit_state* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @emit_alu64(%struct.jit_state* %0, i32 %1, i32 %2, i32 %3)
%7 = tail call i32 @emit4(%struct.jit_state* %0, i32 %4)
ret void
}
/* Variables and functions */
double dsfmt_gv_genrand_close_open();
double unif_rand(void) { return dsfmt_gv_genrand_close_open(); }


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

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

LLVM IR (-O0):
define double @unif_rand() {
%1 = call double (...) @dsfmt_gv_genrand_close_open()
ret double %1
}

LLVM IR (-O2):
define double @unif_rand() {
%1 = tail call double (...) @dsfmt_gv_genrand_close_open()
ret double %1
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void zcfree(void *opaque, void *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<zcfree>:
mov    %rsi,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @zcfree(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @zcfree(i8* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i32 @free(i8* %1)
ret void
}
void gtk_widget_get_clipboard() {}


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

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

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

LLVM IR (-O2):
define void @gtk_widget_get_clipboard() {
ret void
}
int do_996() { return 996; }


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

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

LLVM IR (-O0):
define i32 @do_996() {
ret i32 996
}

LLVM IR (-O2):
define i32 @do_996() {
ret i32 996
}
/* Variables and functions */
double exp(double);
int pow(double, int);
double rho(double r) {
  return ((3.48734 * exp(-4.746728 * (r / 2.74084 - 1.))) /
          (1. + pow(r / 2.74084 - 0.278417, 20.)));
}


x86 assembly (clang, -O0):
<rho>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xed6(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xeba(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xeb2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    $0x14,%edi
call   1040 <pow@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  0xe59(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rho>:
sub    $0x18,%rsp
movapd %xmm0,%xmm1
divsd  0xed0(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xec6(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xec1(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xeb5(%rip),%xmm0
mov    $0x14,%edi
call   1040 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  0xea4(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @rho(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 2.740840e+00
%5 = fsub double %4, 1.000000e+00
%6 = fmul double 0xC012FCA643CC07AB, %5
%7 = call double @exp(double %6)
%8 = fmul double 3.487340e+00, %7
%9 = load double, double* %2
%10 = fdiv double %9, 2.740840e+00
%11 = fsub double %10, 2.784170e-01
%12 = call i32 @pow(double %11, i32 20)
%13 = sitofp i32 %12 to double
%14 = fadd double 1.000000e+00, %13
%15 = fdiv double %8, %14
ret double %15
}

LLVM IR (-O2):
define double @rho(double %0) {
%2 = fdiv double %0, 2.740840e+00
%3 = fadd double %2, -1.000000e+00
%4 = fmul double %3, 0xC012FCA643CC07AB
%5 = tail call double @exp(double %4)
%6 = fmul double %5, 3.487340e+00
%7 = fadd double %2, -2.784170e-01
%8 = tail call i32 @pow(double %7, i32 20)
%9 = sitofp i32 %8 to double
%10 = fadd double %9, 1.000000e+00
%11 = fdiv double %6, %10
ret double %11
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ _unsupported();
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
                   void *(*start_routine)(void *), void *arg) {
  _unsupported();
  return -1;
}


x86 assembly (clang, -O0):
<pthread_create>:
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    $0x0,%al
call   1030 <_unsupported@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_create>:
push   %rax
xor    %eax,%eax
call   1030 <_unsupported@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @pthread_create(i32* nocapture readnone %0, i32* nocapture readnone %1, i8* (i8*)* nocapture readnone %2, i8* nocapture readnone %3) {
%5 = tail call i32 (...) @_unsupported()
ret i32 -1
}
int ffs(int i) { return (__builtin_ffs(i)); }


x86 assembly (clang, -O0):
<ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
bsf    %edx,%eax
add    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs>:
bsf    %edi,%ecx
mov    $0xffffffff,%eax
cmovne %ecx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ffs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.cttz.i32(i32 %3, i1 true)
%5 = add i32 %4, 1
%6 = icmp eq i32 %3, 0
%7 = select i1 %6, i32 0, i32 %5
ret i32 %7
}

LLVM IR (-O2):
define i32 @ffs(i32 %0) {
%2 = tail call i32 @llvm.cttz.i32(i32 %0, i1 true)
%3 = add nuw nsw i32 %2, 1
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i32 0, i32 %3
ret i32 %5
}
/* Variables and functions */
void pwc_dec1_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @pwc_dec1_exit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __m_sort(int *, int /*<<< orphan*/, int);
void merge_sort(int *a, int n) { __m_sort(a, 0, n - 1); }


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

x86 assembly (clang, -O2):
<merge_sort>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <__m_sort@plt>

LLVM IR (-O0):
define void @merge_sort(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 = sub nsw i32 %6, 1
%8 = call i32 @__m_sort(i32* %5, i32 0, i32 %7)
ret void
}

LLVM IR (-O2):
define void @merge_sort(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @__m_sort(i32* %0, i32 0, i32 %3)
ret void
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
int stat(char const *, struct stat *);
int zfile_get_size(const char *filename) {
  struct stat st;
  if (stat(filename, &st) == -1) {
    return -1;
  }
  return st.st_size;
}


x86 assembly (clang, -O0):
<zfile_get_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0xffffffff,%eax
jne    113e <zfile_get_size+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1144 <zfile_get_size+0x34>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zfile_get_size>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
cmp    $0xffffffff,%eax
je     1121 <zfile_get_size+0x11>
mov    (%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @zfile_get_size(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
int shlibtest(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @shlibtest() {
ret i32 1
}
void testfn(struct mmc_host *mmc) {
  printk("%s %d %s \n", __FUNCTION__, 313, mmc_hostname(mmc));
}


x86 assembly (clang, -O0):
<testfn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <mmc_hostname@plt>
mov    %eax,%ecx
lea    0xec0(%rip),%rdi
lea    0xec4(%rip),%rsi
mov    $0x139,%edx
mov    $0x0,%al
call   1030 <printk@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testfn>:
push   %rax
xor    %eax,%eax
call   1040 <mmc_hostname@plt>
lea    0xed1(%rip),%rdi
lea    0xed5(%rip),%rsi
mov    $0x139,%edx
mov    %eax,%ecx
xor    %eax,%eax
pop    %r8
jmp    1030 <printk@plt>

LLVM IR (-O0):
%struct.mmc_host = type opaque
@.str = [11 x i8] c"%s %d %s \0A\00"
@__FUNCTION__.testfn = [7 x i8] c"testfn\00"
define void @testfn(%struct.mmc_host* %0) {
%2 = alloca %struct.mmc_host*
store %struct.mmc_host* %0, %struct.mmc_host** %2
%3 = load %struct.mmc_host*, %struct.mmc_host** %2
%4 = call i32 (%struct.mmc_host*, ...) bitcast (i32 (...)* @mmc_hostname to i32 (%struct.mmc_host*, ...)*)(%struct.mmc_host* %3)
%5 = call i32 (i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @printk to i32 (i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__FUNCTION__.testfn, i64 0, i64 0), i32 313, i32 %4)
ret void
}

LLVM IR (-O2):
%struct.mmc_host = type opaque
@.str = [11 x i8] c"%s %d %s \0A\00"
@__FUNCTION__.testfn = [7 x i8] c"testfn\00"
define void @testfn(%struct.mmc_host* %0) {
%2 = tail call i32 (%struct.mmc_host*, ...) bitcast (i32 (...)* @mmc_hostname to i32 (%struct.mmc_host*, ...)*)(%struct.mmc_host* %0)
%3 = tail call i32 (i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @printk to i32 (i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__FUNCTION__.testfn, i64 0, i64 0), i32 313, i32 %2)
ret void
}
int ft_is_whitespace(char const c) {
  if (c == '\n' || c == '\t' || c == ' ')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_is_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     1131 <ft_is_whitespace+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
je     1131 <ft_is_whitespace+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    113d <ft_is_whitespace+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1144 <ft_is_whitespace+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_is_whitespace>:
cmp    $0x20,%dil
ja     1120 <ft_is_whitespace+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100000600,%rdx
bt     %rcx,%rdx
jae    1120 <ft_is_whitespace+0x20>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ft_is_whitespace(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 10
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 9
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %16
15: ; preds = %11, %7, %1
store i32 1, i32* %2
br label %17
16: ; preds = %11
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @ft_is_whitespace(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %3
i8 10, label %3
i8 9, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
double sphereVolume(double radius) {
  double volume;
  const double PI = 3.14159265359;
  double fraction = 4.0 / 3;
  asm("fldpi \n"
      "fldl %[fraction] \n"
      "fmulp \n"
      "fldl %[radius] \n"
      "fmulp \n"
      "fldl %[radius] \n"
      "fmulp \n"
      "fldl %[radius] \n"
      "fmulp \n"
      "fstpl %[volume] \n"
      : [volume] "=m"(volume)
      : [radius] "m"(radius), [fraction] "m"(fraction)
      :);
  return volume;
}


x86 assembly (clang, -O0):
<sphereVolume>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xee2(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
fldpi
fldl   -0x20(%rbp)
fmulp  %st,%st(1)
fldl   -0x8(%rbp)
fmulp  %st,%st(1)
fldl   -0x8(%rbp)
fmulp  %st,%st(1)
fldl   -0x8(%rbp)
fmulp  %st,%st(1)
fstpl  -0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sphereVolume>:
movsd  %xmm0,-0x8(%rsp)
movabs $0x3ff5555555555555,%rax
55 f5 3f
mov    %rax,-0x18(%rsp)
fldpi
fldl   -0x18(%rsp)
fmulp  %st,%st(1)
fldl   -0x8(%rsp)
fmulp  %st,%st(1)
fldl   -0x8(%rsp)
fmulp  %st,%st(1)
fldl   -0x8(%rsp)
fmulp  %st,%st(1)
fstpl  -0x10(%rsp)
movsd  -0x10(%rsp),%xmm0
ret

LLVM IR (-O0):
define double @sphereVolume(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %2
store double 0x400921FB54442EEA, double* %4
store double 0x3FF5555555555555, double* %5
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
define double @sphereVolume(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = bitcast double* %3 to i8*
%6 = bitcast double* %4 to i8*
store double 0x3FF5555555555555, double* %4
%7 = load double, double* %3
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ udelay(int);
void yield(void) { udelay(1); }


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

x86 assembly (clang, -O2):
<yield>:
mov    $0x1,%edi
jmp    1030 <udelay@plt>

LLVM IR (-O0):
define void @yield() {
%1 = call i32 @udelay(i32 1)
ret void
}

LLVM IR (-O2):
define void @yield() {
%1 = tail call i32 @udelay(i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
void *mem_get(void *mem_pool, uint16_t mem_size, uint16_t index) {
  return ((void *)((uint8_t *)mem_pool + (mem_size * index)));
}


x86 assembly (clang, -O0):
<mem_get>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_get>:
imul   %edx,%esi
movslq %esi,%rax
lea    (%rdi,%rax,4),%rax
ret

LLVM IR (-O0):
define i8* @mem_get(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 i8*, i8** %4
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = mul nsw i32 %9, %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %8, i64 %12
%14 = bitcast i32* %13 to i8*
ret i8* %14
}

LLVM IR (-O2):
define i8* @mem_get(i8* readnone %0, i32 %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
%5 = mul nsw i32 %2, %1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %4, i64 %6
%8 = bitcast i32* %7 to i8*
ret i8* %8
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int x;
  int y;
  x = __VERIFIER_nondet_int();
  y = __VERIFIER_nondet_int();
  while (x == y && x > 0) {
    while (y > 0) {
      x = x - 1;
      y = y - 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0xd(%rbp)
jne    114e <main+0x3e>
cmpl   $0x0,-0x8(%rbp)
setg   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    115e <main+0x4e>
jmp    1189 <main+0x79>
jmp    1163 <main+0x53>
cmpl   $0x0,-0xc(%rbp)
jle    1184 <main+0x74>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <main+0x53>
jmp    1133 <main+0x23>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %2
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %3
br label %6
6: ; preds = %24, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br label %13
13: ; preds = %10, %6
%14 = phi i1 [ false, %6 ], [ %12, %10 ]
br i1 %14, label %15, label %25
15: ; preds = %13
br label %16
16: ; preds = %19, %15
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* %2
%21 = sub nsw i32 %20, 1
store i32 %21, i32* %2
%22 = load i32, i32* %3
%23 = sub nsw i32 %22, 1
store i32 %23, i32* %3
br label %16
24: ; preds = %16
br label %6
25: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ awakeWaiting(int);
int sesc_resume(int tid) {
  awakeWaiting(tid);
  return 1;
}


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

x86 assembly (clang, -O2):
<sesc_resume>:
push   %rax
call   1030 <awakeWaiting@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @sesc_resume(i32 %0) {
%2 = tail call i32 @awakeWaiting(i32 %0)
ret i32 1
}
/* Type definitions */
struct addrinfo {
  char *ai_canonname;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
struct addrinfo *host_serv(char *, char *, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  struct addrinfo *res;
  res = host_serv("localhost", "tcp", AF_INET, SOCK_STREAM);
  printf("%s\n", res->ai_canonname);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edx
mov    0x2ea0(%rip),%rax
mov    (%rax),%ecx
lea    0xebf(%rip),%rdi
lea    0xec2(%rip),%rsi
call   1030 <host_serv@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edx
mov    0x2ea7(%rip),%rax
mov    (%rax),%ecx
lea    0xec6(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1030 <host_serv@plt>
mov    (%rax),%rsi
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.addrinfo = type { i8* }
@.str = [10 x i8] c"localhost\00"
@.str.1 = [4 x i8] c"tcp\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca %struct.addrinfo*
%2 = load i32, i32* @AF_INET
%3 = load i32, i32* @SOCK_STREAM
%4 = call %struct.addrinfo* @host_serv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3)
store %struct.addrinfo* %4, %struct.addrinfo** %1
%5 = load %struct.addrinfo*, %struct.addrinfo** %1
%6 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 0
%7 = load i8*, i8** %6
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
%struct.addrinfo = type { i8* }
@.str = [10 x i8] c"localhost\00"
@.str.1 = [4 x i8] c"tcp\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = tail call %struct.addrinfo* @host_serv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %2)
%4 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 0
%5 = load i8*, i8** %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ reHeapElement(int *, int *, double *, int, int);
int /*<<< orphan*/ swap(int *, int *, int, int);
void popHeap(int *p, int *q, double *v, int length, int i) {
  swap(p, q, i, length);
  reHeapElement(p, q, v, length - 1, i);
  return;
}


x86 assembly (clang, -O0):
<popHeap>:
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    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1040 <swap@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x20(%rbp),%r8d
call   1030 <reHeapElement@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<popHeap>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r15d
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
mov    %r8d,%edx
call   1040 <swap@plt>
add    $0xffffffff,%ebp
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %ebp,%ecx
mov    %r15d,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <reHeapElement@plt>

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

LLVM IR (-O2):
define void @popHeap(i32* %0, i32* %1, double* %2, i32 %3, i32 %4) {
%6 = tail call i32 @swap(i32* %0, i32* %1, i32 %4, i32 %3)
%7 = add nsw i32 %3, -1
%8 = tail call i32 @reHeapElement(i32* %0, i32* %1, double* %2, i32 %7, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *, char *);
void gen_program_stop() { print("M0", "stop"); }


x86 assembly (clang, -O0):
<gen_program_stop>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee1(%rip),%rsi
call   1030 <print@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_program_stop>:
lea    0xee9(%rip),%rdi
lea    0xee5(%rip),%rsi
jmp    1030 <print@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"M0\00"
@.str.1 = [5 x i8] c"stop\00"
define void @gen_program_stop() {
%1 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"M0\00"
@.str.1 = [5 x i8] c"stop\00"
define void @gen_program_stop() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ isprime(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int sum, n;
  sum = 0;
  for (n = 2; n < 10000; ++n) {
    if (isprime(n)) {
      sum += n;
    }
  }
  printf("Sum of primes less than 10000: %d\n", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x2710,-0xc(%rbp)
jge    1178 <main+0x58>
mov    -0xc(%rbp),%edi
call   1040 <isprime@plt>
cmp    $0x0,%rax
je     1165 <main+0x45>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    116a <main+0x4a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
mov    $0x2,%ebp
jmp    113d <main+0x1d>
nopl   0x0(%rax)
add    %ecx,%ebx
add    $0x1,%ebp
cmp    $0x2710,%ebp
je     1152 <main+0x32>
mov    %ebp,%edi
call   1040 <isprime@plt>
mov    $0x0,%ecx
test   %rax,%rax
je     1130 <main+0x10>
mov    %ebp,%ecx
jmp    1130 <main+0x10>
lea    0xea7(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Sum of primes less than 10000: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 2, i32* %3
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10000
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %3
%9 = call i64 @isprime(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = add nsw i32 %13, %12
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %7
br label %16
16: ; preds = %15
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %4
19: ; preds = %4
%20 = load i32, i32* %2
%21 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [35 x i8] c"Sum of primes less than 10000: %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 2, %0 ], [ %8, %1 ]
%3 = phi i32 [ 0, %0 ], [ %7, %1 ]
%4 = tail call i64 @isprime(i32 %2)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i32 0, i32 %2
%7 = add nuw nsw i32 %6, %3
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 10000
br i1 %9, label %10, label %1
10: ; preds = %1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}