#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ quickSortD(long *, int /*<<< orphan*/, int, double *);
char *test_quickSortD() {
  long a[] = {7, 12, 1, -2, 0, 15, 4, 9, 11, 3, -1, 13, 5};
  double v[] = {1, 0.5, 3, -1, 7, 9, 0.1, 2, -3, 0, 1.2, 8, 10};
  int N = 13;
  double vs[] = {-1.0, 1.2, 7.0,  3.0, 0.0, 0.1, 10.0,
                 1.0,  2.0, -3.0, 0.5, 8.0, 9.0};
  quickSortD(a, 0, N - 1, v);
  for (int i = 1; i < N; i++) {
    do {
      if (!(a[i - 1] <= a[i]))
        return "error, quickSortD gives wrong order";
    } while (0);
  }
  for (int i = 0; i < N; i++) {
    do {
      if (!(vs[i] == v[i]))
        return "error, quickSortD gives wrong order for double[] v";
    } while (0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_quickSortD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
lea    -0x70(%rbp),%rdi
lea    0xeca(%rip),%rsi
mov    $0x68,%edx
call   1030 <memcpy@plt>
lea    -0xe0(%rbp),%rdi
lea    0xf22(%rip),%rsi
mov    $0x68,%edx
call   1030 <memcpy@plt>
movl   $0xd,-0xe4(%rbp)
lea    -0x150(%rbp),%rdi
lea    0xf70(%rip),%rsi
mov    $0x68,%edx
call   1030 <memcpy@plt>
lea    -0x70(%rbp),%rdi
mov    -0xe4(%rbp),%edx
sub    $0x1,%edx
lea    -0xe0(%rbp),%rcx
xor    %esi,%esi
call   1040 <quickSortD@plt>
movl   $0x1,-0x154(%rbp)
mov    -0x154(%rbp),%eax
cmp    -0xe4(%rbp),%eax
jge    1206 <test_quickSortD+0xe6>
jmp    11b6 <test_quickSortD+0x96>
mov    -0x154(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x70(%rbp,%rax,8),%rax
movslq -0x154(%rbp),%rcx
cmp    -0x70(%rbp,%rcx,8),%rax
jle    11e8 <test_quickSortD+0xc8>
lea    0xf69(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    128e <test_quickSortD+0x16e>
jmp    11ed <test_quickSortD+0xcd>
jmp    11f2 <test_quickSortD+0xd2>
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x154(%rbp)
jmp    119f <test_quickSortD+0x7f>
movl   $0x0,-0x158(%rbp)
mov    -0x158(%rbp),%eax
cmp    -0xe4(%rbp),%eax
jge    1286 <test_quickSortD+0x166>
jmp    1227 <test_quickSortD+0x107>
movslq -0x158(%rbp),%rax
movsd  -0x150(%rbp,%rax,8),%xmm0
ff ff
movslq -0x158(%rbp),%rax
ucomisd -0xe0(%rbp,%rax,8),%xmm0
ff ff
jne    1258 <test_quickSortD+0x138>
jp     1258 <test_quickSortD+0x138>
jmp    1268 <test_quickSortD+0x148>
lea    0xf0d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    128e <test_quickSortD+0x16e>
jmp    126d <test_quickSortD+0x14d>
jmp    1272 <test_quickSortD+0x152>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
jmp    1210 <test_quickSortD+0xf0>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_quickSortD>:
sub    $0xd8,%rsp
mov    0xfa2(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0xf86(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf6a(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xf4e(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xf32(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xf16(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xefa(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0xfbf(%rip),%rax
mov    %rax,0xd0(%rsp)
movaps 0xfa0(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xf81(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xf62(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xf43(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xf24(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movdqa 0xf04(%rip),%xmm0
movdqa %xmm0,0x70(%rsp)
mov    %rsp,%rdi
lea    0x70(%rsp),%rcx
xor    %esi,%esi
mov    $0xc,%edx
call   1030 <quickSortD@plt>
mov    0x8(%rsp),%rcx
lea    0xf46(%rip),%rax
cmp    %rcx,(%rsp)
jg     137c <test_quickSortD+0x26c>
mov    0x10(%rsp),%rdx
cmp    %rdx,%rcx
jg     137c <test_quickSortD+0x26c>
mov    0x18(%rsp),%rcx
cmp    %rcx,%rdx
jg     137c <test_quickSortD+0x26c>
mov    0x20(%rsp),%rdx
cmp    %rdx,%rcx
jg     137c <test_quickSortD+0x26c>
mov    0x28(%rsp),%rcx
cmp    %rcx,%rdx
jg     137c <test_quickSortD+0x26c>
mov    0x30(%rsp),%rdx
cmp    %rdx,%rcx
jg     137c <test_quickSortD+0x26c>
mov    0x38(%rsp),%rcx
cmp    %rcx,%rdx
jg     137c <test_quickSortD+0x26c>
mov    0x40(%rsp),%rdx
cmp    %rdx,%rcx
jg     137c <test_quickSortD+0x26c>
mov    0x48(%rsp),%rcx
cmp    %rcx,%rdx
jg     137c <test_quickSortD+0x26c>
mov    0x50(%rsp),%rdx
cmp    %rdx,%rcx
jg     137c <test_quickSortD+0x26c>
mov    0x58(%rsp),%rcx
cmp    %rcx,%rdx
jg     137c <test_quickSortD+0x26c>
cmp    0x60(%rsp),%rcx
jg     137c <test_quickSortD+0x26c>
movapd 0x70(%rsp),%xmm0
movapd 0x80(%rsp),%xmm1
xorpd  %xmm2,%xmm2
movhpd 0xd52(%rip),%xmm2
cmpneqpd 0x90(%rsp),%xmm2
movapd 0xa0(%rsp),%xmm3
cmpneqpd 0xd66(%rip),%xmm3
packssdw %xmm3,%xmm2
cmpneqpd 0xd69(%rip),%xmm1
cmpneqpd 0xd70(%rip),%xmm0
packssdw %xmm1,%xmm0
packssdw %xmm2,%xmm0
movsd  0xd0(%rsp),%xmm1
xor    %eax,%eax
ucomisd 0xd0d(%rip),%xmm1
lea    0xe5a(%rip),%rcx
cmovne %rcx,%rax
cmovp  %rcx,%rax
movsd  0xc8(%rsp),%xmm1
ucomisd 0xcf5(%rip),%xmm1
cmovne %rcx,%rax
cmovp  %rcx,%rax
movsd  0xc0(%rsp),%xmm1
ucomisd 0xce4(%rip),%xmm1
cmovne %rcx,%rax
cmovp  %rcx,%rax
movsd  0xb8(%rsp),%xmm1
ucomisd 0xcd3(%rip),%xmm1
cmovne %rcx,%rax
cmovp  %rcx,%rax
movsd  0xb0(%rsp),%xmm1
ucomisd 0xcc2(%rip),%xmm1
cmovne %rcx,%rax
cmovp  %rcx,%rax
pmovmskb %xmm0,%edx
test   $0xaaaa,%edx
cmovne %rcx,%rax
add    $0xd8,%rsp
ret

LLVM IR (-O0):
@__const.test_quickSortD.a = [13 x i64] [i64 7, i64 12, i64 1, i64 -2, i64 0, i64 15, i64 4, i64 9, i64 11, i64 3, i64 -1, i64 13, i64 5]
@__const.test_quickSortD.v = [13 x double] [double 1.000000e+00, double 5.000000e-01, double 3.000000e+00, double -1.000000e+00, double 7.000000e+00, double 9.000000e+00, double 1.000000e-01, double 2.000000e+00, double -3.000000e+00, double 0.000000e+00, double 1.200000e+00, double 8.000000e+00, double 1.000000e+01]
@__const.test_quickSortD.vs = [13 x double] [double -1.000000e+00, double 1.200000e+00, double 7.000000e+00, double 3.000000e+00, double 0.000000e+00, double 1.000000e-01, double 1.000000e+01, double 1.000000e+00, double 2.000000e+00, double -3.000000e+00, double 5.000000e-01, double 8.000000e+00, double 9.000000e+00]
@.str = [36 x i8] c"error, quickSortD gives wrong order\00"
@.str.1 = [51 x i8] c"error, quickSortD gives wrong order for double[] v\00"
define i8* @test_quickSortD() {
%1 = alloca i8*
%2 = alloca [13 x i64]
%3 = alloca [13 x double]
%4 = alloca i32
%5 = alloca [13 x double]
%6 = alloca i32
%7 = alloca i32
%8 = bitcast [13 x i64]* %2 to i8*
%9 = bitcast [13 x double]* %3 to i8*
store i32 13, i32* %4
%10 = bitcast [13 x double]* %5 to i8*
%11 = getelementptr inbounds [13 x i64], [13 x i64]* %2, i64 0, i64 0
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 1
%14 = getelementptr inbounds [13 x double], [13 x double]* %3, i64 0, i64 0
%15 = call i32 @quickSortD(i64* %11, i32 0, i32 %13, double* %14)
store i32 1, i32* %6
br label %16
16: ; preds = %35, %0
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %38
20: ; preds = %16
br label %21
21: ; preds = %20
%22 = load i32, i32* %6
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [13 x i64], [13 x i64]* %2, i64 0, i64 %24
%26 = load i64, i64* %25
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [13 x i64], [13 x i64]* %2, i64 0, i64 %28
%30 = load i64, i64* %29
%31 = icmp sle i64 %26, %30
br i1 %31, label %33, label %32
32: ; preds = %21
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8** %1
br label %61
33: ; preds = %21
br label %34
34: ; preds = %33
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %16
38: ; preds = %16
store i32 0, i32* %7
br label %39
39: ; preds = %57, %38
%40 = load i32, i32* %7
%41 = load i32, i32* %4
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %60
43: ; preds = %39
br label %44
44: ; preds = %43
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [13 x double], [13 x double]* %5, i64 0, i64 %46
%48 = load double, double* %47
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [13 x double], [13 x double]* %3, i64 0, i64 %50
%52 = load double, double* %51
%53 = fcmp oeq double %48, %52
br i1 %53, label %55, label %54
54: ; preds = %44
store i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %61
55: ; preds = %44
br label %56
56: ; preds = %55
br label %57
57: ; preds = %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %39
60: ; preds = %39
store i8* null, i8** %1
br label %61
61: ; preds = %60, %54, %32
%62 = load i8*, i8** %1
ret i8* %62
}

LLVM IR (-O2):
@__const.test_quickSortD.a = [13 x i64] [i64 7, i64 12, i64 1, i64 -2, i64 0, i64 15, i64 4, i64 9, i64 11, i64 3, i64 -1, i64 13, i64 5]
@__const.test_quickSortD.v = [13 x double] [double 1.000000e+00, double 5.000000e-01, double 3.000000e+00, double -1.000000e+00, double 7.000000e+00, double 9.000000e+00, double 1.000000e-01, double 2.000000e+00, double -3.000000e+00, double 0.000000e+00, double 1.200000e+00, double 8.000000e+00, double 1.000000e+01]
@.str = [36 x i8] c"error, quickSortD gives wrong order\00"
@.str.1 = [51 x i8] c"error, quickSortD gives wrong order for double[] v\00"
define i8* @test_quickSortD() {
%1 = alloca [13 x i64]
%2 = alloca [13 x double]
%3 = bitcast [13 x i64]* %1 to i8*
%4 = bitcast [13 x double]* %2 to i8*
%5 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 0
%6 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 0
%7 = call i32 @quickSortD(i64* %5, i32 0, i32 12, double* %6)
%8 = load i64, i64* %5
%9 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 1
%10 = load i64, i64* %9
%11 = icmp sgt i64 %8, %10
br i1 %11, label %84, label %12
12: ; preds = %0
%13 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 2
%14 = load i64, i64* %13
%15 = icmp sgt i64 %10, %14
br i1 %15, label %84, label %16
16: ; preds = %12
%17 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 3
%18 = load i64, i64* %17
%19 = icmp sgt i64 %14, %18
br i1 %19, label %84, label %20
20: ; preds = %16
%21 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 4
%22 = load i64, i64* %21
%23 = icmp sgt i64 %18, %22
br i1 %23, label %84, label %24
24: ; preds = %20
%25 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 5
%26 = load i64, i64* %25
%27 = icmp sgt i64 %22, %26
br i1 %27, label %84, label %28
28: ; preds = %24
%29 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 6
%30 = load i64, i64* %29
%31 = icmp sgt i64 %26, %30
br i1 %31, label %84, label %32
32: ; preds = %28
%33 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 7
%34 = load i64, i64* %33
%35 = icmp sgt i64 %30, %34
br i1 %35, label %84, label %36
36: ; preds = %32
%37 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 8
%38 = load i64, i64* %37
%39 = icmp sgt i64 %34, %38
br i1 %39, label %84, label %40
40: ; preds = %36
%41 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 9
%42 = load i64, i64* %41
%43 = icmp sgt i64 %38, %42
br i1 %43, label %84, label %44
44: ; preds = %40
%45 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 10
%46 = load i64, i64* %45
%47 = icmp sgt i64 %42, %46
br i1 %47, label %84, label %48
48: ; preds = %44
%49 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 11
%50 = load i64, i64* %49
%51 = icmp sgt i64 %46, %50
%52 = getelementptr inbounds [13 x i64], [13 x i64]* %1, i64 0, i64 12
%53 = load i64, i64* %52
%54 = icmp sgt i64 %50, %53
%55 = select i1 %51, i1 true, i1 %54
br i1 %55, label %84, label %56
56: ; preds = %48
%57 = bitcast [13 x double]* %2 to <8 x double>*
%58 = load <8 x double>, <8 x double>* %57
%59 = freeze <8 x double> %58
%60 = fcmp une <8 x double> %59, <double -1.000000e+00, double 1.200000e+00, double 7.000000e+00, double 3.000000e+00, double 0.000000e+00, double 1.000000e-01, double 1.000000e+01, double 1.000000e+00>
%61 = bitcast <8 x i1> %60 to i8
%62 = icmp eq i8 %61, 0
%63 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 8
%64 = load double, double* %63
%65 = fcmp oeq double %64, 2.000000e+00
%66 = select i1 %62, i1 %65, i1 false
%67 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 9
%68 = load double, double* %67
%69 = fcmp oeq double %68, -3.000000e+00
%70 = select i1 %66, i1 %69, i1 false
%71 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 10
%72 = load double, double* %71
%73 = fcmp oeq double %72, 5.000000e-01
%74 = select i1 %70, i1 %73, i1 false
%75 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 11
%76 = load double, double* %75
%77 = fcmp oeq double %76, 8.000000e+00
%78 = select i1 %74, i1 %77, i1 false
%79 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 12
%80 = load double, double* %79
%81 = fcmp oeq double %80, 9.000000e+00
%82 = select i1 %78, i1 %81, i1 false
%83 = select i1 %82, i8* null, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0)
br label %84
84: ; preds = %56, %0, %12, %16, %20, %24, %28, %32, %36, %40, %44, %48
%85 = phi i8* [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %48 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %44 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %40 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %36 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %32 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %28 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %24 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %20 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %16 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %12 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %0 ], [ %83, %56 ]
ret i8* %85
}