void mysort3(int N, double *data1, double *data2, double *data3) {
  int i, j;
  double v, t1, t2, t3;
  if (N <= 1)
    return;
  v = data1[0];
  i = 0;
  j = N;
  for (;;) {
    while (++i < N ? data1[i] < v : 0) {
    }
    while (data1[--j] > v) {
    }
    if (i >= j)
      break;
    t1 = data1[i];
    data1[i] = data1[j];
    data1[j] = t1;
    t2 = data2[i];
    data2[i] = data2[j];
    data2[j] = t2;
    t3 = data3[i];
    data3[i] = data3[j];
    data3[j] = t3;
  }
  t1 = data1[i - 1];
  data1[i - 1] = data1[0];
  data1[0] = t1;
  t2 = data2[i - 1];
  data2[i - 1] = data2[0];
  data2[0] = t2;
  t3 = data3[i - 1];
  data3[i - 1] = data3[0];
  data3[0] = t3;
  mysort3(i - 1, data1, data2, data3);
  mysort3(N - i, data1 + i, data2 + i, data3 + i);
}


x86 assembly (clang, -O0):
<mysort3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x1,-0x4(%rbp)
jg     1136 <mysort3+0x26>
jmp    13ab <mysort3+0x29b>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1155 <mysort3+0x45>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmp    -0x4(%rbp),%eax
jge    118d <mysort3+0x7d>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4c(%rbp)
jmp    1197 <mysort3+0x87>
xor    %eax,%eax
mov    %eax,-0x4c(%rbp)
jmp    1197 <mysort3+0x87>
mov    -0x4c(%rbp),%eax
cmp    $0x0,%eax
je     11a8 <mysort3+0x98>
jmp    1155 <mysort3+0x45>
jmp    11ad <mysort3+0x9d>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x28(%rbp)
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    11d2 <mysort3+0xc2>
jmp    11ad <mysort3+0x9d>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jl     11e3 <mysort3+0xd3>
jmp    12a2 <mysort3+0x192>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1150 <mysort3+0x40>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x24(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <mysort3@plt>
mov    -0x4(%rbp),%edi
sub    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rcx
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
call   1030 <mysort3@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mysort3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jge    1132 <mysort3+0x22>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r13
movabs $0xffffffff00000000,%r15
ff ff ff
jmp    11ed <mysort3+0xdd>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r11,0x10(%rsp)
lea    (%r11,%r12,1),%edi
mov    %r14,%rax
neg    %rax
sar    $0x1d,%rax
movsd  0x0(%r13,%rax,1),%xmm0
movsd  0x0(%r13),%xmm1
movsd  %xmm1,0x0(%r13,%rax,1)
movsd  %xmm0,0x0(%r13)
movsd  (%rdx,%rax,1),%xmm0
movsd  (%rdx),%xmm1
movsd  %xmm1,(%rdx,%rax,1)
movsd  %xmm0,(%rdx)
movsd  (%rcx,%rax,1),%xmm0
movsd  (%rcx),%xmm1
movsd  %xmm1,(%rcx,%rax,1)
movsd  %xmm0,(%rcx)
mov    %r13,%rsi
mov    %rcx,%rbp
mov    %rdx,%rbx
call   1030 <mysort3@plt>
movabs $0x100000000,%r11
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    0xc(%rsp),%eax
sub    0x10(%rsp),%eax
not    %r12d
add    %eax,%r12d
mov    %r11,%rax
sub    %r14,%rax
sar    $0x1d,%rax
add    %rax,%r13
add    %rax,%rdx
add    %rax,%rcx
mov    %r12d,%edi
cmp    $0x1,%r12d
jle    1123 <mysort3+0x13>
movsd  0x0(%r13),%xmm0
mov    %edi,%r10d
lea    0x8(%r13),%r8
mov    %edi,0xc(%rsp)
mov    %edi,%ebx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rsi,%r11
movslq %esi,%r9
mov    %r9,%rsi
imul   %r15,%rsi
lea    0x1(%r9),%rdi
lea    (%r8,%r9,8),%rax
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rsi,%r14
mov    %rbp,%r12
lea    (%rdi,%rbp,1),%rsi
cmp    %r10,%rsi
jge    1250 <mysort3+0x140>
lea    (%r14,%r15,1),%rsi
lea    0x1(%r12),%rbp
ucomisd (%rax,%r12,8),%xmm0
ja     1230 <mysort3+0x120>
movslq %ebx,%rbx
lea    (%r9,%r12,1),%rsi
add    $0x1,%rsi
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%r13,%rbx,8),%xmm1
add    $0xffffffffffffffff,%rbx
ucomisd %xmm0,%xmm1
ja     1260 <mysort3+0x150>
lea    (%r11,%r12,1),%eax
add    $0x1,%eax
cmp    %ebx,%eax
jge    1150 <mysort3+0x40>
movabs $0x100000000,%rax
sub    %r14,%rax
sar    $0x1d,%rax
movsd  0x0(%r13,%rax,1),%xmm2
movsd  %xmm1,0x0(%r13,%rax,1)
movsd  %xmm2,0x0(%r13,%rbx,8)
movsd  (%rdx,%rax,1),%xmm1
movsd  (%rdx,%rbx,8),%xmm2
movsd  %xmm2,(%rdx,%rax,1)
movsd  %xmm1,(%rdx,%rbx,8)
movsd  (%rcx,%rax,1),%xmm1
movsd  (%rcx,%rbx,8),%xmm2
movsd  %xmm2,(%rcx,%rax,1)
movsd  %xmm1,(%rcx,%rbx,8)
jmp    1210 <mysort3+0x100>

