#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 */
struct node {
  int dummy;
};

/* Variables and functions */
char get_piece(char *, char, char);
int is_occupied(char *, char, char);
struct node *store_move(struct node *, char *, int /*<<< orphan*/,
                        struct node *, char, char, char, char);
struct node *get_king_moves_black(struct node *currentNode, char *board,
                                  struct node *parentNode) {
  char x, y;
  int numMoves = 0;
  for (x = 'a'; x <= 'h'; x++) {
    for (y = '1'; y <= '8'; y++) {
      char p = get_piece(board, x, y);
      if (p == 'k') {
        if ((y < '8') && (is_occupied(board, x, y + 1) != -1)) {
          currentNode =
              store_move(currentNode, board, 0, parentNode, x, y, x, y + 1);
          numMoves++;
        }
        if ((x < 'h') && (y < '8') &&
            (is_occupied(board, x + 1, y + 1) != -1)) {
          currentNode =
              store_move(currentNode, board, 0, parentNode, x, y, x + 1, y + 1);
          numMoves++;
        }
        if ((x < 'h') && (is_occupied(board, x + 1, y) != -1)) {
          currentNode =
              store_move(currentNode, board, 0, parentNode, x, y, x + 1, y);
          numMoves++;
        }
        if ((x < 'h') && (y > '1') &&
            (is_occupied(board, x + 1, y - 1) != -1)) {
          currentNode =
              store_move(currentNode, board, 0, parentNode, x, y, x + 1, y - 1);
          numMoves++;
        }
        if ((y > '1') && (is_occupied(board, x, y - 1) != -1)) {
          currentNode =
              store_move(currentNode, board, 0, parentNode, x, y, x, y - 1);
          numMoves++;
        }
        if ((x > 'a') && (y > '1') &&
            (is_occupied(board, x - 1, y - 1) != -1)) {
          currentNode =
              store_move(currentNode, board, 0, parentNode, x, y, x - 1, y - 1);
          numMoves++;
        }
        if ((x > 'a') && (is_occupied(board, x - 1, y) != -1)) {
          currentNode =
              store_move(currentNode, board, 0, parentNode, x, y, x - 1, y);
          numMoves++;
        }
        if ((x > 'a') && (y < '8') &&
            (is_occupied(board, x - 1, y + 1) != -1)) {
          currentNode =
              store_move(currentNode, board, 0, parentNode, x, y, x - 1, y + 1);
          numMoves++;
        }
      }
    }
  }
  return currentNode;
}


