xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ ChangeIntWithPointer(int *, int);
int GetInt(char *);
int /*<<< orphan*/ printf(char *, int);
void Ex6_Pointers() {
  int a = GetInt("Give input: ");
  ChangeIntWithPointer(&a, 5);
  printf("%d\n", a);
}


x86 assembly (clang, -O0):
<Ex6_Pointers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1050 <GetInt@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
mov    $0x5,%esi
call   1040 <ChangeIntWithPointer@plt>
mov    -0x4(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ex6_Pointers>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <GetInt@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x5,%esi
call   1040 <ChangeIntWithPointer@plt>
mov    0x4(%rsp),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Give input: \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @Ex6_Pointers() {
%1 = alloca i32
%2 = call i32 @GetInt(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = call i32 @ChangeIntWithPointer(i32* %1, i32 5)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Give input: \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @Ex6_Pointers() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @GetInt(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %1
%4 = call i32 @ChangeIntWithPointer(i32* %1, i32 5)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret void
}
/* Variables and functions */
int munmap(void *, size_t);
int heap_unmap(void *adrs, size_t size) { return munmap(adrs, size); }


x86 assembly (clang, -O0):
<heap_unmap>:
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 <munmap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heap_unmap>:
jmp    1030 <munmap@plt>

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

LLVM IR (-O2):
define i32 @heap_unmap(i8* %0, i64 %1) {
%3 = tail call i32 @munmap(i8* %0, i64 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ attrset(int /*<<< orphan*/);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ printw(char *);
void run() {
  attrset(COLOR_PAIR(1));
  printw("Hello World");
  getch();
}


x86 assembly (clang, -O0):
<run>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1040 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1060 <attrset@plt>
lea    0xea4(%rip),%rdi
call   1030 <printw@plt>
mov    $0x0,%al
call   1050 <getch@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<run>:
push   %rax
mov    $0x1,%edi
call   1040 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1060 <attrset@plt>
lea    0xea7(%rip),%rdi
call   1030 <printw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <getch@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Hello World\00"
define void @run() {
%1 = call i32 @COLOR_PAIR(i32 1)
%2 = call i32 @attrset(i32 %1)
%3 = call i32 @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @getch()
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello World\00"
define void @run() {
%1 = tail call i32 @COLOR_PAIR(i32 1)
%2 = tail call i32 @attrset(i32 %1)
%3 = tail call i32 @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @getch()
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t h265hvcc_array_get_nal_unit_type(const uint8_t *p) {
  return p[0] & 0x3f;
}


x86 assembly (clang, -O0):
<h265hvcc_array_get_nal_unit_type>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x3f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<h265hvcc_array_get_nal_unit_type>:
mov    (%rdi),%eax
and    $0x3f,%eax
ret

LLVM IR (-O0):
define i32 @h265hvcc_array_get_nal_unit_type(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = and i32 %5, 63
ret i32 %6
}

LLVM IR (-O2):
define i32 @h265hvcc_array_get_nal_unit_type(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 63
ret i32 %3
}
void psocMemoryBarrier() { __asm__ __volatile__("" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @psocMemoryBarrier() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ a_0_55(int, char *);
void a_0_63(void) {
  { a_0_55(((((7)))), "END ?"); }
}


x86 assembly (clang, -O0):
<a_0_63>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7,%edi
lea    0xee0(%rip),%rsi
call   1030 <a_0_55@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_0_63>:
lea    0xee9(%rip),%rsi
mov    $0x7,%edi
jmp    1030 <a_0_55@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"END ?\00"
define void @a_0_63() {
%1 = call i32 @a_0_55(i32 7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"END ?\00"
define void @a_0_63() {
%1 = tail call i32 @a_0_55(i32 7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int z_fwrite_str(const char *ph, char *cs) {
  FILE *pFile = fopen(ph, "wb");
  if (pFile == NULL)
    return -1;
  fprintf(pFile, "%s", cs);
  fclose(pFile);
  return 0;
}


x86 assembly (clang, -O0):
<z_fwrite_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    116b <z_fwrite_str+0x3b>
movl   $0xffffffff,-0x4(%rbp)
jmp    118f <z_fwrite_str+0x5f>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<z_fwrite_str>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1162 <z_fwrite_str+0x32>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    1167 <z_fwrite_str+0x37>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"wb\00"
define i32 @z_fwrite_str(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @fputs(i8* %1, i32* %3)
%7 = tail call i32 @fclose(i32* %3)
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ 0, %5 ], [ -1, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
void setkey(const char *key) { errno = ENOSYS; }


x86 assembly (clang, -O0):
<setkey>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec0(%rip),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setkey>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define void @setkey(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret void
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define void @setkey(i8* nocapture readnone %0) {
%2 = load i32, i32* @ENOSYS
store i32 %2, i32* @errno
ret void
}
/* Variables and functions */
float strtod(char const *, char **);
float strtof(const char *str, char **end) { return strtod(str, end); }


x86 assembly (clang, -O0):
<strtof>:
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 <strtod@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtof>:
jmp    1030 <strtod@plt>

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

LLVM IR (-O2):
define float @strtof(i8* %0, i8** nocapture %1) {
%3 = tail call float @strtod(i8* %0, i8** %1)
ret float %3
}
void SSMR3HandleHostOSAndArch(void) {}


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

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

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

LLVM IR (-O2):
define void @SSMR3HandleHostOSAndArch() {
ret void
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_message_new_method_error(void *call, void **m, const void *e) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_message_new_method_error>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
mov    0x2ec7(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_bus_message_new_method_error>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_message_new_method_error(i8* %0, i8** %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%7 = load i32, i32* @EINVAL
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_message_new_method_error(i8* nocapture readnone %0, i8** nocapture readnone %1, i8* nocapture readnone %2) {
%4 = load i32, i32* @EINVAL
%5 = sub nsw i32 0, %4
ret i32 %5
}
/* Type definitions */
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int isinput() {
  fd_set in_set;
  struct timeval timeout;
  int rc;
  FD_ZERO(&in_set);
  FD_SET(0, &in_set);
  timeout.tv_sec = 0;
  timeout.tv_usec = 200;
  return select(1, &in_set, NULL, NULL, &timeout);
}


x86 assembly (clang, -O0):
<isinput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rdi
call   1030 <FD_ZERO@plt>
xor    %edi,%edi
lea    -0x4(%rbp),%rsi
call   1050 <FD_SET@plt>
movq   $0x0,-0x10(%rbp)
movl   $0xc8,-0x18(%rbp)
mov    $0x1,%edi
lea    -0x4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x18(%rbp),%r8
mov    %rcx,%rdx
call   1040 <select@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isinput>:
push   %rbx
sub    $0x20,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <FD_ZERO@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <FD_SET@plt>
movq   $0x0,0x18(%rsp)
movl   $0xc8,0x10(%rsp)
lea    0x10(%rsp),%r8
mov    $0x1,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <select@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i32 @isinput() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = alloca i32
%4 = call i32 @FD_ZERO(i32* %1)
%5 = call i32 @FD_SET(i32 0, i32* %1)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
store i64 0, i64* %6
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
store i32 200, i32* %7
%8 = call i32 @select(i32 1, i32* %1, i32* null, i32* null, %struct.timeval* %2)
ret i32 %8
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i32 @isinput() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = bitcast i32* %1 to i8*
%4 = bitcast %struct.timeval* %2 to i8*
%5 = call i32 @FD_ZERO(i32* %1)
%6 = call i32 @FD_SET(i32 0, i32* %1)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i64 0, i64* %7
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i32 200, i32* %8
%9 = call i32 @select(i32 1, i32* %1, i32* null, i32* null, %struct.timeval* %2)
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *wmemchr(int /*<<< orphan*/ const *, int /*<<< orphan*/,
                            size_t);
size_t wcsnlen(const wchar_t *str, size_t maxlen) {
  const wchar_t *end = wmemchr(str, 0, maxlen);
  return end == NULL ? maxlen : (size_t)(end - str);
}


x86 assembly (clang, -O0):
<wcsnlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <wmemchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114b <wcsnlen+0x3b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    115e <wcsnlen+0x4e>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsnlen>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <wmemchr@plt>
mov    %rax,%rcx
sub    %rbx,%rcx
sar    $0x2,%rcx
test   %rax,%rax
cmove  %r14,%rcx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @wcsnlen(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32*
store i32* %0, i32** %3
store i64 %1, i64* %4
%6 = load i32*, i32** %3
%7 = load i64, i64* %4
%8 = call i32* @wmemchr(i32* %6, i32 0, i64 %7)
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i64, i64* %4
br label %20
13: ; preds = %2
%14 = load i32*, i32** %5
%15 = load i32*, i32** %3
%16 = ptrtoint i32* %14 to i64
%17 = ptrtoint i32* %15 to i64
%18 = sub i64 %16, %17
%19 = sdiv exact i64 %18, 4
br label %20
20: ; preds = %13, %11
%21 = phi i64 [ %12, %11 ], [ %19, %13 ]
ret i64 %21
}

LLVM IR (-O2):
define i64 @wcsnlen(i32* %0, i64 %1) {
%3 = tail call i32* @wmemchr(i32* %0, i32 0, i64 %1)
%4 = icmp eq i32* %3, null
%5 = ptrtoint i32* %3 to i64
%6 = ptrtoint i32* %0 to i64
%7 = sub i64 %5, %6
%8 = ashr exact i64 %7, 2
%9 = select i1 %4, i64 %1, i64 %8
ret i64 %9
}
/* Variables and functions */
int GPTLerror(char *, char const *);
int init_clock_gettime() {
  static const char *thisfunc = "init_clock_gettime";
  return GPTLerror("%s: not enabled\n", thisfunc);
}


x86 assembly (clang, -O0):
<init_clock_gettime>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f0d(%rip),%rsi
lea    0xef1(%rip),%rdi
call   1030 <GPTLerror@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_clock_gettime>:
lea    0xefc(%rip),%rdi
lea    0xee2(%rip),%rsi
jmp    1030 <GPTLerror@plt>

LLVM IR (-O0):
@init_clock_gettime.thisfunc = internal global i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i32 0, i32 0)
@.str = [19 x i8] c"init_clock_gettime\00"
@.str.1 = [17 x i8] c"%s: not enabled\0A\00"
define i32 @init_clock_gettime() {
%1 = load i8*, i8** @init_clock_gettime.thisfunc
%2 = call i32 @GPTLerror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret i32 %2
}

LLVM IR (-O2):
@.str = [19 x i8] c"init_clock_gettime\00"
@.str.1 = [17 x i8] c"%s: not enabled\0A\00"
define i32 @init_clock_gettime() {
%1 = tail call i32 @GPTLerror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void produce_y(int *y) {
  for (int i = 0; i < 1000; i++) {
    for (int j = 0; j < 1000; ++j) {
    }
  }
  *y = 1;
}


x86 assembly (clang, -O0):
<produce_y>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1156 <produce_y+0x56>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3e8,-0x10(%rbp)
jge    1143 <produce_y+0x43>
jmp    1135 <produce_y+0x35>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <produce_y+0x23>
jmp    1148 <produce_y+0x48>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <produce_y+0xf>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @produce_y(i32* nocapture writeonly %0) {
store i32 1, i32* %0
ret void
}
double divn(double m1, double m2) { return m1 / m2; }


x86 assembly (clang, -O0):
<divn>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<divn>:
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @divn(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @divn(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
const char *nfsref_lookup_display_boolean(_Bool value) {
  return value ? "true" : "false";
}


x86 assembly (clang, -O0):
<nfsref_lookup_display_boolean>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%dl
lea    0xeef(%rip),%rax
lea    0xee3(%rip),%rcx
test   $0x1,%dl
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nfsref_lookup_display_boolean>:
lea    0xef9(%rip),%rcx
lea    0xef7(%rip),%rax
test   %edi,%edi
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i8* @nfsref_lookup_display_boolean(i1 zeroext %0) {
%2 = alloca i8
%3 = zext i1 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = trunc i8 %4 to i1
%6 = zext i1 %5 to i64
%7 = select i1 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
ret i8* %7
}

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i8* @nfsref_lookup_display_boolean(i1 zeroext %0) {
%2 = select i1 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
ret i8* %2
}
int test_imm_00int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x00 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0x0,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0xffffffd8,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_00int64_midword_mem(i64* nocapture readnone %0) {
ret i32 -40
}
int bsr64(unsigned long long x) { return x ? 64 - __builtin_clzll(x) : 0; }


x86 assembly (clang, -O0):
<bsr64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <bsr64+0x30>
mov    -0x8(%rbp),%rax
bsr    %rax,%rax
xor    $0x3f,%rax
mov    %eax,%ecx
mov    $0x40,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <bsr64+0x3a>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <bsr64+0x3a>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bsr64>:
test   %rdi,%rdi
je     1110 <bsr64+0x10>
bsr    %rdi,%rax
xor    $0xffffffc0,%eax
add    $0x41,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @bsr64(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i64, i64* %2
%7 = call i64 @llvm.ctlz.i64(i64 %6, i1 true)
%8 = trunc i64 %7 to i32
%9 = sub nsw i32 64, %8
br label %11
10: ; preds = %1
br label %11
11: ; preds = %10, %5
%12 = phi i32 [ %9, %5 ], [ 0, %10 ]
ret i32 %12
}

LLVM IR (-O2):
define i32 @bsr64(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i64 @llvm.ctlz.i64(i64 %0, i1 true)
%5 = trunc i64 %4 to i32
%6 = sub nuw nsw i32 64, %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
int /*<<< orphan*/ remove(char *);
scalar_t__ stat(char *, struct stat *);
void removeemptycap(char *filenametoremove) {
  struct stat statinfo;
  if (filenametoremove == NULL) {
    return;
  }
  if (stat(filenametoremove, &statinfo) != 0) {
    return;
  }
  if (statinfo.st_size == 24) {
    remove(filenametoremove);
    return;
  }
  return;
}


x86 assembly (clang, -O0):
<removeemptycap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <removeemptycap+0x1c>
jmp    1175 <removeemptycap+0x55>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
je     1158 <removeemptycap+0x38>
jmp    1175 <removeemptycap+0x55>
cmpl   $0x18,-0x10(%rbp)
jne    1170 <removeemptycap+0x50>
mov    -0x8(%rbp),%rdi
call   1030 <remove@plt>
jmp    1175 <removeemptycap+0x55>
jmp    1175 <removeemptycap+0x55>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeemptycap>:
push   %rbx
sub    $0x10,%rsp
test   %rdi,%rdi
je     114b <removeemptycap+0x2b>
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
call   1040 <stat@plt>
test   %rax,%rax
jne    114b <removeemptycap+0x2b>
cmpl   $0x18,0x8(%rsp)
jne    114b <removeemptycap+0x2b>
mov    %rbx,%rdi
call   1030 <remove@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define void @removeemptycap(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
br label %20
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i64 @stat(i8* %8, %struct.stat* %3)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
br label %20
12: ; preds = %7
%13 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 24
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i8*, i8** %2
%18 = call i32 @remove(i8* %17)
br label %20
19: ; preds = %12
br label %20
20: ; preds = %19, %16, %11, %6
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define void @removeemptycap(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = icmp eq i8* %0, null
br i1 %4, label %14, label %5
5: ; preds = %1
%6 = call i64 @stat(i8* %0, %struct.stat* %2)
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 24
%11 = select i1 %7, i1 %10, i1 false
br i1 %11, label %12, label %14
12: ; preds = %5
%13 = call i32 @remove(i8* %0)
br label %14
14: ; preds = %5, %1, %12
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ a();
int main(int argc, char *argv[]) {
  a();
  return EXIT_SUCCESS;
}


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

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

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @a()
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ testOht();
void runTests() { testOht(); }


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

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

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

LLVM IR (-O2):
define void @runTests() {
%1 = tail call i32 (...) @testOht()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ VW_Hlin(int, int, int, int);
scalar_t__ VW_MarkUpdateBlock(int, int, int, int);
void VWB_Hlin(int x1, int x2, int y, int color) {
  if (VW_MarkUpdateBlock(x1, y, x2, y))
    VW_Hlin(x1, x2, y, color);
}


x86 assembly (clang, -O0):
<VWB_Hlin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1040 <VW_MarkUpdateBlock@plt>
cmp    $0x0,%rax
je     1160 <VWB_Hlin+0x40>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <VW_Hlin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VWB_Hlin>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r15d
mov    %edi,%ebx
mov    %edx,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
call   1040 <VW_MarkUpdateBlock@plt>
test   %rax,%rax
je     115b <VWB_Hlin+0x3b>
mov    %ebx,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <VW_Hlin@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @VWB_Hlin(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i64 @VW_MarkUpdateBlock(i32 %0, i32 %2, i32 %1, i32 %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @VW_Hlin(i32 %0, i32 %1, i32 %2, i32 %3)
br label %9
9: ; preds = %7, %4
ret void
}
char to_lower_case(char c) { return (c >= 'A' && c <= 'Z' ? (c + 32) : c); }


x86 assembly (clang, -O0):
<to_lower_case>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1133 <to_lower_case+0x33>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     1133 <to_lower_case+0x33>
movsbl -0x1(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    113a <to_lower_case+0x3a>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @to_lower_case(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Type definitions */
typedef int time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ localtime_r(int *, struct tm *);
struct tm *localtime(const time_t *clock) {
  static struct tm tv;
  time_t epoch_nou = 1;
  localtime_r(&epoch_nou, &tv);
  return &tv;
}


x86 assembly (clang, -O0):
<localtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
lea    0x2efe(%rip),%rsi
call   1030 <localtime_r@plt>
lea    0x2ef2(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<localtime>:
push   %rbx
sub    $0x10,%rsp
movl   $0x1,0xc(%rsp)
lea    0x2f08(%rip),%rbx
lea    0xc(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <localtime_r@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@localtime.tv = internal global %struct.tm zeroinitializer
define %struct.tm* @localtime(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 1, i32* %3
%4 = call i32 @localtime_r(i32* %3, %struct.tm* @localtime.tv)
ret %struct.tm* @localtime.tv
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@localtime.tv = internal global %struct.tm zeroinitializer
define %struct.tm* @localtime(i32* nocapture readnone %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = call i32 @localtime_r(i32* %2, %struct.tm* @localtime.tv)
ret %struct.tm* @localtime.tv
}
int checkpass_pam(const char *user, const char *pass) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @checkpass_pam(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -1
}
int main() {
  return 3 + 7 - 10 + (-7 * 3) / 5 - -4 + (- -7 % 2) - 1 + -9 / 3 + 5 - 2;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int mintaka_index_allocate(char const *, int, int);
int mintaka_index_allocate_(const char *string, int *number, int *event) {
  return mintaka_index_allocate(string, *number, *event);
}


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

x86 assembly (clang, -O2):
<mintaka_index_allocate_>:
mov    (%rsi),%esi
mov    (%rdx),%edx
jmp    1030 <mintaka_index_allocate@plt>

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

LLVM IR (-O2):
define i32 @mintaka_index_allocate_(i8* %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = tail call i32 @mintaka_index_allocate(i8* %0, i32 %4, i32 %5)
ret i32 %6
}
int flows_in_thread(int num_flows, int num_threads, int tid) {
  const int min_flows_per_thread = num_flows / num_threads;
  const int remaining_flows = num_flows % num_threads;
  const int flows_in_this_thread =
      tid < remaining_flows ? min_flows_per_thread + 1 : min_flows_per_thread;
  return flows_in_this_thread;
}


x86 assembly (clang, -O0):
<flows_in_thread>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    113b <flows_in_thread+0x3b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <flows_in_thread+0x41>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flows_in_thread>:
mov    %edx,%ecx
mov    %edi,%eax
cltd
idiv   %esi
xor    %esi,%esi
cmp    %ecx,%edx
setg   %sil
add    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @flows_in_thread(i32 %0, i32 %1, i32 %2) {
%4 = sdiv i32 %0, %1
%5 = srem i32 %0, %1
%6 = icmp sgt i32 %5, %2
%7 = zext i1 %6 to i32
%8 = add nsw i32 %4, %7
ret i32 %8
}
int test_imm_61int64_lowword_reg(long long val) {
  return ((val) & (0x61 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_61int64_lowword_reg>:
test   $0x61,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_61int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 97
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ do_oops();
int /*<<< orphan*/ pr_info(char *);
int so2_oops_init(void) {
  pr_info("oops_init\n");
  do_oops();
  return 0;
}


x86 assembly (clang, -O0):
<so2_oops_init>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <pr_info@plt>
mov    $0x0,%al
call   1040 <do_oops@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"oops_init\0A\00"
define i32 @so2_oops_init() {
%1 = call i32 @pr_info(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @do_oops()
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"oops_init\0A\00"
define i32 @so2_oops_init() {
%1 = tail call i32 @pr_info(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @do_oops()
ret i32 0
}
/* Variables and functions */
char ReadByte(char **);
unsigned int ANSI2USC(char **src) {
  char b1 = ReadByte(src);
  if (b1 <= 0x7F) {
    return b1;
  }
  char b2 = ReadByte(src);
  return b2 << 2 | b1;
}


x86 assembly (clang, -O0):
<ANSI2USC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ReadByte@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x7f,%eax
jg     1141 <ANSI2USC+0x31>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115d <ANSI2USC+0x4d>
mov    -0x10(%rbp),%rdi
call   1030 <ReadByte@plt>
mov    %al,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
shl    $0x2,%eax
movsbl -0x11(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ANSI2USC>:
push   %rax
call   1030 <ReadByte@plt>
movsbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ANSI2USC(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8
%5 = alloca i8
store i8** %0, i8*** %3
%6 = load i8**, i8*** %3
%7 = call signext i8 @ReadByte(i8** %6)
store i8 %7, i8* %4
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 127
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
store i32 %13, i32* %2
br label %23
14: ; preds = %1
%15 = load i8**, i8*** %3
%16 = call signext i8 @ReadByte(i8** %15)
store i8 %16, i8* %5
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = shl i32 %18, 2
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %2
br label %23
23: ; preds = %14, %11
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @ANSI2USC(i8** %0) {
%2 = tail call signext i8 @ReadByte(i8** %0)
%3 = sext i8 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void emit_asm(char *s) { printf("%s\n", s); }


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

x86 assembly (clang, -O2):
<emit_asm>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @emit_asm(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct netpbm_image {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dilate_1d_h(struct netpbm_image *, struct netpbm_image *);
int /*<<< orphan*/ dilate_1d_v(struct netpbm_image *, struct netpbm_image *);
void dilate(struct netpbm_image *img_in, struct netpbm_image *img_scratch,
            struct netpbm_image *img_out) {
  dilate_1d_h(img_in, img_scratch);
  dilate_1d_v(img_scratch, img_out);
}


x86 assembly (clang, -O0):
<dilate>:
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
call   1040 <dilate_1d_h@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <dilate_1d_v@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dilate>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
call   1040 <dilate_1d_h@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <dilate_1d_v@plt>

LLVM IR (-O0):
%struct.netpbm_image = type { i32 }
define void @dilate(%struct.netpbm_image* %0, %struct.netpbm_image* %1, %struct.netpbm_image* %2) {
%4 = alloca %struct.netpbm_image*
%5 = alloca %struct.netpbm_image*
%6 = alloca %struct.netpbm_image*
store %struct.netpbm_image* %0, %struct.netpbm_image** %4
store %struct.netpbm_image* %1, %struct.netpbm_image** %5
store %struct.netpbm_image* %2, %struct.netpbm_image** %6
%7 = load %struct.netpbm_image*, %struct.netpbm_image** %4
%8 = load %struct.netpbm_image*, %struct.netpbm_image** %5
%9 = call i32 @dilate_1d_h(%struct.netpbm_image* %7, %struct.netpbm_image* %8)
%10 = load %struct.netpbm_image*, %struct.netpbm_image** %5
%11 = load %struct.netpbm_image*, %struct.netpbm_image** %6
%12 = call i32 @dilate_1d_v(%struct.netpbm_image* %10, %struct.netpbm_image* %11)
ret void
}

LLVM IR (-O2):
%struct.netpbm_image = type { i32 }
define void @dilate(%struct.netpbm_image* %0, %struct.netpbm_image* %1, %struct.netpbm_image* %2) {
%4 = tail call i32 @dilate_1d_h(%struct.netpbm_image* %0, %struct.netpbm_image* %1)
%5 = tail call i32 @dilate_1d_v(%struct.netpbm_image* %1, %struct.netpbm_image* %2)
ret void
}
/* Variables and functions */
long long __ocml_round_f64(double);
long long int llround(double x) { return __ocml_round_f64(x); }


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

x86 assembly (clang, -O2):
<llround>:
jmp    1030 <__ocml_round_f64@plt>

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

LLVM IR (-O2):
define i64 @llround(double %0) {
%2 = tail call i64 @__ocml_round_f64(double %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ draw_arrow(double, double, double, double);
void draw_arrow_default(void) { draw_arrow(0.05, 0.8, 0.1, 0.2); }


x86 assembly (clang, -O0):
<draw_arrow_default>:
push   %rbp
mov    %rsp,%rbp
movsd  0xee4(%rip),%xmm0
movsd  0xee4(%rip),%xmm1
movsd  0xee4(%rip),%xmm2
movsd  0xee4(%rip),%xmm3
call   1030 <draw_arrow@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_arrow_default>:
movsd  0xee8(%rip),%xmm0
movsd  0xee8(%rip),%xmm1
movsd  0xee8(%rip),%xmm2
movsd  0xee8(%rip),%xmm3
jmp    1030 <draw_arrow@plt>

LLVM IR (-O0):
define void @draw_arrow_default() {
%1 = call i32 @draw_arrow(double 5.000000e-02, double 8.000000e-01, double 1.000000e-01, double 2.000000e-01)
ret void
}

LLVM IR (-O2):
define void @draw_arrow_default() {
%1 = tail call i32 @draw_arrow(double 5.000000e-02, double 8.000000e-01, double 1.000000e-01, double 2.000000e-01)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(size_t);
int /*<<< orphan*/ gn_fatal(char *);
void *realloc(void *, size_t);
void *gn_realloc(void *mem, size_t size) {
  assert(size);
  mem = realloc(mem, size);
  if (!mem)
    gn_fatal("out of memory");
  return mem;
}


x86 assembly (clang, -O0):
<gn_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1171 <gn_realloc+0x41>
lea    0xe94(%rip),%rdi
call   1040 <gn_fatal@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gn_realloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <assert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1161 <gn_realloc+0x31>
lea    0xea4(%rip),%rdi
call   1040 <gn_fatal@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @gn_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i32 @assert(i64 %1)
%4 = tail call i8* @realloc(i8* %0, i64 %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @gn_fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret i8* %4
}