double Fcp(int n, const double *xt, const double *yt) {
  int *xo, *yo, a;
  double *x, *y, d;
  if (n < 2)
    return -1;
  x = (double *)malloc((n + 1) * sizeof(double));
  y = (double *)malloc((n + 1) * sizeof(double));
  x[0] = n;
  xo = Mergesort(n, xt);
  for (a = 1; a <= n; a++) {
    x[a] = xt[xo[a]];
    y[a] = yt[xo[a]];
  }
  free(xo);
  yo = Mergesort(n, y);
  d = Fcpd(1, n, x, y, yo);
  free(x);
  free(y);
  free(yo);
  return d;
}


x86 assembly (clang, -O0):
<Fcp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    116f <Fcp+0x2f>
movsd  0xe9b(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1287 <Fcp+0x147>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x48(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <Mergesort@plt>
cltq
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1221 <Fcp+0xe1>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x34(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x34(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c3 <Fcp+0x83>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x0,%al
call   1040 <Mergesort@plt>
cltq
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    $0x1,%edi
mov    $0x0,%al
call   1050 <Fcpd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fcp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jge    115d <Fcp+0x1d>
movsd  0xea8(%rip),%xmm0
jmp    1282 <Fcp+0x142>
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %edi,%r14d
mov    %edi,%r13d
lea    0x8(,%r13,8),%r12
mov    %r12,%rdi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1060 <malloc@plt>
mov    %rax,%r12
cvtsi2sd %r14d,%xmm0
movsd  %xmm0,(%r15)
mov    %r14d,%edi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <Mergesort@plt>
movslq %eax,%rdi
mov    $0x1,%eax
cmp    $0x1,%r14d
je     120b <Fcp+0xcb>
mov    %r13d,%ecx
and    $0xfffffffe,%ecx
neg    %rcx
mov    $0x1,%eax
nopw   0x0(%rax,%rax,1)
movslq (%rdi,%rax,4),%rdx
movsd  0x0(%rbp,%rdx,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  (%rbx,%rdx,8),%xmm0
movsd  %xmm0,(%r12,%rax,8)
movslq 0x4(%rdi,%rax,4),%rdx
movsd  0x0(%rbp,%rdx,8),%xmm0
movsd  %xmm0,0x8(%r15,%rax,8)
movsd  (%rbx,%rdx,8),%xmm0
movsd  %xmm0,0x8(%r12,%rax,8)
lea    (%rcx,%rax,1),%rdx
add    $0x2,%rdx
add    $0x2,%rax
cmp    $0x1,%rdx
jne    11c0 <Fcp+0x80>
test   $0x1,%r13b
je     122c <Fcp+0xec>
movslq (%rdi,%rax,4),%rcx
movsd  0x0(%rbp,%rcx,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%r12,%rax,8)
call   1030 <free@plt>
mov    %r14d,%edi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <Mergesort@plt>
movslq %eax,%rbx
mov    $0x1,%edi
mov    %r14d,%esi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <Fcpd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @Fcp(i32 %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %17
16: ; preds = %3
store double -1.000000e+00, double* %4
br label %94
17: ; preds = %3
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 8
%22 = call i8* @malloc(i64 %21)
%23 = bitcast i8* %22 to double*
store double* %23, double** %11
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = mul i64 %26, 8
%28 = call i8* @malloc(i64 %27)
%29 = bitcast i8* %28 to double*
store double* %29, double** %12
%30 = load i32, i32* %5
%31 = sitofp i32 %30 to double
%32 = load double*, double** %11
%33 = getelementptr inbounds double, double* %32, i64 0
store double %31, double* %33
%34 = load i32, i32* %5
%35 = load double*, double** %6
%36 = call i32 (i32, double*, ...) bitcast (i32 (...)* @Mergesort to i32 (i32, double*, ...)*)(i32 %34, double* %35)
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i32*
store i32* %38, i32** %8
store i32 1, i32* %10
br label %39
39: ; preds = %70, %17
%40 = load i32, i32* %10
%41 = load i32, i32* %5
%42 = icmp sle i32 %40, %41
br i1 %42, label %43, label %73
43: ; preds = %39
%44 = load double*, double** %6
%45 = load i32*, i32** %8
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
%49 = load i32, i32* %48
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %44, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %11
%54 = load i32, i32* %10
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
store double %52, double* %56
%57 = load double*, double** %7
%58 = load i32*, i32** %8
%59 = load i32, i32* %10
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %58, i64 %60
%62 = load i32, i32* %61
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %57, i64 %63
%65 = load double, double* %64
%66 = load double*, double** %12
%67 = load i32, i32* %10
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
store double %65, double* %69
br label %70
70: ; preds = %43
%71 = load i32, i32* %10
%72 = add nsw i32 %71, 1
store i32 %72, i32* %10
br label %39
73: ; preds = %39
%74 = load i32*, i32** %8
%75 = bitcast i32* %74 to i8*
%76 = load i32, i32* %5
%77 = load double*, double** %12
%78 = call i32 (i32, double*, ...) bitcast (i32 (...)* @Mergesort to i32 (i32, double*, ...)*)(i32 %76, double* %77)
%79 = sext i32 %78 to i64
%80 = inttoptr i64 %79 to i32*
store i32* %80, i32** %9
%81 = load i32, i32* %5
%82 = load double*, double** %11
%83 = load double*, double** %12
%84 = load i32*, i32** %9
%85 = call i32 (i32, i32, double*, double*, i32*, ...) bitcast (i32 (...)* @Fcpd to i32 (i32, i32, double*, double*, i32*, ...)*)(i32 1, i32 %81, double* %82, double* %83, i32* %84)
%86 = sitofp i32 %85 to double
store double %86, double* %13
%87 = load double*, double** %11
%88 = bitcast double* %87 to i8*
%89 = load double*, double** %12
%90 = bitcast double* %89 to i8*
%91 = load i32*, i32** %9
%92 = bitcast i32* %91 to i8*
%93 = load double, double* %13
store double %93, double* %4
br label %94
94: ; preds = %73, %16
%95 = load double, double* %4
ret double %95
}

LLVM IR (-O2):
define double @Fcp(i32 %0, double* %1, double* nocapture %2) {
%4 = icmp slt i32 %0, 2
br i1 %4, label %68, label %5
5: ; preds = %3
%6 = add nuw i32 %0, 1
%7 = zext i32 %6 to i64
%8 = shl nuw nsw i64 %7, 3
%9 = tail call i8* @malloc(i64 %8)
%10 = bitcast i8* %9 to double*
%11 = tail call i8* @malloc(i64 %8)
%12 = bitcast i8* %11 to double*
%13 = sitofp i32 %0 to double
store double %13, double* %10
%14 = tail call i32 (i32, double*, ...) bitcast (i32 (...)* @Mergesort to i32 (i32, double*, ...)*)(i32 %0, double* %1)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = add nsw i64 %7, -1
%18 = and i64 %17, 1
%19 = icmp eq i32 %6, 2
br i1 %19, label %47, label %20
20: ; preds = %5
%21 = and i64 %17, -2
br label %22
22: ; preds = %22, %20
%23 = phi i64 [ 1, %20 ], [ %44, %22 ]
%24 = phi i64 [ 0, %20 ], [ %45, %22 ]
%25 = getelementptr inbounds i32, i32* %16, i64 %23
%26 = load i32, i32* %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %1, i64 %27
%29 = load double, double* %28
%30 = getelementptr inbounds double, double* %10, i64 %23
store double %29, double* %30
%31 = getelementptr inbounds double, double* %2, i64 %27
%32 = load double, double* %31
%33 = getelementptr inbounds double, double* %12, i64 %23
store double %32, double* %33
%34 = add nuw nsw i64 %23, 1
%35 = getelementptr inbounds i32, i32* %16, i64 %34
%36 = load i32, i32* %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %1, i64 %37
%39 = load double, double* %38
%40 = getelementptr inbounds double, double* %10, i64 %34
store double %39, double* %40
%41 = getelementptr inbounds double, double* %2, i64 %37
%42 = load double, double* %41
%43 = getelementptr inbounds double, double* %12, i64 %34
store double %42, double* %43
%44 = add nuw nsw i64 %23, 2
%45 = add i64 %24, 2
%46 = icmp eq i64 %45, %21
br i1 %46, label %47, label %22
47: ; preds = %22, %5
%48 = phi i64 [ 1, %5 ], [ %44, %22 ]
%49 = icmp eq i64 %18, 0
br i1 %49, label %60, label %50
50: ; preds = %47
%51 = getelementptr inbounds i32, i32* %16, i64 %48
%52 = load i32, i32* %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %1, i64 %53
%55 = load double, double* %54
%56 = getelementptr inbounds double, double* %10, i64 %48
store double %55, double* %56
%57 = getelementptr inbounds double, double* %2, i64 %53
%58 = load double, double* %57
%59 = getelementptr inbounds double, double* %12, i64 %48
store double %58, double* %59
br label %60
60: ; preds = %47, %50
%61 = inttoptr i64 %15 to i8*
tail call void @free(i8* %61)
%62 = tail call i32 (i32, double*, ...) bitcast (i32 (...)* @Mergesort to i32 (i32, double*, ...)*)(i32 %0, double* %12)
%63 = sext i32 %62 to i64
%64 = inttoptr i64 %63 to i32*
%65 = tail call i32 (i32, i32, double*, double*, i32*, ...) bitcast (i32 (...)* @Fcpd to i32 (i32, i32, double*, double*, i32*, ...)*)(i32 1, i32 %0, double* %10, double* %12, i32* %64)
%66 = sitofp i32 %65 to double
tail call void @free(i8* %9)
tail call void @free(i8* %11)
%67 = inttoptr i64 %63 to i8*
tail call void @free(i8* %67)
br label %68
68: ; preds = %3, %60
%69 = phi double [ %66, %60 ], [ -1.000000e+00, %3 ]
ret double %69
}