#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 Abc_Tt4Check2(int, int, int, int *, int *);
int Abc_Tt4CheckTwoLevel(int t) {
  int pair1, pair2;
  int f[4] = {0xAAAA, 0xCCCC, 0xF0F0, 0xFF00};
  int r[4] = {0x5555, 0x3333, 0x0F0F, 0x00FF};
  if ((pair1 = Abc_Tt4Check2(t, 0, 1, f, r)) >= 0 &&
      (pair2 = Abc_Tt4Check2(t, 2, 3, f, r)) >= 0)
    return (1 << 4) | (pair2 << 2) | pair1;
  if ((pair1 = Abc_Tt4Check2(t, 0, 2, f, r)) >= 0 &&
      (pair2 = Abc_Tt4Check2(t, 1, 3, f, r)) >= 0)
    return (2 << 4) | (pair2 << 2) | pair1;
  if ((pair1 = Abc_Tt4Check2(t, 0, 3, f, r)) >= 0 &&
      (pair2 = Abc_Tt4Check2(t, 1, 2, f, r)) >= 0)
    return (3 << 4) | (pair2 << 2) | pair1;
  return -1;
}


x86 assembly (clang, -O0):
<Abc_Tt4CheckTwoLevel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed5(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rcx
lea    -0x30(%rbp),%r8
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <Abc_Tt4Check2@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jl     11a4 <Abc_Tt4CheckTwoLevel+0x94>
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rcx
lea    -0x30(%rbp),%r8
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <Abc_Tt4Check2@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jl     11a4 <Abc_Tt4CheckTwoLevel+0x94>
mov    -0x10(%rbp),%eax
shl    $0x2,%eax
or     $0x10,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1265 <Abc_Tt4CheckTwoLevel+0x155>
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rcx
lea    -0x30(%rbp),%r8
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <Abc_Tt4Check2@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jl     1201 <Abc_Tt4CheckTwoLevel+0xf1>
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rcx
lea    -0x30(%rbp),%r8
mov    $0x1,%esi
mov    $0x3,%edx
call   1030 <Abc_Tt4Check2@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jl     1201 <Abc_Tt4CheckTwoLevel+0xf1>
mov    -0x10(%rbp),%eax
shl    $0x2,%eax
or     $0x20,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1265 <Abc_Tt4CheckTwoLevel+0x155>
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rcx
lea    -0x30(%rbp),%r8
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <Abc_Tt4Check2@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jl     125e <Abc_Tt4CheckTwoLevel+0x14e>
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rcx
lea    -0x30(%rbp),%r8
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <Abc_Tt4Check2@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jl     125e <Abc_Tt4CheckTwoLevel+0x14e>
mov    -0x10(%rbp),%eax
shl    $0x2,%eax
or     $0x30,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1265 <Abc_Tt4CheckTwoLevel+0x155>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Abc_Tt4CheckTwoLevel>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xee3(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%rcx
mov    %rsp,%r8
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <Abc_Tt4Check2@plt>
test   %eax,%eax
js     1175 <Abc_Tt4CheckTwoLevel+0x65>
mov    %eax,%ebp
lea    0x10(%rsp),%rcx
mov    %rsp,%r8
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <Abc_Tt4Check2@plt>
test   %eax,%eax
js     1175 <Abc_Tt4CheckTwoLevel+0x65>
shl    $0x2,%eax
or     %eax,%ebp
or     $0x10,%ebp
jmp    1204 <Abc_Tt4CheckTwoLevel+0xf4>
lea    0x10(%rsp),%rcx
mov    %rsp,%r8
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <Abc_Tt4Check2@plt>
test   %eax,%eax
js     11b8 <Abc_Tt4CheckTwoLevel+0xa8>
mov    %eax,%ebp
lea    0x10(%rsp),%rcx
mov    %rsp,%r8
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x3,%edx
call   1030 <Abc_Tt4Check2@plt>
test   %eax,%eax
js     11b8 <Abc_Tt4CheckTwoLevel+0xa8>
shl    $0x2,%eax
or     %eax,%ebp
or     $0x20,%ebp
jmp    1204 <Abc_Tt4CheckTwoLevel+0xf4>
lea    0x10(%rsp),%rcx
mov    %rsp,%r8
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <Abc_Tt4Check2@plt>
mov    $0xffffffff,%ebp
test   %eax,%eax
js     1204 <Abc_Tt4CheckTwoLevel+0xf4>
mov    %eax,%r14d
lea    0x10(%rsp),%rcx
mov    %rsp,%r8
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <Abc_Tt4Check2@plt>
test   %eax,%eax
js     1204 <Abc_Tt4CheckTwoLevel+0xf4>
shl    $0x2,%eax
or     %eax,%r14d
or     $0x30,%r14d
mov    %r14d,%ebp
mov    %ebp,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.Abc_Tt4CheckTwoLevel.f = [4 x i32] [i32 43690, i32 52428, i32 61680, i32 65280]
@__const.Abc_Tt4CheckTwoLevel.r = [4 x i32] [i32 21845, i32 13107, i32 3855, i32 255]
define i32 @Abc_Tt4CheckTwoLevel(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [4 x i32]
%7 = alloca [4 x i32]
store i32 %0, i32* %3
%8 = bitcast [4 x i32]* %6 to i8*
%9 = bitcast [4 x i32]* %7 to i8*
%10 = load i32, i32* %3
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%13 = call i32 @Abc_Tt4Check2(i32 %10, i32 0, i32 1, i32* %11, i32* %12)
store i32 %13, i32* %4
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %1
%16 = load i32, i32* %3
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%19 = call i32 @Abc_Tt4Check2(i32 %16, i32 2, i32 3, i32* %17, i32* %18)
store i32 %19, i32* %5
%20 = icmp sge i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %15
%22 = load i32, i32* %5
%23 = shl i32 %22, 2
%24 = or i32 16, %23
%25 = load i32, i32* %4
%26 = or i32 %24, %25
store i32 %26, i32* %2
br label %64
27: ; preds = %15, %1
%28 = load i32, i32* %3
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%31 = call i32 @Abc_Tt4Check2(i32 %28, i32 0, i32 2, i32* %29, i32* %30)
store i32 %31, i32* %4
%32 = icmp sge i32 %31, 0
br i1 %32, label %33, label %45
33: ; preds = %27
%34 = load i32, i32* %3
%35 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%36 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%37 = call i32 @Abc_Tt4Check2(i32 %34, i32 1, i32 3, i32* %35, i32* %36)
store i32 %37, i32* %5
%38 = icmp sge i32 %37, 0
br i1 %38, label %39, label %45
39: ; preds = %33
%40 = load i32, i32* %5
%41 = shl i32 %40, 2
%42 = or i32 32, %41
%43 = load i32, i32* %4
%44 = or i32 %42, %43
store i32 %44, i32* %2
br label %64
45: ; preds = %33, %27
%46 = load i32, i32* %3
%47 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%48 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%49 = call i32 @Abc_Tt4Check2(i32 %46, i32 0, i32 3, i32* %47, i32* %48)
store i32 %49, i32* %4
%50 = icmp sge i32 %49, 0
br i1 %50, label %51, label %63
51: ; preds = %45
%52 = load i32, i32* %3
%53 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%54 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%55 = call i32 @Abc_Tt4Check2(i32 %52, i32 1, i32 2, i32* %53, i32* %54)
store i32 %55, i32* %5
%56 = icmp sge i32 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %51
%58 = load i32, i32* %5
%59 = shl i32 %58, 2
%60 = or i32 48, %59
%61 = load i32, i32* %4
%62 = or i32 %60, %61
store i32 %62, i32* %2
br label %64
63: ; preds = %51, %45
store i32 -1, i32* %2
br label %64
64: ; preds = %63, %57, %39, %21
%65 = load i32, i32* %2
ret i32 %65
}

LLVM IR (-O2):
@__const.Abc_Tt4CheckTwoLevel.f = [4 x i32] [i32 43690, i32 52428, i32 61680, i32 65280]
@__const.Abc_Tt4CheckTwoLevel.r = [4 x i32] [i32 21845, i32 13107, i32 3855, i32 255]
define i32 @Abc_Tt4CheckTwoLevel(i32 %0) {
%2 = alloca [4 x i32]
%3 = alloca [4 x i32]
%4 = bitcast [4 x i32]* %2 to i8*
%5 = bitcast [4 x i32]* %3 to i8*
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%8 = call i32 @Abc_Tt4Check2(i32 %0, i32 0, i32 1, i32* %6, i32* %7)
%9 = icmp sgt i32 %8, -1
br i1 %9, label %10, label %17
10: ; preds = %1
%11 = call i32 @Abc_Tt4Check2(i32 %0, i32 2, i32 3, i32* %6, i32* %7)
%12 = icmp sgt i32 %11, -1
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = shl i32 %11, 2
%15 = or i32 %8, %14
%16 = or i32 %15, 16
br label %37
17: ; preds = %10, %1
%18 = call i32 @Abc_Tt4Check2(i32 %0, i32 0, i32 2, i32* %6, i32* %7)
%19 = icmp sgt i32 %18, -1
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = call i32 @Abc_Tt4Check2(i32 %0, i32 1, i32 3, i32* %6, i32* %7)
%22 = icmp sgt i32 %21, -1
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = shl i32 %21, 2
%25 = or i32 %18, %24
%26 = or i32 %25, 32
br label %37
27: ; preds = %20, %17
%28 = call i32 @Abc_Tt4Check2(i32 %0, i32 0, i32 3, i32* %6, i32* %7)
%29 = icmp sgt i32 %28, -1
br i1 %29, label %30, label %37
30: ; preds = %27
%31 = call i32 @Abc_Tt4Check2(i32 %0, i32 1, i32 2, i32* %6, i32* %7)
%32 = icmp sgt i32 %31, -1
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = shl i32 %31, 2
%35 = or i32 %28, %34
%36 = or i32 %35, 48
br label %37
37: ; preds = %27, %30, %33, %23, %13
%38 = phi i32 [ %16, %13 ], [ %26, %23 ], [ %36, %33 ], [ -1, %30 ], [ -1, %27 ]
ret i32 %38
}