#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int compare_uint64(void *p1, void *p2, int size) {
  assert(size == 8);
  unsigned long long int *val1 = (unsigned long long int *)p1;
  unsigned long long int *val2 = (unsigned long long int *)p2;
  if (*val1 < *val2)
    return -1;
  if (*val1 > *val2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<compare_uint64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    -0x30(%rbp),%rcx
cmp    (%rcx),%rax
jae    1164 <compare_uint64+0x54>
movl   $0xffffffff,-0x4(%rbp)
jmp    118b <compare_uint64+0x7b>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    -0x30(%rbp),%rcx
cmp    (%rcx),%rax
jbe    1184 <compare_uint64+0x74>
movl   $0x1,-0x4(%rbp)
jmp    118b <compare_uint64+0x7b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_uint64>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x8,%edx
sete   %dil
call   1030 <assert@plt>
mov    (%rbx),%rax
xor    %ecx,%ecx
cmp    (%r14),%rax
seta   %cl
mov    $0xffffffff,%eax
cmovae %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @compare_uint64(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i64*
%9 = alloca i64*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%10 = load i32, i32* %7
%11 = icmp eq i32 %10, 8
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i8*, i8** %5
%15 = bitcast i8* %14 to i64*
store i64* %15, i64** %8
%16 = load i8*, i8** %6
%17 = bitcast i8* %16 to i64*
store i64* %17, i64** %9
%18 = load i64*, i64** %8
%19 = load i64, i64* %18
%20 = load i64*, i64** %9
%21 = load i64, i64* %20
%22 = icmp ult i64 %19, %21
br i1 %22, label %23, label %24
23: ; preds = %3
store i32 -1, i32* %4
br label %32
24: ; preds = %3
%25 = load i64*, i64** %8
%26 = load i64, i64* %25
%27 = load i64*, i64** %9
%28 = load i64, i64* %27
%29 = icmp ugt i64 %26, %28
br i1 %29, label %30, label %31
30: ; preds = %24
store i32 1, i32* %4
br label %32
31: ; preds = %24
store i32 0, i32* %4
br label %32
32: ; preds = %31, %30, %23
%33 = load i32, i32* %4
ret i32 %33
}

LLVM IR (-O2):
define i32 @compare_uint64(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 8
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = bitcast i8* %0 to i64*
%8 = bitcast i8* %1 to i64*
%9 = load i64, i64* %7
%10 = load i64, i64* %8
%11 = icmp ult i64 %9, %10
%12 = icmp ugt i64 %9, %10
%13 = zext i1 %12 to i32
%14 = select i1 %11, i32 -1, i32 %13
ret i32 %14
}