xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int CheckCrc14443(int, int *, int);
bool checkCRC(uint32_t decrypted) {
  uint8_t data[] = {(decrypted >> 24) & 0xFF, (decrypted >> 16) & 0xFF,
                    (decrypted >> 8) & 0xFF, decrypted & 0xFF};
  return CheckCrc14443(0x6363, data, sizeof(data));
}


x86 assembly (clang, -O0):
<checkCRC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x6363,%edi
mov    $0x10,%edx
call   1030 <CheckCrc14443@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkCRC>:
sub    $0x18,%rsp
mov    %edi,%eax
mov    %edi,%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x18,%eax
mov    %eax,(%rsp)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %eax,0x4(%rsp)
mov    %edx,0x8(%rsp)
mov    %esi,0xc(%rsp)
mov    %rsp,%rsi
mov    $0x6363,%edi
mov    $0x10,%edx
call   1030 <CheckCrc14443@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @checkCRC(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x i32]
store i32 %0, i32* %2
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = ashr i32 %5, 24
%7 = and i32 %6, 255
store i32 %7, i32* %4
%8 = getelementptr inbounds i32, i32* %4, i64 1
%9 = load i32, i32* %2
%10 = ashr i32 %9, 16
%11 = and i32 %10, 255
store i32 %11, i32* %8
%12 = getelementptr inbounds i32, i32* %8, i64 1
%13 = load i32, i32* %2
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
store i32 %15, i32* %12
%16 = getelementptr inbounds i32, i32* %12, i64 1
%17 = load i32, i32* %2
%18 = and i32 %17, 255
store i32 %18, i32* %16
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%20 = call i32 @CheckCrc14443(i32 25443, i32* %19, i32 16)
ret i32 %20
}

