int point_compare(double *x1, double *y1, double *x2, double *y2) {
  if (*x1 > *x2)
    return 1;
  if (*x1 < *x2)
    return -1;
  if (*y1 > *y2)
    return 1;
  if (*y1 < *y2)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<point_compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1136 <point_compare+0x36>
movl   $0x1,-0x4(%rbp)
jmp    11ab <point_compare+0xab>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    115c <point_compare+0x5c>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ab <point_compare+0xab>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    117e <point_compare+0x7e>
movl   $0x1,-0x4(%rbp)
jmp    11ab <point_compare+0xab>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a4 <point_compare+0xa4>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ab <point_compare+0xab>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<point_compare>:
movsd  (%rdi),%xmm0
movsd  (%rdx),%xmm1
mov    $0x1,%eax
ucomisd %xmm1,%xmm0
ja     113c <point_compare+0x3c>
mov    $0xffffffff,%eax
ucomisd %xmm0,%xmm1
ja     113c <point_compare+0x3c>
movsd  (%rsi),%xmm0
movsd  (%rcx),%xmm1
ucomisd %xmm1,%xmm0
mov    $0x1,%eax
ja     113c <point_compare+0x3c>
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @point_compare(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
%10 = load double*, double** %6
%11 = load double, double* %10
%12 = load double*, double** %8
%13 = load double, double* %12
%14 = fcmp ogt double %11, %13
br i1 %14, label %15, label %16
15: ; preds = %4
store i32 1, i32* %5
br label %38
16: ; preds = %4
%17 = load double*, double** %6
%18 = load double, double* %17
%19 = load double*, double** %8
%20 = load double, double* %19
%21 = fcmp olt double %18, %20
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 -1, i32* %5
br label %38
23: ; preds = %16
%24 = load double*, double** %7
%25 = load double, double* %24
%26 = load double*, double** %9
%27 = load double, double* %26
%28 = fcmp ogt double %25, %27
br i1 %28, label %29, label %30
29: ; preds = %23
store i32 1, i32* %5
br label %38
30: ; preds = %23
%31 = load double*, double** %7
%32 = load double, double* %31
%33 = load double*, double** %9
%34 = load double, double* %33
%35 = fcmp olt double %32, %34
br i1 %35, label %36, label %37
36: ; preds = %30
store i32 -1, i32* %5
br label %38
37: ; preds = %30
store i32 0, i32* %5
br label %38
38: ; preds = %37, %36, %29, %22, %15
%39 = load i32, i32* %5
ret i32 %39
}

LLVM IR (-O2):
define i32 @point_compare(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3) {
%5 = load double, double* %0
%6 = load double, double* %2
%7 = fcmp ogt double %5, %6
br i1 %7, label %17, label %8
8: ; preds = %4
%9 = fcmp olt double %5, %6
br i1 %9, label %17, label %10
10: ; preds = %8
%11 = load double, double* %1
%12 = load double, double* %3
%13 = fcmp ogt double %11, %12
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = fcmp olt double %11, %12
%16 = sext i1 %15 to i32
br label %17
17: ; preds = %14, %10, %8, %4
%18 = phi i32 [ 1, %4 ], [ -1, %8 ], [ 1, %10 ], [ %16, %14 ]
ret i32 %18
}