xunge/DecIR huggingface dataset:
/* Variables and functions */
char *_strerror_r(int, int /*<<< orphan*/, int /*<<< orphan*/);
char *strerror(int errnum) { return _strerror_r(errnum, 0, 0); }


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

x86 assembly (clang, -O2):
<strerror>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <_strerror_r@plt>

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

LLVM IR (-O2):
define i8* @strerror(i32 %0) {
%2 = tail call i8* @_strerror_r(i32 %0, i32 0, i32 0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ hook(char *);
void shutdown(void) { hook("shutdown() called inside missing-export."); }


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

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

LLVM IR (-O0):
@.str = [41 x i8] c"shutdown() called inside missing-export.\00"
define void @shutdown() {
%1 = call i32 @hook(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"shutdown() called inside missing-export.\00"
define void @shutdown() {
%1 = tail call i32 @hook(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned int spi_transfer16(volatile unsigned int *base, unsigned int val) {
  *(base + (4 + 1)) = val;
  return *(base + (4 + 1));
}


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

x86 assembly (clang, -O2):
<spi_transfer16>:
mov    %esi,0x14(%rdi)
mov    0x14(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @spi_transfer16(i32* %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 5
store volatile i32 %1, i32* %3
%4 = load volatile i32, i32* %3
ret i32 %4
}
/* Type definitions */
typedef float int32_t;

/* Variables and functions */
float fabsfk(float);
__attribute__((always_)) const float ptruncf(float x) {
  return fabsfk(x) >= (float)(1LL << 23) ? x : (x - (x - (int32_t)x));
}


x86 assembly (clang, -O0):
<ptruncf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabsfk@plt>
movss  0xed1(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1147 <ptruncf+0x37>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    115f <ptruncf+0x4f>
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptruncf>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1030 <fabsfk@plt>
movss  0x4(%rsp),%xmm3
movaps %xmm3,%xmm1
subss  %xmm3,%xmm1
movss  0xecf(%rip),%xmm2
cmpnless %xmm0,%xmm2
andps  %xmm1,%xmm2
subss  %xmm2,%xmm3
movaps %xmm3,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @ptruncf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @fabsfk(float %3)
%5 = fcmp oge float %4, 0x4160000000000000
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load float, float* %2
br label %14
8: ; preds = %1
%9 = load float, float* %2
%10 = load float, float* %2
%11 = load float, float* %2
%12 = fsub float %10, %11
%13 = fsub float %9, %12
br label %14
14: ; preds = %8, %6
%15 = phi float [ %7, %6 ], [ %13, %8 ]
ret float %15
}

LLVM IR (-O2):
define float @ptruncf(float %0) {
%2 = tail call float @fabsfk(float %0)
%3 = fcmp ult float %2, 0x4160000000000000
%4 = fsub float %0, %0
%5 = select i1 %3, float %4, float 0.000000e+00
%6 = fsub float %0, %5
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void MMX_PUNPCKHDQ(int dst_reg, int src_reg) {
  addbyte(0x66);
  addbyte(0x0f);
  addbyte(0x62);
  addbyte(0xc0 | (dst_reg << 3) | src_reg);
  addbyte(0x66);
  addbyte(0x0f);
  addbyte(0x70);
  addbyte(0xc0 | (dst_reg << 3) | dst_reg);
  addbyte(0x0e);
}


x86 assembly (clang, -O0):
<MMX_PUNPCKHDQ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0x62,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0xc0,%edi
or     -0x8(%rbp),%edi
call   1030 <addbyte@plt>
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0x70,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0xc0,%edi
or     -0x4(%rbp),%edi
call   1030 <addbyte@plt>
mov    $0xe,%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMX_PUNPCKHDQ>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %edi,%r14d
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0x62,%edi
call   1030 <addbyte@plt>
mov    %r14d,%ebx
or     $0x18,%ebx
shl    $0x3,%ebx
or     %ebx,%ebp
mov    %ebp,%edi
call   1030 <addbyte@plt>
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0x70,%edi
call   1030 <addbyte@plt>
or     %r14d,%ebx
mov    %ebx,%edi
call   1030 <addbyte@plt>
mov    $0xe,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @MMX_PUNPCKHDQ(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 102)
%6 = call i32 @addbyte(i32 15)
%7 = call i32 @addbyte(i32 98)
%8 = load i32, i32* %3
%9 = shl i32 %8, 3
%10 = or i32 192, %9
%11 = load i32, i32* %4
%12 = or i32 %10, %11
%13 = call i32 @addbyte(i32 %12)
%14 = call i32 @addbyte(i32 102)
%15 = call i32 @addbyte(i32 15)
%16 = call i32 @addbyte(i32 112)
%17 = load i32, i32* %3
%18 = shl i32 %17, 3
%19 = or i32 192, %18
%20 = load i32, i32* %3
%21 = or i32 %19, %20
%22 = call i32 @addbyte(i32 %21)
%23 = call i32 @addbyte(i32 14)
ret void
}

LLVM IR (-O2):
define void @MMX_PUNPCKHDQ(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 102)
%4 = tail call i32 @addbyte(i32 15)
%5 = tail call i32 @addbyte(i32 98)
%6 = shl i32 %0, 3
%7 = or i32 %6, 192
%8 = or i32 %7, %1
%9 = tail call i32 @addbyte(i32 %8)
%10 = tail call i32 @addbyte(i32 102)
%11 = tail call i32 @addbyte(i32 15)
%12 = tail call i32 @addbyte(i32 112)
%13 = or i32 %7, %0
%14 = tail call i32 @addbyte(i32 %13)
%15 = tail call i32 @addbyte(i32 14)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fd_ssd1315_write_command(int);
void fd_ssd1315_display_off(void) { fd_ssd1315_write_command(0xae); }


x86 assembly (clang, -O0):
<fd_ssd1315_display_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0xae,%edi
call   1030 <fd_ssd1315_write_command@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_ssd1315_display_off>:
mov    $0xae,%edi
jmp    1030 <fd_ssd1315_write_command@plt>

LLVM IR (-O0):
define void @fd_ssd1315_display_off() {
%1 = call i32 @fd_ssd1315_write_command(i32 174)
ret void
}

LLVM IR (-O2):
define void @fd_ssd1315_display_off() {
%1 = tail call i32 @fd_ssd1315_write_command(i32 174)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fexpect(char *, int, int /*<<< orphan*/, int);
void empty_struct() {
  struct tag15 {};
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c",
          308, 0, sizeof(struct tag15));
  ;
  union tag16 {};
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c",
          310, 0, sizeof(union tag16));
  ;
}


x86 assembly (clang, -O0):
<empty_struct>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x134,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <fexpect@plt>
lea    0xed0(%rip),%rdi
mov    $0x136,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <fexpect@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<empty_struct>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x134,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0x136,%esi
xor    %edx,%edx
xor    %ecx,%ecx
pop    %rbx
jmp    1030 <fexpect@plt>

LLVM IR (-O0):
@.str = [129 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/struct.c\00"
define void @empty_struct() {
%1 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 308, i32 0, i32 0)
%2 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 310, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [129 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/struct.c\00"
define void @empty_struct() {
%1 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 308, i32 0, i32 0)
%2 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 310, i32 0, i32 0)
ret void
}
int test_imm_2Fuint16_mem(unsigned short *val) {
  return ((*val) & (-0x2F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_2Fuint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -47
%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_2Fuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -47
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int digits_in_int(int i) {
  int digits = 0;
  do {
    digits++;
    i /= 10;
  } while (i > 0);
  return digits;
}


x86 assembly (clang, -O0):
<digits_in_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     110e <digits_in_int+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digits_in_int>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%eax
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
cmp    $0x9,%ecx
jg     1110 <digits_in_int+0x10>
ret

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

LLVM IR (-O2):
define i32 @digits_in_int(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %6, %2 ]
%4 = phi i32 [ 0, %1 ], [ %5, %2 ]
%5 = add nuw nsw i32 %4, 1
%6 = sdiv i32 %3, 10
%7 = icmp sgt i32 %3, 9
br i1 %7, label %2, label %8
8: ; preds = %2
ret i32 %5
}
int a_twist_d_on_eflip(eflip)
int eflip;
{
  int temp_arr[12];
  a_eflip_unpack(eflip, temp_arr);
  four_cycle(temp_arr, 7, 6, 5, 4);
  return a_eflip_pack(temp_arr);
}


x86 assembly (clang, -O0):
<a_twist_d_on_eflip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1030 <a_eflip_unpack@plt>
lea    -0x40(%rbp),%rdi
mov    $0x7,%esi
mov    $0x6,%edx
mov    $0x5,%ecx
mov    $0x4,%r8d
mov    $0x0,%al
call   1040 <four_cycle@plt>
lea    -0x40(%rbp),%rdi
mov    $0x0,%al
call   1050 <a_eflip_pack@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_twist_d_on_eflip>:
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <a_eflip_unpack@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x6,%edx
mov    $0x5,%ecx
mov    $0x4,%r8d
xor    %eax,%eax
call   1040 <four_cycle@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <a_eflip_pack@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @a_twist_d_on_eflip(i32 %0) {
%2 = alloca i32
%3 = alloca [12 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 0
%6 = call i32 (i32, i32*, ...) bitcast (i32 (...)* @a_eflip_unpack to i32 (i32, i32*, ...)*)(i32 %4, i32* %5)
%7 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 0
%8 = call i32 (i32*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @four_cycle to i32 (i32*, i32, i32, i32, i32, ...)*)(i32* %7, i32 7, i32 6, i32 5, i32 4)
%9 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 0
%10 = call i32 (i32*, ...) bitcast (i32 (...)* @a_eflip_pack to i32 (i32*, ...)*)(i32* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @a_twist_d_on_eflip(i32 %0) {
%2 = alloca [12 x i32]
%3 = bitcast [12 x i32]* %2 to i8*
%4 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 0
%5 = call i32 (i32, i32*, ...) bitcast (i32 (...)* @a_eflip_unpack to i32 (i32, i32*, ...)*)(i32 %0, i32* %4)
%6 = call i32 (i32*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @four_cycle to i32 (i32*, i32, i32, i32, i32, ...)*)(i32* %4, i32 7, i32 6, i32 5, i32 4)
%7 = call i32 (i32*, ...) bitcast (i32 (...)* @a_eflip_pack to i32 (i32*, ...)*)(i32* %4)
ret i32 %7
}
/* Variables and functions */
double sqrt(int /*<<< orphan*/);
int /*<<< orphan*/ variance(double *);
double standard_deviation(double input[100]) { return sqrt(variance(input)); }


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

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

LLVM IR (-O0):
define double @standard_deviation(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = call i32 @variance(double* %3)
%5 = call double @sqrt(i32 %4)
ret double %5
}

LLVM IR (-O2):
define double @standard_deviation(double* %0) {
%2 = tail call i32 @variance(double* %0)
%3 = tail call double @sqrt(i32 %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
void finalize_stack(char *text_section) {
  char *prologo = (char *)malloc(sizeof(char) * 100);
  sprintf(prologo, "\tmov esp, ebp\n\tpop ebp\n");
  strcat(text_section, prologo);
  free(prologo);
}


x86 assembly (clang, -O0):
<finalize_stack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<finalize_stack>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
movabs $0xa70626520706f,%rax
mov    %rax,0x10(%rbx)
movups 0xea7(%rip),%xmm0
movups %xmm0,(%rbx)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\09mov esp, ebp\0A\09pop ebp\0A\00"
define void @finalize_stack(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i64 @malloc(i32 100)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = load i8*, i8** %3
%10 = call i32 @strcat(i8* %8, i8* %9)
%11 = load i8*, i8** %3
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"\09mov esp, ebp\0A\09pop ebp\0A\00"
define void @finalize_stack(i8* %0) {
%2 = tail call i64 @malloc(i32 100)
%3 = inttoptr i64 %2 to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(24) %3, i8* align 1 dereferenceable(24) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 24, i1 false)
%4 = tail call i32 @strcat(i8* %0, i8* %3)
%5 = tail call i32 @free(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
unsigned long FanChannelDutyGet(unsigned long ulBase, unsigned long ulChannel) {
  unsigned long ulDuty;
  DEBUG_ASSERT(ulBase == 0x40084000);
  DEBUG_ASSERT(ulChannel < 6);
  ulDuty = (*((volatile unsigned long *)(ulBase + 0x00000014 +
                                         (ulChannel * 0x10)))) &
           0x01FF0000;
  ulDuty >>= 16;
  return (ulDuty);
}


x86 assembly (clang, -O0):
<FanChannelDutyGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x40084000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
cmpq   $0x6,-0x10(%rbp)
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
add    $0x14,%rax
mov    -0x10(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
and    $0x1ff0000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shr    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FanChannelDutyGet>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x40084000,%r14
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x6,%rbx
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
shl    $0x4,%rbx
mov    0x14(%r14,%rbx,1),%rax
shr    $0x10,%eax
and    $0x1ff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @FanChannelDutyGet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = icmp eq i64 %6, 1074282496
%8 = zext i1 %7 to i32
%9 = call i32 @DEBUG_ASSERT(i32 %8)
%10 = load i64, i64* %4
%11 = icmp ult i64 %10, 6
%12 = zext i1 %11 to i32
%13 = call i32 @DEBUG_ASSERT(i32 %12)
%14 = load i64, i64* %3
%15 = add i64 %14, 20
%16 = load i64, i64* %4
%17 = mul i64 %16, 16
%18 = add i64 %15, %17
%19 = inttoptr i64 %18 to i64*
%20 = load volatile i64, i64* %19
%21 = and i64 %20, 33488896
store i64 %21, i64* %5
%22 = load i64, i64* %5
%23 = lshr i64 %22, 16
store i64 %23, i64* %5
%24 = load i64, i64* %5
ret i64 %24
}

LLVM IR (-O2):
define i64 @FanChannelDutyGet(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 1074282496
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = icmp ult i64 %1, 6
%7 = zext i1 %6 to i32
%8 = tail call i32 @DEBUG_ASSERT(i32 %7)
%9 = add i64 %0, 20
%10 = shl i64 %1, 4
%11 = add i64 %9, %10
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = lshr i64 %13, 16
%15 = and i64 %14, 511
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int unbox_int(int *i) {
  int ret = *i;
  free(i);
  return ret;
}


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

x86 assembly (clang, -O2):
<unbox_int>:
push   %rbx
mov    (%rdi),%ebx
call   1030 <free@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @unbox_int(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
%6 = load i32*, i32** %2
%7 = call i32 @free(i32* %6)
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @unbox_int(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @free(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fexpect(char *, int, int, int);
void t6a(int e, int x[][3]) {
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/array.c",
          45, e, *(*(x + 1) + 1));
  ;
}


x86 assembly (clang, -O0):
<t6a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%ecx
lea    0xed0(%rip),%rdi
mov    $0x2d,%esi
call   1030 <fexpect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t6a>:
mov    %edi,%edx
mov    0x10(%rsi),%ecx
lea    0xee4(%rip),%rdi
mov    $0x2d,%esi
jmp    1030 <fexpect@plt>

LLVM IR (-O0):
@.str = [128 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/array.c\00"
define void @t6a(i32 %0, [3 x i32]* %1) {
%3 = alloca i32
%4 = alloca [3 x i32]*
store i32 %0, i32* %3
store [3 x i32]* %1, [3 x i32]** %4
%5 = load i32, i32* %3
%6 = load [3 x i32]*, [3 x i32]** %4
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 1
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = call i32 @fexpect(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str, i64 0, i64 0), i32 45, i32 %5, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [128 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/array.c\00"
define void @t6a(i32 %0, [3 x i32]* nocapture %1) {
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 1, i64 1
%4 = load i32, i32* %3
%5 = tail call i32 @fexpect(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str, i64 0, i64 0), i32 45, i32 %0, i32 %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int wait4(int /*<<< orphan*/, int *, int, int /*<<< orphan*/ *);
int sys_waitpid(pid_t pid, int *status, int options) {
  return wait4(pid, status, options, NULL);
}


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

x86 assembly (clang, -O2):
<sys_waitpid>:
xor    %ecx,%ecx
jmp    1030 <wait4@plt>

LLVM IR (-O0):
define i32 @sys_waitpid(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32*, i32** %5
%9 = load i32, i32* %6
%10 = call i32 @wait4(i32 %7, i32* %8, i32 %9, i32* null)
ret i32 %10
}

LLVM IR (-O2):
define i32 @sys_waitpid(i32 %0, i32* %1, i32 %2) {
%4 = tail call i32 @wait4(i32 %0, i32* %1, i32 %2, i32* null)
ret i32 %4
}
/* Variables and functions */
scalar_t__ dataIsLittleEndian();
unsigned short swab16(unsigned short);
scalar_t__ systemIsLittleEndian();
unsigned short fix_short(unsigned short us) {
  return (dataIsLittleEndian() != systemIsLittleEndian()) ? swab16(us) : us;
}


x86 assembly (clang, -O0):
<fix_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    $0x0,%al
call   1030 <dataIsLittleEndian@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <systemIsLittleEndian@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     1175 <fix_short+0x45>
movzwl -0x2(%rbp),%edi
call   1040 <swab16@plt>
movzwl %ax,%eax
mov    %eax,-0x14(%rbp)
jmp    117c <fix_short+0x4c>
movzwl -0x2(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
movzwl %ax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_short>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <dataIsLittleEndian@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <systemIsLittleEndian@plt>
cmp    %rax,%rbx
jne    1154 <fix_short+0x24>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
movzwl %bp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <swab16@plt>

LLVM IR (-O0):
define zeroext i16 @fix_short(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = call i64 (...) @dataIsLittleEndian()
%4 = call i64 (...) @systemIsLittleEndian()
%5 = icmp ne i64 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i16, i16* %2
%8 = call zeroext i16 @swab16(i16 zeroext %7)
%9 = zext i16 %8 to i32
br label %13
10: ; preds = %1
%11 = load i16, i16* %2
%12 = zext i16 %11 to i32
br label %13
13: ; preds = %10, %6
%14 = phi i32 [ %9, %6 ], [ %12, %10 ]
%15 = trunc i32 %14 to i16
ret i16 %15
}

LLVM IR (-O2):
define zeroext i16 @fix_short(i16 zeroext %0) {
%2 = tail call i64 (...) @dataIsLittleEndian()
%3 = tail call i64 (...) @systemIsLittleEndian()
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call zeroext i16 @swab16(i16 zeroext %0)
br label %7
7: ; preds = %1, %5
%8 = phi i16 [ %6, %5 ], [ %0, %1 ]
ret i16 %8
}
/* Variables and functions */
scalar_t__ prefix(char *, char *);
bool matches(char *tok, char *min, char *full) {
  return prefix(min, tok) && prefix(tok, full);
}


x86 assembly (clang, -O0):
<matches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <prefix@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x19(%rbp)
je     115a <matches+0x4a>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <prefix@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matches>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1030 <prefix@plt>
test   %rax,%rax
je     1142 <matches+0x32>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <prefix@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
jmp    1144 <matches+0x34>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @matches(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %4
%9 = call i64 @prefix(i8* %7, i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = load i8*, i8** %4
%13 = load i8*, i8** %6
%14 = call i64 @prefix(i8* %12, i8* %13)
%15 = icmp ne i64 %14, 0
br label %16
16: ; preds = %11, %3
%17 = phi i1 [ false, %3 ], [ %15, %11 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @matches(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @prefix(i8* %1, i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i64 @prefix(i8* %0, i8* %2)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ 0, %3 ], [ %9, %6 ]
ret i32 %11
}
extern void crash(void) {
  void (*die)() = (void (*)())(0x0000dead);
  die();
}


x86 assembly (clang, -O0):
<crash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xdead,%eax
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crash>:
mov    $0xdead,%ecx
xor    %eax,%eax
jmp    *%rcx

LLVM IR (-O0):
define void @crash() {
%1 = alloca void (...)*
store void (...)* inttoptr (i64 57005 to void (...)*), void (...)** %1
%2 = load void (...)*, void (...)** %1
ret void
}

LLVM IR (-O2):
define void @crash() {
tail call void (...) inttoptr (i64 57005 to void (...)*)()
ret void
}
/* Type definitions */
typedef int uid_t;

/* Variables and functions */
int /*<<< orphan*/ setuid(int);
int main() {
  uid_t uid = 1000;
  setuid(uid);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @setuid(i32 1000)
ret i32 0
}
/* Variables and functions */
int sysCall(int, int /*<<< orphan*/, unsigned long, int);
int outbyte(unsigned char c) { return sysCall(4, 0, (unsigned long)&c, 1); }


x86 assembly (clang, -O0):
<outbyte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    -0x1(%rbp),%rdx
mov    $0x4,%edi
xor    %esi,%esi
mov    $0x1,%ecx
call   1030 <sysCall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outbyte>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rdx
mov    $0x4,%edi
xor    %esi,%esi
mov    $0x1,%ecx
call   1030 <sysCall@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @outbyte(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = ptrtoint i8* %2 to i64
%4 = call i32 @sysCall(i32 4, i32 0, i64 %3, i32 1)
ret i32 %4
}

LLVM IR (-O2):
define i32 @outbyte(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = ptrtoint i8* %2 to i64
%4 = call i32 @sysCall(i32 4, i32 0, i64 %3, i32 1)
ret i32 %4
}
/* Variables and functions */
int getStringFromFile_n(char *, char *, char *, int);
int strtol(char *, int /*<<< orphan*/ *, int);
int getIntFromFile(char *file, char *name) {
  int val = 0;
  char value_string[255];
  if (getStringFromFile_n(file, name, value_string, 255) == -1 ||
      value_string == NULL)
    return -1;
  val = strtol(value_string, NULL, 10);
  return val;
}


x86 assembly (clang, -O0):
<getIntFromFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x120(%rbp),%rdx
mov    $0xff,%ecx
call   1030 <getStringFromFile_n@plt>
cmp    $0xffffffff,%eax
jne    1168 <getIntFromFile+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    1186 <getIntFromFile+0x66>
lea    -0x120(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getIntFromFile>:
sub    $0x108,%rsp
mov    %rsp,%rdx
mov    $0xff,%ecx
call   1030 <getStringFromFile_n@plt>
cmp    $0xffffffff,%eax
je     1150 <getIntFromFile+0x30>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
add    $0x108,%rsp
ret
mov    $0xffffffff,%eax
add    $0x108,%rsp
ret

LLVM IR (-O0):
define i32 @getIntFromFile(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [255 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%11 = call i32 @getStringFromFile_n(i8* %8, i8* %9, i8* %10, i32 255)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %18
14: ; preds = %2
%15 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%16 = call i32 @strtol(i8* %15, i32* null, i32 10)
store i32 %16, i32* %6
%17 = load i32, i32* %6
store i32 %17, i32* %3
br label %18
18: ; preds = %14, %13
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @getIntFromFile(i8* %0, i8* %1) {
%3 = alloca [255 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%5 = call i32 @getStringFromFile_n(i8* %0, i8* %1, i8* %4, i32 255)
%6 = icmp eq i32 %5, -1
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 @strtol(i8* nocapture %4, i32* null, i32 10)
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ %8, %7 ], [ -1, %2 ]
ret i32 %10
}
void RTSha256Init(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSha256Init() {
ret void
}
/* Variables and functions */
scalar_t__ sknobs_file_exists(char *);
int sknobs_load_file(char *);
int sknobs_load_file_if_exists(char *filename) {
  if (sknobs_file_exists(filename))
    return sknobs_load_file(filename);
  return 0;
}


x86 assembly (clang, -O0):
<sknobs_load_file_if_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sknobs_file_exists@plt>
cmp    $0x0,%rax
je     1150 <sknobs_load_file_if_exists+0x30>
mov    -0x10(%rbp),%rdi
call   1040 <sknobs_load_file@plt>
mov    %eax,-0x4(%rbp)
jmp    1157 <sknobs_load_file_if_exists+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sknobs_load_file_if_exists>:
push   %rbx
mov    %rdi,%rbx
call   1030 <sknobs_file_exists@plt>
test   %rax,%rax
je     1137 <sknobs_load_file_if_exists+0x17>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <sknobs_load_file@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @sknobs_load_file_if_exists(i8* %0) {
%2 = tail call i64 @sknobs_file_exists(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @sknobs_load_file(i8* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t crcByte(uint16_t crc, uint8_t b) {
  crc = (uint8_t)(crc >> 8) | (crc << 8);
  crc ^= b;
  crc ^= (uint8_t)(crc & 0xff) >> 4;
  crc ^= crc << 12;
  crc ^= (crc & 0xff) << 5;
  return crc;
}


x86 assembly (clang, -O0):
<crcByte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
sar    $0x4,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xc,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x5,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<crcByte>:
mov    %edi,%eax
sar    $0x8,%eax
shl    $0x8,%edi
or     %eax,%edi
xor    %esi,%edi
mov    %edi,%eax
shr    $0x4,%eax
and    $0xf,%eax
xor    %edi,%eax
mov    %eax,%ecx
shl    $0xc,%ecx
xor    %eax,%ecx
movzbl %al,%eax
shl    $0x5,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @crcByte(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 = ashr i32 %5, 8
%7 = load i32, i32* %3
%8 = shl i32 %7, 8
%9 = or i32 %6, %8
store i32 %9, i32* %3
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = xor i32 %11, %10
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = and i32 %13, 255
%15 = ashr i32 %14, 4
%16 = load i32, i32* %3
%17 = xor i32 %16, %15
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = shl i32 %18, 12
%20 = load i32, i32* %3
%21 = xor i32 %20, %19
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = and i32 %22, 255
%24 = shl i32 %23, 5
%25 = load i32, i32* %3
%26 = xor i32 %25, %24
store i32 %26, i32* %3
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @crcByte(i32 %0, i32 %1) {
%3 = ashr i32 %0, 8
%4 = shl i32 %0, 8
%5 = or i32 %3, %4
%6 = xor i32 %5, %1
%7 = lshr i32 %6, 4
%8 = and i32 %7, 15
%9 = xor i32 %8, %6
%10 = shl i32 %9, 12
%11 = xor i32 %10, %9
%12 = shl i32 %9, 5
%13 = and i32 %12, 8160
%14 = xor i32 %11, %13
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
unsigned int getc(int /*<<< orphan*/ *);
unsigned int get_trash_size(FILE *input_file) {
  unsigned int trash_size = (0);
  unsigned int first_byte;
  fseek(input_file, (0), SEEK_SET);
  first_byte = getc(input_file);
  trash_size = (unsigned int)(first_byte >> (8 - 3));
  return (trash_size);
}


x86 assembly (clang, -O0):
<get_trash_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea2(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shr    $0x5,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_trash_size>:
push   %rbx
mov    %rdi,%rbx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <fseek@plt>
mov    %rbx,%rdi
call   1040 <getc@plt>
shr    $0x5,%eax
pop    %rbx
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
define i32 @get_trash_size(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%5 = load i32*, i32** %2
%6 = load i32, i32* @SEEK_SET
%7 = call i32 @fseek(i32* %5, i32 0, i32 %6)
%8 = load i32*, i32** %2
%9 = call i32 @getc(i32* %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = lshr i32 %10, 5
store i32 %11, i32* %3
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define i32 @get_trash_size(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_SET
%3 = tail call i32 @fseek(i32* %0, i32 0, i32 %2)
%4 = tail call i32 @getc(i32* %0)
%5 = lshr i32 %4, 5
ret i32 %5
}
/* Variables and functions */
double bar(double *, double *, int);
double foo(double *__restrict a, double *__restrict b, int n) {
  return bar(a, b, n);
}


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

x86 assembly (clang, -O2):
<foo>:
jmp    1030 <bar@plt>

LLVM IR (-O0):
define double @foo(double* noalias %0, double* noalias %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load double*, double** %5
%9 = load i32, i32* %6
%10 = call double @bar(double* %7, double* %8, i32 %9)
ret double %10
}

LLVM IR (-O2):
define double @foo(double* noalias %0, double* noalias %1, i32 %2) {
%4 = tail call double @bar(double* %0, double* %1, i32 %2)
ret double %4
}
void lgtd_router_device_list_free(struct lgtd_router_device_list *devices) {
  (void)devices;
}


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

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

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

LLVM IR (-O2):
%struct.lgtd_router_device_list = type opaque
define void @lgtd_router_device_list_free(%struct.lgtd_router_device_list* nocapture %0) {
ret void
}
/* Type definitions */
struct ring {
  int dummy;
};

/* Variables and functions */
unsigned int ring_avail(struct ring *);
unsigned int ring_writereverse(struct ring *, void *, unsigned int);
unsigned int ring_writeallreverse(struct ring *ring, void *buffer,
                                  unsigned int count) {
  if (count > ring_avail(ring))
    return 0;
  return ring_writereverse(ring, buffer, count);
}


x86 assembly (clang, -O0):
<ring_writeallreverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ring_avail@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jbe    115b <ring_writeallreverse+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    116e <ring_writeallreverse+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <ring_writereverse@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ring_writeallreverse>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <ring_avail@plt>
cmp    %ebp,%eax
jae    113c <ring_writeallreverse+0x1c>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <ring_writereverse@plt>

LLVM IR (-O0):
%struct.ring = type { i32 }
define i32 @ring_writeallreverse(%struct.ring* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.ring*
%6 = alloca i8*
%7 = alloca i32
store %struct.ring* %0, %struct.ring** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = load %struct.ring*, %struct.ring** %5
%10 = call i32 @ring_avail(%struct.ring* %9)
%11 = icmp ugt i32 %8, %10
br i1 %11, label %12, label %13
12: ; preds = %3
store i32 0, i32* %4
br label %18
13: ; preds = %3
%14 = load %struct.ring*, %struct.ring** %5
%15 = load i8*, i8** %6
%16 = load i32, i32* %7
%17 = call i32 @ring_writereverse(%struct.ring* %14, i8* %15, i32 %16)
store i32 %17, i32* %4
br label %18
18: ; preds = %13, %12
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
%struct.ring = type { i32 }
define i32 @ring_writeallreverse(%struct.ring* %0, i8* %1, i32 %2) {
%4 = tail call i32 @ring_avail(%struct.ring* %0)
%5 = icmp ult i32 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @ring_writereverse(%struct.ring* %0, i8* %1, i32 %2)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %7, %6 ], [ 0, %3 ]
ret i32 %9
}
/* Variables and functions */
char *getStr(char *);
int main(void) {
  char *abc = "abc";
  char *new_str;
  new_str = getStr(abc);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <getStr@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = load i8*, i8** %1
%4 = call i8* @getStr(i8* %3)
store i8* %4, i8** %2
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
define i32 @main() {
%1 = tail call i8* @getStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int big(char *a, char *b) {
  while (*a && *a++ == *b++)
    ;
  return *(--a) - *(--b);
}


x86 assembly (clang, -O0):
<big>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     114d <big+0x4d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115d <big+0x5d>
jmp    1162 <big+0x62>
jmp    110c <big+0xc>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x8(%rbp)
movsbl -0x1(%rax),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
movsbl -0x1(%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<big>:
movzbl (%rdi),%eax
test   %al,%al
je     1118 <big+0x18>
add    $0x1,%rdi
lea    0x1(%rsi),%rcx
cmp    (%rsi),%al
mov    %rcx,%rsi
je     1100 <big>
jmp    111b <big+0x1b>
mov    %rsi,%rcx
movsbl -0x1(%rdi),%eax
movsbl -0x1(%rcx),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @big(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %22, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = sext i8 %13 to i32
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %4
%17 = load i8, i8* %15
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %14, %18
br label %20
20: ; preds = %10, %5
%21 = phi i1 [ false, %5 ], [ %19, %10 ]
br i1 %21, label %22, label %23
22: ; preds = %20
br label %5
23: ; preds = %20
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i32 -1
store i8* %25, i8** %3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i32 -1
store i8* %29, i8** %4
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = sub nsw i32 %27, %31
ret i32 %32
}

LLVM IR (-O2):
define i32 @big(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = phi i8* [ %1, %2 ], [ %10, %8 ]
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = load i8, i8* %5
%12 = icmp eq i8 %6, %11
br i1 %12, label %3, label %13
13: ; preds = %3, %8
%14 = phi i8* [ %9, %8 ], [ %4, %3 ]
%15 = phi i8* [ %10, %8 ], [ %5, %3 ]
%16 = getelementptr inbounds i8, i8* %14, i64 -1
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = getelementptr inbounds i8, i8* %15, i64 -1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %18, %21
ret i32 %22
}