xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ unix_error(char *);
scalar_t__ waitpid(int, int *, int /*<<< orphan*/);
void waitfg(pid_t pid) {
  int status;
  if (waitpid(-1, &status, 0) < 0)
    unix_error("waitfg: waitpd error");
}


x86 assembly (clang, -O0):
<waitfg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xffffffff,%edi
lea    -0x8(%rbp),%rsi
xor    %edx,%edx
call   1040 <waitpid@plt>
cmp    $0x0,%rax
jge    1151 <waitfg+0x31>
lea    0xeb4(%rip),%rdi
call   1030 <unix_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waitfg>:
push   %rax
lea    0x4(%rsp),%rsi
mov    $0xffffffff,%edi
xor    %edx,%edx
call   1040 <waitpid@plt>
test   %rax,%rax
js     1139 <waitfg+0x19>
pop    %rax
ret
lea    0xec0(%rip),%rdi
call   1030 <unix_error@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [21 x i8] c"waitfg: waitpd error\00"
define void @waitfg(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i64 @waitpid(i32 -1, i32* %3, i32 0)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @unix_error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"waitfg: waitpd error\00"
define void @waitfg(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i64 @waitpid(i32 -1, i32* %2, i32 0)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @unix_error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}
/* Variables and functions */
int in(int);
int /*<<< orphan*/ out(int, int);
void tty_enable_color_adapter() {
  int mor = in(0x3c2);
  mor |= 1;
  out(0x3cc, mor);
}


x86 assembly (clang, -O0):
<tty_enable_color_adapter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3c2,%edi
call   1040 <in@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x3cc,%edi
call   1030 <out@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tty_enable_color_adapter>:
push   %rax
mov    $0x3c2,%edi
call   1040 <in@plt>
or     $0x1,%eax
mov    $0x3cc,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <out@plt>

LLVM IR (-O0):
define void @tty_enable_color_adapter() {
%1 = alloca i32
%2 = call i32 @in(i32 962)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = or i32 %3, 1
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @out(i32 972, i32 %5)
ret void
}

LLVM IR (-O2):
define void @tty_enable_color_adapter() {
%1 = tail call i32 @in(i32 962)
%2 = or i32 %1, 1
%3 = tail call i32 @out(i32 972, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char str[] = "ABC\0DEF";
  printf("String str is \"%s\". \n", str);
  printf("The length of the string: %d .\n", sizeof(str));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movabs $0x46454400434241,%rax
mov    %rax,(%rsp)
lea    0xeda(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.str = [8 x i8] c"ABC\00DEF\00"
@.str = [22 x i8] c"String str is \22%s\22. \0A\00"
@.str.1 = [32 x i8] c"The length of the string: %d .\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
store i32 0, i32* %1
%3 = bitcast [8 x i8]* %2 to i8*
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i64 8)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"String str is \22%s\22. \0A\00"
@.str.1 = [32 x i8] c"The length of the string: %d .\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 19779406734246465, i64* %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i64 8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
char *my_alloc(int size, int lnum, char *fname) {
  char *ptr;
  ptr = (char *)malloc(size);
  if (ptr == 0) {
    fprintf(stderr, "Memory allocation bombed on line %d in %s\n", lnum, fname);
  }
  return (ptr);
}


x86 assembly (clang, -O0):
<my_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1165 <my_alloc+0x45>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xea0(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_alloc>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1150 <my_alloc+0x30>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
mov    %ebp,%edx
mov    %r14,%rcx
call   1030 <fprintf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"Memory allocation bombed on line %d in %s\0A\00"
define i8* @my_alloc(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i32, i32* %4
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = load i32, i32* %5
%16 = load i8*, i8** %6
%17 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %15, i8* %16)
br label %18
18: ; preds = %13, %3
%19 = load i8*, i8** %7
ret i8* %19
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"Memory allocation bombed on line %d in %s\0A\00"
define i8* @my_alloc(i32 %0, i32 %1, i8* %2) {
%4 = tail call i64 @malloc(i32 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2)
br label %9
9: ; preds = %6, %3
%10 = inttoptr i64 %4 to i8*
ret i8* %10
}
/* Type definitions */
typedef int /*<<< orphan*/ mbstate_t;
typedef int /*<<< orphan*/ char32_t;

/* Variables and functions */
size_t wctomb(char *, int /*<<< orphan*/);
size_t c32rtomb(char *restrict s, char32_t c32, mbstate_t *restrict ps) {
  ps;
  return (wctomb(s, c32));
}


x86 assembly (clang, -O0):
<c32rtomb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <wctomb@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c32rtomb>:
jmp    1030 <wctomb@plt>

LLVM IR (-O0):
define i64 @c32rtomb(i8* noalias %0, i32 %1, i32* noalias %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 i32*, i32** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = call i64 @wctomb(i8* %8, i32 %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @c32rtomb(i8* noalias %0, i32 %1, i32* noalias nocapture readnone %2) {
%4 = tail call i64 @wctomb(i8* %0, i32 %1)
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isupper(int);
void t_isupper_0xb3() {
  Assert_real((isupper(179) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isupper.c",
              900, ("isupper should be 0 for 0xb3"));
}


x86 assembly (clang, -O0):
<t_isupper_0xb3>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb3,%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x384,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isupper_0xb3>:
push   %rax
mov    $0xb3,%edi
call   1030 <isupper@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x384,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0xb3\00"
define void @t_isupper_0xb3() {
%1 = call i64 @isupper(i32 179)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 900, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0xb3\00"
define void @t_isupper_0xb3() {
%1 = tail call i64 @isupper(i32 179)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 900, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void write_belong(unsigned int *l, unsigned int v) {
  unsigned char *b = (unsigned char *)l;
  b[0] = v >> 24;
  b[1] = v >> 16;
  b[2] = v >> 8;
  b[3] = v;
}


x86 assembly (clang, -O0):
<write_belong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x18,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
shr    $0x10,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_belong>:
bswap  %esi
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @write_belong(i32* nocapture writeonly %0, i32 %1) {
%3 = bitcast i32* %0 to i8*
%4 = lshr i32 %1, 24
%5 = trunc i32 %4 to i8
store i8 %5, i8* %3
%6 = lshr i32 %1, 16
%7 = trunc i32 %6 to i8
%8 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %7, i8* %8
%9 = lshr i32 %1, 8
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds i8, i8* %3, i64 2
store i8 %10, i8* %11
%12 = trunc i32 %1 to i8
%13 = getelementptr inbounds i8, i8* %3, i64 3
store i8 %12, i8* %13
ret void
}
/* Variables and functions */
int putchar(int);
int putch(int c) { return putchar(c); }


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

x86 assembly (clang, -O2):
<putch>:
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define i32 @putch(i32 %0) {
%2 = tail call i32 @putchar(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t avalanche64(uint64_t h, uint64_t salt) {
  h += salt;
  h ^= h >> 33;
  h *= 0xff51afd7ed558ccd;
  h ^= h >> 33;
  h *= 0xc4ceb9fe1a85ec53;
  h ^= h >> 33;
  return h < 2 ? 2 : h;
}


x86 assembly (clang, -O0):
<avalanche64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x21,%ecx
sar    %cl,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xff51afd7ed558ccd,%rcx
af 51 ff
imul   %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x21,%ecx
sar    %cl,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xc4ceb9fe1a85ec53,%rcx
b9 ce c4
imul   %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x21,%ecx
sar    %cl,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    1184 <avalanche64+0x84>
mov    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    118a <avalanche64+0x8a>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @avalanche64(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = add nsw i32 %6, %5
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = ashr i32 %8, 33
%10 = load i32, i32* %3
%11 = xor i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = mul i64 %13, -49064778989728563
%15 = trunc i64 %14 to i32
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = ashr i32 %16, 33
%18 = load i32, i32* %3
%19 = xor i32 %18, %17
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = mul i64 %21, -4265267296055464877
%23 = trunc i64 %22 to i32
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = ashr i32 %24, 33
%26 = load i32, i32* %3
%27 = xor i32 %26, %25
store i32 %27, i32* %3
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 2
br i1 %29, label %30, label %31
30: ; preds = %2
br label %33
31: ; preds = %2
%32 = load i32, i32* %3
br label %33
33: ; preds = %31, %30
%34 = phi i32 [ 2, %30 ], [ %32, %31 ]
ret i32 %34
}

LLVM IR (-O2):
define i32 @avalanche64(i32 %0, i32 %1) {
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ EPOLLIN;
int /*<<< orphan*/ add2epoll(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ close(int);
int epoll_create1(int /*<<< orphan*/);
int epoll_init(int listen_sock) {
  int efd;
  efd = epoll_create1(0);
  if (efd > 0) {
    if (!add2epoll(efd, EPOLLIN, listen_sock)) {
      return efd;
    } else {
      close(efd);
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<epoll_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
xor    %edi,%edi
call   1050 <epoll_create1@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1184 <epoll_init+0x54>
mov    -0xc(%rbp),%edi
mov    0x2e8f(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
call   1030 <add2epoll@plt>
cmp    $0x0,%eax
jne    1177 <epoll_init+0x47>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118b <epoll_init+0x5b>
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
jmp    1184 <epoll_init+0x54>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epoll_init>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
xor    %edi,%edi
call   1050 <epoll_create1@plt>
mov    $0xffffffff,%ebx
test   %eax,%eax
jle    116b <epoll_init+0x3b>
mov    %eax,%ebp
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %r14d,%edx
call   1030 <add2epoll@plt>
test   %eax,%eax
je     1169 <epoll_init+0x39>
mov    %ebp,%edi
call   1040 <close@plt>
jmp    116b <epoll_init+0x3b>
mov    %ebp,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EPOLLIN = global i32 0
define i32 @epoll_init(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = call i32 @epoll_create1(i32 0)
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %1
%9 = load i32, i32* %4
%10 = load i32, i32* @EPOLLIN
%11 = load i32, i32* %3
%12 = call i32 @add2epoll(i32 %9, i32 %10, i32 %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %8
%15 = load i32, i32* %4
store i32 %15, i32* %2
br label %21
16: ; preds = %8
%17 = load i32, i32* %4
%18 = call i32 @close(i32 %17)
br label %19
19: ; preds = %16
br label %20
20: ; preds = %19, %1
store i32 -1, i32* %2
br label %21
21: ; preds = %20, %14
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@EPOLLIN = global i32 0
define i32 @epoll_init(i32 %0) {
%2 = tail call i32 @epoll_create1(i32 0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = load i32, i32* @EPOLLIN
%6 = tail call i32 @add2epoll(i32 %2, i32 %5, i32 %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @close(i32 %2)
br label %10
10: ; preds = %1, %8, %4
%11 = phi i32 [ %2, %4 ], [ -1, %8 ], [ -1, %1 ]
ret i32 %11
}
char *getcwd(path, size)
char *path;
int size;
{ return getwd(path); }


x86 assembly (clang, -O0):
<getcwd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <getwd@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @getcwd(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @getwd to i32 (i8*, ...)*)(i8* %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @getcwd(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getwd to i32 (i8*, ...)*)(i8* %0)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ check_for_hvm();
int main(void) {
  check_for_hvm();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @check_for_hvm()
ret i32 0
}
int xhash2(int x) {
  int xmax = 65535;
  int t;
  if (x == 0)
    return xmax;
  if (x == xmax)
    return 0;
  t = x * 11;
  return t % xmax;
}


x86 assembly (clang, -O0):
<xhash2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0xffff,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1123 <xhash2+0x23>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114c <xhash2+0x4c>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    113b <xhash2+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    114c <xhash2+0x4c>
imul   $0xb,-0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xhash2>:
test   %edi,%edi
je     110f <xhash2+0xf>
cmp    $0xffff,%edi
jne    1115 <xhash2+0x15>
xor    %eax,%eax
ret
mov    $0xffff,%eax
ret
lea    (%rdi,%rdi,4),%eax
lea    (%rdi,%rax,2),%eax
movslq %eax,%rcx
imul   $0xffffffff80008001,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0xf,%eax
add    %edx,%eax
mov    %eax,%edx
shl    $0x10,%edx
sub    %edx,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @xhash2(i32 %0) {
switch i32 %0, label %3 [
i32 0, label %6
i32 65535, label %2
]
2: ; preds = %1
br label %6
3: ; preds = %1
%4 = mul nsw i32 %0, 11
%5 = srem i32 %4, 65535
br label %6
6: ; preds = %1, %3, %2
%7 = phi i32 [ 0, %2 ], [ %5, %3 ], [ 65535, %1 ]
ret i32 %7
}
int do_228() { return 228; }


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

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

LLVM IR (-O0):
define i32 @do_228() {
ret i32 228
}

LLVM IR (-O2):
define i32 @do_228() {
ret i32 228
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ vsnprintf(char *, size_t, char *, int /*<<< orphan*/);
void uninivar_vsnprintf(void) {
  char *s;
  size_t n;
  char *format;
  va_list arg;
  (void)vsnprintf(s, n, format, arg);
}


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

x86 assembly (clang, -O2):
<uninivar_vsnprintf>:
jmp    1030 <vsnprintf@plt>

LLVM IR (-O0):
define void @uninivar_vsnprintf() {
%1 = alloca i8*
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i32
%5 = load i8*, i8** %1
%6 = load i64, i64* %2
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i32 @vsnprintf(i8* %5, i64 %6, i8* %7, i32 %8)
ret void
}

LLVM IR (-O2):
define void @uninivar_vsnprintf() {
%1 = tail call i32 @vsnprintf(i8* undef, i64 undef, i8* undef, i32 undef)
ret void
}
int test_imm_B0uint8_mem(unsigned char *val) {
  return ((*val) & (-0xB0 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B0uint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xffffff50,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B0uint8_mem>:
testb  $0x50,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_B0uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -176
%7 = icmp ne i32 %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_B0uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 80
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ panic(char *);
void *save_malloc(size_t size) {
  void *ptr;
  ptr = malloc(size);
  if (ptr == NULL)
    panic("no memory\n");
  return ptr;
}


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"no memory\0A\00"
define noalias i8* @save_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @panic(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ __libc_write(int, void const *, size_t);
int /*<<< orphan*/ pthread_testcancel();
ssize_t write(int fd, const void *buf, size_t count) {
  pthread_testcancel();
  return __libc_write(fd, buf, count);
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <pthread_testcancel@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <__libc_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <pthread_testcancel@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <__libc_write@plt>

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

LLVM IR (-O2):
define i32 @write(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 (...) @pthread_testcancel()
%5 = tail call i32 @__libc_write(i32 %0, i8* %1, i64 %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void Usage(char *prog_name) {
  fprintf(stderr,
          "usage: %s <thread count> <number of random vals per thread>\n",
          prog_name);
  exit(0);
}


x86 assembly (clang, -O0):
<Usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [61 x i8] c"usage: %s <thread count> <number of random vals per thread>\0A\00"
define void @Usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [61 x i8] c"usage: %s <thread count> <number of random vals per thread>\0A\00"
define void @Usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int tng_compress_uncompress_pos_gen(char *, int /*<<< orphan*/ *,
                                    int /*<<< orphan*/ *, int *,
                                    unsigned long *, unsigned long *);
int tng_compress_uncompress_pos_int(char *data, int *pos,
                                    unsigned long *prec_hi,
                                    unsigned long *prec_lo) {
  return tng_compress_uncompress_pos_gen(data, NULL, NULL, pos, prec_hi,
                                         prec_lo);
}


x86 assembly (clang, -O0):
<tng_compress_uncompress_pos_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1030 <tng_compress_uncompress_pos_gen@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tng_compress_uncompress_pos_int>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <tng_compress_uncompress_pos_gen@plt>

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

LLVM IR (-O2):
define i32 @tng_compress_uncompress_pos_int(i8* %0, i32* %1, i64* %2, i64* %3) {
%5 = tail call i32 @tng_compress_uncompress_pos_gen(i8* %0, i32* null, i32* null, i32* %1, i64* %2, i64* %3)
ret i32 %5
}
/* Variables and functions */
long ndb_get_ptr_p(void *i_ptr, long *o_index, short *o_status, size_t *o_size,
                   char *o_remark) {
  return 0;
}


x86 assembly (clang, -O0):
<ndb_get_ptr_p>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @ndb_get_ptr_p(i8* %0, i64* %1, i16* %2, i64* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i64*
%8 = alloca i16*
%9 = alloca i64*
%10 = alloca i8*
store i8* %0, i8** %6
store i64* %1, i64** %7
store i16* %2, i16** %8
store i64* %3, i64** %9
store i8* %4, i8** %10
ret i64 0
}

LLVM IR (-O2):
define i64 @ndb_get_ptr_p(i8* nocapture readnone %0, i64* nocapture readnone %1, i16* nocapture readnone %2, i64* nocapture readnone %3, i8* nocapture readnone %4) {
ret i64 0
}
int test_imm_C7int8_reg(signed char val) {
  return ((val) & (0xC7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C7int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xc7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_C7int8_reg(i8 signext %0) {
%2 = and i8 %0, -57
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int timespec_before(struct timespec *, struct timespec *);
int /*<<< orphan*/ timespec_now(struct timespec *);
int timespec_expired(struct timespec *ts) {
  struct timespec now;
  timespec_now(&now);
  return timespec_before(ts, &now);
}


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

x86 assembly (clang, -O2):
<timespec_expired>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <timespec_now@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <timespec_before@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
define i32 @timespec_expired(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
%3 = alloca %struct.timespec
store %struct.timespec* %0, %struct.timespec** %2
%4 = call i32 @timespec_now(%struct.timespec* %3)
%5 = load %struct.timespec*, %struct.timespec** %2
%6 = call i32 @timespec_before(%struct.timespec* %5, %struct.timespec* %3)
ret i32 %6
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @timespec_expired(%struct.timespec* %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = call i32 @timespec_now(%struct.timespec* %2)
%5 = call i32 @timespec_before(%struct.timespec* %0, %struct.timespec* %2)
ret i32 %5
}
/* Variables and functions */
int bar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("Call bar(): %d\n", bar());
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"Call bar(): %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @bar()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void los_reboot() {
  printf("%s rebooting (hardware reset)", "LetkuOS");
  __asm__ __volatile__("cli");
  while (1) {
    int i = inb(0x64);
    if ((i & 2) == 0)
      break;
  }
  outb(0x64, 0xFE);
}


x86 assembly (clang, -O0):
<los_reboot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xed8(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
cli
mov    $0x64,%edi
mov    $0x0,%al
call   1050 <inb@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    1171 <los_reboot+0x41>
jmp    1176 <los_reboot+0x46>
jmp    114e <los_reboot+0x1e>
mov    $0x64,%edi
mov    $0xfe,%esi
mov    $0x0,%al
call   1040 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<los_reboot>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xedf(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
cli
nopw   0x0(%rax,%rax,1)
mov    $0x64,%edi
xor    %eax,%eax
call   1050 <inb@plt>
test   $0x2,%al
jne    1150 <los_reboot+0x20>
mov    $0x64,%edi
mov    $0xfe,%esi
xor    %eax,%eax
pop    %rcx
jmp    1040 <outb@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"%s rebooting (hardware reset)\00"
@.str.1 = [8 x i8] c"LetkuOS\00"
define void @los_reboot() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %3
3: ; preds = %0, %9
%4 = call i32 (i32, ...) bitcast (i32 (...)* @inb to i32 (i32, ...)*)(i32 100)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = and i32 %5, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %3
br label %10
9: ; preds = %3
br label %3
10: ; preds = %8
%11 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outb to i32 (i32, i32, ...)*)(i32 100, i32 254)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"%s rebooting (hardware reset)\00"
@.str.1 = [8 x i8] c"LetkuOS\00"
define void @los_reboot() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
tail call void asm sideeffect "cli", "~{dirflag},~{fpsr},~{flags}"()
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @inb to i32 (i32, ...)*)(i32 100)
%4 = and i32 %3, 2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
%7 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outb to i32 (i32, i32, ...)*)(i32 100, i32 254)
ret void
}
/* Type definitions */
struct ac_buffer {
  int dummy;
};
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int _buffer_write(struct ac_buffer *, int /*<<< orphan*/ *, int);
int buffer_write_int64(struct ac_buffer *buffer, int64_t value) {
  return _buffer_write(buffer, &value, sizeof(int64_t));
}


x86 assembly (clang, -O0):
<buffer_write_int64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <_buffer_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_write_int64>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <_buffer_write@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.ac_buffer = type { i32 }
define i32 @buffer_write_int64(%struct.ac_buffer* %0, i32 %1) {
%3 = alloca %struct.ac_buffer*
%4 = alloca i32
store %struct.ac_buffer* %0, %struct.ac_buffer** %3
store i32 %1, i32* %4
%5 = load %struct.ac_buffer*, %struct.ac_buffer** %3
%6 = call i32 @_buffer_write(%struct.ac_buffer* %5, i32* %4, i32 4)
ret i32 %6
}

LLVM IR (-O2):
%struct.ac_buffer = type { i32 }
define i32 @buffer_write_int64(%struct.ac_buffer* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @_buffer_write(%struct.ac_buffer* %0, i32* %3, i32 4)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ngen(char *, char *, int);
void cgdeclb(int a) { ngen("%s\t%d(%%rbp)", "decb", a); }


x86 assembly (clang, -O0):
<cgdeclb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xedb(%rip),%rdi
lea    0xee1(%rip),%rsi
call   1030 <ngen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgdeclb>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xeed(%rip),%rsi
jmp    1030 <ngen@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"%s\09%d(%%rbp)\00"
@.str.1 = [5 x i8] c"decb\00"
define void @cgdeclb(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @ngen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%s\09%d(%%rbp)\00"
@.str.1 = [5 x i8] c"decb\00"
define void @cgdeclb(i32 %0) {
%2 = tail call i32 @ngen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int *, int);
void int_list_copy(int *src, int *dest, int length) {
  memcpy(dest, src, length * sizeof(int));
}


x86 assembly (clang, -O0):
<int_list_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_list_copy>:
mov    %rdi,%rax
shl    $0x2,%edx
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @int_list_copy(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 4
%12 = trunc i64 %11 to i32
%13 = call i32 @memcpy(i32* %7, i32* %8, i32 %12)
ret void
}

LLVM IR (-O2):
define void @int_list_copy(i32* %0, i32* %1, i32 %2) {
%4 = shl i32 %2, 2
%5 = tail call i32 @memcpy(i32* %1, i32* %0, i32 %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ __builtin_rdctl(int);
uint32_t _Nios2_Get_ctlreg_tlbacc(void) { return (uint32_t)__builtin_rdctl(9); }


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

x86 assembly (clang, -O2):
<_Nios2_Get_ctlreg_tlbacc>:
mov    $0x9,%edi
jmp    1030 <__builtin_rdctl@plt>

LLVM IR (-O0):
define i32 @_Nios2_Get_ctlreg_tlbacc() {
%1 = call i32 @__builtin_rdctl(i32 9)
ret i32 %1
}

LLVM IR (-O2):
define i32 @_Nios2_Get_ctlreg_tlbacc() {
%1 = tail call i32 @__builtin_rdctl(i32 9)
ret i32 %1
}
int ttohl(int val) { return (val); }


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

x86 assembly (clang, -O2):
<ttohl>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @ttohl(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
float clampf(float);
int round(float);
int clamp8(float x) { return round(clampf(x) * 255.0f); }


x86 assembly (clang, -O0):
<clamp8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <clampf@plt>
movss  0xec1(%rip),%xmm1
mulss  %xmm1,%xmm0
call   1040 <round@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp8>:
push   %rax
call   1030 <clampf@plt>
mulss  0xed2(%rip),%xmm0
pop    %rax
jmp    1040 <round@plt>

LLVM IR (-O0):
define i32 @clamp8(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @clampf(float %3)
%5 = fmul float %4, 2.550000e+02
%6 = call i32 @round(float %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @clamp8(float %0) {
%2 = tail call float @clampf(float %0)
%3 = fmul float %2, 2.550000e+02
%4 = tail call i32 @round(float %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int bs_disconnect(int fd) {
  close(fd);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @bs_disconnect(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ say(char *, int);
void hit(void) { say("This is for all the kids that fell down you!", 1); }


x86 assembly (clang, -O0):
<hit>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1,%esi
call   1030 <say@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hit>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
jmp    1030 <say@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"This is for all the kids that fell down you!\00"
define void @hit() {
%1 = call i32 @say(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"This is for all the kids that fell down you!\00"
define void @hit() {
%1 = tail call i32 @say(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int y_root;
};
struct TYPE_4__ {
  TYPE_1__ xbutton;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xbutton_y_root(void *_p, int _v) {
  ((XEvent *)_p)->xbutton.y_root = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XEvent_xbutton_y_root>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xbutton_y_root(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xbutton_y_root(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
void f(void) {
  int i, v = 0;
#pragma acc loop gang reduction(+ : v)
  for (i = 0; i < 10; i++)
    v++;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1133 <f+0x33>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <f+0x12>
pop    %rbp
ret

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

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

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