// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, 0x10(%rsp)
leal -0x5(%rsi), %eax
xorl %ebp, %ebp
cmpl $-0x4, %eax
jb 0xc952
movq %rsi, 0x40(%rsp)
movq %rdi, 0x18(%rsp)
movb $0x1, %r14b
movl $0x1, %r15d
leaq 0x48(%rsp), %r12
leaq 0x20(%rsp), %rbx
xorl %r13d, %r13d
movl %r13d, %ebp
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movl %r15d, %edx
callq 0x96fa
movq %rbx, %rdi
movq %r12, %r13
movq %r12, %rsi
callq 0x92fe
movq %rbx, %rdi
leaq 0x3a02(%rip), %rsi      # 0x1017e
callq 0x2080
movl %eax, %ebx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xc79f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %r13, %r12
movq %r13, %rdi
callq 0x92e2
xorl %eax, %eax
testl %ebx, %ebx
movzbl %r14b, %r14d
movl $0x0, %ecx
cmovnel %ecx, %r14d
setne %al
movl %ebp, %r13d
addl %eax, %r13d
incl %r15d
cmpl $0x6, %r15d
leaq 0x20(%rsp), %rbx
jne 0xc751
xorl %ebp, %ebp
movq 0x18(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0xa61e
testl %eax, %eax
jle 0xc8ed
movq %r15, %rbx
leaq 0x48(%rsp), %r15
leaq 0x20(%rsp), %r12
movl $0x0, 0xc(%rsp)
movl $0x0, 0x4(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x0, 0x8(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0xa6f2
movq %r12, %rdi
movq %r15, %rsi
callq 0x92fe
movq %r15, %rdi
callq 0x92e2
movq %r12, %rdi
leaq 0x3918(%rip), %rsi      # 0x10160
callq 0x2080
testl %eax, %eax
je 0xc87d
movq %r12, %rdi
leaq 0x3d55(%rip), %rsi      # 0x105b0
callq 0x2080
testl %eax, %eax
je 0xc883
movq %r12, %rdi
leaq 0x38f8(%rip), %rsi      # 0x10166
callq 0x2080
testl %eax, %eax
je 0xc889
incl 0xc(%rsp)
jmp 0xc88d
incl 0x10(%rsp)
jmp 0xc88d
incl 0x8(%rsp)
jmp 0xc88d
incl 0x4(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xc8a9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21a0
incl %ebp
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa61e
cmpl %eax, %ebp
jl 0xc81c
cmpl $0x2, 0x8(%rsp)
setge %al
cmpl $0x2, 0x10(%rsp)
setge %cl
cmpl $0x2, 0x4(%rsp)
setge %dl
orb %al, %dl
orb %cl, %dl
cmpl $0x0, 0xc(%rsp)
setg %bpl
orb %dl, %bpl
movq %rbx, %r15
movq 0x40(%rsp), %rcx
decl %ecx
leaq 0x3fdd(%rip), %rax      # 0x108d8
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
testb $0x1, %r14b
jne 0xc946
movq %r15, %rdi
xorl %esi, %esi
callq 0xa61e
cmpl $0x7, %eax
setne %bpl
jmp 0xc952
cmpl $0x2, %r13d
jb 0xc946
movq %r15, %rdi
xorl %esi, %esi
callq 0xa61e
movl %eax, %ebx
movq %r15, %rdi
movl $0x1, %esi
callq 0xa61e
addl %ebx, %eax
movb $0x1, %bpl
cmpl $0x1, %eax
jg 0xc952
xorl %ebp, %ebp
jmp 0xc952
cmpl $0x5, %r13d
setb %bpl
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc965
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x92e2
movq %rbx, %rdi
callq 0x2280
nop