xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printArray(int *arr, int n) {
  int i;
  for (i = 0; i < n; i++)
    printf(" %d", arr[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArray+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
define void @printArray(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
int main(int argc, char **argv) { return 84 >> 1; }


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 42
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_216() {
  Assert_real((isqrt(216) == 14),
              "/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/stdlib/isqrt.c",
              1085, ("Integer square root of 216 should be 14"));
}


x86 assembly (clang, -O0):
<t_sqrt_216>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd8,%edi
call   1030 <isqrt@plt>
cmp    $0xe,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x43d,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_216>:
push   %rax
mov    $0xd8,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xe,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x43d,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 216 should be 14\00"
define void @t_sqrt_216() {
%1 = call i32 @isqrt(i32 216)
%2 = icmp eq i32 %1, 14
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1085, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 216 should be 14\00"
define void @t_sqrt_216() {
%1 = tail call i32 @isqrt(i32 216)
%2 = icmp eq i32 %1, 14
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1085, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
                                             struct module *, unsigned long),
                                   void *data) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.module = type opaque
define i32 @module_kallsyms_on_each_symbol(i32 (i8*, i8*, %struct.module*, i64)* %0, i8* %1) {
%3 = alloca i32 (i8*, i8*, %struct.module*, i64)*
%4 = alloca i8*
store i32 (i8*, i8*, %struct.module*, i64)* %0, i32 (i8*, i8*, %struct.module*, i64)** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
%struct.module = type opaque
define i32 @module_kallsyms_on_each_symbol(i32 (i8*, i8*, %struct.module*, i64)* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void helloworld() { printf("hello github\n"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"hello github\0A\00"
define void @helloworld() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"hello github\00"
define void @helloworld() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
int interpolate(int v00, int v01, int v10, int xf, int yf) {
  return v00 + (((v01 - v00) * xf + (v10 - v00) * yf) >> 16);
}


x86 assembly (clang, -O0):
<interpolate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
imul   -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
sub    -0x4(%rbp),%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
sar    $0x10,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpolate>:
sub    %edi,%esi
imul   %ecx,%esi
sub    %edi,%edx
imul   %r8d,%edx
lea    (%rdx,%rsi,1),%eax
sar    $0x10,%eax
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @interpolate(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = sub nsw i32 %1, %0
%7 = mul nsw i32 %6, %3
%8 = sub nsw i32 %2, %0
%9 = mul nsw i32 %8, %4
%10 = add nsw i32 %9, %7
%11 = ashr i32 %10, 16
%12 = add nsw i32 %11, %0
ret i32 %12
}
/* Variables and functions */
char *stb__splitpath_raw(int /*<<< orphan*/ *, char *, int);
char *stb_splitpathdup(char *src, int flag) {
  return stb__splitpath_raw(NULL, src, flag);
}


x86 assembly (clang, -O0):
<stb_splitpathdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
call   1030 <stb__splitpath_raw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stb_splitpathdup>:
mov    %esi,%edx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <stb__splitpath_raw@plt>

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

LLVM IR (-O2):
define i8* @stb_splitpathdup(i8* %0, i32 %1) {
%3 = tail call i8* @stb__splitpath_raw(i32* null, i8* %0, i32 %1)
ret i8* %3
}
extern int foo() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @foo() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void errmalloc(void) {
  fprintf(stderr, "Error: Could not allocate memory.\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<errmalloc>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<errmalloc>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Error: Could not allocate memory.\0A\00"
@EXIT_FAILURE = global i32 0
define void @errmalloc() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Error: Could not allocate memory.\0A\00"
@EXIT_FAILURE = global i32 0
define void @errmalloc() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int /*<<< orphan*/ _HibernateWriteComplete();
void HibernateIntEnable(uint32_t ui32IntFlags) {
  ASSERT(!(ui32IntFlags & ~(0x00000008 | 0x00000004 | 0x00000080 | 0x00000040 |
                            0x00000020 | 0x00000001 | 0x00000010)));
  (*((volatile uint32_t *)(0x400FC014))) |= ui32IntFlags;
  _HibernateWriteComplete();
}


x86 assembly (clang, -O0):
<HibernateIntEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffff02,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x4(%rbp),%eax
mov    $0x400fc014,%ecx
mov    (%rcx),%ecx
or     %eax,%ecx
mov    $0x400fc014,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateIntEnable>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
test   $0xffffff02,%ebx
sete   %dil
call   1040 <ASSERT@plt>
or     %ebx,0x400fc014
xor    %eax,%eax
pop    %rbx
jmp    1030 <_HibernateWriteComplete@plt>

LLVM IR (-O0):
define void @HibernateIntEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -254
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
%8 = call i32 @ASSERT(i32 %7)
%9 = load i32, i32* %2
%10 = load volatile i32, i32* inttoptr (i64 1074774036 to i32*)
%11 = or i32 %10, %9
store volatile i32 %11, i32* inttoptr (i64 1074774036 to i32*)
%12 = call i32 (...) @_HibernateWriteComplete()
ret void
}

LLVM IR (-O2):
define void @HibernateIntEnable(i32 %0) {
%2 = and i32 %0, -254
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = load volatile i32, i32* inttoptr (i64 1074774036 to i32*)
%7 = or i32 %6, %0
store volatile i32 %7, i32* inttoptr (i64 1074774036 to i32*)
%8 = tail call i32 (...) @_HibernateWriteComplete()
ret void
}
any(c, s) register char c, *s;
{
  for (; *s; s++)
    if (*s == c)
      return (1);
  return (0);
}


x86 assembly (clang, -O0):
<any>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1150 <any+0x50>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jne    113a <any+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1157 <any+0x57>
jmp    113f <any+0x3f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110e <any+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<any>:
mov    (%rsi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1122 <any+0x22>
movsbl %dil,%edx
add    $0x1,%rsi
movsbl %cl,%ecx
cmp    %ecx,%edx
je     1123 <any+0x23>
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <any+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @any(i32 %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2
%6 = shl i32 %0, 24
%7 = ashr exact i32 %6, 24
br label %11
8: ; preds = %11
%9 = load i8, i8* %16
%10 = icmp eq i8 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %5, %8
%12 = phi i8 [ %3, %5 ], [ %9, %8 ]
%13 = phi i8* [ %1, %5 ], [ %16, %8 ]
%14 = sext i8 %12 to i32
%15 = icmp eq i32 %7, %14
%16 = getelementptr inbounds i8, i8* %13, i64 1
br i1 %15, label %17, label %8
17: ; preds = %11, %8, %2
%18 = phi i32 [ 0, %2 ], [ 0, %8 ], [ 1, %11 ]
ret i32 %18
}
void free(void *ptr) {}


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

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

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

LLVM IR (-O2):
define void @free(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __exit_end_func(int);
__attribute__((destructor)) void __clean_for_exit() { __exit_end_func(-1); }


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

x86 assembly (clang, -O2):
<__clean_for_exit>:
mov    $0xffffffff,%edi
jmp    1030 <__exit_end_func@plt>

LLVM IR (-O0):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__clean_for_exit, i8* null }]
define void @__clean_for_exit() {
%1 = call i32 @__exit_end_func(i32 -1)
ret void
}

LLVM IR (-O2):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__clean_for_exit, i8* null }]
define void @__clean_for_exit() {
%1 = tail call i32 @__exit_end_func(i32 -1)
ret void
}
/* Variables and functions */
int _chsize(int, int);
int ftruncate(int __fd, int __length) { return _chsize(__fd, __length); }


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

x86 assembly (clang, -O2):
<ftruncate>:
jmp    1030 <_chsize@plt>

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

LLVM IR (-O2):
define i32 @ftruncate(i32 %0, i32 %1) {
%3 = tail call i32 @_chsize(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ glmMin3fs(float *, float *, float);
void glmMin3fs_(float x[3], float y) { glmMin3fs(x, x, y); }


x86 assembly (clang, -O0):
<glmMin3fs_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movss  -0xc(%rbp),%xmm0
call   1030 <glmMin3fs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmMin3fs_>:
mov    %rdi,%rsi
jmp    1030 <glmMin3fs@plt>

LLVM IR (-O0):
define void @glmMin3fs_(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
store float* %0, float** %3
store float %1, float* %4
%5 = load float*, float** %3
%6 = load float*, float** %3
%7 = load float, float* %4
%8 = call i32 @glmMin3fs(float* %5, float* %6, float %7)
ret void
}

LLVM IR (-O2):
define void @glmMin3fs_(float* %0, float %1) {
%3 = tail call i32 @glmMin3fs(float* %0, float* %0, float %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ function(char *);
int main(void) {
  char large_string[256];
  int i;
  for (i = 0; i < 255; i++)
    large_string[i] = 'A';
  function(large_string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x114(%rbp)
cmpl   $0xff,-0x114(%rbp)
jge    115f <main+0x4f>
movslq -0x114(%rbp),%rax
movb   $0x41,-0x110(%rbp,%rax,1)
41
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    112c <main+0x1c>
lea    -0x110(%rbp),%rdi
call   1030 <function@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x108,%rsp
movaps 0xee2(%rip),%xmm0
movups %xmm0,0xef(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <function@plt>
xor    %eax,%eax
add    $0x108,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 255
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %9
store i8 65, i8* %10
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%16 = call i32 @function(i8* %15)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = call i32 @function(i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
scalar_t__ strlen(char *);
void cmdline_parser_print_version(void) {
  printf("%s %s\n", (strlen("artifact") ? "artifact" : "artifact"), "4.02");
}


x86 assembly (clang, -O0):
<cmdline_parser_print_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xedc(%rip),%rdi
call   1030 <strlen@plt>
lea    0xed0(%rip),%rsi
cmp    $0x0,%rax
cmovne %rsi,%rsi
lea    0xeba(%rip),%rdi
lea    0xec3(%rip),%rdx
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdline_parser_print_version>:
lea    0xee9(%rip),%rdi
lea    0xee9(%rip),%rsi
lea    0xeeb(%rip),%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [9 x i8] c"artifact\00"
@.str.2 = [5 x i8] c"4.02\00"
define void @cmdline_parser_print_version() {
%1 = call i64 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [9 x i8] c"artifact\00"
@.str.2 = [5 x i8] c"4.02\00"
define void @cmdline_parser_print_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getPageOfVirtualAddress(int);
int isPageMapped(int *, int /*<<< orphan*/);
int isVirtualAddressMapped(int *table, int vaddr) {
  return isPageMapped(table, getPageOfVirtualAddress(vaddr));
}


x86 assembly (clang, -O0):
<isVirtualAddressMapped>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <getPageOfVirtualAddress@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <isPageMapped@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isVirtualAddressMapped>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1040 <getPageOfVirtualAddress@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <isPageMapped@plt>

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

LLVM IR (-O2):
define i32 @isVirtualAddressMapped(i32* %0, i32 %1) {
%3 = tail call i32 @getPageOfVirtualAddress(i32 %1)
%4 = tail call i32 @isPageMapped(i32* %0, i32 %3)
ret i32 %4
}
int f_sub(int a, int b) { return a - b; }


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

x86 assembly (clang, -O2):
<f_sub>:
mov    %edi,%eax
sub    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @f_sub(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
int min2i(int x, int y) { return (x < y) ? x : y; }


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

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

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

LLVM IR (-O2):
define i32 @min2i(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0xf8() {
  Assert_real((ispunct(248) == 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_ispunct.c",
              1245, ("ispunct should be 0 for 0xf8"));
}


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

x86 assembly (clang, -O2):
<t_ispunct_0xf8>:
push   %rax
mov    $0xf8,%edi
call   1030 <ispunct@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4dd,%edx
pop    %rax
jmp    1040 <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_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xf8\00"
define void @t_ispunct_0xf8() {
%1 = call i64 @ispunct(i32 248)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1245, i8* getelementptr inbounds ([29 x i8], [29 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_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xf8\00"
define void @t_ispunct_0xf8() {
%1 = tail call i64 @ispunct(i32 248)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1245, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nvram_get(char const *);
int nvram_set(char const *, char const *);
scalar_t__ strcmp(int /*<<< orphan*/, char const *);
int nvram_safe_set(const char *name, const char *value) {
  int ret = 0;
  if (!nvram_get(name) || strcmp(nvram_get(name), value))
    ret = nvram_set(name, value);
  return ret;
}


x86 assembly (clang, -O0):
<nvram_safe_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <nvram_get@plt>
cmp    $0x0,%eax
je     1177 <nvram_safe_set+0x47>
mov    -0x8(%rbp),%rdi
call   1050 <nvram_get@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1187 <nvram_safe_set+0x57>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <nvram_set@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvram_safe_set>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <nvram_get@plt>
test   %eax,%eax
je     115a <nvram_safe_set+0x2a>
mov    %rbx,%rdi
call   1050 <nvram_get@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     116c <nvram_safe_set+0x3c>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <nvram_set@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @nvram_safe_set(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%6 = load i8*, i8** %3
%7 = call i32 @nvram_get(i8* %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @nvram_get(i8* %10)
%12 = load i8*, i8** %4
%13 = call i64 @strcmp(i32 %11, i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %9, %2
%16 = load i8*, i8** %3
%17 = load i8*, i8** %4
%18 = call i32 @nvram_set(i8* %16, i8* %17)
store i32 %18, i32* %5
br label %19
19: ; preds = %15, %9
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
define i32 @nvram_safe_set(i8* %0, i8* %1) {
%3 = tail call i32 @nvram_get(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @nvram_get(i8* %0)
%7 = tail call i64 @strcmp(i32 %6, i8* %1)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %5, %2
%10 = tail call i32 @nvram_set(i8* %0, i8* %1)
br label %11
11: ; preds = %9, %5
%12 = phi i32 [ %10, %9 ], [ 0, %5 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ splint(float *, float *, float *, int, float, float *);
float getinterp(float n) {
  extern float TWOn[], MU[], Y2[];
  extern int ninterp;
  float n2, y;
  n2 = 2. * n;
  splint(TWOn, MU, Y2, ninterp, n2, &y);
  return (y);
}


x86 assembly (clang, -O0):
<getinterp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xed2(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    0x2e8e(%rip),%rax
mov    (%rax),%ecx
movss  -0x8(%rbp),%xmm0
mov    0x2e88(%rip),%rdi
mov    0x2e89(%rip),%rsi
mov    0x2e8a(%rip),%rdx
lea    -0xc(%rbp),%r8
call   1030 <splint@plt>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getinterp>:
push   %rax
addss  %xmm0,%xmm0
mov    0x2eb4(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb3(%rip),%rdi
mov    0x2eb4(%rip),%rsi
mov    0x2eb5(%rip),%rdx
lea    0x4(%rsp),%r8
call   1030 <splint@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@TWOn = external global [0 x float]
@MU = external global [0 x float]
@Y2 = external global [0 x float]
@ninterp = external global i32
define float @getinterp(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fmul double 2.000000e+00, %6
%8 = fptrunc double %7 to float
store float %8, float* %3
%9 = load i32, i32* @ninterp
%10 = load float, float* %3
%11 = call i32 @splint(float* getelementptr inbounds ([0 x float], [0 x float]* @TWOn, i64 0, i64 0), float* getelementptr inbounds ([0 x float], [0 x float]* @MU, i64 0, i64 0), float* getelementptr inbounds ([0 x float], [0 x float]* @Y2, i64 0, i64 0), i32 %9, float %10, float* %4)
%12 = load float, float* %4
ret float %12
}

LLVM IR (-O2):
@TWOn = external global [0 x float]
@MU = external global [0 x float]
@Y2 = external global [0 x float]
@ninterp = external global i32
define float @getinterp(float %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = fmul float %0, 2.000000e+00
%5 = load i32, i32* @ninterp
%6 = call i32 @splint(float* getelementptr inbounds ([0 x float], [0 x float]* @TWOn, i64 0, i64 0), float* getelementptr inbounds ([0 x float], [0 x float]* @MU, i64 0, i64 0), float* getelementptr inbounds ([0 x float], [0 x float]* @Y2, i64 0, i64 0), i32 %5, float %4, float* %2)
%7 = load float, float* %2
ret float %7
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int /*<<< orphan*/ dbg_set_chain(int /*<<< orphan*/);
int /*<<< orphan*/ get_response_from_vpi();
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ send_address_to_vpi(int);
int /*<<< orphan*/ send_command_to_vpi(int);
int /*<<< orphan*/ send_data_to_vpi(int);
int dbg_wb_write32(uint32_t adr, uint32_t data) {
  if (0)
    printf("dbg_wb_write32: adr 0x%.8x data 0x%.8x\n", adr, data);
  dbg_set_chain(0);
  send_command_to_vpi(0x7);
  send_address_to_vpi(adr);
  send_data_to_vpi(sizeof(data));
  send_data_to_vpi(data);
  get_response_from_vpi();
  return 0;
}


x86 assembly (clang, -O0):
<dbg_wb_write32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %edi,%edi
call   1050 <dbg_set_chain@plt>
mov    $0x7,%edi
call   1030 <send_command_to_vpi@plt>
mov    -0x4(%rbp),%edi
call   1040 <send_address_to_vpi@plt>
mov    $0x4,%edi
call   1070 <send_data_to_vpi@plt>
mov    -0x8(%rbp),%edi
call   1070 <send_data_to_vpi@plt>
mov    $0x0,%al
call   1060 <get_response_from_vpi@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbg_wb_write32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
call   1050 <dbg_set_chain@plt>
mov    $0x7,%edi
call   1030 <send_command_to_vpi@plt>
mov    %ebp,%edi
call   1040 <send_address_to_vpi@plt>
mov    $0x4,%edi
call   1070 <send_data_to_vpi@plt>
mov    %ebx,%edi
call   1070 <send_data_to_vpi@plt>
xor    %eax,%eax
call   1060 <get_response_from_vpi@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @dbg_wb_write32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @dbg_set_chain(i32 0)
%6 = call i32 @send_command_to_vpi(i32 7)
%7 = load i32, i32* %3
%8 = call i32 @send_address_to_vpi(i32 %7)
%9 = call i32 @send_data_to_vpi(i32 4)
%10 = load i32, i32* %4
%11 = call i32 @send_data_to_vpi(i32 %10)
%12 = call i32 (...) @get_response_from_vpi()
ret i32 0
}

LLVM IR (-O2):
define i32 @dbg_wb_write32(i32 %0, i32 %1) {
%3 = tail call i32 @dbg_set_chain(i32 0)
%4 = tail call i32 @send_command_to_vpi(i32 7)
%5 = tail call i32 @send_address_to_vpi(i32 %0)
%6 = tail call i32 @send_data_to_vpi(i32 4)
%7 = tail call i32 @send_data_to_vpi(i32 %1)
%8 = tail call i32 (...) @get_response_from_vpi()
ret i32 0
}
/* Type definitions */
struct notify_node {
  int dummy;
};

/* Variables and functions */
int is_empty_notify_list(struct notify_node *n) { return n == NULL; }


x86 assembly (clang, -O0):
<is_empty_notify_list>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_empty_notify_list>:
xor    %eax,%eax
test   %rdi,%rdi
sete   %al
ret

LLVM IR (-O0):
%struct.notify_node = type { i32 }
define i32 @is_empty_notify_list(%struct.notify_node* %0) {
%2 = alloca %struct.notify_node*
store %struct.notify_node* %0, %struct.notify_node** %2
%3 = load %struct.notify_node*, %struct.notify_node** %2
%4 = icmp eq %struct.notify_node* %3, null
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
%struct.notify_node = type { i32 }
define i32 @is_empty_notify_list(%struct.notify_node* readnone %0) {
%2 = icmp eq %struct.notify_node* %0, null
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
void *malloc(size_t);
void *skin_buffer_alloc(size_t size) {
  void *retval = NULL;
  retval = malloc(size);
  return retval;
}


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

x86 assembly (clang, -O2):
<skin_buffer_alloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @skin_buffer_alloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ process(char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 3) {
    fprintf(stderr, "usage: %s <bin file> <hex file>\n", argv[0]);
    exit(1);
  }
  process(argv[1], argv[2]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
je     116f <main+0x3f>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <process@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x3,%edi
jne    1147 <main+0x17>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1030 <process@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xea6(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"usage: %s <bin file> <hex file>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 3
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @process(i8* %17, i8* %20)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"usage: %s <bin file> <hex file>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @process(i8* %11, i8* %13)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strncpy(char *, char *, unsigned int);
void vulnerable(char *mem) {
  char buff[20];
  strncpy(buff, mem, (unsigned int)mem[0]);
  printf("size: %d\n", (unsigned int)mem[0]);
  printf("%s\n", buff);
}


x86 assembly (clang, -O0):
<vulnerable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vulnerable>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movsbl (%rdi),%edx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strncpy@plt>
movsbl (%rbx),%esi
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"size: %d\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @vulnerable(i8* %0) {
%2 = alloca i8*
%3 = alloca [20 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = call i32 @strncpy(i8* %4, i8* %5, i32 %9)
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"size: %d\0A\00"
define void @vulnerable(i8* %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = sext i8 %4 to i32
%6 = call i32 @strncpy(i8* %3, i8* %0, i32 %5)
%7 = load i8, i8* %0
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @puts(i8* %3)
ret void
}
/* Variables and functions */
long double asinh(long double);
long double asinhl(long double a1) { return asinh(a1); }


x86 assembly (clang, -O0):
<asinhl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <asinh@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asinhl>:
jmp    1030 <asinh@plt>

LLVM IR (-O0):
define x86_fp80 @asinhl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @asinh(x86_fp80 %3)
ret x86_fp80 %4
}

LLVM IR (-O2):
define x86_fp80 @asinhl(x86_fp80 %0) {
%2 = tail call x86_fp80 @asinh(x86_fp80 %0)
ret x86_fp80 %2
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 3) {
    printf("Usage: %s PID SIGNUM\n", argv[0]);
  }
  kill(atoi(argv[1]), atoi(argv[2]));
}


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)
cmpl   $0x3,-0x8(%rbp)
jge    1163 <main+0x33>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1040 <kill@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     114a <main+0x1a>
mov    (%rbx),%rsi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <kill@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"Usage: %s PID SIGNUM\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %7
7: ; preds = %4, %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = tail call i32 @kill(i32 %10, i32 %13)
ret i32 0
}
/* Variables and functions */
int EOF;
int getchar();
int main(void) {
  int c;
  while ((c = getchar()) != EOF)
    if (c == '\r')
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2eb8(%rip),%rcx
cmp    (%rcx),%eax
je     1153 <main+0x43>
cmpl   $0xd,-0x8(%rbp)
jne    114e <main+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    115a <main+0x4a>
jmp    111f <main+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    (%r14),%eax
je     1136 <main+0x26>
cmp    $0xd,%eax
jne    1120 <main+0x10>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
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 = %11, %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 %12
7: ; preds = %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 13
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 1, i32* %1
br label %13
11: ; preds = %7
br label %3
12: ; preds = %3
store i32 0, i32* %1
br label %13
13: ; preds = %12, %10
%14 = load i32, i32* %1
ret i32 %14
}

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