// File: /workspace/github_cpp_makefile_star2_O2/lega911[P]ijson/src/service.cpp
// Function: Service::_clean_dead_tasks()
void Service::_clean_dead_tasks() {
    LOCK _l(server->global_lock);
    for(const auto &ql : server->_queue_list) {
        if(ql == NULL) continue;
        if(!ql->mutex.try_lock()) continue;

        for(int nloop=0; nloop < server->threads; nloop++) {
            Queue *q = &ql->queue[nloop];

            auto it=q->workers.begin();
            while(it != q->workers.end()) {
                Connect *conn = *it;
                if(conn->is_closed() || conn->status != Status::worker_wait_job) {
                    it = q->workers.erase(it);
                    conn->unlink();
                } else {
                    it++;
                }
            }

            auto it2=q->clients.begin();
            while(it2 != q->clients.end()) {
                Message *msg = *it2;
                if(msg->conn && (msg->conn->is_closed() || msg->conn->status != Status::client_wait_result)) {
                    it2 = q->clients.erase(it2);
                    delete msg;
                } else {
                    it2++;
                }
            }
        }
        ql->mutex.unlock();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
movl $0x20058, %edi          # imm = 0x20058
addq 0x8(%rbx), %rdi
movq %rdi, -0x58(%rbp)
callq 0xd764
movq %rbx, -0x98(%rbp)
movq 0x8(%rbx), %rax
movq 0x20110(%rax), %rbx
movq 0x20118(%rax), %rax
movq %rax, -0x88(%rbp)
leaq -0x100(%rbp), %r15
leaq -0x50(%rbp), %r12
cmpq -0x88(%rbp), %rbx
je 0x168b1
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x168a8
addq $0x18, %rdi
callq 0x134d4
testb %al, %al
je 0x168a8
xorl %edx, %edx
movq %rbx, -0x90(%rbp)
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rax
movslq 0x28(%rax), %rax
movq (%rbx), %rdi
cmpq %rax, %rdx
jge 0x1689f
movq 0x40(%rdi), %rcx
movq %rdx, -0xa0(%rbp)
imulq $0xa0, %rdx, %rdx
leaq (%rcx,%rdx), %r13
movq 0x10(%rcx,%rdx), %rax
movq %rax, -0x80(%rbp)
movq 0x18(%rcx,%rdx), %rsi
movq %rsi, -0x78(%rbp)
movq 0x20(%rcx,%rdx), %rsi
movq %rsi, -0x70(%rbp)
movq 0x28(%rcx,%rdx), %rcx
movq %rcx, -0x68(%rbp)
cmpq 0x30(%r13), %rax
je 0x167ce
movq (%rax), %rbx
cmpl $-0x1, (%rbx)
je 0x16781
cmpl $0x1, 0xcc(%rbx)
jne 0x16781
movq %r12, %rdi
leaq -0x80(%rbp), %rsi
xorl %edx, %edx
callq 0x136d8
jmp 0x167c8
movq %rax, -0xe0(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0xd8(%rbp)
movups -0x70(%rbp), %xmm0
movups %xmm0, -0xd0(%rbp)
movq %r12, %rdi
movq %r13, %rsi
leaq -0xe0(%rbp), %rdx
callq 0x1369a
movups -0x50(%rbp), %xmm0
movups -0x40(%rbp), %xmm1
movaps %xmm1, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movq %rbx, %rdi
callq 0xa84c
movq -0x80(%rbp), %rax
jmp 0x1675a
leaq 0x50(%r13), %rbx
movq 0x60(%r13), %rax
movq %rax, -0x50(%rbp)
movq 0x68(%r13), %rcx
movq %rcx, -0x48(%rbp)
movq 0x70(%r13), %rcx
movq %rcx, -0x40(%rbp)
movq 0x78(%r13), %rcx
movq %rcx, -0x38(%rbp)
cmpq 0x80(%r13), %rax
je 0x16889
movq (%rax), %r14
movq 0x18(%r14), %rcx
testq %rcx, %rcx
je 0x16819
cmpl $-0x1, (%rcx)
je 0x16828
cmpl $0x4, 0xcc(%rcx)
jne 0x16828
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x135b8
jmp 0x16880
movq %rax, -0xc0(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xb8(%rbp)
movups -0x40(%rbp), %xmm0
movups %xmm0, -0xb0(%rbp)
movq %r15, %rdi
movq %rbx, %rsi
leaq -0xc0(%rbp), %rdx
callq 0x135f2
movups -0x100(%rbp), %xmm0
movups -0xf0(%rbp), %xmm1
movaps %xmm1, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %r14, %rdi
callq 0x12fd6
movq %r14, %rdi
pushq $0x38
popq %rsi
callq 0xa300
movq -0x50(%rbp), %rax
jmp 0x167f2
movq -0xa0(%rbp), %rdx
incq %rdx
movq -0x90(%rbp), %rbx
jmp 0x16705
addq $0x18, %rdi
callq 0xa220
addq $0x8, %rbx
jmp 0x166d2
movq -0x58(%rbp), %rdi
callq 0xa220
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x168d0
jmp 0x168d0
movq %rax, %rbx
movq -0x58(%rbp), %rdi
callq 0xa220
movq %rbx, %rdi
callq 0xa470