xunge/DecIR huggingface dataset:
int foo(int a, int *b, char c) {}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo(i32 %0, i32* %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8
store i32 %0, i32* %5
store i32* %1, i32** %6
store i8 %2, i8* %7
%8 = load i32, i32* %4
ret i32 %8
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32* nocapture readnone %1, i8 signext %2) {
ret i32 undef
}
void ignore_log_cb(int s, const char *msg) {}


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

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

LLVM IR (-O0):
define void @ignore_log_cb(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @ignore_log_cb(i32 %0, i8* nocapture %1) {
ret void
}
int test_imm_97int16_mem(short *val) {
  return ((*val) & (-0x97 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_97int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffff69,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_97int16_mem>:
movzwl (%rdi),%eax
test   $0xff69,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_97int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -151
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int _lseek(int file, int ptr, int dir) {
  if (file) {
  }
  if (dir) {
  }
  if (ptr) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<_lseek>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     111c <_lseek+0x1c>
jmp    111c <_lseek+0x1c>
cmpl   $0x0,-0xc(%rbp)
je     112b <_lseek+0x2b>
jmp    112b <_lseek+0x2b>
cmpl   $0x0,-0x8(%rbp)
je     113a <_lseek+0x3a>
jmp    113a <_lseek+0x3a>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @_lseek(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 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %3
br label %10
10: ; preds = %9, %3
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %5
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %14
br label %18
18: ; preds = %17, %14
ret i32 0
}

LLVM IR (-O2):
define i32 @_lseek(i32 %0, i32 %1, i32 %2) {
ret i32 0
}
void WebPRescalerDspInitNEON(void) {}


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

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

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

LLVM IR (-O2):
define void @WebPRescalerDspInitNEON() {
ret void
}
void dead_result9(int *data) {
  int j = data[2];
  data[j] = 2;
}


x86 assembly (clang, -O0):
<dead_result9>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x2,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dead_result9>:
movslq 0x8(%rdi),%rax
movl   $0x2,(%rdi,%rax,4)
ret

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

LLVM IR (-O2):
define void @dead_result9(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
store i32 2, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ASIC_AcknowledgeInterrupt();
int /*<<< orphan*/ GateArray_AcknowledgeInterrupt();
int /*<<< orphan*/ KCC_AcknowledgeInterrupt();
int /*<<< orphan*/ Z80_ClearInterruptRequest();
void Z80_AcknowledgeInterrupt(void) {
  GateArray_AcknowledgeInterrupt();
  ASIC_AcknowledgeInterrupt();
  Z80_ClearInterruptRequest();
  KCC_AcknowledgeInterrupt();
}


x86 assembly (clang, -O0):
<Z80_AcknowledgeInterrupt>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <GateArray_AcknowledgeInterrupt@plt>
mov    $0x0,%al
call   1050 <ASIC_AcknowledgeInterrupt@plt>
mov    $0x0,%al
call   1030 <Z80_ClearInterruptRequest@plt>
mov    $0x0,%al
call   1040 <KCC_AcknowledgeInterrupt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Z80_AcknowledgeInterrupt>:
push   %rax
xor    %eax,%eax
call   1060 <GateArray_AcknowledgeInterrupt@plt>
xor    %eax,%eax
call   1050 <ASIC_AcknowledgeInterrupt@plt>
xor    %eax,%eax
call   1030 <Z80_ClearInterruptRequest@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <KCC_AcknowledgeInterrupt@plt>

LLVM IR (-O0):
define void @Z80_AcknowledgeInterrupt() {
%1 = call i32 (...) @GateArray_AcknowledgeInterrupt()
%2 = call i32 (...) @ASIC_AcknowledgeInterrupt()
%3 = call i32 (...) @Z80_ClearInterruptRequest()
%4 = call i32 (...) @KCC_AcknowledgeInterrupt()
ret void
}

LLVM IR (-O2):
define void @Z80_AcknowledgeInterrupt() {
%1 = tail call i32 (...) @GateArray_AcknowledgeInterrupt()
%2 = tail call i32 (...) @ASIC_AcknowledgeInterrupt()
%3 = tail call i32 (...) @Z80_ClearInterruptRequest()
%4 = tail call i32 (...) @KCC_AcknowledgeInterrupt()
ret void
}
int test_unsignedint() {
  int i;
  unsigned int reds[2] = {4096, 4096};
#pragma acc parallel loop
  for (i = 0; i < 4096; i++) {
#pragma acc atomic
    reds[0]--;
#pragma acc atomic
    --reds[1];
  }
  for (i = 0; i < 2; i++) {
    if (reds[i] != 0) {
      return i + 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_unsignedint>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1000,-0x8(%rbp)
jge    1143 <test_unsignedint+0x43>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1116 <test_unsignedint+0x16>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1184 <test_unsignedint+0x84>
movslq -0x8(%rbp),%rax
cmpl   $0x0,-0x10(%rbp,%rax,4)
je     1171 <test_unsignedint+0x71>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    118b <test_unsignedint+0x8b>
jmp    1176 <test_unsignedint+0x76>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <test_unsignedint+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.test_unsignedint.reds = [2 x i32] [i32 4096, i32 4096]
define i32 @test_unsignedint() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
store i32 0, i32* %2
br label %5
5: ; preds = %15, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 4096
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %9
%11 = add i32 %10, -1
store i32 %11, i32* %9
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%13 = load i32, i32* %12
%14 = add i32 %13, -1
store i32 %14, i32* %12
br label %15
15: ; preds = %8
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %5
18: ; preds = %5
store i32 0, i32* %2
br label %19
19: ; preds = %32, %18
%20 = load i32, i32* %2
%21 = icmp slt i32 %20, 2
br i1 %21, label %22, label %35
22: ; preds = %19
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %1
br label %36
31: ; preds = %22
br label %32
32: ; preds = %31
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %19
35: ; preds = %19
store i32 0, i32* %1
br label %36
36: ; preds = %35, %28
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
define i32 @test_unsignedint() {
ret i32 0
}
long double fac(int n) {
  if (n == 1)
    return 1;
  else
    return n * fac(n - 1);
}


x86 assembly (clang, -O0):
<fac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    112f <fac+0x1f>
fld1
fstpt  -0x10(%rbp)
jmp    114b <fac+0x3b>
mov    -0x14(%rbp),%edi
mov    %edi,-0x18(%rbp)
fildl  -0x18(%rbp)
fstpt  -0x24(%rbp)
add    $0xffffffff,%edi
call   1030 <fac@plt>
fldt   -0x24(%rbp)
fmulp  %st,%st(1)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fac>:
fld1
cmp    $0x1,%edi
je     112e <fac+0x1e>
push   %rax
fstp   %st(0)
mov    %edi,0x4(%rsp)
add    $0xffffffff,%edi
call   1030 <fac@plt>
fimull 0x4(%rsp)
add    $0x8,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @fac(i32 %0) {
%2 = alloca x86_fp80
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store x86_fp80 0xK3FFF8000000000000000, x86_fp80* %2
br label %14
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to x86_fp80
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 1
%12 = call x86_fp80 @fac(i32 %11)
%13 = fmul x86_fp80 %9, %12
store x86_fp80 %13, x86_fp80* %2
br label %14
14: ; preds = %7, %6
%15 = load x86_fp80, x86_fp80* %2
ret x86_fp80 %15
}

LLVM IR (-O2):
define x86_fp80 @fac(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi x86_fp80 [ %9, %5 ], [ 0xK3FFF8000000000000000, %1 ]
ret x86_fp80 %4
5: ; preds = %1
%6 = sitofp i32 %0 to x86_fp80
%7 = add nsw i32 %0, -1
%8 = tail call x86_fp80 @fac(i32 %7)
%9 = fmul x86_fp80 %8, %6
br label %3
}
double fa(double x, double k) { return ((x * x) / k); }


x86 assembly (clang, -O0):
<fa>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fa>:
mulsd  %xmm0,%xmm0
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fa(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 = fmul double %5, %6
%8 = load double, double* %4
%9 = fdiv double %7, %8
ret double %9
}

LLVM IR (-O2):
define double @fa(double %0, double %1) {
%3 = fmul double %0, %0
%4 = fdiv double %3, %1
ret double %4
}
void write_reg(volatile void *reg_base, unsigned int offset,
               unsigned int data) {
  *((volatile unsigned int *)(reg_base + offset)) = data;
}


x86 assembly (clang, -O0):
<write_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %edx,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_reg>:
mov    %esi,%eax
mov    %edx,(%rdi,%rax,1)
ret

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

LLVM IR (-O2):
define void @write_reg(i8* %0, i32 %1, i32 %2) {
%4 = zext i32 %1 to i64
%5 = getelementptr i8, i8* %0, i64 %4
%6 = bitcast i8* %5 to i32*
store volatile i32 %2, i32* %6
ret void
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int wait(int *);
void sig_chld(int signo) {
  pid_t pid;
  int stat;
  printf("about to terminate the child\n");
  pid = wait(&stat);
  printf("child %d terminated \n", pid);
  return;
}


x86 assembly (clang, -O0):
<sig_chld>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1040 <wait@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_chld>:
push   %rax
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rdi
call   1050 <wait@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [30 x i8] c"about to terminate the child\0A\00"
@.str.1 = [22 x i8] c"child %d terminated \0A\00"
define void @sig_chld(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @wait(i32* %4)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"child %d terminated \0A\00"
@str = [29 x i8] c"about to terminate the child\00"
define void @sig_chld(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%5 = call i32 @wait(i32* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret void
}
/* Variables and functions */
int exists_character(char *, int);
int timlib_character_exists(char *buffer, int c) {
  return exists_character(buffer, c);
}


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

x86 assembly (clang, -O2):
<timlib_character_exists>:
jmp    1030 <exists_character@plt>

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

LLVM IR (-O2):
define i32 @timlib_character_exists(i8* %0, i32 %1) {
%3 = tail call i32 @exists_character(i8* %0, i32 %1)
ret i32 %3
}
void handle_ABRT(int sig) {}


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

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

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

LLVM IR (-O2):
define void @handle_ABRT(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ addstr(char const *);
void console_write(const char *str) { addstr(str); }


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

x86 assembly (clang, -O2):
<console_write>:
jmp    1030 <addstr@plt>

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

LLVM IR (-O2):
define void @console_write(i8* %0) {
%2 = tail call i32 @addstr(i8* %0)
ret void
}
/* Type definitions */
struct slPair {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ slPairFreeList(struct slPair **);
int /*<<< orphan*/ slPairFreeVals(struct slPair *);
void slPairFreeValsAndList(struct slPair **pList) {
  slPairFreeVals(*pList);
  slPairFreeList(pList);
}


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

x86 assembly (clang, -O2):
<slPairFreeValsAndList>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1040 <slPairFreeVals@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <slPairFreeList@plt>

LLVM IR (-O0):
%struct.slPair = type { i32 }
define void @slPairFreeValsAndList(%struct.slPair** %0) {
%2 = alloca %struct.slPair**
store %struct.slPair** %0, %struct.slPair*** %2
%3 = load %struct.slPair**, %struct.slPair*** %2
%4 = load %struct.slPair*, %struct.slPair** %3
%5 = call i32 @slPairFreeVals(%struct.slPair* %4)
%6 = load %struct.slPair**, %struct.slPair*** %2
%7 = call i32 @slPairFreeList(%struct.slPair** %6)
ret void
}

LLVM IR (-O2):
%struct.slPair = type { i32 }
define void @slPairFreeValsAndList(%struct.slPair** %0) {
%2 = load %struct.slPair*, %struct.slPair** %0
%3 = tail call i32 @slPairFreeVals(%struct.slPair* %2)
%4 = tail call i32 @slPairFreeList(%struct.slPair** %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int x = 10;
  printf("Hello!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%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 = [8 x i8] c"Hello!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"Hello!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 0
}
long long zusz() { return 0x00007fffffff0000LL; }


x86 assembly (clang, -O0):
<zusz>:
push   %rbp
mov    %rsp,%rbp
movabs $0x7fffffff0000,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zusz>:
movabs $0x7fffffff0000,%rax
ret

LLVM IR (-O0):
define i64 @zusz() {
ret i64 140737488289792
}

LLVM IR (-O2):
define i64 @zusz() {
ret i64 140737488289792
}
int compare_int(const void *a, const void *b) {
  const int *da = (const int *)a;
  const int *db = (const int *)b;
  return (*da > *db) - (*da < *db);
}


x86 assembly (clang, -O0):
<compare_int>:
push   %rbp
mov    %rsp,%rbp
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),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
mov    -0x20(%rbp),%rdx
cmp    (%rdx),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_int>:
mov    (%rdi),%ecx
xor    %eax,%eax
xor    %edx,%edx
cmp    (%rsi),%ecx
setg   %al
setl   %dl
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @compare_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = icmp sgt i32 %12, %14
%16 = zext i1 %15 to i32
%17 = load i32*, i32** %5
%18 = load i32, i32* %17
%19 = load i32*, i32** %6
%20 = load i32, i32* %19
%21 = icmp slt i32 %18, %20
%22 = zext i1 %21 to i32
%23 = sub nsw i32 %16, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @compare_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i32
%9 = icmp slt i32 %5, %6
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
void stopMonitoringConsoleBell(void) {}


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

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

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

LLVM IR (-O2):
define void @stopMonitoringConsoleBell() {
ret void
}
int find_first_clear(unsigned x) {
  int i;
  if (x == -1)
    return -1;
  i = 0;
  while (1) {
    if (!((1 << i) & x))
      return i;
    i++;
  }
}


x86 assembly (clang, -O0):
<find_first_clear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    111d <find_first_clear+0x1d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1153 <find_first_clear+0x53>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
and    -0x8(%rbp),%eax
cmp    $0x0,%eax
jne    1145 <find_first_clear+0x45>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <find_first_clear+0x53>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <find_first_clear+0x24>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_first_clear>:
mov    $0xffffffff,%eax
cmp    $0xffffffff,%edi
je     1118 <find_first_clear+0x18>
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
bt     %eax,%edi
jb     1110 <find_first_clear+0x10>
ret

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

LLVM IR (-O2):
define i32 @find_first_clear(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = shl nuw i32 1, %4
%6 = and i32 %5, %0
%7 = icmp eq i32 %6, 0
%8 = add nuw nsw i32 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ -1, %1 ], [ %4, %3 ]
ret i32 %10
}
void interrupts_enable(void) { asm volatile("sti\n\t"); }


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

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

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

LLVM IR (-O2):
define void @interrupts_enable() {
tail call void asm sideeffect "sti\0A\09", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char, char, char, char);
int main() {
  char c1 = 'C';
  char c2 = 'h';
  char c3 = 'i';
  char c4 = 'n';
  char c5 = 'a';
  c1 = c1 + 4;
  c2 = c2 + 4;
  c3 = c3 + 4;
  c4 = c4 + 4;
  c5 = c5 + 4;
  printf("%c%c%c%c%c\n", c1, c2, c3, c4, c5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x43,-0x5(%rbp)
movb   $0x68,-0x6(%rbp)
movb   $0x69,-0x7(%rbp)
movb   $0x6e,-0x8(%rbp)
movb   $0x61,-0x9(%rbp)
movsbl -0x5(%rbp),%eax
add    $0x4,%eax
mov    %al,-0x5(%rbp)
movsbl -0x6(%rbp),%eax
add    $0x4,%eax
mov    %al,-0x6(%rbp)
movsbl -0x7(%rbp),%eax
add    $0x4,%eax
mov    %al,-0x7(%rbp)
movsbl -0x8(%rbp),%eax
add    $0x4,%eax
mov    %al,-0x8(%rbp)
movsbl -0x9(%rbp),%eax
add    $0x4,%eax
mov    %al,-0x9(%rbp)
mov    -0x5(%rbp),%sil
mov    -0x6(%rbp),%dl
mov    -0x7(%rbp),%cl
mov    -0x8(%rbp),%al
lea    0xe87(%rip),%rdi
movsbl %sil,%esi
movsbl %dl,%edx
movsbl %cl,%ecx
movsbl %al,%r8d
movsbl -0x9(%rbp),%r9d
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x47,%esi
mov    $0x6c,%edx
mov    $0x6d,%ecx
mov    $0x72,%r8d
mov    $0x65,%r9d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%c%c%c%c%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i32 0, i32* %1
store i8 67, i8* %2
store i8 104, i8* %3
store i8 105, i8* %4
store i8 110, i8* %5
store i8 97, i8* %6
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = add nsw i32 %8, 4
%10 = trunc i32 %9 to i8
store i8 %10, i8* %2
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, 4
%14 = trunc i32 %13 to i8
store i8 %14, i8* %3
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = add nsw i32 %16, 4
%18 = trunc i32 %17 to i8
store i8 %18, i8* %4
%19 = load i8, i8* %5
%20 = sext i8 %19 to i32
%21 = add nsw i32 %20, 4
%22 = trunc i32 %21 to i8
store i8 %22, i8* %5
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = add nsw i32 %24, 4
%26 = trunc i32 %25 to i8
store i8 %26, i8* %6
%27 = load i8, i8* %2
%28 = load i8, i8* %3
%29 = load i8, i8* %4
%30 = load i8, i8* %5
%31 = load i8, i8* %6
%32 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 signext %27, i8 signext %28, i8 signext %29, i8 signext %30, i8 signext %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"%c%c%c%c%c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 signext 71, i8 signext 108, i8 signext 109, i8 signext 114, i8 signext 101)
ret i32 0
}
int main() {
  int a = 6;
  for (a = 0; a < 6; ++a) {
  }
  if (a == 6) {
  ERROR:
    goto ERROR;
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x6,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    1136 <main+0x36>
jmp    1128 <main+0x28>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
cmpl   $0x6,-0x8(%rbp)
jne    114a <main+0x4a>
jmp    1145 <main+0x45>
jmp    1145 <main+0x45>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int getpid();
int disp_get_core_id(void) { return getpid(); }


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

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

LLVM IR (-O0):
define i32 @disp_get_core_id() {
%1 = call i32 (...) @getpid()
ret i32 %1
}

LLVM IR (-O2):
define i32 @disp_get_core_id() {
%1 = tail call i32 (...) @getpid()
ret i32 %1
}
int fib_recursion(int n) {
  int ret = 0;
  if (n == 0) {
    ret = 0;
  } else if (n == 1) {
    ret = 1;
  } else {
    ret = fib_recursion(n - 1) + fib_recursion(n - 2);
  }
  return ret;
}


x86 assembly (clang, -O0):
<fib_recursion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1138 <fib_recursion+0x28>
movl   $0x0,-0x8(%rbp)
jmp    1176 <fib_recursion+0x66>
cmpl   $0x1,-0x4(%rbp)
jne    114e <fib_recursion+0x3e>
movl   $0x1,-0x8(%rbp)
jmp    1171 <fib_recursion+0x61>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib_recursion@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib_recursion@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    1176 <fib_recursion+0x66>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib_recursion>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%ebx
jb     1132 <fib_recursion+0x22>
nopl   0x0(%rax)
lea    -0x1(%rbx),%edi
call   1030 <fib_recursion@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
cmp    $0x2,%ebx
jae    1120 <fib_recursion+0x10>
add    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib_recursion(i32 %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i32 [ 0, %1 ], [ %10, %6 ]
%4 = phi i32 [ %0, %1 ], [ %9, %6 ]
%5 = icmp ult i32 %4, 2
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = add nsw i32 %4, -1
%8 = tail call i32 @fib_recursion(i32 %7)
%9 = add nsw i32 %4, -2
%10 = add nsw i32 %8, %3
br label %2
11: ; preds = %2
%12 = add nsw i32 %4, %3
ret i32 %12
}
/* Variables and functions */
int parse_ff(char **, scalar_t__);
scalar_t__ strcspn(char *, char *);
int parse_ff_past(char **buf, char *accept) {
  return parse_ff(buf, strcspn(*buf, accept) + 1);
}


x86 assembly (clang, -O0):
<parse_ff_past>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcspn@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
call   1030 <parse_ff@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_ff_past>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1040 <strcspn@plt>
lea    0x1(%rax),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <parse_ff@plt>

LLVM IR (-O0):
define i32 @parse_ff_past(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 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = call i64 @strcspn(i8* %7, i8* %8)
%10 = add nsw i64 %9, 1
%11 = call i32 @parse_ff(i8** %5, i64 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @parse_ff_past(i8** %0, i8* nocapture %1) {
%3 = load i8*, i8** %0
%4 = tail call i64 @strcspn(i8* %3, i8* %1)
%5 = add nsw i64 %4, 1
%6 = tail call i32 @parse_ff(i8** %0, i64 %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ __assert_int_equals(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ parse_long(char *);
void test_parse_bytes(void) {
  __assert_int_equals("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/headius/jato/refs/"
                      "heads/master/test/unit/vm/parse-test.c",
                      13, (32), (parse_long("32")));
}


x86 assembly (clang, -O0):
<test_parse_bytes>:
push   %rbp
mov    %rsp,%rbp
lea    0xf68(%rip),%rdi
call   1030 <parse_long@plt>
mov    %eax,%ecx
lea    0xec7(%rip),%rdi
mov    $0xd,%esi
mov    $0x20,%edx
call   1040 <__assert_int_equals@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_parse_bytes>:
push   %rax
lea    0xf6b(%rip),%rdi
call   1030 <parse_long@plt>
lea    0xecc(%rip),%rdi
mov    $0xd,%esi
mov    $0x20,%edx
mov    %eax,%ecx
pop    %rax
jmp    1040 <__assert_int_equals@plt>

LLVM IR (-O0):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/headius/jato/refs/heads/master/test/unit/vm/parse-test.c\00"
@.str.1 = [3 x i8] c"32\00"
define void @test_parse_bytes() {
%1 = call i32 @parse_long(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @__assert_int_equals(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 13, i32 32, i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/headius/jato/refs/heads/master/test/unit/vm/parse-test.c\00"
@.str.1 = [3 x i8] c"32\00"
define void @test_parse_bytes() {
%1 = tail call i32 @parse_long(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @__assert_int_equals(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 13, i32 32, i32 %1)
ret void
}
unsigned int be_int(unsigned int i) {
  unsigned int ret = i;
  ret = i >> 24;
  ret += (i >> 8) & 0x0000ff00;
  ret += (i << 8) & 0x00ff0000;
  ret += (i << 24);
  return ret;
}


x86 assembly (clang, -O0):
<be_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x18,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff00,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
and    $0xff0000,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x18,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @be_int(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %2
%6 = lshr i32 %5, 24
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = lshr i32 %7, 8
%9 = and i32 %8, 65280
%10 = load i32, i32* %3
%11 = add i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = shl i32 %12, 8
%14 = and i32 %13, 16711680
%15 = load i32, i32* %3
%16 = add i32 %15, %14
store i32 %16, i32* %3
%17 = load i32, i32* %2
%18 = shl i32 %17, 24
%19 = load i32, i32* %3
%20 = add i32 %19, %18
store i32 %20, i32* %3
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @be_int(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ foo(int *, int *);
int main(void) {
  int a = 0;
  int b = 0;
  foo(&a, &b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @foo(i32* %1, i32* %2)
ret i32 0
}
void roadmap_open_help(void) {}


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

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

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

LLVM IR (-O2):
define void @roadmap_open_help() {
ret void
}
int is_escaped_char(char c) {
  char charesc[] = {'>', '<', '&', '\"', '\''};
  int i, n = 5;
  for (i = 0; i < n; i++) {
    if (c == charesc[i])
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_escaped_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    0xef0(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xeeb(%rip),%al
mov    %al,-0x6(%rbp)
movl   $0x5,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    116a <is_escaped_char+0x6a>
movsbl -0x5(%rbp),%eax
movslq -0x10(%rbp),%rcx
movsbl -0xa(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    1157 <is_escaped_char+0x57>
movl   $0x1,-0x4(%rbp)
jmp    1171 <is_escaped_char+0x71>
jmp    115c <is_escaped_char+0x5c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112a <is_escaped_char+0x2a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_escaped_char>:
cmp    $0x3e,%dil
ja     1120 <is_escaped_char+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x500000c400000000,%rdx
bt     %rcx,%rdx
jae    1120 <is_escaped_char+0x20>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@__const.is_escaped_char.charesc = [5 x i8] c"><&\22'"
define i32 @is_escaped_char(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca [5 x i8]
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %3
%7 = bitcast [5 x i8]* %4 to i8*
store i32 5, i32* %6
store i32 0, i32* %5
br label %8
8: ; preds = %23, %1
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %14, %19
br i1 %20, label %21, label %22
21: ; preds = %12
store i32 1, i32* %2
br label %27
22: ; preds = %12
br label %23
23: ; preds = %22
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %8
26: ; preds = %8
store i32 0, i32* %2
br label %27
27: ; preds = %26, %21
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @is_escaped_char(i8 signext %0) {
switch i8 %0, label %2 [
i8 62, label %3
i8 60, label %3
i8 38, label %3
i8 34, label %3
i8 39, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 1, %1 ], [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void __cxa_pure_virtual() { fprintf(stderr, "pure virtual called\n"); }


x86 assembly (clang, -O0):
<__cxa_pure_virtual>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__cxa_pure_virtual>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"pure virtual called\0A\00"
define void @__cxa_pure_virtual() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"pure virtual called\0A\00"
define void @__cxa_pure_virtual() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "syntax: psxdump -d <device> -f <output file>\n\n"
                  "  -d <device>       give device name\n"
                  "  -f <output file>  file to put track dump\n"
                  "  -F                force the program to proceed even if "
                  "it's not a PSX disk\n"
                  "  -T                test type of disc (PSX or non) and "
                  "report it as exit code\n"
                  "  -h                display this banner :-)\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [326 x i8] c"syntax: psxdump -d <device> -f <output file>\0A\0A -d <device> give device name\0A -f <output file> file to put track dump\0A -F force the program to proceed even if it's not a PSX disk\0A -T test type of disc (PSX or non) and report it as exit code\0A -h display this banner :-)\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([326 x i8], [326 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [326 x i8] c"syntax: psxdump -d <device> -f <output file>\0A\0A -d <device> give device name\0A -f <output file> file to put track dump\0A -F force the program to proceed even if it's not a PSX disk\0A -T test type of disc (PSX or non) and report it as exit code\0A -h display this banner :-)\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([326 x i8], [326 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tubeCmd(int, unsigned char, unsigned char);
void tubeWrite(unsigned char addr, unsigned char byte) {
  tubeCmd(0x80, addr, byte);
}


x86 assembly (clang, -O0):
<tubeWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
mov    $0x80,%edi
movzbl %al,%esi
movzbl -0x2(%rbp),%edx
call   1030 <tubeCmd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tubeWrite>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0x80,%edi
jmp    1030 <tubeCmd@plt>

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

LLVM IR (-O2):
define void @tubeWrite(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call i32 @tubeCmd(i32 128, i8 zeroext %0, i8 zeroext %1)
ret void
}
/* Variables and functions */
int elf_interp(int, int /*<<< orphan*/, char *);
int elf_get_interp(int fd, char *interp) { return elf_interp(fd, 0, interp); }


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

x86 assembly (clang, -O2):
<elf_get_interp>:
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <elf_interp@plt>

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

LLVM IR (-O2):
define i32 @elf_get_interp(i32 %0, i8* %1) {
%3 = tail call i32 @elf_interp(i32 %0, i32 0, i8* %1)
ret i32 %3
}
void omap_setup_dss_device(struct platform_device *pdev) {}


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

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

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

LLVM IR (-O2):
%struct.platform_device = type opaque
define void @omap_setup_dss_device(%struct.platform_device* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ alloca(int);
int /*<<< orphan*/ test11a(char *);
void __attribute__((no)) __attribute__((noclone)) test11(void) {
  char *save = (char *)alloca(4);
  test11a(save);
}


x86 assembly (clang, -O0):
<test11>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <alloca@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <test11a@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test11>:
push   %rax
mov    $0x4,%edi
call   1040 <alloca@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <test11a@plt>

LLVM IR (-O0):
define void @test11() {
%1 = alloca i8*
%2 = call i64 @alloca(i32 4)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @test11a(i8* %4)
ret void
}

LLVM IR (-O2):
define void @test11() {
%1 = tail call i64 @alloca(i32 4)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @test11a(i8* %2)
ret void
}
int mod(int a, int n) {
  return a >= n ? a % n : a >= 0 ? a : n - 1 - (-1 - a) % n;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1125 <mod+0x25>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
jmp    115d <mod+0x5d>
cmpl   $0x0,-0x4(%rbp)
jl     113a <mod+0x3a>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1157 <mod+0x57>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0xffffffff,%eax
sub    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    -0x14(%rbp),%eax
sub    %edx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod>:
mov    %edi,%eax
cmp    %esi,%edi
jge    110b <mod+0xb>
test   %eax,%eax
js     1111 <mod+0x11>
ret
cltd
idiv   %esi
mov    %edx,%eax
ret
not    %eax
cltd
idiv   %esi
mov    %edx,%eax
not    %eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @mod(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 sge i32 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = srem i32 %9, %10
br label %27
12: ; preds = %2
%13 = load i32, i32* %3
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = load i32, i32* %3
br label %25
17: ; preds = %12
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
%20 = load i32, i32* %3
%21 = sub nsw i32 -1, %20
%22 = load i32, i32* %4
%23 = srem i32 %21, %22
%24 = sub nsw i32 %19, %23
br label %25
25: ; preds = %17, %15
%26 = phi i32 [ %16, %15 ], [ %24, %17 ]
br label %27
27: ; preds = %25, %8
%28 = phi i32 [ %11, %8 ], [ %26, %25 ]
ret i32 %28
}

LLVM IR (-O2):
define i32 @mod(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = srem i32 %0, %1
br label %13
6: ; preds = %2
%7 = icmp sgt i32 %0, -1
br i1 %7, label %13, label %8
8: ; preds = %6
%9 = xor i32 %0, -1
%10 = srem i32 %9, %1
%11 = xor i32 %10, -1
%12 = add i32 %11, %1
br label %13
13: ; preds = %6, %8, %4
%14 = phi i32 [ %5, %4 ], [ %12, %8 ], [ %0, %6 ]
ret i32 %14
}