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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void _save_to_file(int idx, void *data, void *arg) {
  FILE *fp = (FILE *)arg;
  fprintf(fp, "%s\n", (char *)data);
  return;
}


x86 assembly (clang, -O0):
<_save_to_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_save_to_file>:
mov    %rdx,%rdi
mov    %rsi,%rdx
lea    0xee3(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @_save_to_file(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %7
%10 = load i32*, i32** %7
%11 = load i8*, i8** %5
%12 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @_save_to_file(i32 %0, i8* %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i32*
%5 = tail call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ **calloc(int, int);
int /*<<< orphan*/ log_fatal(char *, char *);
uint64_t **pbm_init(void) {
  uint64_t **retv = calloc((0xFFFFFFFF / 0xFFFF), sizeof(void *));
  if (!retv) {
    log_fatal("pbm", "unable to allocate memory for base page table");
  }
  return retv;
}


x86 assembly (clang, -O0):
<pbm_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10001,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1159 <pbm_init+0x39>
lea    0xeb3(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1040 <log_fatal@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pbm_init>:
push   %rbx
mov    $0x10001,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114b <pbm_init+0x2b>
lea    0xec1(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1040 <log_fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"pbm\00"
@.str.1 = [46 x i8] c"unable to allocate memory for base page table\00"
define i32** @pbm_init() {
%1 = alloca i32**
%2 = call i32** @calloc(i32 65537, i32 8)
store i32** %2, i32*** %1
%3 = load i32**, i32*** %1
%4 = icmp ne i32** %3, null
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @log_fatal(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = load i32**, i32*** %1
ret i32** %8
}

LLVM IR (-O2):
@.str = [4 x i8] c"pbm\00"
@.str.1 = [46 x i8] c"unable to allocate memory for base page table\00"
define noalias i32** @pbm_init() {
%1 = tail call i32** @calloc(i32 65537, i32 8)
%2 = icmp eq i32** %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @log_fatal(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret i32** %1
}
int __attribute__((no)) func(int x) { return x + 1; }


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

x86 assembly (clang, -O2):
<func>:
lea    0x1(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @func(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @func(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, int);
int strlenght(char *);
int main(void) {
  printf("Nr de caractere = %d", strlenght("This is a string."));
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecf(%rip),%rdi
call   1050 <strlenght@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedd(%rip),%rdi
call   1050 <strlenght@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Nr de caractere = %d\00"
@.str.1 = [18 x i8] c"This is a string.\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @strlenght(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Nr de caractere = %d\00"
@.str.1 = [18 x i8] c"This is a string.\00"
define i32 @main() {
%1 = tail call i32 @strlenght(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @getchar()
ret i32 0
}
__attribute__((always_)) void mm_update_next_owner(struct mm_struct *mm) {}


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

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

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

LLVM IR (-O2):
%struct.mm_struct = type opaque
define void @mm_update_next_owner(%struct.mm_struct* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isalnum(int);
void t_isalnum_0x64() {
  Assert_real((isalnum(100)),
              "/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_isalnum.c",
              505, ("isalnum should be 1 for d"));
}


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

x86 assembly (clang, -O2):
<t_isalnum_0x64>:
push   %rax
mov    $0x64,%edi
call   1030 <isalnum@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x1f9,%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_isalnum.c\00"
@.str.1 = [26 x i8] c"isalnum should be 1 for d\00"
define void @t_isalnum_0x64() {
%1 = call i32 @isalnum(i32 100)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 505, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [26 x i8] c"isalnum should be 1 for d\00"
define void @t_isalnum_0x64() {
%1 = tail call i32 @isalnum(i32 100)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 505, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
struct node *createLists();
int /*<<< orphan*/ flatten(struct node *);
int /*<<< orphan*/ printList(struct node *);
int main() {
  struct node *head = NULL;
  head = createLists();
  flatten(head);
  printList(head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <createLists@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <flatten@plt>
mov    -0x10(%rbp),%rdi
call   1050 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <createLists@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <flatten@plt>
mov    %rbx,%rdi
call   1050 <printList@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
store i32 0, i32* %1
store %struct.node* null, %struct.node** %2
%3 = call %struct.node* (...) @createLists()
store %struct.node* %3, %struct.node** %2
%4 = load %struct.node*, %struct.node** %2
%5 = call i32 @flatten(%struct.node* %4)
%6 = load %struct.node*, %struct.node** %2
%7 = call i32 @printList(%struct.node* %6)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
define i32 @main() {
%1 = tail call %struct.node* (...) @createLists()
%2 = tail call i32 @flatten(%struct.node* %1)
%3 = tail call i32 @printList(%struct.node* %1)
ret i32 0
}
int test_imm_DBuint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xDB << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DBuint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0xdb,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_DBuint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 219
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_DBuint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 940597837824
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_divpwr2(int x, int n) {
  int p2n = 1 << n;
  return x / p2n;
}


x86 assembly (clang, -O0):
<test_divpwr2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_divpwr2>:
mov    %esi,%ecx
mov    $0x1,%esi
shl    %cl,%esi
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @test_divpwr2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = shl i32 1, %6
store i32 %7, i32* %5
%8 = load i32, i32* %3
%9 = load i32, i32* %5
%10 = sdiv i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @test_divpwr2(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = sdiv i32 %0, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("helloworld!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"helloworld!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"helloworld!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int string(char *token, int max) {
  char *s;
  int i;
  s = token;
  for (i = 0; i <= max; i++)
    if (*s++ == '\0')
      return (1);
  return (0);
}


x86 assembly (clang, -O0):
<string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1160 <string+0x60>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    114d <string+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    1167 <string+0x67>
jmp    1152 <string+0x52>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111a <string+0x1a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string>:
test   %esi,%esi
js     111e <string+0x1e>
add    $0x1,%esi
xor    %eax,%eax
nopl   0x0(%rax)
cmpb   $0x0,(%rdi,%rax,1)
je     1121 <string+0x21>
add    $0x1,%rax
cmp    %eax,%esi
jne    1110 <string+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @string(i8* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %9
%5 = phi i32 [ %11, %9 ], [ 0, %2 ]
%6 = phi i8* [ %10, %9 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = add nuw i32 %5, 1
%12 = icmp eq i32 %5, %1
br i1 %12, label %13, label %4
13: ; preds = %4, %9, %2
%14 = phi i32 [ 0, %2 ], [ 0, %9 ], [ 1, %4 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ eembed_diy_str_to_u64(char const *, char **, int);
uint64_t eembed_str_to_u64(const char *str, char **endptr, int base) {
  return eembed_diy_str_to_u64(str, endptr, base);
}


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

x86 assembly (clang, -O2):
<eembed_str_to_u64>:
jmp    1030 <eembed_diy_str_to_u64@plt>

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

LLVM IR (-O2):
define i32 @eembed_str_to_u64(i8* %0, i8** %1, i32 %2) {
%4 = tail call i32 @eembed_diy_str_to_u64(i8* %0, i8** %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ X_OK;
int access(char const *, int /*<<< orphan*/);
int executable(const char *fname) {
  if (access(fname, X_OK) != -1) {
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<executable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0xffffffff,%eax
je     1143 <executable+0x33>
movl   $0x1,-0x4(%rbp)
jmp    114a <executable+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<executable>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@X_OK = global i32 0
define i32 @executable(i8* nocapture %0) {
%2 = load i32, i32* @X_OK
%3 = tail call i32 @access(i8* %0, i32 %2)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
scalar_t__ malloc(int);
float *CreateQueue() {
  float *Q;
  Q = (float *)malloc(sizeof(float));
  if (Q == NULL)
    return NULL;
  Q[0] = -1.0;
  return Q;
}


x86 assembly (clang, -O0):
<CreateQueue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113e <CreateQueue+0x2e>
movq   $0x0,-0x8(%rbp)
jmp    1156 <CreateQueue+0x46>
mov    -0x10(%rbp),%rax
movss  0xeb6(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateQueue>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     1128 <CreateQueue+0x18>
movl   $0xbf800000,(%rax)
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define float* @CreateQueue() {
%1 = alloca float*
%2 = alloca float*
%3 = call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to float*
store float* %4, float** %2
%5 = load float*, float** %2
%6 = icmp eq float* %5, null
br i1 %6, label %7, label %8
7: ; preds = %0
store float* null, float** %1
br label %12
8: ; preds = %0
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 0
store float -1.000000e+00, float* %10
%11 = load float*, float** %2
store float* %11, float** %1
br label %12
12: ; preds = %8, %7
%13 = load float*, float** %1
ret float* %13
}

LLVM IR (-O2):
define float* @CreateQueue() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to float*
%3 = icmp eq i64 %1, 0
br i1 %3, label %5, label %4
4: ; preds = %0
store float -1.000000e+00, float* %2
br label %5
5: ; preds = %0, %4
%6 = phi float* [ %2, %4 ], [ null, %0 ]
ret float* %6
}
/* Variables and functions */
int /*<<< orphan*/ ugl_AddBytecode(int);
void ugl_bytecode_reserve_arg_stack(int arg_cnt) {
  while (arg_cnt > 16) {
    ugl_AddBytecode((0x05) | 0x0f0);
    arg_cnt -= 16;
  }
  if (arg_cnt > 0) {
    arg_cnt--;
    ugl_AddBytecode((0x05) | (arg_cnt << 4));
  }
}


x86 assembly (clang, -O0):
<ugl_bytecode_reserve_arg_stack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jle    113d <ugl_bytecode_reserve_arg_stack+0x2d>
mov    $0xf5,%edi
call   1030 <ugl_AddBytecode@plt>
mov    -0x4(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0x4(%rbp)
jmp    111b <ugl_bytecode_reserve_arg_stack+0xb>
cmpl   $0x0,-0x4(%rbp)
jle    115e <ugl_bytecode_reserve_arg_stack+0x4e>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x4,%edi
or     $0x5,%edi
call   1030 <ugl_AddBytecode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ugl_bytecode_reserve_arg_stack>:
push   %rbx
cmp    $0x11,%edi
jl     1136 <ugl_bytecode_reserve_arg_stack+0x26>
mov    %edi,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0xf5,%edi
call   1030 <ugl_AddBytecode@plt>
lea    -0x10(%rbx),%edi
cmp    $0x20,%ebx
mov    %edi,%ebx
ja     1120 <ugl_bytecode_reserve_arg_stack+0x10>
jmp    113a <ugl_bytecode_reserve_arg_stack+0x2a>
test   %edi,%edi
jle    1146 <ugl_bytecode_reserve_arg_stack+0x36>
shl    $0x4,%edi
add    $0xfffffff5,%edi
pop    %rbx
jmp    1030 <ugl_AddBytecode@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @ugl_bytecode_reserve_arg_stack(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %6, %1
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 16
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = call i32 @ugl_AddBytecode(i32 245)
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 16
store i32 %9, i32* %2
br label %3
10: ; preds = %3
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %2
%15 = add nsw i32 %14, -1
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = shl i32 %16, 4
%18 = or i32 5, %17
%19 = call i32 @ugl_AddBytecode(i32 %18)
br label %20
20: ; preds = %13, %10
ret void
}

LLVM IR (-O2):
define void @ugl_bytecode_reserve_arg_stack(i32 %0) {
%2 = icmp sgt i32 %0, 16
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = tail call i32 @ugl_AddBytecode(i32 245)
%6 = add nsw i32 %4, -16
%7 = icmp ugt i32 %4, 32
br i1 %7, label %3, label %10
8: ; preds = %1
%9 = icmp sgt i32 %0, 0
br i1 %9, label %10, label %15
10: ; preds = %3, %8
%11 = phi i32 [ %0, %8 ], [ %6, %3 ]
%12 = shl nuw nsw i32 %11, 4
%13 = add nsw i32 %12, -11
%14 = tail call i32 @ugl_AddBytecode(i32 %13)
br label %15
15: ; preds = %10, %8
ret void
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_mvwaddwstr(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_mvwaddwstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    115a <cmd_mvwaddwstr+0x2a>
jmp    1170 <cmd_mvwaddwstr+0x40>
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xe95(%rip),%rdi
call   1050 <report_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_mvwaddwstr>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_mvwaddwstr+0x12>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xead(%rip),%rdi
pop    %rax
jmp    1050 <report_error@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_mvwaddwstr(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 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_mvwaddwstr(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ helloWorld();
int /*<<< orphan*/ printf(char *, int);
int main() {
  helloWorld();
  printf("HelloWorld, %d\n", 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <helloWorld@plt>
lea    0xec3(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [16 x i8] c"HelloWorld, %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @helloWorld()
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"HelloWorld, %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @helloWorld()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ err_sys(char *);
int /*<<< orphan*/ fork();
pid_t Fork(void) {
  pid_t pid;
  if ((pid = fork()) < 0) {
    err_sys("fork error");
  }
  return pid;
}


x86 assembly (clang, -O0):
<Fork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <fork@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    1147 <Fork+0x27>
lea    0xebe(%rip),%rdi
call   1030 <err_sys@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fork>:
push   %rbx
xor    %eax,%eax
call   1040 <fork@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    113a <Fork+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <err_sys@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"fork error\00"
define i32 @Fork() {
%1 = alloca i32
%2 = call i32 (...) @fork()
store i32 %2, i32* %1
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @err_sys(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [11 x i8] c"fork error\00"
define i32 @Fork() {
%1 = tail call i32 (...) @fork()
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @err_sys(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret i32 %1
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ test3();
int main() {
  test3();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <test3@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test3@plt>
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test3()
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @test3()
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
/* Type definitions */
typedef int uint64_t;
typedef void *uint32_t;

/* Variables and functions */
void *htonl(int);
uint64_t htonll(uint64_t i) {
  union {
    uint64_t ui64;
    struct {
      uint32_t a;
      uint32_t b;
    } ui32;
  } u;
  u.ui32.a = htonl(i >> 32);
  u.ui32.b = htonl(i >> 0);
  return u.ui64;
}


x86 assembly (clang, -O0):
<htonll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
call   1030 <htonl@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
sar    $0x0,%edi
call   1030 <htonl@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<htonll>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <htonl@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1030 <htonl@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%union.anon = type { %struct.anon }
%struct.anon = type { i8*, i8* }
define i32 @htonll(i32 %0) {
%2 = alloca i32
%3 = alloca %union.anon
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 32
%6 = call i8* @htonl(i32 %5)
%7 = bitcast %union.anon* %3 to %struct.anon*
%8 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
store i8* %6, i8** %8
%9 = load i32, i32* %2
%10 = ashr i32 %9, 0
%11 = call i8* @htonl(i32 %10)
%12 = bitcast %union.anon* %3 to %struct.anon*
%13 = getelementptr inbounds %struct.anon, %struct.anon* %12, i32 0, i32 1
store i8* %11, i8** %13
%14 = bitcast %union.anon* %3 to i32*
%15 = load i32, i32* %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @htonll(i32 %0) {
%2 = tail call i8* @htonl(i32 poison)
%3 = tail call i8* @htonl(i32 %0)
%4 = ptrtoint i8* %2 to i64
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ writeDbl(char *, double);
void start() {
  writeDbl("ax", 0.0);
  writeDbl("ay", 0.0);
}


x86 assembly (clang, -O0):
<start>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
xorps  %xmm0,%xmm0
call   1030 <writeDbl@plt>
lea    0xed9(%rip),%rdi
xorps  %xmm0,%xmm0
call   1030 <writeDbl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<start>:
push   %rax
lea    0xee8(%rip),%rdi
xorps  %xmm0,%xmm0
call   1030 <writeDbl@plt>
lea    0xedc(%rip),%rdi
xorps  %xmm0,%xmm0
pop    %rax
jmp    1030 <writeDbl@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"ax\00"
@.str.1 = [3 x i8] c"ay\00"
define void @start() {
%1 = call i32 @writeDbl(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double 0.000000e+00)
%2 = call i32 @writeDbl(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double 0.000000e+00)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"ax\00"
@.str.1 = [3 x i8] c"ay\00"
define void @start() {
%1 = tail call i32 @writeDbl(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double 0.000000e+00)
%2 = tail call i32 @writeDbl(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double 0.000000e+00)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, unsigned int, unsigned int, double);
void new_print_double(char *s, double f) {
  unsigned int *u;
  u = (unsigned int *)&f;
  printf("%20s %8x %8x %.20g\n", s, *u, *(u + 1), f);
}


x86 assembly (clang, -O0):
<new_print_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
movsd  -0x10(%rbp),%xmm0
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_print_double>:
mov    %rdi,%rsi
movq   %xmm0,%rdx
mov    %rdx,%rcx
shr    $0x20,%rcx
lea    0xeda(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [20 x i8] c"%20s %8x %8x %.20g\0A\00"
define void @new_print_double(i8* %0, double %1) {
%3 = bitcast double %1 to i64
%4 = trunc i64 %3 to i32
%5 = lshr i64 %3, 32
%6 = trunc i64 %5 to i32
%7 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %4, i32 %6, double %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ funcb();
int main(void) {
  funcb();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <funcb@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @funcb()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @funcb()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
__attribute__((always_)) void tu_move_up(int delta_y) {
  printf("\x1b[%dA", delta_y);
}


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

x86 assembly (clang, -O2):
<tu_move_up>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%dA\00"
define void @tu_move_up(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help_sh() {
  printf(" Help:\n");
  printf("  clear - clear screen:\n");
  printf("  version - the kernel version:\n");
}


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

x86 assembly (clang, -O2):
<help_sh>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c" Help:\0A\00"
@.str.1 = [25 x i8] c" clear - clear screen:\0A\00"
@.str.2 = [33 x i8] c" version - the kernel version:\0A\00"
define void @help_sh() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c" Help:\00"
@str.3 = [24 x i8] c" clear - clear screen:\00"
@str.4 = [32 x i8] c" version - the kernel version:\00"
define void @help_sh() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0))
ret void
}
void afio_init(void) {}


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

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

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

LLVM IR (-O2):
define void @afio_init() {
ret void
}
/* Variables and functions */
int fileno(int /*<<< orphan*/);
int /*<<< orphan*/ makeTmpFileStream();
int makeTmpFile() { return fileno(makeTmpFileStream()); }


x86 assembly (clang, -O0):
<makeTmpFile>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <makeTmpFileStream@plt>
mov    %eax,%edi
call   1040 <fileno@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeTmpFile>:
push   %rax
xor    %eax,%eax
call   1030 <makeTmpFileStream@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <fileno@plt>

LLVM IR (-O0):
define i32 @makeTmpFile() {
%1 = call i32 (...) @makeTmpFileStream()
%2 = call i32 @fileno(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
define i32 @makeTmpFile() {
%1 = tail call i32 (...) @makeTmpFileStream()
%2 = tail call i32 @fileno(i32 %1)
ret i32 %2
}
void vadd(double *add, double *v1, double *v2) {
  add[0] = v1[0] + v2[0];
  add[1] = v1[1] + v2[1];
  add[2] = v1[2] + v2[2];
}


x86 assembly (clang, -O0):
<vadd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
addsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
addsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vadd>:
movsd  (%rsi),%xmm0
addsd  (%rdx),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rsi),%xmm0
addsd  0x8(%rdx),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x10(%rsi),%xmm0
addsd  0x10(%rdx),%xmm0
movsd  %xmm0,0x10(%rdi)
ret

LLVM IR (-O0):
define void @vadd(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %5
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %6
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = fadd double %9, %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 0
store double %13, double* %15
%16 = load double*, double** %5
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = fadd double %18, %21
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 1
store double %22, double* %24
%25 = load double*, double** %5
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
%28 = load double*, double** %6
%29 = getelementptr inbounds double, double* %28, i64 2
%30 = load double, double* %29
%31 = fadd double %27, %30
%32 = load double*, double** %4
%33 = getelementptr inbounds double, double* %32, i64 2
store double %31, double* %33
ret void
}

LLVM IR (-O2):
define void @vadd(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %1
%5 = load double, double* %2
%6 = fadd double %4, %5
store double %6, double* %0
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %2, i64 1
%10 = load double, double* %9
%11 = fadd double %8, %10
%12 = getelementptr inbounds double, double* %0, i64 1
store double %11, double* %12
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %2, i64 2
%16 = load double, double* %15
%17 = fadd double %14, %16
%18 = getelementptr inbounds double, double* %0, i64 2
store double %17, double* %18
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void reinit_graphics() {
  printf("\033[%sm", "0");
  printf("\033[%sm", "40");
  printf("\033[%sm", "37");
}


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

x86 assembly (clang, -O2):
<reinit_graphics>:
push   %rbx
lea    0xee8(%rip),%rbx
lea    0xee8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[%sm\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"40\00"
@.str.3 = [3 x i8] c"37\00"
define void @reinit_graphics() {
%1 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%sm\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"40\00"
@.str.3 = [3 x i8] c"37\00"
define void @reinit_graphics() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t lsrl1(uint64_t x) { return x >> 1; }


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

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

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

LLVM IR (-O2):
define i32 @lsrl1(i32 %0) {
%2 = ashr i32 %0, 1
ret i32 %2
}
int fun151() { return 151; }


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

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

LLVM IR (-O0):
define i32 @fun151() {
ret i32 151
}

LLVM IR (-O2):
define i32 @fun151() {
ret i32 151
}
void beep2(int duration, int frequency) {}


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

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

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

LLVM IR (-O2):
define void @beep2(i32 %0, i32 %1) {
ret void
}
double ls_costN_nm7_sq(double x) { return x * x; }


x86 assembly (clang, -O0):
<ls_costN_nm7_sq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_costN_nm7_sq>:
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @ls_costN_nm7_sq(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @ls_costN_nm7_sq(double %0) {
%2 = fmul double %0, %0
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ __NOP();
void delay_clks(unsigned int clks) {
  int i;
  for (i = 0; i < clks; ++i)
    __NOP();
}


x86 assembly (clang, -O0):
<delay_clks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1143 <delay_clks+0x33>
mov    $0x0,%al
call   1030 <__NOP@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <delay_clks+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay_clks>:
push   %rbx
test   %edi,%edi
je     112c <delay_clks+0x1c>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <__NOP@plt>
add    $0xffffffff,%ebx
jne    1120 <delay_clks+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @delay_clks(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 (...) @__NOP()
%6 = add nuw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
void f6(char *source) {
  char *destination1 = 0;
  char *destination2 = destination1 - 0;
  memcpy(destination2, source, 10);
}


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

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

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

LLVM IR (-O2):
define void @f6(i8* %0) {
%2 = tail call i32 @memcpy(i8* null, i8* %0, i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void __BUG(char *msg) {
  fprintf(stderr, "BUG EXISTS. THIS MUST BE AVOIDED! %s\n", msg);
}


x86 assembly (clang, -O0):
<__BUG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__BUG>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"BUG EXISTS. THIS MUST BE AVOIDED! %s\0A\00"
define void @__BUG(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"BUG EXISTS. THIS MUST BE AVOIDED! %s\0A\00"
define void @__BUG(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
const char *__attribute__((section(".test.c"))) __attribute__((no))
strong_n3(void) {
  return "strong_n3";
}


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

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"strong_n3\00"
define i8* @strong_n3() section ".test.c" {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int f321(int *);
int f322(int *p) { return f321(p); }


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

x86 assembly (clang, -O2):
<f322>:
jmp    1030 <f321@plt>

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

LLVM IR (-O2):
define i32 @f322(i32* %0) {
%2 = tail call i32 @f321(i32* %0)
ret i32 %2
}