xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int read(int, char *, int);
int do_read(int fd, char *data, int length) {
  int res;
  do
    res = read(fd, data, length);
  while ((res < 0) && (errno == EINTR));
  return res;
}


x86 assembly (clang, -O0):
<do_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <read@plt>
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0x19(%rbp)
jge    115d <do_read+0x4d>
mov    0x2e96(%rip),%rax
mov    (%rax),%rax
mov    0x2e84(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1122 <do_read+0x12>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_read>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2eb9(%rip),%r15
mov    0x2eaa(%rip),%r12
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <read@plt>
test   %eax,%eax
jns    114a <do_read+0x3a>
mov    (%r12),%rcx
cmp    %rcx,(%r15)
je     1130 <do_read+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i32 @do_read(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
br label %8
8: ; preds = %20, %3
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @read(i32 %9, i8* %10, i32 %11)
store i32 %12, i32* %7
br label %13
13: ; preds = %8
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i64, i64* @errno
%18 = load i64, i64* @EINTR
%19 = icmp eq i64 %17, %18
br label %20
20: ; preds = %16, %13
%21 = phi i1 [ false, %13 ], [ %19, %16 ]
br i1 %21, label %8, label %22
22: ; preds = %20
%23 = load i32, i32* %7
ret i32 %23
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i32 @do_read(i32 %0, i8* nocapture %1, i32 %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i32 @read(i32 %0, i8* %1, i32 %2)
%6 = icmp slt i32 %5, 0
%7 = load i64, i64* @errno
%8 = load i64, i64* @EINTR
%9 = icmp eq i64 %7, %8
%10 = select i1 %6, i1 %9, i1 false
br i1 %10, label %4, label %11
11: ; preds = %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int G55_f(char *s) {
  debug("G55_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<G55_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<G55_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf05(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"G55_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @G55_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [46 x i8] c"G55_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @G55_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
float sub2(float a, float b) { return a - b; }


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

x86 assembly (clang, -O2):
<sub2>:
subss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @sub2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fsub float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @sub2(float %0, float %1) {
%3 = fsub float %0, %1
ret float %3
}
char *Check_MID(char *Author_name, char *Module_Name, float Version) {
  return "test";
}


x86 assembly (clang, -O0):
<Check_MID>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
lea    0xee8(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"test\00"
define i8* @Check_MID(i8* %0, i8* %1, float %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float
store i8* %0, i8** %4
store i8* %1, i8** %5
store float %2, float* %6
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
define i8* @Check_MID(i8* nocapture readnone %0, i8* nocapture readnone %1, float %2) {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello(void) { printf("Hello"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
define void @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
define void @hello() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void test10_cb(void *cc_, char *sa, char *se, void *v_) {
  int v = v_ ? *(int *)v_ : -1;
  printf("found partial match : %d\n", v);
}


x86 assembly (clang, -O0):
<test10_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1141 <test10_cb+0x31>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
jmp    114e <test10_cb+0x3e>
mov    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    114e <test10_cb+0x3e>
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test10_cb>:
test   %rcx,%rcx
je     1123 <test10_cb+0x13>
mov    (%rcx),%esi
lea    0xee2(%rip),%rdi
jmp    1030 <printf@plt>
mov    $0xffffffff,%esi
lea    0xed1(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"found partial match : %d\0A\00"
define void @test10_cb(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %8
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load i8*, i8** %8
%14 = bitcast i8* %13 to i32*
%15 = load i32, i32* %14
br label %17
16: ; preds = %4
br label %17
17: ; preds = %16, %12
%18 = phi i32 [ %15, %12 ], [ -1, %16 ]
store i32 %18, i32* %9
%19 = load i32, i32* %9
%20 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"found partial match : %d\0A\00"
define void @test10_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* %3) {
%5 = icmp eq i8* %3, null
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = bitcast i8* %3 to i32*
%8 = load i32, i32* %7
br label %9
9: ; preds = %4, %6
%10 = phi i32 [ %8, %6 ], [ -1, %4 ]
%11 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar(char);
int /*<<< orphan*/ ft_putstr(char *);
int main(int argc, char **argv) {
  while (argc > 1) {
    argc--;
    ft_putstr(argv[argc]);
    ft_putchar('\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)
cmpl   $0x1,-0x8(%rbp)
jle    1169 <main+0x49>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <ft_putstr@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     1160 <main+0x40>
mov    %rsi,%r14
mov    %edi,%ebx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x2(%rbx),%eax
mov    (%r14,%rax,8),%rdi
call   1040 <ft_putstr@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x2,%rbx
ja     1140 <main+0x20>
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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %6
6: ; preds = %9, %2
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %4
%11 = add nsw i32 %10, -1
store i32 %11, i32* %4
%12 = load i8**, i8*** %5
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @ft_putstr(i8* %16)
%18 = call i32 @ft_putchar(i8 signext 10)
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ %5, %4 ], [ %8, %6 ]
%8 = add nsw i64 %7, -1
%9 = and i64 %8, 4294967295
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @ft_putstr(i8* %11)
%13 = tail call i32 @ft_putchar(i8 signext 10)
%14 = icmp ugt i64 %7, 2
br i1 %14, label %6, label %15
15: ; preds = %6, %2
ret i32 0
}
int GetDistSymbol(int dist) {
  if (dist < 5) {
    return dist - 1;
  } else {
    int l = (31 ^ __builtin_clz(dist - 1));
    int r = ((dist - 1) >> (l - 1)) & 1;
    return l * 2 + r;
  }
}


x86 assembly (clang, -O0):
<GetDistSymbol>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    111f <GetDistSymbol+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <GetDistSymbol+0x51>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
bsr    %eax,%eax
xor    $0x1f,%eax
xor    $0x1f,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetDistSymbol>:
lea    -0x1(%rdi),%eax
cmp    $0x5,%edi
jl     111d <GetDistSymbol+0x1d>
bsr    %eax,%edx
xor    $0x1f,%edx
mov    $0x1e,%cl
sub    %dl,%cl
shr    %cl,%eax
and    $0x1,%eax
lea    (%rax,%rdx,2),%eax
xor    $0x3e,%eax
ret

LLVM IR (-O0):
define i32 @GetDistSymbol(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %2
br label %26
11: ; preds = %1
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = call i32 @llvm.ctlz.i32(i32 %13, i1 true)
%15 = xor i32 31, %14
store i32 %15, i32* %4
%16 = load i32, i32* %3
%17 = sub nsw i32 %16, 1
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
%20 = ashr i32 %17, %19
%21 = and i32 %20, 1
store i32 %21, i32* %5
%22 = load i32, i32* %4
%23 = mul nsw i32 %22, 2
%24 = load i32, i32* %5
%25 = add nsw i32 %23, %24
store i32 %25, i32* %2
br label %26
26: ; preds = %11, %8
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @GetDistSymbol(i32 %0) {
%2 = icmp slt i32 %0, 5
%3 = add nsw i32 %0, -1
br i1 %2, label %12, label %4
4: ; preds = %1
%5 = tail call i32 @llvm.ctlz.i32(i32 %3, i1 true)
%6 = sub nsw i32 30, %5
%7 = lshr i32 %3, %6
%8 = and i32 %7, 1
%9 = shl nuw nsw i32 %5, 1
%10 = or i32 %8, %9
%11 = xor i32 %10, 62
br label %12
12: ; preds = %1, %4
%13 = phi i32 [ %11, %4 ], [ %3, %1 ]
ret i32 %13
}
/* Variables and functions */
int f127(int *);
int f128(int *p) { return f127(p); }


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

x86 assembly (clang, -O2):
<f128>:
jmp    1030 <f127@plt>

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

LLVM IR (-O2):
define i32 @f128(i32* %0) {
%2 = tail call i32 @f127(i32* %0)
ret i32 %2
}
/* Type definitions */
struct timespec {
  double tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
double walltime() {
  struct timespec tv;
  clock_gettime(CLOCK_REALTIME, &tv);
  return tv.tv_sec + 1e-9 * tv.tv_nsec;
}


x86 assembly (clang, -O0):
<walltime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xec4(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<walltime>:
sub    $0x18,%rsp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdl 0x10(%rsp),%xmm0
mulsd  0xecb(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { double, i32 }
@CLOCK_REALTIME = global i32 0
define double @walltime() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_REALTIME
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = call double @llvm.fmuladd.f64(double 1.000000e-09, double %8, double %5)
ret double %9
}

LLVM IR (-O2):
%struct.timespec = type { double, i32 }
@CLOCK_REALTIME = global i32 0
define double @walltime() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_REALTIME
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load double, double* %5
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sitofp i32 %8 to double
%10 = call double @llvm.fmuladd.f64(double %9, double 1.000000e-09, double %6)
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *);
void streq(void *a, void *b) {
  char *c, *d;
  c = a;
  d = b;
  sprintf(c, "%s", d);
}


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

x86 assembly (clang, -O2):
<streq>:
jmp    1030 <strcpy@plt>

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

LLVM IR (-O2):
define void @streq(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strcpy(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ itob(int, char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
int main() {
  int n1 = 32;
  char s1[50];
  itob(n1, s1, 16);
  printf("%d, %s\n\n", n1, s1);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
mov    %rsp,%rbx
mov    $0x20,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
lea    0xebf(%rip),%rdi
mov    $0x20,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d, %s\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [50 x i8]
store i32 0, i32* %1
store i32 32, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%6 = call i32 @itob(i32 %4, i8* %5, i32 16)
%7 = load i32, i32* %2
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d, %s\0A\0A\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @itob(i32 32, i8* %2, i32 16)
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 32, i8* %2)
ret i32 0
}
void rop3_102_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  stk1 = *D ^ S;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_102_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @rop3_102_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = xor i32 %10, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %7
%15 = load i8, i8* %7
%16 = zext i8 %15 to i32
%17 = load i8, i8* %5
%18 = zext i8 %17 to i32
%19 = xor i32 %18, -1
%20 = and i32 %16, %19
%21 = load i8, i8* %6
%22 = zext i8 %21 to i32
%23 = xor i32 %22, -1
%24 = and i32 %20, %23
%25 = load i8*, i8** %4
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = load i8, i8* %5
%29 = zext i8 %28 to i32
%30 = and i32 %27, %29
%31 = or i32 %24, %30
%32 = load i8*, i8** %4
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = load i8, i8* %6
%36 = zext i8 %35 to i32
%37 = and i32 %34, %36
%38 = or i32 %31, %37
%39 = trunc i32 %38 to i8
%40 = load i8*, i8** %4
store i8 %39, i8* %40
ret void
}

LLVM IR (-O2):
define void @rop3_102_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void isr_default_int(void) { print("interrupt\n"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"interrupt\0A\00"
define void @isr_default_int() {
%1 = call i32 @print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"interrupt\0A\00"
define void @isr_default_int() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
__attribute__((always_)) int nxt_popcount(unsigned int x) {
  int count;
  for (count = 0; x != 0; count++) {
    x &= x - 1;
  }
  return count;
}


x86 assembly (clang, -O0):
<nxt_popcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <nxt_popcount+0x32>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <nxt_popcount+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nxt_popcount>:
xor    %eax,%eax
test   %edi,%edi
je     111c <nxt_popcount+0x1c>
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rdi),%ecx
add    $0x1,%eax
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <nxt_popcount+0x10>
ret

LLVM IR (-O0):
define i32 @nxt_popcount(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %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* %2
%9 = sub i32 %8, 1
%10 = load i32, i32* %2
%11 = and i32 %10, %9
store i32 %11, i32* %2
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @nxt_popcount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add i32 %5, -1
%7 = and i32 %6, %5
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
void task_second() {
  int j = 1;
  while (1) {
    j += 2;
    kprint("2");
    for (int i = 0; i < 1000000; ++i) {
      __asm__("NOP");
    }
  }
}


x86 assembly (clang, -O0):
<task_second>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <kprint@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xf4240,-0x8(%rbp)
jge    1159 <task_second+0x49>
nop
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <task_second+0x2d>
jmp    111f <task_second+0xf>

x86 assembly (clang, -O2):
<task_second>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <kprint@plt>
mov    $0xf4240,%eax
nop
nop
add    $0xffffffff,%eax
jne    1130 <task_second+0x20>
jmp    1120 <task_second+0x10>

LLVM IR (-O0):
@.str = [2 x i8] c"2\00"
define void @task_second() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
br label %3
3: ; preds = %0, %14
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 2
store i32 %5, i32* %1
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %7
7: ; preds = %11, %3
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 1000000
br i1 %9, label %10, label %14
10: ; preds = %7
br label %11
11: ; preds = %10
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %7
14: ; preds = %7
br label %3
}

LLVM IR (-O2):
@.str = [2 x i8] c"2\00"
define void @task_second() {
br label %1
1: ; preds = %3, %0
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %5, %3 ]
tail call void asm sideeffect "NOP", "~{dirflag},~{fpsr},~{flags}"()
%5 = add nuw nsw i32 %4, 1
%6 = icmp eq i32 %5, 1000000
br i1 %6, label %1, label %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void die(const char *message) {
  fprintf(stderr, "dying: %s\n", message);
  exit(2);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"dying: %s\0A\00"
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 2)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *, double);
int /*<<< orphan*/ stdout;
void slist_element_show_double(void *x, void *arg) {
  { arg = arg; }
  fprintf(stdout, "\tslist element {object=>0x%p,value=>%.3f}\n", x,
          *(double *)x);
}


x86 assembly (clang, -O0):
<slist_element_show_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slist_element_show_double>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
movsd  (%rdx),%xmm0
lea    0xed9(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [43 x i8] c"\09slist element {object=>0x%p,value=>%.3f}\0A\00"
define void @slist_element_show_double(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
store i8* %5, i8** %4
%6 = load i32, i32* @stdout
%7 = load i8*, i8** %3
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
%11 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %7, double %10)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [43 x i8] c"\09slist element {object=>0x%p,value=>%.3f}\0A\00"
define void @slist_element_show_double(i8* %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = bitcast i8* %0 to double*
%5 = load double, double* %4
%6 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %0, double %5)
ret void
}
/* Type definitions */
typedef scalar_t__ int_fast16_t;

/* Variables and functions */
bool SHAREMIND_SET_KEY_LESS_THAN_int_fast16_t(int_fast16_t const k1,
                                              int_fast16_t const k2) {
  return k1 < k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_SET_KEY_LESS_THAN_int_fast16_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_SET_KEY_LESS_THAN_int_fast16_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
setl   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_SET_KEY_LESS_THAN_int_fast16_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_SET_KEY_LESS_THAN_int_fast16_t(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int main(void) {
  int speed = 15;
  int *ptr;
  ptr = &speed;
  printf("The address %x contains %d\n", ptr, *ptr);
  printArray();
  arrayLength();
  dynamicArray();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xf,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <printArray@plt>
mov    $0x0,%al
call   1060 <arrayLength@plt>
mov    $0x0,%al
call   1050 <dynamicArray@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0xf,0x4(%rsp)
lea    0xeb0(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    $0xf,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <printArray@plt>
xor    %eax,%eax
call   1060 <arrayLength@plt>
xor    %eax,%eax
call   1050 <dynamicArray@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"The address %x contains %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 15, i32* %1
store i32* %1, i32** %2
%3 = load i32*, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %3, i32 %5)
%7 = call i32 (...) @printArray()
%8 = call i32 (...) @arrayLength()
%9 = call i32 (...) @dynamicArray()
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"The address %x contains %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 15, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %1, i32 15)
%4 = call i32 (...) @printArray()
%5 = call i32 (...) @arrayLength()
%6 = call i32 (...) @dynamicArray()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ft_memdel(void **mem) {
  free(*mem);
  *mem = NULL;
}


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

x86 assembly (clang, -O2):
<ft_memdel>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @ft_memdel(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
%5 = call i32 @free(i8* %4)
%6 = load i8**, i8*** %2
store i8* null, i8** %6
ret void
}

LLVM IR (-O2):
define void @ft_memdel(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @free(i8* %2)
store i8* null, i8** %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_MD_CTX;

/* Variables and functions */
int /*<<< orphan*/ EVP_MD_CTX_md_data(int /*<<< orphan*/ *);
int SHA256_Init(int /*<<< orphan*/);
int init256(EVP_MD_CTX *ctx) { return SHA256_Init(EVP_MD_CTX_md_data(ctx)); }


x86 assembly (clang, -O0):
<init256>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <EVP_MD_CTX_md_data@plt>
mov    %eax,%edi
call   1040 <SHA256_Init@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init256>:
push   %rax
call   1030 <EVP_MD_CTX_md_data@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <SHA256_Init@plt>

LLVM IR (-O0):
define i32 @init256(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @EVP_MD_CTX_md_data(i32* %3)
%5 = call i32 @SHA256_Init(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @init256(i32* %0) {
%2 = tail call i32 @EVP_MD_CTX_md_data(i32* %0)
%3 = tail call i32 @SHA256_Init(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void halt(char *msg) {
  printf(msg);
  printf(", machine halted.\n");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<halt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
jmp    1131 <halt+0x21>

x86 assembly (clang, -O2):
<halt>:
push   %rax
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    1140 <halt+0x20>

LLVM IR (-O0):
@.str = [19 x i8] c", machine halted.\0A\00"
define void @halt(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %6
br label %6
}

LLVM IR (-O2):
@str = [18 x i8] c", machine halted.\00"
define void @halt(i8* nocapture %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %1, %4
br label %4
}
/* Variables and functions */
char *_read_line(int);
int /*<<< orphan*/ setNonBlocking(int, int);
char *read_line(int fd) {
  setNonBlocking(fd, 1);
  return _read_line(fd);
}


x86 assembly (clang, -O0):
<read_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <setNonBlocking@plt>
mov    -0x4(%rbp),%edi
call   1040 <_read_line@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_line>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%esi
call   1030 <setNonBlocking@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <_read_line@plt>

LLVM IR (-O0):
define i8* @read_line(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @setNonBlocking(i32 %3, i32 1)
%5 = load i32, i32* %2
%6 = call i8* @_read_line(i32 %5)
ret i8* %6
}

LLVM IR (-O2):
define i8* @read_line(i32 %0) {
%2 = tail call i32 @setNonBlocking(i32 %0, i32 1)
%3 = tail call i8* @_read_line(i32 %0)
ret i8* %3
}
/* Type definitions */
struct xfs_dir2_data_hdr {
  int dummy;
};
struct xfs_dir2_data_entry {
  int dummy;
};

/* Variables and functions */
int xfs_dir3_data_dotdot_offset(struct xfs_dir2_data_hdr *);
struct xfs_dir2_data_entry *
xfs_dir3_data_dotdot_entry_p(struct xfs_dir2_data_hdr *hdr) {
  return (struct xfs_dir2_data_entry *)((char *)hdr +
                                        xfs_dir3_data_dotdot_offset(hdr));
}


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

x86 assembly (clang, -O2):
<xfs_dir3_data_dotdot_entry_p>:
push   %rbx
mov    %rdi,%rbx
call   1030 <xfs_dir3_data_dotdot_offset@plt>
cltq
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.xfs_dir2_data_entry = type { i32 }
%struct.xfs_dir2_data_hdr = type { i32 }
define %struct.xfs_dir2_data_entry* @xfs_dir3_data_dotdot_entry_p(%struct.xfs_dir2_data_hdr* %0) {
%2 = alloca %struct.xfs_dir2_data_hdr*
store %struct.xfs_dir2_data_hdr* %0, %struct.xfs_dir2_data_hdr** %2
%3 = load %struct.xfs_dir2_data_hdr*, %struct.xfs_dir2_data_hdr** %2
%4 = bitcast %struct.xfs_dir2_data_hdr* %3 to i8*
%5 = load %struct.xfs_dir2_data_hdr*, %struct.xfs_dir2_data_hdr** %2
%6 = call i32 @xfs_dir3_data_dotdot_offset(%struct.xfs_dir2_data_hdr* %5)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 %7
%9 = bitcast i8* %8 to %struct.xfs_dir2_data_entry*
ret %struct.xfs_dir2_data_entry* %9
}

LLVM IR (-O2):
%struct.xfs_dir2_data_entry = type { i32 }
%struct.xfs_dir2_data_hdr = type { i32 }
define %struct.xfs_dir2_data_entry* @xfs_dir3_data_dotdot_entry_p(%struct.xfs_dir2_data_hdr* %0) {
%2 = bitcast %struct.xfs_dir2_data_hdr* %0 to i8*
%3 = tail call i32 @xfs_dir3_data_dotdot_offset(%struct.xfs_dir2_data_hdr* %0)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %2, i64 %4
%6 = bitcast i8* %5 to %struct.xfs_dir2_data_entry*
ret %struct.xfs_dir2_data_entry* %6
}
/* Type definitions */
struct sk_buff_head {
  int dummy;
};
struct sk_buff {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __skb_unlink(struct sk_buff *, struct sk_buff_head *);
struct sk_buff *skb_peek_tail(struct sk_buff_head *);
struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) {
  struct sk_buff *skb = skb_peek_tail(list);
  if (skb)
    __skb_unlink(skb, list);
  return skb;
}


x86 assembly (clang, -O0):
<__skb_dequeue_tail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <skb_peek_tail@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1151 <__skb_dequeue_tail+0x31>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <__skb_unlink@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__skb_dequeue_tail>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <skb_peek_tail@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113f <__skb_dequeue_tail+0x1f>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <__skb_unlink@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sk_buff = type { i32 }
%struct.sk_buff_head = type { i32 }
define %struct.sk_buff* @__skb_dequeue_tail(%struct.sk_buff_head* %0) {
%2 = alloca %struct.sk_buff_head*
%3 = alloca %struct.sk_buff*
store %struct.sk_buff_head* %0, %struct.sk_buff_head** %2
%4 = load %struct.sk_buff_head*, %struct.sk_buff_head** %2
%5 = call %struct.sk_buff* @skb_peek_tail(%struct.sk_buff_head* %4)
store %struct.sk_buff* %5, %struct.sk_buff** %3
%6 = load %struct.sk_buff*, %struct.sk_buff** %3
%7 = icmp ne %struct.sk_buff* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load %struct.sk_buff*, %struct.sk_buff** %3
%10 = load %struct.sk_buff_head*, %struct.sk_buff_head** %2
%11 = call i32 @__skb_unlink(%struct.sk_buff* %9, %struct.sk_buff_head* %10)
br label %12
12: ; preds = %8, %1
%13 = load %struct.sk_buff*, %struct.sk_buff** %3
ret %struct.sk_buff* %13
}

LLVM IR (-O2):
%struct.sk_buff = type { i32 }
%struct.sk_buff_head = type { i32 }
define %struct.sk_buff* @__skb_dequeue_tail(%struct.sk_buff_head* %0) {
%2 = tail call %struct.sk_buff* @skb_peek_tail(%struct.sk_buff_head* %0)
%3 = icmp eq %struct.sk_buff* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @__skb_unlink(%struct.sk_buff* %2, %struct.sk_buff_head* %0)
br label %6
6: ; preds = %4, %1
ret %struct.sk_buff* %2
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ print_exit(int);
scalar_t__ waitpid(int, int *, int /*<<< orphan*/);
void clean_up_child_process(int signal_number) {
  int status;
  while (waitpid(-1, &status, WNOHANG) > 0)
    print_exit(status);
}


x86 assembly (clang, -O0):
<clean_up_child_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0x8(%rbp),%rsi
call   1030 <waitpid@plt>
cmp    $0x0,%rax
jle    1159 <clean_up_child_process+0x39>
mov    -0x8(%rbp),%edi
call   1040 <print_exit@plt>
jmp    112b <clean_up_child_process+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_up_child_process>:
push   %r14
push   %rbx
push   %rax
mov    0x2ebd(%rip),%r14
mov    (%r14),%edx
lea    0x4(%rsp),%rsi
mov    $0xffffffff,%edi
call   1030 <waitpid@plt>
test   %rax,%rax
jle    116e <clean_up_child_process+0x4e>
lea    0x4(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
call   1040 <print_exit@plt>
mov    (%r14),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1030 <waitpid@plt>
test   %rax,%rax
jg     1150 <clean_up_child_process+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @clean_up_child_process(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* @WNOHANG
%6 = call i64 @waitpid(i32 -1, i32* %3, i32 %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* %3
%10 = call i32 @print_exit(i32 %9)
br label %4
11: ; preds = %4
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @clean_up_child_process(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @WNOHANG
%5 = call i64 @waitpid(i32 -1, i32* %2, i32 %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1, %7
%8 = load i32, i32* %2
%9 = call i32 @print_exit(i32 %8)
%10 = load i32, i32* @WNOHANG
%11 = call i64 @waitpid(i32 -1, i32* %2, i32 %10)
%12 = icmp sgt i64 %11, 0
br i1 %12, label %7, label %13
13: ; preds = %7, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int G10_f(char *s) {
  debug("G10_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<G10_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<G10_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf05(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"G10_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @G10_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [46 x i8] c"G10_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @G10_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
int llvm_fcmp_uno(double X, double Y) { return X != X || Y != Y; }


x86 assembly (clang, -O0):
<llvm_fcmp_uno>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
ucomisd -0x8(%rbp),%xmm0
mov    %al,-0x11(%rbp)
jne    113e <llvm_fcmp_uno+0x3e>
jp     113e <llvm_fcmp_uno+0x3e>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
setne  %al
setp   %cl
or     %cl,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<llvm_fcmp_uno>:
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setp   %al
ret

LLVM IR (-O0):
define i32 @llvm_fcmp_uno(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = fcmp une double %5, %6
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load double, double* %4
%10 = load double, double* %4
%11 = fcmp une double %9, %10
br label %12
12: ; preds = %8, %2
%13 = phi i1 [ true, %2 ], [ %11, %8 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @llvm_fcmp_uno(double %0, double %1) {
%3 = fcmp uno double %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int cmp_fun(const void *a, const void *b) { return (*(int *)a - *(int *)b); }


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

x86 assembly (clang, -O2):
<cmp_fun>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @cmp_fun(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmp_fun(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void cpu6502_dump(uint32_t pc, uint32_t a, uint32_t x, uint32_t y, uint32_t sp,
                  uint32_t sr) {}


x86 assembly (clang, -O0):
<cpu6502_dump>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @cpu6502_dump(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
ret void
}

LLVM IR (-O2):
define void @cpu6502_dump(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void __attribute__((weak)) function2(void) {
  printf("libtest2: I am weak function2!\n");
}


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"libtest2: I am weak function2!\0A\00"
define weak void @function2() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"libtest2: I am weak function2!\00"
define weak void @function2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}