#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 deterRotMx(int const *);
int traceRotMx(int const *);
int GetRotMxOrder(const int *RotMx) {
  int deter = deterRotMx(RotMx);
  if (deter == -1 || deter == 1) {
    switch (traceRotMx(RotMx)) {
    case -3:
      return -1;
    case -2:
      return -6;
    case -1:
      if (deter == -1)
        return -4;
      else
        return 2;
    case 0:
      if (deter == -1)
        return -3;
      else
        return 3;
    case 1:
      if (deter == -1)
        return -2;
      else
        return 4;
    case 2:
      return 6;
    case 3:
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<GetRotMxOrder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <deterRotMx@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     114c <GetRotMxOrder+0x2c>
cmpl   $0x1,-0x14(%rbp)
jne    1216 <GetRotMxOrder+0xf6>
mov    -0x10(%rbp),%rdi
call   1030 <traceRotMx@plt>
add    $0x3,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x6,%eax
ja     1211 <GetRotMxOrder+0xf1>
mov    -0x20(%rbp),%rax
lea    0xe8e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xffffffff,-0x4(%rbp)
jmp    121d <GetRotMxOrder+0xfd>
movl   $0xfffffffa,-0x4(%rbp)
jmp    121d <GetRotMxOrder+0xfd>
cmpl   $0xffffffff,-0x14(%rbp)
jne    11a9 <GetRotMxOrder+0x89>
movl   $0xfffffffc,-0x4(%rbp)
jmp    121d <GetRotMxOrder+0xfd>
movl   $0x2,-0x4(%rbp)
jmp    121d <GetRotMxOrder+0xfd>
cmpl   $0xffffffff,-0x14(%rbp)
jne    11cb <GetRotMxOrder+0xab>
movl   $0xfffffffd,-0x4(%rbp)
jmp    121d <GetRotMxOrder+0xfd>
movl   $0x3,-0x4(%rbp)
jmp    121d <GetRotMxOrder+0xfd>
cmpl   $0xffffffff,-0x14(%rbp)
jne    11ed <GetRotMxOrder+0xcd>
movl   $0xfffffffe,-0x4(%rbp)
jmp    121d <GetRotMxOrder+0xfd>
movl   $0x4,-0x4(%rbp)
jmp    121d <GetRotMxOrder+0xfd>
movl   $0x6,-0x4(%rbp)
jmp    121d <GetRotMxOrder+0xfd>
movl   $0x1,-0x4(%rbp)
jmp    121d <GetRotMxOrder+0xfd>
jmp    1216 <GetRotMxOrder+0xf6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetRotMxOrder>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <deterRotMx@plt>
mov    %eax,%ebp
cmp    $0x1,%eax
je     1137 <GetRotMxOrder+0x17>
cmp    $0xffffffff,%ebp
jne    1165 <GetRotMxOrder+0x45>
mov    %rbx,%rdi
call   1030 <traceRotMx@plt>
mov    %eax,%ecx
add    $0x3,%ecx
cmp    $0x6,%ecx
ja     1165 <GetRotMxOrder+0x45>
mov    $0xffffffff,%eax
lea    0xeab(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0xfffffffa,%eax
jmp    1167 <GetRotMxOrder+0x47>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
cmp    $0xffffffff,%ebp
mov    $0xfffffffc,%ecx
mov    $0x2,%eax
cmove  %ecx,%eax
jmp    1167 <GetRotMxOrder+0x47>
cmp    $0xffffffff,%ebp
mov    $0xfffffffd,%ecx
mov    $0x3,%eax
cmove  %ecx,%eax
jmp    1167 <GetRotMxOrder+0x47>
cmp    $0xffffffff,%ebp
mov    $0xfffffffe,%ecx
mov    $0x4,%eax
cmove  %ecx,%eax
jmp    1167 <GetRotMxOrder+0x47>
mov    $0x6,%eax
jmp    1167 <GetRotMxOrder+0x47>
mov    $0x1,%eax
jmp    1167 <GetRotMxOrder+0x47>

LLVM IR (-O0):
define i32 @GetRotMxOrder(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i32 @deterRotMx(i32* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, -1
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %35
12: ; preds = %9, %1
%13 = load i32*, i32** %3
%14 = call i32 @traceRotMx(i32* %13)
switch i32 %14, label %34 [
i32 -3, label %15
i32 -2, label %16
i32 -1, label %17
i32 0, label %22
i32 1, label %27
i32 2, label %32
i32 3, label %33
]
15: ; preds = %12
store i32 -1, i32* %2
br label %36
16: ; preds = %12
store i32 -6, i32* %2
br label %36
17: ; preds = %12
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 -4, i32* %2
br label %36
21: ; preds = %17
store i32 2, i32* %2
br label %36
22: ; preds = %12
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 -3, i32* %2
br label %36
26: ; preds = %22
store i32 3, i32* %2
br label %36
27: ; preds = %12
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 -2, i32* %2
br label %36
31: ; preds = %27
store i32 4, i32* %2
br label %36
32: ; preds = %12
store i32 6, i32* %2
br label %36
33: ; preds = %12
store i32 1, i32* %2
br label %36
34: ; preds = %12
br label %35
35: ; preds = %34, %9
store i32 0, i32* %2
br label %36
36: ; preds = %35, %33, %32, %31, %30, %26, %25, %21, %20, %16, %15
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
define i32 @GetRotMxOrder(i32* %0) {
%2 = tail call i32 @deterRotMx(i32* %0)
%3 = icmp eq i32 %2, -1
switch i32 %2, label %15 [
i32 -1, label %4
i32 1, label %4
]
4: ; preds = %1, %1
%5 = tail call i32 @traceRotMx(i32* %0)
switch i32 %5, label %15 [
i32 -3, label %16
i32 -2, label %6
i32 -1, label %7
i32 0, label %9
i32 1, label %11
i32 2, label %13
i32 3, label %14
]
6: ; preds = %4
br label %16
7: ; preds = %4
%8 = select i1 %3, i32 -4, i32 2
br label %16
9: ; preds = %4
%10 = select i1 %3, i32 -3, i32 3
br label %16
11: ; preds = %4
%12 = select i1 %3, i32 -2, i32 4
br label %16
13: ; preds = %4
br label %16
14: ; preds = %4
br label %16
15: ; preds = %1, %4
br label %16
16: ; preds = %11, %9, %7, %4, %15, %14, %13, %6
%17 = phi i32 [ 0, %15 ], [ 1, %14 ], [ 6, %13 ], [ -6, %6 ], [ -1, %4 ], [ %8, %7 ], [ %10, %9 ], [ %12, %11 ]
ret i32 %17
}