LLVM IR (-O0):
define void @mysort3(i32 %0, double* %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%15 = load i32, i32* %5
%16 = icmp sle i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %4
br label %189
18: ; preds = %4
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
store double %21, double* %11
store i32 0, i32* %9
%22 = load i32, i32* %5
store i32 %22, i32* %10
br label %23
23: ; preds = %59, %18
br label %24
24: ; preds = %42, %23
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 1
store i32 %26, i32* %9
%27 = load i32, i32* %5
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %38
29: ; preds = %24
%30 = load double*, double** %6
%31 = load i32, i32* %9
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = load double, double* %33
%35 = load double, double* %11
%36 = fcmp olt double %34, %35
%37 = zext i1 %36 to i32
br label %39
38: ; preds = %24
br label %39
39: ; preds = %38, %29
%40 = phi i32 [ %37, %29 ], [ 0, %38 ]
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %39
br label %24
43: ; preds = %39
br label %44
44: ; preds = %53, %43
%45 = load double*, double** %6
%46 = load i32, i32* %10
%47 = add nsw i32 %46, -1
store i32 %47, i32* %10
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %45, i64 %48
%50 = load double, double* %49
%51 = load double, double* %11
%52 = fcmp ogt double %50, %51
br i1 %52, label %53, label %54
53: ; preds = %44
br label %44
54: ; preds = %44
%55 = load i32, i32* %9
%56 = load i32, i32* %10
%57 = icmp sge i32 %55, %56
br i1 %57, label %58, label %59
58: ; preds = %54
br label %117
59: ; preds = %54
%60 = load double*, double** %6
%61 = load i32, i32* %9
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
%64 = load double, double* %63
store double %64, double* %12
%65 = load double*, double** %6
%66 = load i32, i32* %10
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %65, i64 %67
%69 = load double, double* %68
%70 = load double*, double** %6
%71 = load i32, i32* %9
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
store double %69, double* %73
%74 = load double, double* %12
%75 = load double*, double** %6
%76 = load i32, i32* %10
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
store double %74, double* %78
%79 = load double*, double** %7
%80 = load i32, i32* %9
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %79, i64 %81
%83 = load double, double* %82
store double %83, double* %13
%84 = load double*, double** %7
%85 = load i32, i32* %10
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
%89 = load double*, double** %7
%90 = load i32, i32* %9
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %89, i64 %91
store double %88, double* %92
%93 = load double, double* %13
%94 = load double*, double** %7
%95 = load i32, i32* %10
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %94, i64 %96
store double %93, double* %97
%98 = load double*, double** %8
%99 = load i32, i32* %9
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
%102 = load double, double* %101
store double %102, double* %14
%103 = load double*, double** %8
%104 = load i32, i32* %10
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %103, i64 %105
%107 = load double, double* %106
%108 = load double*, double** %8
%109 = load i32, i32* %9
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double, double* %108, i64 %110
store double %107, double* %111
%112 = load double, double* %14
%113 = load double*, double** %8
%114 = load i32, i32* %10
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %113, i64 %115
store double %112, double* %116
br label %23
117: ; preds = %58
%118 = load double*, double** %6
%119 = load i32, i32* %9
%120 = sub nsw i32 %119, 1
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %118, i64 %121
%123 = load double, double* %122
store double %123, double* %12
%124 = load double*, double** %6
%125 = getelementptr inbounds double, double* %124, i64 0
%126 = load double, double* %125
%127 = load double*, double** %6
%128 = load i32, i32* %9
%129 = sub nsw i32 %128, 1
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %127, i64 %130
store double %126, double* %131
%132 = load double, double* %12
%133 = load double*, double** %6
%134 = getelementptr inbounds double, double* %133, i64 0
store double %132, double* %134
%135 = load double*, double** %7
%136 = load i32, i32* %9
%137 = sub nsw i32 %136, 1
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %135, i64 %138
%140 = load double, double* %139
store double %140, double* %13
%141 = load double*, double** %7
%142 = getelementptr inbounds double, double* %141, i64 0
%143 = load double, double* %142
%144 = load double*, double** %7
%145 = load i32, i32* %9
%146 = sub nsw i32 %145, 1
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds double, double* %144, i64 %147
store double %143, double* %148
%149 = load double, double* %13
%150 = load double*, double** %7
%151 = getelementptr inbounds double, double* %150, i64 0
store double %149, double* %151
%152 = load double*, double** %8
%153 = load i32, i32* %9
%154 = sub nsw i32 %153, 1
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds double, double* %152, i64 %155
%157 = load double, double* %156
store double %157, double* %14
%158 = load double*, double** %8
%159 = getelementptr inbounds double, double* %158, i64 0
%160 = load double, double* %159
%161 = load double*, double** %8
%162 = load i32, i32* %9
%163 = sub nsw i32 %162, 1
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds double, double* %161, i64 %164
store double %160, double* %165
%166 = load double, double* %14
%167 = load double*, double** %8
%168 = getelementptr inbounds double, double* %167, i64 0
store double %166, double* %168
%169 = load i32, i32* %9
%170 = sub nsw i32 %169, 1
%171 = load double*, double** %6
%172 = load double*, double** %7
%173 = load double*, double** %8
%174 = load i32, i32* %5
%175 = load i32, i32* %9
%176 = sub nsw i32 %174, %175
%177 = load double*, double** %6
%178 = load i32, i32* %9
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds double, double* %177, i64 %179
%181 = load double*, double** %7
%182 = load i32, i32* %9
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds double, double* %181, i64 %183
%185 = load double*, double** %8
%186 = load i32, i32* %9
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds double, double* %185, i64 %187
br label %189
189: ; preds = %117, %17
ret void
}