x86 assembly (clang, -O0):
<get_king_moves_black>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movb   $0x61,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x68,%eax
jg     15d7 <get_king_moves_black+0x4a7>
movb   $0x31,-0x1a(%rbp)
movsbl -0x1a(%rbp),%eax
cmp    $0x38,%eax
jg     15c5 <get_king_moves_black+0x495>
mov    -0x10(%rbp),%rdi
mov    -0x19(%rbp),%al
movsbl %al,%esi
movsbl -0x1a(%rbp),%edx
call   1040 <get_piece@plt>
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x6b,%eax
jne    15b3 <get_king_moves_black+0x483>
movsbl -0x1a(%rbp),%eax
cmp    $0x38,%eax
jge    1209 <get_king_moves_black+0xd9>
mov    -0x10(%rbp),%rdi
mov    -0x19(%rbp),%cl
movsbl -0x1a(%rbp),%eax
add    $0x1,%eax
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     1209 <get_king_moves_black+0xd9>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
mov    -0x19(%rbp),%r10b
movsbl -0x1a(%rbp),%eax
add    $0x1,%eax
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
movsbl %al,%eax
mov    %eax,0x8(%rsp)
call   1050 <store_move@plt>
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x68,%eax
jge    129b <get_king_moves_black+0x16b>
movsbl -0x1a(%rbp),%eax
cmp    $0x38,%eax
jge    129b <get_king_moves_black+0x16b>
mov    -0x10(%rbp),%rdi
movsbl -0x19(%rbp),%eax
add    $0x1,%eax
mov    %al,%cl
movsbl -0x1a(%rbp),%eax
add    $0x1,%eax
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     129b <get_king_moves_black+0x16b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
movsbl -0x19(%rbp),%eax
add    $0x1,%eax
mov    %al,%r10b
movsbl -0x1a(%rbp),%eax
add    $0x1,%eax
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
movsbl %al,%eax
mov    %eax,0x8(%rsp)
call   1050 <store_move@plt>
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x68,%eax
jge    130d <get_king_moves_black+0x1dd>
mov    -0x10(%rbp),%rdi
movsbl -0x19(%rbp),%eax
add    $0x1,%eax
movsbl %al,%esi
movsbl -0x1a(%rbp),%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     130d <get_king_moves_black+0x1dd>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
movsbl -0x19(%rbp),%eax
add    $0x1,%eax
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %al,%eax
mov    %eax,(%rsp)
movsbl -0x1a(%rbp),%eax
mov    %eax,0x8(%rsp)
call   1050 <store_move@plt>
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x68,%eax
jge    139f <get_king_moves_black+0x26f>
movsbl -0x1a(%rbp),%eax
cmp    $0x31,%eax
jle    139f <get_king_moves_black+0x26f>
mov    -0x10(%rbp),%rdi
movsbl -0x19(%rbp),%eax
add    $0x1,%eax
mov    %al,%cl
movsbl -0x1a(%rbp),%eax
sub    $0x1,%eax
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     139f <get_king_moves_black+0x26f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
movsbl -0x19(%rbp),%eax
add    $0x1,%eax
mov    %al,%r10b
movsbl -0x1a(%rbp),%eax
sub    $0x1,%eax
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
movsbl %al,%eax
mov    %eax,0x8(%rsp)
call   1050 <store_move@plt>
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsbl -0x1a(%rbp),%eax
cmp    $0x31,%eax
jle    1418 <get_king_moves_black+0x2e8>
mov    -0x10(%rbp),%rdi
mov    -0x19(%rbp),%cl
movsbl -0x1a(%rbp),%eax
sub    $0x1,%eax
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     1418 <get_king_moves_black+0x2e8>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
mov    -0x19(%rbp),%r10b
movsbl -0x1a(%rbp),%eax
sub    $0x1,%eax
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
movsbl %al,%eax
mov    %eax,0x8(%rsp)
call   1050 <store_move@plt>
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x61,%eax
jle    14aa <get_king_moves_black+0x37a>
movsbl -0x1a(%rbp),%eax
cmp    $0x31,%eax
jle    14aa <get_king_moves_black+0x37a>
mov    -0x10(%rbp),%rdi
movsbl -0x19(%rbp),%eax
sub    $0x1,%eax
mov    %al,%cl
movsbl -0x1a(%rbp),%eax
sub    $0x1,%eax
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     14aa <get_king_moves_black+0x37a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
movsbl -0x19(%rbp),%eax
sub    $0x1,%eax
mov    %al,%r10b
movsbl -0x1a(%rbp),%eax
sub    $0x1,%eax
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
movsbl %al,%eax
mov    %eax,0x8(%rsp)
call   1050 <store_move@plt>
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x61,%eax
jle    151c <get_king_moves_black+0x3ec>
mov    -0x10(%rbp),%rdi
movsbl -0x19(%rbp),%eax
sub    $0x1,%eax
movsbl %al,%esi
movsbl -0x1a(%rbp),%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     151c <get_king_moves_black+0x3ec>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
movsbl -0x19(%rbp),%eax
sub    $0x1,%eax
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %al,%eax
mov    %eax,(%rsp)
movsbl -0x1a(%rbp),%eax
mov    %eax,0x8(%rsp)
call   1050 <store_move@plt>
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x61,%eax
jle    15ae <get_king_moves_black+0x47e>
movsbl -0x1a(%rbp),%eax
cmp    $0x38,%eax
jge    15ae <get_king_moves_black+0x47e>
mov    -0x10(%rbp),%rdi
movsbl -0x19(%rbp),%eax
sub    $0x1,%eax
mov    %al,%cl
movsbl -0x1a(%rbp),%eax
add    $0x1,%eax
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     15ae <get_king_moves_black+0x47e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
movsbl -0x19(%rbp),%eax
sub    $0x1,%eax
mov    %al,%r10b
movsbl -0x1a(%rbp),%eax
add    $0x1,%eax
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
movsbl %al,%eax
mov    %eax,0x8(%rsp)
call   1050 <store_move@plt>
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    15b3 <get_king_moves_black+0x483>
jmp    15b8 <get_king_moves_black+0x488>
mov    -0x1a(%rbp),%al
add    $0x1,%al
mov    %al,-0x1a(%rbp)
jmp    1160 <get_king_moves_black+0x30>
jmp    15ca <get_king_moves_black+0x49a>
mov    -0x19(%rbp),%al
add    $0x1,%al
mov    %al,-0x19(%rbp)
jmp    114f <get_king_moves_black+0x1f>
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_king_moves_black>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,0x10(%rsp)
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
mov    $0x61,%bpl
jmp    115e <get_king_moves_black+0x2e>
mov    0x1c(%rsp),%eax
mov    %eax,%ebp
cmp    $0x69,%al
je     1421 <get_king_moves_black+0x2f1>
lea    0x1(%rbp),%eax
mov    %eax,0x1c(%rsp)
lea    -0x1(%rbp),%eax
mov    %eax,0x2c(%rsp)
mov    $0x30,%r13b
mov    %rbp,0x30(%rsp)
jmp    118b <get_king_moves_black+0x5b>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x38,%r13b
mov    0x30(%rsp),%rbp
je     1150 <get_king_moves_black+0x20>
mov    %r13d,%r15d
lea    0x1(%r15),%r13d
movsbl %bpl,%r14d
movsbl %r13b,%r12d
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r12d,%edx
call   1040 <get_piece@plt>
cmp    $0x6b,%al
jne    1180 <get_king_moves_black+0x50>
cmp    $0x38,%r13b
jae    1250 <get_king_moves_black+0x120>
lea    0x2(%r15),%eax
movsbl %al,%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     11f5 <get_king_moves_black+0xc5>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    0x10(%rsp),%rcx
mov    %r14d,%r8d
mov    %r12d,%r9d
push   %rbp
push   %r14
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
cmpb   $0x67,0x30(%rsp)
ja     12e3 <get_king_moves_black+0x1b3>
movsbl 0x1c(%rsp),%esi
mov    %rbx,%rdi
mov    %rsi,0x20(%rsp)
mov    %ebp,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     125a <get_king_moves_black+0x12a>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    0x10(%rsp),%rcx
mov    %r14d,%r8d
mov    %r12d,%r9d
push   %rbp
push   0x28(%rsp)
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
jmp    125a <get_king_moves_black+0x12a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x68,%bpl
jae    12f0 <get_king_moves_black+0x1c0>
movsbl 0x1c(%rsp),%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     1297 <get_king_moves_black+0x167>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    0x10(%rsp),%rcx
mov    %r14d,%r8d
mov    %r12d,%r9d
push   %r12
push   %rbp
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
cmp    $0x32,%r13b
jb     137a <get_king_moves_black+0x24a>
movsbl %r15b,%edx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rdx,0x20(%rsp)
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     12f0 <get_king_moves_black+0x1c0>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    0x10(%rsp),%rcx
mov    %r14d,%r8d
mov    %r12d,%r9d
push   0x20(%rsp)
push   %rbp
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
jmp    12f0 <get_king_moves_black+0x1c0>
cmp    $0x31,%r13b
jbe    137a <get_king_moves_black+0x24a>
nopl   (%rax)
movsbl %r15b,%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     132c <get_king_moves_black+0x1fc>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    0x10(%rsp),%rcx
mov    %r14d,%r8d
mov    %r12d,%r9d
push   %rbp
push   %r14
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
cmpb   $0x62,0x30(%rsp)
jb     1180 <get_king_moves_black+0x50>
movsbl 0x2c(%rsp),%esi
mov    %rbx,%rdi
mov    %rsi,0x20(%rsp)
mov    %ebp,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     1385 <get_king_moves_black+0x255>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    0x10(%rsp),%rcx
mov    %r14d,%r8d
mov    %r12d,%r9d
push   %rbp
push   0x28(%rsp)
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
jmp    1385 <get_king_moves_black+0x255>
cmpb   $0x61,0x30(%rsp)
jbe    1180 <get_king_moves_black+0x50>
movsbl 0x2c(%rsp),%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     13ce <get_king_moves_black+0x29e>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    0x10(%rsp),%rcx
mov    %r14d,%r8d
mov    %r12d,%r9d
push   %r12
push   %rbp
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
cmp    $0x38,%r13b
jae    1180 <get_king_moves_black+0x50>
jmp    13d8 <get_king_moves_black+0x2a8>
cmp    $0x37,%r13b
ja     1180 <get_king_moves_black+0x50>
add    $0x2,%r15b
movsbl %r15b,%r15d
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
call   1030 <is_occupied@plt>
cmp    $0xffffffff,%eax
je     1180 <get_king_moves_black+0x50>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    0x10(%rsp),%rcx
mov    %r14d,%r8d
mov    %r12d,%r9d
push   %r15
push   %rbp
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
jmp    1180 <get_king_moves_black+0x50>
mov    0x8(%rsp),%rax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define %struct.node* @get_king_moves_black(%struct.node* %0, i8* %1, %struct.node* %2) {
%4 = alloca %struct.node*
%5 = alloca i8*
%6 = alloca %struct.node*
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
%10 = alloca i8
store %struct.node* %0, %struct.node** %4
store i8* %1, i8** %5
store %struct.node* %2, %struct.node** %6
store i32 0, i32* %9
store i8 97, i8* %7
br label %11
11: ; preds = %290, %3
%12 = load i8, i8* %7
%13 = sext i8 %12 to i32
%14 = icmp sle i32 %13, 104
br i1 %14, label %15, label %293
15: ; preds = %11
store i8 49, i8* %8
br label %16
16: ; preds = %286, %15
%17 = load i8, i8* %8
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 56
br i1 %19, label %20, label %289
20: ; preds = %16
%21 = load i8*, i8** %5
%22 = load i8, i8* %7
%23 = load i8, i8* %8
%24 = call signext i8 @get_piece(i8* %21, i8 signext %22, i8 signext %23)
store i8 %24, i8* %10
%25 = load i8, i8* %10
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 107
br i1 %27, label %28, label %285
28: ; preds = %20
%29 = load i8, i8* %8
%30 = sext i8 %29 to i32
%31 = icmp slt i32 %30, 56
br i1 %31, label %32, label %55
32: ; preds = %28
%33 = load i8*, i8** %5
%34 = load i8, i8* %7
%35 = load i8, i8* %8
%36 = sext i8 %35 to i32
%37 = add nsw i32 %36, 1
%38 = trunc i32 %37 to i8
%39 = call i32 @is_occupied(i8* %33, i8 signext %34, i8 signext %38)
%40 = icmp ne i32 %39, -1
br i1 %40, label %41, label %55
41: ; preds = %32
%42 = load %struct.node*, %struct.node** %4
%43 = load i8*, i8** %5
%44 = load %struct.node*, %struct.node** %6
%45 = load i8, i8* %7
%46 = load i8, i8* %8
%47 = load i8, i8* %7
%48 = load i8, i8* %8
%49 = sext i8 %48 to i32
%50 = add nsw i32 %49, 1
%51 = trunc i32 %50 to i8
%52 = call %struct.node* @store_move(%struct.node* %42, i8* %43, i32 0, %struct.node* %44, i8 signext %45, i8 signext %46, i8 signext %47, i8 signext %51)
store %struct.node* %52, %struct.node** %4
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
store i32 %54, i32* %9
br label %55
55: ; preds = %41, %32, %28
%56 = load i8, i8* %7
%57 = sext i8 %56 to i32
%58 = icmp slt i32 %57, 104
br i1 %58, label %59, label %92
59: ; preds = %55
%60 = load i8, i8* %8
%61 = sext i8 %60 to i32
%62 = icmp slt i32 %61, 56
br i1 %62, label %63, label %92
63: ; preds = %59
%64 = load i8*, i8** %5
%65 = load i8, i8* %7
%66 = sext i8 %65 to i32
%67 = add nsw i32 %66, 1
%68 = trunc i32 %67 to i8
%69 = load i8, i8* %8
%70 = sext i8 %69 to i32
%71 = add nsw i32 %70, 1
%72 = trunc i32 %71 to i8
%73 = call i32 @is_occupied(i8* %64, i8 signext %68, i8 signext %72)
%74 = icmp ne i32 %73, -1
br i1 %74, label %75, label %92
75: ; preds = %63
%76 = load %struct.node*, %struct.node** %4
%77 = load i8*, i8** %5
%78 = load %struct.node*, %struct.node** %6
%79 = load i8, i8* %7
%80 = load i8, i8* %8
%81 = load i8, i8* %7
%82 = sext i8 %81 to i32
%83 = add nsw i32 %82, 1
%84 = trunc i32 %83 to i8
%85 = load i8, i8* %8
%86 = sext i8 %85 to i32
%87 = add nsw i32 %86, 1
%88 = trunc i32 %87 to i8
%89 = call %struct.node* @store_move(%struct.node* %76, i8* %77, i32 0, %struct.node* %78, i8 signext %79, i8 signext %80, i8 signext %84, i8 signext %88)
store %struct.node* %89, %struct.node** %4
%90 = load i32, i32* %9
%91 = add nsw i32 %90, 1
store i32 %91, i32* %9
br label %92
92: ; preds = %75, %63, %59, %55
%93 = load i8, i8* %7
%94 = sext i8 %93 to i32
%95 = icmp slt i32 %94, 104
br i1 %95, label %96, label %119
96: ; preds = %92
%97 = load i8*, i8** %5
%98 = load i8, i8* %7
%99 = sext i8 %98 to i32
%100 = add nsw i32 %99, 1
%101 = trunc i32 %100 to i8
%102 = load i8, i8* %8
%103 = call i32 @is_occupied(i8* %97, i8 signext %101, i8 signext %102)
%104 = icmp ne i32 %103, -1
br i1 %104, label %105, label %119
105: ; preds = %96
%106 = load %struct.node*, %struct.node** %4
%107 = load i8*, i8** %5
%108 = load %struct.node*, %struct.node** %6
%109 = load i8, i8* %7
%110 = load i8, i8* %8
%111 = load i8, i8* %7
%112 = sext i8 %111 to i32
%113 = add nsw i32 %112, 1
%114 = trunc i32 %113 to i8
%115 = load i8, i8* %8
%116 = call %struct.node* @store_move(%struct.node* %106, i8* %107, i32 0, %struct.node* %108, i8 signext %109, i8 signext %110, i8 signext %114, i8 signext %115)
store %struct.node* %116, %struct.node** %4
%117 = load i32, i32* %9
%118 = add nsw i32 %117, 1
store i32 %118, i32* %9
br label %119
119: ; preds = %105, %96, %92
%120 = load i8, i8* %7
%121 = sext i8 %120 to i32
%122 = icmp slt i32 %121, 104
br i1 %122, label %123, label %156
123: ; preds = %119
%124 = load i8, i8* %8
%125 = sext i8 %124 to i32
%126 = icmp sgt i32 %125, 49
br i1 %126, label %127, label %156
127: ; preds = %123
%128 = load i8*, i8** %5
%129 = load i8, i8* %7
%130 = sext i8 %129 to i32
%131 = add nsw i32 %130, 1
%132 = trunc i32 %131 to i8
%133 = load i8, i8* %8
%134 = sext i8 %133 to i32
%135 = sub nsw i32 %134, 1
%136 = trunc i32 %135 to i8
%137 = call i32 @is_occupied(i8* %128, i8 signext %132, i8 signext %136)
%138 = icmp ne i32 %137, -1
br i1 %138, label %139, label %156
139: ; preds = %127
%140 = load %struct.node*, %struct.node** %4
%141 = load i8*, i8** %5
%142 = load %struct.node*, %struct.node** %6
%143 = load i8, i8* %7
%144 = load i8, i8* %8
%145 = load i8, i8* %7
%146 = sext i8 %145 to i32
%147 = add nsw i32 %146, 1
%148 = trunc i32 %147 to i8
%149 = load i8, i8* %8
%150 = sext i8 %149 to i32
%151 = sub nsw i32 %150, 1
%152 = trunc i32 %151 to i8
%153 = call %struct.node* @store_move(%struct.node* %140, i8* %141, i32 0, %struct.node* %142, i8 signext %143, i8 signext %144, i8 signext %148, i8 signext %152)
store %struct.node* %153, %struct.node** %4
%154 = load i32, i32* %9
%155 = add nsw i32 %154, 1
store i32 %155, i32* %9
br label %156
156: ; preds = %139, %127, %123, %119
%157 = load i8, i8* %8
%158 = sext i8 %157 to i32
%159 = icmp sgt i32 %158, 49
br i1 %159, label %160, label %183
160: ; preds = %156
%161 = load i8*, i8** %5
%162 = load i8, i8* %7
%163 = load i8, i8* %8
%164 = sext i8 %163 to i32
%165 = sub nsw i32 %164, 1
%166 = trunc i32 %165 to i8
%167 = call i32 @is_occupied(i8* %161, i8 signext %162, i8 signext %166)
%168 = icmp ne i32 %167, -1
br i1 %168, label %169, label %183
169: ; preds = %160
%170 = load %struct.node*, %struct.node** %4
%171 = load i8*, i8** %5
%172 = load %struct.node*, %struct.node** %6
%173 = load i8, i8* %7
%174 = load i8, i8* %8
%175 = load i8, i8* %7
%176 = load i8, i8* %8
%177 = sext i8 %176 to i32
%178 = sub nsw i32 %177, 1
%179 = trunc i32 %178 to i8
%180 = call %struct.node* @store_move(%struct.node* %170, i8* %171, i32 0, %struct.node* %172, i8 signext %173, i8 signext %174, i8 signext %175, i8 signext %179)
store %struct.node* %180, %struct.node** %4
%181 = load i32, i32* %9
%182 = add nsw i32 %181, 1
store i32 %182, i32* %9
br label %183
183: ; preds = %169, %160, %156
%184 = load i8, i8* %7
%185 = sext i8 %184 to i32
%186 = icmp sgt i32 %185, 97
br i1 %186, label %187, label %220
187: ; preds = %183
%188 = load i8, i8* %8
%189 = sext i8 %188 to i32
%190 = icmp sgt i32 %189, 49
br i1 %190, label %191, label %220
191: ; preds = %187
%192 = load i8*, i8** %5
%193 = load i8, i8* %7
%194 = sext i8 %193 to i32
%195 = sub nsw i32 %194, 1
%196 = trunc i32 %195 to i8
%197 = load i8, i8* %8
%198 = sext i8 %197 to i32
%199 = sub nsw i32 %198, 1
%200 = trunc i32 %199 to i8
%201 = call i32 @is_occupied(i8* %192, i8 signext %196, i8 signext %200)
%202 = icmp ne i32 %201, -1
br i1 %202, label %203, label %220
203: ; preds = %191
%204 = load %struct.node*, %struct.node** %4
%205 = load i8*, i8** %5
%206 = load %struct.node*, %struct.node** %6
%207 = load i8, i8* %7
%208 = load i8, i8* %8
%209 = load i8, i8* %7
%210 = sext i8 %209 to i32
%211 = sub nsw i32 %210, 1
%212 = trunc i32 %211 to i8
%213 = load i8, i8* %8
%214 = sext i8 %213 to i32
%215 = sub nsw i32 %214, 1
%216 = trunc i32 %215 to i8
%217 = call %struct.node* @store_move(%struct.node* %204, i8* %205, i32 0, %struct.node* %206, i8 signext %207, i8 signext %208, i8 signext %212, i8 signext %216)
store %struct.node* %217, %struct.node** %4
%218 = load i32, i32* %9
%219 = add nsw i32 %218, 1
store i32 %219, i32* %9
br label %220
220: ; preds = %203, %191, %187, %183
%221 = load i8, i8* %7
%222 = sext i8 %221 to i32
%223 = icmp sgt i32 %222, 97
br i1 %223, label %224, label %247
224: ; preds = %220
%225 = load i8*, i8** %5
%226 = load i8, i8* %7
%227 = sext i8 %226 to i32
%228 = sub nsw i32 %227, 1
%229 = trunc i32 %228 to i8
%230 = load i8, i8* %8
%231 = call i32 @is_occupied(i8* %225, i8 signext %229, i8 signext %230)
%232 = icmp ne i32 %231, -1
br i1 %232, label %233, label %247
233: ; preds = %224
%234 = load %struct.node*, %struct.node** %4
%235 = load i8*, i8** %5
%236 = load %struct.node*, %struct.node** %6
%237 = load i8, i8* %7
%238 = load i8, i8* %8
%239 = load i8, i8* %7
%240 = sext i8 %239 to i32
%241 = sub nsw i32 %240, 1
%242 = trunc i32 %241 to i8
%243 = load i8, i8* %8
%244 = call %struct.node* @store_move(%struct.node* %234, i8* %235, i32 0, %struct.node* %236, i8 signext %237, i8 signext %238, i8 signext %242, i8 signext %243)
store %struct.node* %244, %struct.node** %4
%245 = load i32, i32* %9
%246 = add nsw i32 %245, 1
store i32 %246, i32* %9
br label %247
247: ; preds = %233, %224, %220
%248 = load i8, i8* %7
%249 = sext i8 %248 to i32
%250 = icmp sgt i32 %249, 97
br i1 %250, label %251, label %284
251: ; preds = %247
%252 = load i8, i8* %8
%253 = sext i8 %252 to i32
%254 = icmp slt i32 %253, 56
br i1 %254, label %255, label %284
255: ; preds = %251
%256 = load i8*, i8** %5
%257 = load i8, i8* %7
%258 = sext i8 %257 to i32
%259 = sub nsw i32 %258, 1
%260 = trunc i32 %259 to i8
%261 = load i8, i8* %8
%262 = sext i8 %261 to i32
%263 = add nsw i32 %262, 1
%264 = trunc i32 %263 to i8
%265 = call i32 @is_occupied(i8* %256, i8 signext %260, i8 signext %264)
%266 = icmp ne i32 %265, -1
br i1 %266, label %267, label %284
267: ; preds = %255
%268 = load %struct.node*, %struct.node** %4
%269 = load i8*, i8** %5
%270 = load %struct.node*, %struct.node** %6
%271 = load i8, i8* %7
%272 = load i8, i8* %8
%273 = load i8, i8* %7
%274 = sext i8 %273 to i32
%275 = sub nsw i32 %274, 1
%276 = trunc i32 %275 to i8
%277 = load i8, i8* %8
%278 = sext i8 %277 to i32
%279 = add nsw i32 %278, 1
%280 = trunc i32 %279 to i8
%281 = call %struct.node* @store_move(%struct.node* %268, i8* %269, i32 0, %struct.node* %270, i8 signext %271, i8 signext %272, i8 signext %276, i8 signext %280)
store %struct.node* %281, %struct.node** %4
%282 = load i32, i32* %9
%283 = add nsw i32 %282, 1
store i32 %283, i32* %9
br label %284
284: ; preds = %267, %255, %251, %247
br label %285
285: ; preds = %284, %20
br label %286
286: ; preds = %285
%287 = load i8, i8* %8
%288 = add i8 %287, 1
store i8 %288, i8* %8
br label %16
289: ; preds = %16
br label %290
290: ; preds = %289
%291 = load i8, i8* %7
%292 = add i8 %291, 1
store i8 %292, i8* %7
br label %11
293: ; preds = %11
%294 = load %struct.node*, %struct.node** %4
ret %struct.node* %294
}

