#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_bishop_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 == 'b') {
        char dest_x = x - 1;
        char dest_y = y - 1;
        int keepGoing = 1;
        if ((x == 'a') || (y == '1'))
          keepGoing = 0;
        while ((keepGoing == 1) && (is_occupied(board, dest_x, dest_y) == 0)) {
          currentNode = store_move(currentNode, board, 0, parentNode, x, y,
                                   dest_x, dest_y);
          numMoves++;
          if ((dest_x > 'a') && (dest_y > '1') &&
              (is_occupied(board, dest_x - 1, dest_y - 1) == 1)) {
            currentNode = store_move(currentNode, board, 0, parentNode, x, y,
                                     dest_x - 1, dest_y - 1);
            numMoves++;
            keepGoing = 0;
          }
          dest_x--;
          dest_y--;
          if ((dest_x < 'a') || (dest_y < '1'))
            keepGoing = 0;
        }
        dest_x = x + 1;
        dest_y = y - 1;
        keepGoing = 1;
        if ((x == 'h') || (y == '1'))
          keepGoing = 0;
        while ((keepGoing == 1) && (is_occupied(board, dest_x, dest_y) == 0)) {
          currentNode = store_move(currentNode, board, 0, parentNode, x, y,
                                   dest_x, dest_y);
          numMoves++;
          if ((dest_x < 'h') && (dest_y > '1') &&
              (is_occupied(board, dest_x + 1, dest_y - 1) == 1)) {
            currentNode = store_move(currentNode, board, 0, parentNode, x, y,
                                     dest_x + 1, dest_y - 1);
            numMoves++;
            keepGoing = 0;
          }
          dest_x++;
          dest_y--;
          if ((dest_x > 'h') || (dest_y < '1'))
            keepGoing = 0;
        }
        dest_x = x - 1;
        dest_y = y + 1;
        keepGoing = 1;
        if ((x == 'a') || (y == '8'))
          keepGoing = 0;
        while ((keepGoing == 1) && (is_occupied(board, dest_x, dest_y) == 0)) {
          currentNode = store_move(currentNode, board, 0, parentNode, x, y,
                                   dest_x, dest_y);
          numMoves++;
          if ((dest_x > 'a') && (dest_y < '8') &&
              (is_occupied(board, dest_x - 1, dest_y + 1) == 1)) {
            currentNode = store_move(currentNode, board, 0, parentNode, x, y,
                                     dest_x - 1, dest_y + 1);
            numMoves++;
            keepGoing = 0;
          }
          dest_x--;
          dest_y++;
          if ((dest_x < 'a') || (dest_y > '8'))
            keepGoing = 0;
        }
        dest_x = x + 1;
        dest_y = y + 1;
        keepGoing = 1;
        if ((x == 'h') || (y == '8'))
          keepGoing = 0;
        while ((keepGoing == 1) && (is_occupied(board, dest_x, dest_y) == 0)) {
          currentNode = store_move(currentNode, board, 0, parentNode, x, y,
                                   dest_x, dest_y);
          numMoves++;
          if ((dest_x < 'h') && (dest_y < '8') &&
              (is_occupied(board, dest_x + 1, dest_y + 1) == 1)) {
            currentNode = store_move(currentNode, board, 0, parentNode, x, y,
                                     dest_x + 1, dest_y + 1);
            numMoves++;
            keepGoing = 0;
          }
          dest_x++;
          dest_y++;
          if ((dest_x > 'h') || (dest_y > '8'))
            keepGoing = 0;
        }
      }
    }
  }
  return currentNode;
}


