int qd_is_one(const double *a) {
  return ((a[0] == 1.0) && (a[1] == 0.0) && (a[2] == 0.0) && (a[3] == 0.0)) ? 1
                                                                            : 0;
}


x86 assembly (clang, -O0):
<qd_is_one>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
xor    %eax,%eax
movsd  0xee6(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x9(%rbp)
jne    118a <qd_is_one+0x8a>
jp     118a <qd_is_one+0x8a>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x9(%rbp)
jne    118a <qd_is_one+0x8a>
jp     118a <qd_is_one+0x8a>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x9(%rbp)
jne    118a <qd_is_one+0x8a>
jp     118a <qd_is_one+0x8a>
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qd_is_one>:
movsd  (%rdi),%xmm0
xor    %eax,%eax
ucomisd 0xef2(%rip),%xmm0
jne    1142 <qd_is_one+0x42>
jp     1142 <qd_is_one+0x42>
movsd  0x8(%rdi),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1142 <qd_is_one+0x42>
jp     1142 <qd_is_one+0x42>
movsd  0x10(%rdi),%xmm1
ucomisd %xmm0,%xmm1
jne    1142 <qd_is_one+0x42>
jp     1142 <qd_is_one+0x42>
xorpd  %xmm0,%xmm0
cmpeqsd 0x18(%rdi),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
ret

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

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