// File: /workspace/github_cpp_makefile_star2_O1/lega911[P]ijson/src/server.cpp
// Function: Loop::_check_timeout()
void Loop::_check_timeout() {
    if(!server->global_lock.try_lock()) return;

    u32 now = get_time_sec();
    for(const auto &ql : server->_queue_list) {
        if(!ql) continue;

        LOCK _l(ql->mutex);

        for(int i=0;i<server->threads;i++) {
            for(const auto &worker : ql->queue[i].workers) {
                if(!worker->ping) continue;
                if(worker->ping_timeout > now) continue;
                if(worker->is_closed()) continue;

                bool busy = true;
                if(worker->status == Status::worker_wait_job) {
                    worker->mutex.lock();
                    if(worker->status == Status::worker_wait_job) {
                        worker->status = Status::busy;
                        busy = false;
                    }
                    worker->mutex.unlock();
                }
                if(busy) continue;

                if(worker->worker_mode) worker->status = Status::worker_mode_async;
                else worker->status = Status::net;
                worker->send.status("408 Timeout")->done();
                worker->ping_timeout = now + worker->ping;
                if(server->log & 8) std::cout << ltime() << "408 Timeout\n";
            }
        }
    }
    server->global_lock.unlock();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movl $0x20058, %edi          # imm = 0x20058
addq 0x18(%rbx), %rdi
callq 0x80a0
testl %eax, %eax
je 0x1071f
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x16511
movl %eax, -0x2c(%rbp)
movq 0x18(%rbx), %rax
movq 0x20110(%rax), %r14
movq 0x20118(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq %rax, %r14
je 0x10930
movq %rbx, -0x40(%rbp)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x10922
addq $0x18, %rdi
movq %rdi, -0x38(%rbp)
callq 0x83f0
testl %eax, %eax
jne 0x10953
movq 0x18(%rbx), %rax
cmpl $0x0, 0x28(%rax)
jle 0x10919
xorl %ecx, %ecx
movq %r14, -0x50(%rbp)
movq (%r14), %rax
movq 0x40(%rax), %rax
movq %rcx, -0x58(%rbp)
leaq (%rcx,%rcx,4), %rcx
shlq $0x5, %rcx
movq 0x10(%rax,%rcx), %rbx
movq 0x30(%rax,%rcx), %r15
cmpq %r15, %rbx
je 0x108f9
addq %rcx, %rax
movq 0x20(%rax), %r14
movq 0x28(%rax), %r13
movq (%rbx), %rdi
cmpl $0x0, 0xf8(%rdi)
je 0x108d8
movl -0x2c(%rbp), %eax
cmpl %eax, 0xfc(%rdi)
ja 0x108d8
cmpl $-0x1, (%rdi)
je 0x108d8
cmpl $0x1, 0xcc(%rdi)
jne 0x108d8
addq $0x50, %rdi
callq 0x83f0
testl %eax, %eax
jne 0x1094c
movq (%rbx), %rdi
cmpl $0x1, 0xcc(%rdi)
jne 0x10897
movl $0x5, 0xcc(%rdi)
addq $0x50, %rdi
callq 0x8240
movq (%rbx), %rdi
cmpb $0x0, 0xf3(%rdi)
movl $0x0, %eax
movl $0x6, %ecx
cmovnel %ecx, %eax
movl %eax, 0xcc(%rdi)
addq $0x18, %rdi
leaq 0x7c35(%rip), %rsi      # 0x18476
callq 0x9ee0
movq %rax, %rdi
callq 0xa802
movq (%rbx), %rax
movl 0xf8(%rax), %ecx
addl -0x2c(%rbp), %ecx
movl %ecx, 0xfc(%rax)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
testb $0x8, 0x20(%rax)
je 0x108d8
callq 0x16531
movq %rax, %r12
testq %rax, %rax
je 0x108a2
movq %r12, %rdi
callq 0x8130
movq 0xd746(%rip), %rdi      # 0x1dfd0
movq %r12, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0x108c0
addq $0x50, %rdi
callq 0x8240
jmp 0x108d8
movq 0xd727(%rip), %rcx      # 0x1dfd0
movq (%rcx), %rax
movq -0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
movl 0x20(%rcx,%rax), %esi
orl $0x1, %esi
callq 0x8470
movl $0xc, %edx
movq 0xd704(%rip), %rdi      # 0x1dfd0
leaq 0x7baf(%rip), %rsi      # 0x18482
callq 0x8350
addq $0x8, %rbx
cmpq %r14, %rbx
jne 0x108f0
movq 0x8(%r13), %rbx
addq $0x8, %r13
leaq 0x200(%rbx), %r14
cmpq %r15, %rbx
jne 0x107b0
movq -0x58(%rbp), %rcx
incq %rcx
movq -0x40(%rbp), %rbx
movq 0x18(%rbx), %rax
movslq 0x28(%rax), %rax
cmpq %rax, %rcx
movq -0x50(%rbp), %r14
jl 0x1077f
movq -0x38(%rbp), %rdi
callq 0x8240
addq $0x8, %r14
cmpq -0x48(%rbp), %r14
jne 0x1074a
movl $0x20058, %edi          # imm = 0x20058
addq 0x18(%rbx), %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8240
movl %eax, %edi
callq 0x81d0
movl %eax, %edi
callq 0x81d0
jmp 0x1095c
movq %rax, %rbx
movq -0x38(%rbp), %rdi
callq 0x8240
movq %rbx, %rdi
callq 0x84a0