xunge/DecIR huggingface dataset:
/* Variables and functions */
int calcScoreHelper(int /*<<< orphan*/, char *, int, int /*<<< orphan*/);
int calcScore(char *scoresheet) { return calcScoreHelper(0, scoresheet, 1, 0); }


x86 assembly (clang, -O0):
<calcScore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %ecx,%ecx
mov    $0x1,%edx
mov    %ecx,%edi
call   1030 <calcScoreHelper@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcScore>:
mov    %rdi,%rsi
xor    %edi,%edi
mov    $0x1,%edx
xor    %ecx,%ecx
jmp    1030 <calcScoreHelper@plt>

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

LLVM IR (-O2):
define i32 @calcScore(i8* %0) {
%2 = tail call i32 @calcScoreHelper(i32 0, i8* %0, i32 1, i32 0)
ret i32 %2
}
/* Type definitions */
typedef int uint32_t;
struct buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ put16be(struct buffer *, int);
void put32be(struct buffer *input, uint32_t val) {
  put16be(input, val >> 16);
  put16be(input, val);
}


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

x86 assembly (clang, -O2):
<put32be>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
sar    $0x10,%esi
call   1030 <put16be@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <put16be@plt>

LLVM IR (-O0):
%struct.buffer = type { i32 }
define void @put32be(%struct.buffer* %0, i32 %1) {
%3 = alloca %struct.buffer*
%4 = alloca i32
store %struct.buffer* %0, %struct.buffer** %3
store i32 %1, i32* %4
%5 = load %struct.buffer*, %struct.buffer** %3
%6 = load i32, i32* %4
%7 = ashr i32 %6, 16
%8 = call i32 @put16be(%struct.buffer* %5, i32 %7)
%9 = load %struct.buffer*, %struct.buffer** %3
%10 = load i32, i32* %4
%11 = call i32 @put16be(%struct.buffer* %9, i32 %10)
ret void
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define void @put32be(%struct.buffer* %0, i32 %1) {
%3 = ashr i32 %1, 16
%4 = tail call i32 @put16be(%struct.buffer* %0, i32 %3)
%5 = tail call i32 @put16be(%struct.buffer* %0, i32 %1)
ret void
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR9C_get(void) { return U_WMRCORENONE_get("U_WMR9C"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR9C\00"
define i32 @U_WMR9C_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_WMR9C\00"
define i32 @U_WMR9C_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
}
/* Variables and functions */
int /*<<< orphan*/ write_le(unsigned char *, double);
int write_clip(unsigned char *ptr, double sum) {
  if (sum > 32767.0) {
    write_le(ptr, 0x7fff);
    return 1;
  } else if (sum < -32768.0) {
    write_le(ptr, -0x8000);
    return 1;
  } else {
    write_le(ptr, sum);
    return 0;
  }
}


x86 assembly (clang, -O0):
<write_clip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xed2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1155 <write_clip+0x45>
mov    -0x10(%rbp),%rdi
movsd  0xebc(%rip),%xmm0
call   1030 <write_le@plt>
movl   $0x1,-0x4(%rbp)
jmp    119a <write_clip+0x8a>
movsd  0xeab(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1185 <write_clip+0x75>
mov    -0x10(%rbp),%rdi
movsd  0xe94(%rip),%xmm0
call   1030 <write_le@plt>
movl   $0x1,-0x4(%rbp)
jmp    119a <write_clip+0x8a>
mov    -0x10(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
call   1030 <write_le@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_clip>:
push   %rbx
movapd %xmm0,%xmm1
movsd  0xee3(%rip),%xmm2
ucomisd %xmm0,%xmm2
seta   %al
movsd  0xedc(%rip),%xmm0
ucomisd %xmm0,%xmm1
seta   %cl
ja     113d <write_clip+0x2d>
maxsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
or     %al,%cl
movzbl %cl,%ebx
call   1030 <write_le@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @write_clip(i8* %0, double %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double
store i8* %0, i8** %4
store double %1, double* %5
%6 = load double, double* %5
%7 = fcmp ogt double %6, 3.276700e+04
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i32 @write_le(i8* %9, double 3.276700e+04)
store i32 1, i32* %3
br label %21
11: ; preds = %2
%12 = load double, double* %5
%13 = fcmp olt double %12, -3.276800e+04
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i8*, i8** %4
%16 = call i32 @write_le(i8* %15, double -3.276800e+04)
store i32 1, i32* %3
br label %21
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load double, double* %5
%20 = call i32 @write_le(i8* %18, double %19)
store i32 0, i32* %3
br label %21
21: ; preds = %17, %14, %8
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @write_clip(i8* %0, double %1) {
%3 = fcmp ogt double %1, 3.276700e+04
%4 = fcmp olt double %1, -3.276800e+04
%5 = select i1 %4, double -3.276800e+04, double %1
%6 = select i1 %3, double 3.276700e+04, double %5
%7 = or i1 %3, %4
%8 = zext i1 %7 to i32
%9 = tail call i32 @write_le(i8* %0, double %6)
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ fprintf(int /*<<< orphan*/ *, char *, int const, char const *);
int /*<<< orphan*/ pfatal(char *);
int strlen(char const *);
void ns_writestr(FILE *file, const char *str) {
  const int len = strlen(str);
  if (fprintf(file, "%d:%s,\n", len, str) < 0)
    pfatal("cannot write to file");
}


x86 assembly (clang, -O0):
<ns_writestr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xea2(%rip),%rsi
call   1050 <fprintf@plt>
cmp    $0x0,%rax
jge    1179 <ns_writestr+0x49>
lea    0xe94(%rip),%rdi
call   1040 <pfatal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ns_writestr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
lea    0xeb7(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
mov    %rbx,%rcx
call   1050 <fprintf@plt>
test   %rax,%rax
js     1163 <ns_writestr+0x33>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe9e(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <pfatal@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%d:%s,\0A\00"
@.str.1 = [21 x i8] c"cannot write to file\00"
define void @ns_writestr(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %5
%10 = load i8*, i8** %4
%11 = call i64 @fprintf(i32* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %10)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @pfatal(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %2
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d:%s,\0A\00"
@.str.1 = [21 x i8] c"cannot write to file\00"
define void @ns_writestr(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i64 @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3, i8* %1)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @pfatal(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret void
}
long double atanl(long double x) {
  long double r;
  __asm__ __volatile__("fld1; fpatan" : "=t"(r) : "0"(x));
  return r;
}


x86 assembly (clang, -O0):
<atanl>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fld1
fpatan
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<atanl>:
fldt   0x8(%rsp)
fld1
fpatan
ret

LLVM IR (-O0):
define x86_fp80 @atanl(x86_fp80 %0) {
%2 = alloca x86_fp80
%3 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%4 = load x86_fp80, x86_fp80* %2
%5 = call x86_fp80 asm sideeffect "fld1; fpatan", "={st},0,~{dirflag},~{fpsr},~{flags}"(x86_fp80 %4)
store x86_fp80 %5, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %6
}

LLVM IR (-O2):
define x86_fp80 @atanl(x86_fp80 %0) {
%2 = tail call x86_fp80 asm sideeffect "fld1; fpatan", "={st},0,~{dirflag},~{fpsr},~{flags}"(x86_fp80 %0)
ret x86_fp80 %2
}
/* Variables and functions */
unsigned long long strtoull(char *, int /*<<< orphan*/ *, int);
void callback_system_strtoull(void *data1, void *data2) {
  char *string = data1;
  unsigned long long *value = data2;
  *value = strtoull(string, NULL, 10);
}


x86 assembly (clang, -O0):
<callback_system_strtoull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtoull@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callback_system_strtoull>:
push   %rbx
mov    %rsi,%rbx
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtoull@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @callback_system_strtoull(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i64*
store i64* %9, i64** %6
%10 = load i8*, i8** %5
%11 = call i64 @strtoull(i8* %10, i32* null, i32 10)
%12 = load i64*, i64** %6
store i64 %11, i64* %12
ret void
}

LLVM IR (-O2):
define void @callback_system_strtoull(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = bitcast i8* %1 to i64*
%4 = tail call i64 @strtoull(i8* nocapture %0, i32* null, i32 10)
store i64 %4, i64* %3
ret void
}
void eglReleaseTexImage(void) { return; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ strlist_extend_argv(struct strlist *, char const *const *);
struct strlist *strlist_new();
struct strlist *strlist_from_argv(const char *const *argv) {
  struct strlist *sl = strlist_new();
  strlist_extend_argv(sl, argv);
  return sl;
}


x86 assembly (clang, -O0):
<strlist_from_argv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <strlist_new@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strlist_extend_argv@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlist_from_argv>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <strlist_new@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strlist_extend_argv@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.strlist = type { i32 }
define %struct.strlist* @strlist_from_argv(i8** %0) {
%2 = alloca i8**
%3 = alloca %struct.strlist*
store i8** %0, i8*** %2
%4 = call %struct.strlist* (...) @strlist_new()
store %struct.strlist* %4, %struct.strlist** %3
%5 = load %struct.strlist*, %struct.strlist** %3
%6 = load i8**, i8*** %2
%7 = call i32 @strlist_extend_argv(%struct.strlist* %5, i8** %6)
%8 = load %struct.strlist*, %struct.strlist** %3
ret %struct.strlist* %8
}

LLVM IR (-O2):
%struct.strlist = type { i32 }
define %struct.strlist* @strlist_from_argv(i8** %0) {
%2 = tail call %struct.strlist* (...) @strlist_new()
%3 = tail call i32 @strlist_extend_argv(%struct.strlist* %2, i8** %0)
ret %struct.strlist* %2
}
void gfx_close(void) {}


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

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

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

LLVM IR (-O2):
define void @gfx_close() {
ret void
}
void __libc_csu_fini() { return; }


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

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

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

LLVM IR (-O2):
define void @__libc_csu_fini() {
ret void
}
void marker4() {}


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

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

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

LLVM IR (-O2):
define void @marker4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_failed_address();
char *try_broadcast(char *, char *, char *);
char *try_address(char *d, char *buf, char *uq) {
  char *r = NULL;
  r = try_broadcast(d, buf, uq);
  if (r == NULL) {
    print_failed_address();
  }
  return r;
}


x86 assembly (clang, -O0):
<try_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <try_broadcast@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1163 <try_address+0x43>
mov    $0x0,%al
call   1030 <print_failed_address@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<try_address>:
push   %rbx
call   1040 <try_broadcast@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <try_address+0x15>
xor    %eax,%eax
call   1030 <print_failed_address@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @try_address(i8* %0, i8* %1, i8* %2) {
%4 = tail call i8* @try_broadcast(i8* %0, i8* %1, i8* %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @print_failed_address()
br label %8
8: ; preds = %6, %3
ret i8* %4
}
/* Variables and functions */
int tst_bl_entry(int, char **);
int main(int argc, char **argv) { return tst_bl_entry(argc, argv); }


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <tst_bl_entry@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <tst_bl_entry@plt>

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 = load i8**, i8*** %5
%8 = call i32 @tst_bl_entry(i32 %6, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @tst_bl_entry(i32 %0, i8** %1)
ret i32 %3
}
int iswhitespace(char *p) { return *p == '\t' || *p == ' '; }


x86 assembly (clang, -O0):
<iswhitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x9(%rbp)
je     112d <iswhitespace+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswhitespace>:
mov    (%rdi),%al
cmp    $0x9,%al
sete   %cl
cmp    $0x20,%al
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @iswhitespace(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 9
%4 = icmp eq i8 %2, 32
%5 = or i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
OP(ed, ad) {}


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

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

LLVM IR (-O0):
define i32 @OP(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* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
char *ft_strchr(char *, char);
int /*<<< orphan*/ load_line(char **, char **, char *);
int find_newline(char **line, char **remaining) {
  char *found;
  if (*remaining && (found = ft_strchr(*remaining, '\n'))) {
    *found = '\0';
    load_line(line, remaining, found);
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<find_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1181 <find_newline+0x61>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    $0xa,%esi
call   1030 <ft_strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1181 <find_newline+0x61>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <load_line@plt>
movl   $0x1,-0x4(%rbp)
jmp    1188 <find_newline+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_newline>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    (%rsi),%rdi
xor    %ebp,%ebp
test   %rdi,%rdi
je     1159 <find_newline+0x39>
mov    %rsi,%rbx
mov    $0xa,%esi
call   1030 <ft_strchr@plt>
test   %rax,%rax
je     1159 <find_newline+0x39>
movb   $0x0,(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <load_line@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @find_newline(i8** %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i8* @ft_strchr(i8* %3, i8 signext 10)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %5
store i8 0, i8* %6
%9 = tail call i32 @load_line(i8** %0, i8** %1, i8* %6)
br label %10
10: ; preds = %2, %5, %8
%11 = phi i32 [ 1, %8 ], [ 0, %5 ], [ 0, %2 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ write_test(char *, int, int);
void flush_cache() { write_test("t", 20000, 4096); }


x86 assembly (clang, -O0):
<flush_cache>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x4e20,%esi
mov    $0x1000,%edx
call   1030 <write_test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_cache>:
lea    0xee9(%rip),%rdi
mov    $0x4e20,%esi
mov    $0x1000,%edx
jmp    1030 <write_test@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"t\00"
define void @flush_cache() {
%1 = call i32 @write_test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 20000, i32 4096)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"t\00"
define void @flush_cache() {
%1 = tail call i32 @write_test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 20000, i32 4096)
ret void
}
void ffpmsg(const char *str) {}


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

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

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

LLVM IR (-O2):
define void @ffpmsg(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bailer(char const *, char const *, char const *);
int /*<<< orphan*/ exit(int);
void syserr(const char *funcname, const char *syscall, const char *msg) {
  bailer(funcname, syscall, msg);
  exit(-1);
}


x86 assembly (clang, -O0):
<syserr>:
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),%rdx
call   1030 <bailer@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<syserr>:
push   %rax
call   1030 <bailer@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @syserr(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 i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @bailer(i8* %7, i8* %8, i8* %9)
%11 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define void @syserr(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @bailer(i8* %0, i8* %1, i8* %2)
%5 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
unsigned long long gu_avphys_pages();
unsigned long long gu_page_size();
size_t gu_avphys_bytes() {
  unsigned long long avphys = gu_avphys_pages();
  avphys *= gu_page_size();
  size_t max = -1;
  return (avphys < max ? avphys : max);
}


x86 assembly (clang, -O0):
<gu_avphys_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <gu_avphys_pages@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <gu_page_size@plt>
imul   -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
movq   $0xffffffffffffffff,-0x10(%rbp)
ff
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1166 <gu_avphys_bytes+0x46>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    116e <gu_avphys_bytes+0x4e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gu_avphys_bytes>:
push   %rbx
xor    %eax,%eax
call   1030 <gu_avphys_pages@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <gu_page_size@plt>
imul   %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @gu_avphys_bytes() {
%1 = alloca i64
%2 = alloca i64
%3 = call i64 (...) @gu_avphys_pages()
store i64 %3, i64* %1
%4 = call i64 (...) @gu_page_size()
%5 = load i64, i64* %1
%6 = mul i64 %5, %4
store i64 %6, i64* %1
store i64 -1, i64* %2
%7 = load i64, i64* %1
%8 = load i64, i64* %2
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = load i64, i64* %1
br label %14
12: ; preds = %0
%13 = load i64, i64* %2
br label %14
14: ; preds = %12, %10
%15 = phi i64 [ %11, %10 ], [ %13, %12 ]
ret i64 %15
}

LLVM IR (-O2):
define i64 @gu_avphys_bytes() {
%1 = tail call i64 (...) @gu_avphys_pages()
%2 = tail call i64 (...) @gu_page_size()
%3 = mul i64 %2, %1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i = 0;
  for (i = 0; i < 1000000001; i++) {
  }
  printf("i is now: %d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3b9aca01,-0x8(%rbp)
jge    114d <main+0x3d>
jmp    113f <main+0x2f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"i is now: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 1000000001)
ret i32 0
}
void inc_zcache_evicted_eph_pageframes(void) {}


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

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

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

LLVM IR (-O2):
define void @inc_zcache_evicted_eph_pageframes() {
ret void
}
int Regexp__white_space(int c) {
  if ((c == ' ') || (c == '\t'))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<Regexp__white_space>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
je     111b <Regexp__white_space+0x1b>
cmpl   $0x9,-0x8(%rbp)
jne    1127 <Regexp__white_space+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <Regexp__white_space+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Regexp__white_space>:
cmp    $0x20,%edi
sete   %al
cmp    $0x9,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @Regexp__white_space(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 32
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 9
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store i32 1, i32* %2
br label %11
10: ; preds = %6
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @Regexp__white_space(i32 %0) {
%2 = icmp eq i32 %0, 32
%3 = icmp eq i32 %0, 9
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int ugl_AddLabel(char const *);
int ugl_FindLabel(char const *);
int ugl_GetLabel(const char *name) {
  int idx;
  idx = ugl_FindLabel(name);
  if (idx >= 0)
    return idx;
  return ugl_AddLabel(name);
}


x86 assembly (clang, -O0):
<ugl_GetLabel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ugl_FindLabel@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     114d <ugl_GetLabel+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <ugl_GetLabel+0x39>
mov    -0x10(%rbp),%rdi
call   1040 <ugl_AddLabel@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ugl_GetLabel>:
push   %rbx
mov    %rdi,%rbx
call   1030 <ugl_FindLabel@plt>
test   %eax,%eax
js     112f <ugl_GetLabel+0xf>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <ugl_AddLabel@plt>

LLVM IR (-O0):
define i32 @ugl_GetLabel(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @ugl_FindLabel(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %14
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = call i32 @ugl_AddLabel(i8* %12)
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @ugl_GetLabel(i8* %0) {
%2 = tail call i32 @ugl_FindLabel(i8* %0)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @ugl_AddLabel(i8* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %2, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void imprime_nombre(char *nombre) { printf("Hola Mundo %s\n", nombre); }


x86 assembly (clang, -O0):
<imprime_nombre>:
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):
<imprime_nombre>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"Hola Mundo %s\0A\00"
define void @imprime_nombre(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ a();
int /*<<< orphan*/ b();
main() {
  a();
  b();
  b();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <a@plt>
mov    $0x0,%al
call   1030 <b@plt>
mov    $0x0,%al
call   1030 <b@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @a()
%2 = call i32 (...) @b()
%3 = call i32 (...) @b()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @a()
%2 = tail call i32 (...) @b()
%3 = tail call i32 (...) @b()
ret i32 0
}
/* Variables and functions */
int EXIT_SUCCESS;
int OpenChatFellow();
int /*<<< orphan*/ STDOUT_FILENO;
int read(int, char *, int);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
int main(void) {
  int fellow_desc = 0;
  int result = -1;
  char fellow_chr;
  fellow_desc = OpenChatFellow();
  while (1) {
    result = read(fellow_desc, &fellow_chr, 1);
    if (result != -1)
      write(STDOUT_FILENO, &fellow_chr, 1);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    $0x0,%al
call   1050 <OpenChatFellow@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xd(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     118c <main+0x5c>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
lea    -0xd(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
jmp    1157 <main+0x27>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <OpenChatFellow@plt>
mov    %eax,%ebx
lea    0xf(%rsp),%r14
mov    0x2ea2(%rip),%r15
xchg   %ax,%ax
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0xffffffff,%eax
je     1150 <main+0x20>
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
jmp    1150 <main+0x20>

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i32 -1, i32* %3
%5 = call i32 (...) @OpenChatFellow()
store i32 %5, i32* %2
br label %6
6: ; preds = %0, %14
%7 = load i32, i32* %2
%8 = call i32 @read(i32 %7, i8* %4, i32 1)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i32, i32* @STDOUT_FILENO
%13 = call i32 @write(i32 %12, i8* %4, i32 1)
br label %14
14: ; preds = %11, %6
br label %6
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (...) @OpenChatFellow()
br label %3
3: ; preds = %9, %0
%4 = call i32 @read(i32 %2, i8* %1, i32 1)
%5 = icmp eq i32 %4, -1
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* @STDOUT_FILENO
%8 = call i32 @write(i32 %7, i8* %1, i32 1)
br label %9
9: ; preds = %6, %3
br label %3
}
/* Variables and functions */
int partition(int *, int, int);
void quick(int *arr, int low, int high) {
  int j;
  if (low < high) {
    j = partition(arr, low, high);
    quick(arr, low, j - 1);
    quick(arr, j + 1, high);
  }
}


x86 assembly (clang, -O0):
<quick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quick+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quick@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quick@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quick+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quick@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quick+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quick(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quick(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
int isEven(int a) { return a % 2 != 0; }


x86 assembly (clang, -O0):
<isEven>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @isEven(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 2
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @isEven(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int open_netlink_mulicast();
int /*<<< orphan*/ read_event_from_kernel(int);
int registration_kernel();
int main() {
  int nls;
  nls = registration_kernel();
  if (nls < 0)
    return nls;
  nls = open_netlink_mulicast();
  if (nls < 0)
    return nls;
  while (1)
    read_event_from_kernel(nls);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <registration_kernel@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    115e <main+0x2e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118f <main+0x5f>
mov    $0x0,%al
call   1030 <open_netlink_mulicast@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    117d <main+0x4d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118f <main+0x5f>
jmp    1182 <main+0x52>
mov    -0x8(%rbp),%edi
call   1040 <read_event_from_kernel@plt>
jmp    1182 <main+0x52>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <registration_kernel@plt>
test   %eax,%eax
js     1159 <main+0x29>
xor    %eax,%eax
call   1030 <open_netlink_mulicast@plt>
mov    %eax,%ebx
test   %eax,%eax
js     115b <main+0x2b>
nopl   0x0(%rax)
mov    %ebx,%edi
call   1040 <read_event_from_kernel@plt>
jmp    1150 <main+0x20>
mov    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @registration_kernel()
%2 = icmp slt i32 %1, 0
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = tail call i32 (...) @open_netlink_mulicast()
%5 = icmp slt i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3, %6
%7 = tail call i32 @read_event_from_kernel(i32 %4)
br label %6
8: ; preds = %3, %0
%9 = phi i32 [ %1, %0 ], [ %4, %3 ]
ret i32 %9
}
float fdimf(float x, float y) { return (x > y) ? (x - y) : 0; }


x86 assembly (clang, -O0):
<fdimf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1131 <fdimf+0x31>
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113e <fdimf+0x3e>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113e <fdimf+0x3e>
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdimf>:
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
cmpltss %xmm0,%xmm1
andps  %xmm1,%xmm2
movaps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @fdimf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp ogt float %5, %6
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load float, float* %3
%10 = load float, float* %4
%11 = fsub float %9, %10
br label %13
12: ; preds = %2
br label %13
13: ; preds = %12, %8
%14 = phi float [ %11, %8 ], [ 0.000000e+00, %12 ]
ret float %14
}

LLVM IR (-O2):
define float @fdimf(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = fsub float %0, %1
%5 = select i1 %3, float %4, float 0.000000e+00
ret float %5
}
/* Variables and functions */
int DPMI_UnlockMemory(void *, int);
int DPMI_UnlockMemoryRegion(void *start, void *end) {
  int status;
  status = DPMI_UnlockMemory(start, (char *)end - (char *)start);
  return (status);
}


x86 assembly (clang, -O0):
<DPMI_UnlockMemoryRegion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
call   1030 <DPMI_UnlockMemory@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DPMI_UnlockMemoryRegion>:
sub    %edi,%esi
jmp    1030 <DPMI_UnlockMemory@plt>

LLVM IR (-O0):
define i32 @DPMI_UnlockMemoryRegion(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = load i8*, i8** %3
%9 = ptrtoint i8* %7 to i64
%10 = ptrtoint i8* %8 to i64
%11 = sub i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = call i32 @DPMI_UnlockMemory(i8* %6, i32 %12)
store i32 %13, i32* %5
%14 = load i32, i32* %5
ret i32 %14
}

LLVM IR (-O2):
define i32 @DPMI_UnlockMemoryRegion(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
%7 = tail call i32 @DPMI_UnlockMemory(i8* %0, i32 %6)
ret i32 %7
}
int mvdu_mode_vmode(int mode) {
  switch (mode) {
  case 5:
  case 6:
  case 7:
  case 8:
  case 11:
  case 12:
    return 0;
  default:
    return 1;
  }
}


x86 assembly (clang, -O0):
<mvdu_mode_vmode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xfffffffb,%eax
sub    $0x4,%eax
jb     1132 <mvdu_mode_vmode+0x32>
jmp    111e <mvdu_mode_vmode+0x1e>
mov    -0xc(%rbp),%eax
add    $0xfffffff5,%eax
sub    $0x1,%eax
ja     113e <mvdu_mode_vmode+0x3e>
jmp    1132 <mvdu_mode_vmode+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1145 <mvdu_mode_vmode+0x45>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mvdu_mode_vmode>:
add    $0xfffffffb,%edi
mov    $0x1,%eax
cmp    $0x7,%edi
ja     111a <mvdu_mode_vmode+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @mvdu_mode_vmode(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 5, label %5
i32 6, label %5
i32 7, label %5
i32 8, label %5
i32 11, label %5
i32 12, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1
store i32 0, i32* %2
br label %7
6: ; preds = %1
store i32 1, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
@switch.table.mvdu_mode_vmode = [8 x i32] [i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0, i32 0]
define i32 @mvdu_mode_vmode(i32 %0) {
%2 = add i32 %0, -5
%3 = icmp ult i32 %2, 8
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.mvdu_mode_vmode, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 1, %1 ]
ret i32 %9
}
void nop0(void) { return; }


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

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

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

LLVM IR (-O2):
define void @nop0() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ profileCycleCount_reset();
int /*<<< orphan*/ profileCycleCount_start();
void profileTimedEventInit() {
  profileCycleCount_reset();
  profileCycleCount_start();
}


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

x86 assembly (clang, -O2):
<profileTimedEventInit>:
push   %rax
xor    %eax,%eax
call   1030 <profileCycleCount_reset@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <profileCycleCount_start@plt>

LLVM IR (-O0):
define void @profileTimedEventInit() {
%1 = call i32 (...) @profileCycleCount_reset()
%2 = call i32 (...) @profileCycleCount_start()
ret void
}

LLVM IR (-O2):
define void @profileTimedEventInit() {
%1 = tail call i32 (...) @profileCycleCount_reset()
%2 = tail call i32 (...) @profileCycleCount_start()
ret void
}
/* Variables and functions */
scalar_t__ in_byte(scalar_t__);
scalar_t__ serial_received();
char serial_getc() {
  while (serial_received() == 0)
    ;
  return (char)in_byte((0x3F8 + 0));
}


x86 assembly (clang, -O0):
<serial_getc>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <serial_getc+0x9>
mov    $0x0,%al
call   1040 <serial_received@plt>
cmp    $0x0,%rax
jne    113f <serial_getc+0x1f>
jmp    1129 <serial_getc+0x9>
mov    $0x3f8,%edi
call   1030 <in_byte@plt>
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_getc>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <serial_received@plt>
test   %rax,%rax
je     1130 <serial_getc+0x10>
mov    $0x3f8,%edi
call   1030 <in_byte@plt>
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @serial_getc() {
br label %1
1: ; preds = %4, %0
%2 = call i64 (...) @serial_received()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1
br label %1
5: ; preds = %1
%6 = call i64 @in_byte(i64 1016)
%7 = trunc i64 %6 to i8
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @serial_getc() {
br label %1
1: ; preds = %1, %0
%2 = tail call i64 (...) @serial_received()
%3 = icmp eq i64 %2, 0
br i1 %3, label %1, label %4
4: ; preds = %1
%5 = tail call i64 @in_byte(i64 1016)
%6 = trunc i64 %5 to i8
ret i8 %6
}
/* Type definitions */
struct szb_s {
  int dummy;
};

/* Variables and functions */
scalar_t__ szb_get(struct szb_s *, int);
void *szb_getptr(struct szb_s *szb, int pos) {
  void **ptr;
  ptr = (void **)szb_get(szb, pos);
  if (ptr == NULL) {
    return NULL;
  }
  return *ptr;
}


x86 assembly (clang, -O0):
<szb_getptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <szb_get@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1147 <szb_getptr+0x37>
movq   $0x0,-0x8(%rbp)
jmp    1152 <szb_getptr+0x42>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<szb_getptr>:
push   %rax
call   1030 <szb_get@plt>
test   %rax,%rax
je     1120 <szb_getptr+0x10>
mov    (%rax),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.szb_s = type { i32 }
define i8* @szb_getptr(%struct.szb_s* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca %struct.szb_s*
%5 = alloca i32
%6 = alloca i8**
store %struct.szb_s* %0, %struct.szb_s** %4
store i32 %1, i32* %5
%7 = load %struct.szb_s*, %struct.szb_s** %4
%8 = load i32, i32* %5
%9 = call i64 @szb_get(%struct.szb_s* %7, i32 %8)
%10 = inttoptr i64 %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %6
%12 = icmp eq i8** %11, null
br i1 %12, label %13, label %14
13: ; preds = %2
store i8* null, i8** %3
br label %17
14: ; preds = %2
%15 = load i8**, i8*** %6
%16 = load i8*, i8** %15
store i8* %16, i8** %3
br label %17
17: ; preds = %14, %13
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
%struct.szb_s = type { i32 }
define i8* @szb_getptr(%struct.szb_s* %0, i32 %1) {
%3 = tail call i64 @szb_get(%struct.szb_s* %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = inttoptr i64 %3 to i8**
%7 = load i8*, i8** %6
br label %8
8: ; preds = %2, %5
%9 = phi i8* [ %7, %5 ], [ null, %2 ]
ret i8* %9
}
void dummy_func2(void) {}


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

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

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

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