// File: /workspace/github_cpp_makefile_star2_O3/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
movl $0x0, %ebp
cmpl $-0x4, %eax
jb 0xc8b5
xorl %r14d, %r14d
movq %rsi, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
movb $0x1, 0x3(%rsp)
movl $0x1, %ebp
leaq 0x48(%rsp), %r13
leaq 0x28(%rsp), %rbx
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movl %ebp, %edx
callq 0x96b2
movq %rbx, %rdi
movq %r13, %rsi
callq 0x92ae
movq %rbx, %r15
movq %rbx, %rdi
leaq 0x3a8e(%rip), %rsi      # 0x1017e
callq 0x2080
movl %eax, %ebx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xc713
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21a0
xorl %r12d, %r12d
testl %ebx, %ebx
setne %r12b
sete %bl
movq %r13, %rdi
callq 0x9292
andb %bl, 0x3(%rsp)
addl %r12d, %r14d
incl %ebp
cmpl $0x6, %ebp
movq %r15, %rbx
jne 0xc6c9
xorl %ebp, %ebp
movq 0x18(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0xa5f8
testl %eax, %eax
jle 0xc84f
movq %r15, %rbx
leaq 0x48(%rsp), %r15
leaq 0x28(%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 0xa6bc
movq %r12, %rdi
movq %r15, %rsi
callq 0x92ae
movq %r15, %rdi
callq 0x9292
movq %r12, %rdi
leaq 0x39b6(%rip), %rsi      # 0x10160
callq 0x2080
testl %eax, %eax
je 0xc7df
movq %r12, %rdi
leaq 0x3e03(%rip), %rsi      # 0x105c0
callq 0x2080
testl %eax, %eax
je 0xc7e5
movq %r12, %rdi
leaq 0x3996(%rip), %rsi      # 0x10166
callq 0x2080
testl %eax, %eax
je 0xc7eb
incl 0xc(%rsp)
jmp 0xc7ef
incl 0x10(%rsp)
jmp 0xc7ef
incl 0x8(%rsp)
jmp 0xc7ef
incl 0x4(%rsp)
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xc80b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21a0
incl %ebp
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa5f8
cmpl %eax, %ebp
jl 0xc77e
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 0x20(%rsp), %rcx
decl %ecx
leaq 0x408b(%rip), %rax      # 0x108e8
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpb $0x0, 0x3(%rsp)
jne 0xc8a9
movq %r15, %rdi
xorl %esi, %esi
callq 0xa5f8
cmpl $0x7, %eax
setne %bpl
jmp 0xc8b5
cmpl $0x2, %r14d
jb 0xc8a9
movq %r15, %rdi
xorl %esi, %esi
callq 0xa5f8
movl %eax, %ebx
movq %r15, %rdi
movl $0x1, %esi
callq 0xa5f8
addl %ebx, %eax
movb $0x1, %bpl
cmpl $0x1, %eax
jg 0xc8b5
xorl %ebp, %ebp
jmp 0xc8b5
cmpl $0x5, %r14d
setb %bpl
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc8c8
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x9292
movq %rbx, %rdi
callq 0x2280
nopl (%rax)