#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 */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void send_search_output(int ply, int score, int time_ms, unsigned int nodes,
                        int pv_length, int *pos_from, int *pos_to,
                        int *promotion_type) {
  int i;
  uint64_t nps = nodes;
  if (time_ms)
    nps = 1000 * nps / time_ms;
  fprintf(stdout, "info depth %d score cp %d time %d nodes %d nps %ld pv", ply,
          score, time_ms, nodes, nps);
  for (i = 0; i < pv_length; i++) {
    int from = pos_from[i];
    int to = pos_to[i];
    int promotion = promotion_type[i];
    if (promotion) {
      char pt = 0;
      if (promotion == 1)
        pt = 'n';
      else if (promotion == 2)
        pt = 'b';
      else if (promotion == 3)
        pt = 'r';
      else if (promotion == 4)
        pt = 'q';
      fprintf(stdout, " %c%c%c%c%c", (from % 8) + 'a', (from / 8) + '1',
              (to % 8) + 'a', (to / 8) + '1', pt);
    } else {
      fprintf(stdout, " %c%c%c%c", (from % 8) + 'a', (from / 8) + '1',
              (to % 8) + 'a', (to / 8) + '1');
    }
  }
  fprintf(stdout, "\n");
}


x86 assembly (clang, -O0):
<send_search_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1152 <send_search_output+0x42>
imul   $0x3e8,-0x28(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x28(%rbp)
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    -0x28(%rbp),%eax
lea    0xe8d(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12fb <send_search_output+0x1eb>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2c(%rbp)
mov    0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x30(%rbp)
mov    0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1289 <send_search_output+0x179>
movb   $0x0,-0x35(%rbp)
cmpl   $0x1,-0x34(%rbp)
jne    11db <send_search_output+0xcb>
movb   $0x6e,-0x35(%rbp)
jmp    121e <send_search_output+0x10e>
cmpl   $0x2,-0x34(%rbp)
jne    11ee <send_search_output+0xde>
movb   $0x62,-0x35(%rbp)
jmp    1219 <send_search_output+0x109>
cmpl   $0x3,-0x34(%rbp)
jne    1201 <send_search_output+0xf1>
movb   $0x72,-0x35(%rbp)
jmp    1214 <send_search_output+0x104>
cmpl   $0x4,-0x34(%rbp)
jne    120f <send_search_output+0xff>
movb   $0x71,-0x35(%rbp)
jmp    1214 <send_search_output+0x104>
jmp    1219 <send_search_output+0x109>
jmp    121e <send_search_output+0x10e>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %edx,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
add    $0x31,%ecx
mov    -0x30(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    %edx,%r8d
add    $0x61,%r8d
mov    -0x30(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    -0x3c(%rbp),%edx
mov    %eax,%r9d
add    $0x31,%r9d
movsbl -0x35(%rbp),%eax
lea    0xdbc(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12e8 <send_search_output+0x1d8>
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %edx,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
add    $0x31,%ecx
mov    -0x30(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    %edx,%r8d
add    $0x61,%r8d
mov    -0x30(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    -0x40(%rbp),%edx
mov    %eax,%r9d
add    $0x31,%r9d
lea    0xd61(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12ed <send_search_output+0x1dd>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1184 <send_search_output+0x74>
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
lea    0xd41(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_search_output>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8d,%r14d
mov    %ecx,%r9d
mov    %edx,%r8d
mov    %esi,%ecx
mov    %edi,%r10d
mov    0x58(%rsp),%r12
mov    0x50(%rsp),%rbx
mov    %r9d,%eax
test   %edx,%edx
je     114d <send_search_output+0x3d>
imul   $0x3e8,%r9d,%eax
cltd
idiv   %r8d
mov    0x2e8c(%rip),%rdx
mov    (%rdx),%edi
mov    %eax,(%rsp)
lea    0xeb4(%rip),%rsi
mov    %r10d,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %r14d,%r14d
jle    128b <send_search_output+0x17b>
mov    %r14d,%r15d
lea    0xe83(%rip),%r14
xor    %r13d,%r13d
jmp    11f3 <send_search_output+0xe3>
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x2e49(%rip),%rcx
mov    (%rcx),%edi
lea    0x7(%rdx),%ecx
test   %edx,%edx
cmovns %edx,%ecx
mov    %ecx,%ebp
and    $0xfffffff8,%ebp
neg    %ebp
add    %ebp,%edx
add    $0x61,%edx
sar    $0x3,%ecx
add    $0x31,%ecx
lea    0x7(%rax),%r9d
test   %eax,%eax
cmovns %eax,%r9d
mov    %r9d,%ebp
and    $0xfffffff8,%ebp
neg    %ebp
lea    (%rax,%rbp,1),%r8d
add    $0x61,%r8d
sar    $0x3,%r9d
add    $0x31,%r9d
mov    %esi,(%rsp)
lea    0xe6b(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%r13
cmp    %r13,%r15
je     128b <send_search_output+0x17b>
mov    0x10(%rsp),%rax
mov    (%rax,%r13,4),%edx
mov    (%rbx,%r13,4),%eax
mov    (%r12,%r13,4),%ecx
cmp    $0x4,%rcx
ja     1182 <send_search_output+0x72>
mov    $0x6e,%esi
movslq (%r14,%rcx,4),%rcx
add    %r14,%rcx
jmp    *%rcx
mov    0x2dbd(%rip),%rcx
mov    (%rcx),%edi
lea    0x7(%rdx),%ecx
test   %edx,%edx
cmovns %edx,%ecx
mov    %ecx,%esi
and    $0xfffffff8,%esi
neg    %esi
add    %esi,%edx
add    $0x61,%edx
sar    $0x3,%ecx
add    $0x31,%ecx
lea    0x7(%rax),%r9d
test   %eax,%eax
cmovns %eax,%r9d
mov    %r9d,%esi
and    $0xfffffff8,%esi
neg    %esi
lea    (%rax,%rsi,1),%r8d
add    $0x61,%r8d
sar    $0x3,%r9d
add    $0x31,%r9d
lea    0xdee(%rip),%rsi
jmp    11df <send_search_output+0xcf>
mov    $0x62,%esi
jmp    1190 <send_search_output+0x80>
mov    $0x72,%esi
jmp    1190 <send_search_output+0x80>
mov    $0x71,%esi
jmp    1190 <send_search_output+0x80>
mov    0x2d4e(%rip),%rax
mov    (%rax),%edi
lea    0xdc5(%rip),%rsi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [54 x i8] c"info depth %d score cp %d time %d nodes %d nps %ld pv\00"
@.str.1 = [12 x i8] c" %c%c%c%c%c\00"
@.str.2 = [10 x i8] c" %c%c%c%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @send_search_output(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* %5, i32* %6, i32* %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%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 i8
store i32 %0, i32* %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
store i32* %7, i32** %16
%23 = load i32, i32* %12
store i32 %23, i32* %18
%24 = load i32, i32* %11
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %8
%27 = load i32, i32* %18
%28 = mul nsw i32 1000, %27
%29 = load i32, i32* %11
%30 = sdiv i32 %28, %29
store i32 %30, i32* %18
br label %31
31: ; preds = %26, %8
%32 = load i32, i32* @stdout
%33 = load i32, i32* %9
%34 = load i32, i32* %10
%35 = load i32, i32* %11
%36 = load i32, i32* %12
%37 = load i32, i32* %18
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %33, i32 %34, i32 %35, i32 %36, i32 %37)
store i32 0, i32* %17
br label %39
39: ; preds = %113, %31
%40 = load i32, i32* %17
%41 = load i32, i32* %13
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %116
43: ; preds = %39
%44 = load i32*, i32** %14
%45 = load i32, i32* %17
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
%48 = load i32, i32* %47
store i32 %48, i32* %19
%49 = load i32*, i32** %15
%50 = load i32, i32* %17
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
%53 = load i32, i32* %52
store i32 %53, i32* %20
%54 = load i32*, i32** %16
%55 = load i32, i32* %17
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %54, i64 %56
%58 = load i32, i32* %57
store i32 %58, i32* %21
%59 = load i32, i32* %21
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %97
61: ; preds = %43
store i8 0, i8* %22
%62 = load i32, i32* %21
%63 = icmp eq i32 %62, 1
br i1 %63, label %64, label %65
64: ; preds = %61
store i8 110, i8* %22
br label %80
65: ; preds = %61
%66 = load i32, i32* %21
%67 = icmp eq i32 %66, 2
br i1 %67, label %68, label %69
68: ; preds = %65
store i8 98, i8* %22
br label %79
69: ; preds = %65
%70 = load i32, i32* %21
%71 = icmp eq i32 %70, 3
br i1 %71, label %72, label %73
72: ; preds = %69
store i8 114, i8* %22
br label %78
73: ; preds = %69
%74 = load i32, i32* %21
%75 = icmp eq i32 %74, 4
br i1 %75, label %76, label %77
76: ; preds = %73
store i8 113, i8* %22
br label %77
77: ; preds = %76, %73
br label %78
78: ; preds = %77, %72
br label %79
79: ; preds = %78, %68
br label %80
80: ; preds = %79, %64
%81 = load i32, i32* @stdout
%82 = load i32, i32* %19
%83 = srem i32 %82, 8
%84 = add nsw i32 %83, 97
%85 = load i32, i32* %19
%86 = sdiv i32 %85, 8
%87 = add nsw i32 %86, 49
%88 = load i32, i32* %20
%89 = srem i32 %88, 8
%90 = add nsw i32 %89, 97
%91 = load i32, i32* %20
%92 = sdiv i32 %91, 8
%93 = add nsw i32 %92, 49
%94 = load i8, i8* %22
%95 = sext i8 %94 to i32
%96 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %84, i32 %87, i32 %90, i32 %93, i32 %95)
br label %112
97: ; preds = %43
%98 = load i32, i32* @stdout
%99 = load i32, i32* %19
%100 = srem i32 %99, 8
%101 = add nsw i32 %100, 97
%102 = load i32, i32* %19
%103 = sdiv i32 %102, 8
%104 = add nsw i32 %103, 49
%105 = load i32, i32* %20
%106 = srem i32 %105, 8
%107 = add nsw i32 %106, 97
%108 = load i32, i32* %20
%109 = sdiv i32 %108, 8
%110 = add nsw i32 %109, 49
%111 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %101, i32 %104, i32 %107, i32 %110)
br label %112
112: ; preds = %97, %80
br label %113
113: ; preds = %112
%114 = load i32, i32* %17
%115 = add nsw i32 %114, 1
store i32 %115, i32* %17
br label %39
116: ; preds = %39
%117 = load i32, i32* @stdout
%118 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [54 x i8] c"info depth %d score cp %d time %d nodes %d nps %ld pv\00"
@.str.1 = [12 x i8] c" %c%c%c%c%c\00"
@.str.2 = [10 x i8] c" %c%c%c%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @send_search_output(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* nocapture %5, i32* nocapture %6, i32* nocapture %7) {
%9 = icmp eq i32 %2, 0
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = mul nsw i32 %3, 1000
%12 = sdiv i32 %11, %2
br label %13
13: ; preds = %10, %8
%14 = phi i32 [ %12, %10 ], [ %3, %8 ]
%15 = load i32, i32* @stdout
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3, i32 %14)
%17 = icmp sgt i32 %4, 0
br i1 %17, label %18, label %58
18: ; preds = %13
%19 = zext i32 %4 to i64
br label %20
20: ; preds = %18, %55
%21 = phi i64 [ 0, %18 ], [ %56, %55 ]
%22 = getelementptr inbounds i32, i32* %5, i64 %21
%23 = load i32, i32* %22
%24 = getelementptr inbounds i32, i32* %6, i64 %21
%25 = load i32, i32* %24
%26 = getelementptr inbounds i32, i32* %7, i64 %21
%27 = load i32, i32* %26
switch i32 %27, label %31 [
i32 0, label %44
i32 1, label %32
i32 2, label %28
i32 3, label %29
i32 4, label %30
]
28: ; preds = %20
br label %32
29: ; preds = %20
br label %32
30: ; preds = %20
br label %32
31: ; preds = %20
br label %32
32: ; preds = %20, %31, %28, %30, %29
%33 = phi i32 [ 98, %28 ], [ 114, %29 ], [ 113, %30 ], [ 110, %20 ], [ 0, %31 ]
%34 = load i32, i32* @stdout
%35 = srem i32 %23, 8
%36 = add nsw i32 %35, 97
%37 = sdiv i32 %23, 8
%38 = add nsw i32 %37, 49
%39 = srem i32 %25, 8
%40 = add nsw i32 %39, 97
%41 = sdiv i32 %25, 8
%42 = add nsw i32 %41, 49
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %36, i32 %38, i32 %40, i32 %42, i32 %33)
br label %55
44: ; preds = %20
%45 = load i32, i32* @stdout
%46 = srem i32 %23, 8
%47 = add nsw i32 %46, 97
%48 = sdiv i32 %23, 8
%49 = add nsw i32 %48, 49
%50 = srem i32 %25, 8
%51 = add nsw i32 %50, 97
%52 = sdiv i32 %25, 8
%53 = add nsw i32 %52, 49
%54 = tail call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %47, i32 %49, i32 %51, i32 %53)
br label %55
55: ; preds = %44, %32
%56 = add nuw nsw i64 %21, 1
%57 = icmp eq i64 %56, %19
br i1 %57, label %58, label %20
58: ; preds = %55, %13
%59 = load i32, i32* @stdout
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}