xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void *realloc(void *, size_t);
void *sfm_realloc(void *ptr, size_t size) {
  if ((ptr = realloc(ptr, size)) == NULL)
    die("sfm is out of memory!");
  return ptr;
}


x86 assembly (clang, -O0):
<sfm_realloc>:
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   1030 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    1157 <sfm_realloc+0x37>
lea    0xeae(%rip),%rdi
call   1040 <die@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sfm_realloc>:
push   %rbx
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <sfm_realloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"sfm is out of memory!\00"
define i8* @sfm_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
store i8* %7, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [22 x i8] c"sfm is out of memory!\00"
define noalias i8* @sfm_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ MapErrorWindow(char *);
int /*<<< orphan*/ PrintErrorMessage(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, int);
void Error(char *msg, char *module, int line) {
  char buffer[(1024 + 80 + 1) + 1];
  MapErrorWindow("INTERNAL ERROR");
  (void)sprintf(buffer, "%s*In Module \"%s\"*Line %d", msg, module, line);
  (void)PrintErrorMessage(buffer);
}


x86 assembly (clang, -O0):
<Error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <MapErrorWindow@plt>
lea    -0x470(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
lea    0xea3(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x470(%rbp),%rdi
call   1040 <PrintErrorMessage@plt>
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Error>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x458,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xeb3(%rip),%rdi
call   1030 <MapErrorWindow@plt>
lea    0xeb6(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    %r14d,%r8d
call   1050 <sprintf@plt>
mov    %r15,%rdi
call   1040 <PrintErrorMessage@plt>
add    $0x458,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"INTERNAL ERROR\00"
@.str.1 = [26 x i8] c"%s*In Module \22%s\22*Line %d\00"
define void @Error(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [1106 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = call i32 @MapErrorWindow(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [1106 x i8], [1106 x i8]* %7, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %11, i32 %12)
%14 = getelementptr inbounds [1106 x i8], [1106 x i8]* %7, i64 0, i64 0
%15 = call i32 @PrintErrorMessage(i8* %14)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"INTERNAL ERROR\00"
@.str.1 = [26 x i8] c"%s*In Module \22%s\22*Line %d\00"
define void @Error(i8* %0, i8* %1, i32 %2) {
%4 = alloca [1106 x i8]
%5 = getelementptr inbounds [1106 x i8], [1106 x i8]* %4, i64 0, i64 0
%6 = tail call i32 @MapErrorWindow(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1, i32 %2)
%8 = call i32 @PrintErrorMessage(i8* %5)
ret void
}
/* Variables and functions */
scalar_t__ fork();
int /*<<< orphan*/ printf(char *);
void fork5() {
  printf("L0\n");
  if (fork() == 0) {
    printf("L1\n");
    if (fork() == 0) {
      printf("L2\n");
    }
  }
  printf("Bye\n");
}


x86 assembly (clang, -O0):
<fork5>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <fork@plt>
cmp    $0x0,%rax
jne    116f <fork5+0x4f>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <fork@plt>
cmp    $0x0,%rax
jne    116a <fork5+0x4a>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
jmp    116f <fork5+0x4f>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fork5>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
jne    115d <fork5+0x3d>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
jne    115d <fork5+0x3d>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"L0\0A\00"
@.str.1 = [4 x i8] c"L1\0A\00"
@.str.2 = [4 x i8] c"L2\0A\00"
@.str.3 = [5 x i8] c"Bye\0A\00"
define void @fork5() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = call i64 (...) @fork()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = call i64 (...) @fork()
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %4
br label %11
11: ; preds = %10, %0
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [3 x i8] c"L0\00"
@str.4 = [4 x i8] c"Bye\00"
@str.5 = [3 x i8] c"L1\00"
@str.6 = [3 x i8] c"L2\00"
define void @fork5() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%2 = tail call i64 (...) @fork()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i64 (...) @fork()
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.6, i64 0, i64 0))
br label %10
10: ; preds = %4, %8, %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ calloc(size_t, size_t);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void *xcalloc(size_t nmemb, size_t size) {
  void *r;
  if ((r = (void *)calloc(nmemb, size)) == 0) {
    fprintf(stderr, "calloc: out of memory\n");
    exit(1);
  }
  return r;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    117a <xcalloc+0x4a>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xe95(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %rax
call   1030 <calloc@plt>
test   %rax,%rax
je     113d <xcalloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"calloc: out of memory\0A\00"
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i64 @calloc(i64 %6, i64 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"calloc: out of memory\0A\00"
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = tail call i64 @calloc(i64 %0, i64 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = inttoptr i64 %3 to i8*
ret i8* %10
}
/* Variables and functions */
int tag_hash(char *name) {
  uintptr_t l = (uintptr_t)name;
  int res = 0;
  while (l) {
    res ^= l;
    l >>= 12;
  }
  return res & 4095;
}


x86 assembly (clang, -O0):
<tag_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1141 <tag_hash+0x41>
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rax
xor    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
shr    $0xc,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <tag_hash+0x17>
mov    -0x14(%rbp),%eax
and    $0xfff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tag_hash>:
xor    %eax,%eax
test   %rdi,%rdi
je     1127 <tag_hash+0x27>
mov    %rdi,%rcx
nopw   0x0(%rax,%rax,1)
xor    %edi,%eax
shr    $0xc,%rcx
cmp    $0xfff,%rdi
mov    %rcx,%rdi
ja     1110 <tag_hash+0x10>
and    $0xfff,%eax
ret

LLVM IR (-O0):
define i32 @tag_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %3
store i32 0, i32* %4
br label %7
7: ; preds = %10, %1
%8 = load i64, i64* %3
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i64, i64* %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = xor i64 %13, %11
%15 = trunc i64 %14 to i32
store i32 %15, i32* %4
%16 = load i64, i64* %3
%17 = lshr i64 %16, 12
store i64 %17, i64* %3
br label %7
18: ; preds = %7
%19 = load i32, i32* %4
%20 = and i32 %19, 4095
ret i32 %20
}

LLVM IR (-O2):
define i32 @tag_hash(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = ptrtoint i8* %0 to i64
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ 0, %3 ]
%7 = phi i64 [ %10, %5 ], [ %4, %3 ]
%8 = trunc i64 %7 to i32
%9 = xor i32 %6, %8
%10 = lshr i64 %7, 12
%11 = icmp ult i64 %7, 4096
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = and i32 %9, 4095
br label %14
14: ; preds = %12, %1
%15 = phi i32 [ 0, %1 ], [ %13, %12 ]
ret i32 %15
}
/* Variables and functions */
int *malloc(int);
void main() {
  int *x;
  int *y;
  x = malloc(sizeof(int));
  y = x;
  *y = 13;
}


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

x86 assembly (clang, -O2):
<main>:
mov    $0x4,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i32* @malloc(i32 4)
store i32* %3, i32** %1
%4 = load i32*, i32** %1
store i32* %4, i32** %2
%5 = load i32*, i32** %2
store i32 13, i32* %5
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32* @malloc(i32 4)
ret void
}
void GPMCPrefetchAccessModeSelect(unsigned int baseAddr,
                                  unsigned int accessMode) {
  (*((volatile unsigned int *)(baseAddr + (0x1E0 + ((1 - 1) * (0x4)))))) &=
      ~(0x00000001u);
  (*((volatile unsigned int *)(baseAddr + (0x1E0 + ((1 - 1) * (0x4)))))) |=
      ((accessMode << (0x00000000u)) & (0x00000001u));
}


x86 assembly (clang, -O0):
<GPMCPrefetchAccessModeSelect>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1e0,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%edx
shl    $0x0,%edx
and    $0x1,%edx
mov    -0x4(%rbp),%eax
add    $0x1e0,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPMCPrefetchAccessModeSelect>:
add    $0x1e0,%edi
andl   $0xfffffffe,(%rdi)
and    $0x1,%esi
or     %esi,(%rdi)
ret

LLVM IR (-O0):
define void @GPMCPrefetchAccessModeSelect(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 = add i32 %5, 480
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -2
store volatile i32 %10, i32* %8
%11 = load i32, i32* %4
%12 = shl i32 %11, 0
%13 = and i32 %12, 1
%14 = load i32, i32* %3
%15 = add i32 %14, 480
%16 = zext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
%19 = or i32 %18, %13
store volatile i32 %19, i32* %17
ret void
}

LLVM IR (-O2):
define void @GPMCPrefetchAccessModeSelect(i32 %0, i32 %1) {
%3 = add i32 %0, 480
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, -2
store volatile i32 %7, i32* %5
%8 = and i32 %1, 1
%9 = load volatile i32, i32* %5
%10 = or i32 %9, %8
store volatile i32 %10, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AlarmToTimerC__0__fired__postTask();
void AlarmToTimerC__0__Alarm__fired(void) {
  AlarmToTimerC__0__fired__postTask();
}


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

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

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

LLVM IR (-O2):
define void @AlarmToTimerC__0__Alarm__fired() {
%1 = tail call i32 (...) @AlarmToTimerC__0__fired__postTask()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
void filecopy(FILE *ifp, FILE *ofp) {
  int c;
  while ((c = getc(ifp)) != EOF) {
    putc(c, ofp);
  }
}


x86 assembly (clang, -O0):
<filecopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%eax
je     115c <filecopy+0x3c>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <putc@plt>
jmp    1130 <filecopy+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filecopy>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <getc@plt>
mov    0x2eb1(%rip),%r15
cmp    (%r15),%eax
je     1157 <filecopy+0x37>
nopl   0x0(%rax)
mov    %eax,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    (%r15),%eax
jne    1140 <filecopy+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @filecopy(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
br label %6
6: ; preds = %11, %2
%7 = load i32*, i32** %3
%8 = call i32 @getc(i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = load i32, i32* %5
%13 = load i32*, i32** %4
%14 = call i32 @putc(i32 %12, i32* %13)
br label %6
15: ; preds = %6
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @filecopy(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 @getc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %9, %6 ], [ %3, %2 ]
%8 = tail call i32 @putc(i32 %7, i32* %1)
%9 = tail call i32 @getc(i32* %0)
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
void f2(char *source) {
  char *destination = 0;
  memcpy(destination - 0, source, 10);
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0xa,%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
mov    %rdi,%rsi
xor    %edi,%edi
mov    $0xa,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @f2(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @memcpy(i8* %5, i8* %6, i32 10)
ret void
}

LLVM IR (-O2):
define void @f2(i8* %0) {
%2 = tail call i32 @memcpy(i8* null, i8* %0, i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int /*<<< orphan*/);
int starts_with(const char *str, const char *prefix) {
  return strncmp(prefix, str, strlen(prefix)) == 0;
}


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

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

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

LLVM IR (-O2):
define i32 @starts_with(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i64 @strncmp(i8* %1, i8* %0, i32 %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ decrypt(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main(int argc, char *argv[]) {
  int buflen = 1024;
  char buf[buflen];
  scanf("%s", buf);
  decrypt(buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x400,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x30(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x28(%rbp)
lea    0xe96(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <decrypt@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
lea    0xed1(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <decrypt@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1024, i32* %6
%9 = load i32, i32* %6
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i8, i64 %10
store i64 %10, i64* %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @decrypt(i8* %12)
store i32 0, i32* %3
%15 = load i8*, i8** %7
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @decrypt(i8* %4)
ret i32 0
}
/* Variables and functions */
int rand();
int stub_func(int n) { return 1 + rand() % n; }


x86 assembly (clang, -O0):
<stub_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stub_func>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
lea    0x1(%rdx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @stub_func(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
%6 = add nsw i32 1, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @stub_func(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
%4 = add nsw i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0xea() {
  Assert_real((isxdigit(234) == 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",
              1175, ("isxdigit should be 0 for 0xea"));
}


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

x86 assembly (clang, -O2):
<t_isxdigit_0xea>:
push   %rax
mov    $0xea,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x497,%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 0xea\00"
define void @t_isxdigit_0xea() {
%1 = call i64 @isxdigit(i32 234)
%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 1175, 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 0xea\00"
define void @t_isxdigit_0xea() {
%1 = tail call i64 @isxdigit(i32 234)
%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 1175, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear(char *, int);
int main(void) {
  char x[3];
  clear(x, 4);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x3(%rbp),%rdi
mov    $0x4,%esi
call   1030 <clear@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x5(%rsp),%rdi
mov    $0x4,%esi
call   1030 <clear@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%3 = call i32 @clear(i8* %2, i32 4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%3 = call i32 @clear(i8* %2, i32 4)
ret i32 0
}
int ft_isalpha(int c) {
  if (c >= 'A' && c <= 'Z')
    return (1);
  if (c >= 'a' && c <= 'z')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_isalpha>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     1127 <ft_isalpha+0x27>
cmpl   $0x5a,-0x8(%rbp)
jg     1127 <ft_isalpha+0x27>
movl   $0x1,-0x4(%rbp)
jmp    114e <ft_isalpha+0x4e>
cmpl   $0x61,-0x8(%rbp)
jl     1147 <ft_isalpha+0x47>
cmpl   $0x7a,-0x8(%rbp)
jg     1147 <ft_isalpha+0x47>
movl   $0x1,-0x4(%rbp)
jmp    114e <ft_isalpha+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isalpha>:
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isalpha(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 90
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %18
10: ; preds = %6, %1
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 97
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 122
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 1, i32* %2
br label %18
17: ; preds = %13, %10
store i32 0, i32* %2
br label %18
18: ; preds = %17, %16, %9
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @ft_isalpha(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
char *l_getNpnSps(char *str) {
  while ((*str != '\0') && (!(*str > ' ')))
    str++;
  return str;
}


x86 assembly (clang, -O0):
<l_getNpnSps>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     112f <l_getNpnSps+0x2f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
setg   %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113f <l_getNpnSps+0x3f>
jmp    1150 <l_getNpnSps+0x50>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <l_getNpnSps+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_getNpnSps>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1121 <l_getNpnSps+0x21>
cmp    $0x21,%cl
jl     1110 <l_getNpnSps+0x10>
ret

LLVM IR (-O0):
define i8* @l_getNpnSps(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %16, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp sgt i32 %11, 32
%13 = xor i1 %12, true
br label %14
14: ; preds = %8, %3
%15 = phi i1 [ false, %3 ], [ %13, %8 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
br label %3
19: ; preds = %14
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
define i8* @l_getNpnSps(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %8, %2 ]
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 0
%6 = icmp slt i8 %4, 33
%7 = and i1 %5, %6
%8 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %7, label %2, label %9
9: ; preds = %2
ret i8* %3
}
void print(int n) {
  int *IO = (int *)0x3c000000;
  *IO = n;
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x3c000000,%eax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
mov    %edi,0x3c000000
ret

LLVM IR (-O0):
define void @print(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
store i32* inttoptr (i64 1006632960 to i32*), i32** %3
%4 = load i32, i32* %2
%5 = load i32*, i32** %3
store i32 %4, i32* %5
ret void
}

LLVM IR (-O2):
define void @print(i32 %0) {
store i32 %0, i32* inttoptr (i64 1006632960 to i32*)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_spinlock_t;

/* Variables and functions */
int pthread_spin_lock(int /*<<< orphan*/ *);
int __attribute__((unused))
___pthread_spin_lock(pthread_spinlock_t *spin, char *lname, char *fn, int ln) {
  return pthread_spin_lock(spin);
}


x86 assembly (clang, -O0):
<___pthread_spin_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pthread_spin_lock@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<___pthread_spin_lock>:
jmp    1030 <pthread_spin_lock@plt>

LLVM IR (-O0):
define i32 @___pthread_spin_lock(i32* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = call i32 @pthread_spin_lock(i32* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @___pthread_spin_lock(i32* %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
%5 = tail call i32 @pthread_spin_lock(i32* %0)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printResult(int *, int *, int);
int main() {
  int a[] = {-2, -1, 0, 6, 7, 9};
  int val = -2;
  printResult(&val, a, 6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0xfffffffe,-0x24(%rbp)
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdi
mov    $0x6,%edx
call   1030 <printResult@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0xfffffffe,0xc(%rsp)
ff
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    $0x6,%edx
call   1030 <printResult@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [6 x i32] [i32 -2, i32 -1, i32 0, i32 6, i32 7, i32 9]
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [6 x i32]* %2 to i8*
store i32 -2, i32* %3
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%6 = call i32 @printResult(i32* %3, i32* %5, i32 6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [6 x i32] [i32 -2, i32 -1, i32 0, i32 6, i32 7, i32 9]
define i32 @main() {
%1 = alloca [6 x i32]
%2 = alloca i32
%3 = bitcast [6 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 -2, i32* %2
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%6 = call i32 @printResult(i32* %2, i32* %5, i32 6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ serialWriteChar(int, char);
int strlen(char *);
void serialWriteString(int fd, char *s) {
  int l = strlen(s);
  for (int i = 0; i < l; i++) {
    serialWriteChar(fd, s[i]);
  }
}


x86 assembly (clang, -O0):
<serialWriteString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1170 <serialWriteString+0x50>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1040 <serialWriteChar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1142 <serialWriteString+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialWriteString>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%r14d
mov    %rsi,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1156 <serialWriteString+0x36>
mov    %eax,%ebp
xor    %ebx,%ebx
nopl   (%rax)
movsbl (%r15,%rbx,1),%esi
mov    %r14d,%edi
call   1040 <serialWriteChar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <serialWriteString+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @serialWriteString(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = zext i32 %3 to i64
br label %8
7: ; preds = %8, %2
ret void
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %13, %8 ]
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = tail call i32 @serialWriteChar(i32 %0, i8 signext %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %7, label %8
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
void free_ivector(int *v) { free(v); }


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

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

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

LLVM IR (-O2):
define void @free_ivector(i32* nocapture %0) {
%2 = tail call i32 @free(i32* %0)
ret void
}
int *get_arr() {
  static int arr[50000] = {8};
  return arr;
}


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

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

LLVM IR (-O0):
@get_arr.arr = internal global <{ i32, [49999 x i32] }> <{ i32 8, [49999 x i32] zeroinitializer }>
define i32* @get_arr() {
ret i32* getelementptr inbounds ([50000 x i32], [50000 x i32]* bitcast (<{ i32, [49999 x i32] }>* @get_arr.arr to [50000 x i32]*), i64 0, i64 0)
}

LLVM IR (-O2):
@get_arr.arr = internal global <{ i32, [49999 x i32] }> <{ i32 8, [49999 x i32] zeroinitializer }>
define i32* @get_arr() {
ret i32* getelementptr inbounds (<{ i32, [49999 x i32] }>, <{ i32, [49999 x i32] }>* @get_arr.arr, i64 0, i32 0)
}
/* Variables and functions */
int /*<<< orphan*/ op_mkdir(int /*<<< orphan*/);
void wl_mkdir(void) { op_mkdir(0); }


x86 assembly (clang, -O0):
<wl_mkdir>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <op_mkdir@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_mkdir>:
xor    %edi,%edi
jmp    1030 <op_mkdir@plt>

LLVM IR (-O0):
define void @wl_mkdir() {
%1 = call i32 @op_mkdir(i32 0)
ret void
}

LLVM IR (-O2):
define void @wl_mkdir() {
%1 = tail call i32 @op_mkdir(i32 0)
ret void
}
/* Variables and functions */
bool nrf91_errata_15(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf91_errata_15() {
ret i32 0
}
void protocolBISTRxTestFrame(void) {}


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

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

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

LLVM IR (-O2):
define void @protocolBISTRxTestFrame() {
ret void
}
void vtime_account_user(struct task_struct *tsk) {}


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @vtime_account_user(%struct.task_struct* nocapture %0) {
ret void
}
int f(int c) { return 32 + c * 9 / 5; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x9,-0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
add    $0x20,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    (%rdi,%rdi,8),%eax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
sar    $0x21,%rcx
shr    $0x3f,%rax
add    %ecx,%eax
add    $0x20,%eax
ret

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 9
%5 = sdiv i32 %4, 5
%6 = add nsw i32 32, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = mul nsw i32 %0, 9
%3 = sdiv i32 %2, 5
%4 = add nsw i32 %3, 32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ lBuff;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char const *const, char *);
int tryCommand(char const *const aCommand) {
  char lBuff[1024];
  FILE *lIn = popen(aCommand, "r");
  if (fgets(lBuff, sizeof(lBuff), lIn) == NULL) {
    pclose(lIn);
    return 1;
  } else {
    pclose(lIn);
    return 0;
  }
}


x86 assembly (clang, -O0):
<tryCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    1190 <tryCommand+0x60>
mov    -0x418(%rbp),%rdi
call   1030 <pclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a3 <tryCommand+0x73>
mov    -0x418(%rbp),%rdi
call   1030 <pclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tryCommand>:
push   %rbp
push   %rbx
sub    $0x408,%rsp
lea    0xec0(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1040 <fgets@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %rbx,%rdi
call   1030 <pclose@plt>
mov    %ebp,%eax
add    $0x408,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i32 @tryCommand(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = alloca i32*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32* @popen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %5
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = load i32*, i32** %5
%10 = call i32* @fgets(i8* %8, i32 1024, i32* %9)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i32*, i32** %5
%14 = call i32 @pclose(i32* %13)
store i32 1, i32* %2
br label %18
15: ; preds = %1
%16 = load i32*, i32** %5
%17 = call i32 @pclose(i32* %16)
store i32 0, i32* %2
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @tryCommand(i8* nocapture %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @popen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32* @fgets(i8* %3, i32 1024, i32* %4)
%6 = icmp eq i32* %5, null
%7 = call i32 @pclose(i32* %4)
%8 = zext i1 %6 to i32
ret i32 %8
}
int odd_even(int num) {
  if (num % 2 == 0)
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<odd_even>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1127 <odd_even+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <odd_even+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<odd_even>:
mov    %edi,%eax
not    %eax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @odd_even(i32 %0) {
%2 = and i32 %0, 1
%3 = xor i32 %2, 1
ret i32 %3
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int64_t monotonic_time_ms(int ms) { return ms; }


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

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

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

LLVM IR (-O2):
define i32 @monotonic_time_ms(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
int is_history_command(const char command[]) {
  return strcmp(command, "!!") != 0 && strcmp(command, "!") != 0;
}


x86 assembly (clang, -O0):
<is_history_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     1158 <is_history_command+0x48>
mov    -0x8(%rbp),%rdi
lea    0xeb8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_history_command>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1141 <is_history_command+0x31>
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"!!\00"
@.str.1 = [2 x i8] c"!\00"
define i32 @is_history_command(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@.str = [3 x i8] c"!!\00"
@.str.1 = [2 x i8] c"!\00"
define i32 @is_history_command(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
int fn2() { return 5; }


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

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

LLVM IR (-O0):
define i32 @fn2() {
ret i32 5
}

LLVM IR (-O2):
define i32 @fn2() {
ret i32 5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
__attribute__((__visibility__("hidden"))) void bar() { printf("bar\n"); }


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

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

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

LLVM IR (-O2):
@str = [4 x i8] c"bar\00"
define hidden void @bar() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *mystrdup(const char *p) {
  char *q;
  if (p == NULL)
    return NULL;
  q = malloc(strlen(p) + 1);
  if (q != NULL)
    strcpy(q, p);
  return q;
}


x86 assembly (clang, -O0):
<mystrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <mystrdup+0x24>
movq   $0x0,-0x8(%rbp)
jmp    118d <mystrdup+0x5d>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1185 <mystrdup+0x55>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrdup>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115f <mystrdup+0x2f>
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     115f <mystrdup+0x2f>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    1161 <mystrdup+0x31>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @mystrdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = add nsw i64 %4, 1
%6 = tail call i8* @malloc(i64 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %6, i8* %0)
br label %10
10: ; preds = %3, %8, %1
%11 = phi i8* [ null, %1 ], [ %6, %8 ], [ null, %3 ]
ret i8* %11
}