xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ usleep(unsigned int);
void Sys_Sleep(unsigned ms) { usleep(ms * 1000); }


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

x86 assembly (clang, -O2):
<Sys_Sleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @Sys_Sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @Sys_Sleep(i32 %0) {
%2 = mul i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
void RTTimerLRStart(void) {}


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

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

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

LLVM IR (-O2):
define void @RTTimerLRStart() {
ret void
}
int main() {
  int i;
  int res = 12;
  goto L1;
  while (i < 100) {
    if (i > 100) {
    L1:
      res = 0;
      goto L2;
    }
    i++;
  }
L2:
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xc,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 12, i32* %3
br label %12
4: ; No predecessors!
br label %5
5: ; preds = %13, %4
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 100
br i1 %10, label %11, label %13
11: ; preds = %8
br label %12
12: ; preds = %11, %0
store i32 0, i32* %3
br label %17
13: ; preds = %8
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %5
16: ; preds = %5
br label %17
17: ; preds = %16, %12
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int read_8042_cmd_byte();
int /*<<< orphan*/ write_8042_cmd_byte(int);
void enable_keyboard(void) {
  write_8042_cmd_byte(read_8042_cmd_byte() & 0b11101111);
}


x86 assembly (clang, -O0):
<enable_keyboard>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <read_8042_cmd_byte@plt>
mov    %eax,%edi
and    $0xef,%edi
call   1030 <write_8042_cmd_byte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<enable_keyboard>:
push   %rax
xor    %eax,%eax
call   1040 <read_8042_cmd_byte@plt>
and    $0xef,%eax
mov    %eax,%edi
pop    %rax
jmp    1030 <write_8042_cmd_byte@plt>

LLVM IR (-O0):
define void @enable_keyboard() {
%1 = call i32 (...) @read_8042_cmd_byte()
%2 = and i32 %1, 239
%3 = call i32 @write_8042_cmd_byte(i32 %2)
ret void
}

LLVM IR (-O2):
define void @enable_keyboard() {
%1 = tail call i32 (...) @read_8042_cmd_byte()
%2 = and i32 %1, 239
%3 = tail call i32 @write_8042_cmd_byte(i32 %2)
ret void
}
float endian_float(const float x) { return x; }


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

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

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

LLVM IR (-O2):
define float @endian_float(float returned %0) {
ret float %0
}
/* Variables and functions */
double degRad(double);
double mercatorX(double lon) { return 6378137.0 * degRad(lon); }


x86 assembly (clang, -O0):
<mercatorX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <degRad@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mercatorX>:
push   %rax
call   1030 <degRad@plt>
mulsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @mercatorX(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @degRad(double %3)
%5 = fmul double 0x415854A640000000, %4
ret double %5
}

LLVM IR (-O2):
define double @mercatorX(double %0) {
%2 = tail call double @degRad(double %0)
%3 = fmul double %2, 0x415854A640000000
ret double %3
}
int mDB_createindex(fn, idx, keydef) {
  return mDBi_msg('A', fn, idx, 0, keydef, 0, 0, 0);
}


x86 assembly (clang, -O0):
<mDB_createindex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%r8d
mov    $0x41,%edi
xor    %r9d,%r9d
mov    %r9d,%ecx
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x0,%al
call   1030 <mDBi_msg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mDB_createindex>:
push   %rax
mov    %edx,%r8d
mov    %esi,%edx
mov    %edi,%esi
mov    $0x41,%edi
xor    %ecx,%ecx
xor    %r9d,%r9d
xor    %eax,%eax
push   $0x0
push   $0x0
call   1030 <mDBi_msg@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mDB_createindex(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 (i32, i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @mDBi_msg to i32 (i32, i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 65, i32 %7, i32 %8, i32 0, i32 %9, i32 0, i32 0, i32 0)
ret i32 %10
}

LLVM IR (-O2):
define i32 @mDB_createindex(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (i32, i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @mDBi_msg to i32 (i32, i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 65, i32 %0, i32 %1, i32 0, i32 %2, i32 0, i32 0, i32 0)
ret i32 %4
}
double dmax(double x, double y) {
  if (x > y)
    return x;
  return y;
}


x86 assembly (clang, -O0):
<dmax>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    112d <dmax+0x2d>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1137 <dmax+0x37>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmax>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dmax(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load double, double* %4
store double %10, double* %3
br label %13
11: ; preds = %2
%12 = load double, double* %5
store double %12, double* %3
br label %13
13: ; preds = %11, %9
%14 = load double, double* %3
ret double %14
}

LLVM IR (-O2):
define double @dmax(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ check_read(unsigned short, char *);
void insb(unsigned short int port, void *addr, unsigned long int count) {
  for (unsigned long int i = 0; i < count; i++) {
    check_read(port + i, "insb");
  }
}


x86 assembly (clang, -O0):
<insb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1165 <insb+0x55>
movzwl -0x2(%rbp),%eax
add    -0x20(%rbp),%rax
lea    0xeb4(%rip),%rsi
movzwl %ax,%edi
call   1030 <check_read@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112f <insb+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insb>:
push   %rbp
push   %r14
push   %rbx
test   %rdx,%rdx
je     1146 <insb+0x36>
mov    %rdx,%rbx
mov    %edi,%ebp
lea    0xedb(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
movzwl %bp,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <check_read@plt>
add    $0x1,%ebp
add    $0xffffffffffffffff,%rbx
jne    1130 <insb+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"insb\00"
define void @insb(i16 zeroext %0, i8* nocapture readnone %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %5, label %6
5: ; preds = %6, %3
ret void
6: ; preds = %3, %6
%7 = phi i64 [ %11, %6 ], [ 0, %3 ]
%8 = trunc i64 %7 to i16
%9 = add i16 %8, %0
%10 = tail call i32 @check_read(i16 zeroext %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = add nuw i64 %7, 1
%12 = icmp eq i64 %11, %2
br i1 %12, label %5, label %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int main() {
  long i = 10, f = 1;
  for (i = 10; i > 0; i--) {
    f = f * i;
  }
  printf("%lu", f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0xa,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movq   $0xa,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    1160 <main+0x50>
mov    -0x18(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <main+0x27>
mov    -0x18(%rbp),%rsi
lea    0xe95(%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    $0x375f00,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 3628800)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void tell_me_a_bad_translated_joke() {
  printf("Whats the dark vader favorite ice-cream? -Chocolate, because its "
         "icedarksicescream!");
}


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

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

LLVM IR (-O0):
@.str = [84 x i8] c"Whats the dark vader favorite ice-cream? -Chocolate, because its icedarksicescream!\00"
define void @tell_me_a_bad_translated_joke() {
%1 = call i32 @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [84 x i8] c"Whats the dark vader favorite ice-cream? -Chocolate, because its icedarksicescream!\00"
define void @tell_me_a_bad_translated_joke() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct lt_list {
  int dummy;
};

/* Variables and functions */
int lt_list_is_empty(struct lt_list *lst) { return (lst == NULL); }


x86 assembly (clang, -O0):
<lt_list_is_empty>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lt_list_is_empty>:
xor    %eax,%eax
test   %rdi,%rdi
sete   %al
ret

LLVM IR (-O0):
%struct.lt_list = type { i32 }
define i32 @lt_list_is_empty(%struct.lt_list* %0) {
%2 = alloca %struct.lt_list*
store %struct.lt_list* %0, %struct.lt_list** %2
%3 = load %struct.lt_list*, %struct.lt_list** %2
%4 = icmp eq %struct.lt_list* %3, null
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
%struct.lt_list = type { i32 }
define i32 @lt_list_is_empty(%struct.lt_list* readnone %0) {
%2 = icmp eq %struct.lt_list* %0, null
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
void f8(unsigned long int s) {
  if ((unsigned short int)s == 0)
    return;
  if (s == 0)
    link_error();
}


x86 assembly (clang, -O0):
<f8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl %ax,%eax
cmp    $0x0,%eax
jne    1131 <f8+0x21>
jmp    1143 <f8+0x33>
cmpq   $0x0,-0x8(%rbp)
jne    1143 <f8+0x33>
mov    $0x0,%al
call   1030 <link_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f8(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i16
%5 = zext i16 %4 to i32
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
br label %13
8: ; preds = %1
%9 = load i64, i64* %2
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 (...) @link_error()
br label %13
13: ; preds = %7, %11, %8
ret void
}

LLVM IR (-O2):
define void @f8(i64 %0) {
ret void
}
int brk(addr) void *addr;
{ return (0); }


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

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

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

LLVM IR (-O2):
define i32 @brk(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gen_call(char *);
int /*<<< orphan*/ gen_pop();
gen_unsigned_greater_or_equal() {
  gen_pop();
  gen_call("ccuge");
}


x86 assembly (clang, -O0):
<gen_unsigned_greater_or_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <gen_pop@plt>
lea    0xeca(%rip),%rdi
call   1040 <gen_call@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_unsigned_greater_or_equal>:
push   %rax
xor    %eax,%eax
call   1030 <gen_pop@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <gen_call@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"ccuge\00"
define i32 @gen_unsigned_greater_or_equal() {
%1 = alloca i32
%2 = call i32 (...) @gen_pop()
%3 = call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [6 x i8] c"ccuge\00"
define i32 @gen_unsigned_greater_or_equal() {
%1 = tail call i32 (...) @gen_pop()
%2 = tail call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ assert(char);
char *strings_alloc(int);
char *strings_from_char(char c) {
  assert(c);
  char *ret = strings_alloc(2);
  ret[0] = c;
  ret[1] = '\0';
  return ret;
}


x86 assembly (clang, -O0):
<strings_from_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <assert@plt>
mov    $0x2,%edi
call   1030 <strings_alloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strings_from_char>:
push   %rbx
mov    %edi,%ebx
call   1040 <assert@plt>
mov    $0x2,%edi
call   1030 <strings_alloc@plt>
mov    %bl,(%rax)
movb   $0x0,0x1(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i8* @strings_from_char(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8*
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = call i32 @assert(i8 signext %4)
%6 = call i8* @strings_alloc(i32 2)
store i8* %6, i8** %3
%7 = load i8, i8* %2
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8 0, i8* %11
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define i8* @strings_from_char(i8 signext %0) {
%2 = tail call i32 @assert(i8 signext %0)
%3 = tail call i8* @strings_alloc(i32 2)
store i8 %0, i8* %3
%4 = getelementptr inbounds i8, i8* %3, i64 1
store i8 0, i8* %4
ret i8* %3
}
/* Variables and functions */
int run_external(char **);
int run_internal(char **);
int run_command(char **command) {
  int status;
  status = run_internal(command);
  if (status == -1)
    status = run_external(command);
  return status;
}


x86 assembly (clang, -O0):
<run_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <run_internal@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    114e <run_command+0x2e>
mov    -0x8(%rbp),%rdi
call   1030 <run_external@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_command>:
push   %rbx
mov    %rdi,%rbx
call   1040 <run_internal@plt>
cmp    $0xffffffff,%eax
je     1130 <run_command+0x10>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <run_external@plt>

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

LLVM IR (-O2):
define i32 @run_command(i8** %0) {
%2 = tail call i32 @run_internal(i8** %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @run_external(i8** %0)
br label %6
6: ; preds = %4, %1
%7 = phi i32 [ %5, %4 ], [ %2, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ print_star(int);
int main(void) {
  int num = 3;
  print_star(num);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
call   1030 <print_star@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print_star(i32 3)
ret i32 0
}
int length(s)
char *s;
{
  register int l;
  register char *p;
  l = 0;
  p = s;
  while (*p++)
    l++;
  return (l);
}


x86 assembly (clang, -O0):
<length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
cmpb   $0x0,(%rax)
je     113d <length+0x3d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <length+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<length>:
cmpb   $0x0,(%rdi)
je     111c <length+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <length+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @length(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = load i8*, i8** %2
store i8* %5, i8** %4
br label %6
6: ; preds = %11, %1
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %4
%9 = load i8, i8* %7
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %6
14: ; preds = %6
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @length(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %7, %4 ], [ %0, %1 ]
%6 = phi i32 [ %8, %4 ], [ 0, %1 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = add nuw nsw i32 %6, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
int test_imm_DAuint16_reg(unsigned short val) {
  return ((val) & (-0xDA << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DAuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff26,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_DAuint16_reg>:
test   $0xff26,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_DAuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -218
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int ffun(int n) {
  int s = 0;
  while (n) {
    s = s * 10 + n % 10;
    n = n / 10;
  }
  return s;
}


x86 assembly (clang, -O0):
<ffun>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1145 <ffun+0x45>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <ffun+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffun>:
xor    %eax,%eax
test   %edi,%edi
je     113f <ffun+0x3f>
cs nopw 0x0(%rax,%rax,1)
lea    (%rax,%rax,4),%eax
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
lea    (%rsi,%rax,2),%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <ffun+0x10>
ret

LLVM IR (-O0):
define i32 @ffun(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 10
%10 = load i32, i32* %2
%11 = srem i32 %10, 10
%12 = add nsw i32 %9, %11
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 10
store i32 %14, i32* %2
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @ffun(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = mul nsw i32 %4, 10
%7 = srem i32 %5, 10
%8 = add nsw i32 %6, %7
%9 = sdiv i32 %5, 10
%10 = add i32 %5, 9
%11 = icmp ult i32 %10, 19
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %13
}
/* Type definitions */
struct terminal {
  int dummy;
};
struct parm_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ move_cursor(struct terminal *, int /*<<< orphan*/, int);
int sum(struct parm_t *);
void curs_back(struct terminal *term, struct parm_t *parm) {
  int num = sum(parm);
  if (num <= 0)
    num = 1;
  move_cursor(term, 0, -num);
}


x86 assembly (clang, -O0):
<curs_back>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sum@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     114d <curs_back+0x2d>
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
sub    -0x14(%rbp),%edx
xor    %esi,%esi
call   1040 <move_cursor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curs_back>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <sum@plt>
test   %eax,%eax
mov    $0x1,%edx
cmovg  %eax,%edx
neg    %edx
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1040 <move_cursor@plt>

LLVM IR (-O0):
%struct.terminal = type { i32 }
%struct.parm_t = type { i32 }
define void @curs_back(%struct.terminal* %0, %struct.parm_t* %1) {
%3 = alloca %struct.terminal*
%4 = alloca %struct.parm_t*
%5 = alloca i32
store %struct.terminal* %0, %struct.terminal** %3
store %struct.parm_t* %1, %struct.parm_t** %4
%6 = load %struct.parm_t*, %struct.parm_t** %4
%7 = call i32 @sum(%struct.parm_t* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp sle i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %5
br label %11
11: ; preds = %10, %2
%12 = load %struct.terminal*, %struct.terminal** %3
%13 = load i32, i32* %5
%14 = sub nsw i32 0, %13
%15 = call i32 @move_cursor(%struct.terminal* %12, i32 0, i32 %14)
ret void
}

LLVM IR (-O2):
%struct.terminal = type { i32 }
%struct.parm_t = type { i32 }
define void @curs_back(%struct.terminal* %0, %struct.parm_t* %1) {
%3 = tail call i32 @sum(%struct.parm_t* %1)
%4 = icmp sgt i32 %3, 1
%5 = select i1 %4, i32 %3, i32 1
%6 = sub nsw i32 0, %5
%7 = tail call i32 @move_cursor(%struct.terminal* %0, i32 0, i32 %6)
ret void
}
unsigned UpVal(unsigned Val1, unsigned Val3, unsigned Val9, unsigned Val27) {
  return (((Val1 >> 2) & 3) * 1) + (((Val3 >> 2) & 3) * 3) +
         (((Val9 >> 2) & 3) * 9) + (((Val27 >> 2) & 3) * 27);
}


x86 assembly (clang, -O0):
<UpVal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
and    $0x3,%eax
shl    $0x0,%eax
mov    -0x8(%rbp),%ecx
shr    $0x2,%ecx
and    $0x3,%ecx
imul   $0x3,%ecx,%ecx
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
shr    $0x2,%ecx
and    $0x3,%ecx
imul   $0x9,%ecx,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%ecx
shr    $0x2,%ecx
and    $0x3,%ecx
imul   $0x1b,%ecx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UpVal>:
shr    $0x2,%edi
and    $0x3,%edi
shr    $0x2,%esi
and    $0x3,%esi
lea    (%rsi,%rsi,2),%eax
add    %edi,%eax
shr    $0x2,%edx
and    $0x3,%edx
lea    (%rdx,%rdx,8),%edx
add    %eax,%edx
shr    $0x2,%ecx
and    $0x3,%ecx
lea    (%rcx,%rcx,8),%eax
lea    (%rax,%rax,2),%eax
add    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @UpVal(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = lshr i32 %0, 2
%6 = and i32 %5, 3
%7 = lshr i32 %1, 2
%8 = and i32 %7, 3
%9 = mul nuw nsw i32 %8, 3
%10 = add nuw nsw i32 %9, %6
%11 = lshr i32 %2, 2
%12 = and i32 %11, 3
%13 = mul nuw nsw i32 %12, 9
%14 = add nuw nsw i32 %10, %13
%15 = lshr i32 %3, 2
%16 = and i32 %15, 3
%17 = mul nuw nsw i32 %16, 27
%18 = add nuw nsw i32 %14, %17
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ do_test(int);
int main() {
  do_test(0);
  do_test(-1);
  do_test(0xda004acedeadbeefull);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @do_test(i32 0)
%2 = tail call i32 @do_test(i32 -1)
%3 = tail call i32 @do_test(i32 -559038737)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ clear_old_logins();
int /*<<< orphan*/ clear_old_machines();
int /*<<< orphan*/ clear_old_users();
void clear_old_records(void) {
  clear_old_logins();
  clear_old_users();
  clear_old_machines();
}


x86 assembly (clang, -O0):
<clear_old_records>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <clear_old_logins@plt>
mov    $0x0,%al
call   1040 <clear_old_users@plt>
mov    $0x0,%al
call   1030 <clear_old_machines@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_old_records>:
push   %rax
xor    %eax,%eax
call   1050 <clear_old_logins@plt>
xor    %eax,%eax
call   1040 <clear_old_users@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <clear_old_machines@plt>

LLVM IR (-O0):
define void @clear_old_records() {
%1 = call i32 (...) @clear_old_logins()
%2 = call i32 (...) @clear_old_users()
%3 = call i32 (...) @clear_old_machines()
ret void
}

LLVM IR (-O2):
define void @clear_old_records() {
%1 = tail call i32 (...) @clear_old_logins()
%2 = tail call i32 (...) @clear_old_users()
%3 = tail call i32 (...) @clear_old_machines()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ IPPROTO_RAW;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int open_sockraw() {
  int s;
  s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
  if (s == -1) {
    perror("[open_sockraw] socket()");
    return -1;
  }
  return s;
}


x86 assembly (clang, -O0):
<open_sockraw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
call   1040 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    116d <open_sockraw+0x4d>
lea    0xea4(%rip),%rdi
call   1030 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1173 <open_sockraw+0x53>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_sockraw>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    0x2eaf(%rip),%rax
mov    (%rax),%esi
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
call   1040 <socket@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     114c <open_sockraw+0x2c>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xead(%rip),%rdi
call   1030 <perror@plt>
jmp    1148 <open_sockraw+0x28>

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_RAW = global i32 0
@.str = [24 x i8] c"[open_sockraw] socket()\00"
define i32 @open_sockraw() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @AF_INET
%4 = load i32, i32* @SOCK_RAW
%5 = load i32, i32* @IPPROTO_RAW
%6 = call i32 @socket(i32 %3, i32 %4, i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %13
11: ; preds = %0
%12 = load i32, i32* %2
store i32 %12, i32* %1
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_RAW = global i32 0
@.str = [24 x i8] c"[open_sockraw] socket()\00"
define i32 @open_sockraw() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_RAW
%3 = load i32, i32* @IPPROTO_RAW
%4 = tail call i32 @socket(i32 %1, i32 %2, i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %0, %6
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void save_str(const char *str, const char *path) {
  FILE *file = fopen(path, "w");
  fprintf(file, "%s", str);
  fclose(file);
}


x86 assembly (clang, -O0):
<save_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe9f(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_str>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rax
mov    %rdi,%r14
lea    0xebf(%rip),%rsi
mov    %rax,%rdi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [3 x i8] c"%s\00"
define void @save_str(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i8*, i8** %3
%10 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i32*, i32** %5
%12 = call i32 @fclose(i32* %11)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
define void @save_str(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @fputs(i8* %0, i32* %3)
%5 = tail call i32 @fclose(i32* %3)
ret void
}
/* Variables and functions */
long double asinh(double);
__attribute__((weak)) long double asinhl(long double x) {
  return asinh((double)x);
}


x86 assembly (clang, -O0):
<asinhl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <asinh@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asinhl>:
fldt   0x8(%rsp)
fstpl  -0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
jmp    1030 <asinh@plt>

LLVM IR (-O0):
define weak x86_fp80 @asinhl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fptrunc x86_fp80 %3 to double
%5 = call x86_fp80 @asinh(double %4)
ret x86_fp80 %5
}

LLVM IR (-O2):
define weak x86_fp80 @asinhl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call x86_fp80 @asinh(double %2)
ret x86_fp80 %3
}
/* Variables and functions */
int /*<<< orphan*/ closeFileDescriptors();
int /*<<< orphan*/ unexportPin(int);
void dinitBuzzer() {
  closeFileDescriptors();
  unexportPin(45);
}


x86 assembly (clang, -O0):
<dinitBuzzer>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <closeFileDescriptors@plt>
mov    $0x2d,%edi
call   1040 <unexportPin@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dinitBuzzer>:
push   %rax
xor    %eax,%eax
call   1030 <closeFileDescriptors@plt>
mov    $0x2d,%edi
pop    %rax
jmp    1040 <unexportPin@plt>

LLVM IR (-O0):
define void @dinitBuzzer() {
%1 = call i32 (...) @closeFileDescriptors()
%2 = call i32 @unexportPin(i32 45)
ret void
}

LLVM IR (-O2):
define void @dinitBuzzer() {
%1 = tail call i32 (...) @closeFileDescriptors()
%2 = tail call i32 @unexportPin(i32 45)
ret void
}
void UARTModemControlClear(unsigned long ulBase, unsigned long ulControl) {
  unsigned long ulTemp;
  ;
  ;
  ;
  ulTemp = (*((volatile unsigned long *)(ulBase + 0x00000030)));
  ulTemp &= ~(ulControl & (0x00000800 | 0x00000400));
  (*((volatile unsigned long *)(ulBase + 0x00000030))) = ulTemp;
}


x86 assembly (clang, -O0):
<UARTModemControlClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0xc00,%rax
xor    $0xffffffffffffffff,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x30(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTModemControlClear>:
not    %esi
or     $0xfffffffffffff3ff,%rsi
and    %rsi,0x30(%rdi)
ret

LLVM IR (-O0):
define void @UARTModemControlClear(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = add i64 %6, 48
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
store i64 %9, i64* %5
%10 = load i64, i64* %4
%11 = and i64 %10, 3072
%12 = xor i64 %11, -1
%13 = load i64, i64* %5
%14 = and i64 %13, %12
store i64 %14, i64* %5
%15 = load i64, i64* %5
%16 = load i64, i64* %3
%17 = add i64 %16, 48
%18 = inttoptr i64 %17 to i64*
store volatile i64 %15, i64* %18
ret void
}

LLVM IR (-O2):
define void @UARTModemControlClear(i64 %0, i64 %1) {
%3 = add i64 %0, 48
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = and i64 %1, 3072
%7 = xor i64 %6, -1
%8 = and i64 %5, %7
store volatile i64 %8, i64* %4
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t geopm_region_id_set_hint(uint64_t hint_type, uint64_t rid) {
  return (rid | hint_type);
}


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

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

LLVM IR (-O0):
define i32 @geopm_region_id_set_hint(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 = or i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @geopm_region_id_set_hint(i32 %0, i32 %1) {
%3 = or i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ uart_process_isr(int /*<<< orphan*/);
void uart_isr_C_0_function(void) { uart_process_isr(0); }


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

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

LLVM IR (-O0):
define void @uart_isr_C_0_function() {
%1 = call i32 @uart_process_isr(i32 0)
ret void
}

LLVM IR (-O2):
define void @uart_isr_C_0_function() {
%1 = tail call i32 @uart_process_isr(i32 0)
ret void
}
double lerp(double s, double e, double t) { return s + (e - s) * t; }


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
}
/* Variables and functions */
int io_in8(int);
void hdd_wait(void) {
  for (; (io_in8(0x1f7) & 0x88) != 0x08;)
    ;
}


x86 assembly (clang, -O0):
<hdd_wait>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <hdd_wait+0x9>
mov    $0x1f7,%edi
call   1030 <io_in8@plt>
and    $0x88,%eax
cmp    $0x8,%eax
je     1136 <hdd_wait+0x26>
jmp    1119 <hdd_wait+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdd_wait>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1f7,%edi
call   1030 <io_in8@plt>
and    $0x88,%eax
cmp    $0x8,%eax
jne    1120 <hdd_wait+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @hdd_wait() {
br label %1
1: ; preds = %5, %0
%2 = call i32 @io_in8(i32 503)
%3 = and i32 %2, 136
%4 = icmp ne i32 %3, 8
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @hdd_wait() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @io_in8(i32 503)
%3 = and i32 %2, 136
%4 = icmp eq i32 %3, 8
br i1 %4, label %5, label %1
5: ; preds = %1
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t ntohs(uint16_t netshort) {
  return ((netshort & 0xff) << 8) | (netshort >> 8);
}


x86 assembly (clang, -O0):
<ntohs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntohs>:
mov    %edi,%eax
shl    $0x8,%eax
movzwl %ax,%eax
sar    $0x8,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @ntohs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 8
%6 = load i32, i32* %2
%7 = ashr i32 %6, 8
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @ntohs(i32 %0) {
%2 = shl i32 %0, 8
%3 = and i32 %2, 65280
%4 = ashr i32 %0, 8
%5 = or i32 %3, %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct zc_sb_v0 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ zc_sb_v0_uuid_get(int /*<<< orphan*/ *,
                                     struct zc_sb_v0 const *const);
char const *zc_uuid_format(int /*<<< orphan*/ *, char *const);
const char *zc_sb_uuid_format(const struct zc_sb_v0 *const sb,
                              char *const buf) {
  uint8_t uuid[16];
  zc_sb_v0_uuid_get(uuid, sb);
  return zc_uuid_format(uuid, buf);
}


x86 assembly (clang, -O0):
<zc_sb_uuid_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <zc_sb_v0_uuid_get@plt>
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <zc_uuid_format@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zc_sb_uuid_format>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <zc_sb_v0_uuid_get@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <zc_uuid_format@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.zc_sb_v0 = type { i32 }
define i8* @zc_sb_uuid_format(%struct.zc_sb_v0* %0, i8* %1) {
%3 = alloca %struct.zc_sb_v0*
%4 = alloca i8*
%5 = alloca [16 x i32]
store %struct.zc_sb_v0* %0, %struct.zc_sb_v0** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 0
%7 = load %struct.zc_sb_v0*, %struct.zc_sb_v0** %3
%8 = call i32 @zc_sb_v0_uuid_get(i32* %6, %struct.zc_sb_v0* %7)
%9 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = call i8* @zc_uuid_format(i32* %9, i8* %10)
ret i8* %11
}

LLVM IR (-O2):
%struct.zc_sb_v0 = type { i32 }
define i8* @zc_sb_uuid_format(%struct.zc_sb_v0* %0, i8* %1) {
%3 = alloca [16 x i32]
%4 = bitcast [16 x i32]* %3 to i8*
%5 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%6 = call i32 @zc_sb_v0_uuid_get(i32* %5, %struct.zc_sb_v0* %0)
%7 = call i8* @zc_uuid_format(i32* %5, i8* %1)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  printf(
      "%s\n",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/mj31508/holbertonschool-low_level_programming/"
      "refs/heads/master/0x0C-preprocessor/2-main.c");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [181 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mj31508/holbertonschool-low_level_programming/refs/heads/master/0x0C-preprocessor/2-main.c\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([181 x i8], [181 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [181 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mj31508/holbertonschool-low_level_programming/refs/heads/master/0x0C-preprocessor/2-main.c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([181 x i8], [181 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int time_t;

/* Variables and functions */
int /*<<< orphan*/ time(int *);
int gs2() {
  int res;
  time_t nowEpoch;
  time(&nowEpoch);
  res = nowEpoch % 3600;
  return (3600 - res);
}


x86 assembly (clang, -O0):
<gs2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <time@plt>
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    $0xe10,%eax
sub    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gs2>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <time@plt>
movslq 0x4(%rsp),%rcx
imul   $0xffffffff91a2b3c5,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0xb,%eax
add    %edx,%eax
imul   $0xe10,%eax,%eax
sub    %ecx,%eax
add    $0xe10,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gs2() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @time(i32* %2)
%4 = load i32, i32* %2
%5 = srem i32 %4, 3600
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = sub nsw i32 3600, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @gs2() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = load i32, i32* %1
%5 = srem i32 %4, 3600
%6 = sub nsw i32 3600, %5
ret i32 %6
}
/* Type definitions */
struct nn_list_item {
  int dummy;
};
struct nn_list {
  int dummy;
};

/* Variables and functions */
struct nn_list_item *nn_list_end(struct nn_list *self) {
  return NULL;
}


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

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

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

LLVM IR (-O2):
%struct.nn_list_item = type { i32 }
%struct.nn_list = type { i32 }
define noalias %struct.nn_list_item* @nn_list_end(%struct.nn_list* nocapture readnone %0) {
ret %struct.nn_list_item* null
}