xunge/DecIR huggingface dataset:
unsigned ring_space_contig(unsigned size, unsigned head, unsigned tail) {
  if (head >= tail)
    return (tail ? size : size - 1) - head;
  else
    return tail - head - 1;
}


x86 assembly (clang, -O0):
<ring_space_contig>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jb     1145 <ring_space_contig+0x45>
cmpl   $0x0,-0x10(%rbp)
je     112e <ring_space_contig+0x2e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <ring_space_contig+0x37>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <ring_space_contig+0x51>
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ring_space_contig>:
cmp    %esi,%edx
jbe    110b <ring_space_contig+0xb>
not    %esi
add    %edx,%esi
mov    %esi,%eax
ret
mov    %edi,%eax
cmp    $0x1,%edx
sbb    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @ring_space_contig(i32 %0, i32 %1, i32 %2) {
%4 = icmp ugt i32 %2, %1
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = icmp eq i32 %2, 0
%7 = sext i1 %6 to i32
%8 = sub i32 %0, %1
%9 = add i32 %8, %7
br label %13
10: ; preds = %3
%11 = xor i32 %1, -1
%12 = add i32 %11, %2
br label %13
13: ; preds = %10, %5
%14 = phi i32 [ %9, %5 ], [ %12, %10 ]
ret i32 %14
}
/* Variables and functions */
int similarityscore(char, char);
int characterscore(char charx, char chary) {
  if (charx == chary) {
    return 10;
  } else if (chary == '*') {
    return 8;
  } else {
    return similarityscore(charx, chary);
  }
}


x86 assembly (clang, -O0):
<characterscore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jne    1140 <characterscore+0x30>
movl   $0xa,-0x4(%rbp)
jmp    116b <characterscore+0x5b>
movsbl -0x6(%rbp),%eax
cmp    $0x2a,%eax
jne    1159 <characterscore+0x49>
movl   $0x8,-0x4(%rbp)
jmp    116b <characterscore+0x5b>
mov    -0x5(%rbp),%al
movsbl %al,%edi
movsbl -0x6(%rbp),%esi
call   1030 <similarityscore@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<characterscore>:
mov    $0xa,%eax
cmp    %sil,%dil
je     1125 <characterscore+0x15>
mov    $0x8,%eax
cmp    $0x2a,%sil
jne    1126 <characterscore+0x16>
ret
movsbl %dil,%edi
movsbl %sil,%esi
jmp    1030 <similarityscore@plt>

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

