#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 FastestFirstEndSolve(unsigned char *, int, int, int, int, int, int);
int NoParEndSolve(unsigned char *, int, int, int, int, int, int);
int ParEndSolve(unsigned char *, int, int, int, int, int, int);
int EndSolve(unsigned char *board, int alpha, int beta, int color, int empties,
             int discdiff, int prevmove) {
  if (empties > 7)
    return FastestFirstEndSolve(board, alpha, beta, color, empties, discdiff,
                                prevmove);
  else {
    if (empties <= (2 > 4 ? 2 : 4))
      return NoParEndSolve(board, alpha, beta, color, empties, discdiff,
                           prevmove);
    else
      return ParEndSolve(board, alpha, beta, color, empties, discdiff,
                         prevmove);
  }
}


x86 assembly (clang, -O0):
<EndSolve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpl   $0x7,-0x20(%rbp)
jle    1182 <EndSolve+0x52>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <FastestFirstEndSolve@plt>
mov    %eax,-0x4(%rbp)
jmp    11d7 <EndSolve+0xa7>
cmpl   $0x4,-0x20(%rbp)
jg     11b4 <EndSolve+0x84>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <NoParEndSolve@plt>
mov    %eax,-0x4(%rbp)
jmp    11d7 <EndSolve+0xa7>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1050 <ParEndSolve@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EndSolve>:
push   %rax
mov    0x10(%rsp),%eax
cmp    $0x8,%r8d
jl     1145 <EndSolve+0x15>
mov    %eax,(%rsp)
call   1040 <FastestFirstEndSolve@plt>
pop    %rcx
ret
cmp    $0x4,%r8d
jg     1155 <EndSolve+0x25>
mov    %eax,(%rsp)
call   1030 <NoParEndSolve@plt>
pop    %rcx
ret
pop    %rax
jmp    1050 <ParEndSolve@plt>

LLVM IR (-O0):
define i32 @EndSolve(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i8* %0, i8** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
%16 = load i32, i32* %13
%17 = icmp sgt i32 %16, 7
br i1 %17, label %18, label %27
18: ; preds = %7
%19 = load i8*, i8** %9
%20 = load i32, i32* %10
%21 = load i32, i32* %11
%22 = load i32, i32* %12
%23 = load i32, i32* %13
%24 = load i32, i32* %14
%25 = load i32, i32* %15
%26 = call i32 @FastestFirstEndSolve(i8* %19, i32 %20, i32 %21, i32 %22, i32 %23, i32 %24, i32 %25)
store i32 %26, i32* %8
br label %48
27: ; preds = %7
%28 = load i32, i32* %13
%29 = icmp sle i32 %28, 4
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load i8*, i8** %9
%32 = load i32, i32* %10
%33 = load i32, i32* %11
%34 = load i32, i32* %12
%35 = load i32, i32* %13
%36 = load i32, i32* %14
%37 = load i32, i32* %15
%38 = call i32 @NoParEndSolve(i8* %31, i32 %32, i32 %33, i32 %34, i32 %35, i32 %36, i32 %37)
store i32 %38, i32* %8
br label %48
39: ; preds = %27
%40 = load i8*, i8** %9
%41 = load i32, i32* %10
%42 = load i32, i32* %11
%43 = load i32, i32* %12
%44 = load i32, i32* %13
%45 = load i32, i32* %14
%46 = load i32, i32* %15
%47 = call i32 @ParEndSolve(i8* %40, i32 %41, i32 %42, i32 %43, i32 %44, i32 %45, i32 %46)
store i32 %47, i32* %8
br label %48
48: ; preds = %39, %30, %18
%49 = load i32, i32* %8
ret i32 %49
}

LLVM IR (-O2):
define i32 @EndSolve(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = icmp sgt i32 %4, 7
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @FastestFirstEndSolve(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6)
br label %17
11: ; preds = %7
%12 = icmp slt i32 %4, 5
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = tail call i32 @NoParEndSolve(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6)
br label %17
15: ; preds = %11
%16 = tail call i32 @ParEndSolve(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6)
br label %17
17: ; preds = %15, %13, %9
%18 = phi i32 [ %10, %9 ], [ %14, %13 ], [ %16, %15 ]
ret i32 %18
}