xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t bytes_to_uint64_le(const unsigned char *p) {
  return (((uint64_t)p[0]) | (((uint64_t)p[1]) << 8) |
          (((uint64_t)p[2]) << 16) | (((uint64_t)p[3]) << 24) |
          (((uint64_t)p[4]) << 32) | (((uint64_t)p[5]) << 40) |
          (((uint64_t)p[6]) << 48) | (((uint64_t)p[7]) << 56));
}


x86 assembly (clang, -O0):
<bytes_to_uint64_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x4(%rcx),%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x5(%rcx),%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x6(%rcx),%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x7(%rcx),%edx
mov    $0x38,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bytes_to_uint64_le(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %6, %11
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl i32 %16, 16
%18 = or i32 %12, %17
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 3
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = shl i32 %22, 24
%24 = or i32 %18, %23
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i64 4
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = shl i32 %28, 32
%30 = or i32 %24, %29
%31 = load i8*, i8** %2
%32 = getelementptr inbounds i8, i8* %31, i64 5
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = shl i32 %34, 40
%36 = or i32 %30, %35
%37 = load i8*, i8** %2
%38 = getelementptr inbounds i8, i8* %37, i64 6
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = shl i32 %40, 48
%42 = or i32 %36, %41
%43 = load i8*, i8** %2
%44 = getelementptr inbounds i8, i8* %43, i64 7
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = shl i32 %46, 56
%48 = or i32 %42, %47
ret i32 %48
}

LLVM IR (-O2):
define i32 @bytes_to_uint64_le(i8* nocapture readnone %0) {
ret i32 poison
}
/* Type definitions */
struct rc4 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rc4_emit_byte(struct rc4 *);
void rc4_skip(struct rc4 *k, size_t count) {
  for (size_t b = 0; b < count; b++) {
    rc4_emit_byte(k);
  }
}


