#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*/ CSPL_Sort_argsort(double *, long *, int);
int /*<<< orphan*/ CSPL_Sort_mergesort(double *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  double dat1[5] = {4, 2, 10, 123, 2};
  double dat2[5] = {5, 6, 30, 2, 1};
  long i;
  long inds1[5];
  long inds2[5];
  printf("\n\tArray1\tArray2\n");
  for (i = 0; i < 5; i++) {
    printf("%5ld\t", i);
    printf("%5.1lf\t", dat1[i]);
    printf("%5.1lf\n", dat2[i]);
  }
  printf("Sort arrays printing out the indicies in argsort\n");
  CSPL_Sort_argsort(dat1, inds1, 5);
  CSPL_Sort_argsort(dat2, inds2, 5);
  for (i = 0; i < 5; i++) {
    printf("%5ld\t", inds1[i]);
    printf("%5ld\n", inds2[i]);
  }
  {
    double dat1[5] = {4, 2, 10, 123, 2};
    double dat2[5] = {5, 6, 30, 2, 1};
    printf("\n\nDo a mergesort on the arrays\n");
    CSPL_Sort_mergesort(dat1, 5);
    CSPL_Sort_mergesort(dat2, 5);
    printf("\tArray1\tArray2\n");
    for (i = 0; i < 5; i++) {
      printf("%5ld\t", i);
      printf("%5.1lf\t", dat1[i]);
      printf("%5.1lf\n", dat2[i]);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xece(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeac(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe97(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe6a(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xe65(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe50(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe3b(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe26(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe11(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x68(%rbp)
cmpq   $0x5,-0x68(%rbp)
jge    1268 <main+0x128>
mov    -0x68(%rbp),%rsi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
lea    0xe1f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
lea    0xe0f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
jmp    120a <main+0xca>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x5,%edx
call   1030 <CSPL_Sort_argsort@plt>
lea    -0x60(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x5,%edx
call   1030 <CSPL_Sort_argsort@plt>
movq   $0x0,-0x68(%rbp)
cmpq   $0x5,-0x68(%rbp)
jge    12f8 <main+0x1b8>
mov    -0x68(%rbp),%rax
mov    -0x90(%rbp,%rax,8),%rsi
ff
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rsi
ff
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
jmp    12a8 <main+0x168>
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xd25(%rip),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  0xce5(%rip),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  0xcfd(%rip),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  0xce5(%rip),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  0xcb5(%rip),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xcaa(%rip),%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movsd  0xc92(%rip),%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
movsd  0xc7a(%rip),%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movsd  0xc62(%rip),%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
movsd  0xc4a(%rip),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
lea    0xcda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xf0(%rbp),%rdi
mov    $0x5,%esi
call   1060 <CSPL_Sort_mergesort@plt>
lea    -0x120(%rbp),%rdi
mov    $0x5,%esi
call   1060 <CSPL_Sort_mergesort@plt>
lea    0xc4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x68(%rbp)
cmpq   $0x5,-0x68(%rbp)
jge    1468 <main+0x328>
mov    -0x68(%rbp),%rsi
lea    0xc37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%rax
movsd  -0xf0(%rbp,%rax,8),%xmm0
ff ff
lea    0xc22(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%rax
movsd  -0x120(%rbp,%rax,8),%xmm0
ff ff
lea    0xc0f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
jmp    1404 <main+0x2c4>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
movaps 0xea8(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xea9(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movabs $0x4000000000000000,%r13
mov    %r13,0x110(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xe99(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movabs $0x3ff0000000000000,%rbp
mov    %rbp,0xe0(%rsp)
lea    0xee4(%rip),%rdi
call   1040 <puts@plt>
lea    0xebc(%rip),%r12
mov    %r12,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeaf(%rip),%r14
movsd  0xe61(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe9e(%rip),%r15
movsd  0xe50(%rip),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x1,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0xe37(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xe2d(%rip),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x2,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0xe14(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xe0a(%rip),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x3,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0xdf1(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %r15,%rdi
movsd  0xdbc(%rip),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x4,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
movsd  0xd9b(%rip),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xdb4(%rip),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xdd7(%rip),%rdi
call   1040 <puts@plt>
lea    0xf0(%rsp),%rdi
lea    0x90(%rsp),%rsi
mov    $0x5,%edx
call   1030 <CSPL_Sort_argsort@plt>
lea    0xc0(%rsp),%rdi
lea    0x60(%rsp),%rsi
mov    $0x5,%edx
call   1030 <CSPL_Sort_argsort@plt>
mov    0x90(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x60(%rsp),%rsi
lea    0xd6d(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x98(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x68(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xa0(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x70(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xa8(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x78(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xb0(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x80(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movaps 0xc3f(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xc43(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    %r13,0x50(%rsp)
movaps 0xc42(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xc47(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rbp,0x20(%rsp)
lea    0xce3(%rip),%rdi
call   1040 <puts@plt>
lea    0x30(%rsp),%rdi
mov    $0x5,%esi
call   1060 <CSPL_Sort_mergesort@plt>
mov    %rsp,%rdi
mov    $0x5,%esi
call   1060 <CSPL_Sort_mergesort@plt>
lea    0xc7b(%rip),%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x1,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x2,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0x40(%rsp),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x3,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0x48(%rsp),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x4,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0x50(%rsp),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0A\09Array1\09Array2\0A\00"
@.str.1 = [6 x i8] c"%5ld\09\00"
@.str.2 = [8 x i8] c"%5.1lf\09\00"
@.str.3 = [8 x i8] c"%5.1lf\0A\00"
@.str.4 = [50 x i8] c"Sort arrays printing out the indicies in argsort\0A\00"
@.str.5 = [6 x i8] c"%5ld\0A\00"
@.str.6 = [32 x i8] c"\0A\0ADo a mergesort on the arrays\0A\00"
@.str.7 = [16 x i8] c"\09Array1\09Array2\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x double]
%3 = alloca [5 x double]
%4 = alloca i64
%5 = alloca [5 x i64]
%6 = alloca [5 x i64]
%7 = alloca [5 x double]
%8 = alloca [5 x double]
store i32 0, i32* %1
%9 = bitcast [5 x double]* %2 to i8*
%10 = bitcast i8* %9 to [5 x double]*
%11 = getelementptr inbounds [5 x double], [5 x double]* %10, i32 0, i32 0
store double 4.000000e+00, double* %11
%12 = getelementptr inbounds [5 x double], [5 x double]* %10, i32 0, i32 1
store double 2.000000e+00, double* %12
%13 = getelementptr inbounds [5 x double], [5 x double]* %10, i32 0, i32 2
store double 1.000000e+01, double* %13
%14 = getelementptr inbounds [5 x double], [5 x double]* %10, i32 0, i32 3
store double 1.230000e+02, double* %14
%15 = getelementptr inbounds [5 x double], [5 x double]* %10, i32 0, i32 4
store double 2.000000e+00, double* %15
%16 = bitcast [5 x double]* %3 to i8*
%17 = bitcast i8* %16 to [5 x double]*
%18 = getelementptr inbounds [5 x double], [5 x double]* %17, i32 0, i32 0
store double 5.000000e+00, double* %18
%19 = getelementptr inbounds [5 x double], [5 x double]* %17, i32 0, i32 1
store double 6.000000e+00, double* %19
%20 = getelementptr inbounds [5 x double], [5 x double]* %17, i32 0, i32 2
store double 3.000000e+01, double* %20
%21 = getelementptr inbounds [5 x double], [5 x double]* %17, i32 0, i32 3
store double 2.000000e+00, double* %21
%22 = getelementptr inbounds [5 x double], [5 x double]* %17, i32 0, i32 4
store double 1.000000e+00, double* %22
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %4
br label %24
24: ; preds = %38, %0
%25 = load i64, i64* %4
%26 = icmp slt i64 %25, 5
br i1 %26, label %27, label %41
27: ; preds = %24
%28 = load i64, i64* %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %28)
%30 = load i64, i64* %4
%31 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 %30
%32 = load double, double* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %32)
%34 = load i64, i64* %4
%35 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 %34
%36 = load double, double* %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %36)
br label %38
38: ; preds = %27
%39 = load i64, i64* %4
%40 = add nsw i64 %39, 1
store i64 %40, i64* %4
br label %24
41: ; preds = %24
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
%43 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%44 = getelementptr inbounds [5 x i64], [5 x i64]* %5, i64 0, i64 0
%45 = call i32 @CSPL_Sort_argsort(double* %43, i64* %44, i32 5)
%46 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 0
%47 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 0
%48 = call i32 @CSPL_Sort_argsort(double* %46, i64* %47, i32 5)
store i64 0, i64* %4
br label %49
49: ; preds = %61, %41
%50 = load i64, i64* %4
%51 = icmp slt i64 %50, 5
br i1 %51, label %52, label %64
52: ; preds = %49
%53 = load i64, i64* %4
%54 = getelementptr inbounds [5 x i64], [5 x i64]* %5, i64 0, i64 %53
%55 = load i64, i64* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %55)
%57 = load i64, i64* %4
%58 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 %57
%59 = load i64, i64* %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %59)
br label %61
61: ; preds = %52
%62 = load i64, i64* %4
%63 = add nsw i64 %62, 1
store i64 %63, i64* %4
br label %49
64: ; preds = %49
%65 = bitcast [5 x double]* %7 to i8*
%66 = bitcast i8* %65 to [5 x double]*
%67 = getelementptr inbounds [5 x double], [5 x double]* %66, i32 0, i32 0
store double 4.000000e+00, double* %67
%68 = getelementptr inbounds [5 x double], [5 x double]* %66, i32 0, i32 1
store double 2.000000e+00, double* %68
%69 = getelementptr inbounds [5 x double], [5 x double]* %66, i32 0, i32 2
store double 1.000000e+01, double* %69
%70 = getelementptr inbounds [5 x double], [5 x double]* %66, i32 0, i32 3
store double 1.230000e+02, double* %70
%71 = getelementptr inbounds [5 x double], [5 x double]* %66, i32 0, i32 4
store double 2.000000e+00, double* %71
%72 = bitcast [5 x double]* %8 to i8*
%73 = bitcast i8* %72 to [5 x double]*
%74 = getelementptr inbounds [5 x double], [5 x double]* %73, i32 0, i32 0
store double 5.000000e+00, double* %74
%75 = getelementptr inbounds [5 x double], [5 x double]* %73, i32 0, i32 1
store double 6.000000e+00, double* %75
%76 = getelementptr inbounds [5 x double], [5 x double]* %73, i32 0, i32 2
store double 3.000000e+01, double* %76
%77 = getelementptr inbounds [5 x double], [5 x double]* %73, i32 0, i32 3
store double 2.000000e+00, double* %77
%78 = getelementptr inbounds [5 x double], [5 x double]* %73, i32 0, i32 4
store double 1.000000e+00, double* %78
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
%80 = getelementptr inbounds [5 x double], [5 x double]* %7, i64 0, i64 0
%81 = call i32 @CSPL_Sort_mergesort(double* %80, i32 5)
%82 = getelementptr inbounds [5 x double], [5 x double]* %8, i64 0, i64 0
%83 = call i32 @CSPL_Sort_mergesort(double* %82, i32 5)
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
store i64 0, i64* %4
br label %85
85: ; preds = %99, %64
%86 = load i64, i64* %4
%87 = icmp slt i64 %86, 5
br i1 %87, label %88, label %102
88: ; preds = %85
%89 = load i64, i64* %4
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %89)
%91 = load i64, i64* %4
%92 = getelementptr inbounds [5 x double], [5 x double]* %7, i64 0, i64 %91
%93 = load double, double* %92
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %93)
%95 = load i64, i64* %4
%96 = getelementptr inbounds [5 x double], [5 x double]* %8, i64 0, i64 %95
%97 = load double, double* %96
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %97)
br label %99
99: ; preds = %88
%100 = load i64, i64* %4
%101 = add nsw i64 %100, 1
store i64 %101, i64* %4
br label %85
102: ; preds = %85
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%5ld\09\00"
@.str.2 = [8 x i8] c"%5.1lf\09\00"
@.str.3 = [8 x i8] c"%5.1lf\0A\00"
@.str.5 = [6 x i8] c"%5ld\0A\00"
@str = [16 x i8] c"\0A\09Array1\09Array2\00"
@str.8 = [49 x i8] c"Sort arrays printing out the indicies in argsort\00"
@str.9 = [31 x i8] c"\0A\0ADo a mergesort on the arrays\00"
@str.10 = [15 x i8] c"\09Array1\09Array2\00"
define i32 @main() {
%1 = alloca [5 x double]
%2 = alloca [5 x double]
%3 = alloca [5 x i64]
%4 = alloca [5 x i64]
%5 = alloca [5 x double]
%6 = alloca [5 x double]
%7 = bitcast [5 x double]* %1 to i8*
%8 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%9 = bitcast [5 x double]* %1 to <2 x double>*
store <2 x double> <double 4.000000e+00, double 2.000000e+00>, <2 x double>* %9
%10 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 2
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.230000e+02>, <2 x double>* %11
%12 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 4
store double 2.000000e+00, double* %12
%13 = bitcast [5 x double]* %2 to i8*
%14 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%15 = bitcast [5 x double]* %2 to <2 x double>*
store <2 x double> <double 5.000000e+00, double 6.000000e+00>, <2 x double>* %15
%16 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 2
%17 = bitcast double* %16 to <2 x double>*
store <2 x double> <double 3.000000e+01, double 2.000000e+00>, <2 x double>* %17
%18 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 4
store double 1.000000e+00, double* %18
%19 = bitcast [5 x i64]* %3 to i8*
%20 = bitcast [5 x i64]* %4 to i8*
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 0)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double 4.000000e+00)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double 5.000000e+00)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 1)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double 2.000000e+00)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double 6.000000e+00)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 2)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double 1.000000e+01)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double 3.000000e+01)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 3)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double 1.230000e+02)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double 2.000000e+00)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 4)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double 2.000000e+00)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double 1.000000e+00)
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.8, i64 0, i64 0))
%38 = getelementptr inbounds [5 x i64], [5 x i64]* %3, i64 0, i64 0
%39 = call i32 @CSPL_Sort_argsort(double* %8, i64* %38, i32 5)
%40 = getelementptr inbounds [5 x i64], [5 x i64]* %4, i64 0, i64 0
%41 = call i32 @CSPL_Sort_argsort(double* %14, i64* %40, i32 5)
%42 = load i64, i64* %38
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %42)
%44 = load i64, i64* %40
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %44)
%46 = getelementptr inbounds [5 x i64], [5 x i64]* %3, i64 0, i64 1
%47 = load i64, i64* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %47)
%49 = getelementptr inbounds [5 x i64], [5 x i64]* %4, i64 0, i64 1
%50 = load i64, i64* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %50)
%52 = getelementptr inbounds [5 x i64], [5 x i64]* %3, i64 0, i64 2
%53 = load i64, i64* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %53)
%55 = getelementptr inbounds [5 x i64], [5 x i64]* %4, i64 0, i64 2
%56 = load i64, i64* %55
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %56)
%58 = getelementptr inbounds [5 x i64], [5 x i64]* %3, i64 0, i64 3
%59 = load i64, i64* %58
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %59)
%61 = getelementptr inbounds [5 x i64], [5 x i64]* %4, i64 0, i64 3
%62 = load i64, i64* %61
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %62)
%64 = getelementptr inbounds [5 x i64], [5 x i64]* %3, i64 0, i64 4
%65 = load i64, i64* %64
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %65)
%67 = getelementptr inbounds [5 x i64], [5 x i64]* %4, i64 0, i64 4
%68 = load i64, i64* %67
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %68)
%70 = bitcast [5 x double]* %5 to i8*
%71 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 0
%72 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 1
%73 = bitcast [5 x double]* %5 to <2 x double>*
store <2 x double> <double 4.000000e+00, double 2.000000e+00>, <2 x double>* %73
%74 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 2
%75 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 3
%76 = bitcast double* %74 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.230000e+02>, <2 x double>* %76
%77 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 4
store double 2.000000e+00, double* %77
%78 = bitcast [5 x double]* %6 to i8*
%79 = getelementptr inbounds [5 x double], [5 x double]* %6, i64 0, i64 0
%80 = getelementptr inbounds [5 x double], [5 x double]* %6, i64 0, i64 1
%81 = bitcast [5 x double]* %6 to <2 x double>*
store <2 x double> <double 5.000000e+00, double 6.000000e+00>, <2 x double>* %81
%82 = getelementptr inbounds [5 x double], [5 x double]* %6, i64 0, i64 2
%83 = getelementptr inbounds [5 x double], [5 x double]* %6, i64 0, i64 3
%84 = bitcast double* %82 to <2 x double>*
store <2 x double> <double 3.000000e+01, double 2.000000e+00>, <2 x double>* %84
%85 = getelementptr inbounds [5 x double], [5 x double]* %6, i64 0, i64 4
store double 1.000000e+00, double* %85
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.9, i64 0, i64 0))
%87 = call i32 @CSPL_Sort_mergesort(double* %71, i32 5)
%88 = call i32 @CSPL_Sort_mergesort(double* %79, i32 5)
%89 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.10, i64 0, i64 0))
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 0)
%91 = load double, double* %71
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %91)
%93 = load double, double* %79
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %93)
%95 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 1)
%96 = load double, double* %72
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %96)
%98 = load double, double* %80
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %98)
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 2)
%101 = load double, double* %74
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %101)
%103 = load double, double* %82
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %103)
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 3)
%106 = load double, double* %75
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %106)
%108 = load double, double* %83
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %108)
%110 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 4)
%111 = load double, double* %77
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %111)
%113 = load double, double* %85
%114 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %113)
ret i32 0
}