xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void Push(char stack[], int *top, char elem) {
  if (*top == 100 - 1) {
    printf("Overflow.\n");
    return;
  }
  *top += 1;
  stack[*top] = elem;
}


x86 assembly (clang, -O0):
<Push>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x63,(%rax)
jne    1143 <Push+0x33>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
jmp    115f <Push+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    %dl,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Push>:
movslq (%rsi),%rax
cmp    $0x63,%rax
jne    1125 <Push+0x15>
lea    0xee0(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x1(%rax),%rcx
mov    %ecx,(%rsi)
mov    %dl,0x1(%rdi,%rax,1)
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Overflow.\0A\00"
define void @Push(i8* %0, i32* %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8
store i8* %0, i8** %4
store i32* %1, i32** %5
store i8 %2, i8* %6
%7 = load i32*, i32** %5
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 99
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %22
12: ; preds = %3
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %13
%16 = load i8, i8* %6
%17 = load i8*, i8** %4
%18 = load i32*, i32** %5
%19 = load i32, i32* %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %17, i64 %20
store i8 %16, i8* %21
br label %22
22: ; preds = %12, %10
ret void
}

LLVM IR (-O2):
@str = [10 x i8] c"Overflow.\00"
define void @Push(i8* nocapture writeonly %0, i32* nocapture %1, i8 signext %2) {
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 99
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %12
8: ; preds = %3
%9 = add nsw i32 %4, 1
store i32 %9, i32* %1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
store i8 %2, i8* %11
br label %12
12: ; preds = %8, %6
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void set_tree_height(uint32_t addr[8], uint32_t tree_height) {
  addr[5] = tree_height;
}


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

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

LLVM IR (-O0):
define void @set_tree_height(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 5
store i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @set_tree_height(i32* nocapture writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %1, i32* %3
ret void
}
double vec3d_dot(const double a[3], const double b[3]) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}


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

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

LLVM IR (-O0):
define double @vec3d_dot(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 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = fmul double %13, %16
%18 = call double @llvm.fmuladd.f64(double %7, double %10, double %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 = call double @llvm.fmuladd.f64(double %21, double %24, double %18)
ret double %25
}

LLVM IR (-O2):
define double @vec3d_dot(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %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 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %10)
ret double %15
}
/* Variables and functions */
int /*<<< orphan*/ calibrate();
int main(void) {
  calibrate();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @calibrate()
ret i32 0
}
/* Type definitions */
struct sched_param {
  int dummy;
};
typedef int /*<<< orphan*/ posix_spawnattr_t;

/* Variables and functions */
int ENOSYS;
int posix_spawnattr_setschedparam(
    posix_spawnattr_t *restrict attr,
    const struct sched_param *restrict schedparam) {
  return ENOSYS;
}


x86 assembly (clang, -O0):
<posix_spawnattr_setschedparam>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<posix_spawnattr_setschedparam>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@ENOSYS = global i32 0
define i32 @posix_spawnattr_setschedparam(i32* noalias %0, %struct.sched_param* noalias %1) {
%3 = alloca i32*
%4 = alloca %struct.sched_param*
store i32* %0, i32** %3
store %struct.sched_param* %1, %struct.sched_param** %4
%5 = load i32, i32* @ENOSYS
ret i32 %5
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@ENOSYS = global i32 0
define i32 @posix_spawnattr_setschedparam(i32* noalias nocapture readnone %0, %struct.sched_param* noalias nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
ret i32 %3
}
/* Variables and functions */
int test_huge_alloc();
int main(int argc, char *argv[], char *envp[]) { return test_huge_alloc(); }


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    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <test_huge_alloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 (...) @test_huge_alloc()
ret i32 %4
}
/* Variables and functions */
int open(char const *, int);
int /*<<< orphan*/ warn(char *, char const *);
int dasd_open_device(const char *device, int flags) {
  int fd;
  fd = open(device, flags);
  if (fd == -1)
    warn("Could not open device '%s'", device);
  return fd;
}


x86 assembly (clang, -O0):
<dasd_open_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <open@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    1158 <dasd_open_device+0x38>
mov    -0x8(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1030 <warn@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dasd_open_device>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <open@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
jne    1141 <dasd_open_device+0x21>
lea    0xec7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <warn@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Could not open device '%s'\00"
define i32 @dasd_open_device(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @open(i8* %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = call i32 @warn(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %11, %2
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
@.str = [27 x i8] c"Could not open device '%s'\00"
define i32 @dasd_open_device(i8* %0, i32 %1) {
%3 = tail call i32 @open(i8* %0, i32 %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @warn(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int ocall_fprint_err(const char *str) {
  int ret = fprintf(stderr, "%s", str);
  fflush(stdout);
  return ret;
}


x86 assembly (clang, -O0):
<ocall_fprint_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ocall_fprint_err>:
push   %rbx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    %eax,%ebx
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
@stdout = global i32 0
define i32 @ocall_fprint_err(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i32, i32* @stderr
%5 = load i8*, i8** %2
%6 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
@stdout = global i32 0
define i32 @ocall_fprint_err(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
ret i32 %3
}
int a_cas(volatile int *p, int t, int s) {
  __asm__ __volatile__("lock ; cmpxchg %3, %1"
                       : "=a"(t), "=m"(*p)
                       : "a"(t), "r"(s)
                       : "memory");
  return t;
}


x86 assembly (clang, -O0):
<a_cas>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%edx
lock cmpxchg %edx,(%rcx)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_cas>:
mov    %esi,%eax
lock cmpxchg %edx,(%rdi)
ret

LLVM IR (-O0):
define i32 @a_cas(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 asm sideeffect "lock ; cmpxchg $3, $1", "={ax},=*m,{ax},r,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %7, i32 %8, i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @a_cas(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 asm sideeffect "lock ; cmpxchg $3, $1", "={ax},=*m,{ax},r,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %0, i32 %1, i32 %2)
ret i32 %4
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ window;
};
typedef TYPE_1__ XFocusOutEvent;

/* Variables and functions */
unsigned long get_XFocusOutEvent_window(void *_p) {
  return (unsigned long)((XFocusOutEvent *)_p)->window;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XFocusOutEvent_window(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XFocusOutEvent_window(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
char *procprt_TSLPU_e(struct tstat *curstat, int avgval, int nsecs) {
  return "    0";
}


x86 assembly (clang, -O0):
<procprt_TSLPU_e>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xeeb(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<procprt_TSLPU_e>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
%struct.tstat = type opaque
@.str = [6 x i8] c" 0\00"
define i8* @procprt_TSLPU_e(%struct.tstat* %0, i32 %1, i32 %2) {
%4 = alloca %struct.tstat*
%5 = alloca i32
%6 = alloca i32
store %struct.tstat* %0, %struct.tstat** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tstat = type opaque
@.str = [6 x i8] c" 0\00"
define i8* @procprt_TSLPU_e(%struct.tstat* nocapture readnone %0, i32 %1, i32 %2) {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void strcat_Bad() {
  char str[8];
  strcpy(str, "abc");
  strcat(str, "defgh");
}


x86 assembly (clang, -O0):
<strcat_Bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1040 <strcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat_Bad>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xec4(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [6 x i8] c"defgh\00"
define void @strcat_Bad() {
%1 = alloca [8 x i8]
%2 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%5 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@.str.1 = [6 x i8] c"defgh\00"
define void @strcat_Bad() {
%1 = alloca [8 x i8]
%2 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "spi_programmer operate ...\n"
          "operate: [id], get chip device id.\n"
          "         [read] [size] [filename]. read spi flash to file, size is "
          "K or M.\n"
          "                  eg. \"spi_programmer read 4M save.bin\", read 4MB "
          "data of spi flash and write to file save.bin.\n"
          "         [write] [filename]. buring file to flash.\n"
          "         [erase] erase spi flash chip\n"
          "         [24cxx] [d] [size]. dump size of bytes to terminal.\n"
          "         [24cxx] [r] [size] [filename]. read i2c eeprom to file, "
          "size is byte\n"
          "         [24cxx] [w] [filename]. write file to i2c eeprom\n");
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [536 x i8] c"spi_programmer operate ...\0Aoperate: [id], get chip device id.\0A [read] [size] [filename]. read spi flash to file, size is K or M.\0A eg. \22spi_programmer read 4M save.bin\22, read 4MB data of spi flash and write to file save.bin.\0A [write] [filename]. buring file to flash.\0A [erase] erase spi flash chip\0A [24cxx] [d] [size]. dump size of bytes to terminal.\0A [24cxx] [r] [size] [filename]. read i2c eeprom to file, size is byte\0A [24cxx] [w] [filename]. write file to i2c eeprom\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([536 x i8], [536 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [536 x i8] c"spi_programmer operate ...\0Aoperate: [id], get chip device id.\0A [read] [size] [filename]. read spi flash to file, size is K or M.\0A eg. \22spi_programmer read 4M save.bin\22, read 4MB data of spi flash and write to file save.bin.\0A [write] [filename]. buring file to flash.\0A [erase] erase spi flash chip\0A [24cxx] [d] [size]. dump size of bytes to terminal.\0A [24cxx] [r] [size] [filename]. read i2c eeprom to file, size is byte\0A [24cxx] [w] [filename]. write file to i2c eeprom\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([536 x i8], [536 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
float const fabsf(float const);
float prob_of_move(const float prior, const float max_accel, const float accel,
                   const float error_rate) {
  if (fabsf(accel) > max_accel)
    return prior * error_rate;
  else
    return prior * (1 - error_rate);
}


x86 assembly (clang, -O0):
<prob_of_move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <fabsf@plt>
ucomiss -0xc(%rbp),%xmm0
jbe    1154 <prob_of_move+0x44>
movss  -0x8(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    116f <prob_of_move+0x5f>
movss  -0x8(%rbp),%xmm0
movss  0xe9f(%rip),%xmm1
subss  -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prob_of_move>:
andps  0xef9(%rip),%xmm2
movss  0xf01(%rip),%xmm4
subss  %xmm3,%xmm4
cmpltss %xmm2,%xmm1
movaps %xmm1,%xmm2
andnps %xmm4,%xmm2
andps  %xmm3,%xmm1
orps   %xmm1,%xmm2
mulss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @prob_of_move(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
%10 = load float, float* %8
%11 = call float @fabsf(float %10)
%12 = load float, float* %7
%13 = fcmp ogt float %11, %12
br i1 %13, label %14, label %18
14: ; preds = %4
%15 = load float, float* %6
%16 = load float, float* %9
%17 = fmul float %15, %16
store float %17, float* %5
br label %23
18: ; preds = %4
%19 = load float, float* %6
%20 = load float, float* %9
%21 = fsub float 1.000000e+00, %20
%22 = fmul float %19, %21
store float %22, float* %5
br label %23
23: ; preds = %18, %14
%24 = load float, float* %5
ret float %24
}

LLVM IR (-O2):
define float @prob_of_move(float %0, float %1, float %2, float %3) {
%5 = tail call float @llvm.fabs.f32(float %2)
%6 = fcmp ogt float %5, %1
%7 = fsub float 1.000000e+00, %3
%8 = select i1 %6, float %3, float %7
%9 = fmul float %8, %0
ret float %9
}
int spacesamount(int charactersamount, int tabsize) {
  return tabsize - (charactersamount % tabsize);
}


x86 assembly (clang, -O0):
<spacesamount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<spacesamount>:
mov    %edi,%eax
cltd
idiv   %esi
sub    %edx,%esi
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @spacesamount(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = sub nsw i32 %1, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
char *strrev(char *);
int main() {
  char s[100];
  printf("Enter a String : ");
  gets(s);
  printf("The Reverse of the String is : ");
  printf("%s\n", strrev(s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1040 <gets@plt>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <strrev@plt>
mov    %rax,%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <strrev@plt>
mov    %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter a String : \00"
@.str.1 = [32 x i8] c"The Reverse of the String is : \00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i8* @strrev(i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter a String : \00"
@.str.1 = [32 x i8] c"The Reverse of the String is : \00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%6 = call i8* @strrev(i8* %2)
%7 = call i32 @puts(i8* dereferenceable(1) %6)
ret i32 0
}
void sym_macros() {}


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

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

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

LLVM IR (-O2):
define void @sym_macros() {
ret void
}
/* Variables and functions */
scalar_t__ getgid();
long GETGID() { return ((long)getgid()); }


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

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

LLVM IR (-O0):
define i64 @GETGID() {
%1 = call i64 (...) @getgid()
ret i64 %1
}

LLVM IR (-O2):
define i64 @GETGID() {
%1 = tail call i64 (...) @getgid()
ret i64 %1
}
void oauth_free_array(int *argcp, char ***argvp) {
  int i;
  for (i = 0; i < (*argcp); i++) {
    free((*argvp)[i]);
  }
  if (*argvp)
    free(*argvp);
}


x86 assembly (clang, -O0):
<oauth_free_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    1158 <oauth_free_array+0x48>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <oauth_free_array+0x17>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1172 <oauth_free_array+0x62>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oauth_free_array>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
cmpl   $0x0,(%rdi)
jle    1148 <oauth_free_array+0x38>
mov    %rdi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14),%rax
mov    (%rax,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
movslq (%r15),%rax
cmp    %rax,%rbx
jl     1130 <oauth_free_array+0x20>
mov    (%r14),%rdi
test   %rdi,%rdi
je     115a <oauth_free_array+0x4a>
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @oauth_free_array(i32* nocapture %0, i8*** nocapture %1) {
%3 = load i32, i32* %0
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = load i8**, i8*** %1
%8 = getelementptr inbounds i8*, i8** %7, i64 %6
%9 = load i8*, i8** %8
tail call void @free(i8* %9)
%10 = add nuw nsw i64 %6, 1
%11 = load i32, i32* %0
%12 = sext i32 %11 to i64
%13 = icmp slt i64 %10, %12
br i1 %13, label %5, label %14
14: ; preds = %5, %2
%15 = load i8**, i8*** %1
%16 = icmp eq i8** %15, null
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = bitcast i8** %15 to i8*
tail call void @free(i8* %18)
br label %19
19: ; preds = %17, %14
ret void
}
/* Variables and functions */
void _exit(void) {}


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

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @_exit() {
unreachable
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ dumasCheckAndFree(void *, char *, long);
void dumasFree(void *oldPtr, char *moduleName, long lineNo) {
  dumasCheckAndFree(oldPtr, moduleName, lineNo);
}


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

x86 assembly (clang, -O2):
<dumasFree>:
jmp    1030 <dumasCheckAndFree@plt>

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

LLVM IR (-O2):
define void @dumasFree(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @dumasCheckAndFree(i8* %0, i8* %1, i64 %2)
ret void
}
unsigned int move(unsigned m, int n) {
  unsigned int d, k;
  if (n > 0) {
    d = m >> n;
    k = m << (sizeof(int) * 8 - n);
    return d | k;
  } else {
    n = -n;
    d = m << n;
    k = m >> (sizeof(int) * 8 - n);
    return d | k;
  }
}


x86 assembly (clang, -O0):
<move>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1141 <move+0x41>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
movslq -0xc(%rbp),%rdx
mov    $0x20,%ecx
sub    %rdx,%rcx
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <move+0x71>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
movslq -0xc(%rbp),%rdx
mov    $0x20,%ecx
sub    %rdx,%rcx
shr    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<move>:
mov    %esi,%ecx
mov    %edi,%eax
test   %esi,%esi
jle    110b <move+0xb>
ror    %cl,%eax
ret
add    $0x20,%cl
ror    %cl,%eax
ret

LLVM IR (-O0):
define i32 @move(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %5
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = lshr i32 %11, %12
store i32 %13, i32* %6
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = sub i64 32, %16
%18 = trunc i64 %17 to i32
%19 = shl i32 %14, %18
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = or i32 %20, %21
store i32 %22, i32* %3
br label %38
23: ; preds = %2
%24 = load i32, i32* %5
%25 = sub nsw i32 0, %24
store i32 %25, i32* %5
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = shl i32 %26, %27
store i32 %28, i32* %6
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = sub i64 32, %31
%33 = trunc i64 %32 to i32
%34 = lshr i32 %29, %33
store i32 %34, i32* %7
%35 = load i32, i32* %6
%36 = load i32, i32* %7
%37 = or i32 %35, %36
store i32 %37, i32* %3
br label %38
38: ; preds = %23, %10
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
define i32 @move(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = lshr i32 %0, %1
%6 = sub nsw i32 32, %1
%7 = shl i32 %0, %6
%8 = or i32 %7, %5
br label %15
9: ; preds = %2
%10 = sub nsw i32 0, %1
%11 = shl i32 %0, %10
%12 = add nsw i32 %1, 32
%13 = lshr i32 %0, %12
%14 = or i32 %13, %11
br label %15
15: ; preds = %9, %4
%16 = phi i32 [ %8, %4 ], [ %14, %9 ]
ret i32 %16
}
/* Variables and functions */
char jrand48(unsigned short *);
void gen(char *buf, size_t len) {
  unsigned short state[3] = {0x1234, 0x5678, 0x9abc};
  for (int i = 0; i < len; i++) {
    buf[i] = jrand48(state);
  }
}


x86 assembly (clang, -O0):
<gen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeda(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xed4(%rip),%ax
mov    %ax,-0x12(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    116d <gen+0x5d>
lea    -0x16(%rbp),%rdi
call   1030 <jrand48@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <gen+0x2b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movzwl 0xee5(%rip),%eax
mov    %ax,0x4(%rsp)
mov    0xed6(%rip),%eax
mov    %eax,(%rsp)
test   %rsi,%rsi
je     1155 <gen+0x45>
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
mov    %rsp,%r15
nopl   (%rax)
mov    %r15,%rdi
call   1030 <jrand48@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <gen+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.gen.state = [3 x i16] [i16 4660, i16 22136, i16 -25924]
define void @gen(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [3 x i16]
%6 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = bitcast [3 x i16]* %5 to i8*
store i32 0, i32* %6
br label %8
8: ; preds = %20, %2
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = load i64, i64* %4
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %23
13: ; preds = %8
%14 = getelementptr inbounds [3 x i16], [3 x i16]* %5, i64 0, i64 0
%15 = call signext i8 @jrand48(i16* %14)
%16 = load i8*, i8** %3
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 %15, i8* %19
br label %20
20: ; preds = %13
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %8
23: ; preds = %8
ret void
}

LLVM IR (-O2):
@__const.gen.state = [3 x i16] [i16 4660, i16 22136, i16 -25924]
define void @gen(i8* nocapture writeonly %0, i64 %1) {
%3 = alloca [3 x i16]
%4 = bitcast [3 x i16]* %3 to i8*
%5 = icmp eq i64 %1, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = getelementptr inbounds [3 x i16], [3 x i16]* %3, i64 0, i64 0
br label %9
8: ; preds = %9, %2
ret void
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %13, %9 ]
%11 = call signext i8 @jrand48(i16* %7)
%12 = getelementptr inbounds i8, i8* %0, i64 %10
store i8 %11, i8* %12
%13 = add nuw i64 %10, 1
%14 = icmp eq i64 %13, %1
br i1 %14, label %8, label %9
}
void test_hashmap() {}


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

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

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

LLVM IR (-O2):
define void @test_hashmap() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ endian_rev16(int /*<<< orphan*/);
uint16_t endian_to_big16(uint16_t data) { return endian_rev16(data); }


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

x86 assembly (clang, -O2):
<endian_to_big16>:
jmp    1030 <endian_rev16@plt>

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

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

/* Variables and functions */
int64_t new_int64_t(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @new_int64_t() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ NF_Init();
void K9Fxx08_init() { NF_Init(); }


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

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

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

LLVM IR (-O2):
define void @K9Fxx08_init() {
%1 = tail call i32 (...) @NF_Init()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_key_t;

/* Variables and functions */
int kthread_key_delete(int /*<<< orphan*/);
int pthread_key_delete(pthread_key_t key) { return kthread_key_delete(key); }


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

x86 assembly (clang, -O2):
<pthread_key_delete>:
jmp    1030 <kthread_key_delete@plt>

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

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

/* Variables and functions */
int /*<<< orphan*/ put16(int /*<<< orphan*/ **, int);
void put32(uint8_t **ppv, uint32_t l) {
  put16(ppv, (l >> 16) & 0xFFFF);
  put16(ppv, (l >> 0) & 0xFFFF);
}


x86 assembly (clang, -O0):
<put32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sar    $0x10,%esi
and    $0xffff,%esi
call   1030 <put16@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sar    $0x0,%esi
and    $0xffff,%esi
call   1030 <put16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put32>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
shr    $0x10,%esi
call   1030 <put16@plt>
movzwl %bx,%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <put16@plt>

LLVM IR (-O0):
define void @put32(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 = ashr i32 %6, 16
%8 = and i32 %7, 65535
%9 = call i32 @put16(i32** %5, i32 %8)
%10 = load i32**, i32*** %3
%11 = load i32, i32* %4
%12 = ashr i32 %11, 0
%13 = and i32 %12, 65535
%14 = call i32 @put16(i32** %10, i32 %13)
ret void
}

LLVM IR (-O2):
define void @put32(i32** %0, i32 %1) {
%3 = lshr i32 %1, 16
%4 = tail call i32 @put16(i32** %0, i32 %3)
%5 = and i32 %1, 65535
%6 = tail call i32 @put16(i32** %0, i32 %5)
ret void
}
void print_failed_names() {}


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

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

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

LLVM IR (-O2):
define void @print_failed_names() {
ret void
}
char *func() {
  char tmp[] = {'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '\0'};
  char *ptr = tmp;
  return ptr;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xef3(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
lea    -0xc(%rsp),%rax
ret

LLVM IR (-O0):
@__const.func.tmp = [12 x i8] c"Hello World\00"
define i8* @func() {
%1 = alloca [12 x i8]
%2 = alloca i8*
%3 = bitcast [12 x i8]* %1 to i8*
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
store i8* %4, i8** %2
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define noalias i8* @func() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
ret i8* %2
}
int Linear_search(int a[], int v, int length) {
  int i;
  for (i = 0; i < length; i++)
    if (a[i] == v)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<Linear_search>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1153 <Linear_search+0x53>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jne    1140 <Linear_search+0x40>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <Linear_search+0x5a>
jmp    1145 <Linear_search+0x45>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <Linear_search+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Linear_search>:
mov    $0xffffffff,%eax
test   %edx,%edx
jle    111e <Linear_search+0x1e>
mov    %edx,%edx
xor    %ecx,%ecx
nopl   (%rax)
cmp    %esi,(%rdi,%rcx,4)
je     111f <Linear_search+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1110 <Linear_search+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Linear_search(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %1
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
int mwsync_shutdown(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @mwsync_shutdown() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_message(void) { printf("Programming is fun.\n"); }


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

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

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

LLVM IR (-O2):
@str = [20 x i8] c"Programming is fun.\00"
define void @print_message() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
__attribute__((__format__(__printf__, (1), (1 + 1)))) void
DEBUG_LOG(const char *unused__fmt __attribute__((__unused__)), ...) {}


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

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

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

LLVM IR (-O2):
define void @DEBUG_LOG(i8* nocapture %0, ...) {
ret void
}
unsigned lowest_bit(unsigned x) { return x & -x; }


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

x86 assembly (clang, -O2):
<lowest_bit>:
mov    %edi,%eax
neg    %eax
and    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @lowest_bit(i32 %0) {
%2 = sub i32 0, %0
%3 = and i32 %2, %0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_create(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  void *(*)(void *), int /*<<< orphan*/ *);
void StartThread(pthread_t *t, void *(*f)(void *)) {
  pthread_create(t, NULL, f, NULL);
}


x86 assembly (clang, -O0):
<StartThread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rsi
call   1030 <pthread_create@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StartThread>:
mov    %rsi,%rdx
xor    %esi,%esi
xor    %ecx,%ecx
jmp    1030 <pthread_create@plt>

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

LLVM IR (-O2):
define void @StartThread(i32* %0, i8* (i8*)* %1) {
%3 = tail call i32 @pthread_create(i32* %0, i32* null, i8* (i8*)* %1, i32* null)
ret void
}
void ignore_alarm(int __attribute__((__unused__)) sig) {}


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

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

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

LLVM IR (-O2):
define void @ignore_alarm(i32 %0) {
ret void
}