xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ ascii_length(char *);
unsigned int ascii_rvalue(char *, int /*<<< orphan*/, int);
unsigned int tar_readvalue(char *attribute) {
  return ascii_rvalue(attribute, ascii_length(attribute), 8);
}


x86 assembly (clang, -O0):
<tar_readvalue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ascii_length@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
mov    $0x8,%edx
call   1030 <ascii_rvalue@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tar_readvalue>:
push   %rbx
mov    %rdi,%rbx
call   1040 <ascii_length@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x8,%edx
pop    %rbx
jmp    1030 <ascii_rvalue@plt>

LLVM IR (-O0):
define i32 @tar_readvalue(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @ascii_length(i8* %4)
%6 = call i32 @ascii_rvalue(i8* %3, i32 %5, i32 8)
ret i32 %6
}

LLVM IR (-O2):
define i32 @tar_readvalue(i8* %0) {
%2 = tail call i32 @ascii_length(i8* %0)
%3 = tail call i32 @ascii_rvalue(i8* %0, i32 %2, i32 8)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ TerminalNewMode(int);
void setcommandmode(void) { TerminalNewMode(-1); }


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

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

LLVM IR (-O0):
define void @setcommandmode() {
%1 = call i32 @TerminalNewMode(i32 -1)
ret void
}

LLVM IR (-O2):
define void @setcommandmode() {
%1 = tail call i32 @TerminalNewMode(i32 -1)
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sysPersistentGet(char *, int, int /*<<< orphan*/);
char *read_datafs_from_flash() {
  char *big_buf = malloc((1024 * 16));
  memset(big_buf, 0, (1024 * 16));
  sysPersistentGet(big_buf, (1024 * 16), 0);
  return big_buf;
}


x86 assembly (clang, -O0):
<read_datafs_from_flash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4000,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4000,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    $0x4000,%esi
xor    %edx,%edx
call   1050 <sysPersistentGet@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_datafs_from_flash>:
push   %rbx
mov    $0x4000,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x4000,%edx
call   1030 <memset@plt>
mov    %rbx,%rdi
mov    $0x4000,%esi
xor    %edx,%edx
call   1050 <sysPersistentGet@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @read_datafs_from_flash() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 16384)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @memset(i8* %3, i32 0, i32 16384)
%5 = load i8*, i8** %1
%6 = call i32 @sysPersistentGet(i8* %5, i32 16384, i32 0)
%7 = load i8*, i8** %1
ret i8* %7
}

