xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int delen(int term1, int term2) {
  if (term2 == 0) {
    printf("delen door nul is flauwe kul\n");
    return 0;
  }
  return term1 / term2;
}


x86 assembly (clang, -O0):
<delen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1140 <delen+0x30>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    114a <delen+0x3a>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delen>:
test   %esi,%esi
je     111a <delen+0xa>
mov    %edi,%eax
cltd
idiv   %esi
ret
push   %rax
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"delen door nul is flauwe kul\0A\00"
define i32 @delen(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %14
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = sdiv i32 %11, %12
store i32 %13, i32* %3
br label %14
14: ; preds = %10, %8
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@str = [29 x i8] c"delen door nul is flauwe kul\00"
define i32 @delen(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %8
6: ; preds = %2
%7 = sdiv i32 %0, %1
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ 0, %4 ], [ %7, %6 ]
ret i32 %9
}
void alt_set_args(int argc, char **argv, char **envp) {
  extern int alt_argc;
  extern char **alt_argv;
  extern char **alt_envp;
  alt_argc = argc;
  alt_argv = argv;
  alt_envp = envp;
}


x86 assembly (clang, -O0):
<alt_set_args>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
mov    0x2ecf(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rcx
mov    0x2eaa(%rip),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    0x2ea4(%rip),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<alt_set_args>:
mov    0x2ee1(%rip),%rax
mov    %edi,(%rax)
mov    0x2ec0(%rip),%rax
mov    %rsi,(%rax)
mov    0x2ebe(%rip),%rax
mov    %rdx,(%rax)
ret

LLVM IR (-O0):
@alt_argc = external global i32
@alt_argv = external global i8**
@alt_envp = external global i8**
define void @alt_set_args(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i32, i32* %4
store i32 %7, i32* @alt_argc
%8 = load i8**, i8*** %5
store i8** %8, i8*** @alt_argv
%9 = load i8**, i8*** %6
store i8** %9, i8*** @alt_envp
ret void
}

LLVM IR (-O2):
@alt_argc = external global i32
@alt_argv = external global i8**
@alt_envp = external global i8**
define void @alt_set_args(i32 %0, i8** %1, i8** %2) {
store i32 %0, i32* @alt_argc
store i8** %1, i8*** @alt_argv
store i8** %2, i8*** @alt_envp
ret void
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMRBD_get(void) { return U_WMRCORENONE_get("U_WMRBD"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMRBD\00"
define i32 @U_WMRBD_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRBD\00"
define i32 @U_WMRBD_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Type definitions */
struct io_uring_sqe {
  int dummy;
};
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ io_uring_prep_rw(int, struct io_uring_sqe *, int, void *,
                                    unsigned int, int /*<<< orphan*/);
void io_uring_prep_write_fixed(struct io_uring_sqe *sqe, int fd, void *buf,
                               unsigned nbytes, off_t offset) {
  io_uring_prep_rw(5, sqe, fd, buf, nbytes, offset);
}


x86 assembly (clang, -O0):
<io_uring_prep_write_fixed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    $0x5,%edi
call   1030 <io_uring_prep_rw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_uring_prep_write_fixed>:
mov    %r8d,%r9d
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rsi
mov    $0x5,%edi
jmp    1030 <io_uring_prep_rw@plt>

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

LLVM IR (-O2):
%struct.io_uring_sqe = type { i32 }
define void @io_uring_prep_write_fixed(%struct.io_uring_sqe* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i32 @io_uring_prep_rw(i32 5, %struct.io_uring_sqe* %0, i32 %1, i8* %2, i32 %3, i32 %4)
ret void
}
/* Type definitions */
struct stream {
  int dummy;
};

/* Variables and functions */
int decode_atom_format_6_1(unsigned char const *, struct stream *);
int decode_atom_format_6_7(const unsigned char *pkt, struct stream *stream) {
  return decode_atom_format_6_1(pkt, stream);
}


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

x86 assembly (clang, -O2):
<decode_atom_format_6_7>:
jmp    1030 <decode_atom_format_6_1@plt>

LLVM IR (-O0):
%struct.stream = type { i32 }
define i32 @decode_atom_format_6_7(i8* %0, %struct.stream* %1) {
%3 = alloca i8*
%4 = alloca %struct.stream*
store i8* %0, i8** %3
store %struct.stream* %1, %struct.stream** %4
%5 = load i8*, i8** %3
%6 = load %struct.stream*, %struct.stream** %4
%7 = call i32 @decode_atom_format_6_1(i8* %5, %struct.stream* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.stream = type { i32 }
define i32 @decode_atom_format_6_7(i8* %0, %struct.stream* %1) {
%3 = tail call i32 @decode_atom_format_6_1(i8* %0, %struct.stream* %1)
ret i32 %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool UARTBusy(uint32_t ui32Base) {
  ;
  return (((*((volatile uint32_t *)(ui32Base + 0x00000018))) & 0x00000008)
              ? true
              : false);
}


x86 assembly (clang, -O0):
<UARTBusy>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x18,%eax
cltq
mov    (%rax),%edx
and    $0x8,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTBusy>:
movslq %edi,%rax
mov    0x18(%rax),%eax
shr    $0x3,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @UARTBusy(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 24
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, 8
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 1, i32 0
ret i32 %11
}

LLVM IR (-O2):
define i32 @UARTBusy(i32 %0) {
%2 = add nsw i32 %0, 24
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = lshr i32 %5, 3
%7 = and i32 %6, 1
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char const *);
int scan(char const *);
int main() {
  const char *str = "aaa\\baaa";
  int res = scan(str);
  printf("%d: %s\n", res, str + res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <scan@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
movslq -0x14(%rbp),%rax
add    %rax,%rdx
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <scan@plt>
movslq %eax,%rsi
add    %rsi,%rbx
lea    0xecc(%rip),%rdi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"aaa\\baaa\00"
@.str.1 = [8 x i8] c"%d: %s\0A\00"
define i32 @main() {
%1 = tail call i32 @scan(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = sext i32 %1 to i64
%3 = getelementptr inbounds [9 x i8], [9 x i8]* @.str, i64 0, i64 %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ MDrv_PNL_TCON_Init();
void MApi_PNL_TCON_Init(void) { MDrv_PNL_TCON_Init(); }


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

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

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

LLVM IR (-O2):
define void @MApi_PNL_TCON_Init() {
%1 = tail call i32 (...) @MDrv_PNL_TCON_Init()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_socket_client_set_callback() {
  printf("NOT IMPLEMENTED:"
         "pa_socket_client_set_callback"
         "\n");
}


x86 assembly (clang, -O0):
<pa_socket_client_set_callback>:
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_socket_client_set_callback>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [46 x i8] c"NOT IMPLEMENTED:pa_socket_client_set_callback\00"
define i32 @pa_socket_client_set_callback() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int tolower(int c) { return (c >= 'A' && c <= 'Z') ? c + ('a' - 'A') : c; }


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x41,-0x4(%rbp)
jl     1129 <tolower+0x29>
cmpl   $0x5a,-0x4(%rbp)
jg     1129 <tolower+0x29>
mov    -0x4(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <tolower+0x2f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
lea    -0x41(%rdi),%ecx
lea    0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @tolower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 65
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 90
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 32
br label %13
11: ; preds = %5, %1
%12 = load i32, i32* %2
br label %13
13: ; preds = %11, %8
%14 = phi i32 [ %10, %8 ], [ %12, %11 ]
ret i32 %14
}

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int64_t eq_int64_t(int64_t a, int64_t b) { return a == b; }


x86 assembly (clang, -O0):
<eq_int64_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eq_int64_t>:
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @eq_int64_t(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @eq_int64_t(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
scalar_t__ spiGetByte();
uint8_t getWriteResultCode(void) {
  unsigned int count = 100000;
  uint8_t result = 0;
  while (result == 0 && count > 0) {
    result = spiGetByte();
    count--;
  }
  return result;
}


x86 assembly (clang, -O0):
<getWriteResultCode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x186a0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jne    1141 <getWriteResultCode+0x31>
cmpl   $0x0,-0x4(%rbp)
seta   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1151 <getWriteResultCode+0x41>
jmp    116a <getWriteResultCode+0x5a>
mov    $0x0,%al
call   1030 <spiGetByte@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <getWriteResultCode+0x17>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getWriteResultCode>:
push   %rbx
mov    $0xfffe7961,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <spiGetByte@plt>
test   %rax,%rax
jne    1135 <getWriteResultCode+0x25>
lea    0x1(%rbx),%ecx
test   %ebx,%ebx
mov    %ecx,%ebx
jne    1120 <getWriteResultCode+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define i64 @getWriteResultCode() {
%1 = alloca i32
%2 = alloca i64
store i32 100000, i32* %1
store i64 0, i64* %2
br label %3
3: ; preds = %11, %0
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %1
%8 = icmp ugt i32 %7, 0
br label %9
9: ; preds = %6, %3
%10 = phi i1 [ false, %3 ], [ %8, %6 ]
br i1 %10, label %11, label %15
11: ; preds = %9
%12 = call i64 (...) @spiGetByte()
store i64 %12, i64* %2
%13 = load i32, i32* %1
%14 = add i32 %13, -1
store i32 %14, i32* %1
br label %3
15: ; preds = %9
%16 = load i64, i64* %2
ret i64 %16
}

LLVM IR (-O2):
define i64 @getWriteResultCode() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 100000, %0 ], [ %4, %1 ]
%3 = tail call i64 (...) @spiGetByte()
%4 = add nsw i32 %2, -1
%5 = icmp eq i64 %3, 0
%6 = icmp ne i32 %4, 0
%7 = select i1 %5, i1 %6, i1 false
br i1 %7, label %1, label %8
8: ; preds = %1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, double *);
double ParseDouble() {
  double dbl;
  scanf("%lf", &dbl);
  return dbl;
}


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

x86 assembly (clang, -O2):
<ParseDouble>:
push   %rax
lea    0xee8(%rip),%rdi
mov    %rsp,%rsi
call   1030 <scanf@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
define double @ParseDouble() {
%1 = alloca double
%2 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%3 = load double, double* %1
ret double %3
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define double @ParseDouble() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load double, double* %1
ret double %4
}
void *simple_get_key_from_data(void *a) { return a; }


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

x86 assembly (clang, -O2):
<simple_get_key_from_data>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @simple_get_key_from_data(i8* readnone returned %0) {
ret i8* %0
}
int __attribute__((const)) lw6sys_chr_is_eol(char c) {
  return (c == '\n' || c == '\r');
}


x86 assembly (clang, -O0):
<lw6sys_chr_is_eol>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     1129 <lw6sys_chr_is_eol+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0xd,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lw6sys_chr_is_eol>:
cmp    $0xa,%dil
sete   %al
cmp    $0xd,%dil
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @lw6sys_chr_is_eol(i8 signext %0) {
%2 = icmp eq i8 %0, 10
%3 = icmp eq i8 %0, 13
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
double stress_funccall_double_1(double const);
double __attribute__((no))
stress_funcdeep_double_2(const double a, const double b) {
  return stress_funccall_double_1(b) + stress_funccall_double_1(a);
}


x86 assembly (clang, -O0):
<stress_funcdeep_double_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <stress_funccall_double_1@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <stress_funccall_double_1@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stress_funcdeep_double_2>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
movaps %xmm1,%xmm0
call   1030 <stress_funccall_double_1@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <stress_funccall_double_1@plt>
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @stress_funcdeep_double_2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = call double @stress_funccall_double_1(double %5)
%7 = load double, double* %3
%8 = call double @stress_funccall_double_1(double %7)
%9 = fadd double %6, %8
ret double %9
}

LLVM IR (-O2):
define double @stress_funcdeep_double_2(double %0, double %1) {
%3 = tail call double @stress_funccall_double_1(double %1)
%4 = tail call double @stress_funccall_double_1(double %0)
%5 = fadd double %3, %4
ret double %5
}
void INT_LCD0(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_LCD0() {
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strncopy(char *src, int n) {
  char *cpy = (char *)malloc(n + 1);
  if (cpy) {
    strncpy(cpy, src, n);
    cpy[n] = '\0';
  }
  return cpy;
}


x86 assembly (clang, -O0):
<strncopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1165 <strncopy+0x45>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncopy>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
lea    0x1(%r14),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1151 <strncopy+0x31>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1030 <strncpy@plt>
movslq %r14d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @strncopy(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = tail call i32 @strncpy(i8* %5, i8* %0, i32 %1)
%9 = sext i32 %1 to i64
%10 = getelementptr inbounds i8, i8* %5, i64 %9
store i8 0, i8* %10
br label %11
11: ; preds = %7, %2
ret i8* %5
}
int fnExtractUnit(int iVal) {
  int iU;
  iU = (iVal % 10);
  return iU;
}


x86 assembly (clang, -O0):
<fnExtractUnit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnExtractUnit>:
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fnExtractUnit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = srem i32 %4, 10
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @fnExtractUnit(i32 %0) {
%2 = srem i32 %0, 10
ret i32 %2
}
__attribute__((no, noclone)) float roundf(float x) { return x; }


x86 assembly (clang, -O0):
<roundf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define float @roundf(float returned %0) {
ret float %0
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
float stdlib_strided_sapxsumkbn(int /*<<< orphan*/ const, float const,
                                float const *, int /*<<< orphan*/ const);
float stdlib_strided_sapxsum(const int64_t N, const float alpha, const float *X,
                             const int64_t stride) {
  return stdlib_strided_sapxsumkbn(N, alpha, X, stride);
}


x86 assembly (clang, -O0):
<stdlib_strided_sapxsum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <stdlib_strided_sapxsumkbn@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_strided_sapxsum>:
jmp    1030 <stdlib_strided_sapxsumkbn@plt>

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

LLVM IR (-O2):
define float @stdlib_strided_sapxsum(i32 %0, float %1, float* %2, i32 %3) {
%5 = tail call float @stdlib_strided_sapxsumkbn(i32 %0, float %1, float* %2, i32 %3)
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ reverseString(char *);
int main(int argc, char *argv[]) {
  if (argc == 1)
    return 1;
  reverseString(argv[1]);
  putchar('\n');
  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)
cmpl   $0x1,-0x8(%rbp)
jne    114c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    116a <main+0x4a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <reverseString@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x1,%edi
je     1144 <main+0x24>
push   %rax
mov    0x8(%rsi),%rdi
call   1040 <reverseString@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
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 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %3
br label %15
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @reverseString(i8* %12)
%14 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %3
br label %15
15: ; preds = %9, %8
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @reverseString(i8* %6)
%8 = tail call i32 @putchar(i8 signext 10)
br label %9
9: ; preds = %2, %4
%10 = phi i32 [ 0, %4 ], [ 1, %2 ]
ret i32 %10
}
/* Variables and functions */
int coco_options_read(char const *, char const *, char *, double *);
int coco_options_read_double(const char *options, const char *name,
                             double *pointer) {
  return coco_options_read(options, name, "%lf", pointer);
}


x86 assembly (clang, -O0):
<coco_options_read_double>:
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),%rsi
mov    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rdx
call   1030 <coco_options_read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coco_options_read_double>:
mov    %rdx,%rcx
lea    0xee6(%rip),%rdx
jmp    1030 <coco_options_read@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
define i32 @coco_options_read_double(i8* %0, i8* %1, double* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double*
store i8* %0, i8** %4
store i8* %1, i8** %5
store double* %2, double** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load double*, double** %6
%10 = call i32 @coco_options_read(i8* %7, i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %9)
ret i32 %10
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define i32 @coco_options_read_double(i8* %0, i8* %1, double* %2) {
%4 = tail call i32 @coco_options_read(i8* %0, i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ _test_storage();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
int main() {
  printf("Testing binary tree persitency (%d nodes, please wait)...", 10000000);
  fflush(stdout);
  _test_storage();
  printf(", OK!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x989680,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x0,%al
call   1050 <_test_storage@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
mov    $0x989680,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
call   1060 <_test_storage@plt>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [58 x i8] c"Testing binary tree persitency (%d nodes, please wait)...\00"
@stdout = global i32 0
@.str.1 = [7 x i8] c", OK!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 10000000)
%3 = load i32, i32* @stdout
%4 = call i32 @fflush(i32 %3)
%5 = call i32 (...) @_test_storage()
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [58 x i8] c"Testing binary tree persitency (%d nodes, please wait)...\00"
@stdout = global i32 0
@str = [6 x i8] c", OK!\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 10000000)
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = tail call i32 (...) @_test_storage()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ printf(char *, double *);
void freeme(double *aptr) {
  printf("freeing address: %p\n", aptr);
  free(aptr);
}


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

x86 assembly (clang, -O2):
<freeme>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"freeing address: %p\0A\00"
define void @freeme(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double* %3)
%5 = load double*, double** %2
%6 = call i32 @free(double* %5)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"freeing address: %p\0A\00"
define void @freeme(double* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double* %0)
%3 = tail call i32 @free(double* %0)
ret void
}
int do_091() { return 91; }


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

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

LLVM IR (-O0):
define i32 @do_091() {
ret i32 91
}

LLVM IR (-O2):
define i32 @do_091() {
ret i32 91
}
/* Type definitions */
typedef int const uint64_t;

/* Variables and functions */
uint64_t ceil_to_full_blocks(const uint64_t x, const uint64_t block_size) {
  if (x % block_size == 0) {
    return x;
  }
  return x + (block_size - (x % block_size));
}


x86 assembly (clang, -O0):
<ceil_to_full_blocks>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1125 <ceil_to_full_blocks+0x25>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113f <ceil_to_full_blocks+0x3f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    -0x10(%rbp),%eax
sub    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil_to_full_blocks>:
mov    %edi,%eax
cltd
idiv   %esi
sub    %edx,%esi
test   %edx,%edx
cmove  %edx,%esi
lea    (%rsi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @ceil_to_full_blocks(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp eq i32 %3, 0
%5 = sub nsw i32 %1, %3
%6 = select i1 %4, i32 0, i32 %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Variables and functions */
int usleep(unsigned int);
int dt_usleep(unsigned usec) { return usleep(usec); }


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

x86 assembly (clang, -O2):
<dt_usleep>:
jmp    1030 <usleep@plt>

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

LLVM IR (-O2):
define i32 @dt_usleep(i32 %0) {
%2 = tail call i32 @usleep(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __WFI();
void ald_pmu_sleep() { __WFI(); }


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

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

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

LLVM IR (-O2):
define void @ald_pmu_sleep() {
%1 = tail call i32 (...) @__WFI()
ret void
}
int get_next_composite_odd_number(composite_odd_number) {
  int index_hint = 1;
  do {
    composite_odd_number += 2;
  } while (index_hint = prime_list_contains(composite_odd_number, index_hint));
  return composite_odd_number;
}


x86 assembly (clang, -O0):
<get_next_composite_odd_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1030 <prime_list_contains@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jne    1122 <get_next_composite_odd_number+0x12>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_next_composite_odd_number>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%eax
nopl   0x0(%rax,%rax,1)
add    $0x2,%ebx
mov    %ebx,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <prime_list_contains@plt>
test   %eax,%eax
jne    1120 <get_next_composite_odd_number+0x10>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @get_next_composite_odd_number(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %5, %2 ]
%4 = phi i32 [ 1, %1 ], [ %6, %2 ]
%5 = add nsw i32 %3, 2
%6 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @prime_list_contains to i32 (i32, i32, ...)*)(i32 %5, i32 %4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void _reset_attrs(void) { fprintf(stdout, "\x1B[0m"); }


x86 assembly (clang, -O0):
<_reset_attrs>:
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):
<_reset_attrs>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [5 x i8] c"\1B[0m\00"
define void @_reset_attrs() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [5 x i8] c"\1B[0m\00"
define void @_reset_attrs() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
void print_irqtrace_events(struct task_struct *curr) {}


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @print_irqtrace_events(%struct.task_struct* nocapture %0) {
ret void
}
double raiz(double x) {
  if (x < 0.0)
    return 1;
  else {
    double resultado;
    asm("fsqrt" : "=t"(resultado) : "0"(x));
    return resultado;
  }
}


x86 assembly (clang, -O0):
<raiz>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1129 <raiz+0x29>
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    114f <raiz+0x4f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
fldl   -0x20(%rbp)
fsqrt
fstpl  -0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<raiz>:
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    1113 <raiz+0x13>
movsd  0xeee(%rip),%xmm0
ret
movsd  %xmm0,-0x8(%rsp)
fldl   -0x8(%rsp)
fsqrt
fstpl  -0x10(%rsp)
movsd  -0x10(%rsp),%xmm0
ret

LLVM IR (-O0):
define double @raiz(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %1
store double 1.000000e+00, double* %2
br label %12
8: ; preds = %1
%9 = load double, double* %3
%10 = call double asm "fsqrt", "={st},0,~{dirflag},~{fpsr},~{flags}"(double %9)
store double %10, double* %4
%11 = load double, double* %4
store double %11, double* %2
br label %12
12: ; preds = %8, %7
%13 = load double, double* %2
ret double %13
}

LLVM IR (-O2):
define double @raiz(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call double asm "fsqrt", "={st},0,~{dirflag},~{fpsr},~{flags}"(double %0)
br label %5
5: ; preds = %1, %3
%6 = phi double [ %4, %3 ], [ 1.000000e+00, %1 ]
ret double %6
}
int check_prime(int num) {
  int i;
  if (num < 2)
    return 0;
  else {
    for (i = 2; i < num; i++) {
      if (num % i == 0) {
        return 0;
      }
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    111d <check_prime+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    116b <check_prime+0x6b>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115f <check_prime+0x5f>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    114c <check_prime+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    116b <check_prime+0x6b>
jmp    1151 <check_prime+0x51>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <check_prime+0x24>
jmp    1164 <check_prime+0x64>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_prime>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jge    110a <check_prime+0xa>
mov    %ecx,%eax
ret
jne    1112 <check_prime+0x12>
mov    $0x1,%eax
ret
mov    $0x2,%esi
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1107 <check_prime+0x7>
add    $0x1,%esi
cmp    %esi,%edi
jne    1120 <check_prime+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @check_prime(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp eq i32 %0, 2
br i1 %4, label %12, label %7
5: ; preds = %7
%6 = icmp eq i32 %11, %0
br i1 %6, label %12, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7, %5, %3, %1
%13 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %7 ], [ 1, %5 ]
ret i32 %13
}
void sbrk() {}


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

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

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

LLVM IR (-O2):
define void @sbrk() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *refstr_alloc(size_t);
size_t strnlen(char const *, size_t);
const char *refstrndup(const char *str, size_t len) {
  char *r;
  if (!str)
    return NULL;
  len = strnlen(str, len);
  r = refstr_alloc(len);
  if (r)
    memcpy(r, str, len);
  return r;
}


x86 assembly (clang, -O0):
<refstrndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1158 <refstrndup+0x28>
movq   $0x0,-0x8(%rbp)
jmp    119a <refstrndup+0x6a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strnlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <refstr_alloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1192 <refstrndup+0x62>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<refstrndup>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1165 <refstrndup+0x35>
mov    %rdi,%r14
call   1030 <strnlen@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1050 <refstr_alloc@plt>
test   %rax,%rax
je     1165 <refstrndup+0x35>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
jmp    1167 <refstrndup+0x37>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @refstrndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %2
store i8* null, i8** %3
br label %25
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = load i64, i64* %5
%13 = call i64 @strnlen(i8* %11, i64 %12)
store i64 %13, i64* %5
%14 = load i64, i64* %5
%15 = call i8* @refstr_alloc(i64 %14)
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %23
18: ; preds = %10
%19 = load i8*, i8** %6
%20 = load i8*, i8** %4
%21 = load i64, i64* %5
%22 = call i32 @memcpy(i8* %19, i8* %20, i64 %21)
br label %23
23: ; preds = %18, %10
%24 = load i8*, i8** %6
store i8* %24, i8** %3
br label %25
25: ; preds = %23, %9
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
define i8* @refstrndup(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = tail call i64 @strnlen(i8* %0, i64 %1)
%6 = tail call i8* @refstr_alloc(i64 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @memcpy(i8* %6, i8* %0, i64 %5)
br label %10
10: ; preds = %4, %8, %2
%11 = phi i8* [ null, %2 ], [ %6, %8 ], [ null, %4 ]
ret i8* %11
}
/* Variables and functions */
scalar_t__ COND_LS();
int /*<<< orphan*/ EA_AY_PI_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_sls_8_pi(void) {
  m68ki_write_8(EA_AY_PI_8(), COND_LS() ? 0xff : 0);
}


x86 assembly (clang, -O0):
<m68k_op_sls_8_pi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <EA_AY_PI_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <COND_LS@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_sls_8_pi>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <EA_AY_PI_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <COND_LS@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_sls_8_pi() {
%1 = call i32 (...) @EA_AY_PI_8()
%2 = call i64 (...) @COND_LS()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_sls_8_pi() {
%1 = tail call i32 (...) @EA_AY_PI_8()
%2 = tail call i64 (...) @COND_LS()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}