LLVM IR (-O2):
define i32 @characterscore(i8 signext %0, i8 signext %1) {
%3 = icmp eq i8 %0, %1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = icmp eq i8 %1, 42
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @similarityscore(i8 signext %0, i8 signext %1)
br label %8
8: ; preds = %4, %2, %6
%9 = phi i32 [ %7, %6 ], [ 10, %2 ], [ 8, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ __hexdump(int /*<<< orphan*/, void const *, size_t, size_t);
void hexdump(const void *data, size_t length, size_t flags) {
  __hexdump(0, data, length, flags);
}


x86 assembly (clang, -O0):
<hexdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
call   1030 <__hexdump@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexdump>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <__hexdump@plt>

LLVM IR (-O0):
define void @hexdump(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i64, i64* %6
%10 = call i32 @__hexdump(i32 0, i8* %7, i64 %8, i64 %9)
ret void
}

LLVM IR (-O2):
define void @hexdump(i8* %0, i64 %1, i64 %2) {
%4 = tail call i32 @__hexdump(i32 0, i8* %0, i64 %1, i64 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct bladerf {
  int dummy;
};

/* Variables and functions */
int nios_32x32_masked_read(struct bladerf *, int, int, int /*<<< orphan*/ *);
int nios_expansion_gpio_read(struct bladerf *dev, uint32_t *val) {
  int status = nios_32x32_masked_read(dev, 0x00, 0xffffffff, val);
  if (status == 0) {
    do {
      do {
      } while (0);
    } while (0);
  }
  return status;
}


x86 assembly (clang, -O0):
<nios_expansion_gpio_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1030 <nios_32x32_masked_read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    115a <nios_expansion_gpio_read+0x4a>
jmp    1146 <nios_expansion_gpio_read+0x36>
jmp    114b <nios_expansion_gpio_read+0x3b>
jmp    1150 <nios_expansion_gpio_read+0x40>
jmp    1155 <nios_expansion_gpio_read+0x45>
jmp    115a <nios_expansion_gpio_read+0x4a>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nios_expansion_gpio_read>:
mov    %rsi,%rcx
xor    %esi,%esi
mov    $0xffffffff,%edx
jmp    1030 <nios_32x32_masked_read@plt>

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

LLVM IR (-O2):
%struct.bladerf = type { i32 }
define i32 @nios_expansion_gpio_read(%struct.bladerf* %0, i32* %1) {
%3 = tail call i32 @nios_32x32_masked_read(%struct.bladerf* %0, i32 0, i32 -1, i32* %1)
ret i32 %3
}
/* Variables and functions */
double pow(int, double);
double absmag_to_flux(double mag) { return pow(10, -mag / 2.5); }


x86 assembly (clang, -O0):
<absmag_to_flux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xebf(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<absmag_to_flux>:
divsd  0xee8(%rip),%xmm0
mov    $0xa,%edi
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @absmag_to_flux(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fneg double %3
%5 = fdiv double %4, 2.500000e+00
%6 = call double @pow(i32 10, double %5)
ret double %6
}

LLVM IR (-O2):
define double @absmag_to_flux(double %0) {
%2 = fdiv double %0, -2.500000e+00
%3 = tail call double @pow(i32 10, double %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ write_imm(int);
int /*<<< orphan*/ write_instr(int);
int gui_handler(char **save) {
  write_instr(0x00);
  write_imm(0xE3);
  write_instr(0x28);
  return 0;
}


x86 assembly (clang, -O0):
<gui_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1040 <write_instr@plt>
mov    $0xe3,%edi
call   1030 <write_imm@plt>
mov    $0x28,%edi
call   1040 <write_instr@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_handler>:
push   %rax
xor    %edi,%edi
call   1040 <write_instr@plt>
mov    $0xe3,%edi
call   1030 <write_imm@plt>
mov    $0x28,%edi
call   1040 <write_instr@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gui_handler(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @write_instr(i32 0)
%4 = call i32 @write_imm(i32 227)
%5 = call i32 @write_instr(i32 40)
ret i32 0
}

LLVM IR (-O2):
define i32 @gui_handler(i8** nocapture readnone %0) {
%2 = tail call i32 @write_instr(i32 0)
%3 = tail call i32 @write_imm(i32 227)
%4 = tail call i32 @write_instr(i32 40)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void v(int b, int a, int j) {
  printf("\33[%d;%df\33[4%d"
         "m  ",
         a, b, j);
}


x86 assembly (clang, -O0):
<v>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [17 x i8] c"\1B[%d;%df\1B[4%dm \00"
define void @v(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* %5
%8 = load i32, i32* %4
%9 = load i32, i32* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"\1B[%d;%df\1B[4%dm \00"
define void @v(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0, i32 %2)
ret void
}
char *test(char *str) {
  int i = 0;
  char tok[20];
  int type;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @test(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [20 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @test(i8* nocapture readnone %0) {
ret i8* undef
}
/* Variables and functions */
void OPENSSL_cleanse(void *p, size_t len) {}


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

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

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

LLVM IR (-O2):
define void @OPENSSL_cleanse(i8* nocapture %0, i64 %1) {
ret void
}
void init_board(int board[14][20]) {
  int i, j;
  for (i = 0; i < 14; i++) {
    for (j = 0; j < 20; j++) {
      board[i][j] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<init_board>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xe,-0xc(%rbp)
jge    1165 <init_board+0x65>
movl   $0x0,-0x10(%rbp)
cmpl   $0x14,-0x10(%rbp)
jge    1152 <init_board+0x52>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1120 <init_board+0x20>
jmp    1157 <init_board+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <init_board+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_board>:
push   %rax
mov    $0x460,%edx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @init_board([20 x i32]* nocapture writeonly %0) {
%2 = bitcast [20 x i32]* %0 to i8*
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int div16(int x) {
  int bias = (1 << 4) - 1;
  int sign = (unsigned)x >> 31;
  printf("%d\n", sign);
  printf("bias is %d\n", bias);
  printf("temp is %d\n", x + bias);
  return (x + bias) >> 4;
}


x86 assembly (clang, -O0):
<div16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xf,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1f,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
add    -0x8(%rbp),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sar    $0x4,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<div16>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%esi
shr    $0x1f,%esi
lea    0xef5(%rip),%rdi
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
add    $0xf,%ebx
lea    0xecd(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
sar    $0x4,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [12 x i8] c"bias is %d\0A\00"
@.str.2 = [12 x i8] c"temp is %d\0A\00"
define i32 @div16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 15, i32* %3
%5 = load i32, i32* %2
%6 = lshr i32 %5, 31
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = add nsw i32 %11, %12
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = add nsw i32 %15, %16
%18 = ashr i32 %17, 4
ret i32 %18
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [12 x i8] c"bias is %d\0A\00"
@.str.2 = [12 x i8] c"temp is %d\0A\00"
define i32 @div16(i32 %0) {
%2 = lshr i32 %0, 31
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 15)
%5 = add nsw i32 %0, 15
%6 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = ashr i32 %5, 4
ret i32 %7
}
long pathconf(char *path, int name) { return 0; }


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

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

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

LLVM IR (-O2):
define i64 @pathconf(i8* nocapture readnone %0, i32 %1) {
ret i64 0
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int lstat(char *, struct stat *);
int sr_fileexists(char *path) {
  struct stat st;
  int rc = lstat(path, &st);
  return rc == 0;
}


x86 assembly (clang, -O0):
<sr_fileexists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <lstat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sr_fileexists>:
push   %rax
mov    %rsp,%rsi
call   1030 <lstat@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @sr_fileexists(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @lstat(i8* %5, %struct.stat* %3)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @sr_fileexists(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @lstat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ math_triangulation_init();
void math_init() { math_triangulation_init(); }


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

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

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

LLVM IR (-O2):
define void @math_init() {
%1 = tail call i32 (...) @math_triangulation_init()
ret void
}
void flushpackets() {}


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

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

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

LLVM IR (-O2):
define void @flushpackets() {
ret void
}
int ellipse_pid(int selected_radius, int current_rudder_angle) { return 0; }


x86 assembly (clang, -O0):
<ellipse_pid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ellipse_pid(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sys_puts(char *);
int main(void) {
  char *kernel = (char *)0xFFFFFFF800000000;
  sys_puts("before write\n");
  kernel[0] = 'x';
  sys_puts("after write");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0xfffffff800000000,%rax
ff ff ff
mov    %rax,-0x10(%rbp)
lea    0xecc(%rip),%rdi
call   1030 <sys_puts@plt>
mov    -0x10(%rbp),%rax
movb   $0x78,(%rax)
lea    0xec7(%rip),%rdi
call   1030 <sys_puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <sys_puts@plt>
movabs $0xfffffff800000000,%rax
ff ff ff
movb   $0x78,(%rax)
lea    0xedd(%rip),%rdi
call   1030 <sys_puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"before write\0A\00"
@.str.1 = [12 x i8] c"after write\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* inttoptr (i64 -34359738368 to i8*), i8** %2
%3 = call i32 @sys_puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
store i8 120, i8* %5
%6 = call i32 @sys_puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"before write\0A\00"
@.str.1 = [12 x i8] c"after write\00"
define i32 @main() {
%1 = tail call i32 @sys_puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i8 120, i8* inttoptr (i64 -34359738368 to i8*)
%2 = tail call i32 @sys_puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct pattern {
  int dummy;
};

/* Variables and functions */
int does_attack(int, int);
int offset(int, int /*<<< orphan*/, int, int);
int autohelperowl_attackpat223(struct pattern *patt, int transformation,
                               int move, int color, int action) {
  int A;
  (void)patt;
  (void)color;
  (void)action;
  A = offset(1, 0, move, transformation);
  return does_attack(move, A);
}


x86 assembly (clang, -O0):
<autohelperowl_attackpat223>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <offset@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <does_attack@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<autohelperowl_attackpat223>:
push   %rbx
mov    %edx,%ebx
mov    %esi,%ecx
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <offset@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <does_attack@plt>

LLVM IR (-O0):
%struct.pattern = type { i32 }
define i32 @autohelperowl_attackpat223(%struct.pattern* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.pattern*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store %struct.pattern* %0, %struct.pattern** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load %struct.pattern*, %struct.pattern** %6
%13 = load i32, i32* %9
%14 = load i32, i32* %10
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = call i32 @offset(i32 1, i32 0, i32 %15, i32 %16)
store i32 %17, i32* %11
%18 = load i32, i32* %8
%19 = load i32, i32* %11
%20 = call i32 @does_attack(i32 %18, i32 %19)
ret i32 %20
}

LLVM IR (-O2):
%struct.pattern = type { i32 }
define i32 @autohelperowl_attackpat223(%struct.pattern* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @offset(i32 1, i32 0, i32 %2, i32 %1)
%7 = tail call i32 @does_attack(i32 %2, i32 %6)
ret i32 %7
}
int do_593() { return 593; }


x86 assembly (clang, -O0):
<do_593>:
push   %rbp
mov    %rsp,%rbp
mov    $0x251,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @do_593() {
ret i32 593
}

LLVM IR (-O2):
define i32 @do_593() {
ret i32 593
}
/* Variables and functions */
int nrf_read_register(int, char *, char *);
int nrf_write_register(int, char, char *);
int nrf_clear_rx_dr(char *retstatus) {
  int ret;
  char statusreg;
  ret = nrf_read_register(0x07, &statusreg, retstatus);
  if (ret < 0)
    return ret;
  statusreg |= 0x40;
  ret = nrf_write_register(0x07, statusreg, retstatus);
  return ret;
}


x86 assembly (clang, -O0):
<nrf_clear_rx_dr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    $0x7,%edi
lea    -0x15(%rbp),%rsi
call   1040 <nrf_read_register@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1156 <nrf_clear_rx_dr+0x36>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117d <nrf_clear_rx_dr+0x5d>
movsbl -0x15(%rbp),%eax
or     $0x40,%eax
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
mov    -0x10(%rbp),%rdx
mov    $0x7,%edi
movsbl %al,%esi
call   1030 <nrf_write_register@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf_clear_rx_dr>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xf(%rsp),%rsi
mov    $0x7,%edi
mov    %rbx,%rdx
call   1040 <nrf_read_register@plt>
test   %eax,%eax
js     1158 <nrf_clear_rx_dr+0x38>
movsbl 0xf(%rsp),%esi
or     $0x40,%esi
mov    %sil,0xf(%rsp)
mov    $0x7,%edi
mov    %rbx,%rdx
call   1030 <nrf_write_register@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @nrf_clear_rx_dr(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @nrf_read_register(i32 7, i8* %5, i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32, i32* %4
store i32 %11, i32* %2
br label %21
12: ; preds = %1
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = or i32 %14, 64
%16 = trunc i32 %15 to i8
store i8 %16, i8* %5
%17 = load i8, i8* %5
%18 = load i8*, i8** %3
%19 = call i32 @nrf_write_register(i32 7, i8 signext %17, i8* %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
store i32 %20, i32* %2
br label %21
21: ; preds = %12, %10
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @nrf_clear_rx_dr(i8* %0) {
%2 = alloca i8
%3 = call i32 @nrf_read_register(i32 7, i8* %2, i8* %0)
%4 = icmp slt i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = load i8, i8* %2
%7 = or i8 %6, 64
store i8 %7, i8* %2
%8 = call i32 @nrf_write_register(i32 7, i8 signext %7, i8* %0)
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ %3, %1 ]
ret i32 %10
}
OP(dd, fa) { op_fa(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_fa()
ret i32 undef
}
/* Type definitions */
struct sil_rb_path {
  int dummy;
};
struct sil_rb_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ insert(struct sil_rb_path *, int, struct sil_rb_head *);
void sil_rb_insert(struct sil_rb_path *path, int dir,
                   struct sil_rb_head *child) {
  insert(path, dir, child);
}


x86 assembly (clang, -O0):
<sil_rb_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <insert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sil_rb_insert>:
jmp    1030 <insert@plt>

LLVM IR (-O0):
%struct.sil_rb_path = type { i32 }
%struct.sil_rb_head = type { i32 }
define void @sil_rb_insert(%struct.sil_rb_path* %0, i32 %1, %struct.sil_rb_head* %2) {
%4 = alloca %struct.sil_rb_path*
%5 = alloca i32
%6 = alloca %struct.sil_rb_head*
store %struct.sil_rb_path* %0, %struct.sil_rb_path** %4
store i32 %1, i32* %5
store %struct.sil_rb_head* %2, %struct.sil_rb_head** %6
%7 = load %struct.sil_rb_path*, %struct.sil_rb_path** %4
%8 = load i32, i32* %5
%9 = load %struct.sil_rb_head*, %struct.sil_rb_head** %6
%10 = call i32 @insert(%struct.sil_rb_path* %7, i32 %8, %struct.sil_rb_head* %9)
ret void
}

LLVM IR (-O2):
%struct.sil_rb_path = type { i32 }
%struct.sil_rb_head = type { i32 }
define void @sil_rb_insert(%struct.sil_rb_path* %0, i32 %1, %struct.sil_rb_head* %2) {
%4 = tail call i32 @insert(%struct.sil_rb_path* %0, i32 %1, %struct.sil_rb_head* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SA1Direct(int);
int /*<<< orphan*/ STY16(int /*<<< orphan*/, int);
void Op84X0(void) { STY16(SA1Direct(2), 0xFFFF); }


x86 assembly (clang, -O0):
<Op84X0>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1040 <SA1Direct@plt>
mov    %eax,%edi
mov    $0xffff,%esi
call   1030 <STY16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op84X0>:
push   %rax
mov    $0x2,%edi
call   1040 <SA1Direct@plt>
mov    %eax,%edi
mov    $0xffff,%esi
pop    %rax
jmp    1030 <STY16@plt>

LLVM IR (-O0):
define void @Op84X0() {
%1 = call i32 @SA1Direct(i32 2)
%2 = call i32 @STY16(i32 %1, i32 65535)
ret void
}

LLVM IR (-O2):
define void @Op84X0() {
%1 = tail call i32 @SA1Direct(i32 2)
%2 = tail call i32 @STY16(i32 %1, i32 65535)
ret void
}
/* Variables and functions */
int atoll(char *);
int /*<<< orphan*/ auto_read_file(char *, char **, size_t *);
char *strstr(char *, char *);
size_t fscache_dirty() {
  static char *buf = NULL;
  static size_t len = 16 * 1024;
  auto_read_file("/proc/meminfo", &buf, &len);
  char *line = strstr(buf, "Dirty:");
  line += sizeof("Dirty:");
  return atoll(line) * 1000;
}


x86 assembly (clang, -O0):
<fscache_dirty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0x2f02(%rip),%rsi
lea    0x2eeb(%rip),%rdx
call   1030 <auto_read_file@plt>
mov    0x2eef(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <atoll@plt>
imul   $0x3e8,%eax,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fscache_dirty>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x2f09(%rip),%rsi
lea    0x2ef2(%rip),%rdx
call   1030 <auto_read_file@plt>
mov    0x2ef6(%rip),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <strstr@plt>
lea    0x7(%rax),%rdi
call   1040 <atoll@plt>
imul   $0x3e8,%eax,%eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
@fscache_dirty.buf = internal global i8* null
@fscache_dirty.len = internal global i64 16384
@.str = [14 x i8] c"/proc/meminfo\00"
@.str.1 = [7 x i8] c"Dirty:\00"
define i64 @fscache_dirty() {
%1 = alloca i8*
%2 = call i32 @auto_read_file(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** @fscache_dirty.buf, i64* @fscache_dirty.len)
%3 = load i8*, i8** @fscache_dirty.buf
%4 = call i8* @strstr(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = getelementptr inbounds i8, i8* %5, i64 7
store i8* %6, i8** %1
%7 = load i8*, i8** %1
%8 = call i32 @atoll(i8* %7)
%9 = mul nsw i32 %8, 1000
%10 = sext i32 %9 to i64
ret i64 %10
}

LLVM IR (-O2):
@fscache_dirty.buf = internal global i8* null
@fscache_dirty.len = internal global i64 16384
@.str = [14 x i8] c"/proc/meminfo\00"
@.str.1 = [7 x i8] c"Dirty:\00"
define i64 @fscache_dirty() {
%1 = tail call i32 @auto_read_file(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** @fscache_dirty.buf, i64* @fscache_dirty.len)
%2 = load i8*, i8** @fscache_dirty.buf
%3 = tail call i8* @strstr(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds i8, i8* %3, i64 7
%5 = tail call i32 @atoll(i8* %4)
%6 = mul nsw i32 %5, 1000
%7 = sext i32 %6 to i64
ret i64 %7
}
int cli_present(Name)
char *Name;
{
  struct {
    int Size;
    char *Ptr;
  } Descr;
  Descr.Ptr = Name;
  Descr.Size = strlen(Name);
  return ((cli$present(&Descr) & 1) ? 1 : 0);
}


x86 assembly (clang, -O0):
<cli_present>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <cli$present@plt>
mov    %eax,%edx
and    $0x1,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_present>:
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
call   1030 <strlen@plt>
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1040 <cli$present@plt>
and    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.anon = type { i32, i8* }
define i32 @cli_present(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.anon
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds %struct.anon, %struct.anon* %3, i32 0, i32 1
store i8* %4, i8** %5
%6 = load i8*, i8** %2
%7 = call i64 @strlen(i8* %6)
%8 = trunc i64 %7 to i32
%9 = getelementptr inbounds %struct.anon, %struct.anon* %3, i32 0, i32 0
store i32 %8, i32* %9
%10 = call i32 (%struct.anon*, ...) bitcast (i32 (...)* @"cli$present" to i32 (%struct.anon*, ...)*)(%struct.anon* %3)
%11 = and i32 %10, 1
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
ret i32 %14
}

LLVM IR (-O2):
%struct.anon = type { i32, i8* }
define i32 @cli_present(i8* %0) {
%2 = alloca %struct.anon
%3 = bitcast %struct.anon* %2 to i8*
%4 = getelementptr inbounds %struct.anon, %struct.anon* %2, i64 0, i32 1
store i8* %0, i8** %4
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = trunc i64 %5 to i32
%7 = getelementptr inbounds %struct.anon, %struct.anon* %2, i64 0, i32 0
store i32 %6, i32* %7
%8 = call i32 (%struct.anon*, ...) bitcast (i32 (...)* @"cli$present" to i32 (%struct.anon*, ...)*)(%struct.anon* %2)
%9 = and i32 %8, 1
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
char *read_uint32(char *buf, uint32_t *val) {
  uint32_t tmp = ntohl(*((uint32_t *)buf));
  memcpy(val, &tmp, 4);
  return buf + 4;
}


x86 assembly (clang, -O0):
<read_uint32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1040 <ntohl@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_uint32>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1040 <ntohl@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
add    $0x4,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @read_uint32(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = call i32 @ntohl(i32 %8)
store i32 %9, i32* %5
%10 = load i32*, i32** %4
%11 = call i32 @memcpy(i32* %10, i32* %5, i32 4)
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 4
ret i8* %13
}

LLVM IR (-O2):
define i8* @read_uint32(i8* %0, i32* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = tail call i32 @ntohl(i32 %6)
store i32 %7, i32* %3
%8 = call i32 @memcpy(i32* %1, i32* %3, i32 4)
%9 = getelementptr inbounds i8, i8* %0, i64 4
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ swap(char *, char *);
void swap32(void *v) {
  char *b = (char *)v;
  swap(b, b + 3);
  swap(b + 1, b + 2);
}


x86 assembly (clang, -O0):
<swap32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x3,%rsi
call   1030 <swap@plt>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
add    $0x2,%rsi
call   1030 <swap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap32>:
push   %rbx
mov    %rdi,%rbx
lea    0x3(%rdi),%rsi
call   1030 <swap@plt>
lea    0x1(%rbx),%rdi
add    $0x2,%rbx
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <swap@plt>

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

LLVM IR (-O2):
define void @swap32(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = tail call i32 @swap(i8* %0, i8* %2)
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = tail call i32 @swap(i8* %4, i8* %5)
ret void
}
int ZeroIntegerDenseVector(q_p, nzq_p)
int *q_p;
int *nzq_p;
{
  int *q_ps;
  q_ps = q_p + *nzq_p;
  for (; q_p < q_ps; q_p++)
    *q_p = 0;
  return 0;
}


x86 assembly (clang, -O0):
<ZeroIntegerDenseVector>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    114b <ZeroIntegerDenseVector+0x4b>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    1122 <ZeroIntegerDenseVector+0x22>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZeroIntegerDenseVector>:
push   %rax
mov    (%rsi),%eax
test   %eax,%eax
jle    113f <ZeroIntegerDenseVector+0x2f>
lea    (%rdi,%rax,4),%rax
lea    0x4(%rdi),%rcx
cmp    %rcx,%rax
cmova  %rax,%rcx
mov    %rdi,%rax
not    %rax
lea    (%rcx,%rax,1),%rdx
add    $0x4,%rdx
and    $0xfffffffffffffffc,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @ZeroIntegerDenseVector(i32* writeonly %0, i32* nocapture %1) {
%3 = ptrtoint i32* %0 to i64
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = zext i32 %4 to i64
%8 = bitcast i32* %0 to i8*
%9 = shl nuw nsw i64 %7, 2
%10 = add i64 %9, %3
%11 = add i64 %3, 4
%12 = call i64 @llvm.umax.i64(i64 %10, i64 %11)
%13 = xor i64 %3, -1
%14 = add i64 %12, %13
%15 = add i64 %14, 4
%16 = and i64 %15, -4
br label %17
17: ; preds = %6, %2
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assertTrue(char *, int);
void test_primitive_cast() {
  uint32_t endian;
  endian = 1;
  int little = ((*((unsigned char *)(&endian))) != 0);
  assertTrue("little == 1", little == 1);
  ;
}


x86 assembly (clang, -O0):
<test_primitive_cast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movzbl -0x4(%rbp),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xebc(%rip),%rdi
call   1030 <assertTrue@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_primitive_cast>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
jmp    1030 <assertTrue@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"little == 1\00"
define void @test_primitive_cast() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
%3 = bitcast i32* %1 to i8*
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
%10 = zext i1 %9 to i32
%11 = call i32 @assertTrue(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"little == 1\00"
define void @test_primitive_cast() {
%1 = tail call i32 @assertTrue(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isascii(int);
void t_isascii_0x32() {
  Assert_real((isascii(50)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isascii.c",
              255, ("isascii should be 1 for 2"));
}


x86 assembly (clang, -O0):
<t_isascii_0x32>:
push   %rbp
mov    %rsp,%rbp
mov    $0x32,%edi
call   1030 <isascii@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0xff,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isascii_0x32>:
lea    0xee9(%rip),%rsi
lea    0xf8a(%rip),%rcx
mov    $0x1,%edi
mov    $0xff,%edx
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [26 x i8] c"isascii should be 1 for 2\00"
define void @t_isascii_0x32() {
%1 = call i32 @isascii(i32 50)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 255, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [26 x i8] c"isascii should be 1 for 2\00"
define void @t_isascii_0x32() {
%1 = tail call i32 @Assert_real(i32 1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 255, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void initBitmap(void) {}


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

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

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

LLVM IR (-O2):
define void @initBitmap() {
ret void
}
/* Variables and functions */
int read_open_flag(char *);
char *strtok(char *, char *);
int read_open_flags(char *str) {
  int flags = 0;
  char *s = NULL;
  s = strtok(str, "|");
  while (s) {
    flags |= read_open_flag(s);
    s = strtok(NULL, "|");
  }
  return flags;
}


x86 assembly (clang, -O0):
<read_open_flags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1182 <read_open_flags+0x62>
mov    -0x18(%rbp),%rdi
call   1030 <read_open_flag@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe8c(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x18(%rbp)
jmp    114f <read_open_flags+0x2f>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_open_flags>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rsi
call   1040 <strtok@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1159 <read_open_flags+0x39>
lea    0xec2(%rip),%r14
xchg   %ax,%ax
mov    %rax,%rdi
call   1030 <read_open_flag@plt>
or     %eax,%ebx
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
jne    1140 <read_open_flags+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"|\00"
define i32 @read_open_flags(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
store i8* null, i8** %4
%5 = load i8*, i8** %2
%6 = call i8* @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %4
br label %7
7: ; preds = %10, %1
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = load i8*, i8** %4
%12 = call i32 @read_open_flag(i8* %11)
%13 = load i32, i32* %3
%14 = or i32 %13, %12
store i32 %14, i32* %3
%15 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %15, i8** %4
br label %7
16: ; preds = %7
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [2 x i8] c"|\00"
define i32 @read_open_flags(i8* %0) {
%2 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %9, %4 ], [ %2, %1 ]
%6 = phi i32 [ %8, %4 ], [ 0, %1 ]
%7 = tail call i32 @read_open_flag(i8* %5)
%8 = or i32 %7, %6
%9 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
int hrtime_is_present(void) {
  struct stat tmp;
  if (stat("/proc/self/hrtime", &tmp) == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<hrtime_is_present>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jne    113e <hrtime_is_present+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1145 <hrtime_is_present+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hrtime_is_present>:
push   %rax
lea    0xee8(%rip),%rdi
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [18 x i8] c"/proc/self/hrtime\00"
define i32 @hrtime_is_present() {
%1 = alloca i32
%2 = alloca %struct.stat
%3 = call i64 @stat(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 1, i32* %1
br label %7
6: ; preds = %0
store i32 0, i32* %1
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [18 x i8] c"/proc/self/hrtime\00"
define i32 @hrtime_is_present() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i64 @stat(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void NV21ToARGBRow_Any_NEON() {}


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

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

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

LLVM IR (-O2):
define void @NV21ToARGBRow_Any_NEON() {
ret void
}