// File: /workspace/github_c_makefile_star2_O0/ArchLuke[P]YouSuck/Engine.c
// Function: TakeMove
static void TakeMove(S_BOARD *pos) {
    
    
    pos->hisPly--;
    pos->ply--;
    
    int move = pos->history[pos->hisPly].move;
    int from = FROMSQ(move);
    int to = TOSQ(move);    
    
    
    if(pos->enPas != NO_SQ) HASH_EP;
    HASH_CA;

    pos->castlePerm = pos->history[pos->hisPly].castlePerm;
    pos->fiftyMove = pos->history[pos->hisPly].fiftyMove;
    pos->enPas = pos->history[pos->hisPly].enPas;

    if(pos->enPas != NO_SQ) HASH_EP;
    HASH_CA;

    pos->side ^= 1;
    HASH_SIDE;
    
    if(MFLAGEP & move) {
        if(pos->side == WHITE) {
            AddPiece(to-10, pos, bP);
        } else {
            AddPiece(to+10, pos, wP);
        }
    } else if(MFLAGCA & move) {
        switch(to) {
            case C1: MovePiece(D1, A1, pos); break;
            case C8: MovePiece(D8, A8, pos); break;
            case G1: MovePiece(F1, H1, pos); break;
            case G8: MovePiece(F8, H8, pos); break;
            default: break;
        }
    }
    
    MovePiece(to, from, pos);
    
    if(PieceKing[pos->pieces[from]]) {
        pos->KingSq[pos->side] = from;
    }
    
    int captured = CAPTURED(move);
    if(captured != EMPTY) {
        AddPiece(to, pos, captured);
    }
    
    if(PROMOTED(move) != EMPTY)   {
        ClearPiece(from, pos);
        AddPiece(from, pos, (PieceCol[PROMOTED(move)] == WHITE ? wP : bP));
    }
    
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rax
movl 0x210(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x210(%rax)
movq 0x20(%rsp), %rax
movl 0x20c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x20c(%rax)
movq 0x20(%rsp), %rax
addq $0x270, %rax            # imm = 0x270
movq 0x20(%rsp), %rcx
movslq 0x210(%rcx), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
andl $0x7f, %eax
movl %eax, 0x18(%rsp)
movl 0x1c(%rsp), %eax
sarl $0x7, %eax
andl $0x7f, %eax
movl %eax, 0x14(%rsp)
movq 0x20(%rsp), %rax
cmpl $0x63, 0x204(%rax)
je 0x5b76
movq 0x20(%rsp), %rax
movslq 0x204(%rax), %rcx
leaq 0x22531(%rip), %rax     # 0x28090
movq (%rax,%rcx,8), %rcx
movq 0x20(%rsp), %rax
xorq 0x220(%rax), %rcx
movq %rcx, 0x220(%rax)
movq 0x20(%rsp), %rax
movslq 0x214(%rax), %rcx
leaq 0x22487(%rip), %rax     # 0x28010
movq (%rax,%rcx,8), %rcx
movq 0x20(%rsp), %rax
xorq 0x220(%rax), %rcx
movq %rcx, 0x220(%rax)
movq 0x20(%rsp), %rax
addq $0x270, %rax            # imm = 0x270
movq 0x20(%rsp), %rcx
movslq 0x210(%rcx), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x214(%rax)
movq 0x20(%rsp), %rax
addq $0x270, %rax            # imm = 0x270
movq 0x20(%rsp), %rcx
movslq 0x210(%rcx), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x208(%rax)
movq 0x20(%rsp), %rax
addq $0x270, %rax            # imm = 0x270
movq 0x20(%rsp), %rcx
movslq 0x210(%rcx), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x204(%rax)
movq 0x20(%rsp), %rax
cmpl $0x63, 0x204(%rax)
je 0x5c5c
movq 0x20(%rsp), %rax
movslq 0x204(%rax), %rcx
leaq 0x2244b(%rip), %rax     # 0x28090
movq (%rax,%rcx,8), %rcx
movq 0x20(%rsp), %rax
xorq 0x220(%rax), %rcx
movq %rcx, 0x220(%rax)
movq 0x20(%rsp), %rax
movslq 0x214(%rax), %rcx
leaq 0x223a1(%rip), %rax     # 0x28010
movq (%rax,%rcx,8), %rcx
movq 0x20(%rsp), %rax
xorq 0x220(%rax), %rcx
movq %rcx, 0x220(%rax)
movq 0x20(%rsp), %rax
movl 0x200(%rax), %ecx
xorl $0x1, %ecx
movl %ecx, 0x200(%rax)
movq 0x254af(%rip), %rcx     # 0x2b150
movq 0x20(%rsp), %rax
xorq 0x220(%rax), %rcx
movq %rcx, 0x220(%rax)
movl 0x1c(%rsp), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
je 0x5d03
movq 0x20(%rsp), %rax
cmpl $0x0, 0x200(%rax)
jne 0x5ce8
movl 0x14(%rsp), %edi
subl $0xa, %edi
movq 0x20(%rsp), %rsi
movl $0x7, %edx
callq 0x5970
jmp 0x5cfe
movl 0x14(%rsp), %edi
addl $0xa, %edi
movq 0x20(%rsp), %rsi
movl $0x1, %edx
callq 0x5970
jmp 0x5da3
movl 0x1c(%rsp), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
je 0x5da1
movl 0x14(%rsp), %eax
movl %eax, 0xc(%rsp)
subl $0x17, %eax
je 0x5d45
jmp 0x5d24
movl 0xc(%rsp), %eax
subl $0x1b, %eax
je 0x5d71
jmp 0x5d2f
movl 0xc(%rsp), %eax
subl $0x5d, %eax
je 0x5d5b
jmp 0x5d3a
movl 0xc(%rsp), %eax
subl $0x61, %eax
je 0x5d87
jmp 0x5d9d
movq 0x20(%rsp), %rdx
movl $0x18, %edi
movl $0x15, %esi
callq 0x5740
jmp 0x5d9f
movq 0x20(%rsp), %rdx
movl $0x5e, %edi
movl $0x5b, %esi
callq 0x5740
jmp 0x5d9f
movq 0x20(%rsp), %rdx
movl $0x1a, %edi
movl $0x1c, %esi
callq 0x5740
jmp 0x5d9f
movq 0x20(%rsp), %rdx
movl $0x60, %edi
movl $0x62, %esi
callq 0x5740
jmp 0x5d9f
jmp 0x5d9f
jmp 0x5da1
jmp 0x5da3
movl 0x14(%rsp), %edi
movl 0x18(%rsp), %esi
movq 0x20(%rsp), %rdx
callq 0x5740
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x5c86(%rip), %rax      # 0xba50
cmpl $0x0, (%rax,%rcx,4)
je 0x5dec
movl 0x18(%rsp), %edx
movq 0x20(%rsp), %rax
movq 0x20(%rsp), %rcx
movslq 0x200(%rcx), %rcx
movl %edx, 0x1f8(%rax,%rcx,4)
movl 0x1c(%rsp), %eax
sarl $0xe, %eax
andl $0xf, %eax
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x10(%rsp)
je 0x5e13
movl 0x14(%rsp), %edi
movq 0x20(%rsp), %rsi
movl 0x10(%rsp), %edx
callq 0x5970
movl 0x1c(%rsp), %eax
sarl $0x14, %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x5e65
movl 0x18(%rsp), %edi
movq 0x20(%rsp), %rsi
callq 0x5540
movl 0x18(%rsp), %edi
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %eax
sarl $0x14, %eax
andl $0xf, %eax
movslq %eax, %rcx
leaq 0x5513(%rip), %rax      # 0xb360
movl (%rax,%rcx,4), %ecx
movl $0x7, %edx
movl $0x1, %eax
cmpl $0x0, %ecx
cmovel %eax, %edx
callq 0x5970
addq $0x28, %rsp
retq
nopw (%rax,%rax)