int qd_gt(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_gt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rcx
mov    $0x1,%al
ucomisd (%rcx),%xmm0
mov    %al,-0x11(%rbp)
ja     11dc <qd_gt+0xdc>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jne    1160 <qd_gt+0x60>
jp     1160 <qd_gt+0x60>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rcx
mov    $0x1,%al
ucomisd 0x8(%rcx),%xmm0
mov    %al,-0x11(%rbp)
ja     11dc <qd_gt+0xdc>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jne    119b <qd_gt+0x9b>
jp     119b <qd_gt+0x9b>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rcx
mov    $0x1,%al
ucomisd 0x10(%rcx),%xmm0
mov    %al,-0x11(%rbp)
ja     11dc <qd_gt+0xdc>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
ucomisd 0x10(%rcx),%xmm0
mov    %al,-0x12(%rbp)
jne    11d6 <qd_gt+0xd6>
jp     11d6 <qd_gt+0xd6>
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd 0x18(%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_gt>:
movsd  (%rdi),%xmm0
mov    $0x1,%eax
ucomisd (%rsi),%xmm0
ja     1123 <qd_gt+0x23>
movsd  0x8(%rdi),%xmm0
movsd  0x8(%rsi),%xmm1
jne    1124 <qd_gt+0x24>
jp     1124 <qd_gt+0x24>
ucomisd %xmm1,%xmm0
jbe    1124 <qd_gt+0x24>
ret
ucomisd %xmm1,%xmm0
movsd  0x10(%rdi),%xmm0
movsd  0x10(%rsi),%xmm1
jne    113c <qd_gt+0x3c>
jp     113c <qd_gt+0x3c>
ucomisd %xmm1,%xmm0
ja     1123 <qd_gt+0x23>
ucomisd %xmm1,%xmm0
jne    1154 <qd_gt+0x54>
jp     1154 <qd_gt+0x54>
movsd  0x18(%rdi),%xmm0
xor    %eax,%eax
ucomisd 0x18(%rsi),%xmm0
seta   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @qd_gt(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 ogt 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 ogt 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 ogt 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 ogt 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_gt(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fcmp ogt 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 ogt 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 ogt 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 ogt 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
}