x86 assembly (clang, -O0):
<get_bishop_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     17e9 <get_bishop_moves_black+0x6b9>
movb   $0x31,-0x1a(%rbp)
movsbl -0x1a(%rbp),%eax
cmp    $0x38,%eax
jg     17d7 <get_bishop_moves_black+0x6a7>
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    $0x62,%eax
jne    17c5 <get_bishop_moves_black+0x695>
movsbl -0x19(%rbp),%eax
sub    $0x1,%eax
mov    %al,-0x22(%rbp)
movsbl -0x1a(%rbp),%eax
sub    $0x1,%eax
mov    %al,-0x23(%rbp)
movl   $0x1,-0x28(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x61,%eax
je     11c5 <get_bishop_moves_black+0x95>
movsbl -0x1a(%rbp),%eax
cmp    $0x31,%eax
jne    11cc <get_bishop_moves_black+0x9c>
movl   $0x0,-0x28(%rbp)
jmp    11d1 <get_bishop_moves_black+0xa1>
xor    %eax,%eax
cmpl   $0x1,-0x28(%rbp)
mov    %al,-0x29(%rbp)
jne    11fc <get_bishop_moves_black+0xcc>
mov    -0x10(%rbp),%rdi
mov    -0x22(%rbp),%al
movsbl %al,%esi
movsbl -0x23(%rbp),%edx
call   1030 <is_occupied@plt>
cmp    $0x0,%eax
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    120c <get_bishop_moves_black+0xdc>
jmp    131c <get_bishop_moves_black+0x1ec>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
mov    -0x22(%rbp),%al
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %al,%eax
mov    %eax,(%rsp)
movsbl -0x23(%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 -0x22(%rbp),%eax
cmp    $0x61,%eax
jle    12e6 <get_bishop_moves_black+0x1b6>
movsbl -0x23(%rbp),%eax
cmp    $0x31,%eax
jle    12e6 <get_bishop_moves_black+0x1b6>
mov    -0x10(%rbp),%rdi
movsbl -0x22(%rbp),%eax
sub    $0x1,%eax
mov    %al,%cl
movsbl -0x23(%rbp),%eax
sub    $0x1,%eax
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <is_occupied@plt>
cmp    $0x1,%eax
jne    12e6 <get_bishop_moves_black+0x1b6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
movsbl -0x22(%rbp),%eax
sub    $0x1,%eax
mov    %al,%r10b
movsbl -0x23(%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)
movl   $0x0,-0x28(%rbp)
mov    -0x22(%rbp),%al
add    $0xff,%al
mov    %al,-0x22(%rbp)
mov    -0x23(%rbp),%al
add    $0xff,%al
mov    %al,-0x23(%rbp)
movsbl -0x22(%rbp),%eax
cmp    $0x61,%eax
jl     1310 <get_bishop_moves_black+0x1e0>
movsbl -0x23(%rbp),%eax
cmp    $0x31,%eax
jge    1317 <get_bishop_moves_black+0x1e7>
movl   $0x0,-0x28(%rbp)
jmp    11d1 <get_bishop_moves_black+0xa1>
movsbl -0x19(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x22(%rbp)
movsbl -0x1a(%rbp),%eax
sub    $0x1,%eax
mov    %al,-0x23(%rbp)
movl   $0x1,-0x28(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x68,%eax
je     1351 <get_bishop_moves_black+0x221>
movsbl -0x1a(%rbp),%eax
cmp    $0x31,%eax
jne    1358 <get_bishop_moves_black+0x228>
movl   $0x0,-0x28(%rbp)
jmp    135d <get_bishop_moves_black+0x22d>
xor    %eax,%eax
cmpl   $0x1,-0x28(%rbp)
mov    %al,-0x2a(%rbp)
jne    1388 <get_bishop_moves_black+0x258>
mov    -0x10(%rbp),%rdi
mov    -0x22(%rbp),%al
movsbl %al,%esi
movsbl -0x23(%rbp),%edx
call   1030 <is_occupied@plt>
cmp    $0x0,%eax
sete   %al
mov    %al,-0x2a(%rbp)
mov    -0x2a(%rbp),%al
test   $0x1,%al
jne    1398 <get_bishop_moves_black+0x268>
jmp    14a8 <get_bishop_moves_black+0x378>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
mov    -0x22(%rbp),%al
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %al,%eax
mov    %eax,(%rsp)
movsbl -0x23(%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 -0x22(%rbp),%eax
cmp    $0x68,%eax
jge    1472 <get_bishop_moves_black+0x342>
movsbl -0x23(%rbp),%eax
cmp    $0x31,%eax
jle    1472 <get_bishop_moves_black+0x342>
mov    -0x10(%rbp),%rdi
movsbl -0x22(%rbp),%eax
add    $0x1,%eax
mov    %al,%cl
movsbl -0x23(%rbp),%eax
sub    $0x1,%eax
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <is_occupied@plt>
cmp    $0x1,%eax
jne    1472 <get_bishop_moves_black+0x342>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
movsbl -0x22(%rbp),%eax
add    $0x1,%eax
mov    %al,%r10b
movsbl -0x23(%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)
movl   $0x0,-0x28(%rbp)
mov    -0x22(%rbp),%al
add    $0x1,%al
mov    %al,-0x22(%rbp)
mov    -0x23(%rbp),%al
add    $0xff,%al
mov    %al,-0x23(%rbp)
movsbl -0x22(%rbp),%eax
cmp    $0x68,%eax
jg     149c <get_bishop_moves_black+0x36c>
movsbl -0x23(%rbp),%eax
cmp    $0x31,%eax
jge    14a3 <get_bishop_moves_black+0x373>
movl   $0x0,-0x28(%rbp)
jmp    135d <get_bishop_moves_black+0x22d>
movsbl -0x19(%rbp),%eax
sub    $0x1,%eax
mov    %al,-0x22(%rbp)
movsbl -0x1a(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x23(%rbp)
movl   $0x1,-0x28(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x61,%eax
je     14dd <get_bishop_moves_black+0x3ad>
movsbl -0x1a(%rbp),%eax
cmp    $0x38,%eax
jne    14e4 <get_bishop_moves_black+0x3b4>
movl   $0x0,-0x28(%rbp)
jmp    14e9 <get_bishop_moves_black+0x3b9>
xor    %eax,%eax
cmpl   $0x1,-0x28(%rbp)
mov    %al,-0x2b(%rbp)
jne    1514 <get_bishop_moves_black+0x3e4>
mov    -0x10(%rbp),%rdi
mov    -0x22(%rbp),%al
movsbl %al,%esi
movsbl -0x23(%rbp),%edx
call   1030 <is_occupied@plt>
cmp    $0x0,%eax
sete   %al
mov    %al,-0x2b(%rbp)
mov    -0x2b(%rbp),%al
test   $0x1,%al
jne    1524 <get_bishop_moves_black+0x3f4>
jmp    1634 <get_bishop_moves_black+0x504>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
mov    -0x22(%rbp),%al
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %al,%eax
mov    %eax,(%rsp)
movsbl -0x23(%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 -0x22(%rbp),%eax
cmp    $0x61,%eax
jle    15fe <get_bishop_moves_black+0x4ce>
movsbl -0x23(%rbp),%eax
cmp    $0x38,%eax
jge    15fe <get_bishop_moves_black+0x4ce>
mov    -0x10(%rbp),%rdi
movsbl -0x22(%rbp),%eax
sub    $0x1,%eax
mov    %al,%cl
movsbl -0x23(%rbp),%eax
add    $0x1,%eax
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <is_occupied@plt>
cmp    $0x1,%eax
jne    15fe <get_bishop_moves_black+0x4ce>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
movsbl -0x22(%rbp),%eax
sub    $0x1,%eax
mov    %al,%r10b
movsbl -0x23(%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)
movl   $0x0,-0x28(%rbp)
mov    -0x22(%rbp),%al
add    $0xff,%al
mov    %al,-0x22(%rbp)
mov    -0x23(%rbp),%al
add    $0x1,%al
mov    %al,-0x23(%rbp)
movsbl -0x22(%rbp),%eax
cmp    $0x61,%eax
jl     1628 <get_bishop_moves_black+0x4f8>
movsbl -0x23(%rbp),%eax
cmp    $0x38,%eax
jle    162f <get_bishop_moves_black+0x4ff>
movl   $0x0,-0x28(%rbp)
jmp    14e9 <get_bishop_moves_black+0x3b9>
movsbl -0x19(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x22(%rbp)
movsbl -0x1a(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x23(%rbp)
movl   $0x1,-0x28(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x68,%eax
je     1669 <get_bishop_moves_black+0x539>
movsbl -0x1a(%rbp),%eax
cmp    $0x38,%eax
jne    1670 <get_bishop_moves_black+0x540>
movl   $0x0,-0x28(%rbp)
jmp    1675 <get_bishop_moves_black+0x545>
xor    %eax,%eax
cmpl   $0x1,-0x28(%rbp)
mov    %al,-0x2c(%rbp)
jne    16a0 <get_bishop_moves_black+0x570>
mov    -0x10(%rbp),%rdi
mov    -0x22(%rbp),%al
movsbl %al,%esi
movsbl -0x23(%rbp),%edx
call   1030 <is_occupied@plt>
cmp    $0x0,%eax
sete   %al
mov    %al,-0x2c(%rbp)
mov    -0x2c(%rbp),%al
test   $0x1,%al
jne    16b0 <get_bishop_moves_black+0x580>
jmp    17c0 <get_bishop_moves_black+0x690>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
mov    -0x22(%rbp),%al
xor    %edx,%edx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %al,%eax
mov    %eax,(%rsp)
movsbl -0x23(%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 -0x22(%rbp),%eax
cmp    $0x68,%eax
jge    178a <get_bishop_moves_black+0x65a>
movsbl -0x23(%rbp),%eax
cmp    $0x38,%eax
jge    178a <get_bishop_moves_black+0x65a>
mov    -0x10(%rbp),%rdi
movsbl -0x22(%rbp),%eax
add    $0x1,%eax
mov    %al,%cl
movsbl -0x23(%rbp),%eax
add    $0x1,%eax
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <is_occupied@plt>
cmp    $0x1,%eax
jne    178a <get_bishop_moves_black+0x65a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x19(%rbp),%r8b
mov    -0x1a(%rbp),%r9b
movsbl -0x22(%rbp),%eax
add    $0x1,%eax
mov    %al,%r10b
movsbl -0x23(%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)
movl   $0x0,-0x28(%rbp)
mov    -0x22(%rbp),%al
add    $0x1,%al
mov    %al,-0x22(%rbp)
mov    -0x23(%rbp),%al
add    $0x1,%al
mov    %al,-0x23(%rbp)
movsbl -0x22(%rbp),%eax
cmp    $0x68,%eax
jg     17b4 <get_bishop_moves_black+0x684>
movsbl -0x23(%rbp),%eax
cmp    $0x38,%eax
jle    17bb <get_bishop_moves_black+0x68b>
movl   $0x0,-0x28(%rbp)
jmp    1675 <get_bishop_moves_black+0x545>
jmp    17c5 <get_bishop_moves_black+0x695>
jmp    17ca <get_bishop_moves_black+0x69a>
mov    -0x1a(%rbp),%al
add    $0x1,%al
mov    %al,-0x1a(%rbp)
jmp    1160 <get_bishop_moves_black+0x30>
jmp    17dc <get_bishop_moves_black+0x6ac>
mov    -0x19(%rbp),%al
add    $0x1,%al
mov    %al,-0x19(%rbp)
jmp    114f <get_bishop_moves_black+0x1f>
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bishop_moves_black>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,0x20(%rsp)
mov    %rsi,%r15
mov    %rdi,0x8(%rsp)
mov    $0x61,%r13b
mov    %rsi,0x18(%rsp)
jmp    116f <get_bishop_moves_black+0x3f>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x2c(%rsp),%eax
mov    %eax,%r13d
cmp    $0x69,%al
je     15fa <get_bishop_moves_black+0x4ca>
lea    -0x1(%r13),%eax
mov    %eax,0x3c(%rsp)
lea    0x1(%r13),%eax
mov    %eax,0x2c(%rsp)
mov    $0x31,%bpl
mov    %r13,0x30(%rsp)
jmp    11a0 <get_bishop_moves_black+0x70>
nopl   0x0(%rax)
add    $0x1,%bpl
mov    %ebp,%r14d
mov    %r14d,%ebp
cmp    $0x39,%r14b
je     1160 <get_bishop_moves_black+0x30>
movsbl %r13b,%r14d
movsbl %bpl,%ebx
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
call   1040 <get_piece@plt>
cmp    $0x62,%al
jne    1190 <get_bishop_moves_black+0x60>
lea    -0x1(%rbp),%r12d
cmp    $0x61,%r13b
mov    %rbp,0x40(%rsp)
mov    %r14d,0x14(%rsp)
mov    %ebx,0x10(%rsp)
je     12c0 <get_bishop_moves_black+0x190>
cmp    $0x31,%bpl
je     12c0 <get_bishop_moves_black+0x190>
mov    %r12d,%ebx
mov    0x3c(%rsp),%eax
mov    %eax,%r13d
nopl   0x0(%rax)
movsbl %r13b,%r14d
movsbl %bl,%ebp
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1030 <is_occupied@plt>
test   %eax,%eax
jne    12c0 <get_bishop_moves_black+0x190>
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
xor    %edx,%edx
mov    0x20(%rsp),%rcx
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
push   %rbp
push   %r14
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
add    $0xff,%bpl
lea    -0x1(%r14),%r15d
cmp    $0x62,%r14b
jb     1260 <get_bishop_moves_black+0x130>
cmp    $0x32,%bl
jb     1260 <get_bishop_moves_black+0x130>
movsbl %r15b,%esi
movsbl %bpl,%edx
mov    0x18(%rsp),%rdi
call   1030 <is_occupied@plt>
cmp    $0x1,%eax
je     127c <get_bishop_moves_black+0x14c>
cmp    $0x61,%r15b
jb     12ba <get_bishop_moves_black+0x18a>
mov    %ebp,%ebx
mov    %r15d,%r13d
cmp    $0x30,%bpl
mov    0x18(%rsp),%r15
ja     11f0 <get_bishop_moves_black+0xc0>
jmp    12c0 <get_bishop_moves_black+0x190>
add    $0xff,%bl
add    $0xff,%r13b
movsbl %bl,%eax
movsbl %r13b,%ebp
mov    0x8(%rsp),%rdi
mov    0x18(%rsp),%r15
mov    %r15,%rsi
xor    %edx,%edx
mov    0x20(%rsp),%rcx
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
push   %rax
push   %rbp
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
jmp    12c0 <get_bishop_moves_black+0x190>
mov    0x18(%rsp),%r15
nop
mov    0x30(%rsp),%r13
cmp    $0x68,%r13b
je     13d0 <get_bishop_moves_black+0x2a0>
cmpb   $0x31,0x40(%rsp)
je     13d0 <get_bishop_moves_black+0x2a0>
mov    0x2c(%rsp),%eax
mov    %eax,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %r14b,%ebx
movsbl %r12b,%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <is_occupied@plt>
test   %eax,%eax
jne    13d0 <get_bishop_moves_black+0x2a0>
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
xor    %edx,%edx
mov    0x20(%rsp),%rcx
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
push   %rbp
push   %rbx
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
add    $0xff,%bpl
lea    0x1(%rbx),%r15d
cmp    $0x67,%bl
ja     135f <get_bishop_moves_black+0x22f>
cmp    $0x32,%r12b
jb     135f <get_bishop_moves_black+0x22f>
movsbl %r15b,%esi
movsbl %bpl,%edx
mov    0x18(%rsp),%rdi
call   1030 <is_occupied@plt>
cmp    $0x1,%eax
je     137c <get_bishop_moves_black+0x24c>
cmp    $0x67,%r14b
ja     13bc <get_bishop_moves_black+0x28c>
mov    %ebp,%r12d
mov    %r15d,%r14d
cmp    $0x30,%bpl
mov    0x18(%rsp),%r15
ja     12f0 <get_bishop_moves_black+0x1c0>
jmp    13d0 <get_bishop_moves_black+0x2a0>
add    $0xff,%r12b
add    $0x1,%r14b
movsbl %r12b,%eax
movsbl %r14b,%ebp
mov    0x8(%rsp),%rdi
mov    0x18(%rsp),%r15
mov    %r15,%rsi
xor    %edx,%edx
mov    0x20(%rsp),%rcx
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
push   %rax
push   %rbp
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
jmp    13d0 <get_bishop_moves_black+0x2a0>
mov    0x18(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x40(%rsp),%rax
lea    0x1(%rax),%r14d
cmp    $0x61,%r13b
je     14e0 <get_bishop_moves_black+0x3b0>
cmp    $0x38,%al
je     14e0 <get_bishop_moves_black+0x3b0>
mov    %r14d,%r12d
mov    0x3c(%rsp),%eax
mov    %eax,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %r13b,%ebx
movsbl %r12b,%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <is_occupied@plt>
test   %eax,%eax
jne    14e0 <get_bishop_moves_black+0x3b0>
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
xor    %edx,%edx
mov    0x20(%rsp),%rcx
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
push   %rbp
push   %rbx
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
add    $0x1,%bpl
lea    -0x1(%rbx),%r15d
cmp    $0x62,%bl
jb     146f <get_bishop_moves_black+0x33f>
cmp    $0x37,%r12b
ja     146f <get_bishop_moves_black+0x33f>
movsbl %r15b,%esi
movsbl %bpl,%edx
mov    0x18(%rsp),%rdi
call   1030 <is_occupied@plt>
cmp    $0x1,%eax
je     148c <get_bishop_moves_black+0x35c>
cmp    $0x61,%r15b
jb     14cc <get_bishop_moves_black+0x39c>
mov    %r15d,%r13d
cmp    $0x38,%r12b
mov    %ebp,%r12d
mov    0x18(%rsp),%r15
jb     1400 <get_bishop_moves_black+0x2d0>
jmp    14e0 <get_bishop_moves_black+0x3b0>
add    $0x1,%r12b
add    $0xff,%r13b
movsbl %r12b,%eax
movsbl %r13b,%ebp
mov    0x8(%rsp),%rdi
mov    0x18(%rsp),%r15
mov    %r15,%rsi
xor    %edx,%edx
mov    0x20(%rsp),%rcx
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
push   %rax
push   %rbp
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
jmp    14e0 <get_bishop_moves_black+0x3b0>
mov    0x18(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x30(%rsp),%r13
cmp    $0x68,%r13b
je     1197 <get_bishop_moves_black+0x67>
cmpb   $0x38,0x40(%rsp)
je     1197 <get_bishop_moves_black+0x67>
mov    %r14d,%r12d
mov    0x2c(%rsp),%eax
mov    %eax,%r13d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %r13b,%ebx
movsbl %r12b,%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <is_occupied@plt>
test   %eax,%eax
jne    15f0 <get_bishop_moves_black+0x4c0>
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
xor    %edx,%edx
mov    0x20(%rsp),%rcx
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
push   %rbp
push   %rbx
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
add    $0x1,%bpl
lea    0x1(%rbx),%r15d
cmp    $0x67,%bl
ja     157f <get_bishop_moves_black+0x44f>
cmp    $0x37,%r12b
ja     157f <get_bishop_moves_black+0x44f>
movsbl %r15b,%esi
movsbl %bpl,%edx
mov    0x18(%rsp),%rdi
call   1030 <is_occupied@plt>
cmp    $0x1,%eax
je     159c <get_bishop_moves_black+0x46c>
cmp    $0x67,%r13b
ja     15dc <get_bishop_moves_black+0x4ac>
mov    %r15d,%r13d
cmp    $0x38,%r12b
mov    %ebp,%r12d
mov    0x18(%rsp),%r15
jb     1510 <get_bishop_moves_black+0x3e0>
jmp    15f0 <get_bishop_moves_black+0x4c0>
add    $0x1,%r12b
add    $0x1,%r13b
movsbl %r12b,%eax
movsbl %r13b,%ebp
mov    0x8(%rsp),%rdi
mov    0x18(%rsp),%r15
mov    %r15,%rsi
xor    %edx,%edx
mov    0x20(%rsp),%rcx
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
push   %rax
push   %rbp
call   1050 <store_move@plt>
add    $0x10,%rsp
mov    %rax,0x8(%rsp)
jmp    15f0 <get_bishop_moves_black+0x4c0>
mov    0x18(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x30(%rsp),%r13
jmp    1197 <get_bishop_moves_black+0x67>
mov    0x8(%rsp),%rax
add    $0x48,%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_bishop_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
%11 = alloca i8
%12 = alloca i8
%13 = alloca i32
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 %14
14: ; preds = %397, %3
%15 = load i8, i8* %7
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 104
br i1 %17, label %18, label %400
18: ; preds = %14
store i8 49, i8* %8
br label %19
19: ; preds = %393, %18
%20 = load i8, i8* %8
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 56
br i1 %22, label %23, label %396
23: ; preds = %19
%24 = load i8*, i8** %5
%25 = load i8, i8* %7
%26 = load i8, i8* %8
%27 = call signext i8 @get_piece(i8* %24, i8 signext %25, i8 signext %26)
store i8 %27, i8* %10
%28 = load i8, i8* %10
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 98
br i1 %30, label %31, label %392
31: ; preds = %23
%32 = load i8, i8* %7
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 1
%35 = trunc i32 %34 to i8
store i8 %35, i8* %11
%36 = load i8, i8* %8
%37 = sext i8 %36 to i32
%38 = sub nsw i32 %37, 1
%39 = trunc i32 %38 to i8
store i8 %39, i8* %12
store i32 1, i32* %13
%40 = load i8, i8* %7
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 97
br i1 %42, label %47, label %43
43: ; preds = %31
%44 = load i8, i8* %8
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 49
br i1 %46, label %47, label %48
47: ; preds = %43, %31
store i32 0, i32* %13
br label %48
48: ; preds = %47, %43
br label %49
49: ; preds = %120, %48
%50 = load i32, i32* %13
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %58
52: ; preds = %49
%53 = load i8*, i8** %5
%54 = load i8, i8* %11
%55 = load i8, i8* %12
%56 = call i32 @is_occupied(i8* %53, i8 signext %54, i8 signext %55)
%57 = icmp eq i32 %56, 0
br label %58
58: ; preds = %52, %49
%59 = phi i1 [ false, %49 ], [ %57, %52 ]
br i1 %59, label %60, label %121
60: ; preds = %58
%61 = load %struct.node*, %struct.node** %4
%62 = load i8*, i8** %5
%63 = load %struct.node*, %struct.node** %6
%64 = load i8, i8* %7
%65 = load i8, i8* %8
%66 = load i8, i8* %11
%67 = load i8, i8* %12
%68 = call %struct.node* @store_move(%struct.node* %61, i8* %62, i32 0, %struct.node* %63, i8 signext %64, i8 signext %65, i8 signext %66, i8 signext %67)
store %struct.node* %68, %struct.node** %4
%69 = load i32, i32* %9
%70 = add nsw i32 %69, 1
store i32 %70, i32* %9
%71 = load i8, i8* %11
%72 = sext i8 %71 to i32
%73 = icmp sgt i32 %72, 97
br i1 %73, label %74, label %107
74: ; preds = %60
%75 = load i8, i8* %12
%76 = sext i8 %75 to i32
%77 = icmp sgt i32 %76, 49
br i1 %77, label %78, label %107
78: ; preds = %74
%79 = load i8*, i8** %5
%80 = load i8, i8* %11
%81 = sext i8 %80 to i32
%82 = sub nsw i32 %81, 1
%83 = trunc i32 %82 to i8
%84 = load i8, i8* %12
%85 = sext i8 %84 to i32
%86 = sub nsw i32 %85, 1
%87 = trunc i32 %86 to i8
%88 = call i32 @is_occupied(i8* %79, i8 signext %83, i8 signext %87)
%89 = icmp eq i32 %88, 1
br i1 %89, label %90, label %107
90: ; preds = %78
%91 = load %struct.node*, %struct.node** %4
%92 = load i8*, i8** %5
%93 = load %struct.node*, %struct.node** %6
%94 = load i8, i8* %7
%95 = load i8, i8* %8
%96 = load i8, i8* %11
%97 = sext i8 %96 to i32
%98 = sub nsw i32 %97, 1
%99 = trunc i32 %98 to i8
%100 = load i8, i8* %12
%101 = sext i8 %100 to i32
%102 = sub nsw i32 %101, 1
%103 = trunc i32 %102 to i8
%104 = call %struct.node* @store_move(%struct.node* %91, i8* %92, i32 0, %struct.node* %93, i8 signext %94, i8 signext %95, i8 signext %99, i8 signext %103)
store %struct.node* %104, %struct.node** %4
%105 = load i32, i32* %9
%106 = add nsw i32 %105, 1
store i32 %106, i32* %9
store i32 0, i32* %13
br label %107
107: ; preds = %90, %78, %74, %60
%108 = load i8, i8* %11
%109 = add i8 %108, -1
store i8 %109, i8* %11
%110 = load i8, i8* %12
%111 = add i8 %110, -1
store i8 %111, i8* %12
%112 = load i8, i8* %11
%113 = sext i8 %112 to i32
%114 = icmp slt i32 %113, 97
br i1 %114, label %119, label %115
115: ; preds = %107
%116 = load i8, i8* %12
%117 = sext i8 %116 to i32
%118 = icmp slt i32 %117, 49
br i1 %118, label %119, label %120
119: ; preds = %115, %107
store i32 0, i32* %13
br label %120
120: ; preds = %119, %115
br label %49
121: ; preds = %58
%122 = load i8, i8* %7
%123 = sext i8 %122 to i32
%124 = add nsw i32 %123, 1
%125 = trunc i32 %124 to i8
store i8 %125, i8* %11
%126 = load i8, i8* %8
%127 = sext i8 %126 to i32
%128 = sub nsw i32 %127, 1
%129 = trunc i32 %128 to i8
store i8 %129, i8* %12
store i32 1, i32* %13
%130 = load i8, i8* %7
%131 = sext i8 %130 to i32
%132 = icmp eq i32 %131, 104
br i1 %132, label %137, label %133
133: ; preds = %121
%134 = load i8, i8* %8
%135 = sext i8 %134 to i32
%136 = icmp eq i32 %135, 49
br i1 %136, label %137, label %138
137: ; preds = %133, %121
store i32 0, i32* %13
br label %138
138: ; preds = %137, %133
br label %139
139: ; preds = %210, %138
%140 = load i32, i32* %13
%141 = icmp eq i32 %140, 1
br i1 %141, label %142, label %148
142: ; preds = %139
%143 = load i8*, i8** %5
%144 = load i8, i8* %11
%145 = load i8, i8* %12
%146 = call i32 @is_occupied(i8* %143, i8 signext %144, i8 signext %145)
%147 = icmp eq i32 %146, 0
br label %148
148: ; preds = %142, %139
%149 = phi i1 [ false, %139 ], [ %147, %142 ]
br i1 %149, label %150, label %211
150: ; preds = %148
%151 = load %struct.node*, %struct.node** %4
%152 = load i8*, i8** %5
%153 = load %struct.node*, %struct.node** %6
%154 = load i8, i8* %7
%155 = load i8, i8* %8
%156 = load i8, i8* %11
%157 = load i8, i8* %12
%158 = call %struct.node* @store_move(%struct.node* %151, i8* %152, i32 0, %struct.node* %153, i8 signext %154, i8 signext %155, i8 signext %156, i8 signext %157)
store %struct.node* %158, %struct.node** %4
%159 = load i32, i32* %9
%160 = add nsw i32 %159, 1
store i32 %160, i32* %9
%161 = load i8, i8* %11
%162 = sext i8 %161 to i32
%163 = icmp slt i32 %162, 104
br i1 %163, label %164, label %197
164: ; preds = %150
%165 = load i8, i8* %12
%166 = sext i8 %165 to i32
%167 = icmp sgt i32 %166, 49
br i1 %167, label %168, label %197
168: ; preds = %164
%169 = load i8*, i8** %5
%170 = load i8, i8* %11
%171 = sext i8 %170 to i32
%172 = add nsw i32 %171, 1
%173 = trunc i32 %172 to i8
%174 = load i8, i8* %12
%175 = sext i8 %174 to i32
%176 = sub nsw i32 %175, 1
%177 = trunc i32 %176 to i8
%178 = call i32 @is_occupied(i8* %169, i8 signext %173, i8 signext %177)
%179 = icmp eq i32 %178, 1
br i1 %179, label %180, label %197
180: ; preds = %168
%181 = load %struct.node*, %struct.node** %4
%182 = load i8*, i8** %5
%183 = load %struct.node*, %struct.node** %6
%184 = load i8, i8* %7
%185 = load i8, i8* %8
%186 = load i8, i8* %11
%187 = sext i8 %186 to i32
%188 = add nsw i32 %187, 1
%189 = trunc i32 %188 to i8
%190 = load i8, i8* %12
%191 = sext i8 %190 to i32
%192 = sub nsw i32 %191, 1
%193 = trunc i32 %192 to i8
%194 = call %struct.node* @store_move(%struct.node* %181, i8* %182, i32 0, %struct.node* %183, i8 signext %184, i8 signext %185, i8 signext %189, i8 signext %193)
store %struct.node* %194, %struct.node** %4
%195 = load i32, i32* %9
%196 = add nsw i32 %195, 1
store i32 %196, i32* %9
store i32 0, i32* %13
br label %197
197: ; preds = %180, %168, %164, %150
%198 = load i8, i8* %11
%199 = add i8 %198, 1
store i8 %199, i8* %11
%200 = load i8, i8* %12
%201 = add i8 %200, -1
store i8 %201, i8* %12
%202 = load i8, i8* %11
%203 = sext i8 %202 to i32
%204 = icmp sgt i32 %203, 104
br i1 %204, label %209, label %205
205: ; preds = %197
%206 = load i8, i8* %12
%207 = sext i8 %206 to i32
%208 = icmp slt i32 %207, 49
br i1 %208, label %209, label %210
209: ; preds = %205, %197
store i32 0, i32* %13
br label %210
210: ; preds = %209, %205
br label %139
211: ; preds = %148
%212 = load i8, i8* %7
%213 = sext i8 %212 to i32
%214 = sub nsw i32 %213, 1
%215 = trunc i32 %214 to i8
store i8 %215, i8* %11
%216 = load i8, i8* %8
%217 = sext i8 %216 to i32
%218 = add nsw i32 %217, 1
%219 = trunc i32 %218 to i8
store i8 %219, i8* %12
store i32 1, i32* %13
%220 = load i8, i8* %7
%221 = sext i8 %220 to i32
%222 = icmp eq i32 %221, 97
br i1 %222, label %227, label %223
223: ; preds = %211
%224 = load i8, i8* %8
%225 = sext i8 %224 to i32
%226 = icmp eq i32 %225, 56
br i1 %226, label %227, label %228
227: ; preds = %223, %211
store i32 0, i32* %13
br label %228
228: ; preds = %227, %223
br label %229
229: ; preds = %300, %228
%230 = load i32, i32* %13
%231 = icmp eq i32 %230, 1
br i1 %231, label %232, label %238
232: ; preds = %229
%233 = load i8*, i8** %5
%234 = load i8, i8* %11
%235 = load i8, i8* %12
%236 = call i32 @is_occupied(i8* %233, i8 signext %234, i8 signext %235)
%237 = icmp eq i32 %236, 0
br label %238
238: ; preds = %232, %229
%239 = phi i1 [ false, %229 ], [ %237, %232 ]
br i1 %239, label %240, label %301
240: ; preds = %238
%241 = load %struct.node*, %struct.node** %4
%242 = load i8*, i8** %5
%243 = load %struct.node*, %struct.node** %6
%244 = load i8, i8* %7
%245 = load i8, i8* %8
%246 = load i8, i8* %11
%247 = load i8, i8* %12
%248 = call %struct.node* @store_move(%struct.node* %241, i8* %242, i32 0, %struct.node* %243, i8 signext %244, i8 signext %245, i8 signext %246, i8 signext %247)
store %struct.node* %248, %struct.node** %4
%249 = load i32, i32* %9
%250 = add nsw i32 %249, 1
store i32 %250, i32* %9
%251 = load i8, i8* %11
%252 = sext i8 %251 to i32
%253 = icmp sgt i32 %252, 97
br i1 %253, label %254, label %287
254: ; preds = %240
%255 = load i8, i8* %12
%256 = sext i8 %255 to i32
%257 = icmp slt i32 %256, 56
br i1 %257, label %258, label %287
258: ; preds = %254
%259 = load i8*, i8** %5
%260 = load i8, i8* %11
%261 = sext i8 %260 to i32
%262 = sub nsw i32 %261, 1
%263 = trunc i32 %262 to i8
%264 = load i8, i8* %12
%265 = sext i8 %264 to i32
%266 = add nsw i32 %265, 1
%267 = trunc i32 %266 to i8
%268 = call i32 @is_occupied(i8* %259, i8 signext %263, i8 signext %267)
%269 = icmp eq i32 %268, 1
br i1 %269, label %270, label %287
270: ; preds = %258
%271 = load %struct.node*, %struct.node** %4
%272 = load i8*, i8** %5
%273 = load %struct.node*, %struct.node** %6
%274 = load i8, i8* %7
%275 = load i8, i8* %8
%276 = load i8, i8* %11
%277 = sext i8 %276 to i32
%278 = sub nsw i32 %277, 1
%279 = trunc i32 %278 to i8
%280 = load i8, i8* %12
%281 = sext i8 %280 to i32
%282 = add nsw i32 %281, 1
%283 = trunc i32 %282 to i8
%284 = call %struct.node* @store_move(%struct.node* %271, i8* %272, i32 0, %struct.node* %273, i8 signext %274, i8 signext %275, i8 signext %279, i8 signext %283)
store %struct.node* %284, %struct.node** %4
%285 = load i32, i32* %9
%286 = add nsw i32 %285, 1
store i32 %286, i32* %9
store i32 0, i32* %13
br label %287
287: ; preds = %270, %258, %254, %240
%288 = load i8, i8* %11
%289 = add i8 %288, -1
store i8 %289, i8* %11
%290 = load i8, i8* %12
%291 = add i8 %290, 1
store i8 %291, i8* %12
%292 = load i8, i8* %11
%293 = sext i8 %292 to i32
%294 = icmp slt i32 %293, 97
br i1 %294, label %299, label %295
295: ; preds = %287
%296 = load i8, i8* %12
%297 = sext i8 %296 to i32
%298 = icmp sgt i32 %297, 56
br i1 %298, label %299, label %300
299: ; preds = %295, %287
store i32 0, i32* %13
br label %300
300: ; preds = %299, %295
br label %229
301: ; preds = %238
%302 = load i8, i8* %7
%303 = sext i8 %302 to i32
%304 = add nsw i32 %303, 1
%305 = trunc i32 %304 to i8
store i8 %305, i8* %11
%306 = load i8, i8* %8
%307 = sext i8 %306 to i32
%308 = add nsw i32 %307, 1
%309 = trunc i32 %308 to i8
store i8 %309, i8* %12
store i32 1, i32* %13
%310 = load i8, i8* %7
%311 = sext i8 %310 to i32
%312 = icmp eq i32 %311, 104
br i1 %312, label %317, label %313
313: ; preds = %301
%314 = load i8, i8* %8
%315 = sext i8 %314 to i32
%316 = icmp eq i32 %315, 56
br i1 %316, label %317, label %318
317: ; preds = %313, %301
store i32 0, i32* %13
br label %318
318: ; preds = %317, %313
br label %319
319: ; preds = %390, %318
%320 = load i32, i32* %13
%321 = icmp eq i32 %320, 1
br i1 %321, label %322, label %328
322: ; preds = %319
%323 = load i8*, i8** %5
%324 = load i8, i8* %11
%325 = load i8, i8* %12
%326 = call i32 @is_occupied(i8* %323, i8 signext %324, i8 signext %325)
%327 = icmp eq i32 %326, 0
br label %328
328: ; preds = %322, %319
%329 = phi i1 [ false, %319 ], [ %327, %322 ]
br i1 %329, label %330, label %391
330: ; preds = %328
%331 = load %struct.node*, %struct.node** %4
%332 = load i8*, i8** %5
%333 = load %struct.node*, %struct.node** %6
%334 = load i8, i8* %7
%335 = load i8, i8* %8
%336 = load i8, i8* %11
%337 = load i8, i8* %12
%338 = call %struct.node* @store_move(%struct.node* %331, i8* %332, i32 0, %struct.node* %333, i8 signext %334, i8 signext %335, i8 signext %336, i8 signext %337)
store %struct.node* %338, %struct.node** %4
%339 = load i32, i32* %9
%340 = add nsw i32 %339, 1
store i32 %340, i32* %9
%341 = load i8, i8* %11
%342 = sext i8 %341 to i32
%343 = icmp slt i32 %342, 104
br i1 %343, label %344, label %377
344: ; preds = %330
%345 = load i8, i8* %12
%346 = sext i8 %345 to i32
%347 = icmp slt i32 %346, 56
br i1 %347, label %348, label %377
348: ; preds = %344
%349 = load i8*, i8** %5
%350 = load i8, i8* %11
%351 = sext i8 %350 to i32
%352 = add nsw i32 %351, 1
%353 = trunc i32 %352 to i8
%354 = load i8, i8* %12
%355 = sext i8 %354 to i32
%356 = add nsw i32 %355, 1
%357 = trunc i32 %356 to i8
%358 = call i32 @is_occupied(i8* %349, i8 signext %353, i8 signext %357)
%359 = icmp eq i32 %358, 1
br i1 %359, label %360, label %377
360: ; preds = %348
%361 = load %struct.node*, %struct.node** %4
%362 = load i8*, i8** %5
%363 = load %struct.node*, %struct.node** %6
%364 = load i8, i8* %7
%365 = load i8, i8* %8
%366 = load i8, i8* %11
%367 = sext i8 %366 to i32
%368 = add nsw i32 %367, 1
%369 = trunc i32 %368 to i8
%370 = load i8, i8* %12
%371 = sext i8 %370 to i32
%372 = add nsw i32 %371, 1
%373 = trunc i32 %372 to i8
%374 = call %struct.node* @store_move(%struct.node* %361, i8* %362, i32 0, %struct.node* %363, i8 signext %364, i8 signext %365, i8 signext %369, i8 signext %373)
store %struct.node* %374, %struct.node** %4
%375 = load i32, i32* %9
%376 = add nsw i32 %375, 1
store i32 %376, i32* %9
store i32 0, i32* %13
br label %377
377: ; preds = %360, %348, %344, %330
%378 = load i8, i8* %11
%379 = add i8 %378, 1
store i8 %379, i8* %11
%380 = load i8, i8* %12
%381 = add i8 %380, 1
store i8 %381, i8* %12
%382 = load i8, i8* %11
%383 = sext i8 %382 to i32
%384 = icmp sgt i32 %383, 104
br i1 %384, label %389, label %385
385: ; preds = %377
%386 = load i8, i8* %12
%387 = sext i8 %386 to i32
%388 = icmp sgt i32 %387, 56
br i1 %388, label %389, label %390
389: ; preds = %385, %377
store i32 0, i32* %13
br label %390
390: ; preds = %389, %385
br label %319
391: ; preds = %328
br label %392
392: ; preds = %391, %23
br label %393
393: ; preds = %392
%394 = load i8, i8* %8
%395 = add i8 %394, 1
store i8 %395, i8* %8
br label %19
396: ; preds = %19
br label %397
397: ; preds = %396
%398 = load i8, i8* %7
%399 = add i8 %398, 1
store i8 %399, i8* %7
br label %14
400: ; preds = %14
%401 = load %struct.node*, %struct.node** %4
ret %struct.node* %401
}

LLVM IR (-O2):
%struct.node = type { i32 }
define %struct.node* @get_bishop_moves_black(%struct.node* %0, i8* %1, %struct.node* %2) {
br label %4
4: ; preds = %3, %125
%5 = phi %struct.node* [ %0, %3 ], [ %123, %125 ]
%6 = phi i8 [ 97, %3 ], [ %9, %125 ]
%7 = add nsw i8 %6, -1
%8 = icmp eq i8 %6, 97
%9 = add nuw nsw i8 %6, 1
%10 = icmp eq i8 %6, 104
br label %11
11: ; preds = %4, %121
%12 = phi %struct.node* [ %5, %4 ], [ %123, %121 ]
%13 = phi i8 [ 49, %4 ], [ %122, %121 ]
%14 = tail call signext i8 @get_piece(i8* %1, i8 signext %6, i8 signext %13)
%15 = icmp eq i8 %14, 98
br i1 %15, label %18, label %16
16: ; preds = %11
%17 = add nuw nsw i8 %13, 1
br label %121
18: ; preds = %11
%19 = add nsw i8 %13, -1
%20 = icmp eq i8 %13, 49
%21 = or i1 %8, %20
br i1 %21, label %44, label %22
22: ; preds = %18, %40
%23 = phi i8 [ %34, %40 ], [ %19, %18 ]
%24 = phi i8 [ %33, %40 ], [ %7, %18 ]
%25 = phi %struct.node* [ %29, %40 ], [ %12, %18 ]
%26 = tail call i32 @is_occupied(i8* %1, i8 signext %24, i8 signext %23)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %44
28: ; preds = %22
%29 = tail call %struct.node* @store_move(%struct.node* %25, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %24, i8 signext %23)
%30 = icmp ugt i8 %24, 97
%31 = icmp ugt i8 %23, 49
%32 = and i1 %30, %31
%33 = add nsw i8 %24, -1
%34 = add nsw i8 %23, -1
br i1 %32, label %35, label %40
35: ; preds = %28
%36 = tail call i32 @is_occupied(i8* %1, i8 signext %33, i8 signext %34)
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = tail call %struct.node* @store_move(%struct.node* %29, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %33, i8 signext %34)
br label %44
40: ; preds = %28, %35
%41 = icmp ugt i8 %33, 96
%42 = icmp ugt i8 %34, 48
%43 = and i1 %41, %42
br i1 %43, label %22, label %44
44: ; preds = %22, %40, %38, %18
%45 = phi %struct.node* [ %12, %18 ], [ %39, %38 ], [ %29, %40 ], [ %25, %22 ]
%46 = or i1 %10, %20
br i1 %46, label %69, label %47
47: ; preds = %44, %65
%48 = phi i8 [ %59, %65 ], [ %19, %44 ]
%49 = phi i8 [ %58, %65 ], [ %9, %44 ]
%50 = phi %struct.node* [ %54, %65 ], [ %45, %44 ]
%51 = tail call i32 @is_occupied(i8* %1, i8 signext %49, i8 signext %48)
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %69
53: ; preds = %47
%54 = tail call %struct.node* @store_move(%struct.node* %50, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %49, i8 signext %48)
%55 = icmp ult i8 %49, 104
%56 = icmp ugt i8 %48, 49
%57 = and i1 %55, %56
%58 = add nuw nsw i8 %49, 1
%59 = add nsw i8 %48, -1
br i1 %57, label %60, label %65
60: ; preds = %53
%61 = tail call i32 @is_occupied(i8* %1, i8 signext %58, i8 signext %59)
%62 = icmp eq i32 %61, 1
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = tail call %struct.node* @store_move(%struct.node* %54, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %58, i8 signext %59)
br label %69
65: ; preds = %53, %60
%66 = icmp ult i8 %49, 104
%67 = icmp ugt i8 %59, 48
%68 = and i1 %66, %67
br i1 %68, label %47, label %69
69: ; preds = %47, %65, %63, %44
%70 = phi %struct.node* [ %45, %44 ], [ %64, %63 ], [ %54, %65 ], [ %50, %47 ]
%71 = add nuw nsw i8 %13, 1
%72 = icmp eq i8 %13, 56
%73 = or i1 %8, %72
br i1 %73, label %96, label %74
74: ; preds = %69, %92
%75 = phi i8 [ %86, %92 ], [ %71, %69 ]
%76 = phi i8 [ %85, %92 ], [ %7, %69 ]
%77 = phi %struct.node* [ %81, %92 ], [ %70, %69 ]
%78 = tail call i32 @is_occupied(i8* %1, i8 signext %76, i8 signext %75)
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %96
80: ; preds = %74
%81 = tail call %struct.node* @store_move(%struct.node* %77, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %76, i8 signext %75)
%82 = icmp ugt i8 %76, 97
%83 = icmp ult i8 %75, 56
%84 = and i1 %82, %83
%85 = add nsw i8 %76, -1
%86 = add nuw nsw i8 %75, 1
br i1 %84, label %87, label %92
87: ; preds = %80
%88 = tail call i32 @is_occupied(i8* %1, i8 signext %85, i8 signext %86)
%89 = icmp eq i32 %88, 1
br i1 %89, label %90, label %92
90: ; preds = %87
%91 = tail call %struct.node* @store_move(%struct.node* %81, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %85, i8 signext %86)
br label %96
92: ; preds = %80, %87
%93 = icmp ugt i8 %85, 96
%94 = icmp ult i8 %75, 56
%95 = and i1 %93, %94
br i1 %95, label %74, label %96
96: ; preds = %74, %92, %90, %69
%97 = phi %struct.node* [ %70, %69 ], [ %91, %90 ], [ %81, %92 ], [ %77, %74 ]
%98 = or i1 %10, %72
br i1 %98, label %121, label %99
99: ; preds = %96, %117
%100 = phi i8 [ %111, %117 ], [ %71, %96 ]
%101 = phi i8 [ %110, %117 ], [ %9, %96 ]
%102 = phi %struct.node* [ %106, %117 ], [ %97, %96 ]
%103 = tail call i32 @is_occupied(i8* %1, i8 signext %101, i8 signext %100)
%104 = icmp eq i32 %103, 0
br i1 %104, label %105, label %121
105: ; preds = %99
%106 = tail call %struct.node* @store_move(%struct.node* %102, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %101, i8 signext %100)
%107 = icmp ult i8 %101, 104
%108 = icmp ult i8 %100, 56
%109 = and i1 %107, %108
%110 = add nuw nsw i8 %101, 1
%111 = add nuw nsw i8 %100, 1
br i1 %109, label %112, label %117
112: ; preds = %105
%113 = tail call i32 @is_occupied(i8* %1, i8 signext %110, i8 signext %111)
%114 = icmp eq i32 %113, 1
br i1 %114, label %115, label %117
115: ; preds = %112
%116 = tail call %struct.node* @store_move(%struct.node* %106, i8* %1, i32 0, %struct.node* %2, i8 signext %6, i8 signext %13, i8 signext %110, i8 signext %111)
br label %121
117: ; preds = %105, %112
%118 = icmp ult i8 %101, 104
%119 = icmp ult i8 %100, 56
%120 = and i1 %118, %119
br i1 %120, label %99, label %121
121: ; preds = %117, %99, %115, %16, %96
%122 = phi i8 [ %17, %16 ], [ %71, %96 ], [ %71, %115 ], [ %71, %99 ], [ %71, %117 ]
%123 = phi %struct.node* [ %12, %16 ], [ %97, %96 ], [ %116, %115 ], [ %106, %117 ], [ %102, %99 ]
%124 = icmp eq i8 %122, 57
br i1 %124, label %125, label %11
125: ; preds = %121
%126 = icmp eq i8 %9, 105
br i1 %126, label %127, label %4
127: ; preds = %125
ret %struct.node* %123
}