int qd_lt_qd_dd(const double *a, const double *b) {
  return (a[0] < b[0] || (a[0] == b[0] && a[1] < b[1]) ||
          (a[1] == b[1] && a[2] < 0.0))
             ? 1
             : 0;
}


x86 assembly (clang, -O0):
<qd_lt_qd_dd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0x11(%rbp)
ja     11a3 <qd_lt_qd_dd+0xa3>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jne    1168 <qd_lt_qd_dd+0x68>
jp     1168 <qd_lt_qd_dd+0x68>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0x11(%rbp)
ja     11a3 <qd_lt_qd_dd+0xa3>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
ucomisd 0x8(%rcx),%xmm0
mov    %al,-0x12(%rbp)
jne    119d <qd_lt_qd_dd+0x9d>
jp     119d <qd_lt_qd_dd+0x9d>
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd 0x10(%rax),%xmm0
seta   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qd_lt_qd_dd>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
mov    $0x1,%eax
ucomisd %xmm0,%xmm1
ja     112b <qd_lt_qd_dd+0x2b>
ucomisd %xmm1,%xmm0
movsd  0x8(%rdi),%xmm0
movsd  0x8(%rsi),%xmm1
jne    112c <qd_lt_qd_dd+0x2c>
jp     112c <qd_lt_qd_dd+0x2c>
ucomisd %xmm0,%xmm1
jbe    112c <qd_lt_qd_dd+0x2c>
ret
ucomisd %xmm1,%xmm0
jne    1143 <qd_lt_qd_dd+0x43>
jp     1143 <qd_lt_qd_dd+0x43>
xorpd  %xmm0,%xmm0
xor    %eax,%eax
ucomisd 0x10(%rdi),%xmm0
seta   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @qd_lt_qd_dd(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = fcmp olt double %7, %10
br i1 %11, label %43, label %12
12: ; preds = %2
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = load double*, double** %4
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = fcmp oeq double %15, %18
br i1 %19, label %20, label %28
20: ; preds = %12
%21 = load double*, double** %3
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = load double*, double** %4
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = fcmp olt double %23, %26
br i1 %27, label %43, label %28
28: ; preds = %20, %12
%29 = load double*, double** %3
%30 = getelementptr inbounds double, double* %29, i64 1
%31 = load double, double* %30
%32 = load double*, double** %4
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = load double, double* %33
%35 = fcmp oeq double %31, %34
br i1 %35, label %36, label %41
36: ; preds = %28
%37 = load double*, double** %3
%38 = getelementptr inbounds double, double* %37, i64 2
%39 = load double, double* %38
%40 = fcmp olt double %39, 0.000000e+00
br label %41
41: ; preds = %36, %28
%42 = phi i1 [ false, %28 ], [ %40, %36 ]
br label %43
43: ; preds = %41, %20, %2
%44 = phi i1 [ true, %20 ], [ true, %2 ], [ %42, %41 ]
%45 = zext i1 %44 to i64
%46 = select i1 %44, i32 1, i32 0
ret i32 %46
}

LLVM IR (-O2):
define i32 @qd_lt_qd_dd(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fcmp olt double %3, %4
br i1 %5, label %21, label %6
6: ; preds = %2
%7 = fcmp oeq double %3, %4
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %1, i64 1
%11 = load double, double* %10
%12 = fcmp olt double %9, %11
%13 = select i1 %7, i1 %12, i1 false
br i1 %13, label %21, label %14
14: ; preds = %6
%15 = fcmp oeq double %9, %11
br i1 %15, label %16, label %21
16: ; preds = %14
%17 = getelementptr inbounds double, double* %0, i64 2
%18 = load double, double* %17
%19 = fcmp olt double %18, 0.000000e+00
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %6, %14, %16, %2
%22 = phi i32 [ 1, %2 ], [ 0, %14 ], [ %20, %16 ], [ 1, %6 ]
ret i32 %22
}