// File: /workspace/github_cpp_makefile_star2_O3/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 $0x78, %rsp
movq %rdi, %rbx
movl $0x20058, %edi          # imm = 0x20058
addq 0x8(%rbx), %rdi
movq %rdi, -0x30(%rbp)
callq 0x83f0
testl %eax, %eax
jne 0x16245
movq 0x8(%rbx), %rax
movq 0x20110(%rax), %r14
movq 0x20118(%rax), %r15
cmpq %r15, %r14
je 0x1622d
movq %rbx, -0x60(%rbp)
movq %r15, -0x58(%rbp)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x16220
addq $0x18, %rdi
callq 0x80a0
testl %eax, %eax
jne 0x16220
movq 0x8(%rbx), %rax
cmpl $0x0, 0x28(%rax)
jle 0x16210
xorl %ecx, %ecx
movq %r14, -0x68(%rbp)
movq (%r14), %rax
movq 0x40(%rax), %rax
movq %rcx, -0x70(%rbp)
leaq (%rcx,%rcx,4), %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %r13
movq 0x10(%rax,%rcx), %r14
movq 0x30(%rax,%rcx), %rax
cmpq %rax, %r14
je 0x16132
movq 0x20(%r13), %r12
movq 0x28(%r13), %r15
movq (%r14), %rbx
cmpl $-0x1, (%rbx)
je 0x160e3
cmpl $0x1, 0xcc(%rbx)
jne 0x160e3
addq $0x8, %r14
cmpq %r12, %r14
jne 0x1612d
movq 0x8(%r15), %r14
addq $0x8, %r15
leaq 0x200(%r14), %r12
jmp 0x1612d
movq %r14, -0x50(%rbp)
movq (%r15), %rax
movq %rax, -0x48(%rbp)
addq $0x200, %rax            # imm = 0x200
movq %rax, -0x40(%rbp)
movq %r15, -0x38(%rbp)
leaq -0x98(%rbp), %rdi
movq %r13, %rsi
leaq -0x50(%rbp), %rdx
callq 0x148c6
movq -0x98(%rbp), %r14
movq -0x88(%rbp), %r12
movq -0x80(%rbp), %r15
movq %rbx, %rdi
callq 0x898c
movq 0x30(%r13), %rax
cmpq %rax, %r14
jne 0x160b8
movq 0x60(%r13), %r15
movq 0x80(%r13), %rax
cmpq %rax, %r15
je 0x161f0
leaq 0x50(%r13), %rcx
movq %rcx, -0x78(%rbp)
movq 0x70(%r13), %rbx
movq 0x78(%r13), %r12
movq (%r15), %r14
movq 0x18(%r14), %rcx
testq %rcx, %rcx
je 0x16170
cmpl $-0x1, (%rcx)
je 0x1618b
cmpl $0x4, 0xcc(%rcx)
jne 0x1618b
addq $0x8, %r15
cmpq %rbx, %r15
jne 0x161e7
movq 0x8(%r12), %r15
addq $0x8, %r12
leaq 0x200(%r15), %rbx
jmp 0x161e7
movq %r15, -0x50(%rbp)
movq (%r12), %rax
movq %rax, -0x48(%rbp)
addq $0x200, %rax            # imm = 0x200
movq %rax, -0x40(%rbp)
movq %r12, -0x38(%rbp)
leaq -0x98(%rbp), %rdi
movq -0x78(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x13c32
movq -0x98(%rbp), %r15
movq -0x88(%rbp), %rbx
movq -0x80(%rbp), %r12
movq %r14, %rdi
callq 0x12ea6
movl $0x38, %esi
movq %r14, %rdi
callq 0x8320
movq 0x80(%r13), %rax
cmpq %rax, %r15
jne 0x16156
movq -0x70(%rbp), %rcx
incq %rcx
movq -0x60(%rbp), %rbx
movq 0x8(%rbx), %rax
movslq 0x28(%rax), %rax
cmpq %rax, %rcx
movq -0x68(%rbp), %r14
jl 0x16086
movq (%r14), %rdi
addq $0x18, %rdi
callq 0x8240
movq -0x58(%rbp), %r15
addq $0x8, %r14
cmpq %r15, %r14
jne 0x16055
movq -0x30(%rbp), %rdi
callq 0x8240
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x81d0
jmp 0x16250
jmp 0x16250
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x8240
movq %rbx, %rdi
callq 0x84a0