#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 libhl_cmp_keys_double(void *k1, size_t k1size, void *k2, size_t k2size) {
  {
    if (k1size < sizeof(double) || k2size < sizeof(double) || k1size != k2size)
      return k1size - k2size;
    double __k1i = *((double *)k1);
    double __k2i = *((double *)k2);
    return __k1i - __k2i;
  };
}


x86 assembly (clang, -O0):
<libhl_cmp_keys_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x8,-0x18(%rbp)
jb     1138 <libhl_cmp_keys_double+0x38>
cmpq   $0x8,-0x28(%rbp)
jb     1138 <libhl_cmp_keys_double+0x38>
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     1148 <libhl_cmp_keys_double+0x48>
mov    -0x18(%rbp),%rax
sub    -0x28(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1173 <libhl_cmp_keys_double+0x73>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<libhl_cmp_keys_double>:
mov    %rsi,%rax
cmp    %rcx,%rsi
jne    1121 <libhl_cmp_keys_double+0x21>
cmp    $0x8,%rax
jb     1121 <libhl_cmp_keys_double+0x21>
cmp    $0x7,%rcx
jbe    1121 <libhl_cmp_keys_double+0x21>
movsd  (%rdi),%xmm0
subsd  (%rdx),%xmm0
cvttsd2si %xmm0,%eax
ret
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @libhl_cmp_keys_double(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
%10 = alloca double
%11 = alloca double
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i64 %3, i64* %9
%12 = load i64, i64* %7
%13 = icmp ult i64 %12, 8
br i1 %13, label %21, label %14
14: ; preds = %4
%15 = load i64, i64* %9
%16 = icmp ult i64 %15, 8
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = load i64, i64* %7
%19 = load i64, i64* %9
%20 = icmp ne i64 %18, %19
br i1 %20, label %21, label %26
21: ; preds = %17, %14, %4
%22 = load i64, i64* %7
%23 = load i64, i64* %9
%24 = sub i64 %22, %23
%25 = trunc i64 %24 to i32
store i32 %25, i32* %5
br label %37
26: ; preds = %17
%27 = load i8*, i8** %6
%28 = bitcast i8* %27 to double*
%29 = load double, double* %28
store double %29, double* %10
%30 = load i8*, i8** %8
%31 = bitcast i8* %30 to double*
%32 = load double, double* %31
store double %32, double* %11
%33 = load double, double* %10
%34 = load double, double* %11
%35 = fsub double %33, %34
%36 = fptosi double %35 to i32
store i32 %36, i32* %5
br label %37
37: ; preds = %26, %21
%38 = load i32, i32* %5
ret i32 %38
}

LLVM IR (-O2):
define i32 @libhl_cmp_keys_double(i8* nocapture %0, i64 %1, i8* nocapture %2, i64 %3) {
%5 = icmp ugt i64 %1, 7
%6 = icmp ugt i64 %3, 7
%7 = and i1 %5, %6
%8 = icmp eq i64 %1, %3
%9 = and i1 %8, %7
br i1 %9, label %13, label %10
10: ; preds = %4
%11 = sub i64 %1, %3
%12 = trunc i64 %11 to i32
br label %20
13: ; preds = %4
%14 = bitcast i8* %0 to double*
%15 = load double, double* %14
%16 = bitcast i8* %2 to double*
%17 = load double, double* %16
%18 = fsub double %15, %17
%19 = fptosi double %18 to i32
br label %20
20: ; preds = %13, %10
%21 = phi i32 [ %12, %10 ], [ %19, %13 ]
ret i32 %21
}