// File: ATOMIC-LICHESS[P]ATOMKRAFT/debug.cpp
// Function: print_bb(unsigned long)
void print_bb(Bitboard bb) {
	Piece piece;
	Piece pieces[64];
	
	for (int k = 0; k < 64; ++k) {
		pieces[k] = PIECE_NONE;
	}
	
	while (bb) {
		pieces[pop_1st_bit(&bb)] = PIECE_NONE_DARK_SQ;
	}
	
	cout << "    0   1   2   3   4   5   6   7" << endl;
	cout << "  +---+---+---+---+---+---+---+---+" << endl;
	
	for (int rank = 7; rank >= 0; --rank) {
		cout << rank + 1 << " |";
		for (int file = 0; file < 8; ++file) {
			piece = pieces[BOARDVTOI[rank][file]];
			if (piece < 0 || piece > 16) {
				cout << "ERROR" << endl;
				return;
			}
			cout << " " << PIECE_NAME[piece] << " |";
		}
		cout << " " << rank << endl;
		cout << "  +---+---+---+---+---+---+---+---+" << endl;
	}
	
	cout << "    a   b   c   d   e   f   g   h" << endl;
}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x120(%rsp)
movl $0x0, 0xc(%rsp)
cmpl $0x40, 0xc(%rsp)
jge 0x15dd8
movslq 0xc(%rsp), %rax
movl $0x10, 0x10(%rsp,%rax,4)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x15db7
jmp 0x15dda
cmpq $0x0, 0x120(%rsp)
je 0x15dfe
leaq 0x120(%rsp), %rdi
callq 0xd940
cltq
movl $0x0, 0x10(%rsp,%rax,4)
jmp 0x15dda
movq 0x561b3(%rip), %rdi     # 0x6bfb8
leaq 0x4384a(%rip), %rsi     # 0x59656
callq 0x64b0
movq %rax, %rdi
movq 0x56175(%rip), %rsi     # 0x6bf90
callq 0x6520
movq 0x56191(%rip), %rdi     # 0x6bfb8
leaq 0x4384a(%rip), %rsi     # 0x59678
callq 0x64b0
movq %rax, %rdi
movq 0x56153(%rip), %rsi     # 0x6bf90
callq 0x6520
movl $0x7, 0x8(%rsp)
cmpl $0x0, 0x8(%rsp)
jl 0x15f9a
movl 0x8(%rsp), %esi
addl $0x1, %esi
movq 0x56155(%rip), %rdi     # 0x6bfb8
callq 0x6940
movq %rax, %rdi
leaq 0x4382a(%rip), %rsi     # 0x5969c
callq 0x64b0
movl $0x0, 0x4(%rsp)
cmpl $0x8, 0x4(%rsp)
jge 0x15f3a
movslq 0x8(%rsp), %rcx
leaq 0x438aa(%rip), %rax     # 0x59740
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x4(%rsp), %rcx
movslq (%rax,%rcx,4), %rax
movl 0x10(%rsp,%rax,4), %eax
movl %eax, 0x11c(%rsp)
cmpl $0x0, 0x11c(%rsp)
jl 0x15ec5
cmpl $0x10, 0x11c(%rsp)
jle 0x15eec
movq 0x560ec(%rip), %rdi     # 0x6bfb8
leaq 0x437cc(%rip), %rsi     # 0x5969f
callq 0x64b0
movq %rax, %rdi
movq 0x560ae(%rip), %rsi     # 0x6bf90
callq 0x6520
jmp 0x15fbc
movq 0x560c5(%rip), %rdi     # 0x6bfb8
leaq 0x43666(%rip), %rsi     # 0x59560
callq 0x64b0
movq %rax, %rdi
movl 0x11c(%rsp), %eax
movl %eax, %ecx
leaq 0x4392e(%rip), %rax     # 0x59840
movsbl (%rax,%rcx), %esi
callq 0x65d0
movq %rax, %rdi
leaq 0x43777(%rip), %rsi     # 0x5969c
callq 0x64b0
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x15e7f
movq 0x56077(%rip), %rdi     # 0x6bfb8
leaq 0x43618(%rip), %rsi     # 0x59560
callq 0x64b0
movq %rax, %rdi
movl 0x8(%rsp), %esi
callq 0x6940
movq %rax, %rdi
movq 0x5602d(%rip), %rsi     # 0x6bf90
callq 0x6520
movq 0x56049(%rip), %rdi     # 0x6bfb8
leaq 0x43702(%rip), %rsi     # 0x59678
callq 0x64b0
movq %rax, %rdi
movq 0x5600b(%rip), %rsi     # 0x6bf90
callq 0x6520
movl 0x8(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x15e4a
movq 0x56017(%rip), %rdi     # 0x6bfb8
leaq 0x436fd(%rip), %rsi     # 0x596a5
callq 0x64b0
movq %rax, %rdi
movq 0x55fd9(%rip), %rsi     # 0x6bf90
callq 0x6520
addq $0x128, %rsp            # imm = 0x128
retq
nopw %cs:(%rax,%rax)