void test_ccos(_Complex double d) {
  if (ccos(d) != ccos(d))
    link_failure_ccos();
}


x86 assembly (clang, -O0):
<test_ccos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <ccos@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  %xmm1,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  %xmm1,-0x30(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1040 <ccos@plt>
movsd  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movaps %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
ucomisd %xmm3,%xmm2
setne  %al
setp   %cl
or     %cl,%al
ucomisd %xmm0,%xmm1
setne  %cl
setp   %dl
or     %dl,%cl
or     %cl,%al
test   $0x1,%al
jne    11b9 <test_ccos+0x99>
jmp    11c0 <test_ccos+0xa0>
mov    $0x0,%al
call   1030 <link_failure_ccos@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ccos>:
sub    $0x28,%rsp
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1040 <ccos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1040 <ccos@plt>
movsd  0x20(%rsp),%xmm2
ucomisd %xmm0,%xmm2
jne    1173 <test_ccos+0x53>
jp     1173 <test_ccos+0x53>
movsd  0x8(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jne    1173 <test_ccos+0x53>
jp     1173 <test_ccos+0x53>
add    $0x28,%rsp
ret
xor    %eax,%eax
add    $0x28,%rsp
jmp    1030 <link_failure_ccos@plt>

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

LLVM IR (-O2):
define void @test_ccos(double %0, double %1) {
%3 = tail call { double, double } @ccos(double %0, double %1)
%4 = extractvalue { double, double } %3, 0
%5 = extractvalue { double, double } %3, 1
%6 = tail call { double, double } @ccos(double %0, double %1)
%7 = extractvalue { double, double } %6, 0
%8 = extractvalue { double, double } %6, 1
%9 = fcmp une double %4, %7
%10 = fcmp une double %5, %8
%11 = or i1 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = tail call i32 (...) @link_failure_ccos()
br label %14
14: ; preds = %12, %2
ret void
}