// File: bjohnsonfl[P]Overhead-Chess-Engine-/UCI.cpp
// Function: UCI::moveToString[abi:cxx11](move)
std::string UCI::moveToString (move m)
{
    
    //the only internal moves different to external are castling and promotions
    //internally: castling is king to rook sq
    //externally: castling is king src to king dest
    //for promotions, just add the promo letter i.e. fromToPromo
    std::string mv = "    ";
    std::string pieceletters = " nbrq";
    square from ,to;
    from = source_sq(m);
    to = destination_sq(m);
    mv[0] = square_to_file(from) + 'a';
    mv[1] = square_to_rank(from) + '1';
    mv[2] = square_to_file(to) + 'a';
    mv[3] = square_to_rank(to) + '1';
    
    if(move_flag(m) == promoting)
        mv += pieceletters[promo_pieceType(m)];
    
    if(move_flag(m) == castling){
        if(to == a1){
            mv[2] = 'c';
            mv[3] = '1';
        }
        else if(to == h1){
            mv[2] = 'g';
            mv[3] = '1';
        }
        else if(to == a8){
            mv[2] = 'c';
            mv[3] = '8';
        }
        else if(to == h8){
            mv[2] = 'g';
            mv[3] = '8';
        }
    }
    return mv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x68(%rbp)
movq %rdi, %rax
movq %rax, -0x70(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movb $0x0, -0x15(%rbp)
leaq -0x16(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x33a0
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rdx
leaq 0x1cc3(%rip), %rsi      # 0xe5f4
callq 0x3b70
jmp 0xc938
leaq -0x16(%rbp), %rdi
callq 0x3230
leaq -0x49(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x33a0
movq -0x78(%rbp), %rdx
leaq 0x1ca0(%rip), %rsi      # 0xe5f9
leaq -0x48(%rbp), %rdi
callq 0x3b70
jmp 0xc964
leaq -0x49(%rbp), %rdi
callq 0x3230
movl -0x14(%rbp), %edi
callq 0x7860
movl %eax, -0x7c(%rbp)
jmp 0xc97a
movl -0x7c(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x14(%rbp), %edi
callq 0x7870
movl %eax, -0x80(%rbp)
jmp 0xc98d
movl -0x80(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x50(%rbp), %edi
callq 0x59f0
movl %eax, -0x84(%rbp)
jmp 0xc9a3
movq -0x68(%rbp), %rdi
movl -0x84(%rbp), %eax
addb $0x61, %al
movb %al, -0x91(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0x33f0
movq %rax, -0x90(%rbp)
jmp 0xc9c7
movq -0x90(%rbp), %rax
movb -0x91(%rbp), %cl
movb %cl, (%rax)
movl -0x50(%rbp), %edi
callq 0x59d0
movl %eax, -0x98(%rbp)
jmp 0xc9e6
movq -0x68(%rbp), %rdi
movl -0x98(%rbp), %eax
addb $0x31, %al
movb %al, -0xa1(%rbp)
movl $0x1, %esi
callq 0x33f0
movq %rax, -0xa0(%rbp)
jmp 0xca0b
movq -0xa0(%rbp), %rax
movb -0xa1(%rbp), %cl
movb %cl, (%rax)
movl -0x54(%rbp), %edi
callq 0x59f0
movl %eax, -0xa8(%rbp)
jmp 0xca2a
movq -0x68(%rbp), %rdi
movl -0xa8(%rbp), %eax
addb $0x61, %al
movb %al, -0xb1(%rbp)
movl $0x2, %esi
callq 0x33f0
movq %rax, -0xb0(%rbp)
jmp 0xca4f
movq -0xb0(%rbp), %rax
movb -0xb1(%rbp), %cl
movb %cl, (%rax)
movl -0x54(%rbp), %edi
callq 0x59d0
movl %eax, -0xb8(%rbp)
jmp 0xca6e
movq -0x68(%rbp), %rdi
movl -0xb8(%rbp), %eax
addb $0x31, %al
movb %al, -0xc1(%rbp)
movl $0x3, %esi
callq 0x33f0
movq %rax, -0xc0(%rbp)
jmp 0xca93
movq -0xc0(%rbp), %rax
movb -0xc1(%rbp), %cl
movb %cl, (%rax)
movl -0x14(%rbp), %edi
callq 0x78b0
movl %eax, -0xc8(%rbp)
jmp 0xcab2
movl -0xc8(%rbp), %eax
cmpl $0x3, %eax
jne 0xcb52
movl -0x14(%rbp), %edi
callq 0x7890
movl %eax, -0xcc(%rbp)
jmp 0xcad1
movl -0xcc(%rbp), %eax
movl %eax, %eax
movl %eax, %esi
leaq -0x48(%rbp), %rdi
callq 0x33f0
movq %rax, -0xd8(%rbp)
jmp 0xcaed
movq -0x68(%rbp), %rdi
movq -0xd8(%rbp), %rax
movsbl (%rax), %esi
callq 0x3130
jmp 0xcb02
jmp 0xcb52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x16(%rbp), %rdi
callq 0x3230
jmp 0xccd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x3230
jmp 0xccce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3408
jmp 0xccce
movl -0x14(%rbp), %edi
callq 0x78b0
movl %eax, -0xdc(%rbp)
jmp 0xcb62
movl -0xdc(%rbp), %eax
cmpl $0x2, %eax
jne 0xcca5
cmpl $0x0, -0x54(%rbp)
jne 0xcbbe
movq -0x68(%rbp), %rdi
movl $0x2, %esi
callq 0x33f0
movq %rax, -0xe8(%rbp)
jmp 0xcb8e
movq -0x68(%rbp), %rdi
movq -0xe8(%rbp), %rax
movb $0x63, (%rax)
movl $0x3, %esi
callq 0x33f0
movq %rax, -0xf0(%rbp)
jmp 0xcbaf
movq -0xf0(%rbp), %rax
movb $0x31, (%rax)
jmp 0xcca3
cmpl $0x7, -0x54(%rbp)
jne 0xcc0b
movq -0x68(%rbp), %rdi
movl $0x2, %esi
callq 0x33f0
movq %rax, -0xf8(%rbp)
jmp 0xcbdb
movq -0x68(%rbp), %rdi
movq -0xf8(%rbp), %rax
movb $0x67, (%rax)
movl $0x3, %esi
callq 0x33f0
movq %rax, -0x100(%rbp)
jmp 0xcbfc
movq -0x100(%rbp), %rax
movb $0x31, (%rax)
jmp 0xcca1
cmpl $0x38, -0x54(%rbp)
jne 0xcc55
movq -0x68(%rbp), %rdi
movl $0x2, %esi
callq 0x33f0
movq %rax, -0x108(%rbp)
jmp 0xcc28
movq -0x68(%rbp), %rdi
movq -0x108(%rbp), %rax
movb $0x63, (%rax)
movl $0x3, %esi
callq 0x33f0
movq %rax, -0x110(%rbp)
jmp 0xcc49
movq -0x110(%rbp), %rax
movb $0x38, (%rax)
jmp 0xcc9f
cmpl $0x3f, -0x54(%rbp)
jne 0xcc9d
movq -0x68(%rbp), %rdi
movl $0x2, %esi
callq 0x33f0
movq %rax, -0x118(%rbp)
jmp 0xcc72
movq -0x68(%rbp), %rdi
movq -0x118(%rbp), %rax
movb $0x67, (%rax)
movl $0x3, %esi
callq 0x33f0
movq %rax, -0x120(%rbp)
jmp 0xcc93
movq -0x120(%rbp), %rax
movb $0x38, (%rax)
jmp 0xcc9f
jmp 0xcca1
jmp 0xcca3
jmp 0xcca5
movb $0x1, -0x15(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3408
testb $0x1, -0x15(%rbp)
jne 0xccc1
movq -0x68(%rbp), %rdi
callq 0x3408
movq -0x70(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x3408
movq -0x20(%rbp), %rdi
callq 0x3390