// File: whitefusion[P]Jaipur_cardgame-/Human.cpp
// Function: Human::actionVerify(int, Market&)
bool Human::actionVerify(int act, Market &m){
    if (act > 4 || act < 1)
        return false;

    bool allCamel = true;
    int nonCML = 0;
    for (int i = 0; i < 5; ++i){
        if (m.getGoods(i+1).getCard() != "CAMEL"){
            allCamel = false;
            nonCML++;
        }
    }

    int gc, dc, sc, rc;
    gc = dc = sc = rc = 0;

    for (int i = 0; i < getSize(0); ++i){
        string tmp = getHand(0,i).getCard();
        if (tmp == "DIAMD")
            dc++;
        else if (tmp == "GOLD")
            gc++;
        else if (tmp == "SILVR")
            sc++;
        else
            rc++;
    }

    switch (act){
        //take
        case 1:
        {
            if (allCamel || getSize(0) == 7)
                return false;
            else 
                return true;
        }

        // trade
        case 2:
        {
            if (nonCML > 1 && (getSize(0) + getSize(1) > 1))
                return true;
            else
                return false;
        }

        //sell
        case 3:
        {
            if (gc > 1 || dc > 1 || sc > 1 || rc > 0)
                return true;
            else 
                return false;
        }

        //take camel
        case 4:
        {
            if (nonCML < 5) 
                return true;
            else
                return false;
        }
    }

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpl $0x4, -0x14(%rbp)
jg 0x18dad
cmpl $0x1, -0x14(%rbp)
jge 0x18db6
movb $0x0, -0x1(%rbp)
jmp 0x19113
movb $0x1, -0x21(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x5, -0x2c(%rbp)
jge 0x18e83
movq -0x20(%rbp), %rsi
movl -0x2c(%rbp), %edx
incl %edx
leaq -0x70(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x132c0
movq -0xe0(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x12d60
jmp 0x18dfd
leaq 0x537f(%rip), %rsi      # 0x1e183
leaq -0x50(%rbp), %rdi
callq 0x19130
movb %al, -0xe1(%rbp)
jmp 0x18e15
leaq -0x50(%rbp), %rdi
callq 0x2130
leaq -0x70(%rbp), %rdi
callq 0x12d40
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0x18e33
jmp 0x18e73
movb $0x0, -0x21(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x18e73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x18e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x2130
leaq -0x70(%rbp), %rdi
callq 0x12d40
jmp 0x19121
jmp 0x18e75
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x18dc8
movl $0x0, -0x8c(%rbp)
movl $0x0, -0x88(%rbp)
movl $0x0, -0x84(%rbp)
movl $0x0, -0x80(%rbp)
movl $0x0, -0x90(%rbp)
movq -0xd8(%rbp), %rdi
movl -0x90(%rbp), %eax
movl %eax, -0xe8(%rbp)
xorl %esi, %esi
callq 0x14730
movl %eax, %ecx
movl -0xe8(%rbp), %eax
cmpl %ecx, %eax
jge 0x19031
movq -0xd8(%rbp), %rsi
movl -0x90(%rbp), %ecx
leaq -0xd0(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
xorl %edx, %edx
callq 0x14820
movq -0xf0(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x12d60
jmp 0x18f13
leaq -0xd0(%rbp), %rdi
callq 0x12d40
leaq 0x523a(%rip), %rsi      # 0x1e160
leaq -0xb0(%rbp), %rdi
callq 0x13920
movb %al, -0xf1(%rbp)
jmp 0x18f3a
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x18f46
jmp 0x18f94
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x19011
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x12d40
jmp 0x19121
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x2130
jmp 0x19121
leaq 0x51cb(%rip), %rsi      # 0x1e166
leaq -0xb0(%rbp), %rdi
callq 0x13920
movb %al, -0xf2(%rbp)
jmp 0x18faf
movb -0xf2(%rbp), %al
testb $0x1, %al
jne 0x18fbb
jmp 0x18fc6
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x1900f
leaq 0x519e(%rip), %rsi      # 0x1e16b
leaq -0xb0(%rbp), %rdi
callq 0x13920
movb %al, -0xf3(%rbp)
jmp 0x18fe1
movb -0xf3(%rbp), %al
testb $0x1, %al
jne 0x18fed
jmp 0x18ffe
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x1900d
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x1900f
jmp 0x19011
leaq -0xb0(%rbp), %rdi
callq 0x2130
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x18eb2
movl -0x14(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x100(%rbp)
subl $0x3, %eax
ja 0x1910f
movq -0x100(%rbp), %rax
leaq 0x588a(%rip), %rcx      # 0x1e8e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
testb $0x1, -0x21(%rbp)
jne 0x19078
movq -0xd8(%rbp), %rdi
xorl %esi, %esi
callq 0x14730
cmpl $0x7, %eax
jne 0x19081
movb $0x0, -0x1(%rbp)
jmp 0x19113
movb $0x1, -0x1(%rbp)
jmp 0x19113
cmpl $0x1, -0x28(%rbp)
jle 0x190ca
movq -0xd8(%rbp), %rdi
xorl %esi, %esi
callq 0x14730
movq -0xd8(%rbp), %rdi
movl %eax, -0x104(%rbp)
movl $0x1, %esi
callq 0x14730
movl %eax, %ecx
movl -0x104(%rbp), %eax
addl %ecx, %eax
cmpl $0x1, %eax
jle 0x190ca
movb $0x1, -0x1(%rbp)
jmp 0x19113
movb $0x0, -0x1(%rbp)
jmp 0x19113
cmpl $0x1, -0x80(%rbp)
jg 0x190f1
cmpl $0x1, -0x84(%rbp)
jg 0x190f1
cmpl $0x1, -0x88(%rbp)
jg 0x190f1
cmpl $0x0, -0x8c(%rbp)
jle 0x190f7
movb $0x1, -0x1(%rbp)
jmp 0x19113
movb $0x0, -0x1(%rbp)
jmp 0x19113
cmpl $0x5, -0x28(%rbp)
jge 0x19109
movb $0x1, -0x1(%rbp)
jmp 0x19113
movb $0x0, -0x1(%rbp)
jmp 0x19113
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x2360
nopw (%rax,%rax)