xunge/DecIR huggingface dataset:
/* Variables and functions */
int rit_var_unset(char *);
int rm(char *path) {
  if (path == NULL)
    return 1;
  return rit_var_unset(path);
}


x86 assembly (clang, -O0):
<rm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <rm+0x23>
movl   $0x1,-0x4(%rbp)
jmp    113f <rm+0x2f>
mov    -0x10(%rbp),%rdi
call   1030 <rit_var_unset@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rm>:
test   %rdi,%rdi
je     111a <rm+0xa>
jmp    1030 <rit_var_unset@plt>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @rm(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @rit_var_unset(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 1, %1 ]
ret i32 %6
}
float ave(float (*p)[5]) {
  int i;
  float sum;
  for (i = 0; i < 4; i++) {
    sum += **(p + i);
  }
  return sum / 4;
}


x86 assembly (clang, -O0):
<ave>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1144 <ave+0x44>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movss  (%rax),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <ave+0xf>
movss  -0x10(%rbp),%xmm0
movss  0xeaf(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ave>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @ave([5 x float]* %0) {
%2 = alloca [5 x float]*
%3 = alloca i32
%4 = alloca float
store [5 x float]* %0, [5 x float]** %2
store i32 0, i32* %3
br label %5
5: ; preds = %17, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 4
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load [5 x float]*, [5 x float]** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [5 x float], [5 x float]* %9, i64 %11
%13 = getelementptr inbounds [5 x float], [5 x float]* %12, i64 0, i64 0
%14 = load float, float* %13
%15 = load float, float* %4
%16 = fadd float %15, %14
store float %16, float* %4
br label %17
17: ; preds = %8
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
%21 = load float, float* %4
%22 = fdiv float %21, 4.000000e+00
ret float %22
}

LLVM IR (-O2):
define float @ave([5 x float]* nocapture %0) {
ret float 0x7FF8000000000000
}
/* Variables and functions */
int /*<<< orphan*/ doublebuffer();
void double_() { doublebuffer(); }


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

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

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

LLVM IR (-O2):
define void @double_() {
%1 = tail call i32 (...) @doublebuffer()
ret void
}
int ap_sum(int num) { return (1 + num) * num / 2; }


x86 assembly (clang, -O0):
<ap_sum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
imul   -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ap_sum>:
lea    0x1(%rdi),%ecx
imul   %edi,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @ap_sum(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = mul nsw i32 %2, %0
%4 = sdiv i32 %3, 2
ret i32 %4
}
/* Variables and functions */
void IN_Init(void) {}


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

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

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

LLVM IR (-O2):
define void @IN_Init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SelectionSort();
int /*<<< orphan*/ assert(int);
int main(void) {
  int array[5], i;
  for (i = 5 - 1; i >= 0; i--)
    array[i] = i;
  SelectionSort();
  for (i = 0; i < 5; i++)
    assert(array[i] != i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     1159 <main+0x39>
mov    -0x24(%rbp),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1136 <main+0x16>
mov    $0x0,%al
call   1030 <SelectionSort@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1197 <main+0x77>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
cmp    -0x24(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1167 <main+0x47>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %3
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %10
store i32 %8, i32* %11
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 = call i32 (...) @SelectionSort()
store i32 0, i32* %3
br label %17
17: ; preds = %29, %15
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 5
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = load i32, i32* %3
%26 = icmp ne i32 %24, %25
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
br label %29
29: ; preds = %20
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %17
32: ; preds = %17
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @SelectionSort()
%2 = tail call i32 @assert(i32 0)
%3 = tail call i32 @assert(i32 0)
%4 = tail call i32 @assert(i32 0)
%5 = tail call i32 @assert(i32 0)
%6 = tail call i32 @assert(i32 0)
ret i32 0
}
int B(int x) { return x - (x << 3); }


x86 assembly (clang, -O0):
<B>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x3,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<B>:
mov    %edi,%eax
lea    0x0(,%rax,8),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @B(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = shl i32 %4, 3
%6 = sub nsw i32 %3, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @B(i32 %0) {
%2 = mul i32 %0, -7
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ INT_MAX;
int vsnprintf(char *, int /*<<< orphan*/, char const *, int /*<<< orphan*/);
int vsprintf(char *buf, const char *fmt, va_list args) {
  return vsnprintf(buf, INT_MAX, fmt, args);
}


x86 assembly (clang, -O0):
<vsprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eba(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <vsnprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vsprintf>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    0x2ecc(%rip),%rax
mov    (%rax),%esi
jmp    1030 <vsnprintf@plt>

LLVM IR (-O0):
@INT_MAX = global i32 0
define i32 @vsprintf(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* @INT_MAX
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @vsnprintf(i8* %7, i32 %8, i8* %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define i32 @vsprintf(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = load i32, i32* @INT_MAX
%5 = tail call i32 @vsnprintf(i8* %0, i32 %4, i8* %1, i32 %2)
ret i32 %5
}
void exchange_num(int *one, int *two) {
  int tmp;
  tmp = *two;
  *two = *one;
  *one = tmp;
}


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

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

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

LLVM IR (-O2):
define void @exchange_num(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = load i32, i32* %0
store i32 %4, i32* %1
store i32 %3, i32* %0
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t convertLedNumberToBit(uint8_t NLed) { return 1 << (NLed - 1); }


x86 assembly (clang, -O0):
<convertLedNumberToBit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertLedNumberToBit>:
lea    -0x1(%rdi),%ecx
mov    $0x1,%eax
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @convertLedNumberToBit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
%5 = shl i32 1, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @convertLedNumberToBit(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = shl nuw i32 1, %2
ret i32 %3
}
/* Type definitions */
typedef int volatile uint16_t;

/* Variables and functions */
void reg16_write_masked(volatile uint16_t *reg, uint16_t mask, uint16_t value) {
  *reg = (*reg & (~mask)) | (value & mask);
}


x86 assembly (clang, -O0):
<reg16_write_masked>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
and    %eax,%ecx
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%edx
and    %edx,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg16_write_masked>:
mov    %esi,-0x8(%rsp)
mov    %edx,-0x4(%rsp)
mov    (%rdi),%eax
mov    -0x8(%rsp),%ecx
not    %ecx
and    %eax,%ecx
mov    -0x4(%rsp),%eax
and    -0x8(%rsp),%eax
or     %ecx,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @reg16_write_masked(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store volatile i32 %1, i32* %5
store volatile i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load volatile i32, i32* %7
%9 = load volatile i32, i32* %5
%10 = xor i32 %9, -1
%11 = and i32 %8, %10
%12 = load volatile i32, i32* %6
%13 = load volatile i32, i32* %5
%14 = and i32 %12, %13
%15 = or i32 %11, %14
%16 = load i32*, i32** %4
store volatile i32 %15, i32* %16
ret void
}

LLVM IR (-O2):
define void @reg16_write_masked(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
store volatile i32 %1, i32* %4
store volatile i32 %2, i32* %5
%6 = load volatile i32, i32* %0
%7 = load volatile i32, i32* %4
%8 = xor i32 %7, -1
%9 = and i32 %6, %8
%10 = load volatile i32, i32* %5
%11 = load volatile i32, i32* %4
%12 = and i32 %11, %10
%13 = or i32 %12, %9
store volatile i32 %13, i32* %0
ret void
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
__attribute__((always_)) uint64_t max_uint64_t(uint64_t a, uint64_t b) {
  return a > b ? a : b;
}


x86 assembly (clang, -O0):
<max_uint64_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <max_uint64_t+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <max_uint64_t+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_uint64_t>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @max_uint64_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 sgt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @max_uint64_t(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
void glutCreateWindow(const char *str) {}


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

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

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

LLVM IR (-O2):
define void @glutCreateWindow(i8* nocapture %0) {
ret void
}
void CRYPTO_get_locking_callback(void) {}


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

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

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

LLVM IR (-O2):
define void @CRYPTO_get_locking_callback() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cache_wait(int, int);
void cache_sync_rel(void) {
  (*((volatile unsigned *)(0xF4200000 + 0x730)) = 0);
  cache_wait((0xF4200000 + 0x730), 1);
}


x86 assembly (clang, -O0):
<cache_sync_rel>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf4200730,%eax
movl   $0x0,(%rax)
mov    $0xf4200730,%edi
mov    $0x1,%esi
call   1030 <cache_wait@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cache_sync_rel>:
mov    $0xf4200730,%eax
movl   $0x0,(%rax)
mov    $0xf4200730,%edi
mov    $0x1,%esi
jmp    1030 <cache_wait@plt>

LLVM IR (-O0):
define void @cache_sync_rel() {
store volatile i32 0, i32* inttoptr (i64 4095739696 to i32*)
%1 = call i32 @cache_wait(i32 -199227600, i32 1)
ret void
}

LLVM IR (-O2):
define void @cache_sync_rel() {
store volatile i32 0, i32* inttoptr (i64 4095739696 to i32*)
%1 = tail call i32 @cache_wait(i32 -199227600, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ japi_replacetext(int, char *, int, int);
void j_replacetext(int arg0, char *arg1, int arg2, int arg3) {
  japi_replacetext(arg0, arg1, arg2, arg3);
}


x86 assembly (clang, -O0):
<j_replacetext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <japi_replacetext@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j_replacetext>:
jmp    1030 <japi_replacetext@plt>

LLVM IR (-O0):
define void @j_replacetext(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @japi_replacetext(i32 %9, i8* %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @j_replacetext(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @japi_replacetext(i32 %0, i8* %1, i32 %2, i32 %3)
ret void
}
unsigned short int f70(unsigned short int x, unsigned long int y) {
  return (x << y) + (x >> ((-y) & (8 * 2 - 1)));
}


x86 assembly (clang, -O0):
<f70>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
mov    -0x10(%rbp),%rcx
shl    %cl,%eax
movzwl -0x2(%rbp),%edx
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    $0xf,%rcx
sar    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f70>:
mov    %rsi,%rcx
mov    %edi,%eax
shl    %cl,%eax
neg    %cl
and    $0xf,%cl
shr    %cl,%edi
add    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @f70(i16 zeroext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = shl i32 %6, %8
%10 = load i16, i16* %3
%11 = zext i16 %10 to i32
%12 = load i64, i64* %4
%13 = sub i64 0, %12
%14 = and i64 %13, 15
%15 = trunc i64 %14 to i32
%16 = ashr i32 %11, %15
%17 = add nsw i32 %9, %16
%18 = trunc i32 %17 to i16
ret i16 %18
}

LLVM IR (-O2):
define zeroext i16 @f70(i16 zeroext %0, i64 %1) {
%3 = zext i16 %0 to i32
%4 = trunc i64 %1 to i32
%5 = shl i32 %3, %4
%6 = sub i32 0, %4
%7 = and i32 %6, 15
%8 = lshr i32 %3, %7
%9 = add nsw i32 %8, %5
%10 = trunc i32 %9 to i16
ret i16 %10
}
/* Type definitions */
struct Chabu_Data {
  int dummy;
};
struct Chabu_Channel_Data {
  int dummy;
};

/* Variables and functions */
struct Chabu_Channel_Data *popNextRequest(struct Chabu_Data *, int);
struct Chabu_Channel_Data *
Chabu_Priority_PopNextRequestCtrl(struct Chabu_Data *chabu) {
  return popNextRequest(chabu, 1);
}


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

x86 assembly (clang, -O2):
<Chabu_Priority_PopNextRequestCtrl>:
mov    $0x1,%esi
jmp    1030 <popNextRequest@plt>

LLVM IR (-O0):
%struct.Chabu_Channel_Data = type { i32 }
%struct.Chabu_Data = type { i32 }
define %struct.Chabu_Channel_Data* @Chabu_Priority_PopNextRequestCtrl(%struct.Chabu_Data* %0) {
%2 = alloca %struct.Chabu_Data*
store %struct.Chabu_Data* %0, %struct.Chabu_Data** %2
%3 = load %struct.Chabu_Data*, %struct.Chabu_Data** %2
%4 = call %struct.Chabu_Channel_Data* @popNextRequest(%struct.Chabu_Data* %3, i32 1)
ret %struct.Chabu_Channel_Data* %4
}

LLVM IR (-O2):
%struct.Chabu_Channel_Data = type { i32 }
%struct.Chabu_Data = type { i32 }
define %struct.Chabu_Channel_Data* @Chabu_Priority_PopNextRequestCtrl(%struct.Chabu_Data* %0) {
%2 = tail call %struct.Chabu_Channel_Data* @popNextRequest(%struct.Chabu_Data* %0, i32 1)
ret %struct.Chabu_Channel_Data* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 10, b = 1;
  while (a > 0) {
    b *= a;
    a--;
  }
  printf("%d", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    114f <main+0x3f>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xea7(%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
mov    $0x375f00,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 3628800)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ say_hi();
void say_hi_a(void) { say_hi(); }


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

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

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

LLVM IR (-O2):
define void @say_hi_a() {
%1 = tail call i32 (...) @say_hi()
ret void
}
int pivot(int *A, int f, int l) { return A[l]; }


x86 assembly (clang, -O0):
<pivot>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pivot>:
movslq %edx,%rax
mov    (%rdi,%rax,4),%eax
ret

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

LLVM IR (-O2):
define i32 @pivot(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}
/* Variables and functions */
double log(double);
double ustar_func(double K, double u, double Zu, double d0m, double z0m,
                  double Psim) {
  double ustar;
  ustar = K * u / (log((Zu - d0m) / z0m) - Psim);
  return (ustar);
}


x86 assembly (clang, -O0):
<ustar_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ustar_func>:
sub    $0x18,%rsp
movsd  %xmm5,0x10(%rsp)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
subsd  %xmm3,%xmm2
divsd  %xmm4,%xmm2
movapd %xmm2,%xmm0
call   1030 <log@plt>
subsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @ustar_func(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%14 = load double, double* %7
%15 = load double, double* %8
%16 = fmul double %14, %15
%17 = load double, double* %9
%18 = load double, double* %10
%19 = fsub double %17, %18
%20 = load double, double* %11
%21 = fdiv double %19, %20
%22 = call double @log(double %21)
%23 = load double, double* %12
%24 = fsub double %22, %23
%25 = fdiv double %16, %24
store double %25, double* %13
%26 = load double, double* %13
ret double %26
}

LLVM IR (-O2):
define double @ustar_func(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fmul double %0, %1
%8 = fsub double %2, %3
%9 = fdiv double %8, %4
%10 = tail call double @log(double %9)
%11 = fsub double %10, %5
%12 = fdiv double %7, %11
ret double %12
}
float s2f(s)
int s;
{ return s; }


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

x86 assembly (clang, -O2):
<s2f>:
cvtsi2ss %edi,%xmm0
ret

LLVM IR (-O0):
define float @s2f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to float
ret float %4
}

LLVM IR (-O2):
define float @s2f(i32 %0) {
%2 = sitofp i32 %0 to float
ret float %2
}
void myarbitrary(leng, mess) int leng;
char *mess;
{
  prtime();
  printf("Arb", leng);
  prhex(mess, leng);
}


x86 assembly (clang, -O0):
<myarbitrary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <prtime@plt>
mov    -0x4(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x0,%al
call   1040 <prhex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myarbitrary>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <prtime@plt>
lea    0xeba(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <prhex@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"Arb\00"
define void @myarbitrary(i32 %0, i8* %1) {
%3 = tail call i32 (...) @prtime()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @prhex to i32 (i8*, i32, ...)*)(i8* %1, i32 %0)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t clamp_8bit(int val) {
  if (val > 255)
    return 255;
  if (val < 0)
    return 0;
  return (uint8_t)val;
}


x86 assembly (clang, -O0):
<clamp_8bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jle    1120 <clamp_8bit+0x20>
movl   $0xff,-0x4(%rbp)
jmp    113c <clamp_8bit+0x3c>
cmpl   $0x0,-0x8(%rbp)
jge    1136 <clamp_8bit+0x36>
movl   $0x0,-0x4(%rbp)
jmp    113c <clamp_8bit+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp_8bit>:
xor    %ecx,%ecx
test   %edi,%edi
cmovns %edi,%ecx
cmp    $0xff,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @clamp_8bit(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
%4 = icmp ult i32 %3, 255
%5 = select i1 %4, i32 %3, i32 255
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *name) {
  fprintf(stderr,
          "Usage: %s [-v] [-l]\n\n"
          "Where:\n"
          "\t-v be verbose\n"
          "\t-vv be more verbose\n"
          "\t-vvv Even more verbose\n"
          "\t-l Log statistics in a CSV file\n"
          "\n",
          name);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
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    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [123 x i8] c"Usage: %s [-v] [-l]\0A\0AWhere:\0A\09-v be verbose\0A\09-vv be more verbose\0A\09-vvv Even more verbose\0A\09-l Log statistics in a CSV file\0A\0A\00"
define void @usage(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 ([123 x i8], [123 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [123 x i8] c"Usage: %s [-v] [-l]\0A\0AWhere:\0A\09-v be verbose\0A\09-vv be more verbose\0A\09-vvv Even more verbose\0A\09-l Log statistics in a CSV file\0A\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([123 x i8], [123 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
long double __q_asind(long double *);
long double intr_wrap_013(long double p1) { return __q_asind(&p1); }


x86 assembly (clang, -O0):
<intr_wrap_013>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <__q_asind@plt>
fld    %st(0)
fstp   %st(0)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_013>:
sub    $0x18,%rsp
fldt   0x20(%rsp)
fstpt  (%rsp)
mov    %rsp,%rdi
call   1030 <__q_asind@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @intr_wrap_013(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = call x86_fp80 @__q_asind(x86_fp80* %2)
ret x86_fp80 %3
}

LLVM IR (-O2):
define x86_fp80 @intr_wrap_013(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = call x86_fp80 @__q_asind(x86_fp80* %2)
ret x86_fp80 %3
}
int min(int x, int y) {
  int z;
  if (x < y)
    z = x;
  else
    z = y;
  return (z);
}


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

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

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

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ nocc_pinternal(char *, char *, int);
void *occampi_bool_hook(int /*<<< orphan*/);
void *occampi_boolfalse_hook(void *zero) {
  if (zero) {
    nocc_pinternal(("occampi_boolfalse_hook(): got a non-null value!"),
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/concurrency/nocc/refs/"
                   "heads/master/frontend/occampi_lit.c",
                   540);
  }
  return occampi_bool_hook(0);
}


x86 assembly (clang, -O0):
<occampi_boolfalse_hook>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114f <occampi_boolfalse_hook+0x2f>
lea    0xec2(%rip),%rdi
lea    0xeeb(%rip),%rsi
mov    $0x21c,%edx
call   1040 <nocc_pinternal@plt>
xor    %edi,%edi
call   1030 <occampi_bool_hook@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<occampi_boolfalse_hook>:
test   %rdi,%rdi
je     1142 <occampi_boolfalse_hook+0x22>
push   %rax
lea    0xed3(%rip),%rdi
lea    0xefc(%rip),%rsi
mov    $0x21c,%edx
call   1040 <nocc_pinternal@plt>
add    $0x8,%rsp
xor    %edi,%edi
jmp    1030 <occampi_bool_hook@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"occampi_boolfalse_hook(): got a non-null value!\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/concurrency/nocc/refs/heads/master/frontend/occampi_lit.c\00"
define i8* @occampi_boolfalse_hook(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @nocc_pinternal(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 540)
br label %7
7: ; preds = %5, %1
%8 = call i8* @occampi_bool_hook(i32 0)
ret i8* %8
}

LLVM IR (-O2):
@.str = [48 x i8] c"occampi_boolfalse_hook(): got a non-null value!\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/concurrency/nocc/refs/heads/master/frontend/occampi_lit.c\00"
define i8* @occampi_boolfalse_hook(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @nocc_pinternal(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 540)
br label %5
5: ; preds = %3, %1
%6 = tail call i8* @occampi_bool_hook(i32 0)
ret i8* %6
}
unsigned int uintFindMaxHex(unsigned short i) {
  unsigned int b;
  for (b = 16; i > 1; i--)
    b *= b;
  return b;
}


x86 assembly (clang, -O0):
<uintFindMaxHex>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movl   $0x10,-0x8(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x1,%eax
jle    113a <uintFindMaxHex+0x3a>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x2(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x2(%rbp)
jmp    1112 <uintFindMaxHex+0x12>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uintFindMaxHex>:
mov    $0x10,%eax
cmp    $0x2,%di
jb     1169 <uintFindMaxHex+0x69>
lea    -0x1(%rdi),%edx
add    $0xfffffffe,%edi
mov    %edx,%ecx
and    $0x7,%ecx
cmp    $0x7,%di
jae    1123 <uintFindMaxHex+0x23>
mov    $0x10,%eax
jmp    114e <uintFindMaxHex+0x4e>
and    $0xfff8,%edx
mov    $0x10,%eax
xchg   %ax,%ax
imul   %eax,%eax
imul   %eax,%eax
imul   %eax,%eax
imul   %eax,%eax
imul   %eax,%eax
imul   %eax,%eax
imul   %eax,%eax
imul   %eax,%eax
add    $0xfff8,%dx
jne    1130 <uintFindMaxHex+0x30>
test   %cx,%cx
je     1169 <uintFindMaxHex+0x69>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
imul   %eax,%eax
add    $0xffff,%cx
jne    1160 <uintFindMaxHex+0x60>
ret

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

LLVM IR (-O2):
define i32 @uintFindMaxHex(i16 zeroext %0) {
%2 = icmp ugt i16 %0, 1
br i1 %2, label %3, label %33
3: ; preds = %1
%4 = add i16 %0, -1
%5 = add i16 %0, -2
%6 = and i16 %4, 7
%7 = icmp ult i16 %5, 7
br i1 %7, label %23, label %8
8: ; preds = %3
%9 = and i16 %4, -8
br label %10
10: ; preds = %10, %8
%11 = phi i32 [ 16, %8 ], [ %20, %10 ]
%12 = phi i16 [ 0, %8 ], [ %21, %10 ]
%13 = mul i32 %11, %11
%14 = mul i32 %13, %13
%15 = mul i32 %14, %14
%16 = mul i32 %15, %15
%17 = mul i32 %16, %16
%18 = mul i32 %17, %17
%19 = mul i32 %18, %18
%20 = mul i32 %19, %19
%21 = add i16 %12, 8
%22 = icmp eq i16 %21, %9
br i1 %22, label %23, label %10
23: ; preds = %10, %3
%24 = phi i32 [ undef, %3 ], [ %20, %10 ]
%25 = phi i32 [ 16, %3 ], [ %20, %10 ]
%26 = icmp eq i16 %6, 0
br i1 %26, label %33, label %27
27: ; preds = %23, %27
%28 = phi i32 [ %30, %27 ], [ %25, %23 ]
%29 = phi i16 [ %31, %27 ], [ 0, %23 ]
%30 = mul i32 %28, %28
%31 = add i16 %29, 1
%32 = icmp eq i16 %31, %6
br i1 %32, label %33, label %27
33: ; preds = %23, %27, %1
%34 = phi i32 [ 16, %1 ], [ %24, %23 ], [ %30, %27 ]
ret i32 %34
}
void func6() {}


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

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

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

LLVM IR (-O2):
define void @func6() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(int /*<<< orphan*/, char *);
int /*<<< orphan*/ mbo_filename();
int mbo_save_null(void) {
  FILE *f;
  f = fopen(mbo_filename(), "w+b");
  if (f == NULL)
    return (!1);
  fclose(f);
}


x86 assembly (clang, -O0):
<mbo_save_null>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <mbo_filename@plt>
mov    %eax,%edi
lea    0xeb8(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1168 <mbo_save_null+0x38>
movl   $0x0,-0x4(%rbp)
jmp    1171 <mbo_save_null+0x41>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mbo_save_null>:
push   %rax
xor    %eax,%eax
call   1040 <mbo_filename@plt>
lea    0xec1(%rip),%rsi
mov    %eax,%edi
call   1050 <fopen@plt>
test   %rax,%rax
je     1153 <mbo_save_null+0x23>
mov    %rax,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"w+b\00"
define i32 @mbo_save_null() {
%1 = alloca i32
%2 = alloca i32*
%3 = call i32 (...) @mbo_filename()
%4 = call i32* @fopen(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 0, i32* %1
br label %11
8: ; preds = %0
%9 = load i32*, i32** %2
%10 = call i32 @fclose(i32* %9)
br label %11
11: ; preds = %8, %7
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [4 x i8] c"w+b\00"
define i32 @mbo_save_null() {
%1 = tail call i32 (...) @mbo_filename()
%2 = tail call i32* @fopen(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %0, %4
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutexattr_t;

/* Variables and functions */
int ENOSYS;
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
                                  int *protocol) {
  return (ENOSYS);
}


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

x86 assembly (clang, -O2):
<pthread_mutexattr_getprotocol>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @pthread_mutexattr_getprotocol(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @ENOSYS
ret i32 %5
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @pthread_mutexattr_getprotocol(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
ret i32 %3
}
int test_imm_C4int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0xC4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C4int64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0xc4,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C4int64_highword_mem>:
testb  $0xc4,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C4int64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 32
%6 = and i64 %5, 196
%7 = icmp ne i64 %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_C4int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 841813590016
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int main() {
  char a[16], b[16];
  if (sizeof(a) != sizeof(b))
    return 1;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
%3 = alloca [16 x i8]
store i32 0, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
unsigned long iomem_to_phys(unsigned long virt) {
  if (virt >= 0x88000000 && virt <= 0xffffffff)
    return (unsigned long)(virt - 0x78000000);
  return (unsigned long)virt;
}


x86 assembly (clang, -O0):
<iomem_to_phys>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    $0x88000000,%eax
cmp    %rax,-0x10(%rbp)
jb     1139 <iomem_to_phys+0x39>
mov    $0xffffffff,%eax
cmp    %rax,-0x10(%rbp)
ja     1139 <iomem_to_phys+0x39>
mov    -0x10(%rbp),%rax
sub    $0x78000000,%rax
mov    %rax,-0x8(%rbp)
jmp    1141 <iomem_to_phys+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iomem_to_phys>:
movabs $0xffffffff78000000,%rcx
ff ff ff
add    %rdi,%rcx
lea    -0x78000000(%rdi),%rax
cmp    $0x78000000,%rcx
cmovae %rdi,%rax
ret

LLVM IR (-O0):
define i64 @iomem_to_phys(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp uge i64 %4, 2281701376
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i64, i64* %3
%8 = icmp ule i64 %7, 4294967295
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i64, i64* %3
%11 = sub i64 %10, 2013265920
store i64 %11, i64* %2
br label %14
12: ; preds = %6, %1
%13 = load i64, i64* %3
store i64 %13, i64* %2
br label %14
14: ; preds = %12, %9
%15 = load i64, i64* %2
ret i64 %15
}

LLVM IR (-O2):
define i64 @iomem_to_phys(i64 %0) {
%2 = add i64 %0, -2281701376
%3 = icmp ult i64 %2, 2013265920
%4 = add i64 %0, -2013265920
%5 = select i1 %3, i64 %4, i64 %0
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, short, short, char);
void lcd_putc(short x, short y, char c) {
  printf("(%2d,%2d) \"%c\"\n", x, y, c);
}


x86 assembly (clang, -O0):
<lcd_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %si,%cx
mov    %di,%dx
mov    %dx,-0x2(%rbp)
mov    %cx,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x2(%rbp),%cx
mov    -0x4(%rbp),%ax
lea    0xec6(%rip),%rdi
movswl %cx,%esi
movswl %ax,%edx
movsbl -0x5(%rbp),%ecx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_putc>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"(%2d,%2d) \22%c\22\0A\00"
define void @lcd_putc(i16 signext %0, i16 signext %1, i8 signext %2) {
%4 = alloca i16
%5 = alloca i16
%6 = alloca i8
store i16 %0, i16* %4
store i16 %1, i16* %5
store i8 %2, i8* %6
%7 = load i16, i16* %4
%8 = load i16, i16* %5
%9 = load i8, i8* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i16 signext %7, i16 signext %8, i8 signext %9)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"(%2d,%2d) \22%c\22\0A\00"
define void @lcd_putc(i16 signext %0, i16 signext %1, i8 signext %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i16 signext %0, i16 signext %1, i8 signext %2)
ret void
}
/* Type definitions */
typedef size_t uint8_t;

/* Variables and functions */
size_t reversebytes(size_t);
void reverse_arraycopy(uint8_t *arr, uint8_t *dest, size_t len) {
  uint8_t i;
  for (i = 0; i < len; i++) {
    dest[i] = reversebytes(arr[i]);
  }
}


x86 assembly (clang, -O0):
<reverse_arraycopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    116b <reverse_arraycopy+0x5b>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <reversebytes@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112c <reverse_arraycopy+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_arraycopy>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     1146 <reverse_arraycopy+0x36>
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rdi
call   1030 <reversebytes@plt>
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <reverse_arraycopy+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @reverse_arraycopy(i64* nocapture %0, i64* nocapture writeonly %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %13, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %11, %5 ], [ 0, %3 ]
%7 = getelementptr inbounds i64, i64* %0, i64 %6
%8 = load i64, i64* %7
%9 = tail call i64 @reversebytes(i64 %8)
%10 = getelementptr inbounds i64, i64* %1, i64 %6
store i64 %9, i64* %10
%11 = add nuw i64 %6, 1
%12 = icmp eq i64 %11, %2
br i1 %12, label %13, label %5
13: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ munmap(void *, size_t);
void unmap_region(void *vaddr, size_t size) { munmap(vaddr, size); }


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

x86 assembly (clang, -O2):
<unmap_region>:
jmp    1030 <munmap@plt>

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

LLVM IR (-O2):
define void @unmap_region(i8* %0, i64 %1) {
%3 = tail call i32 @munmap(i8* %0, i64 %1)
ret void
}