#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 */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int matocsserv_space_compare(const void *a, const void *b) {
  const struct servsort {
    double space;
    uint16_t csid;
  } *aa = a, *bb = b;
  if (aa->space > bb->space) {
    return 1;
  }
  if (aa->space < bb->space) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<matocsserv_space_compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    113e <matocsserv_space_compare+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    116b <matocsserv_space_compare+0x6b>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1164 <matocsserv_space_compare+0x64>
movl   $0xffffffff,-0x4(%rbp)
jmp    116b <matocsserv_space_compare+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<matocsserv_space_compare>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
neg    %ecx
ucomisd %xmm1,%xmm0
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
%struct.servsort = type { double, i32 }
define i32 @matocsserv_space_compare(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.servsort*
%7 = alloca %struct.servsort*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to %struct.servsort*
store %struct.servsort* %9, %struct.servsort** %6
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to %struct.servsort*
store %struct.servsort* %11, %struct.servsort** %7
%12 = load %struct.servsort*, %struct.servsort** %6
%13 = getelementptr inbounds %struct.servsort, %struct.servsort* %12, i32 0, i32 0
%14 = load double, double* %13
%15 = load %struct.servsort*, %struct.servsort** %7
%16 = getelementptr inbounds %struct.servsort, %struct.servsort* %15, i32 0, i32 0
%17 = load double, double* %16
%18 = fcmp ogt double %14, %17
br i1 %18, label %19, label %20
19: ; preds = %2
store i32 1, i32* %3
br label %30
20: ; preds = %2
%21 = load %struct.servsort*, %struct.servsort** %6
%22 = getelementptr inbounds %struct.servsort, %struct.servsort* %21, i32 0, i32 0
%23 = load double, double* %22
%24 = load %struct.servsort*, %struct.servsort** %7
%25 = getelementptr inbounds %struct.servsort, %struct.servsort* %24, i32 0, i32 0
%26 = load double, double* %25
%27 = fcmp olt double %23, %26
br i1 %27, label %28, label %29
28: ; preds = %20
store i32 -1, i32* %3
br label %30
29: ; preds = %20
store i32 0, i32* %3
br label %30
30: ; preds = %29, %28, %19
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @matocsserv_space_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %4, %6
%8 = fcmp olt double %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}