// File: /workspace/github_cpp_makefile_star2_O2/lega911[P]ijson/src/connect.cpp
// Function: Connect::send_details()
void Connect::send_details() {
    Buffer res(256);

    u64 stat_request = 0;
    u64 stat_call = 0;
    u64 stat_result = 0;
    u64 stat_recv = 0;
    u64 stat_send = 0;
    u64 stat_ioevent = 0;
    for(int i=0; i<server->threads; i++) {
        stat_request += server->loops[i]->stat_request;
        stat_call += server->loops[i]->stat_call;
        stat_result += server->loops[i]->stat_result;
        stat_recv += server->loops[i]->stat_recv;
        stat_send += server->loops[i]->stat_send;
        stat_ioevent += server->loops[i]->stat_ioevent;
    }

    res.add("{\"$info\":{");
    res.add("\"version\":\"");
    res.add(ijson_version);
    res.add("\",\"uptime\":");
    res.add_number(get_time_sec() - server->stat_starttime);
    res.add(",\"connect\":");
    res.add_number(server->stat_connect);
    res.add(",\"request\":");
    res.add_number(stat_request);
    res.add(",\"call\":");
    res.add_number(stat_call);
    res.add(",\"result\":");
    res.add_number(stat_result);
    res.add(",\"recv\":");
    res.add_number(stat_recv);
    res.add(",\"send\":");
    res.add_number(stat_send);
    res.add(",\"io_event\":");
    res.add_number(stat_ioevent);
    res.add("},\n");

    LOCK _l(server->global_lock);
    for(const auto &ql : server->_queue_list) {
        if(ql == NULL) continue;
        res.add("\"");
        res.add(ql->name);
        res.add("\":{\"last_worker\":");
        res.add_number(ql->last_worker);
        res.add(",\"worker_ids\":[");

        int worker_count = 0;
        int client_count = 0;
        bool first = true;
        for(int i=0;i<server->threads;i++) {
            for(const auto &w : ql->queue[i].workers) {
                if(first) {
                    first = false;
                    res.add("\"", 1);
                } else res.add(",\"", 2);
                if(w->connection_id) {
                    int start = res.size();
                    res.add(w->connection_id);
                    json::escape(res, start);
                }
                res.add("\"", 1);
                worker_count++;
            }
            client_count += ql->queue[i].clients.size();
        }
        res.add("],\"workers\":");
        res.add_number(worker_count);
        res.add(",\"clients\":");
        res.add_number(client_count);

        if(!ql->info.empty()) {
            res.add(",\"info\":\"");
            int start = res.size();
            res.add(ql->info);
            json::escape(res, start);
            res.add("\"");
        }
        res.add("},\n");
    };
    res.resize(0, res.size() - 2);
    res.add("}");
    send.status("200 OK")->done(res);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq -0x38(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0xd53a
movq %rbx, -0x48(%rbp)
movq 0x48(%rbx), %rax
movl 0x28(%rax), %ecx
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
xorl %ebx, %ebx
movq $0x0, -0x40(%rbp)
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpq %rdx, %rcx
je 0xc6ea
movq 0x20050(%rax), %rsi
movq (%rsi,%rdx,8), %rsi
addq 0x78(%rsi), %r15
addq 0x80(%rsi), %r14
addq 0x88(%rsi), %r13
addq 0x90(%rsi), %r12
movq -0x40(%rbp), %rdi
addq 0x98(%rsi), %rdi
movq %rdi, -0x40(%rbp)
addq 0xa0(%rsi), %rbx
incq %rdx
jmp 0xc6a6
leaq 0xbca3(%rip), %rsi      # 0x18394
leaq -0x38(%rbp), %rdi
callq 0xd5ee
leaq 0xbc9e(%rip), %rsi      # 0x1839f
leaq -0x38(%rbp), %rdi
callq 0xd5ee
leaq 0xc34b(%rip), %rsi      # 0x18a5c
leaq -0x38(%rbp), %rdi
callq 0xd5ee
leaq 0xbc8a(%rip), %rsi      # 0x183ab
leaq -0x38(%rbp), %rdi
callq 0xd5ee
callq 0x16a69
movl %eax, %esi
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
subq 0x20180(%rax), %rsi
leaq -0x38(%rbp), %rdi
callq 0xd54a
leaq 0xbc67(%rip), %rsi      # 0x183b7
leaq -0x38(%rbp), %rdi
callq 0xd5ee
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x20080(%rax), %rsi
leaq -0x38(%rbp), %rdi
callq 0xd54a
leaq 0xbc4b(%rip), %rsi      # 0x183c3
leaq -0x38(%rbp), %rdi
callq 0xd5ee
leaq -0x38(%rbp), %rdi
movq %r15, %rsi
callq 0xd54a
leaq 0xbc3b(%rip), %rsi      # 0x183cf
leaq -0x38(%rbp), %rdi
callq 0xd5ee
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0xd54a
leaq 0xbc28(%rip), %rsi      # 0x183d8
leaq -0x38(%rbp), %rdi
callq 0xd5ee
leaq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0xd54a
leaq 0xbc17(%rip), %rsi      # 0x183e3
leaq -0x38(%rbp), %rdi
callq 0xd5ee
leaq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0xd54a
leaq 0xbc04(%rip), %rsi      # 0x183ec
leaq -0x38(%rbp), %rdi
callq 0xd5ee
leaq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xd54a
leaq 0xbbf0(%rip), %rsi      # 0x183f5
leaq -0x38(%rbp), %rdi
callq 0xd5ee
leaq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0xd54a
leaq 0xbbe1(%rip), %rsi      # 0x18402
leaq -0x38(%rbp), %rdi
callq 0xd5ee
movl $0x20058, %edi          # imm = 0x20058
movq -0x48(%rbp), %r15
addq 0x48(%r15), %rdi
movq %rdi, -0x58(%rbp)
callq 0xd764
movq 0x48(%r15), %rax
movq 0x20110(%rax), %r12
movq 0x20118(%rax), %rax
movq %rax, -0x68(%rbp)
leaq -0x38(%rbp), %rbx
cmpq -0x68(%rbp), %r12
je 0xca82
cmpq $0x0, (%r12)
je 0xca79
movq %rbx, %rdi
leaq 0xbbb0(%rip), %rsi      # 0x18429
callq 0xd5ee
movq (%r12), %rsi
movq %rbx, %rdi
callq 0xd300
movq %rbx, %rdi
leaq 0xbb72(%rip), %rsi      # 0x18406
callq 0xd5ee
movq (%r12), %rax
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0xd54a
movq %rbx, %rdi
leaq 0xbb65(%rip), %rsi      # 0x18418
callq 0xd5ee
movb $0x1, %r14b
xorl %ecx, %ecx
xorl %ebx, %ebx
xorl %r13d, %r13d
movq %r12, -0x70(%rbp)
movq 0x48(%r15), %rax
movslq 0x28(%rax), %rax
cmpq %rax, %rcx
jge 0xc9e8
movl %r13d, -0x4c(%rbp)
movq (%r12), %rax
movq 0x40(%rax), %rax
movq %rcx, -0x80(%rbp)
imulq $0xa0, %rcx, %rcx
movq 0x10(%rax,%rcx), %r13
movq 0x20(%rax,%rcx), %r12
movq 0x28(%rax,%rcx), %rdx
movq %rdx, -0x60(%rbp)
movq %rcx, -0x78(%rbp)
movq 0x30(%rax,%rcx), %rax
movq %rax, -0x40(%rbp)
cmpq -0x40(%rbp), %r13
je 0xc9b4
testb $0x1, %r14b
leaq 0xbb05(%rip), %rsi      # 0x18428
leaq 0xbaff(%rip), %rax      # 0x18429
cmovneq %rax, %rsi
movzbl %r14b, %eax
andl $0x1, %eax
pushq $0x2
popq %rdx
subl %eax, %edx
leaq -0x38(%rbp), %r15
movq %r15, %rdi
callq 0xd24c
movq (%r13), %rsi
cmpl $0x0, 0x108(%rsi)
je 0xc971
addq $0x100, %rsi            # imm = 0x100
movl -0x30(%rbp), %r14d
movq %r15, %rdi
callq 0xd300
movq %r15, %rdi
movl %r14d, %esi
callq 0xe6f5
movq %r15, %rdi
leaq 0xbaae(%rip), %rsi      # 0x18429
pushq $0x1
popq %rdx
callq 0xd24c
incl %ebx
addq $0x8, %r13
xorl %r14d, %r14d
cmpq %r12, %r13
jne 0xc90e
movq -0x60(%rbp), %rax
movq 0x8(%rax), %r13
addq $0x8, %rax
movq %rax, -0x60(%rbp)
leaq 0x200(%r13), %r12
xorl %r14d, %r14d
jmp 0xc90e
movq -0x70(%rbp), %r12
movq (%r12), %rax
movq 0x40(%rax), %rax
movq -0x78(%rbp), %rcx
leaq (%rax,%rcx), %rdi
addq $0x50, %rdi
callq 0xd714
movl -0x4c(%rbp), %r13d
addl %eax, %r13d
movq -0x80(%rbp), %rcx
incq %rcx
movq -0x48(%rbp), %r15
jmp 0xc8c6
leaq -0x38(%rbp), %r14
movq %r14, %rdi
leaq 0xba35(%rip), %rsi      # 0x1842b
callq 0xd5ee
movslq %ebx, %rsi
movq %r14, %rdi
callq 0xd54a
movq %r14, %rdi
leaq 0xba28(%rip), %rsi      # 0x18438
callq 0xd5ee
movslq %r13d, %rsi
movq %r14, %rdi
callq 0xd54a
movq (%r12), %rax
cmpl $0x0, 0x50(%rax)
movq %r14, %rbx
je 0xca6a
movq %rbx, %rdi
leaq 0xba0d(%rip), %rsi      # 0x18444
callq 0xd5ee
movl -0x30(%rbp), %r14d
movq (%r12), %rsi
addq $0x48, %rsi
movq %rbx, %rdi
callq 0xd300
movq %rbx, %rdi
movl %r14d, %esi
callq 0xe6f5
movq %rbx, %rdi
leaq 0xb9c4(%rip), %rsi      # 0x18429
callq 0xd5ee
movq %rbx, %rdi
leaq 0xb98e(%rip), %rsi      # 0x18402
callq 0xd5ee
addq $0x8, %r12
jmp 0xc85a
leaq -0x38(%rbp), %rdi
movl 0x8(%rdi), %ebx
xorl %esi, %esi
callq 0xd7a2
addl $-0x2, %ebx
leaq -0x38(%rbp), %rdi
movl %ebx, 0x8(%rdi)
leaq 0xbf02(%rip), %rsi      # 0x189a3
callq 0xd5ee
addq $0x18, %r15
leaq 0xb788(%rip), %rsi      # 0x18239
movq %r15, %rdi
callq 0xb93e
leaq -0x38(%rbp), %rsi
movq %r15, %rdi
callq 0xbe84
movq -0x58(%rbp), %rdi
callq 0xa220
leaq -0x38(%rbp), %rdi
callq 0xd6dc
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xcaea
jmp 0xcaf7
movq %rax, %rbx
jmp 0xcb03
jmp 0xcaf7
jmp 0xcaf7
jmp 0xcaf7
jmp 0xcaf7
movq %rax, %rbx
movq -0x58(%rbp), %rdi
callq 0xa220
leaq -0x38(%rbp), %rdi
callq 0xd6dc
movq %rbx, %rdi
callq 0xa470