#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*/ error_option(int, char *);
void permute_dimensions(int ordermode, unsigned nc, unsigned nr, unsigned ns,
                        unsigned *nx, unsigned *ny, unsigned *nz, int ncstart,
                        int nrstart, int nsstart, int *nxstart, int *nystart,
                        int *nzstart) {
  switch (ordermode) {
  case 1:
    *nx = nc;
    *ny = nr;
    *nz = ns;
    *nxstart = ncstart;
    *nystart = nrstart;
    *nzstart = nsstart;
    break;
  case 2:
    *nx = nc;
    *ny = ns;
    *nz = nr;
    *nxstart = ncstart;
    *nystart = nsstart;
    *nzstart = nrstart;
    break;
  case 3:
    *nx = nr;
    *ny = nc;
    *nz = ns;
    *nxstart = nrstart;
    *nystart = ncstart;
    *nzstart = nsstart;
    break;
  case 4:
    *nx = ns;
    *ny = nc;
    *nz = nr;
    *nxstart = nsstart;
    *nystart = ncstart;
    *nzstart = nrstart;
    break;
  case 5:
    *nx = nr;
    *ny = ns;
    *nz = nc;
    *nxstart = nrstart;
    *nystart = nsstart;
    *nzstart = ncstart;
    break;
  case 6:
    *nx = ns;
    *ny = nr;
    *nz = nc;
    *nxstart = nsstart;
    *nystart = nrstart;
    *nzstart = ncstart;
    break;
  default:
    error_option(70212, "lib_vio");
  }
}


