xunge/DecIR huggingface dataset:
int qsort_cmp__QUEUE_INT(const void *x, const void *y) {
  if (*((int *)x) > *((int *)y))
    return (-1);
  else
    return (*((int *)x) < *((int *)y));
}


x86 assembly (clang, -O0):
<qsort_cmp__QUEUE_INT>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jle    112a <qsort_cmp__QUEUE_INT+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1141 <qsort_cmp__QUEUE_INT+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsort_cmp__QUEUE_INT>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setl   %cl
mov    $0xffffffff,%eax
cmovle %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @qsort_cmp__QUEUE_INT(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
int ho_strlen(const char *str) {
  char *p = (char *)str;
  while (*p++)
    ;
  return p - str - 1;
}


x86 assembly (clang, -O0):
<ho_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
je     112d <ho_strlen+0x2d>
jmp    1110 <ho_strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ho_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <ho_strlen+0x10>
ret

LLVM IR (-O0):
define i32 @ho_strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %10, %1
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %3
%8 = load i8, i8* %6
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %5
br label %5
11: ; preds = %5
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = ptrtoint i8* %12 to i64
%15 = ptrtoint i8* %13 to i64
%16 = sub i64 %14, %15
%17 = sub nsw i64 %16, 1
%18 = trunc i64 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @ho_strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %4 to i64
%9 = ptrtoint i8* %0 to i64
%10 = xor i64 %9, -1
%11 = add i64 %8, %10
%12 = trunc i64 %11 to i32
ret i32 %12
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ display;
};
struct TYPE_4__ {
  TYPE_1__ xany;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void *get_XEvent_xany_display(void *_p) {
  return (void *)((XEvent *)_p)->xany.display;
}


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

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

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

LLVM IR (-O2):
define i8* @get_XEvent_xany_display(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
int calculate_index(long income) {
  return ((income - 2200) > (0) ? (income - 2200) : (0)) / 500;
}


x86 assembly (clang, -O0):
<calculate_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x898,%rax
cmp    $0x0,%rax
jle    112f <calculate_index+0x2f>
mov    -0x8(%rbp),%rax
sub    $0x898,%rax
mov    %rax,-0x10(%rbp)
jmp    113a <calculate_index+0x3a>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    113a <calculate_index+0x3a>
mov    -0x10(%rbp),%rax
mov    $0x1f4,%ecx
cqto
idiv   %rcx
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_index>:
cmp    $0x899,%rdi
mov    $0x898,%eax
cmovge %rdi,%rax
add    $0xfffffffffffff768,%rax
shr    $0x2,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
mov    %rdx,%rax
shr    $0x4,%rax
ret

LLVM IR (-O0):
define i32 @calculate_index(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub nsw i64 %3, 2200
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i64, i64* %2
%8 = sub nsw i64 %7, 2200
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %6
%11 = phi i64 [ %8, %6 ], [ 0, %9 ]
%12 = sdiv i64 %11, 500
%13 = trunc i64 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @calculate_index(i64 %0) {
%2 = icmp sgt i64 %0, 2200
%3 = select i1 %2, i64 %0, i64 2200
%4 = add nsw i64 %3, -2200
%5 = udiv i64 %4, 500
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void *sqlite3_malloc(int);
void *fts3HashMalloc(int n) {
  void *p = sqlite3_malloc(n);
  if (p) {
    memset(p, 0, n);
  }
  return p;
}


x86 assembly (clang, -O0):
<fts3HashMalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sqlite3_malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1150 <fts3HashMalloc+0x30>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fts3HashMalloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1040 <sqlite3_malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113e <fts3HashMalloc+0x1e>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @fts3HashMalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @sqlite3_malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i32, i32* %2
%11 = call i32 @memset(i8* %9, i32 0, i32 %10)
br label %12
12: ; preds = %8, %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define i8* @fts3HashMalloc(i32 %0) {
%2 = tail call i8* @sqlite3_malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @memset(i8* %2, i32 0, i32 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, ...);
void print_pid(void) {
  printf("==============================\n");
  printf("Starting exec test...\n");
  printf("My pid is %d and parents is %d\n", getpid(), getppid());
}


x86 assembly (clang, -O0):
<print_pid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getppid@plt>
mov    -0x4(%rbp),%esi
mov    %eax,%edx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_pid>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <getppid@plt>
lea    0xe90(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
pop    %rbx
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"==============================\0A\00"
@.str.1 = [23 x i8] c"Starting exec test...\0A\00"
@.str.2 = [32 x i8] c"My pid is %d and parents is %d\0A\00"
define void @print_pid() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @getpid()
%4 = call i32 (...) @getppid()
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %4)
ret void
}

LLVM IR (-O2):
@.str.2 = [32 x i8] c"My pid is %d and parents is %d\0A\00"
@str = [31 x i8] c"==============================\00"
@str.3 = [22 x i8] c"Starting exec test...\00"
define void @print_pid() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 (...) @getpid()
%4 = tail call i32 (...) @getppid()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %4)
ret void
}
unsigned char BaseToCharBWA(char base) {
  if (base == 0)
    return 'A';
  else if (base == 1)
    return 'C';
  else if (base == 3)
    return 'T';
  else if (base == 2)
    return 'G';
  return 'N';
}


x86 assembly (clang, -O0):
<BaseToCharBWA>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x0,%eax
jne    1120 <BaseToCharBWA+0x20>
movb   $0x41,-0x1(%rbp)
jmp    1175 <BaseToCharBWA+0x75>
movsbl -0x2(%rbp),%eax
cmp    $0x1,%eax
jne    1136 <BaseToCharBWA+0x36>
movb   $0x43,-0x1(%rbp)
jmp    1175 <BaseToCharBWA+0x75>
movsbl -0x2(%rbp),%eax
cmp    $0x3,%eax
jne    114c <BaseToCharBWA+0x4c>
movb   $0x54,-0x1(%rbp)
jmp    1175 <BaseToCharBWA+0x75>
movsbl -0x2(%rbp),%eax
cmp    $0x2,%eax
jne    1162 <BaseToCharBWA+0x62>
movb   $0x47,-0x1(%rbp)
jmp    1175 <BaseToCharBWA+0x75>
jmp    1167 <BaseToCharBWA+0x67>
jmp    116c <BaseToCharBWA+0x6c>
jmp    1171 <BaseToCharBWA+0x71>
movb   $0x4e,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BaseToCharBWA>:
lea    0x0(,%rdi,8),%ecx
mov    $0x54474341,%edx
shr    %cl,%edx
cmp    $0x4,%dil
mov    $0x4e,%eax
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @BaseToCharBWA(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 65, i8* %2
br label %27
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %8
store i8 67, i8* %2
br label %27
13: ; preds = %8
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 3
br i1 %16, label %17, label %18
17: ; preds = %13
store i8 84, i8* %2
br label %27
18: ; preds = %13
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %23
22: ; preds = %18
store i8 71, i8* %2
br label %27
23: ; preds = %18
br label %24
24: ; preds = %23
br label %25
25: ; preds = %24
br label %26
26: ; preds = %25
store i8 78, i8* %2
br label %27
27: ; preds = %26, %22, %17, %12, %7
%28 = load i8, i8* %2
ret i8 %28
}

LLVM IR (-O2):
define zeroext i8 @BaseToCharBWA(i8 signext %0) {
%2 = icmp ult i8 %0, 4
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 3
%5 = lshr i32 1413956417, %4
%6 = trunc i32 %5 to i8
%7 = select i1 %2, i8 %6, i8 78
ret i8 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutexattr_t;

/* Variables and functions */
int pthread_mutexattr_destroy(pthread_mutexattr_t *a) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @pthread_mutexattr_destroy(i32* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ japi_removeitem(int, char *);
void j_removeitem(int arg0, char *arg1) { japi_removeitem(arg0, arg1); }


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

x86 assembly (clang, -O2):
<j_removeitem>:
jmp    1030 <japi_removeitem@plt>

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

LLVM IR (-O2):
define void @j_removeitem(i32 %0, i8* %1) {
%3 = tail call i32 @japi_removeitem(i32 %0, i8* %1)
ret void
}
void disable_interrupts() {}


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

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

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

LLVM IR (-O2):
define void @disable_interrupts() {
ret void
}
int reply() { return (0); }


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

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

LLVM IR (-O0):
define i32 @reply() {
ret i32 0
}

LLVM IR (-O2):
define i32 @reply() {
ret i32 0
}
/* Variables and functions */
int uart_read(int);
int uart_getc(void) {
  unsigned long status;
  do {
    status = uart_read(0x4);
  } while (!(status & (1 << 1)));
  return uart_read(0x0);
}


x86 assembly (clang, -O0):
<uart_getc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1030 <uart_read@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x2,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1118 <uart_getc+0x8>
xor    %edi,%edi
call   1030 <uart_read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_getc>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x4,%edi
call   1030 <uart_read@plt>
test   $0x2,%al
je     1120 <uart_getc+0x10>
xor    %edi,%edi
pop    %rax
jmp    1030 <uart_read@plt>

LLVM IR (-O0):
define i32 @uart_getc() {
%1 = alloca i64
br label %2
2: ; preds = %5, %0
%3 = call i32 @uart_read(i32 4)
%4 = sext i32 %3 to i64
store i64 %4, i64* %1
br label %5
5: ; preds = %2
%6 = load i64, i64* %1
%7 = and i64 %6, 2
%8 = icmp ne i64 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %2, label %10
10: ; preds = %5
%11 = call i32 @uart_read(i32 0)
ret i32 %11
}

LLVM IR (-O2):
define i32 @uart_getc() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @uart_read(i32 4)
%3 = and i32 %2, 2
%4 = icmp eq i32 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = tail call i32 @uart_read(i32 0)
ret i32 %6
}
/* Variables and functions */
bool have_west_neighbor(unsigned int xpos) {
  if (xpos == 0)
    return false;
  else
    return true;
}


x86 assembly (clang, -O0):
<have_west_neighbor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <have_west_neighbor+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1124 <have_west_neighbor+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<have_west_neighbor>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

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

LLVM IR (-O2):
define i32 @have_west_neighbor(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
void fpga_mgr_debugfs_uninit(void) {}


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

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

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

LLVM IR (-O2):
define void @fpga_mgr_debugfs_uninit() {
ret void
}
/* Variables and functions */
char readbiosb(int);
char getnumrows() { return readbiosb(0x484); }


x86 assembly (clang, -O0):
<getnumrows>:
push   %rbp
mov    %rsp,%rbp
mov    $0x484,%edi
call   1030 <readbiosb@plt>
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getnumrows>:
mov    $0x484,%edi
jmp    1030 <readbiosb@plt>

LLVM IR (-O0):
define signext i8 @getnumrows() {
%1 = call signext i8 @readbiosb(i32 1156)
ret i8 %1
}

LLVM IR (-O2):
define signext i8 @getnumrows() {
%1 = tail call signext i8 @readbiosb(i32 1156)
ret i8 %1
}
/* Type definitions */
struct inputfile {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ inf_log(struct inputfile *, int, char const *);
void inf_warn(struct inputfile *inf, const char *message) {
  inf_log(inf, 2, message);
}


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

x86 assembly (clang, -O2):
<inf_warn>:
mov    %rsi,%rdx
mov    $0x2,%esi
jmp    1030 <inf_log@plt>

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

LLVM IR (-O2):
%struct.inputfile = type { i32 }
define void @inf_warn(%struct.inputfile* %0, i8* %1) {
%3 = tail call i32 @inf_log(%struct.inputfile* %0, i32 2, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, ...);
int fdnoblock(int fd) {
  return fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
}


x86 assembly (clang, -O0):
<fdnoblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1030 <fcntl@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    %eax,%edx
mov    0x2e99(%rip),%rax
or     (%rax),%edx
mov    $0x0,%al
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdnoblock>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ebc(%rip),%rax
mov    (%rax),%ebp
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   1030 <fcntl@plt>
mov    0x2eb3(%rip),%rcx
or     (%rcx),%eax
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_SETFL = global i32 0
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
define i32 @fdnoblock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_SETFL
%5 = load i32, i32* %2
%6 = load i32, i32* @F_GETFL
%7 = call i32 (i32, i32, ...) @fcntl(i32 %5, i32 %6)
%8 = load i32, i32* @O_NONBLOCK
%9 = or i32 %7, %8
%10 = call i32 (i32, i32, ...) @fcntl(i32 %3, i32 %4, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
@F_SETFL = global i32 0
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
define i32 @fdnoblock(i32 %0) {
%2 = load i32, i32* @F_SETFL
%3 = load i32, i32* @F_GETFL
%4 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %3)
%5 = load i32, i32* @O_NONBLOCK
%6 = or i32 %5, %4
%7 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %2, i32 %6)
ret i32 %7
}
double foo010(double a, float b, double c) { return (a - b * c); }


x86 assembly (clang, -O0):
<foo010>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x18(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo010>:
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @foo010(double %0, float %1, double %2) {
%4 = alloca double
%5 = alloca float
%6 = alloca double
store double %0, double* %4
store float %1, float* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load float, float* %5
%9 = fpext float %8 to double
%10 = load double, double* %6
%11 = fneg double %9
%12 = call double @llvm.fmuladd.f64(double %11, double %10, double %7)
ret double %12
}

LLVM IR (-O2):
define double @foo010(double %0, float %1, double %2) {
%4 = fpext float %1 to double
%5 = fneg double %4
%6 = tail call double @llvm.fmuladd.f64(double %5, double %2, double %0)
ret double %6
}
int getVbeInfo() { return 0; }


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

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

LLVM IR (-O0):
define i32 @getVbeInfo() {
ret i32 0
}

LLVM IR (-O2):
define i32 @getVbeInfo() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_232() {
  Assert_real((isqrt(232) == 15),
              "/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/stdlib/isqrt.c",
              1165, ("Integer square root of 232 should be 15"));
}


x86 assembly (clang, -O0):
<t_sqrt_232>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe8,%edi
call   1030 <isqrt@plt>
cmp    $0xf,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x48d,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_232>:
push   %rax
mov    $0xe8,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xf,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x48d,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 232 should be 15\00"
define void @t_sqrt_232() {
%1 = call i32 @isqrt(i32 232)
%2 = icmp eq i32 %1, 15
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1165, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 232 should be 15\00"
define void @t_sqrt_232() {
%1 = tail call i32 @isqrt(i32 232)
%2 = icmp eq i32 %1, 15
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1165, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
extern int foo(int a) { return a; }


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

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

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

LLVM IR (-O2):
define i32 @foo(i32 returned %0) {
ret i32 %0
}
double fabs(double x) {
  if (x > 0)
    return x;
  else if (x == 0)
    return 0;
  else
    return -x;
}


x86 assembly (clang, -O0):
<fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    112a <fabs+0x2a>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1170 <fabs+0x70>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    114f <fabs+0x4f>
jp     114f <fabs+0x4f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1170 <fabs+0x70>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     111b <fabs+0x1b>
jne    1113 <fabs+0x13>
jp     1113 <fabs+0x13>
movapd %xmm1,%xmm0
ret
xorpd  0xee5(%rip),%xmm0
movapd %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fabs(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load double, double* %3
store double %7, double* %2
br label %15
8: ; preds = %1
%9 = load double, double* %3
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
store double 0.000000e+00, double* %2
br label %15
12: ; preds = %8
%13 = load double, double* %3
%14 = fneg double %13
store double %14, double* %2
br label %15
15: ; preds = %12, %11, %6
%16 = load double, double* %2
ret double %16
}

LLVM IR (-O2):
define double @fabs(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = fcmp oeq double %0, 0.000000e+00
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = fneg double %0
br label %7
7: ; preds = %3, %1, %5
%8 = phi double [ %6, %5 ], [ %0, %1 ], [ 0.000000e+00, %3 ]
ret double %8
}
/* Variables and functions */
int PAPI_accum(int, long long *);
void papif_accum_(int *EventSet, long long *values, int *check) {
  *check = PAPI_accum(*EventSet, values);
}


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

x86 assembly (clang, -O2):
<papif_accum_>:
push   %rbx
mov    %rdx,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_accum@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @papif_accum_(i32* nocapture %0, i64* %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %0
%5 = tail call i32 @PAPI_accum(i32 %4, i64* %1)
store i32 %5, i32* %2
ret void
}
/* Variables and functions */
int do_protectedmain();
int /*<<< orphan*/ lua_closestring();
int /*<<< orphan*/ lua_message(char *);
char *lua_openstring(char *);
int lua_dostring(char *string) {
  int status;
  char *message = lua_openstring(string);
  if (message) {
    lua_message(message);
    return 1;
  }
  status = do_protectedmain();
  lua_closestring();
  return status;
}


x86 assembly (clang, -O0):
<lua_dostring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <lua_openstring@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1179 <lua_dostring+0x39>
mov    -0x20(%rbp),%rdi
call   1050 <lua_message@plt>
movl   $0x1,-0x4(%rbp)
jmp    1190 <lua_dostring+0x50>
mov    $0x0,%al
call   1060 <do_protectedmain@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <lua_closestring@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lua_dostring>:
push   %rbx
call   1040 <lua_openstring@plt>
test   %rax,%rax
je     115a <lua_dostring+0x1a>
mov    %rax,%rdi
call   1050 <lua_message@plt>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
call   1060 <do_protectedmain@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <lua_closestring@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @lua_dostring(i8* %0) {
%2 = tail call i8* @lua_openstring(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @lua_message(i8* %2)
br label %9
6: ; preds = %1
%7 = tail call i32 (...) @do_protectedmain()
%8 = tail call i32 (...) @lua_closestring()
br label %9
9: ; preds = %6, %4
%10 = phi i32 [ 1, %4 ], [ %7, %6 ]
ret i32 %10
}
void sanitize_file_name(char *name) {
  for (; *name; name++) {
    if (*name == '/') {
      *name = '.';
    }
  }
}


x86 assembly (clang, -O0):
<sanitize_file_name>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <sanitize_file_name+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    112c <sanitize_file_name+0x2c>
mov    -0x8(%rbp),%rax
movb   $0x2e,(%rax)
jmp    1131 <sanitize_file_name+0x31>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <sanitize_file_name+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sanitize_file_name>:
jmp    1117 <sanitize_file_name+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x2e,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x2f,%al
je     1110 <sanitize_file_name+0x10>
test   %al,%al
jne    1113 <sanitize_file_name+0x13>
ret

LLVM IR (-O0):
define void @sanitize_file_name(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 47
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = load i8*, i8** %2
store i8 46, i8* %13
br label %14
14: ; preds = %12, %7
br label %15
15: ; preds = %14
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @sanitize_file_name(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 47, label %5
]
5: ; preds = %2
store i8 46, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret void
}
void loop(int (*callback)(void)) {
  for (;;)
    callback();
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
call   *-0x8(%rbp)
jmp    110c <loop+0xc>

x86 assembly (clang, -O2):
<loop>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   *%rbx
jmp    1110 <loop+0x10>

LLVM IR (-O0):
define void @loop(i32 ()* %0) {
%2 = alloca i32 ()*
store i32 ()* %0, i32 ()** %2
br label %3
3: ; preds = %3, %1
%4 = load i32 ()*, i32 ()** %2
%5 = call i32 %4()
br label %3
}

LLVM IR (-O2):
define void @loop(i32 ()* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 %0()
br label %2
}
int lg2ff_init(struct hid_device *hdev) { return -1; }


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

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

LLVM IR (-O0):
%struct.hid_device = type opaque
define i32 @lg2ff_init(%struct.hid_device* %0) {
%2 = alloca %struct.hid_device*
store %struct.hid_device* %0, %struct.hid_device** %2
ret i32 -1
}

LLVM IR (-O2):
%struct.hid_device = type opaque
define i32 @lg2ff_init(%struct.hid_device* nocapture readnone %0) {
ret i32 -1
}
unsigned kol_thread_start(unsigned start, unsigned stack) {
  asm("int $0x40" ::"a"(51), "b"(1), "c"(start), "d"(stack));
}


x86 assembly (clang, -O0):
<kol_thread_start>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%edx
mov    $0x33,%eax
mov    $0x1,%ebx
int    $0x40
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_thread_start>:
push   %rbx
mov    %esi,%edx
mov    %edi,%ecx
mov    $0x33,%eax
mov    $0x1,%ebx
int    $0x40
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @kol_thread_start(i32 %0, i32 %1) {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},{dx},~{dirflag},~{fpsr},~{flags}"(i32 51, i32 1, i32 %0, i32 %1)
ret i32 undef
}
int swap_nibble(unsigned int n) {
  return (((n & 0xf0) >> 4 | (n & 0x0f) << 4));
}


x86 assembly (clang, -O0):
<swap_nibble>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf0,%eax
shr    $0x4,%eax
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_nibble>:
mov    %edi,%ecx
shr    $0x4,%ecx
and    $0xf,%ecx
shl    $0x4,%edi
movzbl %dil,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @swap_nibble(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 240
%5 = lshr i32 %4, 4
%6 = load i32, i32* %2
%7 = and i32 %6, 15
%8 = shl i32 %7, 4
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @swap_nibble(i32 %0) {
%2 = lshr i32 %0, 4
%3 = and i32 %2, 15
%4 = shl i32 %0, 4
%5 = and i32 %4, 240
%6 = or i32 %3, %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ EBADF;
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int tcsetpgrp(int fd, pid_t pgrp_id) {
  if (fd < 0) {
    __set_errno(EBADF);
    return -1;
  }
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<tcsetpgrp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1142 <tcsetpgrp+0x32>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1157 <tcsetpgrp+0x47>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcsetpgrp>:
push   %rax
test   %edi,%edi
jns    111e <tcsetpgrp+0xe>
mov    0x2ebc(%rip),%rax
jmp    1125 <tcsetpgrp+0x15>
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EBADF = global i32 0
@ENOSYS = global i32 0
define i32 @tcsetpgrp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @EBADF
%10 = call i32 @__set_errno(i32 %9)
store i32 -1, i32* %3
br label %14
11: ; preds = %2
%12 = load i32, i32* @ENOSYS
%13 = call i32 @__set_errno(i32 %12)
store i32 -1, i32* %3
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@EBADF = global i32 0
@ENOSYS = global i32 0
define i32 @tcsetpgrp(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 0
%4 = load i32, i32* @EBADF
%5 = load i32, i32* @ENOSYS
%6 = select i1 %3, i32 %4, i32 %5
%7 = tail call i32 @__set_errno(i32 %6)
ret i32 -1
}
void ff_hevc_put_hevc_uni_w_epel_v64_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_epel_v64_12_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dtx_drawflush();
void dtx_flush(void) { dtx_drawflush(); }


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

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

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

LLVM IR (-O2):
define void @dtx_flush() {
%1 = tail call i32 (...) @dtx_drawflush()
ret void
}
int load_crashdump_segments(struct kexec_info *info, unsigned long crash_base,
                            unsigned long crash_end) {
  return -1;
}


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

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

LLVM IR (-O0):
%struct.kexec_info = type opaque
define i32 @load_crashdump_segments(%struct.kexec_info* %0, i64 %1, i64 %2) {
%4 = alloca %struct.kexec_info*
%5 = alloca i64
%6 = alloca i64
store %struct.kexec_info* %0, %struct.kexec_info** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
ret i32 -1
}

LLVM IR (-O2):
%struct.kexec_info = type opaque
define i32 @load_crashdump_segments(%struct.kexec_info* nocapture readnone %0, i64 %1, i64 %2) {
ret i32 -1
}
/* Type definitions */
struct list_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ list_init_head(struct list_head *);
int /*<<< orphan*/ sys_list_del_node(struct list_head *);
void list_del(struct list_head *node) {
  sys_list_del_node(node);
  list_init_head(node);
}


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

x86 assembly (clang, -O2):
<list_del>:
push   %rbx
mov    %rdi,%rbx
call   1040 <sys_list_del_node@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <list_init_head@plt>

LLVM IR (-O0):
%struct.list_head = type { i32 }
define void @list_del(%struct.list_head* %0) {
%2 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %2
%3 = load %struct.list_head*, %struct.list_head** %2
%4 = call i32 @sys_list_del_node(%struct.list_head* %3)
%5 = load %struct.list_head*, %struct.list_head** %2
%6 = call i32 @list_init_head(%struct.list_head* %5)
ret void
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define void @list_del(%struct.list_head* %0) {
%2 = tail call i32 @sys_list_del_node(%struct.list_head* %0)
%3 = tail call i32 @list_init_head(%struct.list_head* %0)
ret void
}
int bias_hash(int a, int b, int p) {
  a = (p * a) ^ b;
  if (a < 0)
    return -a;
  return a;
}


x86 assembly (clang, -O0):
<bias_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1131 <bias_hash+0x31>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1137 <bias_hash+0x37>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bias_hash>:
imul   %edx,%edi
xor    %esi,%edi
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @bias_hash(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %0
%5 = xor i32 %4, %1
%6 = tail call i32 @llvm.abs.i32(i32 %5, i1 true)
ret i32 %6
}
void XdmcpUnwrap(unsigned char *output, int k) {
  int i;
  unsigned char blocks[2][8];
  k = (k == 0) ? 1 : 0;
  for (i = 0; i < 32; i++)
    output[i] = blocks[k][i];
}


x86 assembly (clang, -O0):
<XdmcpUnwrap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x20,-0x10(%rbp)
jge    115e <XdmcpUnwrap+0x5e>
movslq -0xc(%rbp),%rcx
lea    -0x20(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1125 <XdmcpUnwrap+0x25>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @XdmcpUnwrap(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [2 x [8 x i8]]
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
store i32 %10, i32* %4
store i32 0, i32* %5
br label %11
11: ; preds = %26, %2
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 32
br i1 %13, label %14, label %29
14: ; preds = %11
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [2 x [8 x i8]], [2 x [8 x i8]]* %6, i64 0, i64 %16
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %17, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = load i8*, i8** %3
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 %21, i8* %25
br label %26
26: ; preds = %14
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %11
29: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @XdmcpUnwrap(i8* nocapture writeonly %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fd_nrf8001_echo_event(int /*<<< orphan*/ *, scalar_t__);
void fd_nrf8001_decode_echo_event(uint8_t *buffer, uint32_t length) {
  fd_nrf8001_echo_event(&buffer[1], length - 1);
}


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

x86 assembly (clang, -O2):
add    $0x4,%rdi
add    $0xffffffffffffffff,%rsi
jmp    1030 <fd_nrf8001_echo_event@plt>

LLVM IR (-O0):
define void @fd_nrf8001_decode_echo_event(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 1
%7 = load i64, i64* %4
%8 = sub nsw i64 %7, 1
%9 = call i32 @fd_nrf8001_echo_event(i32* %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @fd_nrf8001_decode_echo_event(i32* %0, i64 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = add nsw i64 %1, -1
%5 = tail call i32 @fd_nrf8001_echo_event(i32* %3, i64 %4)
ret void
}
int meta_l2c_writeback(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @meta_l2c_writeback() {
ret i32 1
}

LLVM IR (-O2):
define i32 @meta_l2c_writeback() {
ret i32 1
}
/* Variables and functions */
int ftok(char const *, char);
int generate_key(const char *path) { return ftok(path, 'X'); }


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

x86 assembly (clang, -O2):
<generate_key>:
mov    $0x58,%esi
jmp    1030 <ftok@plt>

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

LLVM IR (-O2):
define i32 @generate_key(i8* %0) {
%2 = tail call i32 @ftok(i8* %0, i8 signext 88)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ alarm(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ unsafe_func();
void handler(int sig) {
  printf("recv a sig=%d\n", sig);
  unsafe_func();
  alarm(1);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <unsafe_func@plt>
mov    $0x1,%edi
call   1040 <alarm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handler>:
push   %rax
mov    %edi,%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <unsafe_func@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <alarm@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"recv a sig=%d\0A\00"
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @unsafe_func()
%6 = call i32 @alarm(i32 1)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"recv a sig=%d\0A\00"
define void @handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 (...) @unsafe_func()
%4 = tail call i32 @alarm(i32 1)
ret void
}