#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*/ fprintf(int /*<<< orphan*/, char *, int, int, int, int, ...);
int /*<<< orphan*/ stdout;
void send_move(int pos_from, int pos_to, int promotion_type) {
  if (promotion_type) {
    char pt = 0;
    if (promotion_type == 1)
      pt = 'n';
    else if (promotion_type == 2)
      pt = 'b';
    else if (promotion_type == 3)
      pt = 'r';
    else if (promotion_type == 4)
      pt = 'q';
    fprintf(stdout, "bestmove %c%c%c%c%c\n", (pos_from % 8) + 'a',
            (pos_from / 8) + '1', (pos_to % 8) + 'a', (pos_to / 8) + '1', pt);
  } else {
    fprintf(stdout, "bestmove %c%c%c%c\n", (pos_from % 8) + 'a',
            (pos_from / 8) + '1', (pos_to % 8) + 'a', (pos_to / 8) + '1');
  }
}


x86 assembly (clang, -O0):
<send_move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11f0 <send_move+0xe0>
movb   $0x0,-0xd(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1142 <send_move+0x32>
movb   $0x6e,-0xd(%rbp)
jmp    1185 <send_move+0x75>
cmpl   $0x2,-0xc(%rbp)
jne    1155 <send_move+0x45>
movb   $0x62,-0xd(%rbp)
jmp    1180 <send_move+0x70>
cmpl   $0x3,-0xc(%rbp)
jne    1168 <send_move+0x58>
movb   $0x72,-0xd(%rbp)
jmp    117b <send_move+0x6b>
cmpl   $0x4,-0xc(%rbp)
jne    1176 <send_move+0x66>
movb   $0x71,-0xd(%rbp)
jmp    117b <send_move+0x6b>
jmp    1180 <send_move+0x70>
jmp    1185 <send_move+0x75>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
add    $0x31,%ecx
mov    -0x8(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    %edx,%r8d
add    $0x61,%r8d
mov    -0x8(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    -0x14(%rbp),%edx
mov    %eax,%r9d
add    $0x31,%r9d
movsbl -0xd(%rbp),%eax
lea    0xe1f(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    124f <send_move+0x13f>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %edx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
add    $0x31,%ecx
mov    -0x8(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    %edx,%r8d
add    $0x61,%r8d
mov    -0x8(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    -0x18(%rbp),%edx
mov    %eax,%r9d
add    $0x31,%r9d
lea    0xdcd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_move>:
push   %rax
cmp    $0x4,%edx
ja     1184 <send_move+0x74>
mov    $0x6e,%eax
mov    %edx,%ecx
lea    0xedc(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    0x2eac(%rip),%rax
mov    (%rax),%eax
lea    0x7(%rdi),%ecx
test   %edi,%edi
cmovns %edi,%ecx
mov    %ecx,%edx
and    $0xfffffff8,%edx
neg    %edx
sar    $0x3,%ecx
add    $0x31,%ecx
lea    0x7(%rsi),%r9d
test   %esi,%esi
cmovns %esi,%r9d
add    %edi,%edx
add    $0x61,%edx
mov    %r9d,%edi
and    $0xfffffff8,%edi
neg    %edi
lea    (%rsi,%rdi,1),%r8d
add    $0x61,%r8d
sar    $0x3,%r9d
add    $0x31,%r9d
lea    0xeb0(%rip),%rsi
mov    %eax,%edi
xor    %eax,%eax
pop    %r11
jmp    1030 <fprintf@plt>
xor    %eax,%eax
jmp    119b <send_move+0x8b>
mov    $0x62,%eax
jmp    119b <send_move+0x8b>
mov    $0x72,%eax
jmp    119b <send_move+0x8b>
mov    $0x71,%eax
mov    0x2e3e(%rip),%rcx
mov    (%rcx),%r10d
lea    0x7(%rdi),%ecx
test   %edi,%edi
cmovns %edi,%ecx
mov    %ecx,%edx
and    $0xfffffff8,%edx
neg    %edx
add    %edi,%edx
add    $0x61,%edx
sar    $0x3,%ecx
add    $0x31,%ecx
lea    0x7(%rsi),%r9d
test   %esi,%esi
cmovns %esi,%r9d
mov    %r9d,%edi
and    $0xfffffff8,%edi
neg    %edi
lea    (%rsi,%rdi,1),%r8d
add    $0x61,%r8d
sar    $0x3,%r9d
add    $0x31,%r9d
mov    %eax,(%rsp)
lea    0xe29(%rip),%rsi
mov    %r10d,%edi
xor    %eax,%eax
call   1030 <fprintf@plt>
pop    %rax
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [21 x i8] c"bestmove %c%c%c%c%c\0A\00"
@.str.1 = [19 x i8] c"bestmove %c%c%c%c\0A\00"
define void @send_move(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %46
10: ; preds = %3
store i8 0, i8* %7
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %10
store i8 110, i8* %7
br label %29
14: ; preds = %10
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %18
17: ; preds = %14
store i8 98, i8* %7
br label %28
18: ; preds = %14
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %22
21: ; preds = %18
store i8 114, i8* %7
br label %27
22: ; preds = %18
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, 4
br i1 %24, label %25, label %26
25: ; preds = %22
store i8 113, i8* %7
br label %26
26: ; preds = %25, %22
br label %27
27: ; preds = %26, %21
br label %28
28: ; preds = %27, %17
br label %29
29: ; preds = %28, %13
%30 = load i32, i32* @stdout
%31 = load i32, i32* %4
%32 = srem i32 %31, 8
%33 = add nsw i32 %32, 97
%34 = load i32, i32* %4
%35 = sdiv i32 %34, 8
%36 = add nsw i32 %35, 49
%37 = load i32, i32* %5
%38 = srem i32 %37, 8
%39 = add nsw i32 %38, 97
%40 = load i32, i32* %5
%41 = sdiv i32 %40, 8
%42 = add nsw i32 %41, 49
%43 = load i8, i8* %7
%44 = sext i8 %43 to i32
%45 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %33, i32 %36, i32 %39, i32 %42, i32 %44)
br label %61
46: ; preds = %3
%47 = load i32, i32* @stdout
%48 = load i32, i32* %4
%49 = srem i32 %48, 8
%50 = add nsw i32 %49, 97
%51 = load i32, i32* %4
%52 = sdiv i32 %51, 8
%53 = add nsw i32 %52, 49
%54 = load i32, i32* %5
%55 = srem i32 %54, 8
%56 = add nsw i32 %55, 97
%57 = load i32, i32* %5
%58 = sdiv i32 %57, 8
%59 = add nsw i32 %58, 49
%60 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %50, i32 %53, i32 %56, i32 %59)
br label %61
61: ; preds = %46, %29
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [21 x i8] c"bestmove %c%c%c%c%c\0A\00"
@.str.1 = [19 x i8] c"bestmove %c%c%c%c\0A\00"
define void @send_move(i32 %0, i32 %1, i32 %2) {
switch i32 %2, label %7 [
i32 0, label %20
i32 1, label %8
i32 2, label %4
i32 3, label %5
i32 4, label %6
]
4: ; preds = %3
br label %8
5: ; preds = %3
br label %8
6: ; preds = %3
br label %8
7: ; preds = %3
br label %8
8: ; preds = %3, %7, %4, %6, %5
%9 = phi i32 [ 98, %4 ], [ 114, %5 ], [ 113, %6 ], [ 110, %3 ], [ 0, %7 ]
%10 = load i32, i32* @stdout
%11 = srem i32 %0, 8
%12 = add nsw i32 %11, 97
%13 = sdiv i32 %0, 8
%14 = add nsw i32 %13, 49
%15 = srem i32 %1, 8
%16 = add nsw i32 %15, 97
%17 = sdiv i32 %1, 8
%18 = add nsw i32 %17, 49
%19 = tail call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14, i32 %16, i32 %18, i32 %9)
br label %31
20: ; preds = %3
%21 = load i32, i32* @stdout
%22 = srem i32 %0, 8
%23 = add nsw i32 %22, 97
%24 = sdiv i32 %0, 8
%25 = add nsw i32 %24, 49
%26 = srem i32 %1, 8
%27 = add nsw i32 %26, 97
%28 = sdiv i32 %1, 8
%29 = add nsw i32 %28, 49
%30 = tail call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %25, i32 %27, i32 %29)
br label %31
31: ; preds = %20, %8
ret void
}