xunge/DecIR huggingface dataset:
/* Variables and functions */
int baz();
int foo();
int main() {
  int y, z;
  y = 2;
  z = 9;
  y = foo();
  z = y;
  y = y + 2;
  y = baz();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %2
store i32 9, i32* %3
%4 = call i32 (...) @foo()
store i32 %4, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 2
store i32 %7, i32* %2
%8 = call i32 (...) @baz()
store i32 %8, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @baz()
ret i32 0
}
/* Variables and functions */
char *eof_pos(char *src, size_t max) {
  char *ret = 0;
  while (max) {
    if (0 == *src) {
      src++;
      ret = src;
      break;
    }
    src++;
    max--;
  }
  return ret;
}


x86 assembly (clang, -O0):
<eof_pos>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1166 <eof_pos+0x66>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    1149 <eof_pos+0x49>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1166 <eof_pos+0x66>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1114 <eof_pos+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eof_pos>:
test   %rsi,%rsi
je     1120 <eof_pos+0x20>
mov    %rdi,%rax
add    $0x1,%rax
nopl   0x0(%rax)
cmpb   $0x0,-0x1(%rax)
je     1122 <eof_pos+0x22>
add    $0x1,%rax
add    $0xffffffffffffffff,%rsi
jne    1110 <eof_pos+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @eof_pos(i8* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %10
%5 = phi i64 [ %11, %10 ], [ %1, %2 ]
%6 = phi i8* [ %9, %10 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = getelementptr inbounds i8, i8* %6, i64 1
br i1 %8, label %13, label %10
10: ; preds = %4
%11 = add i64 %5, -1
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %10, %4, %2
%14 = phi i8* [ null, %2 ], [ null, %10 ], [ %9, %4 ]
ret i8* %14
}
/* Variables and functions */
int O_NONBLOCK;
int O_RDWR;
int /*<<< orphan*/ asprintf(char **, char *, int, int);
int /*<<< orphan*/ free(char *);
int open(char *, int);
int dvb_dmx_open(int adapter, int demux) {
  char *demux_name = NULL;
  asprintf(&demux_name, "/dev/dvb/adapter%i/demux%i", adapter, demux);
  int fd_demux = open(demux_name, O_RDWR | O_NONBLOCK);
  free(demux_name);
  return fd_demux;
}


x86 assembly (clang, -O0):
<dvb_dmx_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    -0x10(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1040 <asprintf@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
mov    0x2e70(%rip),%rax
or     (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dvb_dmx_open>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ecx
mov    %edi,%edx
movq   $0x0,0x8(%rsp)
lea    0xeb7(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1040 <asprintf@plt>
mov    0x8(%rsp),%rdi
mov    0x2e89(%rip),%rax
mov    0x2e7a(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
call   1050 <open@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"/dev/dvb/adapter%i/demux%i\00"
@O_RDWR = global i32 0
@O_NONBLOCK = global i32 0
define i32 @dvb_dmx_open(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i8* null, i8** %5
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @asprintf(i8** %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i8*, i8** %5
%11 = load i32, i32* @O_RDWR
%12 = load i32, i32* @O_NONBLOCK
%13 = or i32 %11, %12
%14 = call i32 @open(i8* %10, i32 %13)
store i32 %14, i32* %6
%15 = load i8*, i8** %5
%16 = call i32 @free(i8* %15)
%17 = load i32, i32* %6
ret i32 %17
}

LLVM IR (-O2):
@.str = [27 x i8] c"/dev/dvb/adapter%i/demux%i\00"
@O_RDWR = global i32 0
@O_NONBLOCK = global i32 0
define i32 @dvb_dmx_open(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%6 = load i8*, i8** %3
%7 = load i32, i32* @O_RDWR
%8 = load i32, i32* @O_NONBLOCK
%9 = or i32 %8, %7
%10 = call i32 @open(i8* %6, i32 %9)
%11 = load i8*, i8** %3
%12 = call i32 @free(i8* %11)
ret i32 %10
}
/* Variables and functions */
int warm_cache_op_range(int, int /*<<< orphan*/ *, unsigned long);
int warm_cache_op_all(int op) {
  return warm_cache_op_range(op, NULL, (unsigned long)-1);
}


x86 assembly (clang, -O0):
<warm_cache_op_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xffffffffffffffff,%rdx
call   1030 <warm_cache_op_range@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<warm_cache_op_all>:
xor    %esi,%esi
mov    $0xffffffffffffffff,%rdx
jmp    1030 <warm_cache_op_range@plt>

LLVM IR (-O0):
define i32 @warm_cache_op_all(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @warm_cache_op_range(i32 %3, i32* null, i64 -1)
ret i32 %4
}

LLVM IR (-O2):
define i32 @warm_cache_op_all(i32 %0) {
%2 = tail call i32 @warm_cache_op_range(i32 %0, i32* null, i64 -1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ invShiftRow(unsigned char *, int);
void invShiftRows(unsigned char *state) {
  int i;
  for (i = 0; i < 4; i++)
    invShiftRow(state + i * 4, i);
}


x86 assembly (clang, -O0):
<invShiftRows>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1152 <invShiftRows+0x42>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
cltq
add    %rax,%rdi
mov    -0xc(%rbp),%esi
call   1030 <invShiftRow@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <invShiftRows+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<invShiftRows>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
call   1030 <invShiftRow@plt>
lea    0x4(%rbx),%rdi
mov    $0x1,%esi
call   1030 <invShiftRow@plt>
lea    0x8(%rbx),%rdi
mov    $0x2,%esi
call   1030 <invShiftRow@plt>
add    $0xc,%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
pop    %rbx
jmp    1030 <invShiftRow@plt>

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

LLVM IR (-O2):
define void @invShiftRows(i8* %0) {
%2 = tail call i32 @invShiftRow(i8* %0, i32 0)
%3 = getelementptr inbounds i8, i8* %0, i64 4
%4 = tail call i32 @invShiftRow(i8* %3, i32 1)
%5 = getelementptr inbounds i8, i8* %0, i64 8
%6 = tail call i32 @invShiftRow(i8* %5, i32 2)
%7 = getelementptr inbounds i8, i8* %0, i64 12
%8 = tail call i32 @invShiftRow(i8* %7, i32 3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_date(char *, char *);
void internal_date(char *date) { do_date(date, "%2d-%b-%Y %H:%M:%S "); }


x86 assembly (clang, -O0):
<internal_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <do_date@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_date>:
lea    0xee9(%rip),%rsi
jmp    1030 <do_date@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"%2d-%b-%Y %H:%M:%S \00"
define void @internal_date(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @do_date(i8* %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"%2d-%b-%Y %H:%M:%S \00"
define void @internal_date(i8* %0) {
%2 = tail call i32 @do_date(i8* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct ft_cxt {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ft_put_bin(struct ft_cxt *, char const *, scalar_t__);
int /*<<< orphan*/ ft_put_word(struct ft_cxt *, int);
scalar_t__ strlen(char const *);
void ft_begin_node(struct ft_cxt *cxt, const char *name) {
  ft_put_word(cxt, 0x1);
  ft_put_bin(cxt, name, strlen(name) + 1);
}


x86 assembly (clang, -O0):
<ft_begin_node>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1050 <ft_put_word@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1030 <ft_put_bin@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_begin_node>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x1,%esi
call   1050 <ft_put_word@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ft_put_bin@plt>

LLVM IR (-O0):
%struct.ft_cxt = type { i32 }
define void @ft_begin_node(%struct.ft_cxt* %0, i8* %1) {
%3 = alloca %struct.ft_cxt*
%4 = alloca i8*
store %struct.ft_cxt* %0, %struct.ft_cxt** %3
store i8* %1, i8** %4
%5 = load %struct.ft_cxt*, %struct.ft_cxt** %3
%6 = call i32 @ft_put_word(%struct.ft_cxt* %5, i32 1)
%7 = load %struct.ft_cxt*, %struct.ft_cxt** %3
%8 = load i8*, i8** %4
%9 = load i8*, i8** %4
%10 = call i64 @strlen(i8* %9)
%11 = add nsw i64 %10, 1
%12 = call i32 @ft_put_bin(%struct.ft_cxt* %7, i8* %8, i64 %11)
ret void
}

LLVM IR (-O2):
%struct.ft_cxt = type { i32 }
define void @ft_begin_node(%struct.ft_cxt* %0, i8* %1) {
%3 = tail call i32 @ft_put_word(%struct.ft_cxt* %0, i32 1)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add nsw i64 %4, 1
%6 = tail call i32 @ft_put_bin(%struct.ft_cxt* %0, i8* %1, i64 %5)
ret void
}
void call_by_reference(int *x) { *x = 200; }


x86 assembly (clang, -O0):
<call_by_reference>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0xc8,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_by_reference>:
movl   $0xc8,(%rdi)
ret

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

LLVM IR (-O2):
define void @call_by_reference(i32* nocapture writeonly %0) {
store i32 200, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ msg_exit(char *);
char *strdup(char *);
char *_xstrdup(char *s) {
  char *cpy = strdup(s);
  if (!cpy)
    msg_exit("out of memory");
  return cpy;
}


x86 assembly (clang, -O0):
<_xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <_xstrdup+0x30>
lea    0xeb5(%rip),%rdi
call   1030 <msg_exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @_xstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @msg_exit(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  (void)argc;
  (void)argv;
  printf("\e[H\e[2J");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%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 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void uart_init(void) {
  int devisor;
  *((volatile unsigned char *)(0x90000000 + 2)) = 0x01 | 0x02 | 0x04 | 0xC0;
  *((volatile unsigned char *)(0x90000000 + 1)) = 0x00;
  *((volatile unsigned char *)(0x90000000 + 3)) = 0x03 & ~(0x04 | 0x08);
  devisor = 25000000 / (16 * 115200);
  *((volatile unsigned char *)(0x90000000 + 3)) |= 0x80;
  *((volatile unsigned char *)(0x90000000 + 0)) = devisor & 0x000000ff;
  *((volatile unsigned char *)(0x90000000 + 1)) = (devisor >> 8) & 0x000000ff;
  *((volatile unsigned char *)(0x90000000 + 3)) &= ~(0x80);
  return;
}


x86 assembly (clang, -O0):
<uart_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x90000002,%eax
movb   $0xc7,(%rax)
mov    $0x90000001,%eax
movb   $0x0,(%rax)
mov    $0x90000003,%eax
movb   $0x3,(%rax)
movl   $0xd,-0x4(%rbp)
mov    $0x90000003,%eax
mov    (%rax),%al
movzbl %al,%eax
or     $0x80,%eax
mov    %al,%cl
mov    $0x90000003,%eax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    $0x90000000,%eax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    $0x90000001,%eax
mov    %cl,(%rax)
mov    $0x90000003,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0xffffff7f,%eax
mov    %al,%cl
mov    $0x90000003,%eax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_init>:
mov    $0x90000003,%eax
movb   $0xc7,-0x1(%rax)
movb   $0x0,-0x2(%rax)
movb   $0x3,(%rax)
orb    $0x80,(%rax)
movb   $0xd,-0x3(%rax)
movb   $0x0,-0x2(%rax)
andb   $0x7f,(%rax)
ret

LLVM IR (-O0):
define void @uart_init() {
%1 = alloca i32
store volatile i8 -57, i8* inttoptr (i64 2415919106 to i8*)
store volatile i8 0, i8* inttoptr (i64 2415919105 to i8*)
store volatile i8 3, i8* inttoptr (i64 2415919107 to i8*)
store i32 13, i32* %1
%2 = load volatile i8, i8* inttoptr (i64 2415919107 to i8*)
%3 = zext i8 %2 to i32
%4 = or i32 %3, 128
%5 = trunc i32 %4 to i8
store volatile i8 %5, i8* inttoptr (i64 2415919107 to i8*)
%6 = load i32, i32* %1
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
store volatile i8 %8, i8* inttoptr (i64 2415919104 to i8*)
%9 = load i32, i32* %1
%10 = ashr i32 %9, 8
%11 = and i32 %10, 255
%12 = trunc i32 %11 to i8
store volatile i8 %12, i8* inttoptr (i64 2415919105 to i8*)
%13 = load volatile i8, i8* inttoptr (i64 2415919107 to i8*)
%14 = zext i8 %13 to i32
%15 = and i32 %14, -129
%16 = trunc i32 %15 to i8
store volatile i8 %16, i8* inttoptr (i64 2415919107 to i8*)
ret void
}

LLVM IR (-O2):
define void @uart_init() {
store volatile i8 -57, i8* inttoptr (i64 2415919106 to i8*)
store volatile i8 0, i8* inttoptr (i64 2415919105 to i8*)
store volatile i8 3, i8* inttoptr (i64 2415919107 to i8*)
%1 = load volatile i8, i8* inttoptr (i64 2415919107 to i8*)
%2 = or i8 %1, -128
store volatile i8 %2, i8* inttoptr (i64 2415919107 to i8*)
store volatile i8 13, i8* inttoptr (i64 2415919104 to i8*)
store volatile i8 0, i8* inttoptr (i64 2415919105 to i8*)
%3 = load volatile i8, i8* inttoptr (i64 2415919107 to i8*)
%4 = and i8 %3, 127
store volatile i8 %4, i8* inttoptr (i64 2415919107 to i8*)
ret void
}
/* Variables and functions */
int core2_safe(char const *);
int U_EMRPOLYPOLYGON_safe(const char *record) { return (core2_safe(record)); }


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

x86 assembly (clang, -O2):
<U_EMRPOLYPOLYGON_safe>:
jmp    1030 <core2_safe@plt>

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

LLVM IR (-O2):
define i32 @U_EMRPOLYPOLYGON_safe(i8* %0) {
%2 = tail call i32 @core2_safe(i8* %0)
ret i32 %2
}
void fail_start_trace(void) {}


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

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

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

LLVM IR (-O2):
define void @fail_start_trace() {
ret void
}
void endgrent() {}


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

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

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

LLVM IR (-O2):
define void @endgrent() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ pread(int, void *, size_t, int /*<<< orphan*/);
ssize_t nsu_pread(int fd, void *buf, size_t count, off_t offset) {
  return pread(fd, buf, count, offset);
}


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

x86 assembly (clang, -O2):
<nsu_pread>:
jmp    1030 <pread@plt>

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

LLVM IR (-O2):
define i32 @nsu_pread(i32 %0, i8* nocapture %1, i64 %2, i32 %3) {
%5 = tail call i32 @pread(i32 %0, i8* %1, i64 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
char *getenv(const char *name) { return (NULL); }


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

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

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

LLVM IR (-O2):
define noalias i8* @getenv(i8* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("Hello World!"); }


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

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
float fmax(float, float);
void vec2_max(float *dst, float *b) {
  dst[0] = fmax(dst[0], b[0]);
  dst[1] = fmax(dst[1], b[1]);
}


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

x86 assembly (clang, -O2):
<vec2_max>:
movss  (%rsi),%xmm0
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm2
movaps %xmm1,%xmm3
cmpunordss %xmm1,%xmm3
movaps %xmm3,%xmm4
andps  %xmm0,%xmm4
maxss  %xmm1,%xmm0
andnps %xmm0,%xmm3
orps   %xmm4,%xmm3
movss  %xmm3,(%rdi)
movss  0x4(%rsi),%xmm0
movaps %xmm2,%xmm1
cmpunordss %xmm2,%xmm1
movaps %xmm1,%xmm3
andps  %xmm0,%xmm3
maxss  %xmm2,%xmm0
andnps %xmm0,%xmm1
orps   %xmm3,%xmm1
movss  %xmm1,0x4(%rdi)
ret

LLVM IR (-O0):
define void @vec2_max(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 0
%10 = load float, float* %9
%11 = call float @fmax(float %7, float %10)
%12 = load float*, float** %3
%13 = getelementptr inbounds float, float* %12, i64 0
store float %11, float* %13
%14 = load float*, float** %3
%15 = getelementptr inbounds float, float* %14, i64 1
%16 = load float, float* %15
%17 = load float*, float** %4
%18 = getelementptr inbounds float, float* %17, i64 1
%19 = load float, float* %18
%20 = call float @fmax(float %16, float %19)
%21 = load float*, float** %3
%22 = getelementptr inbounds float, float* %21, i64 1
store float %20, float* %22
ret void
}

LLVM IR (-O2):
define void @vec2_max(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = tail call nsz float @llvm.maxnum.f32(float %3, float %4)
store float %5, float* %0
%6 = getelementptr inbounds float, float* %0, i64 1
%7 = load float, float* %6
%8 = getelementptr inbounds float, float* %1, i64 1
%9 = load float, float* %8
%10 = tail call nsz float @llvm.maxnum.f32(float %7, float %9)
store float %10, float* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printArray(int *array, int n) {
  int i;
  for (i = 0; i < n; i++) {
    printf("%d ", *(array + i));
  }
  printf("\n");
}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/ *);
int fileno(int /*<<< orphan*/ *);
int op_fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ wsocks_ctx_map_remove_by_fd(int);
int fclose(FILE *fh) {
  int retval, fd;
  assert(fh);
  do {
  } while (0);
  fd = fileno(fh);
  retval = op_fclose(fh);
  if (retval != 0) {
    return retval;
  }
  wsocks_ctx_map_remove_by_fd(fd);
  return retval;
}


x86 assembly (clang, -O0):
<fclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <assert@plt>
jmp    115a <fclose+0x1a>
mov    -0x10(%rbp),%rdi
call   1050 <fileno@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <op_fclose@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1187 <fclose+0x47>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1195 <fclose+0x55>
mov    -0x18(%rbp),%edi
call   1060 <wsocks_ctx_map_remove_by_fd@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fclose>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbp
call   1040 <assert@plt>
mov    %rbp,%rdi
call   1050 <fileno@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1030 <op_fclose@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    116a <fclose+0x2a>
mov    %ebx,%edi
call   1060 <wsocks_ctx_map_remove_by_fd@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fclose(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 @assert(i32* %6)
br label %8
8: ; preds = %1
br label %9
9: ; preds = %8
%10 = load i32*, i32** %3
%11 = call i32 @fileno(i32* %10)
store i32 %11, i32* %5
%12 = load i32*, i32** %3
%13 = call i32 @op_fclose(i32* %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = load i32, i32* %4
store i32 %17, i32* %2
br label %22
18: ; preds = %9
%19 = load i32, i32* %5
%20 = call i32 @wsocks_ctx_map_remove_by_fd(i32 %19)
%21 = load i32, i32* %4
store i32 %21, i32* %2
br label %22
22: ; preds = %18, %16
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @fclose(i32* %0) {
%2 = tail call i32 @assert(i32* %0)
%3 = tail call i32 @fileno(i32* %0)
%4 = tail call i32 @op_fclose(i32* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @wsocks_ctx_map_remove_by_fd(i32 %3)
br label %8
8: ; preds = %1, %6
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
float mcnet_read_float(uint8_t *in) {
  float out;
  uint8_t *t = (uint8_t *)&out;
  t[0] = in[3];
  t[1] = in[2];
  t[2] = in[1];
  t[3] = in[0];
  return out;
}


x86 assembly (clang, -O0):
<mcnet_read_float>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0xc(%rax)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcnet_read_float>:
movss  0xc(%rdi),%xmm0
ret

LLVM IR (-O0):
define float @mcnet_read_float(i32* %0) {
%2 = alloca i32*
%3 = alloca float
%4 = alloca i32*
store i32* %0, i32** %2
%5 = bitcast float* %3 to i32*
store i32* %5, i32** %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 3
%8 = load i32, i32* %7
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 0
store i32 %8, i32* %10
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 2
%13 = load i32, i32* %12
%14 = load i32*, i32** %4
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32 %13, i32* %15
%16 = load i32*, i32** %2
%17 = getelementptr inbounds i32, i32* %16, i64 1
%18 = load i32, i32* %17
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 2
store i32 %18, i32* %20
%21 = load i32*, i32** %2
%22 = getelementptr inbounds i32, i32* %21, i64 0
%23 = load i32, i32* %22
%24 = load i32*, i32** %4
%25 = getelementptr inbounds i32, i32* %24, i64 3
store i32 %23, i32* %25
%26 = load float, float* %3
ret float %26
}

LLVM IR (-O2):
define float @mcnet_read_float(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = bitcast i32* %2 to float*
%4 = load float, float* %3
ret float %4
}
char *fb_hGetExePath(char *dst, int maxlen) {
  dst[0] = '\0';
  return dst;
}


x86 assembly (clang, -O0):
<fb_hGetExePath>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_hGetExePath>:
mov    %rdi,%rax
movb   $0x0,(%rdi)
ret

LLVM IR (-O0):
define i8* @fb_hGetExePath(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
store i8 0, i8* %6
%7 = load i8*, i8** %3
ret i8* %7
}

LLVM IR (-O2):
define i8* @fb_hGetExePath(i8* returned writeonly %0, i32 %1) {
store i8 0, i8* %0
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void *malloc(size_t);
void *smalloc(size_t size) {
  void *ptr = malloc(size);
  if (!ptr)
    die("out of memory");
  return ptr;
}


x86 assembly (clang, -O0):
<smalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <smalloc+0x30>
lea    0xeb5(%rip),%rdi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @smalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @die(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
unsigned xrop3_9_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = D ^ S;
  stk1 = T | stk2;
  stk1 = ~stk1;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_9_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_9_1_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%eax
shl    $0x8,%eax
or     %esi,%eax
or     %ecx,%eax
not    %eax
and    $0xffffff00,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_9_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = xor i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %7
%26 = load i32, i32* %9
%27 = or i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = xor i32 %28, -1
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = load i32, i32* %6
%32 = xor i32 %31, -1
%33 = and i32 %30, %32
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = and i32 %34, %35
%37 = or i32 %33, %36
ret i32 %37
}

LLVM IR (-O2):
define i32 @xrop3_9_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = or i32 %4, %6
%8 = or i32 %7, 255
%9 = xor i32 %8, -1
%10 = or i32 %9, %3
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ _SC_PHYS_PAGES;
long sysconf(int /*<<< orphan*/);
long total_mem_pages(void) { return sysconf(_SC_PHYS_PAGES); }


x86 assembly (clang, -O0):
<total_mem_pages>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<total_mem_pages>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <sysconf@plt>

LLVM IR (-O0):
@_SC_PHYS_PAGES = global i32 0
define i64 @total_mem_pages() {
%1 = load i32, i32* @_SC_PHYS_PAGES
%2 = call i64 @sysconf(i32 %1)
ret i64 %2
}

LLVM IR (-O2):
@_SC_PHYS_PAGES = global i32 0
define i64 @total_mem_pages() {
%1 = load i32, i32* @_SC_PHYS_PAGES
%2 = tail call i64 @sysconf(i32 %1)
ret i64 %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t from_bcd8(uint8_t bcd) {
  return (bcd & 0x0f) + ((bcd & 0xf0) >> 4) * 10;
}


x86 assembly (clang, -O0):
<from_bcd8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    -0x4(%rbp),%ecx
and    $0xf0,%ecx
sar    $0x4,%ecx
imul   $0xa,%ecx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<from_bcd8>:
mov    %edi,%eax
and    $0xf,%eax
shr    $0x4,%edi
and    $0xf,%edi
lea    (%rdi,%rdi,4),%ecx
lea    (%rax,%rcx,2),%eax
ret

LLVM IR (-O0):
define i32 @from_bcd8(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 15
%5 = load i32, i32* %2
%6 = and i32 %5, 240
%7 = ashr i32 %6, 4
%8 = mul nsw i32 %7, 10
%9 = add nsw i32 %4, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @from_bcd8(i32 %0) {
%2 = and i32 %0, 15
%3 = lshr i32 %0, 4
%4 = and i32 %3, 15
%5 = mul nuw nsw i32 %4, 10
%6 = add nuw nsw i32 %5, %2
ret i32 %6
}
/* Variables and functions */
float index(float x) {
  float n;
  n = index(x);
  return index(x);
}


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

x86 assembly (clang, -O2):
<index>:
jmp    1100 <index>

LLVM IR (-O0):
define float @index(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = call float @index(float %4)
store float %5, float* %3
%6 = load float, float* %2
%7 = call float @index(float %6)
ret float %7
}

LLVM IR (-O2):
define float @index(float %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
int do_229() { return 229; }


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

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

LLVM IR (-O0):
define i32 @do_229() {
ret i32 229
}

LLVM IR (-O2):
define i32 @do_229() {
ret i32 229
}
/* Type definitions */
typedef int /*<<< orphan*/ ushort;

/* Variables and functions */
int /*<<< orphan*/ le16toh(int /*<<< orphan*/);
void endianConvScript(int n, ushort s[]) {
  int i;
  for (i = 0; i < n; ++i) {
    s[i] = le16toh(s[i]);
  }
}


x86 assembly (clang, -O0):
<endianConvScript>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115d <endianConvScript+0x4d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <le16toh@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <endianConvScript+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endianConvScript>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1146 <endianConvScript+0x36>
mov    %rsi,%r15
mov    %edi,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%edi
call   1030 <le16toh@plt>
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <endianConvScript+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @endianConvScript(i32 %0, i32* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %1, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @le16toh(i32 %9)
store i32 %10, i32* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
char *imalloc(int);
char *realloc(char *, unsigned int);
char *irealloc(char *pointer, int size) {
  if (((pointer) == NULL))
    return imalloc(size);
  if (size == 0)
    size = 1;
  return realloc(pointer, (unsigned)size);
}


x86 assembly (clang, -O0):
<irealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <irealloc+0x2b>
mov    -0x14(%rbp),%edi
call   1030 <imalloc@plt>
mov    %rax,-0x8(%rbp)
jmp    116c <irealloc+0x4c>
cmpl   $0x0,-0x14(%rbp)
jne    115c <irealloc+0x3c>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irealloc>:
test   %rdi,%rdi
je     1136 <irealloc+0x16>
test   %esi,%esi
mov    $0x1,%eax
cmovne %esi,%eax
mov    %eax,%esi
jmp    1040 <realloc@plt>
mov    %esi,%edi
jmp    1030 <imalloc@plt>

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

LLVM IR (-O2):
define i8* @irealloc(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @imalloc(i32 %1)
br label %10
6: ; preds = %2
%7 = icmp eq i32 %1, 0
%8 = select i1 %7, i32 1, i32 %1
%9 = tail call i8* @realloc(i8* %0, i32 %8)
br label %10
10: ; preds = %6, %4
%11 = phi i8* [ %5, %4 ], [ %9, %6 ]
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ small_frame();
void medium_frame() {
  char S[16384];
  small_frame();
}


x86 assembly (clang, -O0):
<medium_frame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4000,%rsp
mov    $0x0,%al
call   1030 <small_frame@plt>
add    $0x4000,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @medium_frame() {
%1 = alloca [16384 x i8]
%2 = call i32 (...) @small_frame()
ret void
}

LLVM IR (-O2):
define void @medium_frame() {
%1 = tail call i32 (...) @small_frame()
ret void
}
int fib_serial(int n) {
  int x = 0, y = 0;
  if (n < 2)
    return n;
  else {
    x = fib_serial(n - 1);
    y = fib_serial(n - 2);
    return (x + y);
  }
}


x86 assembly (clang, -O0):
<fib_serial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    113e <fib_serial+0x2e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1163 <fib_serial+0x53>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib_serial@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib_serial@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib_serial>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jge    1120 <fib_serial+0x10>
mov    %ebx,%ecx
jmp    1144 <fib_serial+0x34>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbx),%edi
call   1030 <fib_serial@plt>
lea    -0x2(%rbx),%ecx
add    %eax,%ebp
cmp    $0x3,%ebx
mov    %ecx,%ebx
ja     1130 <fib_serial+0x20>
add    %ecx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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