#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*/ tce_sortacc_4_scalar(double *, double *, int, int, int, int,
                                        int, int, int, int, double);
int /*<<< orphan*/ tce_sortacc_4_simd(double *, double *, int, int, int, int,
                                      int, int, int, int, double);
void tce_sortacc_4_(double *unsorted, double *sorted, int *a_in, int *b_in,
                    int *c_in, int *d_in, int *i_in, int *j_in, int *k_in,
                    int *l_in, double *factor_in) {
  int a = *a_in;
  int b = *b_in;
  int c = *c_in;
  int d = *d_in;
  int i = *i_in - 1;
  int j = *j_in - 1;
  int k = *k_in - 1;
  int l = *l_in - 1;
  double factor = *factor_in;
  int dim[4];
  dim[0] = a;
  dim[1] = b;
  dim[2] = c;
  dim[3] = d;
  if (dim[l] % 2 == 0 && dim[3] % 2 == 0)
    tce_sortacc_4_simd(unsorted, sorted, a, b, c, d, i, j, k, l, factor);
  else
    tce_sortacc_4_scalar(unsorted, sorted, a, b, c, d, i, j, k, l, factor);
}


x86 assembly (clang, -O0):
<tce_sortacc_4_>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x88,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x10(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    0x18(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    0x20(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x54(%rbp)
mov    0x28(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    0x30(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x64(%rbp)
movslq -0x58(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1242 <tce_sortacc_4_+0x122>
mov    -0x64(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1242 <tce_sortacc_4_+0x122>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x3c(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x44(%rbp),%r8d
mov    -0x48(%rbp),%r9d
mov    -0x4c(%rbp),%ebx
mov    -0x50(%rbp),%r11d
mov    -0x54(%rbp),%r10d
mov    -0x58(%rbp),%eax
movsd  -0x60(%rbp),%xmm0
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <tce_sortacc_4_simd@plt>
jmp    1281 <tce_sortacc_4_+0x161>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x3c(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x44(%rbp),%r8d
mov    -0x48(%rbp),%r9d
mov    -0x4c(%rbp),%ebx
mov    -0x50(%rbp),%r11d
mov    -0x54(%rbp),%r10d
mov    -0x58(%rbp),%eax
movsd  -0x60(%rbp),%xmm0
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1040 <tce_sortacc_4_scalar@plt>
add    $0x88,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<tce_sortacc_4_>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x60(%rsp),%r14
mov    0x58(%rsp),%r15
mov    0x50(%rsp),%r12
mov    0x48(%rsp),%rbx
mov    0x40(%rsp),%rax
mov    (%rdx),%edx
mov    (%rcx),%ecx
mov    (%r8),%r8d
mov    (%r9),%r9d
mov    (%rax),%r10d
add    $0xffffffff,%r10d
mov    (%rbx),%r11d
add    $0xffffffff,%r11d
mov    (%r12),%eax
add    $0xffffffff,%eax
movslq (%r15),%rbx
movsd  (%r14),%xmm0
mov    %edx,(%rsp)
mov    %ecx,0x4(%rsp)
mov    %r8d,0x8(%rsp)
mov    %r9d,0xc(%rsp)
mov    -0x4(%rsp,%rbx,4),%ebp
or     %r9d,%ebp
add    $0xffffffffffffffff,%rbx
test   $0x1,%bpl
jne    119b <tce_sortacc_4_+0x7b>
push   %rbx
push   %rax
push   %r11
push   %r10
call   1030 <tce_sortacc_4_simd@plt>
jmp    11a6 <tce_sortacc_4_+0x86>
push   %rbx
push   %rax
push   %r11
push   %r10
call   1040 <tce_sortacc_4_scalar@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @tce_sortacc_4_(double* %0, double* %1, i32* nocapture %2, i32* nocapture %3, i32* nocapture %4, i32* nocapture %5, i32* nocapture %6, i32* nocapture %7, i32* nocapture %8, i32* nocapture %9, double* nocapture %10) {
%12 = alloca [4 x i32]
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = add nsw i32 %17, -1
%19 = load i32, i32* %7
%20 = add nsw i32 %19, -1
%21 = load i32, i32* %8
%22 = add nsw i32 %21, -1
%23 = load i32, i32* %9
%24 = add nsw i32 %23, -1
%25 = load double, double* %10
%26 = bitcast [4 x i32]* %12 to i8*
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 0
store i32 %13, i32* %27
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 1
store i32 %14, i32* %28
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 2
store i32 %15, i32* %29
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 3
store i32 %16, i32* %30
%31 = sext i32 %24 to i64
%32 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = and i32 %33, 1
%35 = icmp eq i32 %34, 0
%36 = and i32 %16, 1
%37 = icmp eq i32 %36, 0
%38 = select i1 %35, i1 %37, i1 false
br i1 %38, label %39, label %41
39: ; preds = %11
%40 = tail call i32 @tce_sortacc_4_simd(double* %0, double* %1, i32 %13, i32 %14, i32 %15, i32 %16, i32 %18, i32 %20, i32 %22, i32 %24, double %25)
br label %43
41: ; preds = %11
%42 = tail call i32 @tce_sortacc_4_scalar(double* %0, double* %1, i32 %13, i32 %14, i32 %15, i32 %16, i32 %18, i32 %20, i32 %22, i32 %24, double %25)
br label %43
43: ; preds = %41, %39
ret void
}