xunge/DecIR huggingface dataset:
/* Variables and functions */
char to_hex(char code) {
  static char hex[] = "0123456789abcdef";
  return hex[code & 15];
}


x86 assembly (clang, -O0):
<to_hex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0x2f15(%rip),%rax
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_hex>:
and    $0xf,%edi
lea    0xef6(%rip),%rax
mov    (%rdi,%rax,1),%al
ret

LLVM IR (-O0):
@to_hex.hex = internal global [17 x i8] c"0123456789abcdef\00"
define signext i8 @to_hex(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 15
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [17 x i8], [17 x i8]* @to_hex.hex, i64 0, i64 %6
%8 = load i8, i8* %7
ret i8 %8
}

LLVM IR (-O2):
@to_hex.hex = internal unnamed_addr constant [17 x i8] c"0123456789abcdef\00"
define signext i8 @to_hex(i8 signext %0) {
%2 = and i8 %0, 15
%3 = zext i8 %2 to i64
%4 = getelementptr inbounds [17 x i8], [17 x i8]* @to_hex.hex, i64 0, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ rotate(int *, int, int);
void constrct_max_heap(int a[], int len) {
  int i;
  for (i = len / 2; i > 0; i--) {
    rotate(a, i, len);
  }
}


x86 assembly (clang, -O0):
<constrct_max_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1154 <constrct_max_heap+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <rotate@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <constrct_max_heap+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<constrct_max_heap>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%esi
jl     1146 <constrct_max_heap+0x36>
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <rotate@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
ja     1130 <constrct_max_heap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @constrct_max_heap(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 = sdiv i32 %6, 2
store i32 %7, i32* %5
br label %8
8: ; preds = %16, %2
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = call i32 @rotate(i32* %12, i32 %13, i32 %14)
br label %16
16: ; preds = %11
%17 = load i32, i32* %5
%18 = add nsw i32 %17, -1
store i32 %18, i32* %5
br label %8
19: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @constrct_max_heap(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = lshr i32 %1, 1
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ %5, %4 ]
%8 = tail call i32 @rotate(i32* %0, i32 %7, i32 %1)
%9 = add nsw i32 %7, -1
%10 = icmp ugt i32 %7, 1
br i1 %10, label %6, label %11
11: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int /*<<< orphan*/ uint64_t;
typedef int uint16_t;

/* Variables and functions */
uint64_t cbor_peek_u16(uint8_t *data) {
  uint16_t value = ((uint16_t)data[0]) << 8 | ((uint16_t)data[1]);
  return (uint64_t)value;
}


x86 assembly (clang, -O0):
<cbor_peek_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbor_peek_u16>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x8(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @cbor_peek_u16(i64* %0) {
%2 = alloca i64*
%3 = alloca i32
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = getelementptr inbounds i64, i64* %4, i64 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = shl i32 %7, 8
%9 = load i64*, i64** %2
%10 = getelementptr inbounds i64, i64* %9, i64 1
%11 = load i64, i64* %10
%12 = trunc i64 %11 to i32
%13 = or i32 %8, %12
store i32 %13, i32* %3
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @cbor_peek_u16(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = shl i32 %3, 8
%5 = getelementptr inbounds i64, i64* %0, i64 1
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ readb(void *);
int /*<<< orphan*/ writeb(unsigned char, long);
void outb(unsigned char value, long address) {
  readb((void *)(address & 0xffffff00) + 0x40);
  writeb(value, address);
}


x86 assembly (clang, -O0):
<outb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0xffffff00,%rdi
and    -0x10(%rbp),%rdi
add    $0x40,%rdi
call   1030 <readb@plt>
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rsi
movzbl %al,%edi
call   1040 <writeb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outb>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %ebx,%edi
and    $0xffffff00,%edi
or     $0x40,%rdi
call   1030 <readb@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <writeb@plt>

LLVM IR (-O0):
define void @outb(i8 zeroext %0, i64 %1) {
%3 = alloca i8
%4 = alloca i64
store i8 %0, i8* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = and i64 %5, 4294967040
%7 = inttoptr i64 %6 to i8*
%8 = getelementptr i8, i8* %7, i64 64
%9 = call i32 @readb(i8* %8)
%10 = load i8, i8* %3
%11 = load i64, i64* %4
%12 = call i32 @writeb(i8 zeroext %10, i64 %11)
ret void
}

LLVM IR (-O2):
define void @outb(i8 zeroext %0, i64 %1) {
%3 = and i64 %1, 4294967040
%4 = inttoptr i64 %3 to i8*
%5 = getelementptr i8, i8* %4, i64 64
%6 = tail call i32 @readb(i8* %5)
%7 = tail call i32 @writeb(i8 zeroext %0, i64 %1)
ret void
}
/* Type definitions */
struct kv_val {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct kv_val *);
void kv_destroy_val(struct kv_val *val) { free(val); }


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

x86 assembly (clang, -O2):
<kv_destroy_val>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.kv_val = type { i32 }
define void @kv_destroy_val(%struct.kv_val* %0) {
%2 = alloca %struct.kv_val*
store %struct.kv_val* %0, %struct.kv_val** %2
%3 = load %struct.kv_val*, %struct.kv_val** %2
%4 = call i32 @free(%struct.kv_val* %3)
ret void
}

LLVM IR (-O2):
%struct.kv_val = type { i32 }
define void @kv_destroy_val(%struct.kv_val* nocapture %0) {
%2 = tail call i32 @free(%struct.kv_val* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sched_yield();
void sys_yield(void) { sched_yield(); }


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

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

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

LLVM IR (-O2):
define void @sys_yield() {
%1 = tail call i32 (...) @sched_yield()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f();
int /*<<< orphan*/ g();
main() {
  f();
  g();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <f@plt>
mov    $0x0,%al
call   1040 <g@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @f()
%2 = call i32 (...) @g()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = tail call i32 (...) @g()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ configure__alloc();
int /*<<< orphan*/ configure__endianness();
int /*<<< orphan*/ configure__fpbits();
int /*<<< orphan*/ generate_defines(char *);
int main(int argc, char **argv) {
  if (argc > 0)
    generate_defines(argv[1]);
  configure__endianness();
  configure__alloc();
  configure__fpbits();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    116d <main+0x2d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <generate_defines@plt>
mov    $0x0,%al
call   1040 <configure__endianness@plt>
mov    $0x0,%al
call   1030 <configure__alloc@plt>
mov    $0x0,%al
call   1050 <configure__fpbits@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
test   %edi,%edi
jle    114e <main+0xe>
mov    0x8(%rsi),%rdi
call   1060 <generate_defines@plt>
xor    %eax,%eax
call   1040 <configure__endianness@plt>
xor    %eax,%eax
call   1030 <configure__alloc@plt>
xor    %eax,%eax
call   1050 <configure__fpbits@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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @generate_defines(i8* %11)
br label %13
13: ; preds = %8, %2
%14 = call i32 (...) @configure__endianness()
%15 = call i32 (...) @configure__alloc()
%16 = call i32 (...) @configure__fpbits()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @generate_defines(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = tail call i32 (...) @configure__endianness()
%10 = tail call i32 (...) @configure__alloc()
%11 = tail call i32 (...) @configure__fpbits()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(float *, int *, int);
float intToFloat(int i) {
  float result;
  memcpy(&result, &i, 4);
  return result;
}


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

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

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

LLVM IR (-O2):
define float @intToFloat(i32 %0) {
%2 = alloca i32
%3 = alloca float
store i32 %0, i32* %2
%4 = bitcast float* %3 to i8*
%5 = call i32 @memcpy(float* %3, i32* %2, i32 4)
%6 = load float, float* %3
ret float %6
}
int test_imm_1Bint8_mem(signed char *val) {
  return ((*val) & (-0x1B << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_1Bint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -27
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned long factorial(int n) {
  unsigned long k = 1;
  while (n > 1)
    k *= n--;
  return k;
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1134 <factorial+0x34>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cltq
imul   -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    110f <factorial+0xf>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     1131 <factorial+0x31>
mov    %edi,%ecx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
imul   %rcx,%rax
lea    -0x1(%rcx),%rdx
cmp    $0x2,%rcx
mov    %rdx,%rcx
ja     1120 <factorial+0x20>
ret

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

LLVM IR (-O2):
define i64 @factorial(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %11
3: ; preds = %1
%4 = zext i32 %0 to i64
br label %5
5: ; preds = %3, %5
%6 = phi i64 [ %4, %3 ], [ %8, %5 ]
%7 = phi i64 [ 1, %3 ], [ %9, %5 ]
%8 = add nsw i64 %6, -1
%9 = mul i64 %7, %6
%10 = icmp ugt i64 %6, 2
br i1 %10, label %5, label %11
11: ; preds = %5, %1
%12 = phi i64 [ 1, %1 ], [ %9, %5 ]
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int displayUsage(char **argv) {
  printf("Usage: %s command regex\n", argv[0]);
  return 0;
}


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

x86 assembly (clang, -O2):
<displayUsage>:
push   %rax
mov    (%rdi),%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Usage: %s command regex\0A\00"
define i32 @displayUsage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Usage: %s command regex\0A\00"
define i32 @displayUsage(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
void ADCEnable(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000008))) |= 0x00000001;
}


x86 assembly (clang, -O0):
<ADCEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
or     $0x1,%rcx
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCEnable>:
orq    $0x1,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @ADCEnable(i64 %0) {
%2 = add i64 %0, 8
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = or i64 %4, 1
store volatile i64 %5, i64* %3
ret void
}
void highbank_pm_init(void) {}


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

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

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

LLVM IR (-O2):
define void @highbank_pm_init() {
ret void
}
void kvm_dirty_ring_free(struct kvm_dirty_ring *ring) {}


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

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

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

LLVM IR (-O2):
%struct.kvm_dirty_ring = type opaque
define void @kvm_dirty_ring_free(%struct.kvm_dirty_ring* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ doParams(int, char **);
int main(int argc, char **argv) {
  doParams(argc, argv);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <doParams@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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @doParams(i32 %6, i8** %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @doParams(i32 %0, i8** %1)
ret i32 0
}
onum(num) int num;
{ outdec(num); }


x86 assembly (clang, -O0):
<onum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <outdec@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @onum(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @outdec to i32 (i32, ...)*)(i32 %0)
ret i32 undef
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int sfip_is_private(uint32_t ip) {
  return (((ip & 0xff) == 10) ||
          (((ip & 0xff) == 172) && (((ip >> 8) & 0xf0) == 16)) ||
          ((ip & 0xffff) == 0xa8c0));
}


x86 assembly (clang, -O0):
<sfip_is_private>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x5(%rbp)
je     115e <sfip_is_private+0x5e>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
cmp    $0xac,%eax
jne    114b <sfip_is_private+0x4b>
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xf0,%ecx
mov    $0x1,%al
cmp    $0x10,%ecx
mov    %al,-0x5(%rbp)
je     115e <sfip_is_private+0x5e>
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
cmp    $0xa8c0,%eax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sfip_is_private>:
mov    $0x1,%eax
cmp    $0xa,%dil
je     112f <sfip_is_private+0x2f>
cmp    $0xac,%dil
jne    1121 <sfip_is_private+0x21>
mov    %edi,%ecx
and    $0xf000,%ecx
cmp    $0x1000,%ecx
je     112f <sfip_is_private+0x2f>
movzwl %di,%ecx
xor    %eax,%eax
cmp    $0xa8c0,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @sfip_is_private(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = icmp eq i32 %4, 10
br i1 %5, label %19, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = and i32 %7, 255
%9 = icmp eq i32 %8, 172
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i32, i32* %2
%12 = ashr i32 %11, 8
%13 = and i32 %12, 240
%14 = icmp eq i32 %13, 16
br i1 %14, label %19, label %15
15: ; preds = %10, %6
%16 = load i32, i32* %2
%17 = and i32 %16, 65535
%18 = icmp eq i32 %17, 43200
br label %19
19: ; preds = %15, %10, %1
%20 = phi i1 [ true, %10 ], [ true, %1 ], [ %18, %15 ]
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @sfip_is_private(i32 %0) {
%2 = trunc i32 %0 to i8
switch i8 %2, label %6 [
i8 10, label %10
i8 -84, label %3
]
3: ; preds = %1
%4 = and i32 %0, 61440
%5 = icmp eq i32 %4, 4096
br i1 %5, label %10, label %6
6: ; preds = %1, %3
%7 = and i32 %0, 65535
%8 = icmp eq i32 %7, 43200
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %1, %6, %3
%11 = phi i32 [ 1, %3 ], [ 1, %1 ], [ %9, %6 ]
ret i32 %11
}
int internal_exec(tcp)
struct tcb *tcp;
{
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.tcb = type opaque
define i32 @internal_exec(%struct.tcb* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ send_cmd(int, char *, int);
void send_cmd_d1(int cmd_code, double arg1) {
  send_cmd(cmd_code, (char *)&arg1, sizeof(double));
}


x86 assembly (clang, -O0):
<send_cmd_d1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <send_cmd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_cmd_d1>:
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <send_cmd@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @send_cmd_d1(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%5 = load i32, i32* %3
%6 = bitcast double* %4 to i8*
%7 = call i32 @send_cmd(i32 %5, i8* %6, i32 8)
ret void
}

LLVM IR (-O2):
define void @send_cmd_d1(i32 %0, double %1) {
%3 = alloca double
store double %1, double* %3
%4 = bitcast double* %3 to i8*
%5 = call i32 @send_cmd(i32 %0, i8* %4, i32 8)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ fexpect(char *, int, int, int);
void test_typedef() {
  typedef int A[];
  A a = {1, 2};
  A b = {3, 4, 5};
  fexpect(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/initializer.c",
      161, 2, sizeof(a) / sizeof(*a));
  ;
  fexpect(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/initializer.c",
      162, 3, sizeof(b) / sizeof(*b));
  ;
}


x86 assembly (clang, -O0):
<test_typedef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    0xedc(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    0xed6(%rip),%rdi
mov    $0xa1,%esi
mov    $0x2,%ecx
mov    %ecx,%edx
call   1030 <fexpect@plt>
lea    0xebe(%rip),%rdi
mov    $0xa2,%esi
mov    $0x3,%ecx
mov    %ecx,%edx
call   1030 <fexpect@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_typedef>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa1,%esi
mov    $0x2,%edx
mov    $0x2,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xa2,%esi
mov    $0x3,%edx
mov    $0x3,%ecx
pop    %rbx
jmp    1030 <fexpect@plt>

LLVM IR (-O0):
@__const.test_typedef.a = [2 x i32] [i32 1, i32 2]
@__const.test_typedef.b = [3 x i32] [i32 3, i32 4, i32 5]
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/initializer.c\00"
define void @test_typedef() {
%1 = alloca [2 x i32]
%2 = alloca [3 x i32]
%3 = bitcast [2 x i32]* %1 to i8*
%4 = bitcast [3 x i32]* %2 to i8*
%5 = call i32 @fexpect(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 161, i32 2, i32 2)
%6 = call i32 @fexpect(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 162, i32 3, i32 3)
ret void
}

LLVM IR (-O2):
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/initializer.c\00"
define void @test_typedef() {
%1 = tail call i32 @fexpect(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 161, i32 2, i32 2)
%2 = tail call i32 @fexpect(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 162, i32 3, i32 3)
ret void
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int y = __VERIFIER_nondet_int();
  while (y >= 0 && y <= 10) {
    y = (2 * y + 1) / 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1142 <main+0x32>
cmpl   $0xa,-0x8(%rbp)
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1152 <main+0x42>
jmp    116b <main+0x5b>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1129 <main+0x19>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %3, i32* %2
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 10
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ false, %4 ], [ %9, %7 ]
br i1 %11, label %12, label %17
12: ; preds = %10
%13 = load i32, i32* %2
%14 = mul nsw i32 2, %13
%15 = add nsw i32 %14, 1
%16 = sdiv i32 %15, 2
store i32 %16, i32* %2
br label %4
17: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}
/* Variables and functions */
int rand();
void wo_non_short_circuit() {
  int a, b;
  a = rand();
  b = rand();
  if ((a < b) && (b > a)) {
    a += b;
    return;
  }
  b += a;
  return;
}


x86 assembly (clang, -O0):
<wo_non_short_circuit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1152 <wo_non_short_circuit+0x42>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    1152 <wo_non_short_circuit+0x42>
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115b <wo_non_short_circuit+0x4b>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wo_non_short_circuit>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <rand@plt>

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

LLVM IR (-O2):
define void @wo_non_short_circuit() {
%1 = tail call i32 (...) @rand()
%2 = tail call i32 (...) @rand()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ BLE_1_bless_isr_Enable();
void CyBleHal_EnableGlobalInterrupts(void) { BLE_1_bless_isr_Enable(); }


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

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

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

LLVM IR (-O2):
define void @CyBleHal_EnableGlobalInterrupts() {
%1 = tail call i32 (...) @BLE_1_bless_isr_Enable()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rcu_quiescent_state();
void rcu_thread_online(void) { rcu_quiescent_state(); }


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

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

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

LLVM IR (-O2):
define void @rcu_thread_online() {
%1 = tail call i32 (...) @rcu_quiescent_state()
ret void
}
/* Variables and functions */
int print_bus_fetch(char *, char const *, int);
int /*<<< orphan*/ strconcat(char *, char const *, char const *, int);
int print_bus_fetch_(const char *func, const char *str, const char *val,
                     int size) {
  char prefix[(100)];
  strconcat(prefix, func, str, (100));
  return print_bus_fetch(prefix, val, size);
}


x86 assembly (clang, -O0):
<print_bus_fetch_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x64,%ecx
call   1030 <strconcat@plt>
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <print_bus_fetch@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bus_fetch_>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x64,%ecx
call   1030 <strconcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <print_bus_fetch@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @print_bus_fetch_(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [100 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = call i32 @strconcat(i8* %10, i8* %11, i8* %12, i32 100)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = load i32, i32* %8
%17 = call i32 @print_bus_fetch(i8* %14, i8* %15, i32 %16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @print_bus_fetch_(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%7 = call i32 @strconcat(i8* %6, i8* %0, i8* %1, i32 100)
%8 = call i32 @print_bus_fetch(i8* %6, i8* %2, i32 %3)
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ mpfr_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ ***malloc(int);
void arr_alloc_2d(const size_t x, const size_t y, mpfr_t (**aptr)[x][y]) {
  *aptr = malloc(sizeof(mpfr_t[x][y]));
  assert(*aptr != NULL);
}


x86 assembly (clang, -O0):
<arr_alloc_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arr_alloc_2d>:
push   %rbx
mov    %rdx,%rbx
imul   %esi,%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
mov    %rax,(%rbx)
xor    %edi,%edi
test   %rax,%rax
setne  %dil
pop    %rbx
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @arr_alloc_2d(i64 %0, i64 %1, i32** %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32**
store i64 %0, i64* %4
store i64 %1, i64* %5
store i32** %2, i32*** %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = load i64, i64* %4
%10 = load i64, i64* %5
%11 = mul nuw i64 %9, %10
%12 = mul nuw i64 4, %11
%13 = trunc i64 %12 to i32
%14 = call i32*** @malloc(i32 %13)
%15 = bitcast i32*** %14 to i32*
%16 = load i32**, i32*** %6
store i32* %15, i32** %16
%17 = load i32**, i32*** %6
%18 = load i32*, i32** %17
%19 = icmp ne i32* %18, null
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
ret void
}

LLVM IR (-O2):
define void @arr_alloc_2d(i64 %0, i64 %1, i32** nocapture writeonly %2) {
%4 = mul nuw i64 %1, %0
%5 = trunc i64 %4 to i32
%6 = shl i32 %5, 2
%7 = tail call i32*** @malloc(i32 %6)
%8 = bitcast i32** %2 to i32****
store i32*** %7, i32**** %8
%9 = icmp ne i32*** %7, null
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
typedef scalar_t__ int64_t;

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int64_t epoch_time() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return tv.tv_sec * 1000000 + tv.tv_usec;
}


x86 assembly (clang, -O0):
<epoch_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x10(%rbp),%eax
cltq
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epoch_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @epoch_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000000
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add nsw i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @epoch_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %9, %7
ret i64 %10
}
/* Variables and functions */
int __infer_nondet_int();
int /*<<< orphan*/ __require_allocated_array(char *);
int sprintf(char *s, const char *format, ...) {
  int res;
  __require_allocated_array(s);
  res = __infer_nondet_int();
  if (res < 0)
    while (1)
      ;
  return res;
}


x86 assembly (clang, -O0):
<sprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <__require_allocated_array@plt>
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1157 <sprintf+0x37>
jmp    1152 <sprintf+0x32>
jmp    1152 <sprintf+0x32>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprintf>:
push   %rax
call   1040 <__require_allocated_array@plt>
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
test   %eax,%eax
js     1140 <sprintf+0x20>
pop    %rcx
ret
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
jmp    1140 <sprintf+0x20>

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

LLVM IR (-O2):
define i32 @sprintf(i8* %0, i8* nocapture readnone %1, ...) {
%3 = tail call i32 @__require_allocated_array(i8* %0)
%4 = tail call i32 (...) @__infer_nondet_int()
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %2, %6
br label %6
7: ; preds = %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
void start_test_msg(const char *test_name) {
  printf("\nTEST: %s\n", test_name);
  printf("================\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<start_test_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_test_msg>:
push   %rax
mov    %rdi,%rsi
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"\0ATEST: %s\0A\00"
@.str.1 = [18 x i8] c"================\0A\00"
@stdout = global i32 0
define void @start_test_msg(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @stdout
%7 = call i32 @fflush(i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\0ATEST: %s\0A\00"
@stdout = global i32 0
@str = [17 x i8] c"================\00"
define void @start_test_msg(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
ret void
}
int rtw_android_wifictrl_func_add(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @rtw_android_wifictrl_func_add() {
ret i32 0
}

LLVM IR (-O2):
define i32 @rtw_android_wifictrl_func_add() {
ret i32 0
}
/* Variables and functions */
char *strdup(char const *);
char *_mosquitto_strdup(const char *s) {
  char *str = strdup(s);
  return str;
}


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

x86 assembly (clang, -O2):
<_mosquitto_strdup>:
jmp    1030 <strdup@plt>

LLVM IR (-O0):
define i8* @_mosquitto_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @_mosquitto_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, void *, size_t const);
size_t min_sz(int /*<<< orphan*/, size_t);
int /*<<< orphan*/ range_sz(char *, char *);
size_t raw_write_buf(char **buf_pos, char *buf_end, void *buf, size_t byte_sz) {
  const size_t n = min_sz(range_sz(*buf_pos, buf_end), byte_sz);
  memcpy(*buf_pos, buf, n);
  *buf_pos += n;
  return n;
}


x86 assembly (clang, -O0):
<raw_write_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <range_sz@plt>
mov    %eax,%edi
mov    -0x20(%rbp),%rsi
call   1050 <min_sz@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x28(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_write_buf>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rdi,%r12
mov    (%rdi),%rdi
call   1030 <range_sz@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1050 <min_sz@plt>
mov    %rax,%rbx
mov    (%r12),%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <memcpy@plt>
add    %rbx,(%r12)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @raw_write_buf(i8** nocapture %0, i8* %1, i8* %2, i64 %3) {
%5 = load i8*, i8** %0
%6 = tail call i32 @range_sz(i8* %5, i8* %1)
%7 = tail call i64 @min_sz(i32 %6, i64 %3)
%8 = load i8*, i8** %0
%9 = tail call i32 @memcpy(i8* %8, i8* %2, i64 %7)
%10 = load i8*, i8** %0
%11 = getelementptr inbounds i8, i8* %10, i64 %7
store i8* %11, i8** %0
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ log_message(char *, char const *, char const *);
int write_string(int, char *, char const *);
bool report_error(int scon, const char *client_name,
                  const char *error_message) {
  log_message("Client %s error sent: %s", client_name, error_message);
  return write_string(scon, "%s\n", error_message);
}


x86 assembly (clang, -O0):
<report_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xebe(%rip),%rdi
call   1040 <log_message@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rdx
lea    0xec4(%rip),%rsi
call   1030 <write_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_error>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %edi,%ebp
lea    0xed1(%rip),%rdi
call   1040 <log_message@plt>
lea    0xede(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write_string@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Client %s error sent: %s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @report_error(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %6
%9 = call i32 @log_message(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%10 = load i32, i32* %4
%11 = load i8*, i8** %6
%12 = call i32 @write_string(i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
ret i32 %12
}

LLVM IR (-O2):
@.str = [25 x i8] c"Client %s error sent: %s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @report_error(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 @log_message(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
%5 = tail call i32 @write_string(i32 %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 %5
}
int execute_cacheflush() { return 0; }


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

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

LLVM IR (-O0):
define i32 @execute_cacheflush() {
ret i32 0
}

LLVM IR (-O2):
define i32 @execute_cacheflush() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int /*<<< orphan*/);
int beginsWith(char *line, char *str) {
  return strncmp(line, str, strlen(str)) == 0;
}


x86 assembly (clang, -O0):
<beginsWith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<beginsWith>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @beginsWith(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i64 @strncmp(i8* %5, i8* %6, i32 %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @beginsWith(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
int f3(int x, int y) { return (x & ~0xffff) | (y & 0xffff); }


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff0000,%eax
mov    -0x8(%rbp),%ecx
and    $0xffff,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
and    $0xffff0000,%edi
movzwl %si,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @f3(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 = and i32 %5, -65536
%7 = load i32, i32* %4
%8 = and i32 %7, 65535
%9 = or i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @f3(i32 %0, i32 %1) {
%3 = and i32 %0, -65536
%4 = and i32 %1, 65535
%5 = or i32 %4, %3
ret i32 %5
}