LLVM IR (-O2):
define i8* @read_datafs_from_flash() {
%1 = tail call dereferenceable_or_null(16384) i8* @malloc(i32 16384)
%2 = tail call i32 @memset(i8* %1, i32 0, i32 16384)
%3 = tail call i32 @sysPersistentGet(i8* %1, i32 16384, i32 0)
ret i8* %1
}
int main() {
  int a = 10, *pInt;
  pInt = &a;
  printf("%d\n", pInt);
  printf("%d\n", *pInt);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0xa,0xc(%rsp)
lea    0xedc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dequeueList();
int /*<<< orphan*/ peekList();
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int lBrack() {
  if (strcmp(peekList(), "[") != 0) {
    return 0;
  }
  dequeueList();
  return 1;
}


x86 assembly (clang, -O0):
<lBrack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <peekList@plt>
mov    %eax,%edi
lea    0xeb8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1163 <lBrack+0x33>
movl   $0x0,-0x4(%rbp)
jmp    1171 <lBrack+0x41>
mov    $0x0,%al
call   1050 <dequeueList@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lBrack>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <peekList@plt>
lea    0xebf(%rip),%rsi
mov    %eax,%edi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1159 <lBrack+0x29>
xor    %eax,%eax
call   1050 <dequeueList@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"[\00"
define i32 @lBrack() {
%1 = tail call i32 (...) @peekList()
%2 = tail call i64 @strcmp(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (...) @dequeueList()
br label %6
6: ; preds = %0, %4
%7 = phi i32 [ 1, %4 ], [ 0, %0 ]
ret i32 %7
}
void av_compare_mod() {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @gtk_tree_model_row_changed() {
ret void
}
/* Type definitions */
struct ADrawTag {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, unsigned int,
                           unsigned int, unsigned int);
int /*<<< orphan*/ getSvgFile(struct ADrawTag *);
char *getSvgPen(struct ADrawTag *);
void SvgFilledCircle(struct ADrawTag *ctx, unsigned int x, unsigned int y,
                     unsigned int r) {
  fprintf(getSvgFile(ctx),
          "<circle fill=\"%s\" cx=\"%u\" cy=\"%u\" r=\"%u\"/>\n",
          getSvgPen(ctx), x, y, r);
}


x86 assembly (clang, -O0):
<SvgFilledCircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getSvgFile@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getSvgPen@plt>
mov    -0x18(%rbp),%edi
mov    %rax,%rdx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
lea    0xe8e(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SvgFilledCircle>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%r12d
mov    %rdi,%rbp
call   1030 <getSvgFile@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1040 <getSvgPen@plt>
lea    0xea6(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
%struct.ADrawTag = type { i32 }
@.str = [44 x i8] c"<circle fill=\22%s\22 cx=\22%u\22 cy=\22%u\22 r=\22%u\22/>\0A\00"
define void @SvgFilledCircle(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.ADrawTag*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.ADrawTag* %0, %struct.ADrawTag** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.ADrawTag*, %struct.ADrawTag** %5
%10 = call i32 @getSvgFile(%struct.ADrawTag* %9)
%11 = load %struct.ADrawTag*, %struct.ADrawTag** %5
%12 = call i8* @getSvgPen(%struct.ADrawTag* %11)
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %13, i32 %14, i32 %15)
ret void
}

LLVM IR (-O2):
%struct.ADrawTag = type { i32 }
@.str = [44 x i8] c"<circle fill=\22%s\22 cx=\22%u\22 cy=\22%u\22 r=\22%u\22/>\0A\00"
define void @SvgFilledCircle(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @getSvgFile(%struct.ADrawTag* %0)
%6 = tail call i8* @getSvgPen(%struct.ADrawTag* %0)
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %1, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ssl_mod_exp(char *, int, char *, int, char *, int, char *,
                               int);
void rdp_sec_rsa_op(char *out, char *in, char *mod, char *exp) {
  ssl_mod_exp(out, 64, in, 32, mod, 64, exp, 4);
}


x86 assembly (clang, -O0):
<rdp_sec_rsa_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%rax
mov    $0x40,%r9d
mov    $0x20,%ecx
mov    %r9d,%esi
mov    %rax,(%rsp)
movl   $0x4,0x8(%rsp)
call   1030 <ssl_mod_exp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdp_sec_rsa_op>:
push   %rax
mov    %rcx,%rax
mov    %rdx,%r8
mov    %rsi,%rdx
mov    $0x40,%esi
mov    $0x20,%ecx
mov    $0x40,%r9d
push   $0x4
push   %rax
call   1030 <ssl_mod_exp@plt>
add    $0x10,%rsp
pop    %rax
ret

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

LLVM IR (-O2):
define void @rdp_sec_rsa_op(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @ssl_mod_exp(i8* %0, i32 64, i8* %1, i32 32, i8* %2, i32 64, i8* %3, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f6a(int);
void f6(int x) { f6a(x); }


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

x86 assembly (clang, -O2):
<f6>:
jmp    1030 <f6a@plt>

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

LLVM IR (-O2):
define void @f6(i32 %0) {
%2 = tail call i32 @f6a(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void delete_string(char *str) { free(str); }


x86 assembly (clang, -O0):
<delete_string>:
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):
<delete_string>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @delete_string(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int ijs_strnlen(const char *s, int size) {
  int i;
  for (i = 0; i < size; i++)
    if (s[i] == 0)
      return i;
  return size;
}


x86 assembly (clang, -O0):
<ijs_strnlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1151 <ijs_strnlen+0x51>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    113e <ijs_strnlen+0x3e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1157 <ijs_strnlen+0x57>
jmp    1143 <ijs_strnlen+0x43>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <ijs_strnlen+0x12>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ijs_strnlen>:
mov    %esi,%eax
test   %esi,%esi
jle    111f <ijs_strnlen+0x1f>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,(%rdi,%rcx,1)
je     1120 <ijs_strnlen+0x20>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <ijs_strnlen+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ijs_strnlen(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %11
%7 = phi i64 [ 0, %4 ], [ %12, %11 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %16, label %6
14: ; preds = %6
%15 = trunc i64 %7 to i32
br label %16
16: ; preds = %11, %14, %2
%17 = phi i32 [ %1, %2 ], [ %15, %14 ], [ %1, %11 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ task_name1(char *);
int /*<<< orphan*/ task_name2(char *);
int main(int argc, char *argv[]) {
  task_name1("foo");
  task_name2("bar");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <task_name1@plt>
lea    0xebb(%rip),%rdi
call   1040 <task_name2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @task_name1(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @task_name2(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @task_name1(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @task_name2(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int os_write(void *data, const void *buffer, int len, int *rc) { return -1; }


x86 assembly (clang, -O0):
<os_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @os_write(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i32* nocapture readnone %3) {
ret i32 -1
}
/* Variables and functions */
int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int),
                                       void (*f)(void *)) {
  return 0;
}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ free_pgd_range(struct mmu_gather *, unsigned long,
                                  unsigned long, unsigned long, unsigned long);
void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
                            unsigned long end, unsigned long floor,
                            unsigned long ceiling) {
  free_pgd_range(tlb, addr, end, floor, ceiling);
}


x86 assembly (clang, -O0):
<hugetlb_free_pgd_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <free_pgd_range@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hugetlb_free_pgd_range>:
jmp    1030 <free_pgd_range@plt>

LLVM IR (-O0):
%struct.mmu_gather = type { i32 }
define void @hugetlb_free_pgd_range(%struct.mmu_gather* %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca %struct.mmu_gather*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store %struct.mmu_gather* %0, %struct.mmu_gather** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load %struct.mmu_gather*, %struct.mmu_gather** %6
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = load i64, i64* %9
%15 = load i64, i64* %10
%16 = call i32 @free_pgd_range(%struct.mmu_gather* %11, i64 %12, i64 %13, i64 %14, i64 %15)
ret void
}

LLVM IR (-O2):
%struct.mmu_gather = type { i32 }
define void @hugetlb_free_pgd_range(%struct.mmu_gather* %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = tail call i32 @free_pgd_range(%struct.mmu_gather* %0, i64 %1, i64 %2, i64 %3, i64 %4)
ret void
}
int is_uppercase(int c) {
  if (c >= 'A' && c <= 'Z')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_uppercase>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     1127 <is_uppercase+0x27>
cmpl   $0x5a,-0x8(%rbp)
jg     1127 <is_uppercase+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <is_uppercase+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @is_uppercase(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 %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_uppercase(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ disk_partition_select(int, int /*<<< orphan*/);
int /*<<< orphan*/ kprintf(char *);
void Main() {
  kprintf("ShovelOS Stage 1.5\r\n");
  disk_partition_select(0x80, 0);
  kprintf("halt");
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<Main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <kprintf@plt>
mov    $0x80,%edi
xor    %esi,%esi
call   1030 <disk_partition_select@plt>
lea    0xed2(%rip),%rdi
call   1040 <kprintf@plt>
jmp    1148 <Main+0x28>

x86 assembly (clang, -O2):
<Main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <kprintf@plt>
mov    $0x80,%edi
xor    %esi,%esi
call   1030 <disk_partition_select@plt>
lea    0xed5(%rip),%rdi
call   1040 <kprintf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
jmp    1150 <Main+0x30>

LLVM IR (-O0):
@.str = [21 x i8] c"ShovelOS Stage 1.5\0D\0A\00"
@.str.1 = [5 x i8] c"halt\00"
define void @Main() {
%1 = call i32 @kprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @disk_partition_select(i32 128, i32 0)
%3 = call i32 @kprintf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
br label %4
}

LLVM IR (-O2):
@.str = [21 x i8] c"ShovelOS Stage 1.5\0D\0A\00"
@.str.1 = [5 x i8] c"halt\00"
define void @Main() {
%1 = tail call i32 @kprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @disk_partition_select(i32 128, i32 0)
%3 = tail call i32 @kprintf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
br label %4
}
/* Variables and functions */
int /*<<< orphan*/ ex1();
int main(int argc, char **argv) {
  ex1();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @ex1()
ret i32 0
}
void RTVfsNewBaseObj(void) {}


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

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

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

LLVM IR (-O2):
define void @RTVfsNewBaseObj() {
ret void
}
int inp(int port) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @inp(i32 %0) {
ret i32 0
}
/* Variables and functions */
unsigned long __pa(void *);
unsigned long virt_to_machine(void *virt) { return __pa(virt); }


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

x86 assembly (clang, -O2):
<virt_to_machine>:
jmp    1030 <__pa@plt>

LLVM IR (-O0):
define i64 @virt_to_machine(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @__pa(i8* %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @virt_to_machine(i8* %0) {
%2 = tail call i64 @__pa(i8* %0)
ret i64 %2
}
int user_free(void *mem) {
  int val;
  __asm__ __volatile__("int $0x40" : "=a"(val) : "a"(68), "b"(12), "c"(mem));
  return val;
}


x86 assembly (clang, -O0):
<user_free>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    $0x44,%eax
mov    $0xc,%ebx
int    $0x40
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_free>:
push   %rbx
mov    %rdi,%rcx
mov    $0x44,%eax
mov    $0xc,%ebx
int    $0x40
pop    %rbx
ret

LLVM IR (-O0):
define i32 @user_free(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 asm sideeffect "int $$0x40", "={ax},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 68, i32 12, i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @user_free(i8* %0) {
%2 = tail call i32 asm sideeffect "int $$0x40", "={ax},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 68, i32 12, i8* %0)
ret i32 %2
}
int main(void) {
  while (1) {
    goto Label;
  }
Label:
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    1110 <main+0x10>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0
br label %3
3: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t *Function1PointerUint8(uint8_t *a) { return a + 1; }


x86 assembly (clang, -O0):
<Function1PointerUint8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Function1PointerUint8>:
lea    0x4(%rdi),%rax
ret

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

LLVM IR (-O2):
define i32* @Function1PointerUint8(i32* readnone %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
ret i32* %2
}
/* Type definitions */
struct dhcpmsg {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_option_string(struct dhcpmsg *, int, char const *const,
                                     size_t);
void add_option_hostname(struct dhcpmsg *packet, const char *const hostname,
                         size_t hsize) {
  if (hsize)
    add_option_string(packet, 0x0c, hostname, hsize);
}


x86 assembly (clang, -O0):
<add_option_hostname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1145 <add_option_hostname+0x35>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0xc,%esi
call   1030 <add_option_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_option_hostname>:
mov    %rdx,%rcx
test   %rdx,%rdx
je     1125 <add_option_hostname+0x15>
mov    %rsi,%rdx
mov    $0xc,%esi
jmp    1030 <add_option_string@plt>
ret

LLVM IR (-O0):
%struct.dhcpmsg = type { i32 }
define void @add_option_hostname(%struct.dhcpmsg* %0, i8* %1, i64 %2) {
%4 = alloca %struct.dhcpmsg*
%5 = alloca i8*
%6 = alloca i64
store %struct.dhcpmsg* %0, %struct.dhcpmsg** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load %struct.dhcpmsg*, %struct.dhcpmsg** %4
%11 = load i8*, i8** %5
%12 = load i64, i64* %6
%13 = call i32 @add_option_string(%struct.dhcpmsg* %10, i32 12, i8* %11, i64 %12)
br label %14
14: ; preds = %9, %3
ret void
}

LLVM IR (-O2):
%struct.dhcpmsg = type { i32 }
define void @add_option_hostname(%struct.dhcpmsg* %0, i8* %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @add_option_string(%struct.dhcpmsg* %0, i32 12, i8* %1, i64 %2)
br label %7
7: ; preds = %5, %3
ret void
}
int CmpDoublePtr(const void *dptr1, const void *dptr2) {
  if (**(const double **)dptr1 > **(const double **)dptr2)
    return 1;
  return -1;
}


x86 assembly (clang, -O0):
<CmpDoublePtr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
ucomisd (%rax),%xmm0
jbe    1134 <CmpDoublePtr+0x34>
movl   $0x1,-0x4(%rbp)
jmp    113b <CmpDoublePtr+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmpDoublePtr>:
mov    (%rdi),%rax
movsd  (%rax),%xmm0
mov    (%rsi),%rax
xor    %ecx,%ecx
ucomisd (%rax),%xmm0
seta   %cl
lea    (%rcx,%rcx,1),%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @CmpDoublePtr(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to double**
%8 = load double*, double** %7
%9 = load double, double* %8
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to double**
%12 = load double*, double** %11
%13 = load double, double* %12
%14 = fcmp ogt double %9, %13
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 1, i32* %3
br label %17
16: ; preds = %2
store i32 -1, i32* %3
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @CmpDoublePtr(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double**
%4 = load double*, double** %3
%5 = load double, double* %4
%6 = bitcast i8* %1 to double**
%7 = load double*, double** %6
%8 = load double, double* %7
%9 = fcmp ogt double %5, %8
%10 = select i1 %9, i32 1, i32 -1
ret i32 %10
}
/* Type definitions */
struct flashctx {
  int dummy;
};

/* Variables and functions */
int probe_spi_rdid_generic(struct flashctx *, int);
int probe_spi_rdid(struct flashctx *flash) {
  return probe_spi_rdid_generic(flash, 3);
}


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

x86 assembly (clang, -O2):
<probe_spi_rdid>:
mov    $0x3,%esi
jmp    1030 <probe_spi_rdid_generic@plt>

LLVM IR (-O0):
%struct.flashctx = type { i32 }
define i32 @probe_spi_rdid(%struct.flashctx* %0) {
%2 = alloca %struct.flashctx*
store %struct.flashctx* %0, %struct.flashctx** %2
%3 = load %struct.flashctx*, %struct.flashctx** %2
%4 = call i32 @probe_spi_rdid_generic(%struct.flashctx* %3, i32 3)
ret i32 %4
}

LLVM IR (-O2):
%struct.flashctx = type { i32 }
define i32 @probe_spi_rdid(%struct.flashctx* %0) {
%2 = tail call i32 @probe_spi_rdid_generic(%struct.flashctx* %0, i32 3)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char, char, char);
int main() {
  printf("%cell%c Worl%c!! %c", 'H', 'o', 'd', '\n');
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"%cell%c Worl%c!! %c\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8 signext 72, i8 signext 111, i8 signext 100, i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"%cell%c Worl%c!! %c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8 signext 72, i8 signext 111, i8 signext 100, i8 signext 10)
ret i32 0
}
int main(void) {
  int x = 0;
  return (x = 1) / (x = 1);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
int cmp_float(const void *a, const void *b) {
  return ((*(float *)a) - (*(float *)b));
}


x86 assembly (clang, -O0):
<cmp_float>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
cvttss2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_float>:
movss  (%rdi),%xmm0
subss  (%rsi),%xmm0
cvttss2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @cmp_float(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to float*
%7 = load float, float* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to float*
%10 = load float, float* %9
%11 = fsub float %7, %10
%12 = fptosi float %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @cmp_float(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = load float, float* %3
%5 = bitcast i8* %1 to float*
%6 = load float, float* %5
%7 = fsub float %4, %6
%8 = fptosi float %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void put_bar(int num) {
  while (num--) {
    printf("=");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<put_bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1140 <put_bar+0x30>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
jmp    111b <put_bar+0xb>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_bar>:
push   %rbx
test   %edi,%edi
je     112f <put_bar+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x3d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <put_bar+0x10>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"=\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @put_bar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
store i32 %5, i32* %2
%6 = icmp ne i32 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %3
9: ; preds = %3
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @put_bar(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = tail call i32 @putchar(i32 61)
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
%9 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_isr();
__attribute__((weak)) void FTDF_GEN_Handler() { default_isr(); }


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

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

LLVM IR (-O0):
define weak void @FTDF_GEN_Handler() {
%1 = call i32 (...) @default_isr()
ret void
}

LLVM IR (-O2):
define weak void @FTDF_GEN_Handler() {
%1 = tail call i32 (...) @default_isr()
ret void
}
/* Type definitions */
typedef int int8_t;

/* Variables and functions */
unsigned int hash_func_int8_t(void *ptr) {
  int8_t v = *((int8_t *)ptr);
  if (sizeof(int8_t) > sizeof(unsigned int))
    return v ^ (v >> 32);
  else
    return v;
}


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

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

LLVM IR (-O0):
define i32 @hash_func_int8_t(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @hash_func_int8_t(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ setsid();
int /*<<< orphan*/ umask(int /*<<< orphan*/);
int daemonize(void) {
  pid_t pid;
  if ((pid = fork()) < 0) {
    return (-1);
  } else if (pid != 0) {
    exit(0);
  }
  setsid();
  chdir("/");
  umask(0);
  return (0);
}


x86 assembly (clang, -O0):
<daemonize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <fork@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jge    1179 <daemonize+0x29>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b1 <daemonize+0x61>
cmpq   $0x0,-0x10(%rbp)
je     118b <daemonize+0x3b>
xor    %edi,%edi
call   1060 <exit@plt>
jmp    1190 <daemonize+0x40>
mov    $0x0,%al
call   1040 <setsid@plt>
lea    0xe62(%rip),%rdi
call   1030 <chdir@plt>
xor    %edi,%edi
call   1050 <umask@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<daemonize>:
push   %rbx
xor    %eax,%eax
call   1070 <fork@plt>
test   %rax,%rax
js     117d <daemonize+0x2d>
jne    1186 <daemonize+0x36>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <setsid@plt>
lea    0xe91(%rip),%rdi
call   1030 <chdir@plt>
xor    %edi,%edi
call   1050 <umask@plt>
jmp    1182 <daemonize+0x32>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
define i32 @daemonize() {
%1 = alloca i32
%2 = alloca i64
%3 = call i64 (...) @fork()
store i64 %3, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 -1, i32* %1
br label %16
6: ; preds = %0
%7 = load i64, i64* %2
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %6
br label %12
12: ; preds = %11
%13 = call i32 (...) @setsid()
%14 = call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @umask(i32 0)
store i32 0, i32* %1
br label %16
16: ; preds = %12, %5
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
define i32 @daemonize() {
%1 = tail call i64 (...) @fork()
%2 = icmp slt i64 %1, 0
br i1 %2, label %11, label %3
3: ; preds = %0
%4 = icmp eq i64 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %3
%8 = tail call i32 (...) @setsid()
%9 = tail call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @umask(i32 0)
br label %11
11: ; preds = %0, %7
%12 = phi i32 [ 0, %7 ], [ -1, %0 ]
ret i32 %12
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void elapsed_time_in_seconds(double *elapsed_time) {
  struct timeval e_time;
  if (gettimeofday(&e_time, NULL) < 0) {
    return;
  }
  *elapsed_time = (double)e_time.tv_sec + ((double)e_time.tv_usec / 1000000.0);
}


x86 assembly (clang, -O0):
<elapsed_time_in_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
jge    1138 <elapsed_time_in_seconds+0x28>
jmp    115c <elapsed_time_in_seconds+0x4c>
cvtsi2sdq -0x10(%rbp),%xmm0
cvtsi2sdq -0x18(%rbp),%xmm1
movsd  0xeb4(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<elapsed_time_in_seconds>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %rax,%rax
js     1144 <elapsed_time_in_seconds+0x34>
cvtsi2sdq 0x8(%rsp),%xmm0
cvtsi2sdq (%rsp),%xmm1
divsd  0xec4(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define void @elapsed_time_in_seconds(double* %0) {
%2 = alloca double*
%3 = alloca %struct.timeval
store double* %0, double** %2
%4 = call i64 @gettimeofday(%struct.timeval* %3, i32* null)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %17
7: ; preds = %1
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%12 = load i64, i64* %11
%13 = sitofp i64 %12 to double
%14 = fdiv double %13, 1.000000e+06
%15 = fadd double %10, %14
%16 = load double*, double** %2
store double %15, double* %16
br label %17
17: ; preds = %7, %6
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define void @elapsed_time_in_seconds(double* nocapture writeonly %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i64 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = icmp slt i64 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to double
%13 = fdiv double %12, 1.000000e+06
%14 = fadd double %13, %9
store double %14, double* %0
br label %15
15: ; preds = %1, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
void printaResult(int (*f)(int)) {
  if (f) {
    printf("%d\n", f(1));
  } else {
    puts("poxa, queria função =/");
  }
}


x86 assembly (clang, -O0):
<printaResult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1152 <printaResult+0x32>
mov    $0x1,%edi
call   *-0x8(%rbp)
mov    %eax,%esi
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
jmp    115e <printaResult+0x3e>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printaResult>:
test   %rdi,%rdi
je     113f <printaResult+0x1f>
push   %rax
mov    %rdi,%rax
mov    $0x1,%edi
call   *%rax
lea    0xec9(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>
lea    0xebe(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [25 x i8] c"poxa, queria fun\C3\A7\C3\A3o =/\00"
define void @printaResult(i32 (i32)* %0) {
%2 = alloca i32 (i32)*
store i32 (i32)* %0, i32 (i32)** %2
%3 = load i32 (i32)*, i32 (i32)** %2
%4 = icmp ne i32 (i32)* %3, null
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32 (i32)*, i32 (i32)** %2
%7 = call i32 %6(i32 1)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %11
9: ; preds = %1
%10 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [25 x i8] c"poxa, queria fun\C3\A7\C3\A3o =/\00"
define void @printaResult(i32 (i32)* %0) {
%2 = icmp eq i32 (i32)* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 %0(i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %8
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_usage() { fprintf(stderr, "usage: netbat [host] <port>\n"); }


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"usage: netbat [host] <port>\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"usage: netbat [host] <port>\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_dvector(double *v, long nl, long nh) { free((char *)(v + nl - 0)); }


x86 assembly (clang, -O0):
<free_dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_dvector>:
lea    (%rdi,%rsi,8),%rdi
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_dvector(double* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds double, double* %0, i64 %1
%5 = bitcast double* %4 to i8*
%6 = tail call i32 @free(i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_strlist_pop() {
  printf("NOT IMPLEMENTED:"
         "pa_strlist_pop"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [31 x i8] c"NOT IMPLEMENTED:pa_strlist_pop\00"
define i32 @pa_strlist_pop() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret i32 undef
}