LLVM IR (-O2):
define i32 @checkCRC(i32 %0) {
%2 = alloca [4 x i32]
%3 = bitcast [4 x i32]* %2 to i8*
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%5 = lshr i32 %0, 24
store i32 %5, i32* %4
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
%7 = lshr i32 %0, 16
%8 = and i32 %7, 255
store i32 %8, i32* %6
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
%10 = lshr i32 %0, 8
%11 = and i32 %10, 255
store i32 %11, i32* %9
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 3
%13 = and i32 %0, 255
store i32 %13, i32* %12
%14 = call i32 @CheckCrc14443(i32 25443, i32* %4, i32 16)
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void func2(void) { puts("Hello world"); }


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"Hello world\00"
define void @func2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct __sk_buff {
  int dummy;
};
typedef int /*<<< orphan*/ __u8;
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
void cilium_dbg_capture2(struct __sk_buff *skb, __u8 type, __u32 arg1,
                         __u32 arg2) {}


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

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

LLVM IR (-O0):
%struct.__sk_buff = type { i32 }
define void @cilium_dbg_capture2(%struct.__sk_buff* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.__sk_buff*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.__sk_buff* %0, %struct.__sk_buff** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
%struct.__sk_buff = type { i32 }
define void @cilium_dbg_capture2(%struct.__sk_buff* nocapture %0, i32 %1, i32 %2, i32 %3) {
ret void
}
signed int f26(signed int v_foo) {
  signed int v_and = v_foo & -49;
  signed int v_parta = v_and << 5;
  signed int v_partb = ((unsigned int)v_and) >> 27;
  signed int v_rotl = v_parta | v_partb;
  return v_rotl;
}


x86 assembly (clang, -O0):
<f26>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffffcf,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x5,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x1b,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f26>:
mov    %edi,%eax
rol    $0x5,%eax
and    $0xfffff9ff,%eax
ret

LLVM IR (-O0):
define i32 @f26(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = and i32 %7, -49
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = shl i32 %9, 5
store i32 %10, i32* %4
%11 = load i32, i32* %3
%12 = lshr i32 %11, 27
store i32 %12, i32* %5
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = or i32 %13, %14
store i32 %15, i32* %6
%16 = load i32, i32* %6
ret i32 %16
}

LLVM IR (-O2):
define i32 @f26(i32 %0) {
%2 = shl i32 %0, 5
%3 = and i32 %2, -1568
%4 = lshr i32 %0, 27
%5 = or i32 %3, %4
ret i32 %5
}
void Increment(int *i) {
  if (*i > 0) {
    (*i)++;
  }
}


x86 assembly (clang, -O0):
<Increment>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jle    1120 <Increment+0x20>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Increment>:
mov    (%rdi),%eax
test   %eax,%eax
jle    110b <Increment+0xb>
add    $0x1,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @Increment(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1
store i32 %9, i32* %7
br label %10
10: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @Increment(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = add nuw nsw i32 %2, 1
store i32 %5, i32* %0
br label %6
6: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void rewind(FILE *stream) {
  FILE tmp;
  tmp = *stream;
}


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

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

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

LLVM IR (-O2):
define void @rewind(i32* nocapture %0) {
ret void
}
void foo346() {}


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

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

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

LLVM IR (-O2):
define void @foo346() {
ret void
}
double inv_q30_to_double(long q30) {
  return (double)q30 / ((double)(1L << 30));
}


x86 assembly (clang, -O0):
<inv_q30_to_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_q30_to_double>:
cvtsi2sd %rdi,%xmm0
mulsd  0xef3(%rip),%xmm0
ret

LLVM IR (-O0):
define double @inv_q30_to_double(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sitofp i64 %3 to double
%5 = fdiv double %4, 0x41D0000000000000
ret double %5
}

LLVM IR (-O2):
define double @inv_q30_to_double(i64 %0) {
%2 = sitofp i64 %0 to double
%3 = fmul double %2, 0x3E10000000000000
ret double %3
}
int main() {
  int a, b;
  a = a * 8 + b;
  while (a < 90) {
    a = a + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x3,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x5a,-0x8(%rbp)
jge    112f <main+0x2f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1117 <main+0x17>
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 i32
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* %2
%5 = mul nsw i32 %4, 8
%6 = load i32, i32* %3
%7 = add nsw i32 %5, %6
store i32 %7, i32* %2
br label %8
8: ; preds = %11, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 90
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %8
14: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void lcd_iomux_config() {}


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

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

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

LLVM IR (-O2):
define void @lcd_iomux_config() {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
unsigned int bytes_needed_for_size(uint32_t size) {
  if (size == 1)
    return 0;
  else if (size <= 0xFF)
    return 1;
  else if (size <= 0xFFFF)
    return 2;
  else if (size <= 0xFFFFFF)
    return 3;
  else
    return 4;
}


x86 assembly (clang, -O0):
<bytes_needed_for_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    111d <bytes_needed_for_size+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    116f <bytes_needed_for_size+0x6f>
cmpl   $0xff,-0x8(%rbp)
jg     1136 <bytes_needed_for_size+0x36>
movl   $0x1,-0x4(%rbp)
jmp    116f <bytes_needed_for_size+0x6f>
cmpl   $0xffff,-0x8(%rbp)
jg     114f <bytes_needed_for_size+0x4f>
movl   $0x2,-0x4(%rbp)
jmp    116f <bytes_needed_for_size+0x6f>
cmpl   $0xffffff,-0x8(%rbp)
jg     1168 <bytes_needed_for_size+0x68>
movl   $0x3,-0x4(%rbp)
jmp    116f <bytes_needed_for_size+0x6f>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytes_needed_for_size>:
xor    %eax,%eax
cmp    $0x1,%edi
je     112f <bytes_needed_for_size+0x2f>
mov    $0x1,%eax
cmp    $0x100,%edi
jl     112f <bytes_needed_for_size+0x2f>
mov    $0x2,%eax
cmp    $0x10000,%edi
jb     112f <bytes_needed_for_size+0x2f>
cmp    $0x1000000,%edi
mov    $0x4,%eax
sbb    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @bytes_needed_for_size(i32 %0) {
%2 = alloca i32
%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 i32 0, i32* %2
br label %20
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 255
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 1, i32* %2
br label %20
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp sle i32 %12, 65535
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 2, i32* %2
br label %20
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp sle i32 %16, 16777215
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 3, i32* %2
br label %20
19: ; preds = %15
store i32 4, i32* %2
br label %20
20: ; preds = %19, %18, %14, %10, %6
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @bytes_needed_for_size(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = icmp slt i32 %0, 256
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 65536
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 16777216
%9 = select i1 %8, i32 3, i32 4
br label %10
10: ; preds = %7, %5, %3, %1
%11 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 2, %5 ], [ %9, %7 ]
ret i32 %11
}
int main() { return !4; }


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
store i32 0, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
__attribute__((no, used)) int foo(int i, int j, int k, int l) {
  return i + j + k + l;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    (%rdi,%rsi,1),%eax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32, i32, i32, i32)* @foo to i8*)], section "llvm.metadata"
define i32 @foo(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %7
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %8
%15 = add nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32, i32, i32, i32)* @foo to i8*)], section "llvm.metadata"
define i32 @foo(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %1, %0
%6 = add nsw i32 %5, %2
%7 = add nsw i32 %6, %3
ret i32 %7
}
long long fib_seq(int n) {
  int x, y;
  if (n < 2)
    return n;
  x = fib_seq(n - 1);
  y = fib_seq(n - 2);
  return x + y;
}


x86 assembly (clang, -O0):
<fib_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1132 <fib_seq+0x22>
movslq -0xc(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115a <fib_seq+0x4a>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib_seq@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib_seq@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib_seq>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x1,%edi
jg     1120 <fib_seq+0x10>
movslq %ebx,%rax
jmp    113a <fib_seq+0x2a>
lea    -0x1(%rbx),%edi
call   1030 <fib_seq@plt>
mov    %rax,%r14
add    $0xfffffffe,%ebx
mov    %ebx,%edi
call   1030 <fib_seq@plt>
add    %r14d,%eax
cltq
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fib_seq(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
br label %5
5: ; preds = %3, %7
%6 = phi i64 [ %14, %7 ], [ %4, %3 ]
ret i64 %6
7: ; preds = %1
%8 = add nsw i32 %0, -1
%9 = tail call i64 @fib_seq(i32 %8)
%10 = add nsw i32 %0, -2
%11 = tail call i64 @fib_seq(i32 %10)
%12 = add i64 %11, %9
%13 = shl i64 %12, 32
%14 = ashr exact i64 %13, 32
br label %5
}
/* Type definitions */
typedef int /*<<< orphan*/ x;
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, int);
uint8_t get_uint8(const void *p) {
  uint8_t x;
  memcpy((void *)&x, p, sizeof(x));
  return x;
}


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

x86 assembly (clang, -O2):
<get_uint8>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @get_uint8(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = bitcast i32* %3 to i8*
%5 = load i8*, i8** %2
%6 = call i32 @memcpy(i8* %4, i8* %5, i32 4)
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_uint8(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i8* %3, i8* %0, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char const *);
int /*<<< orphan*/ stderr;
void check_error(int cond, const char *str) {
  if (cond == 1) {
    fprintf(stderr, str);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<check_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1159 <check_error+0x39>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <fprintf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_error>:
cmp    $0x1,%edi
je     1126 <check_error+0x6>
ret
push   %rax
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
call   1030 <fprintf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @check_error(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 = icmp eq i32 %5, 1
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = call i32 @fprintf(i32 %8, i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @check_error(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* %1)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
ret void
}
int main() {
  if (15 > 8)
    return 7;
  else
    return 8;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
ret i32 7
}

LLVM IR (-O2):
define i32 @main() {
ret i32 7
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void MyFree(void *ptr) {
  if (ptr) {
    free(ptr);
    ptr = NULL;
  }
}


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

x86 assembly (clang, -O2):
<MyFree>:
test   %rdi,%rdi
je     111a <MyFree+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @MyFree(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 %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
store i8* null, i8** %2
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @MyFree(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void gtk_icon_view_set_text_column() {}


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

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

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

LLVM IR (-O2):
define void @gtk_icon_view_set_text_column() {
ret void
}
void syncWrite(void) {
  _serverPanic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/"
               "heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c",
               131, "Function '%s' is disabled.", __func__);
}


x86 assembly (clang, -O0):
<syncWrite>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x83,%esi
lea    0xf79(%rip),%rdx
lea    0xf8d(%rip),%rcx
mov    $0x0,%al
call   1030 <_serverPanic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<syncWrite>:
lea    0xee9(%rip),%rdi
lea    0xf82(%rip),%rdx
lea    0xf96(%rip),%rcx
mov    $0x83,%esi
xor    %eax,%eax
jmp    1030 <_serverPanic@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.syncWrite = [10 x i8] c"syncWrite\00"
define void @syncWrite() {
%1 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 131, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__func__.syncWrite, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.syncWrite = [10 x i8] c"syncWrite\00"
define void @syncWrite() {
%1 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 131, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__func__.syncWrite, i64 0, i64 0))
ret void
}
void printDamage(int damage, char *creatureName) {
  if (!creatureName) {
    logError("Name expected in call; received NULL", __func__);
  } else {
    printf("You did %i damage to the %s!\n", damage, creatureName);
  }
}


x86 assembly (clang, -O0):
<printDamage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <printDamage+0x34>
lea    0xebf(%rip),%rdi
lea    0xedd(%rip),%rsi
mov    $0x0,%al
call   1040 <logError@plt>
jmp    1169 <printDamage+0x49>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printDamage>:
mov    %rsi,%rdx
test   %rsi,%rsi
je     1138 <printDamage+0x18>
mov    %edi,%esi
lea    0xf00(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    0xedf(%rip),%rsi
xor    %eax,%eax
jmp    1040 <logError@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Name expected in call; received NULL\00"
@__func__.printDamage = [12 x i8] c"printDamage\00"
@.str.1 = [30 x i8] c"You did %i damage to the %s!\0A\00"
define void @printDamage(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @logError to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.printDamage, i64 0, i64 0))
br label %13
9: ; preds = %2
%10 = load i32, i32* %3
%11 = load i8*, i8** %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %10, i8* %11)
br label %13
13: ; preds = %9, %7
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"Name expected in call; received NULL\00"
@__func__.printDamage = [12 x i8] c"printDamage\00"
@.str.1 = [30 x i8] c"You did %i damage to the %s!\0A\00"
define void @printDamage(i32 %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @logError to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.printDamage, i64 0, i64 0))
br label %8
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %0, i8* %1)
br label %8
8: ; preds = %6, %4
ret void
}
IM(i) int i;
{ return (((i)&0x8000) ? (i) | (-0x8000) : (i)&0x7fff); }


x86 assembly (clang, -O0):
<IM>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     1128 <IM+0x28>
mov    -0x4(%rbp),%eax
or     $0xffff8000,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <IM+0x33>
mov    -0x4(%rbp),%eax
and    $0x7fff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IM>:
movswl %di,%eax
and    $0x7fff,%edi
and    $0xffff8000,%eax
or     %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @IM(i32 %0) {
%2 = and i32 %0, 32768
%3 = icmp eq i32 %2, 0
%4 = and i32 %0, 32767
%5 = select i1 %3, i32 0, i32 -32768
%6 = or i32 %5, %4
ret i32 %6
}
/* Variables and functions */
size_t ft_strlen(const char *s) {
  const char *tail;
  tail = s;
  while (*tail)
    tail++;
  return (tail - s);
}


x86 assembly (clang, -O0):
<ft_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     112e <ft_strlen+0x2e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <ft_strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <ft_strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @ft_strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
unsigned int foo(unsigned int a, unsigned int b, unsigned int c, unsigned int d,
                 unsigned int e, unsigned int f, unsigned int g,
                 unsigned int h) {
  unsigned int i = (a + 9) + (c + d);
  unsigned int j = (e + 4) + (2 + g);
  e = i + j;
  return e;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    $0x9,%eax
mov    -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x4,%eax
mov    0x10(%rbp),%ecx
add    $0x2,%ecx
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    0x8(%rsp),%eax
add    %edx,%edi
add    %ecx,%edi
add    %r8d,%edi
add    %edi,%eax
add    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%19 = load i32, i32* %9
%20 = add i32 %19, 9
%21 = load i32, i32* %11
%22 = load i32, i32* %12
%23 = add i32 %21, %22
%24 = add i32 %20, %23
store i32 %24, i32* %17
%25 = load i32, i32* %13
%26 = add i32 %25, 4
%27 = load i32, i32* %15
%28 = add i32 2, %27
%29 = add i32 %26, %28
store i32 %29, i32* %18
%30 = load i32, i32* %17
%31 = load i32, i32* %18
%32 = add i32 %30, %31
store i32 %32, i32* %13
%33 = load i32, i32* %13
ret i32 %33
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = add i32 %0, 15
%10 = add i32 %9, %2
%11 = add i32 %10, %3
%12 = add i32 %11, %4
%13 = add i32 %12, %6
ret i32 %13
}
float fmax3(float f1, float f2, float f3) {
  float max = f1;
  if (f2 > max)
    max = f2;
  if (f3 > max)
    max = f3;
  return max;
}


x86 assembly (clang, -O0):
<fmax3>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1136 <fmax3+0x36>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    114f <fmax3+0x4f>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmax3>:
maxss  %xmm0,%xmm1
maxss  %xmm1,%xmm2
movaps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @fmax3(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%8 = load float, float* %4
store float %8, float* %7
%9 = load float, float* %5
%10 = load float, float* %7
%11 = fcmp ogt float %9, %10
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = load float, float* %5
store float %13, float* %7
br label %14
14: ; preds = %12, %3
%15 = load float, float* %6
%16 = load float, float* %7
%17 = fcmp ogt float %15, %16
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load float, float* %6
store float %19, float* %7
br label %20
20: ; preds = %18, %14
%21 = load float, float* %7
ret float %21
}

LLVM IR (-O2):
define float @fmax3(float %0, float %1, float %2) {
%4 = fcmp ogt float %1, %0
%5 = select i1 %4, float %1, float %0
%6 = fcmp olt float %5, %2
%7 = select i1 %6, float %2, float %5
ret float %7
}
void Swap4Bytes(char *bytes) {
  char t;
  t = bytes[0];
  bytes[0] = bytes[3];
  bytes[3] = t;
  t = bytes[1];
  bytes[1] = bytes[2];
  bytes[2] = t;
}


x86 assembly (clang, -O0):
<Swap4Bytes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Swap4Bytes>:
mov    (%rdi),%al
mov    0x3(%rdi),%cl
mov    %cl,(%rdi)
mov    %al,0x3(%rdi)
rolw   $0x8,0x1(%rdi)
ret

LLVM IR (-O0):
define void @Swap4Bytes(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
store i8 %6, i8* %3
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 3
%9 = load i8, i8* %8
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %9, i8* %11
%12 = load i8, i8* %3
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 3
store i8 %12, i8* %14
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
store i8 %17, i8* %3
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 1
store i8 %20, i8* %22
%23 = load i8, i8* %3
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i64 2
store i8 %23, i8* %25
ret void
}

LLVM IR (-O2):
define void @Swap4Bytes(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 3
%4 = load i8, i8* %3
store i8 %4, i8* %0
store i8 %2, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %0, i64 2
%8 = load i8, i8* %7
store i8 %8, i8* %5
store i8 %6, i8* %7
ret void
}
/* Type definitions */
typedef int *p;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int nondet_int();
int main(int argc, char *argv[]) {
  int *p, *q, i = nondet_int();
  p = &i;
  argc = nondet_int();
  if (argc > 1) {
    q = &i;
  } else {
    q = p;
  }
  assert(*(p) + *(q) == 2 * i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <nondet_int@plt>
mov    %eax,-0x24(%rbp)
lea    -0x24(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <nondet_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1169 <main+0x49>
lea    -0x24(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1171 <main+0x51>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
add    (%rcx),%eax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (...) @nondet_int()
store i32 %9, i32* %8
store i32* %8, i32** %6
%10 = call i32 (...) @nondet_int()
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %2
store i32* %8, i32** %7
br label %16
14: ; preds = %2
%15 = load i32*, i32** %6
store i32* %15, i32** %7
br label %16
16: ; preds = %14, %13
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
%21 = add nsw i32 %18, %20
%22 = load i32, i32* %8
%23 = mul nsw i32 2, %22
%24 = icmp eq i32 %21, %23
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @nondet_int()
%4 = tail call i32 (...) @nondet_int()
%5 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ GetMemory(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int Test1(void) {
  char *str = NULL;
  GetMemory(str);
  strcpy(str, "hello world");
  printf(str);
  return 0;
}


x86 assembly (clang, -O0):
<Test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <GetMemory@plt>
mov    -0x8(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test1>:
push   %rax
xor    %edi,%edi
call   1050 <GetMemory@plt>
lea    0xec1(%rip),%rsi
xor    %edi,%edi
call   1030 <strcpy@plt>
xor    %edi,%edi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"hello world\00"
define i32 @Test1() {
%1 = alloca i8*
store i8* null, i8** %1
%2 = load i8*, i8** %1
%3 = call i32 @GetMemory(i8* %2)
%4 = load i8*, i8** %1
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %1
%7 = call i32 @printf(i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
define i32 @Test1() {
%1 = tail call i32 @GetMemory(i8* null)
%2 = tail call i32 @strcpy(i8* null, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) null)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_SIG;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int ASN1_item_i2d_bio(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                      int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_SIG_it;
int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8) {
  return ASN1_item_i2d_bio(&X509_SIG_it, bp, p8);
}


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

x86 assembly (clang, -O2):
<i2d_PKCS8_bio>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2ecb(%rip),%rdi
jmp    1030 <ASN1_item_i2d_bio@plt>

LLVM IR (-O0):
@X509_SIG_it = global i32 0
define i32 @i2d_PKCS8_bio(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 = call i32 @ASN1_item_i2d_bio(i32* @X509_SIG_it, i32* %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
@X509_SIG_it = global i32 0
define i32 @i2d_PKCS8_bio(i32* %0, i32* %1) {
%3 = tail call i32 @ASN1_item_i2d_bio(i32* @X509_SIG_it, i32* %0, i32* %1)
ret i32 %3
}
int square(int x) { return x * x; }


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

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

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

LLVM IR (-O2):
define i32 @square(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
/* Type definitions */
typedef scalar_t__ volatile uint32_t;

/* Variables and functions */
void SSIIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000014))) |= ui32IntFlags;
}


x86 assembly (clang, -O0):
<SSIIntEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIIntEnable>:
mov    %rdi,-0x8(%rsp)
mov    %rsi,-0x10(%rsp)
mov    -0x10(%rsp),%rax
mov    -0x8(%rsp),%rcx
or     %rax,0x14(%rcx)
ret

LLVM IR (-O0):
define void @SSIIntEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = load volatile i64, i64* %3
%7 = add nsw i64 %6, 20
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}

LLVM IR (-O2):
define void @SSIIntEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = load volatile i64, i64* %3
%7 = add nsw i64 %6, 20
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}
/* Variables and functions */
void strlen() {}


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

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

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

LLVM IR (-O2):
define void @strlen() {
ret void
}
void index_to_xy(int index, int *px, int *py, int n) {
  *px = index % n;
  *py = index / n;
}


x86 assembly (clang, -O0):
<index_to_xy>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %edx,(%rax)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<index_to_xy>:
mov    %rdx,%r8
mov    %edi,%eax
cltd
idiv   %ecx
mov    %edx,(%rsi)
mov    %eax,(%r8)
ret

LLVM IR (-O0):
define void @index_to_xy(i32 %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %8
%11 = srem i32 %9, %10
%12 = load i32*, i32** %6
store i32 %11, i32* %12
%13 = load i32, i32* %5
%14 = load i32, i32* %8
%15 = sdiv i32 %13, %14
%16 = load i32*, i32** %7
store i32 %15, i32* %16
ret void
}

LLVM IR (-O2):
define void @index_to_xy(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32 %3) {
%5 = srem i32 %0, %3
store i32 %5, i32* %1
%6 = sdiv i32 %0, %3
store i32 %6, i32* %2
ret void
}
char *fo_RepMkPath(char *Type, char *Filename) { return (0); }


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

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

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

LLVM IR (-O2):
define noalias i8* @fo_RepMkPath(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
void glSamplerParameterfv(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glSamplerParameterfv() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ puts(char *);
void printUsage(const char *command) {
  printf("Usage: %s [OPTION] file1.IFF file2.IFF ...\n\n", command);
  puts("The command `iffjoin' joins an aribitrary number of IFF files into a "
       "single\n"
       "concatenation IFF file. The result is written to the standard output, "
       "or\n"
       "optionally to a given destination file.\n\n"
       "Options:\n"
       "  -o, --output-file=FILE    Specify an output file name\n"
       "  -h, --help                Shows the usage of this command to the "
       "user\n"
       "  -v, --version             Shows the version of this command to the "
       "user");
}


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

x86 assembly (clang, -O2):
<printUsage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xef6(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"Usage: %s [OPTION] file1.IFF file2.IFF ...\0A\0A\00"
@.str.1 = [401 x i8] c"The command `iffjoin' joins an aribitrary number of IFF files into a single\0Aconcatenation IFF file. The result is written to the standard output, or\0Aoptionally to a given destination file.\0A\0AOptions:\0A -o, --output-file=FILE Specify an output file name\0A -h, --help Shows the usage of this command to the user\0A -v, --version Shows the version of this command to the user\00"
define void @printUsage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @puts(i8* getelementptr inbounds ([401 x i8], [401 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"Usage: %s [OPTION] file1.IFF file2.IFF ...\0A\0A\00"
@.str.1 = [401 x i8] c"The command `iffjoin' joins an aribitrary number of IFF files into a single\0Aconcatenation IFF file. The result is written to the standard output, or\0Aoptionally to a given destination file.\0A\0AOptions:\0A -o, --output-file=FILE Specify an output file name\0A -h, --help Shows the usage of this command to the user\0A -v, --version Shows the version of this command to the user\00"
define void @printUsage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([401 x i8], [401 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int smax(int a, int b) { return (a > b) ? a : b; }


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

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

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

LLVM IR (-O2):
define i32 @smax(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
int hexValueScore(const char *hexString, const char hexValue) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @hexValueScore(i8* nocapture readnone %0, i8 signext %1) {
ret i32 0
}
/* Type definitions */
struct v4l2_audioout {
  int dummy;
};
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int main(void) {
  struct v4l2_audioout a;
  (void)a;
  return sizeof(a);
}


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

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

LLVM IR (-O0):
%struct.v4l2_audioout = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.v4l2_audioout
store i32 0, i32* %1
ret i32 4
}

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}