xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
int file_open(const char *filename) {
  int fd = open(filename, O_RDWR);
  if (fd < 0) {
    perror(filename);
    exit(EXIT_FAILURE);
  }
  return fd;
}


x86 assembly (clang, -O0):
<file_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1172 <file_open+0x42>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_open>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
test   %eax,%eax
js     1148 <file_open+0x18>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@O_RDWR = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @file_open(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDWR
%6 = call i32 @open(i8* %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @perror(i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %1
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @file_open(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = tail call i32 @perror(i8* %0)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret i32 %3
}
void bardef() {}


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

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

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

LLVM IR (-O2):
define void @bardef() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) { printf("Hello, World!\n"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%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 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello, World!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
unsigned long posUnsignedLongExtract(unsigned char *);
int timePackageProcess(unsigned char *inbuf, unsigned long *timeS) {
  *timeS = posUnsignedLongExtract(inbuf);
  return (4);
}


x86 assembly (clang, -O0):
<timePackageProcess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <posUnsignedLongExtract@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x4,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timePackageProcess>:
push   %rbx
mov    %rsi,%rbx
call   1030 <posUnsignedLongExtract@plt>
mov    %rax,(%rbx)
mov    $0x4,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @timePackageProcess(i8* %0, i64* nocapture writeonly %1) {
%3 = tail call i64 @posUnsignedLongExtract(i8* %0)
store i64 %3, i64* %1
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ cmd_reget_get(int, char *, int);
void cmd_reget(int idx, char *par) { cmd_reget_get(idx, par, 1); }


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

x86 assembly (clang, -O2):
<cmd_reget>:
mov    $0x1,%edx
jmp    1030 <cmd_reget_get@plt>

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

LLVM IR (-O2):
define void @cmd_reget(i32 %0, i8* %1) {
%3 = tail call i32 @cmd_reget_get(i32 %0, i8* %1, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int a;
  int b;
  a = 6;
  b = 5;
  a == b ? printf("A=B") : (a > b ? printf("A>B") : printf("A<B"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x6,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    114a <main+0x3a>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <main+0x6c>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    116a <main+0x5a>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,-0x10(%rbp)
jmp    1179 <main+0x69>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
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 = [4 x i8] c"A=B\00"
@.str.1 = [4 x i8] c"A>B\00"
@.str.2 = [4 x i8] c"A<B\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 6, i32* %2
store i32 5, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %19
9: ; preds = %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %17
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ %14, %13 ], [ %16, %15 ]
br label %19
19: ; preds = %17, %7
%20 = phi i32 [ %8, %7 ], [ %18, %17 ]
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"A>B\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ngen(char *, char *, int);
void cgldlw(int n) { ngen("%s\tax,[bp%+d]", "mov", n); }


x86 assembly (clang, -O0):
<cgldlw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xedb(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <ngen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgldlw>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xeee(%rip),%rsi
jmp    1030 <ngen@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%s\09ax,[bp%+d]\00"
@.str.1 = [4 x i8] c"mov\00"
define void @cgldlw(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @ngen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s\09ax,[bp%+d]\00"
@.str.1 = [4 x i8] c"mov\00"
define void @cgldlw(i32 %0) {
%2 = tail call i32 @ngen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(double *);
void C_Utils_free_double_ptr(double *item) { free(item); }


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

x86 assembly (clang, -O2):
<C_Utils_free_double_ptr>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @C_Utils_free_double_ptr(double* nocapture %0) {
%2 = tail call i32 @free(double* %0)
ret void
}
/* Variables and functions */
unsigned short readbyte();
unsigned short readword(void) {
  unsigned short w = readbyte();
  return (w << 8) | readbyte();
}


x86 assembly (clang, -O0):
<readword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <readbyte@plt>
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <readbyte@plt>
mov    %ax,%cx
mov    -0x8(%rbp),%eax
movzwl %cx,%ecx
or     %ecx,%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readword>:
push   %rbx
xor    %eax,%eax
call   1030 <readbyte@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
xor    %eax,%eax
call   1030 <readbyte@plt>
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i16 @readword() {
%1 = alloca i16
%2 = call zeroext i16 (...) @readbyte()
store i16 %2, i16* %1
%3 = load i16, i16* %1
%4 = zext i16 %3 to i32
%5 = shl i32 %4, 8
%6 = call zeroext i16 (...) @readbyte()
%7 = zext i16 %6 to i32
%8 = or i32 %5, %7
%9 = trunc i32 %8 to i16
ret i16 %9
}

LLVM IR (-O2):
define zeroext i16 @readword() {
%1 = tail call zeroext i16 (...) @readbyte()
%2 = shl i16 %1, 8
%3 = tail call zeroext i16 (...) @readbyte()
%4 = or i16 %2, %3
ret i16 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlock_t;

/* Variables and functions */
int ENOSYS;
int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) { return -ENOSYS; }


x86 assembly (clang, -O0):
<pthread_rwlock_tryrdlock>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    0x2ed7(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @pthread_rwlock_tryrdlock(i32* nocapture readnone %0) {
%2 = load i32, i32* @ENOSYS
%3 = sub nsw i32 0, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ inlined();
main() {
retry:
  inlined();
  goto retry;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <inlined@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <inlined@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %2, %0
%3 = call i32 (...) @inlined()
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @inlined()
br label %1
}
void Draco9210ClearDataOut() {}


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

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

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

LLVM IR (-O2):
define void @Draco9210ClearDataOut() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() { printf("%d\n", 7 + 8); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 15)
ret i32 0
}
int debug_step_04(int y, int z) {
  int x = y + z;
  x++;
  x++;
  x++;
  x++;
  x++;
  x++;
  x++;
  x++;
  x++;
  x++;
  return x;
}


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

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

LLVM IR (-O0):
define i32 @debug_step_04(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
define i32 @debug_step_04(i32 %0, i32 %1) {
%3 = add i32 %0, 10
%4 = add i32 %3, %1
ret i32 %4
}
char *get_shell_version() { return "0.1.0-SNAPSHOT"; }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"0.1.0-SNAPSHOT\00"
define i8* @get_shell_version() {
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [15 x i8] c"0.1.0-SNAPSHOT\00"
define i8* @get_shell_version() {
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
}
int __ocl_all_long(long src) { return (src >> (64 - 1)) & 0x1; }


x86 assembly (clang, -O0):
<__ocl_all_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sar    $0x3f,%rax
and    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_all_long>:
mov    %rdi,%rax
shr    $0x3f,%rax
ret

LLVM IR (-O0):
define i32 @__ocl_all_long(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 63
%5 = and i64 %4, 1
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @__ocl_all_long(i64 %0) {
%2 = lshr i64 %0, 63
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
char para_maiuscula(char);
void string_para_maiuscula(char *c) {
  int i;
  i = 0;
  while (c[i] != '\0') {
    c[i] = para_maiuscula(c[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<string_para_maiuscula>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1164 <string_para_maiuscula+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <para_maiuscula@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <string_para_maiuscula+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_para_maiuscula>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <string_para_maiuscula+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <para_maiuscula@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <string_para_maiuscula+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @string_para_maiuscula(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %11, %4 ], [ %2, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = tail call signext i8 @para_maiuscula(i8 signext %6)
store i8 %8, i8* %7
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_get_state_dir() {
  printf("NOT IMPLEMENTED:"
         "pa_get_state_dir"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"NOT IMPLEMENTED:pa_get_state_dir\0A\00"
define i32 @pa_get_state_dir() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [33 x i8] c"NOT IMPLEMENTED:pa_get_state_dir\00"
define i32 @pa_get_state_dir() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, char *);
main() {
  char my_word[] = {'R', 'o', 'b', 'e', 'r', 't'};
  char *my_scnd_word = "Robert";
  printf("%s\n", my_word);
  printf("%s", my_scnd_word);
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x6(%rbp)
mov    0xecc(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x6(%rbp),%rsi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movw   $0x7472,0x4(%rsp)
movl   $0x65626f52,(%rsp)
lea    0xed7(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    0xeba(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@__const.main.my_word = [6 x i8] c"Robert"
@.str = [7 x i8] c"Robert\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @getchar()
ret i32 0
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int __stat_common(int, struct stat *);
int /*<<< orphan*/ memset(struct stat *, int /*<<< orphan*/, int);
int _fstat(int file, struct stat *st) {
  memset(st, 0, sizeof(*st));
  return __stat_common(file, st);
}


x86 assembly (clang, -O0):
<_fstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <__stat_common@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fstat>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <__stat_common@plt>

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @_fstat(i32 %0, %struct.stat* %1) {
%3 = tail call i32 @memset(%struct.stat* %1, i32 0, i32 4)
%4 = tail call i32 @__stat_common(i32 %0, %struct.stat* %1)
ret i32 %4
}
/* Variables and functions */
size_t op_hash_string(char const *str) {
  size_t hash = 0;
  for (; *str; ++str)
    hash ^= (hash << 16) ^ (hash >> 8) ^ *str;
  return hash;
}


x86 assembly (clang, -O0):
<op_hash_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1154 <op_hash_string+0x54>
mov    -0x10(%rbp),%rax
shl    $0x10,%rax
mov    -0x10(%rbp),%rcx
shr    $0x8,%rcx
xor    %rcx,%rax
mov    -0x8(%rbp),%rcx
movsbq (%rcx),%rcx
xor    %rcx,%rax
xor    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <op_hash_string+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_hash_string>:
mov    (%rdi),%cl
test   %cl,%cl
je     1134 <op_hash_string+0x34>
add    $0x1,%rdi
xor    %edx,%edx
mov    %rdx,%rax
nop
shr    $0x8,%rax
xor    %rdx,%rax
shl    $0x10,%rdx
movsbq %cl,%rcx
xor    %rdx,%rcx
xor    %rcx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %rax,%rdx
test   %cl,%cl
jne    1110 <op_hash_string+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @op_hash_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
br label %4
4: ; preds = %20, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %4
%9 = load i64, i64* %3
%10 = shl i64 %9, 16
%11 = load i64, i64* %3
%12 = lshr i64 %11, 8
%13 = xor i64 %10, %12
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i64
%17 = xor i64 %13, %16
%18 = load i64, i64* %3
%19 = xor i64 %18, %17
store i64 %19, i64* %3
br label %20
20: ; preds = %8
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %2
br label %4
23: ; preds = %4
%24 = load i64, i64* %3
ret i64 %24
}

LLVM IR (-O2):
define i64 @op_hash_string(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %15, %4 ], [ %2, %1 ]
%6 = phi i64 [ %13, %4 ], [ 0, %1 ]
%7 = phi i8* [ %14, %4 ], [ %0, %1 ]
%8 = shl i64 %6, 16
%9 = lshr i64 %6, 8
%10 = sext i8 %5 to i64
%11 = xor i64 %9, %6
%12 = xor i64 %11, %8
%13 = xor i64 %12, %10
%14 = getelementptr inbounds i8, i8* %7, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %4, %1
%18 = phi i64 [ 0, %1 ], [ %13, %4 ]
ret i64 %18
}
/* Type definitions */
typedef int /*<<< orphan*/ cork;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ TCP_CORK;
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int *, int);
void _nxweb_batch_write_begin(int fd) {
  int cork = 1;
  setsockopt(fd, IPPROTO_TCP, TCP_CORK, &cork, sizeof(cork));
}


x86 assembly (clang, -O0):
<_nxweb_batch_write_begin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nxweb_batch_write_begin>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rax
ret

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@TCP_CORK = global i32 0
define void @_nxweb_batch_write_begin(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @IPPROTO_TCP
%6 = load i32, i32* @TCP_CORK
%7 = call i32 @setsockopt(i32 %4, i32 %5, i32 %6, i32* %3, i32 4)
ret void
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@TCP_CORK = global i32 0
define void @_nxweb_batch_write_begin(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @IPPROTO_TCP
%5 = load i32, i32* @TCP_CORK
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
ret void
}
unsigned get_bit(unsigned x, unsigned n) {
  x >>= n;
  return x & 1;
}


x86 assembly (clang, -O0):
<get_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
shr    %cl,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bit>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @get_bit(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ trans_init();
void c4_init() { trans_init(); }


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

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

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

LLVM IR (-O2):
define void @c4_init() {
%1 = tail call i32 (...) @trans_init()
ret void
}
int kernel_thread(int (*fn)(void), int flg) {
  int pid = 0;
  __asm__ __volatile__("int  $0x44\n"
                       "cmpl $0, %%eax\n"
                       "jne   1f\n"
                       "call *%2\n"
                       "movl $1, %%eax\n"
                       "movl $0, %%ebx\n"
                       "int $0x44\n"
                       "1:\n"
                       : "=a"(pid)
                       : "0"(2), "r"(fn));
  return pid;
}


x86 assembly (clang, -O0):
<kernel_thread>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x2,%eax
int    $0x44
cmp    $0x0,%eax
jne    1134 <kernel_thread+0x34>
call   *%rcx
mov    $0x1,%eax
mov    $0x0,%ebx
int    $0x44
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_thread>:
mov    $0x2,%eax
int    $0x44
cmp    $0x0,%eax
jne    111a <kernel_thread+0x1a>
call   *%rdi
mov    $0x1,%eax
mov    $0x0,%ebx
int    $0x44
ret

LLVM IR (-O0):
define i32 @kernel_thread(i32 ()* %0, i32 %1) {
%3 = alloca i32 ()*
%4 = alloca i32
%5 = alloca i32
store i32 ()* %0, i32 ()** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32 ()*, i32 ()** %3
%7 = call i32 asm sideeffect "int $$0x44\0Acmpl $$0, %eax\0Ajne 1f\0Acall *$2\0Amovl $$1, %eax\0Amovl $$0, %ebx\0Aint $$0x44\0A1:\0A", "={ax},0,r,~{dirflag},~{fpsr},~{flags}"(i32 2, i32 ()* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
ret i32 %8
}

LLVM IR (-O2):
define i32 @kernel_thread(i32 ()* %0, i32 %1) {
%3 = tail call i32 asm sideeffect "int $$0x44\0Acmpl $$0, %eax\0Ajne 1f\0Acall *$2\0Amovl $$1, %eax\0Amovl $$0, %ebx\0Aint $$0x44\0A1:\0A", "={ax},0,r,~{dirflag},~{fpsr},~{flags}"(i32 2, i32 ()* %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sys_write(char *);
void test_task_c() {
  while (1) {
    sys_write("Hello World!\n");
  }
}


x86 assembly (clang, -O0):
<test_task_c>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <test_task_c+0x9>
lea    0xee0(%rip),%rdi
call   1030 <sys_write@plt>
jmp    1119 <test_task_c+0x9>

x86 assembly (clang, -O2):
<test_task_c>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <sys_write@plt>
jmp    1120 <test_task_c+0x10>

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World!\0A\00"
define void @test_task_c() {
br label %1
1: ; preds = %0, %1
%2 = call i32 @sys_write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %1
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello World!\0A\00"
define void @test_task_c() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @sys_write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int printHeapValue(int /*<<< orphan*/);
int /*<<< orphan*/ scheme_entry();
int main(void) {
  uint64_t result = scheme_entry();
  return printHeapValue(result);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <scheme_entry@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <printHeapValue@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @scheme_entry()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printHeapValue(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @scheme_entry()
%2 = tail call i32 @printHeapValue(i32 %1)
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t rfc4175_get_extended_sequence_number(const uint8_t *buf) {
  return (buf[0] << 8) | buf[1];
}


x86 assembly (clang, -O0):
<rfc4175_get_extended_sequence_number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x4(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfc4175_get_extended_sequence_number>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @rfc4175_get_extended_sequence_number(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = or i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @rfc4175_get_extended_sequence_number(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
ret i32 %6
}
int closing(int return_request) { return return_request; }


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

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

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

LLVM IR (-O2):
define i32 @closing(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void rec_2(int number) {
  if (number == 0)
    printf("fim\n");
  else {
    rec_2(number - 1);
    printf("%d\n", number);
  }
}


x86 assembly (clang, -O0):
<rec_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1148 <rec_2+0x28>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1164 <rec_2+0x44>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <rec_2@plt>
mov    -0x4(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rec_2>:
test   %edi,%edi
je     1150 <rec_2+0x20>
push   %rbx
mov    %edi,%ebx
lea    -0x1(%rbx),%edi
call   1050 <rec_2@plt>
lea    0xeba(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
lea    0xead(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"fim\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @rec_2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %12
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 1
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [4 x i8] c"fim\00"
define void @rec_2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %6
ret void
6: ; preds = %1
%7 = add nsw i32 %0, -1
tail call void @rec_2(i32 %7)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %5
}
long add_l(long a, long b) { return a + b; }


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

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

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

LLVM IR (-O2):
define i64 @add_l(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int getopt(int argc, char *const argv[], const char *optstring) {
  (void)argc;
  (void)argv;
  (void)optstring;
  puts("getopt: not implemented");
  return -1;
}


x86 assembly (clang, -O0):
<getopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"getopt: not implemented\00"
define i32 @getopt(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = load i8*, i8** %6
%10 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [24 x i8] c"getopt: not implemented\00"
define i32 @getopt(i32 %0, i8** nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ handle_48(int /*<<< orphan*/);
int gen_48() {
  handle_48(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_48>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_48@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gen_48() {
%1 = call i32 @handle_48(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_48() {
%1 = tail call i32 @handle_48(i32 0)
ret i32 0
}
double SIM_power_restowidth(res, nchannel)
double res;
int nchannel;
{
  double restrans;
  restrans = (nchannel) ? (9723 * 0.0875) : (22400 * 0.0875);
  return (restrans / res);
}


x86 assembly (clang, -O0):
<SIM_power_restowidth>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movsd  0xee9(%rip),%xmm0
movsd  0xee9(%rip),%xmm1
movsd  %xmm1,-0x28(%rbp)
cmp    $0x0,%eax
movsd  %xmm0,-0x20(%rbp)
jne    113c <SIM_power_restowidth+0x3c>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<SIM_power_restowidth>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
lea    0xef2(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @SIM_power_restowidth(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, double 0x408A961999999999, double 0x409E9FFFFFFFFFFF
store double %9, double* %5
%10 = load double, double* %5
%11 = load double, double* %3
%12 = fdiv double %10, %11
ret double %12
}

LLVM IR (-O2):
define double @SIM_power_restowidth(double %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, double 0x409E9FFFFFFFFFFF, double 0x408A961999999999
%5 = fdiv double %4, %0
ret double %5
}
/* Type definitions */
struct proc_dir_entry {
  int dummy;
};
struct net {
  int dummy;
};

/* Variables and functions */
struct proc_dir_entry *proc_mkdir_data(char const *, int /*<<< orphan*/,
                                       struct proc_dir_entry *, struct net *);
struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
                                      struct proc_dir_entry *parent) {
  return proc_mkdir_data(name, 0, parent, net);
}


x86 assembly (clang, -O0):
<proc_net_mkdir>:
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),%rdx
mov    -0x8(%rbp),%rcx
xor    %esi,%esi
call   1030 <proc_mkdir_data@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc_net_mkdir>:
mov    %rdi,%rcx
mov    %rsi,%rdi
xor    %esi,%esi
jmp    1030 <proc_mkdir_data@plt>

LLVM IR (-O0):
%struct.net = type { i32 }
%struct.proc_dir_entry = type { i32 }
define %struct.proc_dir_entry* @proc_net_mkdir(%struct.net* %0, i8* %1, %struct.proc_dir_entry* %2) {
%4 = alloca %struct.net*
%5 = alloca i8*
%6 = alloca %struct.proc_dir_entry*
store %struct.net* %0, %struct.net** %4
store i8* %1, i8** %5
store %struct.proc_dir_entry* %2, %struct.proc_dir_entry** %6
%7 = load i8*, i8** %5
%8 = load %struct.proc_dir_entry*, %struct.proc_dir_entry** %6
%9 = load %struct.net*, %struct.net** %4
%10 = call %struct.proc_dir_entry* @proc_mkdir_data(i8* %7, i32 0, %struct.proc_dir_entry* %8, %struct.net* %9)
ret %struct.proc_dir_entry* %10
}

LLVM IR (-O2):
%struct.net = type { i32 }
%struct.proc_dir_entry = type { i32 }
define %struct.proc_dir_entry* @proc_net_mkdir(%struct.net* %0, i8* %1, %struct.proc_dir_entry* %2) {
%4 = tail call %struct.proc_dir_entry* @proc_mkdir_data(i8* %1, i32 0, %struct.proc_dir_entry* %2, %struct.net* %0)
ret %struct.proc_dir_entry* %4
}
unsigned long int test2(unsigned long int var_a, unsigned long int var_b,
                        unsigned long int var_c, unsigned long int var_d,
                        unsigned long int var_e, unsigned long int var_f,
                        unsigned long int var_g) {
  unsigned long int var_z =
      var_a * var_b * var_c * var_d * var_e * var_f * var_g;
  return var_z;
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
imul   -0x20(%rbp),%rax
imul   -0x28(%rbp),%rax
imul   -0x30(%rbp),%rax
imul   0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
mov    %r8,%rax
imul   %rsi,%rdi
imul   %rcx,%rdx
imul   %rdi,%rdx
imul   %r9,%rax
imul   %rdx,%rax
imul   0x8(%rsp),%rax
ret

LLVM IR (-O0):
define i64 @test2(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6) {
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
store i64 %0, i64* %8
store i64 %1, i64* %9
store i64 %2, i64* %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store i64 %5, i64* %13
store i64 %6, i64* %14
%16 = load i64, i64* %8
%17 = load i64, i64* %9
%18 = mul i64 %16, %17
%19 = load i64, i64* %10
%20 = mul i64 %18, %19
%21 = load i64, i64* %11
%22 = mul i64 %20, %21
%23 = load i64, i64* %12
%24 = mul i64 %22, %23
%25 = load i64, i64* %13
%26 = mul i64 %24, %25
%27 = load i64, i64* %14
%28 = mul i64 %26, %27
store i64 %28, i64* %15
%29 = load i64, i64* %15
ret i64 %29
}

LLVM IR (-O2):
define i64 @test2(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6) {
%8 = mul i64 %1, %0
%9 = mul i64 %8, %2
%10 = mul i64 %9, %3
%11 = mul i64 %10, %4
%12 = mul i64 %11, %5
%13 = mul i64 %12, %6
ret i64 %13
}
int is_r16(int id) {
  switch (id) {
  case 130:
  case 134:
  case 142:
  case 153:
  case 165:
  case 144:
  case 133:
  case 166:
    return (1);
  default:
    return (0);
  }
}


x86 assembly (clang, -O0):
<is_r16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x82,%eax
je     1182 <is_r16+0x82>
jmp    111d <is_r16+0x1d>
mov    -0xc(%rbp),%eax
add    $0xffffff7b,%eax
sub    $0x2,%eax
jb     1182 <is_r16+0x82>
jmp    1133 <is_r16+0x33>
mov    -0xc(%rbp),%eax
sub    $0x8e,%eax
je     1182 <is_r16+0x82>
jmp    1146 <is_r16+0x46>
mov    -0xc(%rbp),%eax
sub    $0x90,%eax
je     1182 <is_r16+0x82>
jmp    1159 <is_r16+0x59>
mov    -0xc(%rbp),%eax
sub    $0x99,%eax
je     1182 <is_r16+0x82>
jmp    116c <is_r16+0x6c>
mov    -0xc(%rbp),%eax
add    $0xffffff5b,%eax
sub    $0x1,%eax
ja     118e <is_r16+0x8e>
jmp    1182 <is_r16+0x82>
movl   $0x1,-0x4(%rbp)
jmp    1195 <is_r16+0x95>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_r16>:
add    $0xffffff7e,%edi
cmp    $0x24,%edi
ja     1121 <is_r16+0x21>
mov    $0x1,%eax
movabs $0x1800805019,%rcx
bt     %rdi,%rcx
jae    1121 <is_r16+0x21>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @is_r16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 130, label %5
i32 134, label %5
i32 142, label %5
i32 153, label %5
i32 165, label %5
i32 144, label %5
i32 133, label %5
i32 166, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_r16(i32 %0) {
switch i32 %0, label %2 [
i32 130, label %3
i32 134, label %3
i32 142, label %3
i32 153, label %3
i32 165, label %3
i32 144, label %3
i32 133, label %3
i32 166, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
void GPS_Fatal(const char *s) { (void)s; }


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

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

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

LLVM IR (-O2):
define void @GPS_Fatal(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *detect_steg(int /*<<< orphan*/ *);
char *scan_JPEG(FILE *f) {
  char *steg = detect_steg(f);
  if (steg != NULL)
    return steg;
  return NULL;
}


x86 assembly (clang, -O0):
<scan_JPEG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <detect_steg@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1141 <scan_JPEG+0x31>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1149 <scan_JPEG+0x39>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_JPEG>:
jmp    1030 <detect_steg@plt>

LLVM IR (-O0):
define i8* @scan_JPEG(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i8* @detect_steg(i32* %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %4
store i8* %10, i8** %2
br label %12
11: ; preds = %1
store i8* null, i8** %2
br label %12
12: ; preds = %11, %9
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
define i8* @scan_JPEG(i32* %0) {
%2 = tail call i8* @detect_steg(i32* %0)
ret i8* %2
}