void mysort_sysrem(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 (data1[++i] < v && i < N) {
    }
    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;
  mysort_sysrem(i - 1, data1, data2, data3);
  mysort_sysrem(N - i, data1 + i, data2 + i, data3 + i);
}


x86 assembly (clang, -O0):
<mysort_sysrem>:
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 <mysort_sysrem+0x26>
jmp    13a2 <mysort_sysrem+0x292>
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 <mysort_sysrem+0x45>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
ucomisd %xmm1,%xmm0
mov    %al,-0x49(%rbp)
jbe    118a <mysort_sysrem+0x7a>
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
setl   %al
mov    %al,-0x49(%rbp)
mov    -0x49(%rbp),%al
test   $0x1,%al
jne    119a <mysort_sysrem+0x8a>
jmp    119f <mysort_sysrem+0x8f>
jmp    1155 <mysort_sysrem+0x45>
jmp    11a4 <mysort_sysrem+0x94>
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    11c9 <mysort_sysrem+0xb9>
jmp    11a4 <mysort_sysrem+0x94>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jl     11da <mysort_sysrem+0xca>
jmp    1299 <mysort_sysrem+0x189>
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 <mysort_sysrem+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 <mysort_sysrem@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 <mysort_sysrem@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mysort_sysrem>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jge    1132 <mysort_sysrem+0x22>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r12
movabs $0xffffffff00000000,%r11
ff ff ff
movabs $0x100000000,%r15
jmp    11ea <mysort_sysrem+0xda>
xchg   %ax,%ax
lea    (%rbx,%r14,1),%edi
add    $0xffffffff,%edi
sar    $0x1d,%rsi
movsd  (%r12,%rsi,1),%xmm0
movsd  (%r12),%xmm1
movsd  %xmm1,(%r12,%rsi,1)
movsd  %xmm0,(%r12)
movsd  (%rdx,%rsi,1),%xmm0
movsd  (%rdx),%xmm1
movsd  %xmm1,(%rdx,%rsi,1)
movsd  %xmm0,(%rdx)
movsd  (%rcx,%rsi,1),%xmm0
movsd  (%rcx),%xmm1
movsd  %xmm1,(%rcx,%rsi,1)
movsd  %xmm0,(%rcx)
mov    %r12,%rsi
mov    %rcx,0x10(%rsp)
mov    %rdx,%rbp
call   1030 <mysort_sysrem@plt>
movabs $0xffffffff00000000,%r11
ff ff ff
mov    %rbp,%rdx
mov    0x10(%rsp),%rcx
mov    0xc(%rsp),%edi
sub    %ebx,%edi
sub    %r14d,%edi
movslq %ebx,%rax
lea    0x0(,%rax,8),%rdx
add    %rbp,%rdx
sub    %r13,%rdx
lea    (%rcx,%rax,8),%rcx
sub    %r13,%rcx
lea    (%r12,%rax,8),%r12
sub    %r13,%r12
cmp    $0x1,%edi
jle    1123 <mysort_sysrem+0x13>
movsd  (%r12),%xmm0
mov    %edi,%r9d
mov    %edi,0xc(%rsp)
mov    %edi,%eax
xor    %r8d,%r8d
nopl   0x0(%rax)
mov    %r8,%rsi
shl    $0x20,%rsi
add    %r11,%rsi
movslq %r8d,%r10
lea    (%r12,%r10,8),%rdi
xor    %r13d,%r13d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
add    %r15,%rsi
movsd  0x8(%rdi,%rbp,8),%xmm1
lea    0x1(%rbp),%r14
add    $0xfffffffffffffff8,%r13
ucomisd %xmm1,%xmm0
jbe    1247 <mysort_sysrem+0x137>
lea    (%r10,%rbp,1),%rbx
add    $0x1,%rbx
mov    %r14,%rbp
cmp    %r9,%rbx
jl     1220 <mysort_sysrem+0x110>
mov    %r8,%rbx
lea    (%r8,%r14,1),%rbp
cltq
lea    (%r10,%r14,1),%r8
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  -0x8(%r12,%rax,8),%xmm2
add    $0xffffffffffffffff,%rax
ucomisd %xmm0,%xmm2
ja     1260 <mysort_sysrem+0x150>
cmp    %eax,%ebp
jge    1150 <mysort_sysrem+0x40>
movsd  %xmm2,(%rdi,%r14,8)
movsd  %xmm1,(%r12,%rax,8)
lea    (%rdx,%r10,8),%rsi
movsd  (%rsi,%r14,8),%xmm1
movsd  (%rdx,%rax,8),%xmm2
movsd  %xmm2,(%rsi,%r14,8)
movsd  %xmm1,(%rdx,%rax,8)
lea    (%rcx,%r10,8),%rsi
movsd  (%rsi,%r14,8),%xmm1
movsd  (%rcx,%rax,8),%xmm2
movsd  %xmm2,(%rsi,%r14,8)
movsd  %xmm1,(%rcx,%rax,8)
jmp    1200 <mysort_sysrem+0xf0>

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

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