LLVM IR (-O2):
define void @mysort3(i32 %0, double* %1, double* %2, double* %3) {
%5 = icmp slt i32 %0, 2
br i1 %5, label %73, label %6
6: ; preds = %4, %52
%7 = phi double* [ %71, %52 ], [ %3, %4 ]
%8 = phi double* [ %70, %52 ], [ %2, %4 ]
%9 = phi double* [ %69, %52 ], [ %1, %4 ]
%10 = phi i32 [ %66, %52 ], [ %0, %4 ]
%11 = load double, double* %9
%12 = zext i32 %10 to i64
br label %13
13: ; preds = %38, %6
%14 = phi i32 [ %10, %6 ], [ %36, %38 ]
%15 = phi i64 [ 0, %6 ], [ %20, %38 ]
%16 = shl i64 %15, 32
%17 = ashr exact i64 %16, 32
br label %18
18: ; preds = %22, %13
%19 = phi i64 [ %20, %22 ], [ %17, %13 ]
%20 = add nsw i64 %19, 1
%21 = icmp slt i64 %20, %12
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = getelementptr inbounds double, double* %9, i64 %20
%24 = load double, double* %23
%25 = fcmp uge double %24, %11
br i1 %25, label %26, label %18
26: ; preds = %18, %22
%27 = sext i32 %14 to i64
br label %28
28: ; preds = %26, %28
%29 = phi i64 [ %27, %26 ], [ %30, %28 ]
%30 = add i64 %29, -1
%31 = getelementptr inbounds double, double* %9, i64 %30
%32 = load double, double* %31
%33 = fcmp ogt double %32, %11
br i1 %33, label %28, label %34
34: ; preds = %28
%35 = trunc i64 %20 to i32
%36 = trunc i64 %30 to i32
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %52
38: ; preds = %34
%39 = getelementptr inbounds double, double* %9, i64 %30
%40 = shl i64 %20, 32
%41 = ashr exact i64 %40, 32
%42 = getelementptr inbounds double, double* %9, i64 %41
%43 = load double, double* %42
store double %32, double* %42
store double %43, double* %39
%44 = getelementptr inbounds double, double* %8, i64 %41
%45 = load double, double* %44
%46 = getelementptr inbounds double, double* %8, i64 %30
%47 = load double, double* %46
store double %47, double* %44
store double %45, double* %46
%48 = getelementptr inbounds double, double* %7, i64 %41
%49 = load double, double* %48
%50 = getelementptr inbounds double, double* %7, i64 %30
%51 = load double, double* %50
store double %51, double* %48
store double %49, double* %50
br label %13
52: ; preds = %34
%53 = trunc i64 %19 to i32
%54 = trunc i64 %20 to i32
%55 = shl i64 %19, 32
%56 = ashr exact i64 %55, 32
%57 = getelementptr inbounds double, double* %9, i64 %56
%58 = load double, double* %57
%59 = load double, double* %9
store double %59, double* %57
store double %58, double* %9
%60 = getelementptr inbounds double, double* %8, i64 %56
%61 = load double, double* %60
%62 = load double, double* %8
store double %62, double* %60
store double %61, double* %8
%63 = getelementptr inbounds double, double* %7, i64 %56
%64 = load double, double* %63
%65 = load double, double* %7
store double %65, double* %63
store double %64, double* %7
tail call void @mysort3(i32 %53, double* %9, double* %8, double* %7)
%66 = sub nsw i32 %10, %54
%67 = shl i64 %20, 32
%68 = ashr exact i64 %67, 32
%69 = getelementptr inbounds double, double* %9, i64 %68
%70 = getelementptr inbounds double, double* %8, i64 %68
%71 = getelementptr inbounds double, double* %7, i64 %68
%72 = icmp slt i32 %66, 2
br i1 %72, label %73, label %6
73: ; preds = %52, %4
ret void
}