// File: /workspace/github_cpp_makefile_star2_O1/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 0x1636e
movq 0x8(%rbx), %rax
movq 0x20110(%rax), %r14
movq 0x20118(%rax), %r15
cmpq %r15, %r14
je 0x16356
movq %rbx, -0x60(%rbp)
movq %r15, -0x58(%rbp)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x16349
addq $0x18, %rdi
callq 0x80a0
testl %eax, %eax
jne 0x16349
movq 0x8(%rbx), %rax
cmpl $0x0, 0x28(%rax)
jle 0x16339
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
cmpq 0x30(%rax,%rcx), %r14
je 0x1625c
movq 0x20(%r13), %r12
movq 0x28(%r13), %r15
movq (%r14), %rbx
cmpl $-0x1, (%rbx)
je 0x16210
cmpl $0x1, 0xcc(%rbx)
jne 0x16210
addq $0x8, %r14
cmpq %r12, %r14
jne 0x16256
movq 0x8(%r15), %r14
addq $0x8, %r15
leaq 0x200(%r14), %r12
jmp 0x16256
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 0x149e8
movq -0x98(%rbp), %r14
movq -0x88(%rbp), %r12
movq -0x80(%rbp), %r15
movq %rbx, %rdi
callq 0x898c
cmpq 0x30(%r13), %r14
jne 0x161e5
movq 0x60(%r13), %r15
cmpq 0x80(%r13), %r15
je 0x16319
leaq 0x50(%r13), %rax
movq %rax, -0x78(%rbp)
movq 0x70(%r13), %rbx
movq 0x78(%r13), %r12
movq (%r15), %r14
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x16297
cmpl $-0x1, (%rax)
je 0x162b2
cmpl $0x4, 0xcc(%rax)
jne 0x162b2
addq $0x8, %r15
cmpq %rbx, %r15
jne 0x1630c
movq 0x8(%r12), %r15
addq $0x8, %r12
leaq 0x200(%r15), %rbx
jmp 0x1630c
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 0x13d46
movq -0x98(%rbp), %r15
movq -0x88(%rbp), %rbx
movq -0x80(%rbp), %r12
testq %r14, %r14
je 0x1630c
movq %r14, %rdi
callq 0x12fda
movl $0x38, %esi
movq %r14, %rdi
callq 0x8320
cmpq 0x80(%r13), %r15
jne 0x1627d
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 0x161ba
movq (%r14), %rdi
addq $0x18, %rdi
callq 0x8240
movq -0x58(%rbp), %r15
addq $0x8, %r14
cmpq %r15, %r14
jne 0x16189
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 0x16379
jmp 0x16379
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x8240
movq %rbx, %rdi
callq 0x84a0
nop