int qd_lt(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] < b[2]) || (a[2] == b[2] && a[3] < b[3]))
             ? 1
             : 0;
}


x86 assembly (clang, -O0):
<qd_lt>:
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     11ec <qd_lt+0xec>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jne    1168 <qd_lt+0x68>
jp     1168 <qd_lt+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     11ec <qd_lt+0xec>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jne    11a7 <qd_lt+0xa7>
jp     11a7 <qd_lt+0xa7>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0x11(%rbp)
ja     11ec <qd_lt+0xec>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
ucomisd 0x10(%rcx),%xmm0
mov    %al,-0x12(%rbp)
jne    11e6 <qd_lt+0xe6>
jp     11e6 <qd_lt+0xe6>
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
ucomisd %xmm1,%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>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
mov    $0x1,%eax
ucomisd %xmm0,%xmm1
ja     112b <qd_lt+0x2b>
ucomisd %xmm1,%xmm0
movsd  0x8(%rdi),%xmm0
movsd  0x8(%rsi),%xmm1
jne    112c <qd_lt+0x2c>
jp     112c <qd_lt+0x2c>
ucomisd %xmm0,%xmm1
jbe    112c <qd_lt+0x2c>
ret
ucomisd %xmm1,%xmm0
movsd  0x10(%rdi),%xmm0
movsd  0x10(%rsi),%xmm1
jne    1144 <qd_lt+0x44>
jp     1144 <qd_lt+0x44>
ucomisd %xmm0,%xmm1
ja     112b <qd_lt+0x2b>
ucomisd %xmm1,%xmm0
jne    115c <qd_lt+0x5c>
jp     115c <qd_lt+0x5c>
movsd  0x18(%rsi),%xmm0
xor    %eax,%eax
ucomisd 0x18(%rdi),%xmm0
seta   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @qd_lt(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 %62, 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 %62, 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 %44
36: ; preds = %28
%37 = load double*, double** %3
%38 = getelementptr inbounds double, double* %37, i64 2
%39 = load double, double* %38
%40 = load double*, double** %4
%41 = getelementptr inbounds double, double* %40, i64 2
%42 = load double, double* %41
%43 = fcmp olt double %39, %42
br i1 %43, label %62, label %44
44: ; preds = %36, %28
%45 = load double*, double** %3
%46 = getelementptr inbounds double, double* %45, i64 2
%47 = load double, double* %46
%48 = load double*, double** %4
%49 = getelementptr inbounds double, double* %48, i64 2
%50 = load double, double* %49
%51 = fcmp oeq double %47, %50
br i1 %51, label %52, label %60
52: ; preds = %44
%53 = load double*, double** %3
%54 = getelementptr inbounds double, double* %53, i64 3
%55 = load double, double* %54
%56 = load double*, double** %4
%57 = getelementptr inbounds double, double* %56, i64 3
%58 = load double, double* %57
%59 = fcmp olt double %55, %58
br label %60
60: ; preds = %52, %44
%61 = phi i1 [ false, %44 ], [ %59, %52 ]
br label %62
62: ; preds = %60, %36, %20, %2
%63 = phi i1 [ true, %36 ], [ true, %20 ], [ true, %2 ], [ %61, %60 ]
%64 = zext i1 %63 to i64
%65 = select i1 %63, i32 1, i32 0
ret i32 %65
}

LLVM IR (-O2):
define i32 @qd_lt(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 %31, 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 %31, label %14
14: ; preds = %6
%15 = fcmp oeq double %9, %11
%16 = getelementptr inbounds double, double* %0, i64 2
%17 = load double, double* %16
%18 = getelementptr inbounds double, double* %1, i64 2
%19 = load double, double* %18
%20 = fcmp olt double %17, %19
%21 = select i1 %15, i1 %20, i1 false
br i1 %21, label %31, label %22
22: ; preds = %14
%23 = fcmp oeq double %17, %19
br i1 %23, label %24, label %31
24: ; preds = %22
%25 = getelementptr inbounds double, double* %0, i64 3
%26 = load double, double* %25
%27 = getelementptr inbounds double, double* %1, i64 3
%28 = load double, double* %27
%29 = fcmp olt double %26, %28
%30 = zext i1 %29 to i32
br label %31
31: ; preds = %14, %6, %22, %24, %2
%32 = phi i32 [ 1, %2 ], [ 0, %22 ], [ %30, %24 ], [ 1, %6 ], [ 1, %14 ]
ret i32 %32
}