xunge/DecIR huggingface dataset:
double lerp(double v1, double v2, double amount) {
  return v1 + (v2 - v1) * amount;
}


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

x86 assembly (clang, -O2):
<lerp>:
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @lerp(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = load double, double* %4
%10 = fsub double %8, %9
%11 = load double, double* %6
%12 = call double @llvm.fmuladd.f64(double %10, double %11, double %7)
ret double %12
}

LLVM IR (-O2):
define double @lerp(double %0, double %1, double %2) {
%4 = fsub double %1, %0
%5 = tail call double @llvm.fmuladd.f64(double %4, double %2, double %0)
ret double %5
}
int main(int argc, char *argv[], char *envp[]) {
  printf("Pi is about %.5f\n", argv);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"Pi is about %.5f\0A\00"
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 = load i8**, i8*** %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Pi is about %.5f\0A\00"
define i32 @main(i32 %0, i8** %1, i8** nocapture readnone %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ newhanoi(char *, char *);
int main() {
  char cur[5] = "AAABB";
  char obj[5] = "CABBB";
  newhanoi(cur, obj);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xed6(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xece(%rip),%eax
mov    %eax,-0xe(%rbp)
mov    0xec9(%rip),%al
mov    %al,-0xa(%rbp)
lea    -0x9(%rbp),%rdi
lea    -0xe(%rbp),%rsi
call   1030 <newhanoi@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movb   $0x42,0x14(%rsp)
movl   $0x42414141,0x10(%rsp)
42
movb   $0x42,0xc(%rsp)
movl   $0x42424143,0x8(%rsp)
42
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <newhanoi@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.cur = [5 x i8] c"AAABB"
@__const.main.obj = [5 x i8] c"CABBB"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca [5 x i8]
store i32 0, i32* %1
%4 = bitcast [5 x i8]* %2 to i8*
%5 = bitcast [5 x i8]* %3 to i8*
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%8 = call i32 @newhanoi(i8* %6, i8* %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.cur = [5 x i8] c"AAABB"
@__const.main.obj = [5 x i8] c"CABBB"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i32 @newhanoi(i8* %3, i8* %4)
ret i32 0
}
/* Variables and functions */
int RAND_MAX;
int rand();
int random_number(void) {
  int i = 0;
  while (rand() < RAND_MAX / 2)
    ++i;
  return i;
}


x86 assembly (clang, -O0):
<random_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    0x2eb8(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
jge    1155 <random_number+0x45>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <random_number+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_number>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
mov    0x2ec8(%rip),%r14
xor    %eax,%eax
call   1030 <rand@plt>
mov    (%r14),%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
add    $0x1,%ebx
cmp    %edx,%eax
jl     1120 <random_number+0x10>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @random_number() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %7, %0
%3 = call i32 (...) @rand()
%4 = load i32, i32* @RAND_MAX
%5 = sdiv i32 %4, 2
%6 = icmp slt i32 %3, %5
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
br label %2
10: ; preds = %2
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @random_number() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %7, %1 ]
%3 = tail call i32 (...) @rand()
%4 = load i32, i32* @RAND_MAX
%5 = sdiv i32 %4, 2
%6 = icmp slt i32 %3, %5
%7 = add nuw nsw i32 %2, 1
br i1 %6, label %1, label %8
8: ; preds = %1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int /*<<< orphan*/);
void getmsg(int f, void *p, void *p2, void *p3) { sleep(0); }


x86 assembly (clang, -O0):
<getmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %edi,%edi
call   1030 <sleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @getmsg(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
%5 = tail call i32 @sleep(i32 0)
ret void
}
void kol_board_puti(int n) {
  char c;
  if (n > 1)
    kol_board_puti(n / 10);
  c = n % 10 + '0';
  asm volatile("int $0x40" ::"a"(63), "b"(1), "c"(c));
}


x86 assembly (clang, -O0):
<kol_board_puti>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    1135 <kol_board_puti+0x25>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <kol_board_puti@plt>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%cl
mov    $0x3f,%eax
mov    $0x1,%ebx
int    $0x40
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_board_puti>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
cmp    $0x2,%edi
jl     112e <kol_board_puti+0x1e>
mov    %ebp,%eax
mov    $0xcccccccd,%edi
imul   %rax,%rdi
shr    $0x23,%rdi
call   1030 <kol_board_puti@plt>
movslq %ebp,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebp
add    $0x30,%bpl
mov    $0x3f,%eax
mov    $0x1,%ebx
mov    %ebp,%ecx
int    $0x40
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @kol_board_puti(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sdiv i32 %7, 10
br label %9
9: ; preds = %6, %1
%10 = load i32, i32* %2
%11 = srem i32 %10, 10
%12 = add nsw i32 %11, 48
%13 = trunc i32 %12 to i8
store i8 %13, i8* %3
%14 = load i8, i8* %3
ret void
}

LLVM IR (-O2):
define void @kol_board_puti(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = udiv i32 %0, 10
tail call void @kol_board_puti(i32 %4)
br label %5
5: ; preds = %3, %1
%6 = srem i32 %0, 10
%7 = trunc i32 %6 to i8
%8 = add nsw i8 %7, 48
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 63, i32 1, i8 %8)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
void minipack_pack_int32(void *ptr, int32_t value, size_t *sz) {
  *sz = 5;
  *((uint8_t *)ptr) = 0xD2;
  *((int32_t *)(ptr + 1)) = htonl(value);
}


x86 assembly (clang, -O0):
<minipack_pack_int32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x5,(%rax)
mov    -0x8(%rbp),%rax
movl   $0xd2,(%rax)
mov    -0xc(%rbp),%edi
call   1030 <htonl@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_pack_int32>:
push   %rbx
mov    %rdi,%rbx
movq   $0x5,(%rdx)
movl   $0xd2,(%rdi)
mov    %esi,%edi
call   1030 <htonl@plt>
mov    %eax,0x1(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @minipack_pack_int32(i8* %0, i32 %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64* %2, i64** %6
%7 = load i64*, i64** %6
store i64 5, i64* %7
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
store i32 210, i32* %9
%10 = load i32, i32* %5
%11 = call i32 @htonl(i32 %10)
%12 = load i8*, i8** %4
%13 = getelementptr i8, i8* %12, i64 1
%14 = bitcast i8* %13 to i32*
store i32 %11, i32* %14
ret void
}

LLVM IR (-O2):
define void @minipack_pack_int32(i8* nocapture writeonly %0, i32 %1, i64* nocapture writeonly %2) {
store i64 5, i64* %2
%4 = bitcast i8* %0 to i32*
store i32 210, i32* %4
%5 = tail call i32 @htonl(i32 %1)
%6 = getelementptr i8, i8* %0, i64 1
%7 = bitcast i8* %6 to i32*
store i32 %5, i32* %7
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int fchmod(int, int /*<<< orphan*/);
int lisp_fchmod(int fd, mode_t mode) { return fchmod(fd, mode); }


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

x86 assembly (clang, -O2):
<lisp_fchmod>:
jmp    1030 <fchmod@plt>

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

LLVM IR (-O2):
define i32 @lisp_fchmod(i32 %0, i32 %1) {
%3 = tail call i32 @fchmod(i32 %0, i32 %1)
ret i32 %3
}
int raise(int a) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @raise(i32 %0) {
ret i32 0
}
/* Type definitions */
typedef int ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int freadfile(int /*<<< orphan*/ *, char **);
ssize_t readfile(const char *filename, char **pp) {
  FILE *f = fopen(filename, "r");
  ssize_t rv;
  if (!f)
    return -1;
  rv = freadfile(f, pp);
  fclose(f);
  return rv;
}


x86 assembly (clang, -O0):
<readfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    116b <readfile+0x3b>
movl   $0xffffffff,-0x4(%rbp)
jmp    118a <readfile+0x5a>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <freadfile@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readfile>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1164 <readfile+0x34>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <freadfile@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %ebp,%eax
jmp    1169 <readfile+0x39>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i32 @readfile(i8* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %6
%10 = load i32*, i32** %6
%11 = icmp ne i32* %10, null
br i1 %11, label %13, label %12
12: ; preds = %2
store i32 -1, i32* %3
br label %20
13: ; preds = %2
%14 = load i32*, i32** %6
%15 = load i8**, i8*** %5
%16 = call i32 @freadfile(i32* %14, i8** %15)
store i32 %16, i32* %7
%17 = load i32*, i32** %6
%18 = call i32 @fclose(i32* %17)
%19 = load i32, i32* %7
store i32 %19, i32* %3
br label %20
20: ; preds = %13, %12
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @readfile(i8* nocapture %0, i8** %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @freadfile(i32* %3, i8** %1)
%7 = tail call i32 @fclose(i32* %3)
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ %6, %5 ], [ -1, %2 ]
ret i32 %9
}
/* Type definitions */
struct timeval {
  unsigned int tv_sec;
};

/* Variables and functions */
void time_inc(struct timeval *tv, unsigned int seconds) {
  tv->tv_sec += seconds;
}


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

x86 assembly (clang, -O2):
<time_inc>:
add    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define void @time_inc(%struct.timeval* %0, i32 %1) {
%3 = alloca %struct.timeval*
%4 = alloca i32
store %struct.timeval* %0, %struct.timeval** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load %struct.timeval*, %struct.timeval** %3
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = add i32 %8, %5
store i32 %9, i32* %7
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define void @time_inc(%struct.timeval* nocapture %0, i32 %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%4 = load i32, i32* %3
%5 = add i32 %4, %1
store i32 %5, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void badsfmt(void) {
  (void)fprintf(stderr,
                ("hexdump: %%s requires a precision or a byte count.\n"));
  exit(1);
}


x86 assembly (clang, -O0):
<badsfmt>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<badsfmt>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [52 x i8] c"hexdump: %%s requires a precision or a byte count.\0A\00"
define void @badsfmt() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [52 x i8] c"hexdump: %%s requires a precision or a byte count.\0A\00"
define void @badsfmt() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int i = -1;
  for (i = 0; i < 10; ++i) {
    if (i == 5) {
      break;
    }
  }
  printf("i =%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1160 <main+0x50>
cmpl   $0x5,-0x14(%rbp)
jne    114d <main+0x3d>
jmp    1160 <main+0x50>
jmp    1152 <main+0x42>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
mov    -0x14(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"i =%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 5)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void LCDDMAConfigSet(uint32_t ui32Base, uint32_t ui32Config) {
  ;

  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000040))) = ui32Config;
}


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

x86 assembly (clang, -O2):
<LCDDMAConfigSet>:
mov    %rsi,0x40(%rdi)
ret

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

LLVM IR (-O2):
define void @LCDDMAConfigSet(i64 %0, i64 %1) {
%3 = add nsw i64 %0, 64
%4 = inttoptr i64 %3 to i64*
store volatile i64 %1, i64* %4
ret void
}
void ARGBQuantizeRow_C() {}


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

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

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

LLVM IR (-O2):
define void @ARGBQuantizeRow_C() {
ret void
}
int rt_mutex_get_effective_prio(struct task_struct *task, int newprio) {
  return newprio;
}


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

x86 assembly (clang, -O2):
<rt_mutex_get_effective_prio>:
mov    %esi,%eax
ret

LLVM IR (-O0):
%struct.task_struct = type opaque
define i32 @rt_mutex_get_effective_prio(%struct.task_struct* %0, i32 %1) {
%3 = alloca %struct.task_struct*
%4 = alloca i32
store %struct.task_struct* %0, %struct.task_struct** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.task_struct = type opaque
define i32 @rt_mutex_get_effective_prio(%struct.task_struct* nocapture readnone %0, i32 returned %1) {
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int write_data(int /*<<< orphan*/ *, int, unsigned char *, int);
int write_partition_physical_disk_drive_id_fat16(FILE *fp) {
  unsigned char ucId = 0x80;
  return write_data(fp, 0x24, &ucId, 1);
}


x86 assembly (clang, -O0):
<write_partition_physical_disk_drive_id_fat16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x80,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x24,%esi
lea    -0x9(%rbp),%rdx
mov    $0x1,%ecx
call   1030 <write_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_partition_physical_disk_drive_id_fat16>:
push   %rax
movb   $0x80,0x7(%rsp)
lea    0x7(%rsp),%rdx
mov    $0x24,%esi
mov    $0x1,%ecx
call   1030 <write_data@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @write_partition_physical_disk_drive_id_fat16(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
store i8 -128, i8* %3
%4 = load i32*, i32** %2
%5 = call i32 @write_data(i32* %4, i32 36, i8* %3, i32 1)
ret i32 %5
}

LLVM IR (-O2):
define i32 @write_partition_physical_disk_drive_id_fat16(i32* %0) {
%2 = alloca i8
store i8 -128, i8* %2
%3 = call i32 @write_data(i32* %0, i32 36, i8* %2, i32 1)
ret i32 %3
}
/* Variables and functions */
int ENODEV;
int qpnp_get_s2_en(int pon_type) { return -ENODEV; }


x86 assembly (clang, -O0):
<qpnp_get_s2_en>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    0x2ed0(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qpnp_get_s2_en>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@ENODEV = global i32 0
define i32 @qpnp_get_s2_en(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @ENODEV
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
@ENODEV = global i32 0
define i32 @qpnp_get_s2_en(i32 %0) {
%2 = load i32, i32* @ENODEV
%3 = sub nsw i32 0, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0x95() {
  Assert_real((isbdigit(149) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isbdigit.c",
              750, ("isbdigit should be 0 for 0x95"));
}


x86 assembly (clang, -O0):
<t_isbdigit_0x95>:
push   %rbp
mov    %rsp,%rbp
mov    $0x95,%edi
call   1040 <isbdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x2ee,%edx
lea    0xf5c(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isbdigit_0x95>:
push   %rax
mov    $0x95,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x2ee,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x95\00"
define void @t_isbdigit_0x95() {
%1 = call i64 @isbdigit(i32 149)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 750, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x95\00"
define void @t_isbdigit_0x95() {
%1 = tail call i64 @isbdigit(i32 149)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 750, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int level_to_prl(int level) {
  switch (level) {
  case (-1):
    return 0x1f;
  case 0:
    return 0x00;
  case 1:
    return 0x01;
  case 4:
    return 0x04;
  case 5:
    return 0x05;
  case 6:
    return 0x06;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<level_to_prl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     1178 <level_to_prl+0x78>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1f,-0x4(%rbp)
jmp    117f <level_to_prl+0x7f>
movl   $0x0,-0x4(%rbp)
jmp    117f <level_to_prl+0x7f>
movl   $0x1,-0x4(%rbp)
jmp    117f <level_to_prl+0x7f>
movl   $0x4,-0x4(%rbp)
jmp    117f <level_to_prl+0x7f>
movl   $0x5,-0x4(%rbp)
jmp    117f <level_to_prl+0x7f>
movl   $0x6,-0x4(%rbp)
jmp    117f <level_to_prl+0x7f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<level_to_prl>:
add    $0x1,%edi
mov    $0xffffffff,%eax
cmp    $0x7,%edi
ja     111a <level_to_prl+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @level_to_prl(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 -1, label %5
i32 0, label %6
i32 1, label %7
i32 4, label %8
i32 5, label %9
i32 6, label %10
]
5: ; preds = %1
store i32 31, i32* %2
br label %12
6: ; preds = %1
store i32 0, i32* %2
br label %12
7: ; preds = %1
store i32 1, i32* %2
br label %12
8: ; preds = %1
store i32 4, i32* %2
br label %12
9: ; preds = %1
store i32 5, i32* %2
br label %12
10: ; preds = %1
store i32 6, i32* %2
br label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %12
12: ; preds = %11, %10, %9, %8, %7, %6, %5
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@switch.table.level_to_prl = [8 x i32] [i32 31, i32 0, i32 1, i32 -1, i32 -1, i32 4, i32 5, i32 6]
define i32 @level_to_prl(i32 %0) {
%2 = add i32 %0, 1
%3 = icmp ult i32 %2, 8
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.level_to_prl, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ -1, %1 ]
ret i32 %9
}
__attribute__((no, noclone)) char *fn3(char *p) {
  *p = 0;
  return p + 1;
}


x86 assembly (clang, -O0):
<fn3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn3>:
movb   $0x0,(%rdi)
lea    0x1(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @fn3(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
store i8 0, i8* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 1
ret i8* %5
}

LLVM IR (-O2):
define i8* @fn3(i8* writeonly %0) {
store i8 0, i8* %0
%2 = getelementptr inbounds i8, i8* %0, i64 1
ret i8* %2
}
const char *utf8_prev(const char *s, const char *e) {
  const char *look = e - 1;
  while (s <= look) {
    unsigned ch = (unsigned char)*look;
    if (ch < 0x80 || ch >= 0xC0)
      return look;
    --look;
  }
  return s;
}


x86 assembly (clang, -O0):
<utf8_prev>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
ja     1168 <utf8_prev+0x68>
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x80,-0x24(%rbp)
jb     114a <utf8_prev+0x4a>
cmpl   $0xc0,-0x24(%rbp)
jb     1157 <utf8_prev+0x57>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1170 <utf8_prev+0x70>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1118 <utf8_prev+0x18>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_prev>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rsi
nopw   0x0(%rax,%rax,1)
cmp    %rax,%rsi
jb     1128 <utf8_prev+0x28>
lea    -0x1(%rsi),%rcx
cmpb   $0xc0,(%rsi)
mov    %rcx,%rsi
jl     1110 <utf8_prev+0x10>
add    $0x1,%rcx
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i8* @utf8_prev(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i64 -1
store i8* %9, i8** %6
br label %10
10: ; preds = %25, %2
%11 = load i8*, i8** %4
%12 = load i8*, i8** %6
%13 = icmp ule i8* %11, %12
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = load i8*, i8** %6
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = icmp ult i32 %18, 128
br i1 %19, label %23, label %20
20: ; preds = %14
%21 = load i32, i32* %7
%22 = icmp uge i32 %21, 192
br i1 %22, label %23, label %25
23: ; preds = %20, %14
%24 = load i8*, i8** %6
store i8* %24, i8** %3
br label %30
25: ; preds = %20
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i32 -1
store i8* %27, i8** %6
br label %10
28: ; preds = %10
%29 = load i8*, i8** %4
store i8* %29, i8** %3
br label %30
30: ; preds = %28, %23
%31 = load i8*, i8** %3
ret i8* %31
}

LLVM IR (-O2):
define i8* @utf8_prev(i8* readnone %0, i8* %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %1, %2 ], [ %5, %7 ]
%5 = getelementptr inbounds i8, i8* %4, i64 -1
%6 = icmp ult i8* %5, %0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = load i8, i8* %5
%9 = icmp sgt i8 %8, -65
br i1 %9, label %10, label %3
10: ; preds = %3, %7
%11 = phi i8* [ %5, %7 ], [ %0, %3 ]
ret i8* %11
}
/* Variables and functions */
char *new_ident();
char *read_ident();
char *get_ident() {
  char *buf;
  buf = read_ident();
  if (!buf) {
    buf = new_ident();
  }
  return buf;
}


x86 assembly (clang, -O0):
<get_ident>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <read_ident@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1149 <get_ident+0x29>
mov    $0x0,%al
call   1040 <new_ident@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ident>:
push   %rax
xor    %eax,%eax
call   1030 <read_ident@plt>
test   %rax,%rax
je     112f <get_ident+0xf>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
jmp    1040 <new_ident@plt>

LLVM IR (-O0):
define i8* @get_ident() {
%1 = alloca i8*
%2 = call i8* (...) @read_ident()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i8* (...) @new_ident()
store i8* %6, i8** %1
br label %7
7: ; preds = %5, %0
%8 = load i8*, i8** %1
ret i8* %8
}

LLVM IR (-O2):
define i8* @get_ident() {
%1 = tail call i8* (...) @read_ident()
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i8* (...) @new_ident()
br label %5
5: ; preds = %3, %0
%6 = phi i8* [ %1, %0 ], [ %4, %3 ]
ret i8* %6
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ puts(char *);
int main(void) {
  int c;
  puts("internet2");
  c = getchar();
  if (EOF == c) {
    puts("got EOF!");
  } else {
    puts("got char: ");
    putchar(c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8c(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    1178 <main+0x48>
lea    0xe9c(%rip),%rdi
call   1040 <puts@plt>
jmp    118c <main+0x5c>
lea    0xe94(%rip),%rdi
call   1040 <puts@plt>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
mov    0x2e9b(%rip),%rax
cmp    %ebx,(%rax)
jne    115f <main+0x2f>
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
jmp    1172 <main+0x42>
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"internet2\00"
@EOF = global i32 0
@.str.1 = [9 x i8] c"got EOF!\00"
@.str.2 = [11 x i8] c"got char: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = load i32, i32* %2
%7 = icmp eq i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %14
10: ; preds = %0
%11 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = call i32 @putchar(i32 %12)
br label %14
14: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"internet2\00"
@EOF = global i32 0
@.str.1 = [9 x i8] c"got EOF!\00"
@.str.2 = [11 x i8] c"got char: \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %3, %2
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %10
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @putchar(i32 %2)
br label %10
10: ; preds = %7, %5
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(void) {
#pragma omp parallel
  puts("Hello, World!\n");
  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 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Hello, World!\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void cpuid(int reg[4], int id) {
  __asm("cpuid"
        : "=a"(reg[0]), "=b"(reg[1]), "=c"(reg[2]), "=d"(reg[3])
        : "a"(id), "c"(0)
        :);
}


x86 assembly (clang, -O0):
<cpuid>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%r8
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
xor    %ecx,%ecx
cpuid
mov    %eax,%r9d
mov    -0x28(%rbp),%rax
mov    %ecx,%esi
mov    -0x20(%rbp),%rcx
mov    %r9d,(%r8)
mov    %ebx,0x4(%rdi)
mov    %esi,0x8(%rcx)
mov    %edx,0xc(%rax)
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid>:
push   %rbx
mov    %esi,%eax
xor    %ecx,%ecx
cpuid
mov    %eax,(%rdi)
mov    %ebx,0x4(%rdi)
mov    %ecx,0x8(%rdi)
mov    %edx,0xc(%rdi)
pop    %rbx
ret

LLVM IR (-O0):
define void @cpuid(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 2
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 3
%13 = load i32, i32* %4
%14 = call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},{cx},~{dirflag},~{fpsr},~{flags}"(i32 %13, i32 0)
%15 = extractvalue { i32, i32, i32, i32 } %14, 0
%16 = extractvalue { i32, i32, i32, i32 } %14, 1
%17 = extractvalue { i32, i32, i32, i32 } %14, 2
%18 = extractvalue { i32, i32, i32, i32 } %14, 3
store i32 %15, i32* %6
store i32 %16, i32* %8
store i32 %17, i32* %10
store i32 %18, i32* %12
ret void
}

LLVM IR (-O2):
define void @cpuid(i32* nocapture writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = getelementptr inbounds i32, i32* %0, i64 2
%5 = getelementptr inbounds i32, i32* %0, i64 3
%6 = tail call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},{cx},~{dirflag},~{fpsr},~{flags}"(i32 %1, i32 0)
%7 = extractvalue { i32, i32, i32, i32 } %6, 0
%8 = extractvalue { i32, i32, i32, i32 } %6, 1
%9 = extractvalue { i32, i32, i32, i32 } %6, 2
%10 = extractvalue { i32, i32, i32, i32 } %6, 3
store i32 %7, i32* %0
store i32 %8, i32* %3
store i32 %9, i32* %4
store i32 %10, i32* %5
ret void
}
/* Type definitions */
struct bufferevent {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bufferevent_get_input(struct bufferevent *);
int /*<<< orphan*/ bufferevent_write_buffer(struct bufferevent *,
                                            int /*<<< orphan*/);
void __attribute__((weak)) client_read_cb(struct bufferevent *bev, void *ctx) {
  bufferevent_write_buffer(bev, bufferevent_get_input(bev));
}


x86 assembly (clang, -O0):
<client_read_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <bufferevent_get_input@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <bufferevent_write_buffer@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.bufferevent = type { i32 }
define weak void @client_read_cb(%struct.bufferevent* %0, i8* %1) {
%3 = alloca %struct.bufferevent*
%4 = alloca i8*
store %struct.bufferevent* %0, %struct.bufferevent** %3
store i8* %1, i8** %4
%5 = load %struct.bufferevent*, %struct.bufferevent** %3
%6 = load %struct.bufferevent*, %struct.bufferevent** %3
%7 = call i32 @bufferevent_get_input(%struct.bufferevent* %6)
%8 = call i32 @bufferevent_write_buffer(%struct.bufferevent* %5, i32 %7)
ret void
}

LLVM IR (-O2):
%struct.bufferevent = type { i32 }
define weak void @client_read_cb(%struct.bufferevent* %0, i8* %1) {
%3 = tail call i32 @bufferevent_get_input(%struct.bufferevent* %0)
%4 = tail call i32 @bufferevent_write_buffer(%struct.bufferevent* %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ swap(char *, int, int);
void reverse(char s[], int fi, int bi) {
  if (fi < bi) {
    swap(s, fi, bi);
    fi++;
    bi--;
    reverse(s, fi, bi);
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    116e <reverse+0x4e>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <swap@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <reverse@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rbp
push   %r14
push   %rbx
cmp    %edx,%esi
jge    1136 <reverse+0x26>
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
nop
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <swap@plt>
add    $0x1,%ebp
add    $0xffffffff,%ebx
cmp    %ebx,%ebp
jl     1120 <reverse+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @reverse(i8* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %12
5: ; preds = %3, %5
%6 = phi i32 [ %10, %5 ], [ %2, %3 ]
%7 = phi i32 [ %9, %5 ], [ %1, %3 ]
%8 = tail call i32 @swap(i8* %0, i32 %7, i32 %6)
%9 = add nsw i32 %7, 1
%10 = add nsw i32 %6, -1
%11 = icmp slt i32 %9, %10
br i1 %11, label %5, label %12
12: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage: ./rc4 <keystring> <inputfile> <outputfile>\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"Usage: ./rc4 <keystring> <inputfile> <outputfile>\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [50 x i8] c"Usage: ./rc4 <keystring> <inputfile> <outputfile>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
int a() { return 10; }


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

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

LLVM IR (-O0):
define i32 @a() {
ret i32 10
}

LLVM IR (-O2):
define i32 @a() {
ret i32 10
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(int);
int /*<<< orphan*/ stderr;
void *fz_malloc(int size) {
  void *p = malloc(size);
  if (!p) {
    fprintf(stderr, "fatal error: out of memory\n");
    abort();
  }
  return p;
}


x86 assembly (clang, -O0):
<fz_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116e <fz_malloc+0x3e>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fz_malloc>:
push   %rax
call   1050 <malloc@plt>
test   %rax,%rax
je     113d <fz_malloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"fatal error: out of memory\0A\00"
define i8* @fz_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"fatal error: out of memory\0A\00"
define noalias i8* @fz_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ fork();
int getpid();
int /*<<< orphan*/ printf(char *, int);
void main() {
  int i;
  fork();
  printf("\nid ==== %d\n", getpid());
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <fork@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <fork@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xeba(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"\0Aid ==== %d\0A\00"
define void @main() {
%1 = tail call i32 (...) @fork()
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Type definitions */
struct pmd_part {
  int dummy;
};
struct fmdriver_work {
  int dummy;
};
struct driver_pmd {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pmd_part_cmdload(struct driver_pmd *, struct pmd_part *);
void pmd_cmdd2_fadeout(struct fmdriver_work *work, struct driver_pmd *pmd,
                       struct pmd_part *part) {
  (void)work;
  pmd_part_cmdload(pmd, part);
}


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

x86 assembly (clang, -O2):
<pmd_cmdd2_fadeout>:
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <pmd_part_cmdload@plt>

LLVM IR (-O0):
%struct.fmdriver_work = type { i32 }
%struct.driver_pmd = type { i32 }
%struct.pmd_part = type { i32 }
define void @pmd_cmdd2_fadeout(%struct.fmdriver_work* %0, %struct.driver_pmd* %1, %struct.pmd_part* %2) {
%4 = alloca %struct.fmdriver_work*
%5 = alloca %struct.driver_pmd*
%6 = alloca %struct.pmd_part*
store %struct.fmdriver_work* %0, %struct.fmdriver_work** %4
store %struct.driver_pmd* %1, %struct.driver_pmd** %5
store %struct.pmd_part* %2, %struct.pmd_part** %6
%7 = load %struct.fmdriver_work*, %struct.fmdriver_work** %4
%8 = load %struct.driver_pmd*, %struct.driver_pmd** %5
%9 = load %struct.pmd_part*, %struct.pmd_part** %6
%10 = call i32 @pmd_part_cmdload(%struct.driver_pmd* %8, %struct.pmd_part* %9)
ret void
}

LLVM IR (-O2):
%struct.fmdriver_work = type { i32 }
%struct.driver_pmd = type { i32 }
%struct.pmd_part = type { i32 }
define void @pmd_cmdd2_fadeout(%struct.fmdriver_work* nocapture readnone %0, %struct.driver_pmd* %1, %struct.pmd_part* %2) {
%4 = tail call i32 @pmd_part_cmdload(%struct.driver_pmd* %1, %struct.pmd_part* %2)
ret void
}