x86 assembly (clang, -O0):
<permute_dimensions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x5,%eax
ja     12d0 <permute_dimensions+0x1c0>
mov    -0x28(%rbp),%rax
lea    0xe9b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    0x20(%rbp),%ecx
mov    0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    0x28(%rbp),%ecx
mov    0x40(%rbp),%rax
mov    %ecx,(%rax)
jmp    12e1 <permute_dimensions+0x1d1>
mov    -0x8(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    0x28(%rbp),%ecx
mov    0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    0x20(%rbp),%ecx
mov    0x40(%rbp),%rax
mov    %ecx,(%rax)
jmp    12e1 <permute_dimensions+0x1d1>
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x20(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%ecx
mov    0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    0x28(%rbp),%ecx
mov    0x40(%rbp),%rax
mov    %ecx,(%rax)
jmp    12e1 <permute_dimensions+0x1d1>
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x28(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%ecx
mov    0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    0x20(%rbp),%ecx
mov    0x40(%rbp),%rax
mov    %ecx,(%rax)
jmp    12e1 <permute_dimensions+0x1d1>
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x20(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    0x28(%rbp),%ecx
mov    0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%ecx
mov    0x40(%rbp),%rax
mov    %ecx,(%rax)
jmp    12e1 <permute_dimensions+0x1d1>
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x28(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    0x20(%rbp),%ecx
mov    0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%ecx
mov    0x40(%rbp),%rax
mov    %ecx,(%rax)
jmp    12e1 <permute_dimensions+0x1d1>
mov    $0x11244,%edi
lea    0xd3c(%rip),%rsi
call   1030 <error_option@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<permute_dimensions>:
add    $0xffffffff,%edi
cmp    $0x5,%edi
ja     1164 <permute_dimensions+0x54>
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x60(%rsp),%r10
mov    0x58(%rsp),%r11
mov    0x50(%rsp),%rax
mov    0x48(%rsp),%r14d
mov    0x40(%rsp),%r15d
mov    0x38(%rsp),%r12d
mov    0x30(%rsp),%rbx
lea    0xeb6(%rip),%rbp
movslq 0x0(%rbp,%rdi,4),%rdi
add    %rbp,%rdi
jmp    *%rdi
mov    %esi,(%r8)
mov    %edx,(%r9)
mov    %ecx,(%rbx)
mov    %r12d,(%rax)
mov    %r15d,(%r11)
jmp    1196 <permute_dimensions+0x86>
lea    0xead(%rip),%rsi
mov    $0x11244,%edi
jmp    1030 <error_option@plt>
mov    %esi,(%r8)
mov    %ecx,(%r9)
mov    %edx,(%rbx)
mov    %r12d,(%rax)
mov    %r14d,(%r11)
mov    %r15d,(%r10)
jmp    11cf <permute_dimensions+0xbf>
mov    %edx,(%r8)
mov    %esi,(%r9)
mov    %ecx,(%rbx)
mov    %r15d,(%rax)
mov    %r12d,(%r11)
mov    %r14d,(%r10)
jmp    11cf <permute_dimensions+0xbf>
mov    %ecx,(%r8)
mov    %esi,(%r9)
mov    %edx,(%rbx)
mov    %r14d,(%rax)
mov    %r12d,(%r11)
mov    %r15d,(%r10)
jmp    11cf <permute_dimensions+0xbf>
mov    %edx,(%r8)
mov    %ecx,(%r9)
mov    %esi,(%rbx)
mov    %r15d,(%rax)
mov    %r14d,(%r11)
jmp    11cc <permute_dimensions+0xbc>
mov    %ecx,(%r8)
mov    %edx,(%r9)
mov    %esi,(%rbx)
mov    %r14d,(%rax)
mov    %r15d,(%r11)
mov    %r12d,(%r10)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"lib_vio\00"
define void @permute_dimensions(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5, i32* %6, i32 %7, i32 %8, i32 %9, i32* %10, i32* %11, i32* %12) {
%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 i32
%23 = alloca i32
%24 = alloca i32*
%25 = alloca i32*
%26 = alloca i32*
store i32 %0, i32* %14
store i32 %1, i32* %15
store i32 %2, i32* %16
store i32 %3, i32* %17
store i32* %4, i32** %18
store i32* %5, i32** %19
store i32* %6, i32** %20
store i32 %7, i32* %21
store i32 %8, i32* %22
store i32 %9, i32* %23
store i32* %10, i32** %24
store i32* %11, i32** %25
store i32* %12, i32** %26
%27 = load i32, i32* %14
switch i32 %27, label %106 [
i32 1, label %28
i32 2, label %41
i32 3, label %54
i32 4, label %67
i32 5, label %80
i32 6, label %93
]
28: ; preds = %13
%29 = load i32, i32* %15
%30 = load i32*, i32** %18
store i32 %29, i32* %30
%31 = load i32, i32* %16
%32 = load i32*, i32** %19
store i32 %31, i32* %32
%33 = load i32, i32* %17
%34 = load i32*, i32** %20
store i32 %33, i32* %34
%35 = load i32, i32* %21
%36 = load i32*, i32** %24
store i32 %35, i32* %36
%37 = load i32, i32* %22
%38 = load i32*, i32** %25
store i32 %37, i32* %38
%39 = load i32, i32* %23
%40 = load i32*, i32** %26
store i32 %39, i32* %40
br label %108
41: ; preds = %13
%42 = load i32, i32* %15
%43 = load i32*, i32** %18
store i32 %42, i32* %43
%44 = load i32, i32* %17
%45 = load i32*, i32** %19
store i32 %44, i32* %45
%46 = load i32, i32* %16
%47 = load i32*, i32** %20
store i32 %46, i32* %47
%48 = load i32, i32* %21
%49 = load i32*, i32** %24
store i32 %48, i32* %49
%50 = load i32, i32* %23
%51 = load i32*, i32** %25
store i32 %50, i32* %51
%52 = load i32, i32* %22
%53 = load i32*, i32** %26
store i32 %52, i32* %53
br label %108
54: ; preds = %13
%55 = load i32, i32* %16
%56 = load i32*, i32** %18
store i32 %55, i32* %56
%57 = load i32, i32* %15
%58 = load i32*, i32** %19
store i32 %57, i32* %58
%59 = load i32, i32* %17
%60 = load i32*, i32** %20
store i32 %59, i32* %60
%61 = load i32, i32* %22
%62 = load i32*, i32** %24
store i32 %61, i32* %62
%63 = load i32, i32* %21
%64 = load i32*, i32** %25
store i32 %63, i32* %64
%65 = load i32, i32* %23
%66 = load i32*, i32** %26
store i32 %65, i32* %66
br label %108
67: ; preds = %13
%68 = load i32, i32* %17
%69 = load i32*, i32** %18
store i32 %68, i32* %69
%70 = load i32, i32* %15
%71 = load i32*, i32** %19
store i32 %70, i32* %71
%72 = load i32, i32* %16
%73 = load i32*, i32** %20
store i32 %72, i32* %73
%74 = load i32, i32* %23
%75 = load i32*, i32** %24
store i32 %74, i32* %75
%76 = load i32, i32* %21
%77 = load i32*, i32** %25
store i32 %76, i32* %77
%78 = load i32, i32* %22
%79 = load i32*, i32** %26
store i32 %78, i32* %79
br label %108
80: ; preds = %13
%81 = load i32, i32* %16
%82 = load i32*, i32** %18
store i32 %81, i32* %82
%83 = load i32, i32* %17
%84 = load i32*, i32** %19
store i32 %83, i32* %84
%85 = load i32, i32* %15
%86 = load i32*, i32** %20
store i32 %85, i32* %86
%87 = load i32, i32* %22
%88 = load i32*, i32** %24
store i32 %87, i32* %88
%89 = load i32, i32* %23
%90 = load i32*, i32** %25
store i32 %89, i32* %90
%91 = load i32, i32* %21
%92 = load i32*, i32** %26
store i32 %91, i32* %92
br label %108
93: ; preds = %13
%94 = load i32, i32* %17
%95 = load i32*, i32** %18
store i32 %94, i32* %95
%96 = load i32, i32* %16
%97 = load i32*, i32** %19
store i32 %96, i32* %97
%98 = load i32, i32* %15
%99 = load i32*, i32** %20
store i32 %98, i32* %99
%100 = load i32, i32* %23
%101 = load i32*, i32** %24
store i32 %100, i32* %101
%102 = load i32, i32* %22
%103 = load i32*, i32** %25
store i32 %102, i32* %103
%104 = load i32, i32* %21
%105 = load i32*, i32** %26
store i32 %104, i32* %105
br label %108
106: ; preds = %13
%107 = call i32 @error_option(i32 70212, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %108
108: ; preds = %106, %93, %80, %67, %54, %41, %28
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"lib_vio\00"
define void @permute_dimensions(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6, i32 %7, i32 %8, i32 %9, i32* nocapture writeonly %10, i32* nocapture writeonly %11, i32* nocapture writeonly %12) {
switch i32 %0, label %20 [
i32 1, label %14
i32 2, label %15
i32 3, label %16
i32 4, label %17
i32 5, label %18
i32 6, label %19
]
14: ; preds = %13
store i32 %1, i32* %4
store i32 %2, i32* %5
store i32 %3, i32* %6
store i32 %7, i32* %10
store i32 %8, i32* %11
store i32 %9, i32* %12
br label %22
15: ; preds = %13
store i32 %1, i32* %4
store i32 %3, i32* %5
store i32 %2, i32* %6
store i32 %7, i32* %10
store i32 %9, i32* %11
store i32 %8, i32* %12
br label %22
16: ; preds = %13
store i32 %2, i32* %4
store i32 %1, i32* %5
store i32 %3, i32* %6
store i32 %8, i32* %10
store i32 %7, i32* %11
store i32 %9, i32* %12
br label %22
17: ; preds = %13
store i32 %3, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 %9, i32* %10
store i32 %7, i32* %11
store i32 %8, i32* %12
br label %22
18: ; preds = %13
store i32 %2, i32* %4
store i32 %3, i32* %5
store i32 %1, i32* %6
store i32 %8, i32* %10
store i32 %9, i32* %11
store i32 %7, i32* %12
br label %22
19: ; preds = %13
store i32 %3, i32* %4
store i32 %2, i32* %5
store i32 %1, i32* %6
store i32 %9, i32* %10
store i32 %8, i32* %11
store i32 %7, i32* %12
br label %22
20: ; preds = %13
%21 = tail call i32 @error_option(i32 70212, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %19, %18, %17, %16, %15, %14
ret void
}