xunge/DecIR huggingface dataset:
/* Variables and functions */
int qsort_partition(int *, int, int);
void qsort(int *arr, int start, int end) {
  if (start < end) {
    int i = qsort_partition(arr, start, end);
    qsort(arr, start, i - 1);
    qsort(arr, i + 1, end);
  }
}


x86 assembly (clang, -O0):
<qsort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <qsort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <qsort_partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1030 <qsort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <qsort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <qsort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <qsort_partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <qsort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <qsort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @qsort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @qsort_partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @qsort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Variables and functions */
unsigned int sv_get_ticks();
unsigned int vox_get_ticks() { return sv_get_ticks(); }


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

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

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

LLVM IR (-O2):
define i32 @vox_get_ticks() {
%1 = tail call i32 (...) @sv_get_ticks()
ret i32 %1
}
void gdk_window_merge_child_shapes() {}


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

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

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

LLVM IR (-O2):
define void @gdk_window_merge_child_shapes() {
ret void
}
/* Variables and functions */
int __bitmap_parse(char const *, unsigned int, int /*<<< orphan*/,
                   unsigned long *, int);
int bitmap_parse(const char *buf, unsigned int buflen, unsigned long *maskp,
                 int nmaskbits) {
  return __bitmap_parse(buf, buflen, 0, maskp, nmaskbits);
}


x86 assembly (clang, -O0):
<bitmap_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
xor    %edx,%edx
call   1030 <__bitmap_parse@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_parse>:
mov    %ecx,%r8d
mov    %rdx,%rcx
xor    %edx,%edx
jmp    1030 <__bitmap_parse@plt>

