xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ putchar(char);
void print_start_page() {
  char c;
  FILE *start_pg = fopen("./mathserve/start.html", "r");
  while ((c = fgetc(start_pg)) != EOF)
    putchar(c);
}


x86 assembly (clang, -O0):
<print_start_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%eax
mov    0x2e83(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     117e <print_start_page+0x4e>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
jmp    114f <print_start_page+0x1f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_start_page>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <fgetc@plt>
mov    0x2e8f(%rip),%r14
cmp    (%r14),%al
je     1175 <print_start_page+0x45>
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    (%r14),%al
jne    1160 <print_start_page+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"./mathserve/start.html\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
define void @print_start_page() {
%1 = alloca i8
%2 = alloca i32*
%3 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
br label %4
4: ; preds = %11, %0
%5 = load i32*, i32** %2
%6 = call signext i8 @fgetc(i32* %5)
store i8 %6, i8* %1
%7 = sext i8 %6 to i32
%8 = load i8, i8* @EOF
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i8, i8* %1
%13 = call i32 @putchar(i8 signext %12)
br label %4
14: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"./mathserve/start.html\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
define void @print_start_page() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call signext i8 @fgetc(i32* %1)
%3 = load i8, i8* @EOF
%4 = icmp eq i8 %2, %3
br i1 %4, label %11, label %5
5: ; preds = %0, %5
%6 = phi i8 [ %8, %5 ], [ %2, %0 ]
%7 = tail call i32 @putchar(i8 signext %6)
%8 = tail call signext i8 @fgetc(i32* %1)
%9 = load i8, i8* @EOF
%10 = icmp eq i8 %8, %9
br i1 %10, label %11, label %5
11: ; preds = %5, %0
ret void
}
int blanc(int b) {
  int reff = 80;
  if (b < reff)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<blanc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x50,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1126 <blanc+0x26>
movl   $0x0,-0x4(%rbp)
jmp    112d <blanc+0x2d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<blanc>:
xor    %eax,%eax
cmp    $0x50,%edi
setge  %al
ret

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

LLVM IR (-O2):
define i32 @blanc(i32 %0) {
%2 = icmp sgt i32 %0, 79
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_query_sender_privilege(void *call, int capability) {
  return -EINVAL;
}


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

x86 assembly (clang, -O2):
<sd_bus_query_sender_privilege>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_query_sender_privilege(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_query_sender_privilege(i8* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ clear();
void fixup() { clear(); }


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

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

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

LLVM IR (-O2):
define void @fixup() {
%1 = tail call i32 (...) @clear()
ret void
}
void foo140(int p) {}


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

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

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

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

/* Variables and functions */
uint32_t shash(const char *s) {
  uint32_t v = 5381;
  if (s) {
    while (*s)
      v = (v << 5) + v + (*s++);
  }
  return v;
}


x86 assembly (clang, -O0):
<shash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1505,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1156 <shash+0x56>
jmp    111f <shash+0x1f>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1151 <shash+0x51>
mov    -0xc(%rbp),%eax
shl    $0x5,%eax
add    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <shash+0x1f>
jmp    1156 <shash+0x56>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shash>:
mov    $0x1505,%eax
test   %rdi,%rdi
je     1137 <shash+0x37>
mov    (%rdi),%cl
test   %cl,%cl
je     1137 <shash+0x37>
add    $0x1,%rdi
mov    $0x1505,%eax
nopl   0x0(%rax)
mov    %eax,%edx
shl    $0x5,%edx
add    %eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1120 <shash+0x20>
ret

LLVM IR (-O0):
define i32 @shash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 5381, i32* %3
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %22
6: ; preds = %1
br label %7
7: ; preds = %11, %6
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = load i32, i32* %3
%13 = shl i32 %12, 5
%14 = load i32, i32* %3
%15 = add nsw i32 %13, %14
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
%18 = load i8, i8* %16
%19 = sext i8 %18 to i32
%20 = add nsw i32 %15, %19
store i32 %20, i32* %3
br label %7
21: ; preds = %7
br label %22
22: ; preds = %21, %1
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @shash(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %14, %6 ], [ %4, %3 ]
%8 = phi i32 [ %13, %6 ], [ 5381, %3 ]
%9 = phi i8* [ %11, %6 ], [ %0, %3 ]
%10 = mul i32 %8, 33
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = sext i8 %7 to i32
%13 = add nsw i32 %10, %12
%14 = load i8, i8* %11
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6, %3, %1
%17 = phi i32 [ 5381, %1 ], [ 5381, %3 ], [ %13, %6 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void local_client_destroy(int fd) { close(fd); }


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

x86 assembly (clang, -O2):
<local_client_destroy>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @local_client_destroy(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
int np2(int x) {
  x -= 1;
  x |= x >> 1;
  x |= x >> 2;
  x |= x >> 4;
  x |= x >> 8;
  x |= x >> 16;
  return x + 1;
}


x86 assembly (clang, -O0):
<np2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<np2>:
lea    -0x1(%rdi),%eax
mov    %eax,%ecx
sar    %ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x2,%eax
or     %ecx,%eax
mov    %eax,%ecx
sar    $0x4,%ecx
or     %eax,%ecx
mov    %ecx,%edx
sar    $0x8,%edx
or     %ecx,%edx
mov    %edx,%eax
sar    $0x10,%eax
or     %edx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @np2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 1
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = ashr i32 %9, 2
%11 = load i32, i32* %2
%12 = or i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = ashr i32 %13, 4
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = ashr i32 %17, 8
%19 = load i32, i32* %2
%20 = or i32 %19, %18
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = ashr i32 %21, 16
%23 = load i32, i32* %2
%24 = or i32 %23, %22
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
ret i32 %26
}

LLVM IR (-O2):
define i32 @np2(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = ashr i32 %2, 1
%4 = or i32 %3, %2
%5 = ashr i32 %4, 2
%6 = or i32 %5, %4
%7 = ashr i32 %6, 4
%8 = or i32 %7, %6
%9 = ashr i32 %8, 8
%10 = or i32 %9, %8
%11 = ashr i32 %10, 16
%12 = or i32 %11, %10
%13 = add nsw i32 %12, 1
ret i32 %13
}
double douMin(double i, double j) { return i < j ? i : j; }


x86 assembly (clang, -O0):
<douMin>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <douMin+0x31>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113b <douMin+0x3b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<douMin>:
minsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @douMin(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @douMin(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
float *ajMemCalloc(size_t, int, char *, int, int /*<<< orphan*/);
float *ajMemArrF(size_t size) {
  return ajMemCalloc((size), (sizeof(float)),
                     "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/kimrutherford/EMBOSS/"
                     "refs/heads/master/ajax/core/ajmem.c",
                     627, 0);
}


x86 assembly (clang, -O0):
<ajMemArrF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
lea    0xed4(%rip),%rdx
mov    $0x273,%ecx
xor    %r8d,%r8d
call   1030 <ajMemCalloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ajMemArrF>:
lea    0xee9(%rip),%rdx
mov    $0x4,%esi
mov    $0x273,%ecx
xor    %r8d,%r8d
jmp    1030 <ajMemCalloc@plt>

LLVM IR (-O0):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kimrutherford/EMBOSS/refs/heads/master/ajax/core/ajmem.c\00"
define float* @ajMemArrF(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call float* @ajMemCalloc(i64 %3, i32 4, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 627, i32 0)
ret float* %4
}

LLVM IR (-O2):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kimrutherford/EMBOSS/refs/heads/master/ajax/core/ajmem.c\00"
define float* @ajMemArrF(i64 %0) {
%2 = tail call float* @ajMemCalloc(i64 %0, i32 4, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 627, i32 0)
ret float* %2
}
char *platGetModel() { return "CSF"; }


x86 assembly (clang, -O0):
<platGetModel>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<platGetModel>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"CSF\00"
define i8* @platGetModel() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"CSF\00"
define i8* @platGetModel() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
long long zzzs() { return 0x000000000000ffffLL; }


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

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

LLVM IR (-O0):
define i64 @zzzs() {
ret i64 65535
}

LLVM IR (-O2):
define i64 @zzzs() {
ret i64 65535
}
int test_imm_AEint16_reg(short val) {
  return ((val) & (-0xAE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_AEint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff52,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_AEint16_reg>:
test   $0xff52,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_AEint16_reg(i16 signext %0) {
%2 = and i16 %0, -174
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int another_routine() { return 1; }


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

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

LLVM IR (-O0):
define i32 @another_routine() {
ret i32 1
}

LLVM IR (-O2):
define i32 @another_routine() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ GetStdHandle(int);
int /*<<< orphan*/ WriteFile(int /*<<< orphan*/, char const *,
                             int /*<<< orphan*/, long *, int /*<<< orphan*/);
int /*<<< orphan*/ strlength(char const *);
int writestr(const char *str) {
  long written;
  WriteFile(GetStdHandle(-11), str, strlength(str), &written, 0);
  return (int)written;
}


x86 assembly (clang, -O0):
<writestr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xfffffff5,%edi
call   1040 <GetStdHandle@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlength@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    -0x10(%rbp),%rcx
xor    %r8d,%r8d
call   1050 <WriteFile@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writestr>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0xfffffff5,%edi
call   1040 <GetStdHandle@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlength@plt>
mov    %rsp,%rcx
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %r8d,%r8d
call   1050 <WriteFile@plt>
mov    (%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @writestr(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = call i32 @GetStdHandle(i32 -11)
%5 = load i8*, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @strlength(i8* %6)
%8 = call i32 @WriteFile(i32 %4, i8* %5, i32 %7, i64* %3, i32 0)
%9 = load i64, i64* %3
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @writestr(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = tail call i32 @GetStdHandle(i32 -11)
%5 = tail call i32 @strlength(i8* %0)
%6 = call i32 @WriteFile(i32 %4, i8* %0, i32 %5, i64* %2, i32 0)
%7 = load i64, i64* %2
%8 = trunc i64 %7 to i32
ret i32 %8
}
/* Variables and functions */
int ENOBUFS;
int ENOMEM;
int errno_resources(int e) { return e == ENOMEM || e == ENOBUFS; }


x86 assembly (clang, -O0):
<errno_resources>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%al
mov    0x2ec5(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x5(%rbp)
je     1130 <errno_resources+0x30>
mov    -0x4(%rbp),%eax
mov    0x2ed0(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<errno_resources>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
sete   %al
mov    0x2ee5(%rip),%rcx
cmp    %edi,(%rcx)
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
@ENOMEM = global i32 0
@ENOBUFS = global i32 0
define i32 @errno_resources(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @ENOMEM
%5 = icmp eq i32 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = load i32, i32* @ENOBUFS
%9 = icmp eq i32 %7, %8
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@ENOMEM = global i32 0
@ENOBUFS = global i32 0
define i32 @errno_resources(i32 %0) {
%2 = load i32, i32* @ENOMEM
%3 = icmp eq i32 %2, %0
%4 = load i32, i32* @ENOBUFS
%5 = icmp eq i32 %4, %0
%6 = select i1 %3, i1 true, i1 %5
%7 = zext i1 %6 to i32
ret i32 %7
}
int linearSearch(int arr[], int size, int search) {
  int i;
  for (i = 0; i < size; ++i)
    if (arr[i] == search)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<linearSearch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1153 <linearSearch+0x53>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1140 <linearSearch+0x40>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <linearSearch+0x5a>
jmp    1145 <linearSearch+0x45>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <linearSearch+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<linearSearch>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <linearSearch+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edx,(%rdi,%rcx,4)
je     111f <linearSearch+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <linearSearch+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @linearSearch(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_vsprintf_malloc() {
  printf("NOT IMPLEMENTED:"
         "pa_vsprintf_malloc"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"NOT IMPLEMENTED:pa_vsprintf_malloc\0A\00"
define i32 @pa_vsprintf_malloc() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [35 x i8] c"NOT IMPLEMENTED:pa_vsprintf_malloc\00"
define i32 @pa_vsprintf_malloc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0xaf() {
  Assert_real((isxdigit(175) == 0),
              "/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_isxdigit.c",
              880, ("isxdigit should be 0 for 0xaf"));
}


x86 assembly (clang, -O0):
<t_isxdigit_0xaf>:
push   %rbp
mov    %rsp,%rbp
mov    $0xaf,%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x370,%edx
lea    0xf5c(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isxdigit_0xaf>:
push   %rax
mov    $0xaf,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x370,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0xaf\00"
define void @t_isxdigit_0xaf() {
%1 = call i64 @isxdigit(i32 175)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 880, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0xaf\00"
define void @t_isxdigit_0xaf() {
%1 = tail call i64 @isxdigit(i32 175)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 880, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int test_imm_34int8_mem(signed char *val) {
  return ((*val) & (0x34 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_34int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 52
%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_34int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 52
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int in_range(int a, int low, int high) {
  if (a < low)
    return 0;
  if (a > high)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<in_range>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1125 <in_range+0x25>
movl   $0x0,-0x4(%rbp)
jmp    1144 <in_range+0x44>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    113d <in_range+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1144 <in_range+0x44>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_range>:
cmp    %esi,%edi
setge  %al
cmp    %edx,%edi
setle  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @in_range(i32 %0, i32 %1, i32 %2) {
%4 = icmp sge i32 %0, %1
%5 = icmp sle i32 %0, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ do_x_filter16(short *, short *, int, int, short *, int, int);
int gradX16(short *src, short *dst, int w, int h) {
  short mask[3] = {-1, 0, 1};
  do_x_filter16(src, dst, w, h, mask, 3, 1);
  return 1;
}


x86 assembly (clang, -O0):
<gradX16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    0xed4(%rip),%eax
mov    %eax,-0x1e(%rbp)
mov    0xece(%rip),%ax
mov    %ax,-0x1a(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    -0x1e(%rbp),%r8
mov    $0x3,%r9d
movl   $0x1,(%rsp)
call   1030 <do_x_filter16@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gradX16>:
sub    $0x18,%rsp
movzwl 0xee9(%rip),%eax
mov    %ax,0x14(%rsp)
mov    0xeda(%rip),%eax
mov    %eax,0x10(%rsp)
movl   $0x1,(%rsp)
lea    0x10(%rsp),%r8
mov    $0x3,%r9d
call   1030 <do_x_filter16@plt>
mov    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.gradX16.mask = [3 x i16] [i16 -1, i16 0, i16 1]
define i32 @gradX16(i16* %0, i16* %1, i32 %2, i32 %3) {
%5 = alloca i16*
%6 = alloca i16*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [3 x i16]
store i16* %0, i16** %5
store i16* %1, i16** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = bitcast [3 x i16]* %9 to i8*
%11 = load i16*, i16** %5
%12 = load i16*, i16** %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = getelementptr inbounds [3 x i16], [3 x i16]* %9, i64 0, i64 0
%16 = call i32 @do_x_filter16(i16* %11, i16* %12, i32 %13, i32 %14, i16* %15, i32 3, i32 1)
ret i32 1
}

LLVM IR (-O2):
@__const.gradX16.mask = [3 x i16] [i16 -1, i16 0, i16 1]
define i32 @gradX16(i16* %0, i16* %1, i32 %2, i32 %3) {
%5 = alloca [3 x i16]
%6 = bitcast [3 x i16]* %5 to i8*
%7 = getelementptr inbounds [3 x i16], [3 x i16]* %5, i64 0, i64 0
%8 = call i32 @do_x_filter16(i16* %0, i16* %1, i32 %2, i32 %3, i16* %7, i32 3, i32 1)
ret i32 1
}
int hash(int value) { return ((value * 31) % 1000); }


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x1f,-0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    %edi,%eax
shl    $0x5,%eax
sub    %edi,%eax
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i32 %0) {
%2 = mul nsw i32 %0, 31
%3 = srem i32 %2, 1000
ret i32 %3
}
/* Type definitions */
typedef char *int64_t;

/* Variables and functions */
int64_t atomic_fetchstore64(volatile void *ptr, int64_t value) {
  int64_t result;
  __asm__ __volatile__("lock\n\txchg"
                       "q"
                       " %0,%1"
                       : "=r"(result), "=m"(*(volatile int64_t *)ptr)
                       : "0"(value), "m"(*(volatile int64_t *)ptr)
                       : "memory");
  return result;
}


x86 assembly (clang, -O0):
<atomic_fetchstore64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
lock xchg %rax,(%rcx)
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atomic_fetchstore64>:
mov    %rsi,%rax
lock xchg %rax,(%rdi)
ret

LLVM IR (-O0):
define i8* @atomic_fetchstore64(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i8**
%8 = load i8*, i8** %4
%9 = load i8*, i8** %3
%10 = bitcast i8* %9 to i8**
%11 = call i8* asm sideeffect "lock\0A\09xchgq $0,$1", "=r,=*m,0,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i8** elementtype(i8*) %7, i8* %8, i8** elementtype(i8*) %10)
store i8* %11, i8** %5
%12 = load i8*, i8** %5
ret i8* %12
}

LLVM IR (-O2):
define i8* @atomic_fetchstore64(i8* %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
%4 = tail call i8* asm sideeffect "lock\0A\09xchgq $0,$1", "=r,=*m,0,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i8** elementtype(i8*) %3, i8* %1, i8** elementtype(i8*) %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ is_prime(int);
int find_prime_greater_than(int val) {
  if (val & 1) {
    val += 2;
  } else {
    val++;
  }
  while (!is_prime(val)) {
    val += 2;
  }
  return val;
}


x86 assembly (clang, -O0):
<find_prime_greater_than>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1138 <find_prime_greater_than+0x28>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <find_prime_greater_than+0x31>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <find_prime_greater_than+0x36>
mov    -0x4(%rbp),%edi
call   1030 <is_prime@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1163 <find_prime_greater_than+0x53>
jmp    1171 <find_prime_greater_than+0x61>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <find_prime_greater_than+0x36>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_prime_greater_than>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%eax
and    $0x1,%eax
cmp    $0x1,%eax
sbb    $0x0,%ebx
add    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <is_prime@plt>
add    $0x2,%ebx
test   %eax,%eax
je     1130 <find_prime_greater_than+0x20>
add    $0xfffffffe,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @find_prime_greater_than(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 2
store i32 %8, i32* %2
br label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %12
12: ; preds = %9, %6
br label %13
13: ; preds = %18, %12
%14 = load i32, i32* %2
%15 = call i32 @is_prime(i32 %14)
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 2
store i32 %20, i32* %2
br label %13
21: ; preds = %13
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @find_prime_greater_than(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 1, i32 2
%5 = add nsw i32 %4, %0
br label %6
6: ; preds = %6, %1
%7 = phi i32 [ %5, %1 ], [ %10, %6 ]
%8 = tail call i32 @is_prime(i32 %7)
%9 = icmp eq i32 %8, 0
%10 = add nsw i32 %7, 2
br i1 %9, label %6, label %11
11: ; preds = %6
ret i32 %7
}
void parallel_clear_rxflag(void) {}


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

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

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

LLVM IR (-O2):
define void @parallel_clear_rxflag() {
ret void
}
int iso_zisofs_get_params(struct iso_zisofs_ctrl *params, int flag) {
  return 0xE830FEA7;
}


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

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

LLVM IR (-O0):
%struct.iso_zisofs_ctrl = type opaque
define i32 @iso_zisofs_get_params(%struct.iso_zisofs_ctrl* %0, i32 %1) {
%3 = alloca %struct.iso_zisofs_ctrl*
%4 = alloca i32
store %struct.iso_zisofs_ctrl* %0, %struct.iso_zisofs_ctrl** %3
store i32 %1, i32* %4
ret i32 -399442265
}

LLVM IR (-O2):
%struct.iso_zisofs_ctrl = type opaque
define i32 @iso_zisofs_get_params(%struct.iso_zisofs_ctrl* nocapture readnone %0, i32 %1) {
ret i32 -399442265
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int i;
  int sum;
  sum = 0;
  for (i = 0; i -= 1000; i++) {
    sum += i;
  }
  printf("%d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x3e8,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     115f <main+0x4f>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
mov    -0x18(%rbp),%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -943689448)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ PRINT_LOG(char *, char *);
int /*<<< orphan*/ free(char *);
void PRINT_LOG_FREE(char *x, char *y) {
  PRINT_LOG(x, y);
  free(y);
}


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

x86 assembly (clang, -O2):
<PRINT_LOG_FREE>:
push   %rbx
mov    %rsi,%rbx
call   1040 <PRINT_LOG@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @PRINT_LOG_FREE(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @PRINT_LOG(i8* %5, i8* %6)
%8 = load i8*, i8** %4
%9 = call i32 @free(i8* %8)
ret void
}

LLVM IR (-O2):
define void @PRINT_LOG_FREE(i8* %0, i8* %1) {
%3 = tail call i32 @PRINT_LOG(i8* %0, i8* %1)
%4 = tail call i32 @free(i8* %1)
ret void
}
/* Type definitions */
struct ip {
  int ip_tos;
};

/* Variables and functions */
int get_ip_dscp(struct ip *self) { return self->ip_tos; }


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

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

LLVM IR (-O0):
%struct.ip = type { i32 }
define i32 @get_ip_dscp(%struct.ip* %0) {
%2 = alloca %struct.ip*
store %struct.ip* %0, %struct.ip** %2
%3 = load %struct.ip*, %struct.ip** %2
%4 = getelementptr inbounds %struct.ip, %struct.ip* %3, i32 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.ip = type { i32 }
define i32 @get_ip_dscp(%struct.ip* nocapture %0) {
%2 = getelementptr inbounds %struct.ip, %struct.ip* %0, i64 0, i32 0
%3 = load i32, i32* %2
ret i32 %3
}
int fibbo(int n) {
  if (n <= 2) {
    return 1;
  } else {
    return fibbo(n - 1) + fibbo(n - 2);
  }
}


x86 assembly (clang, -O0):
<fibbo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     1131 <fibbo+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1154 <fibbo+0x44>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fibbo@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fibbo@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibbo>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmp    $0x3,%edi
jl     1145 <fibbo+0x35>
mov    %edi,%ebx
add    $0x2,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x3(%rbx),%edi
call   1030 <fibbo@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
cmp    $0x4,%ebx
ja     1130 <fibbo+0x20>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fibbo(i32 %0) {
%2 = icmp slt i32 %0, 3
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fibbo(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 5
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i32 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %14
}
void exchange2(int *a, int *b) {
  int tmp = *a;
  *a = *b;
  *b = tmp;
}


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

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

LLVM IR (-O0):
define void @exchange2(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* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

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

/* Variables and functions */
uint32_t swap(uint32_t x) {
  return (((x & 0xff) << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) |
          ((x & 0xff000000) >> 24));
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @swap(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 24
%6 = load i32, i32* %2
%7 = and i32 %6, 65280
%8 = shl i32 %7, 8
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = and i32 %10, 16711680
%12 = ashr i32 %11, 8
%13 = or i32 %9, %12
%14 = load i32, i32* %2
%15 = and i32 %14, -16777216
%16 = lshr i32 %15, 24
%17 = or i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @swap(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
void _M2_coord_finish(__attribute__((unused)) int argc,
                      __attribute__((unused)) char *argv[]) {}


x86 assembly (clang, -O0):
<_M2_coord_finish>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @_M2_coord_finish(i32 %0, i8** nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cmd_printHexWord(unsigned short);
void cmd_printHexDword(unsigned int dword) {
  cmd_printHexWord((unsigned short)((dword & 0xFFFF0000) >> 16));
  cmd_printHexWord((unsigned short)(dword & 0xFFFF));
}


x86 assembly (clang, -O0):
<cmd_printHexDword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff0000,%eax
shr    $0x10,%eax
movzwl %ax,%edi
call   1030 <cmd_printHexWord@plt>
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
movzwl %ax,%edi
call   1030 <cmd_printHexWord@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_printHexDword>:
push   %rbx
mov    %edi,%ebx
shr    $0x10,%edi
call   1030 <cmd_printHexWord@plt>
movzwl %bx,%edi
pop    %rbx
jmp    1030 <cmd_printHexWord@plt>

LLVM IR (-O0):
define void @cmd_printHexDword(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -65536
%5 = lshr i32 %4, 16
%6 = trunc i32 %5 to i16
%7 = call i32 @cmd_printHexWord(i16 zeroext %6)
%8 = load i32, i32* %2
%9 = and i32 %8, 65535
%10 = trunc i32 %9 to i16
%11 = call i32 @cmd_printHexWord(i16 zeroext %10)
ret void
}

LLVM IR (-O2):
define void @cmd_printHexDword(i32 %0) {
%2 = lshr i32 %0, 16
%3 = trunc i32 %2 to i16
%4 = tail call i32 @cmd_printHexWord(i16 zeroext %3)
%5 = trunc i32 %0 to i16
%6 = tail call i32 @cmd_printHexWord(i16 zeroext %5)
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
int main(void) {
  int ch;
  while ((ch = getchar()) != EOF) {
    putchar(ch);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     1155 <main+0x35>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb9(%rip),%rbx
cmp    (%rbx),%eax
je     1152 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* %2
%9 = call i32 @putchar(i32 %8)
br label %3
10: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %10, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 @putchar(i32 %5)
%7 = tail call i32 (...) @getchar()
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %4
10: ; preds = %4, %0
ret i32 0
}
double _COM_CONV64sd(signed long long a) { return (double)a; }


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

x86 assembly (clang, -O2):
<_COM_CONV64sd>:
cvtsi2sd %rdi,%xmm0
ret

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

LLVM IR (-O2):
define double @_COM_CONV64sd(i64 %0) {
%2 = sitofp i64 %0 to double
ret double %2
}
/* Variables and functions */
void *my_xmalloc(size_t a) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @my_xmalloc(i64 %0) {
ret i8* null
}