x86 assembly (clang, -O0):
<rc4_skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1150 <rc4_skip+0x40>
mov    -0x8(%rbp),%rdi
call   1030 <rc4_emit_byte@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <rc4_skip+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc4_skip>:
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
je     112e <rc4_skip+0x1e>
mov    %rsi,%rbx
mov    %rdi,%r14
nop
mov    %r14,%rdi
call   1030 <rc4_emit_byte@plt>
add    $0xffffffffffffffff,%rbx
jne    1120 <rc4_skip+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.rc4 = type { i32 }
define void @rc4_skip(%struct.rc4* %0, i64 %1) {
%3 = alloca %struct.rc4*
%4 = alloca i64
%5 = alloca i64
store %struct.rc4* %0, %struct.rc4** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %13, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load %struct.rc4*, %struct.rc4** %3
%12 = call i32 @rc4_emit_byte(%struct.rc4* %11)
br label %13
13: ; preds = %10
%14 = load i64, i64* %5
%15 = add i64 %14, 1
store i64 %15, i64* %5
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
%struct.rc4 = type { i32 }
define void @rc4_skip(%struct.rc4* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i64 [ %8, %5 ], [ 0, %2 ]
%7 = tail call i32 @rc4_emit_byte(%struct.rc4* %0)
%8 = add nuw i64 %6, 1
%9 = icmp eq i64 %8, %1
br i1 %9, label %4, label %5
}
int rev(int n) {
  int r = 0;
  while (n) {
    int x = n % 10;
    r = r * x;
    n /= 10;
  }
  return r;
}


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

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

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

LLVM IR (-O2):
define i32 @rev(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ islower(int);
void t_islower_0x80() {
  Assert_real((islower(128) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_islower.c",
              645, ("islower should be 0 for 0x80"));
}


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

x86 assembly (clang, -O2):
<t_islower_0x80>:
push   %rax
mov    $0x80,%edi
call   1030 <islower@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x285,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

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

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0x80\00"
define void @t_islower_0x80() {
%1 = tail call i64 @islower(i32 128)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 645, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void gdk_draw_image() {}


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

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

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

LLVM IR (-O2):
define void @gdk_draw_image() {
ret void
}
int rsock_unknown_level_to_int(const char *str, long len, int *valp) {
  switch (len) {
  case 6:
    return -1;
  case 10:
    return -1;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<rsock_unknown_level_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
sub    $0x6,%rax
je     113a <rsock_unknown_level_to_int+0x3a>
jmp    1127 <rsock_unknown_level_to_int+0x27>
mov    -0x28(%rbp),%rax
sub    $0xa,%rax
je     1146 <rsock_unknown_level_to_int+0x46>
jmp    1152 <rsock_unknown_level_to_int+0x52>
movl   $0xffffffff,-0x4(%rbp)
jmp    1159 <rsock_unknown_level_to_int+0x59>
movl   $0xffffffff,-0x4(%rbp)
jmp    1159 <rsock_unknown_level_to_int+0x59>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @rsock_unknown_level_to_int(i8* nocapture readnone %0, i64 %1, i32* nocapture readnone %2) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
char *getcwd(char *buf, size_t size) {
  fprintf(stderr, "try getcwd"
                  "\n");
  buf[0] = '/';
  buf[1] = 0;
  return buf;
}


x86 assembly (clang, -O0):
<getcwd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcwd>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
movw   $0x2f,(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"try getcwd\0A\00"
define i8* @getcwd(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
store i8 47, i8* %8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8 0, i8* %10
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"try getcwd\0A\00"
define i8* @getcwd(i8* returned writeonly %0, i64 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8 47, i8* %0
%5 = getelementptr inbounds i8, i8* %0, i64 1
store i8 0, i8* %5
ret i8* %0
}
/* Variables and functions */
double pow(int, double);
double exp10(double x) { return pow(10., x); }


x86 assembly (clang, -O0):
<exp10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp10>:
mov    $0xa,%edi
jmp    1030 <pow@plt>

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

LLVM IR (-O2):
define double @exp10(double %0) {
%2 = tail call double @pow(i32 10, double %0)
ret double %2
}
int max(int a, int b) { return (a < b) ? b : a; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <max+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <max+0x27>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
int mgetv(n)
int n;
{
  static char RoutineName[] = "mgetv";
  int b = 0;
  while (n--) {
    b <<= 1;
    if (mgetb()) {
      b |= 1;
    }
  }
  return (b);
}


x86 assembly (clang, -O0):
<mgetv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     115d <mgetv+0x4d>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <mgetb@plt>
cmp    $0x0,%eax
je     1158 <mgetv+0x48>
mov    -0x8(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <mgetv+0x12>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mgetv>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
je     1138 <mgetv+0x28>
mov    %edi,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <mgetb@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
lea    (%rcx,%rbx,2),%ebx
add    $0xffffffff,%ebp
jne    1120 <mgetv+0x10>
jmp    113a <mgetv+0x2a>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@mgetv.RoutineName = internal global [6 x i8] c"mgetv\00"
define i32 @mgetv(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %2
%6 = add nsw i32 %5, -1
store i32 %6, i32* %2
%7 = icmp ne i32 %5, 0
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = load i32, i32* %3
%10 = shl i32 %9, 1
store i32 %10, i32* %3
%11 = call i32 (...) @mgetb()
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i32, i32* %3
%15 = or i32 %14, 1
store i32 %15, i32* %3
br label %16
16: ; preds = %13, %8
br label %4
17: ; preds = %4
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @mgetv(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %11, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = add nsw i32 %5, -1
%7 = shl i32 %4, 1
%8 = tail call i32 (...) @mgetb()
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
%11 = or i32 %7, %10
%12 = icmp eq i32 %6, 0
br i1 %12, label %13, label %3
13: ; preds = %3, %1
%14 = phi i32 [ 0, %1 ], [ %11, %3 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *);
char *strerror(int /*<<< orphan*/);
void fatal(char *msg) {
  printf("ERROR\t%s: %s\n", msg, strerror(errno));
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x10(%rbp),%rsi
mov    %rax,%rdx
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeb7(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <printf@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"ERROR\09%s: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @fatal(i8* %0) {
%2 = load i32, i32* @errno
%3 = tail call i8* @strerror(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}
int hexify(int num) {
  if ((num >= 0) && (num <= 9))
    return '0' + num;
  else if ((num >= 10) && (num <= 16))
    return 'a' + (num - 10);
  else
    return 'X';
}


x86 assembly (clang, -O0):
<hexify>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1129 <hexify+0x29>
cmpl   $0x9,-0x8(%rbp)
jg     1129 <hexify+0x29>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1155 <hexify+0x55>
cmpl   $0xa,-0x8(%rbp)
jl     114e <hexify+0x4e>
cmpl   $0x10,-0x8(%rbp)
jg     114e <hexify+0x4e>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
add    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    1155 <hexify+0x55>
movl   $0x58,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexify>:
mov    %edi,%eax
cmp    $0x9,%edi
ja     110b <hexify+0xb>
add    $0x30,%eax
ret
lea    -0xa(%rax),%ecx
add    $0x57,%eax
cmp    $0x7,%ecx
mov    $0x58,%ecx
cmovb  %eax,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @hexify(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = add nuw nsw i32 %0, 48
br label %10
5: ; preds = %1
%6 = add i32 %0, -10
%7 = icmp ult i32 %6, 7
%8 = add nsw i32 %0, 87
%9 = select i1 %7, i32 %8, i32 88
br label %10
10: ; preds = %5, %3
%11 = phi i32 [ %4, %3 ], [ %9, %5 ]
ret i32 %11
}
/* Variables and functions */
double log(double);
double rtoi(double ratio) { return log(ratio) * (17.312340490667548); }


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

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

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

LLVM IR (-O2):
define double @rtoi(double %0) {
%2 = tail call double @log(double %0)
%3 = fmul double %2, 0x40314FF58BE0A23B
ret double %3
}
void acl_create_entry(int *other_p, int *entry_p) {
  if (!other_p || !entry_p) {
    if (entry_p)
      *entry_p = 5;
    return;
  }
  *entry_p = 6;
}


x86 assembly (clang, -O0):
<acl_create_entry>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1122 <acl_create_entry+0x22>
cmpq   $0x0,-0x10(%rbp)
jne    113c <acl_create_entry+0x3c>
cmpq   $0x0,-0x10(%rbp)
je     1137 <acl_create_entry+0x37>
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
jmp    1146 <acl_create_entry+0x46>
mov    -0x10(%rbp),%rax
movl   $0x6,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<acl_create_entry>:
test   %rsi,%rsi
je     1118 <acl_create_entry+0x18>
setne  %al
test   %rdi,%rdi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
add    $0x5,%eax
mov    %eax,(%rsi)
ret

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

LLVM IR (-O2):
define void @acl_create_entry(i32* readnone %0, i32* writeonly %1) {
%3 = icmp ne i32* %1, null
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = icmp ne i32* %0, null
%6 = and i1 %5, %3
%7 = select i1 %6, i32 6, i32 5
store i32 %7, i32* %1
br label %8
8: ; preds = %2, %4
ret void
}
void *test(void *arg) { return arg; }


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

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

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

LLVM IR (-O2):
define i8* @test(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ udelay(int);
void clk() {
  *(volatile unsigned *)(0xBF800000 + (0x86168)) = (1 << (0));
  udelay(1);
  *(volatile unsigned *)(0xBF800000 + (0x86164)) = (1 << (0));
}


x86 assembly (clang, -O0):
<clk>:
push   %rbp
mov    %rsp,%rbp
mov    $0xbf886168,%eax
movl   $0x1,(%rax)
mov    $0x1,%edi
call   1030 <udelay@plt>
mov    $0xbf886164,%eax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clk>:
push   %rbx
mov    $0xbf886164,%ebx
movl   $0x1,0x4(%rbx)
mov    $0x1,%edi
call   1030 <udelay@plt>
movl   $0x1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @clk() {
store volatile i32 1, i32* inttoptr (i64 3213386088 to i32*)
%1 = call i32 @udelay(i32 1)
store volatile i32 1, i32* inttoptr (i64 3213386084 to i32*)
ret void
}

LLVM IR (-O2):
define void @clk() {
store volatile i32 1, i32* inttoptr (i64 3213386088 to i32*)
%1 = tail call i32 @udelay(i32 1)
store volatile i32 1, i32* inttoptr (i64 3213386084 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ calculate(char *, char *, char *);
int /*<<< orphan*/ input_data_correct(char **);
int main(int argc, char **argv) {
  if (argc != 4)
    return (0);
  if (!input_data_correct(argv))
    return (0);
  calculate(argv[1], argv[2], argv[3]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     114c <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    118e <main+0x6e>
mov    -0x10(%rbp),%rdi
call   1040 <input_data_correct@plt>
cmp    $0x0,%eax
jne    116a <main+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    118e <main+0x6e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
call   1030 <calculate@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x4,%edi
jne    1146 <main+0x26>
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1040 <input_data_correct@plt>
test   %eax,%eax
je     1146 <main+0x26>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
mov    0x18(%rbx),%rdx
call   1030 <calculate@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = tail call i32 @input_data_correct(i8** %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %4
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = tail call i32 @calculate(i8* %9, i8* %11, i8* %13)
br label %15
15: ; preds = %4, %2, %7
ret i32 0
}
const char *str_stmt_while() { return "while"; }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"while\00"
define i8* @str_stmt_while() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
unsigned xrop3_136_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned stk1;
  stk1 = D & S;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_136_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @xrop3_136_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 8
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = or i32 %10, %12
store i32 %13, i32* %6
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = and i32 %14, %15
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = xor i32 %18, -1
%20 = and i32 %17, %19
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = and i32 %21, %22
%24 = or i32 %20, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @xrop3_136_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
ret i32 %3
}
/* Variables and functions */
int memcmp(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int main() {
  char *str1 = "Hello World";
  char *str3 = "Hello World";
  char str4[10];
  return memcmp(memcpy(str4, str1, 10), str3, 10) != true;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xebf(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x22(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xa,%edx
call   1040 <memcpy@plt>
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
mov    $0xa,%edx
call   1030 <memcmp@plt>
cmp    $0x1,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rbx
lea    0x6(%rsp),%rdi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1040 <memcpy@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1030 <memcmp@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
setne  %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [10 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @memcpy(i8* %5, i8* %6, i32 10)
%8 = load i8*, i8** %3
%9 = call i32 @memcmp(i32 %7, i8* %8, i32 10)
%10 = icmp ne i32 %9, 1
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @memcpy(i8* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 10)
%4 = call i32 @memcmp(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 10)
%5 = icmp ne i32 %4, 1
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
double sqrt(double);
int main() {
  printf("hello, I'm a C program\n");
  double x = sqrt(2.0);
  printf("The square root of 2.0 is %f\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xebb(%rip),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xec5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xed4(%rip),%rdi
movsd  0xec4(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"hello, I'm a C program\0A\00"
@.str.1 = [30 x i8] c"The square root of 2.0 is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call double @sqrt(double 2.000000e+00)
store double %4, double* %2
%5 = load double, double* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), double %5)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [30 x i8] c"The square root of 2.0 is %f\0A\00"
@str = [23 x i8] c"hello, I'm a C program\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), double 0x3FF6A09E667F3BCD)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printPIF();
int /*<<< orphan*/ printST();
void printAll() {
  printPIF();
  printST();
}


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

x86 assembly (clang, -O2):
<printAll>:
push   %rax
xor    %eax,%eax
call   1030 <printPIF@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <printST@plt>

LLVM IR (-O0):
define void @printAll() {
%1 = call i32 (...) @printPIF()
%2 = call i32 (...) @printST()
ret void
}

LLVM IR (-O2):
define void @printAll() {
%1 = tail call i32 (...) @printPIF()
%2 = tail call i32 (...) @printST()
ret void
}
void _Z16_Jv_BlockSigchldv(void) {}


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

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

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

LLVM IR (-O2):
define void @_Z16_Jv_BlockSigchldv() {
ret void
}
void INT_TM00(void) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @INT_TM00() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ acc_free(void *);
void *acc_malloc(int const);
int /*<<< orphan*/ acc_map_data(unsigned char *, void *, int /*<<< orphan*/);
int /*<<< orphan*/ acc_unmap_data(unsigned char *);
int /*<<< orphan*/ free(unsigned char *);
scalar_t__ malloc(int const);
int main(int argc, char **argv) {
  const int N = 256;
  unsigned char *h;
  void *d;
  h = (unsigned char *)malloc(N);
  d = acc_malloc(N);
  acc_map_data(h, d, 0);
  acc_unmap_data(h);
  acc_free(d);
  free(h);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x100,-0x14(%rbp)
mov    $0x100,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x100,%edi
call   1040 <acc_malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1060 <acc_map_data@plt>
mov    -0x20(%rbp),%rdi
call   1050 <acc_unmap_data@plt>
mov    -0x28(%rbp),%rdi
call   1080 <acc_free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x100,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    $0x100,%edi
call   1040 <acc_malloc@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %edx,%edx
call   1060 <acc_map_data@plt>
mov    %rbx,%rdi
call   1050 <acc_unmap_data@plt>
mov    %r14,%rdi
call   1080 <acc_free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 256, i32* %6
%9 = call i64 @malloc(i32 256)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %7
%11 = call i8* @acc_malloc(i32 256)
store i8* %11, i8** %8
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = call i32 @acc_map_data(i8* %12, i8* %13, i32 0)
%15 = load i8*, i8** %7
%16 = call i32 @acc_unmap_data(i8* %15)
%17 = load i8*, i8** %8
%18 = call i32 @acc_free(i8* %17)
%19 = load i8*, i8** %7
%20 = call i32 @free(i8* %19)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 256)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i8* @acc_malloc(i32 256)
%6 = tail call i32 @acc_map_data(i8* %4, i8* %5, i32 0)
%7 = tail call i32 @acc_unmap_data(i8* %4)
%8 = tail call i32 @acc_free(i8* %5)
%9 = tail call i32 @free(i8* %4)
ret i32 0
}
/* Type definitions */
typedef char uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void showKey(uint8_t *key, size_t key_len) { printf("%s ", key); }


x86 assembly (clang, -O0):
<showKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showKey>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s \00"
define void @showKey(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 i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
define void @showKey(i8* %0, i64 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
double tan(double);
double cot(double n) { return 1.0 / tan(n); }


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

x86 assembly (clang, -O2):
<cot>:
push   %rax
call   1030 <tan@plt>
movsd  0xee2(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @cot(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @tan(double %3)
%5 = fdiv double 1.000000e+00, %4
ret double %5
}

LLVM IR (-O2):
define double @cot(double %0) {
%2 = tail call double @tan(double %0)
%3 = fdiv double 1.000000e+00, %2
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ execv(char *, char **);
void child(int sfd) {
  dup2(sfd, 0);
  dup2(sfd, 1);
  dup2(sfd, 2);
  char *args[] = {"/bin/sh"};
  execv("/bin/sh", args);
}


x86 assembly (clang, -O0):
<child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <dup2@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <dup2@plt>
mov    0x2cc2(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1040 <execv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<child>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %esi,%esi
call   1030 <dup2@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
mov    %ebx,%edi
mov    $0x2,%esi
call   1030 <dup2@plt>
lea    0xeb3(%rip),%rdi
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rsi
call   1040 <execv@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/sh\00"
@__const.child.args = [1 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)]
define void @child(i32 %0) {
%2 = alloca i32
%3 = alloca [1 x i8*]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @dup2(i32 %4, i32 0)
%6 = load i32, i32* %2
%7 = call i32 @dup2(i32 %6, i32 1)
%8 = load i32, i32* %2
%9 = call i32 @dup2(i32 %8, i32 2)
%10 = bitcast [1 x i8*]* %3 to i8*
%11 = getelementptr inbounds [1 x i8*], [1 x i8*]* %3, i64 0, i64 0
%12 = call i32 @execv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %11)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
define void @child(i32 %0) {
%2 = alloca [1 x i8*]
%3 = tail call i32 @dup2(i32 %0, i32 0)
%4 = tail call i32 @dup2(i32 %0, i32 1)
%5 = tail call i32 @dup2(i32 %0, i32 2)
%6 = bitcast [1 x i8*]* %2 to i8*
%7 = bitcast [1 x i8*]* %2 to i64*
store i64 ptrtoint ([8 x i8]* @.str to i64), i64* %7
%8 = getelementptr inbounds [1 x i8*], [1 x i8*]* %2, i64 0, i64 0
%9 = call i32 @execv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %8)
ret void
}
int x2_process_request(struct mypacket *packet) { return 0; }


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

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

LLVM IR (-O0):
%struct.mypacket = type opaque
define i32 @x2_process_request(%struct.mypacket* %0) {
%2 = alloca %struct.mypacket*
store %struct.mypacket* %0, %struct.mypacket** %2
ret i32 0
}

LLVM IR (-O2):
%struct.mypacket = type opaque
define i32 @x2_process_request(%struct.mypacket* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int, int);
void moveCursor(WINDOW *window, int xloc, int yloc) {
  wmove(window, yloc, xloc);
}


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

x86 assembly (clang, -O2):
<moveCursor>:
mov    %esi,%eax
mov    %edx,%esi
mov    %eax,%edx
jmp    1030 <wmove@plt>

LLVM IR (-O0):
define void @moveCursor(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* %6
%9 = load i32, i32* %5
%10 = call i32 @wmove(i32* %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @moveCursor(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @wmove(i32* %0, i32 %2, i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ islower(int);
int tolower(int);
int toupper(int);
int ctoggle(int c) { return islower(c) ? toupper(c) : tolower(c); }


x86 assembly (clang, -O0):
<ctoggle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     115d <ctoggle+0x2d>
mov    -0x4(%rbp),%edi
call   1040 <toupper@plt>
mov    %eax,-0x8(%rbp)
jmp    1168 <ctoggle+0x38>
mov    -0x4(%rbp),%edi
call   1050 <tolower@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctoggle>:
push   %rbx
mov    %edi,%ebx
call   1030 <islower@plt>
mov    %ebx,%edi
test   %rax,%rax
je     1145 <ctoggle+0x15>
pop    %rbx
jmp    1040 <toupper@plt>
pop    %rbx
jmp    1050 <tolower@plt>

LLVM IR (-O0):
define i32 @ctoggle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @islower(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @toupper(i32 %7)
br label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 @tolower(i32 %10)
br label %12
12: ; preds = %9, %6
%13 = phi i32 [ %8, %6 ], [ %11, %9 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @ctoggle(i32 %0) {
%2 = tail call i64 @islower(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @toupper(i32 %0)
br label %8
6: ; preds = %1
%7 = tail call i32 @tolower(i32 %0)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %9
}
void fh_gc_debug() {}


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

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

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

LLVM IR (-O2):
define void @fh_gc_debug() {
ret void
}
unsigned int wHashVal(char *str) {
  unsigned int h;
  unsigned char *p;
  h = 0;
  for (p = (unsigned char *)str; *p != '\0'; p++) {
    h = 31 * h + *p;
  }
  return h % 1024;
}


x86 assembly (clang, -O0):
<wHashVal>:
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
movzbl (%rax),%eax
cmp    $0x0,%eax
je     1148 <wHashVal+0x48>
imul   $0x1f,-0xc(%rbp),%eax
mov    -0x18(%rbp),%rcx
movzbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <wHashVal+0x17>
mov    -0xc(%rbp),%eax
and    $0x3ff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wHashVal>:
mov    (%rdi),%cl
test   %cl,%cl
je     112f <wHashVal+0x2f>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movzbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <wHashVal+0x10>
and    $0x3ff,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @wHashVal(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 = %18, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %6
%12 = load i32, i32* %3
%13 = mul i32 31, %12
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = add i32 %13, %16
store i32 %17, i32* %3
br label %18
18: ; preds = %11
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %4
br label %6
21: ; preds = %6
%22 = load i32, i32* %3
%23 = urem i32 %22, 1024
ret i32 %23
}

LLVM IR (-O2):
define i32 @wHashVal(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %11, %4 ], [ %0, %1 ]
%7 = phi i32 [ %10, %4 ], [ 0, %1 ]
%8 = zext i8 %5 to i32
%9 = mul i32 %7, 31
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %10, 1023
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: nohup utility [argument ...]\n");
  exit(127);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"usage: nohup utility [argument ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 127)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"usage: nohup utility [argument ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 127)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, const char *argv[]) {
  printf("hello world ! I love you\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%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 = [26 x i8] c"hello world ! I love you\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [25 x i8] c"hello world ! I love you\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret i32 0
}