LLVM IR (-O0):
define i32 @bitmap_parse(i8* %0, i32 %1, i64* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i64*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i64* %2, i64** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i64*, i64** %7
%12 = load i32, i32* %8
%13 = call i32 @__bitmap_parse(i8* %9, i32 %10, i32 0, i64* %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @bitmap_parse(i8* %0, i32 %1, i64* %2, i32 %3) {
%5 = tail call i32 @__bitmap_parse(i8* %0, i32 %1, i32 0, i64* %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
char *capture(char const *, char *);
char *get_time(const char *rawString) {
  char *res;
  char *regexString = "[0-9]+ ([A-Z][a-z]{2}[ ]+[0-9]+ "
                      "[0-9]+:[0-9]+|[A-Z][a-z]{2}[ ]+[0-9]+[ ]+[0-9]{4})";
  res = capture(rawString, regexString);
  return res;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <capture@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
lea    0xee9(%rip),%rsi
jmp    1030 <capture@plt>

LLVM IR (-O0):
@.str = [83 x i8] c"[0-9]+ ([A-Z][a-z]{2}[ ]+[0-9]+ [0-9]+:[0-9]+|[A-Z][a-z]{2}[ ]+[0-9]+[ ]+[0-9]{4})\00"
define i8* @get_time(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %2
%6 = load i8*, i8** %4
%7 = call i8* @capture(i8* %5, i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
@.str = [83 x i8] c"[0-9]+ ([A-Z][a-z]{2}[ ]+[0-9]+ [0-9]+:[0-9]+|[A-Z][a-z]{2}[ ]+[0-9]+[ ]+[0-9]{4})\00"
define i8* @get_time(i8* %0) {
%2 = tail call i8* @capture(i8* %0, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
double numeric_tools_representable_delta(double x, double h) {
  volatile double temp = x + h;
  return temp - x;
}


x86 assembly (clang, -O0):
<numeric_tools_representable_delta>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<numeric_tools_representable_delta>:
addsd  %xmm0,%xmm1
movsd  %xmm1,-0x8(%rsp)
movsd  -0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @numeric_tools_representable_delta(double %0, double %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = fadd double %0, %1
store volatile double %5, double* %3
%6 = load volatile double, double* %3
%7 = fsub double %6, %0
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ FatalErrorHandler();
void ErrorHandler() { FatalErrorHandler(); }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ __syscall(int);
gid_t getgid(void) { return __syscall(200); }


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

x86 assembly (clang, -O2):
<getgid>:
mov    $0xc8,%edi
jmp    1030 <__syscall@plt>

LLVM IR (-O0):
define i32 @getgid() {
%1 = call i32 @__syscall(i32 200)
ret i32 %1
}

LLVM IR (-O2):
define i32 @getgid() {
%1 = tail call i32 @__syscall(i32 200)
ret i32 %1
}
char *hash_plugin_summary(void) {
  return ("bfunix \t\tbcrypt (Blowfish) plugin");
}


x86 assembly (clang, -O0):
<hash_plugin_summary>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [34 x i8] c"bfunix \09\09bcrypt (Blowfish) plugin\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [34 x i8] c"bfunix \09\09bcrypt (Blowfish) plugin\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0)
}
int double2int(double source) {
  int i = 0;
  int dest = 0;
  double per = 0;
  if (source > 0) {
    if (source < 0.5)
      dest = 0;
    else {
      if (source >= 0.5 && source <= 1)
        dest = 1;
      else {
        per = source;
        while (per >= 1.0) {
          per = per / 10;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<double2int>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11d1 <double2int+0xd1>
movsd  0xec7(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1150 <double2int+0x50>
movl   $0x0,-0x18(%rbp)
jmp    11cc <double2int+0xcc>
movsd  -0x10(%rbp),%xmm0
movsd  0xea3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1186 <double2int+0x86>
movsd  0xe99(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1186 <double2int+0x86>
movl   $0x1,-0x18(%rbp)
jmp    11c7 <double2int+0xc7>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe6b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11c2 <double2int+0xc2>
movsd  -0x20(%rbp),%xmm0
movsd  0xe5c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1190 <double2int+0x90>
jmp    11c7 <double2int+0xc7>
jmp    11cc <double2int+0xcc>
jmp    11d1 <double2int+0xd1>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @double2int(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store double %0, double* %3
store i32 0, i32* %4
store i32 0, i32* %5
store double 0.000000e+00, double* %6
%7 = load double, double* %3
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %31
9: ; preds = %1
%10 = load double, double* %3
%11 = fcmp olt double %10, 5.000000e-01
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 0, i32* %5
br label %30
13: ; preds = %9
%14 = load double, double* %3
%15 = fcmp oge double %14, 5.000000e-01
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load double, double* %3
%18 = fcmp ole double %17, 1.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 1, i32* %5
br label %29
20: ; preds = %16, %13
%21 = load double, double* %3
store double %21, double* %6
br label %22
22: ; preds = %25, %20
%23 = load double, double* %6
%24 = fcmp oge double %23, 1.000000e+00
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load double, double* %6
%27 = fdiv double %26, 1.000000e+01
store double %27, double* %6
br label %22
28: ; preds = %22
br label %29
29: ; preds = %28, %19
br label %30
30: ; preds = %29, %12
br label %31
31: ; preds = %30, %1
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @double2int(double %0) {
ret i32 undef
}
/* Variables and functions */
scalar_t__ charIsNum(char);
int /*<<< orphan*/ error(int);
int charToInt(char c) {
  if (charIsNum(c))
    return c - '0';
  error(1);
  return -1;
}


x86 assembly (clang, -O0):
<charToInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <charIsNum@plt>
cmp    $0x0,%rax
je     1150 <charToInt+0x30>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1161 <charToInt+0x41>
mov    $0x1,%edi
call   1040 <error@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charToInt>:
push   %rbx
mov    %edi,%ebx
call   1030 <charIsNum@plt>
test   %rax,%rax
je     1135 <charToInt+0x15>
movsbl %bl,%eax
add    $0xffffffd0,%eax
pop    %rbx
ret
mov    $0x1,%edi
call   1040 <error@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @charToInt(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @charIsNum(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %2
br label %13
11: ; preds = %1
%12 = call i32 @error(i32 1)
store i32 -1, i32* %2
br label %13
13: ; preds = %11, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @charToInt(i8 signext %0) {
%2 = tail call i64 @charIsNum(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = sext i8 %0 to i32
%6 = add nsw i32 %5, -48
br label %9
7: ; preds = %1
%8 = tail call i32 @error(i32 1)
br label %9
9: ; preds = %7, %4
%10 = phi i32 [ %6, %4 ], [ -1, %7 ]
ret i32 %10
}
int ssl_finish(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ssl_finish() {
ret i32 0
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ srand(int);
void random_init() {
  struct timeval time;
  gettimeofday(&time, NULL);
  srand((time.tv_sec * 1000) + (time.tv_usec / 1000));
}


x86 assembly (clang, -O0):
<random_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%edi
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
add    %eax,%edi
call   1040 <srand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_init>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,(%rsp),%eax
movslq 0x4(%rsp),%rcx
imul   $0x10624dd3,%rcx,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rdi
add    %ecx,%edi
add    %eax,%edi
pop    %rax
jmp    1040 <srand@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define void @random_init() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = sdiv i32 %7, 1000
%9 = add nsw i32 %5, %8
%10 = call i32 @srand(i32 %9)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @random_init() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
%11 = tail call i32 @srand(i32 %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int xx_be(void) {
  puts("big-endian routine");
  return 2;
}


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"big-endian routine\00"
define i32 @xx_be() {
%1 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 2
}

LLVM IR (-O2):
@.str = [19 x i8] c"big-endian routine\00"
define i32 @xx_be() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 2
}
/* Variables and functions */
void *realloc(void *, unsigned int);
void *orderly_internal_realloc(void *ctx, void *previous, unsigned int sz) {
  return realloc(previous, sz);
}


x86 assembly (clang, -O0):
<orderly_internal_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <realloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<orderly_internal_realloc>:
mov    %rsi,%rdi
mov    %edx,%esi
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define i8* @orderly_internal_realloc(i8* nocapture readnone %0, i8* %1, i32 %2) {
%4 = tail call i8* @realloc(i8* %1, i32 %2)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ cwrapper_q_sortrev_double(double *, int /*<<< orphan*/, int);
void quicksortrev_double_(double numbers[], int *array_size) {
  cwrapper_q_sortrev_double(numbers, 0, (*array_size) - 1);
}


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

x86 assembly (clang, -O2):
<quicksortrev_double_>:
mov    (%rsi),%edx
add    $0xffffffff,%edx
xor    %esi,%esi
jmp    1030 <cwrapper_q_sortrev_double@plt>

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

LLVM IR (-O2):
define void @quicksortrev_double_(double* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = add nsw i32 %3, -1
%5 = tail call i32 @cwrapper_q_sortrev_double(double* %0, i32 0, i32 %4)
ret void
}
/* Variables and functions */
double exp(double);
double simplerng_getuniform();
int simplerng_poisson_small(double lambda) {
  double p = 1.0, L = exp(-lambda);
  int k = 0;
  do {
    k++;
    p *= simplerng_getuniform();
  } while (p > L);
  return k - 1;
}


x86 assembly (clang, -O0):
<simplerng_poisson_small>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xecb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <simplerng_getuniform@plt>
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     1167 <simplerng_poisson_small+0x47>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simplerng_poisson_small>:
push   %rbx
sub    $0x10,%rsp
xorps  0xed4(%rip),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xed1(%rip),%xmm0
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <simplerng_getuniform@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x1,%ebx
ucomisd 0x8(%rsp),%xmm0
ja     1150 <simplerng_poisson_small+0x30>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @simplerng_poisson_small(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %2
store double 1.000000e+00, double* %3
%6 = load double, double* %2
%7 = fneg double %6
%8 = call double @exp(double %7)
store double %8, double* %4
store i32 0, i32* %5
br label %9
9: ; preds = %15, %1
%10 = load i32, i32* %5
%11 = add nsw i32 %10, 1
store i32 %11, i32* %5
%12 = call double (...) @simplerng_getuniform()
%13 = load double, double* %3
%14 = fmul double %13, %12
store double %14, double* %3
br label %15
15: ; preds = %9
%16 = load double, double* %3
%17 = load double, double* %4
%18 = fcmp ogt double %16, %17
br i1 %18, label %9, label %19
19: ; preds = %15
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
ret i32 %21
}

LLVM IR (-O2):
define i32 @simplerng_poisson_small(double %0) {
%2 = fneg double %0
%3 = tail call double @exp(double %2)
br label %4
4: ; preds = %4, %1
%5 = phi double [ 1.000000e+00, %1 ], [ %9, %4 ]
%6 = phi i32 [ 0, %1 ], [ %7, %4 ]
%7 = add nuw nsw i32 %6, 1
%8 = tail call double (...) @simplerng_getuniform()
%9 = fmul double %5, %8
%10 = fcmp ogt double %9, %3
br i1 %10, label %4, label %11
11: ; preds = %4
ret i32 %6
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ escape(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char s[15] = {'a', 'b', 'c'};
  char t[] = "hello";
  escape(s, t);
  printf("%s\n", s);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xec2(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xeba(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xeb2(%rip),%eax
mov    %eax,-0x19(%rbp)
mov    0xeac(%rip),%ax
mov    %ax,-0x15(%rbp)
lea    -0x13(%rbp),%rdi
lea    -0x19(%rbp),%rsi
call   1040 <escape@plt>
lea    -0x13(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xedb(%rip),%rax
mov    %rax,0x17(%rsp)
mov    0xec8(%rip),%rax
mov    %rax,0x10(%rsp)
movw   $0x6f,0xc(%rsp)
movl   $0x6c6c6568,0x8(%rsp)
6c
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <escape@plt>
lea    0xeb0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = <{ i8, i8, i8, [12 x i8] }> <{ i8 97, i8 98, i8 99, [12 x i8] zeroinitializer }>
@__const.main.t = [6 x i8] c"hello\00"
@.str = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [6 x i8]
store i32 0, i32* %1
%4 = bitcast [15 x i8]* %2 to i8*
%5 = bitcast [6 x i8]* %3 to i8*
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%8 = call i32 @escape(i8* %6, i8* %7)
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}

LLVM IR (-O2):
@__const.main.s = <{ i8, i8, i8, [12 x i8] }> <{ i8 97, i8 98, i8 99, [12 x i8] zeroinitializer }>
@__const.main.t = [6 x i8] c"hello\00"
@.str = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%5 = call i32 @escape(i8* %3, i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void failure(const char *emsg) {
  fprintf(stderr, "%s\n", emsg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<failure>:
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    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<failure>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @failure(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @failure(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
char gnupg_trustletter(int t) {
  switch (t) {
  case 1:
    return 'n';
  case 2:
    return 'm';
  case 3:
    return 'f';
  }
  return 'q';
}


x86 assembly (clang, -O0):
<gnupg_trustletter>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     113d <gnupg_trustletter+0x3d>
jmp    111b <gnupg_trustletter+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1146 <gnupg_trustletter+0x46>
jmp    112c <gnupg_trustletter+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     114f <gnupg_trustletter+0x4f>
jmp    1158 <gnupg_trustletter+0x58>
movb   $0x6e,-0x1(%rbp)
jmp    115c <gnupg_trustletter+0x5c>
movb   $0x6d,-0x1(%rbp)
jmp    115c <gnupg_trustletter+0x5c>
movb   $0x66,-0x1(%rbp)
jmp    115c <gnupg_trustletter+0x5c>
movb   $0x71,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gnupg_trustletter>:
lea    -0x8(,%rdi,8),%ecx
mov    %edi,%eax
add    $0xffffffff,%eax
mov    $0x666d6e,%edx
shr    %cl,%edx
cmp    $0x3,%eax
mov    $0x71,%eax
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @gnupg_trustletter(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
]
5: ; preds = %1
store i8 110, i8* %2
br label %9
6: ; preds = %1
store i8 109, i8* %2
br label %9
7: ; preds = %1
store i8 102, i8* %2
br label %9
8: ; preds = %1
store i8 113, i8* %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i8, i8* %2
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @gnupg_trustletter(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
%4 = trunc i32 %2 to i24
%5 = shl i24 %4, 3
%6 = lshr i24 6712686, %5
%7 = trunc i24 %6 to i8
%8 = select i1 %3, i8 %7, i8 113
ret i8 %8
}
/* Type definitions */
struct hdr_histogram {
  int dummy;
};
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ counts_get_normalised(struct hdr_histogram *,
                                         int /*<<< orphan*/);
int /*<<< orphan*/ counts_index_for(struct hdr_histogram *, int /*<<< orphan*/);
int64_t hdr_count_at_value(struct hdr_histogram *h, int64_t value) {
  return counts_get_normalised(h, counts_index_for(h, value));
}


x86 assembly (clang, -O0):
<hdr_count_at_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <counts_index_for@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <counts_get_normalised@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdr_count_at_value>:
push   %rbx
mov    %rdi,%rbx
call   1030 <counts_index_for@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <counts_get_normalised@plt>

LLVM IR (-O0):
%struct.hdr_histogram = type { i32 }
define i32 @hdr_count_at_value(%struct.hdr_histogram* %0, i32 %1) {
%3 = alloca %struct.hdr_histogram*
%4 = alloca i32
store %struct.hdr_histogram* %0, %struct.hdr_histogram** %3
store i32 %1, i32* %4
%5 = load %struct.hdr_histogram*, %struct.hdr_histogram** %3
%6 = load %struct.hdr_histogram*, %struct.hdr_histogram** %3
%7 = load i32, i32* %4
%8 = call i32 @counts_index_for(%struct.hdr_histogram* %6, i32 %7)
%9 = call i32 @counts_get_normalised(%struct.hdr_histogram* %5, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.hdr_histogram = type { i32 }
define i32 @hdr_count_at_value(%struct.hdr_histogram* %0, i32 %1) {
%3 = tail call i32 @counts_index_for(%struct.hdr_histogram* %0, i32 %1)
%4 = tail call i32 @counts_get_normalised(%struct.hdr_histogram* %0, i32 %3)
ret i32 %4
}
int test_imm_69uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x69 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_69uint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0x69,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_69uint64_highword_mem>:
testb  $0x69,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_69uint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 105
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_69uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 450971566080
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int close(int);
int /*<<< orphan*/ unix_error(char *);
void Close(int fd) {
  int rc;
  if ((rc = close(fd)) < 0) {
    unix_error("Close error");
  }
}


x86 assembly (clang, -O0):
<Close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    114b <Close+0x2b>
lea    0xeba(%rip),%rdi
call   1040 <unix_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Close>:
push   %rax
call   1030 <close@plt>
test   %eax,%eax
js     112c <Close+0xc>
pop    %rax
ret
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1040 <unix_error@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Close error\00"
define void @Close(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @close(i32 %4)
store i32 %5, i32* %3
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @unix_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Close error\00"
define void @Close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @unix_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
void prom_console_init(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
int /*<<< orphan*/ reverse_memcpy(void *, void *, int);
void int64_to_bytes(int32_t source, unsigned char bytes[8], int switch_endian) {
  void *dest_ptr = (void *)bytes;
  void *source_ptr = (void *)&source;
  if (switch_endian) {
    reverse_memcpy(dest_ptr, source_ptr, 8);
  } else {
    memcpy(dest_ptr, source_ptr, 8);
  }
}


x86 assembly (clang, -O0):
<int64_to_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1163 <int64_to_bytes+0x43>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x8,%edx
call   1030 <reverse_memcpy@plt>
jmp    1175 <int64_to_bytes+0x55>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int64_to_bytes>:
push   %rax
mov    %rsi,%rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    %rax,%rdi
test   %edx,%edx
je     1140 <int64_to_bytes+0x20>
mov    $0x8,%edx
call   1030 <reverse_memcpy@plt>
pop    %rax
ret
mov    $0x8,%edx
call   1040 <memcpy@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @int64_to_bytes(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %5
store i8* %9, i8** %7
%10 = bitcast i32* %4 to i8*
store i8* %10, i8** %8
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i8*, i8** %7
%15 = load i8*, i8** %8
%16 = call i32 @reverse_memcpy(i8* %14, i8* %15, i32 8)
br label %21
17: ; preds = %3
%18 = load i8*, i8** %7
%19 = load i8*, i8** %8
%20 = call i32 @memcpy(i8* %18, i8* %19, i32 8)
br label %21
21: ; preds = %17, %13
ret void
}

LLVM IR (-O2):
define void @int64_to_bytes(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
store i32 %0, i32* %4
%5 = bitcast i32* %4 to i8*
%6 = icmp eq i32 %2, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = call i32 @reverse_memcpy(i8* %1, i8* %5, i32 8)
br label %11
9: ; preds = %3
%10 = call i32 @memcpy(i8* %1, i8* %5, i32 8)
br label %11
11: ; preds = %9, %7
ret void
}
double Degrees(double arg) { return (arg / 1.745329251994330E-2); }


x86 assembly (clang, -O0):
<Degrees>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Degrees>:
divsd  0xef8(%rip),%xmm0
ret

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

LLVM IR (-O2):
define double @Degrees(double %0) {
%2 = fdiv double %0, 0x3F91DF46A2529D3A
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ clreol();
void cleartoeol() { clreol(); }


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

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

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

LLVM IR (-O2):
define void @cleartoeol() {
%1 = tail call i32 (...) @clreol()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("HelloWorld! from waf");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"HelloWorld! from waf\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"HelloWorld! from waf\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int sendto(int, char *, int, int, struct sockaddr const *, int);
int phrawSendTo(int m_hSocket, const void *lpBuf, int nBufLen,
                struct sockaddr_in *psockaddr_in, int nsockaddr_inLen,
                int nFlags) {
  int nResult;
  nResult = sendto(m_hSocket, (char *)lpBuf, nBufLen, nFlags,
                   (const struct sockaddr *)psockaddr_in, nsockaddr_inLen);
  return nResult;
}


x86 assembly (clang, -O0):
<phrawSendTo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
call   1030 <sendto@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phrawSendTo>:
mov    %r8d,%eax
mov    %rcx,%r8
mov    %r9d,%ecx
mov    %eax,%r9d
jmp    1030 <sendto@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @phrawSendTo(i32 %0, i8* %1, i32 %2, %struct.sockaddr_in* %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca %struct.sockaddr_in*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store %struct.sockaddr_in* %3, %struct.sockaddr_in** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i32, i32* %7
%15 = load i8*, i8** %8
%16 = load i32, i32* %9
%17 = load i32, i32* %12
%18 = load %struct.sockaddr_in*, %struct.sockaddr_in** %10
%19 = bitcast %struct.sockaddr_in* %18 to %struct.sockaddr*
%20 = load i32, i32* %11
%21 = call i32 @sendto(i32 %14, i8* %15, i32 %16, i32 %17, %struct.sockaddr* %19, i32 %20)
store i32 %21, i32* %13
%22 = load i32, i32* %13
ret i32 %22
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @phrawSendTo(i32 %0, i8* %1, i32 %2, %struct.sockaddr_in* %3, i32 %4, i32 %5) {
%7 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%8 = tail call i32 @sendto(i32 %0, i8* %1, i32 %2, i32 %5, %struct.sockaddr* %7, i32 %4)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_endswith();
int /*<<< orphan*/ test_find_file();
int /*<<< orphan*/ test_find_file_dont_exist();
int /*<<< orphan*/ test_join_paths();
int /*<<< orphan*/ test_remove_components();
int main(int argc, char *argv[]) {
  test_endswith();
  test_remove_components();
  test_join_paths();
  test_find_file();
  test_find_file_dont_exist();
  printf("Everything is ok!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <test_endswith@plt>
mov    $0x0,%al
call   1050 <test_remove_components@plt>
mov    $0x0,%al
call   1080 <test_join_paths@plt>
mov    $0x0,%al
call   1030 <test_find_file@plt>
mov    $0x0,%al
call   1070 <test_find_file_dont_exist@plt>
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <test_endswith@plt>
xor    %eax,%eax
call   1050 <test_remove_components@plt>
xor    %eax,%eax
call   1080 <test_join_paths@plt>
xor    %eax,%eax
call   1040 <test_find_file@plt>
xor    %eax,%eax
call   1070 <test_find_file_dont_exist@plt>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Everything is ok!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @test_endswith()
%7 = call i32 (...) @test_remove_components()
%8 = call i32 (...) @test_join_paths()
%9 = call i32 (...) @test_find_file()
%10 = call i32 (...) @test_find_file_dont_exist()
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [18 x i8] c"Everything is ok!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_endswith()
%4 = tail call i32 (...) @test_remove_components()
%5 = tail call i32 (...) @test_join_paths()
%6 = tail call i32 (...) @test_find_file()
%7 = tail call i32 (...) @test_find_file_dont_exist()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
float get_LCG_Pseudorandom_Number(const float max) {
  static uint32_t seed = 42;
  seed = (seed * 3877 + 29573) % 139968;
  return max / 139968 * seed;
}


x86 assembly (clang, -O0):
<get_LCG_Pseudorandom_Number>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
imul   $0xf25,0x2f0d(%rip),%eax
add    $0x7385,%eax
mov    $0x222c0,%ecx
cltd
idiv   %ecx
mov    %edx,0x2efa(%rip)
movss  -0x4(%rbp),%xmm0
movss  0xecd(%rip),%xmm1
divss  %xmm1,%xmm0
cvtsi2ssl 0x2ee1(%rip),%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_LCG_Pseudorandom_Number>:
imul   $0xf25,0x2f16(%rip),%eax
add    $0x7385,%eax
cltq
imul   $0x1df75681,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2e,%rcx
add    %edx,%ecx
imul   $0x222c0,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x2eed(%rip)
divss  0xec5(%rip),%xmm0
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
@get_LCG_Pseudorandom_Number.seed = internal global i32 42
define float @get_LCG_Pseudorandom_Number(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load i32, i32* @get_LCG_Pseudorandom_Number.seed
%4 = mul nsw i32 %3, 3877
%5 = add nsw i32 %4, 29573
%6 = srem i32 %5, 139968
store i32 %6, i32* @get_LCG_Pseudorandom_Number.seed
%7 = load float, float* %2
%8 = fdiv float %7, 1.399680e+05
%9 = load i32, i32* @get_LCG_Pseudorandom_Number.seed
%10 = sitofp i32 %9 to float
%11 = fmul float %8, %10
ret float %11
}

LLVM IR (-O2):
@get_LCG_Pseudorandom_Number.seed = internal unnamed_addr global i32 42
define float @get_LCG_Pseudorandom_Number(float %0) {
%2 = load i32, i32* @get_LCG_Pseudorandom_Number.seed
%3 = mul nsw i32 %2, 3877
%4 = add nsw i32 %3, 29573
%5 = srem i32 %4, 139968
store i32 %5, i32* @get_LCG_Pseudorandom_Number.seed
%6 = fdiv float %0, 1.399680e+05
%7 = sitofp i32 %5 to float
%8 = fmul float %6, %7
ret float %8
}
void asn1_GetSequence(void) {}


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

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

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

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

/* Variables and functions */
unsigned int cpupower_read_sysfs(char *, char *, size_t);
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned int, char const *);
unsigned int sysfs_cpufreq_read_file(unsigned int cpu, const char *fname,
                                     char *buf, size_t buflen) {
  char path[255];
  snprintf(path, sizeof(path),
           "/sys/devices/system/cpu/"
           "cpu%u/cpufreq/%s",
           cpu, fname);
  return cpupower_read_sysfs(path, buf, buflen);
}


x86 assembly (clang, -O0):
<sysfs_cpufreq_read_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    $0xff,%esi
lea    0xeac(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <cpupower_read_sysfs@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysfs_cpufreq_read_file>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r8
mov    %edi,%ecx
lea    0xec2(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0xff,%esi
call   1030 <snprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <cpupower_read_sysfs@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [41 x i8] c"/sys/devices/system/cpu/cpu%u/cpufreq/%s\00"
define i32 @sysfs_cpufreq_read_file(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca [255 x i8]
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%11 = load i32, i32* %5
%12 = load i8*, i8** %6
%13 = call i32 @snprintf(i8* %10, i32 255, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %12)
%14 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = load i64, i64* %8
%17 = call i32 @cpupower_read_sysfs(i8* %14, i8* %15, i64 %16)
ret i32 %17
}

LLVM IR (-O2):
@.str = [41 x i8] c"/sys/devices/system/cpu/cpu%u/cpufreq/%s\00"
define i32 @sysfs_cpufreq_read_file(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca [255 x i8]
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%7 = call i32 @snprintf(i8* %6, i32 255, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1)
%8 = call i32 @cpupower_read_sysfs(i8* %6, i8* %2, i64 %3)
ret i32 %8
}
int ifunc2(void) { return 0xbeefdead; }


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

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

LLVM IR (-O0):
define i32 @ifunc2() {
ret i32 -1091576147
}

LLVM IR (-O2):
define i32 @ifunc2() {
ret i32 -1091576147
}
/* Variables and functions */
int f(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("Output - %d\n", f(10, 20));
  printf("Output - %d\n", f(10, 20));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
mov    $0x14,%esi
call   1030 <f@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x14,%esi
call   1030 <f@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
mov    $0x14,%esi
call   1030 <f@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x14,%esi
call   1030 <f@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Output - %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 10, i32 20)
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @f(i32 10, i32 20)
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Output - %d\0A\00"
define i32 @main() {
%1 = tail call i32 @f(i32 10, i32 20)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @f(i32 10, i32 20)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}