LLVM IR (-O2):
%struct.node = type { i32 }
define %struct.node* @get_king_moves_black(%struct.node* %0, i8* %1, %struct.node* %2) {
br label %4
4: ; preds = %3, %83
%5 = phi %struct.node* [ %0, %3 ], [ %80, %83 ]
%6 = phi i8 [ 97, %3 ], [ %8, %83 ]
%7 = icmp ult i8 %6, 104
%8 = add nuw nsw i8 %6, 1
%9 = icmp ugt i8 %6, 97
%10 = add nsw i8 %6, -1
br label %11
11: ; preds = %4, %79
%12 = phi %struct.node* [ %5, %4 ], [ %80, %79 ]
%13 = phi i8 [ 49, %4 ], [ %81, %79 ]
%14 = tail call signext i8 @get_piece(i8* %1, i8 signext %6, i8 signext %13)
%15 = icmp eq i8 %14, 107
br i1 %15, label %16, label %79
16: ; preds = %11
%17 = icmp ult i8 %13, 56
br i1 %17, label %19, label %18
18: ; preds = %16
br i1 %7, label %32, label %49
19: ; preds = %16
%20 = add nuw nsw i8 %13, 1
%21 = tail call i32 @is_occupied(i8* %1, i8 signext %6, i8 signext %20)
%22 = icmp eq i32 %21, -1
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = tail call %struct.node* @store_move(%struct.node* %12, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %6, i8 signext %20)
br label %25
25: ; preds = %23, %19
%26 = phi %struct.node* [ %24, %23 ], [ %12, %19 ]
br i1 %7, label %27, label %38
27: ; preds = %25
%28 = tail call i32 @is_occupied(i8* %1, i8 signext %8, i8 signext %20)
%29 = icmp eq i32 %28, -1
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = tail call %struct.node* @store_move(%struct.node* %26, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %8, i8 signext %20)
br label %32
32: ; preds = %27, %30, %18
%33 = phi %struct.node* [ %31, %30 ], [ %12, %18 ], [ %26, %27 ]
%34 = tail call i32 @is_occupied(i8* %1, i8 signext %8, i8 signext %13)
%35 = icmp eq i32 %34, -1
br i1 %35, label %40, label %36
36: ; preds = %32
%37 = tail call %struct.node* @store_move(%struct.node* %33, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %8, i8 signext %13)
br label %40
38: ; preds = %25
%39 = icmp ugt i8 %13, 49
br i1 %39, label %49, label %56
40: ; preds = %36, %32
%41 = phi %struct.node* [ %37, %36 ], [ %33, %32 ]
%42 = icmp ugt i8 %13, 49
br i1 %42, label %43, label %56
43: ; preds = %40
%44 = add nsw i8 %13, -1
%45 = tail call i32 @is_occupied(i8* %1, i8 signext %8, i8 signext %44)
%46 = icmp eq i32 %45, -1
br i1 %46, label %49, label %47
47: ; preds = %43
%48 = tail call %struct.node* @store_move(%struct.node* %41, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %8, i8 signext %44)
br label %49
49: ; preds = %43, %18, %47, %38
%50 = phi %struct.node* [ %48, %47 ], [ %26, %38 ], [ %12, %18 ], [ %41, %43 ]
%51 = add nsw i8 %13, -1
%52 = tail call i32 @is_occupied(i8* %1, i8 signext %6, i8 signext %51)
%53 = icmp eq i32 %52, -1
br i1 %53, label %58, label %54
54: ; preds = %49
%55 = tail call %struct.node* @store_move(%struct.node* %50, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %6, i8 signext %51)
br label %58
56: ; preds = %40, %38
%57 = phi %struct.node* [ %26, %38 ], [ %41, %40 ]
br i1 %9, label %65, label %79
58: ; preds = %54, %49
%59 = phi %struct.node* [ %55, %54 ], [ %50, %49 ]
br i1 %9, label %60, label %79
60: ; preds = %58
%61 = tail call i32 @is_occupied(i8* %1, i8 signext %10, i8 signext %51)
%62 = icmp eq i32 %61, -1
br i1 %62, label %65, label %63
63: ; preds = %60
%64 = tail call %struct.node* @store_move(%struct.node* %59, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %10, i8 signext %51)
br label %65
65: ; preds = %60, %63, %56
%66 = phi %struct.node* [ %64, %63 ], [ %57, %56 ], [ %59, %60 ]
%67 = tail call i32 @is_occupied(i8* %1, i8 signext %10, i8 signext %13)
%68 = icmp eq i32 %67, -1
br i1 %68, label %71, label %69
69: ; preds = %65
%70 = tail call %struct.node* @store_move(%struct.node* %66, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %10, i8 signext %13)
br i1 %17, label %72, label %79
71: ; preds = %65
br i1 %17, label %72, label %79
72: ; preds = %69, %71
%73 = phi %struct.node* [ %70, %69 ], [ %66, %71 ]
%74 = add nuw nsw i8 %13, 1
%75 = tail call i32 @is_occupied(i8* %1, i8 signext %10, i8 signext %74)
%76 = icmp eq i32 %75, -1
br i1 %76, label %79, label %77
77: ; preds = %72
%78 = tail call %struct.node* @store_move(%struct.node* %73, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %10, i8 signext %74)
br label %79
79: ; preds = %58, %56, %69, %71, %72, %77, %11
%80 = phi %struct.node* [ %78, %77 ], [ %73, %72 ], [ %66, %71 ], [ %12, %11 ], [ %70, %69 ], [ %57, %56 ], [ %59, %58 ]
%81 = add nuw nsw i8 %13, 1
%82 = icmp eq i8 %81, 57
br i1 %82, label %83, label %11
83: ; preds = %79
%84 = icmp eq i8 %8, 105
br i1 %84, label %85, label %4
85: ; preds = %83
ret %struct.node* %80
}