// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./src/main.cpp
// Function: check_ip(mg_connection*, bool)
bool check_ip(mg_connection* conn, bool verbose = false){
    if(!configs.global().get<bool>("security::access_control")) return true;

    time_t rawtime;
    time(&rawtime);
    const char * cip = cc_get_client_ip(conn);
    string sip(cip);
    time_t lasttime = IPAccessList[sip];
    
    if(is_admin(conn)) return true;
    if(!is_assist(conn).empty()) return true;

    if(IPBanList.find(sip) != IPBanList.end()) {
        // views::info::render(conn, STRING_YOUR_IP_IS_BANNED);
        views::info::render(conn, templates.invoke("misc").toggle("ip_is_banned").build_destory().c_str());
        logLog("Banned IP %s trying to access", cip);
        return false; //banned
    }

    if( abs(lasttime - rawtime) < configs.global().get<int>("user::cooldown") && lasttime != 0){
        views::info::render(conn, templates.invoke("misc").toggle("rapid_accessing").var("IP", cip).build_destory().c_str());
        if(verbose) logLog("%s is rapidly accessing", cip);
        return false;
    }
    IPAccessList[sip] = rawtime;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %esi, %ebp
movq %rdi, %r14
leaq 0x8373c(%rip), %rdi     # 0x96b50
callq 0x11bfe
movq %rax, %rbx
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x60317(%rip), %rsi     # 0x73744
leaq 0x60328(%rip), %rdx     # 0x7375c
leaq 0x28(%rsp), %rdi
callq 0xedfa
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x18460
movl %eax, %ebx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x1345c
callq 0xc640
movb $0x1, %r15b
testb %bl, %bl
je 0x137f0
leaq 0x70(%rsp), %rdi
callq 0xc820
movq %r14, %rdi
callq 0xf9e1
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rax, %rsi
callq 0xcae0
leaq 0x8385b(%rip), %rdi     # 0x96cf0
leaq 0x28(%rsp), %rsi
callq 0x184b0
movslq (%rax), %r13
movq %r14, %rdi
callq 0xef24
movb $0x1, %r15b
testb %al, %al
jne 0x137e1
movq %rbx, 0x48(%rsp)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0xefe6
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
movq -0x8(%rax), %rbx
cmpq %rax, %rdi
je 0x134de
callq 0xc640
testq %rbx, %rbx
jne 0x137e1
leaq 0x837ca(%rip), %rdi     # 0x96cb8
leaq 0x28(%rsp), %rsi
callq 0x22f6a
testq %rax, %rax
movq 0x48(%rsp), %rbx
je 0x135de
leaq 0x88(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x62398(%rip), %rsi     # 0x758b2
leaq 0x62395(%rip), %rdx     # 0x758b6
leaq 0x78(%rsp), %rdi
callq 0xedfa
leaq 0x837f6(%rip), %rdi     # 0x96d28
leaq 0x78(%rsp), %rsi
callq 0x1852c
movq %rax, %r15
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x6020e(%rip), %rsi     # 0x7375d
leaq 0x60213(%rip), %rdx     # 0x73769
leaq 0x50(%rsp), %rdi
callq 0xedfa
leaq 0x1c8(%r15), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1c82a
movb $0x1, (%rax)
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x18576
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2307c
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x135a2
callq 0xc640
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x135b1
callq 0xc640
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x135c0
callq 0xc640
leaq 0x601a3(%rip), %rdi     # 0x7376a
leaq 0x38(%rsp), %r12
xorl %r15d, %r15d
movq %rbx, %rsi
xorl %eax, %eax
callq 0xfd95
jmp 0x137e1
movq %r13, %rax
subq 0x70(%rsp), %rax
movq %rax, %rbx
negq %rbx
cmovsq %rax, %rbx
leaq 0x83559(%rip), %rdi     # 0x96b50
callq 0x11bfe
movq %rax, %r12
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x60175(%rip), %rsi     # 0x73788
leaq 0x6017c(%rip), %rdx     # 0x73796
callq 0xedfa
addq $0x38, %r12
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x12426
movslq (%rax), %rax
cmpq %rax, %rbx
setl %al
testl %r13d, %r13d
setne %bl
andb %al, %bl
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
leaq 0x38(%rsp), %r12
je 0x1365a
callq 0xc640
testb %bl, %bl
je 0x137c4
leaq 0x88(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x6223d(%rip), %rsi     # 0x758b2
leaq 0x6223a(%rip), %rdx     # 0x758b6
leaq 0x78(%rsp), %rdi
callq 0xedfa
leaq 0x8369b(%rip), %rdi     # 0x96d28
leaq 0x78(%rsp), %rsi
callq 0x1852c
movq 0x48(%rsp), %rbx
movq %rax, %r15
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x600e8(%rip), %rsi     # 0x73797
leaq 0x600f0(%rip), %rdx     # 0x737a6
leaq 0x50(%rsp), %rdi
callq 0xedfa
leaq 0x1c8(%r15), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1c82a
movb $0x1, (%rax)
leaq 0xa8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x652d3(%rip), %rsi     # 0x789bb
leaq 0x652ce(%rip), %rdx     # 0x789bd
leaq 0x98(%rsp), %rdi
callq 0xedfa
leaq 0xb8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
movq %rbx, %rsi
callq 0xcae0
leaq 0x198(%r15), %rdi
leaq 0x98(%rsp), %rsi
callq 0x183b2
leaq 0xb8(%rsp), %rsi
movq %rax, %rdi
callq 0xcc40
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x18576
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2307c
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x13763
callq 0xc640
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13779
callq 0xc640
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x1378b
callq 0xc640
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
leaq 0x38(%rsp), %r12
je 0x137a4
callq 0xc640
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x137b3
callq 0xc640
testb %bpl, %bpl
je 0x137de
leaq 0x5ffe8(%rip), %rdi     # 0x737a7
jmp 0x135cc
movq 0x70(%rsp), %rbx
leaq 0x83520(%rip), %rdi     # 0x96cf0
leaq 0x28(%rsp), %rsi
callq 0x184b0
movl %ebx, (%rax)
jmp 0x137e1
xorl %r15d, %r15d
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x137f0
callq 0xc640
movl %r15d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x13859
callq 0xc640
jmp 0x13859
movq %rax, %rbx
jmp 0x1386f
jmp 0x13825
movq %rax, %rbx
jmp 0x13881
jmp 0x1382c
movq %rax, %rbx
jmp 0x13895
jmp 0x13900
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
jne 0x138e1
jmp 0x13903
jmp 0x13900
movq %rax, %rbx
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1386f
callq 0xc640
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x13881
callq 0xc640
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x13895
callq 0xc640
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
jne 0x138e1
jmp 0x13903
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x138c8
callq 0xc640
jmp 0x138c8
jmp 0x138bc
movq %rax, %rbx
jmp 0x138d7
jmp 0x13900
jmp 0x13900
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x138d7
callq 0xc640
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x13903
callq 0xc640
jmp 0x13903
jmp 0x13900
jmp 0x138fb
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
jne 0x13912
jmp 0x13917
movq %rax, %rbx
jmp 0x13917
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x13917
callq 0xc640
movq %rbx, %rdi
callq 0xc760