// File: /workspace/github_c_makefile_star2_O3/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 0x81767(%rip), %rdi     # 0x94b50
callq 0x11bec
movq %rax, %rbx
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x5e342(%rip), %rsi     # 0x71744
leaq 0x5e353(%rip), %rdx     # 0x7175c
leaq 0x28(%rsp), %rdi
callq 0xedf0
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x180f2
movl %eax, %ebx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x13431
callq 0xc640
movb $0x1, %r15b
testb %bl, %bl
je 0x137c5
leaq 0x70(%rsp), %rdi
callq 0xc820
movq %r14, %rdi
callq 0xf9cb
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rax, %rsi
callq 0xcae0
leaq 0x81886(%rip), %rdi     # 0x94cf0
leaq 0x28(%rsp), %rsi
callq 0x18142
movslq (%rax), %r13
movq %r14, %rdi
callq 0xef14
movb $0x1, %r15b
testb %al, %al
jne 0x137b6
movq %rbx, 0x48(%rsp)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0xefe4
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
movq -0x8(%rax), %rbx
cmpq %rax, %rdi
je 0x134b3
callq 0xc640
testq %rbx, %rbx
jne 0x137b6
leaq 0x817f5(%rip), %rdi     # 0x94cb8
leaq 0x28(%rsp), %rsi
callq 0x22c26
testq %rax, %rax
movq 0x48(%rsp), %rbx
je 0x135b3
leaq 0x88(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x603cb(%rip), %rsi     # 0x738ba
leaq 0x603c8(%rip), %rdx     # 0x738be
leaq 0x78(%rsp), %rdi
callq 0xedf0
leaq 0x81821(%rip), %rdi     # 0x94d28
leaq 0x78(%rsp), %rsi
callq 0x181be
movq %rax, %r15
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x5e239(%rip), %rsi     # 0x7175d
leaq 0x5e23e(%rip), %rdx     # 0x71769
leaq 0x50(%rsp), %rdi
callq 0xedf0
leaq 0x1c8(%r15), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1c4c8
movb $0x1, (%rax)
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x18208
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x22d28
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x13577
callq 0xc640
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x13586
callq 0xc640
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x13595
callq 0xc640
leaq 0x5e1ce(%rip), %rdi     # 0x7176a
leaq 0x38(%rsp), %r12
xorl %r15d, %r15d
movq %rbx, %rsi
xorl %eax, %eax
callq 0xfd7f
jmp 0x137b6
movq %r13, %rax
subq 0x70(%rsp), %rax
movq %rax, %rbx
negq %rbx
cmovsq %rax, %rbx
leaq 0x81584(%rip), %rdi     # 0x94b50
callq 0x11bec
movq %rax, %r12
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x5e1a0(%rip), %rsi     # 0x71788
leaq 0x5e1a7(%rip), %rdx     # 0x71796
callq 0xedf0
addq $0x38, %r12
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x12416
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 0x1362f
callq 0xc640
testb %bl, %bl
je 0x13799
leaq 0x88(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x60270(%rip), %rsi     # 0x738ba
leaq 0x6026d(%rip), %rdx     # 0x738be
leaq 0x78(%rsp), %rdi
callq 0xedf0
leaq 0x816c6(%rip), %rdi     # 0x94d28
leaq 0x78(%rsp), %rsi
callq 0x181be
movq 0x48(%rsp), %rbx
movq %rax, %r15
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5e113(%rip), %rsi     # 0x71797
leaq 0x5e11b(%rip), %rdx     # 0x717a6
leaq 0x50(%rsp), %rdi
callq 0xedf0
leaq 0x1c8(%r15), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1c4c8
movb $0x1, (%rax)
leaq 0xa8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x63309(%rip), %rsi     # 0x769c6
leaq 0x63304(%rip), %rdx     # 0x769c8
leaq 0x98(%rsp), %rdi
callq 0xedf0
leaq 0xb8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
movq %rbx, %rsi
callq 0xcae0
leaq 0x198(%r15), %rdi
leaq 0x98(%rsp), %rsi
callq 0x18044
leaq 0xb8(%rsp), %rsi
movq %rax, %rdi
callq 0xcc40
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x18208
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x22d28
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x13738
callq 0xc640
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1374e
callq 0xc640
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x13760
callq 0xc640
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
leaq 0x38(%rsp), %r12
je 0x13779
callq 0xc640
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x13788
callq 0xc640
testb %bpl, %bpl
je 0x137b3
leaq 0x5e013(%rip), %rdi     # 0x717a7
jmp 0x135a1
movq 0x70(%rsp), %rbx
leaq 0x8154b(%rip), %rdi     # 0x94cf0
leaq 0x28(%rsp), %rsi
callq 0x18142
movl %ebx, (%rax)
jmp 0x137b6
xorl %r15d, %r15d
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x137c5
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 0x1382e
callq 0xc640
jmp 0x1382e
movq %rax, %rbx
jmp 0x13844
jmp 0x137fa
movq %rax, %rbx
jmp 0x13856
jmp 0x13801
movq %rax, %rbx
jmp 0x1386a
jmp 0x138d5
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
jne 0x138b6
jmp 0x138d8
jmp 0x138d5
movq %rax, %rbx
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13844
callq 0xc640
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x13856
callq 0xc640
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x1386a
callq 0xc640
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
jne 0x138b6
jmp 0x138d8
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1389d
callq 0xc640
jmp 0x1389d
jmp 0x13891
movq %rax, %rbx
jmp 0x138ac
jmp 0x138d5
jmp 0x138d5
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x138ac
callq 0xc640
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x138d8
callq 0xc640
jmp 0x138d8
jmp 0x138d5
jmp 0x138d0
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
jne 0x138e7
jmp 0x138ec
movq %rax, %rbx
jmp 0x138ec
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x138ec
callq 0xc640
movq %rbx, %rdi
callq 0xc760