// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rdi
movaps %xmm0, (%rdi)
movl $0x100, %esi            # imm = 0x100
callq 0xc596
movq %rbx, -0x50(%rbp)
movq 0x48(%rbx), %rcx
movslq 0x28(%rcx), %rax
testq %rax, %rax
jle 0xb3af
movq 0x20050(%rcx), %rcx
xorl %edx, %edx
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %r15d, %r15d
xorl %edi, %edi
movq (%rcx,%rdx,8), %rsi
addq 0x78(%rsi), %r14
addq 0x80(%rsi), %rbx
addq 0x88(%rsi), %r13
addq 0x90(%rsi), %r12
addq 0x98(%rsi), %r15
addq 0xa0(%rsi), %rdi
incq %rdx
cmpq %rdx, %rax
jne 0xb37a
jmp 0xb3bf
xorl %edi, %edi
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %rdi, -0x58(%rbp)
leaq 0xbfca(%rip), %rsi      # 0x17394
leaq -0x40(%rbp), %rdi
callq 0xc44c
leaq 0xbfc5(%rip), %rsi      # 0x1739f
leaq -0x40(%rbp), %rdi
callq 0xc44c
leaq 0xc66f(%rip), %rsi      # 0x17a59
leaq -0x40(%rbp), %rdi
callq 0xc44c
leaq 0xbfb1(%rip), %rsi      # 0x173ab
leaq -0x40(%rbp), %rdi
callq 0xc44c
callq 0x163d5
movl %eax, %esi
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rax
subq 0x20180(%rax), %rsi
leaq -0x40(%rbp), %rdi
callq 0xc35e
leaq 0xbf8e(%rip), %rsi      # 0x173b7
leaq -0x40(%rbp), %rdi
callq 0xc44c
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x20080(%rax), %rsi
leaq -0x40(%rbp), %rdi
callq 0xc35e
leaq 0xbf72(%rip), %rsi      # 0x173c3
leaq -0x40(%rbp), %rdi
callq 0xc44c
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0xc35e
leaq 0xbf62(%rip), %rsi      # 0x173cf
leaq -0x40(%rbp), %rdi
callq 0xc44c
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0xc35e
leaq 0xbf4f(%rip), %rsi      # 0x173d8
leaq -0x40(%rbp), %rdi
callq 0xc44c
leaq -0x40(%rbp), %rdi
movq %r13, %rsi
callq 0xc35e
leaq 0xbf3e(%rip), %rsi      # 0x173e3
leaq -0x40(%rbp), %rdi
callq 0xc44c
leaq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0xc35e
leaq 0xbf2b(%rip), %rsi      # 0x173ec
leaq -0x40(%rbp), %rdi
callq 0xc44c
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0xc35e
leaq 0xbf18(%rip), %rsi      # 0x173f5
leaq -0x40(%rbp), %rdi
callq 0xc44c
leaq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0xc35e
leaq 0xbf08(%rip), %rsi      # 0x17402
leaq -0x40(%rbp), %rdi
callq 0xc44c
movl $0x20058, %edi          # imm = 0x20058
movq -0x50(%rbp), %r15
addq 0x48(%r15), %rdi
movq %rdi, -0x60(%rbp)
callq 0x83f0
testl %eax, %eax
jne 0xb85a
movq 0x48(%r15), %rax
movq 0x20110(%rax), %r12
movq 0x20118(%rax), %rax
movq %rax, -0x70(%rbp)
cmpq %rax, %r12
je 0xb7f6
cmpq $0x0, (%r12)
leaq -0x40(%rbp), %rbx
je 0xb7e8
movq %rbx, %rdi
leaq 0xbe50(%rip), %rsi      # 0x173a9
callq 0xc44c
movq (%r12), %rax
movq (%rax), %rsi
movl 0x8(%rax), %edx
movq %rbx, %rdi
callq 0xc102
movq %rbx, %rdi
leaq 0xbe8c(%rip), %rsi      # 0x17406
callq 0xc44c
movq (%r12), %rax
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0xc35e
movq %rbx, %rdi
leaq 0xbe7f(%rip), %rsi      # 0x17418
callq 0xc44c
movq 0x48(%r15), %rcx
cmpl $0x0, 0x28(%rcx)
jle 0xb754
movq (%r12), %rax
movq 0x40(%rax), %rdx
xorl %edi, %edi
movb $0x1, %al
movl $0x0, -0x44(%rbp)
xorl %r13d, %r13d
movq %r12, -0x78(%rbp)
movq %rdi, -0x80(%rbp)
leaq (%rdi,%rdi,4), %r9
shlq $0x5, %r9
movq 0x10(%rdx,%r9), %r14
movq 0x30(%rdx,%r9), %rsi
movq %rsi, -0x88(%rbp)
cmpq %rsi, %r14
je 0xb6e5
addq %r9, %rdx
movq 0x20(%rdx), %rcx
movq %rcx, -0x58(%rbp)
movq 0x28(%rdx), %rcx
movq %rcx, -0x68(%rbp)
movq %r9, %r15
movl -0x38(%rbp), %esi
testb $0x1, %al
je 0xb627
incl %esi
leaq -0x40(%rbp), %rdi
callq 0xc596
movq -0x40(%rbp), %rax
movslq -0x38(%rbp), %rcx
movb $0x22, (%rax,%rcx)
movl $0x1, %ebx
jmp 0xb646
addl $0x2, %esi
leaq -0x40(%rbp), %rdi
callq 0xc596
movq -0x40(%rbp), %rax
movslq -0x38(%rbp), %rcx
movw $0x222c, (%rax,%rcx)    # imm = 0x222C
movl $0x2, %ebx
addl -0x38(%rbp), %ebx
movl %ebx, -0x38(%rbp)
movq (%r14), %rax
movl 0x108(%rax), %edx
testl %edx, %edx
je 0xb679
movq 0x100(%rax), %rsi
leaq -0x40(%rbp), %r12
movq %r12, %rdi
callq 0xc102
movq %r12, %rdi
movl %ebx, %esi
callq 0xd532
movl -0x38(%rbp), %ebx
incl %ebx
leaq -0x40(%rbp), %rdi
movl %ebx, %esi
callq 0xc596
movq -0x40(%rbp), %rax
movslq -0x38(%rbp), %rcx
movb $0x22, (%rax,%rcx)
incl -0x38(%rbp)
addq $0x8, %r14
cmpq -0x58(%rbp), %r14
jne 0xb6ba
movq -0x68(%rbp), %rax
movq 0x8(%rax), %r14
addq $0x8, %rax
movq %rax, -0x68(%rbp)
leaq 0x200(%r14), %rax
movq %rax, -0x58(%rbp)
movq %r15, %r9
incl %r13d
xorl %eax, %eax
cmpq -0x88(%rbp), %r14
jne 0xb5ff
movq -0x78(%rbp), %r12
movq (%r12), %rax
movq -0x50(%rbp), %r15
movq 0x48(%r15), %rcx
movq 0x40(%rax), %rdx
xorl %eax, %eax
movq 0x98(%rdx,%r9), %rsi
movl 0x78(%rdx,%r9), %edi
movl %esi, %r8d
subl %edi, %r8d
shrl $0x3, %r8d
cmpq $0x1, %rsi
adcl $-0x1, %r8d
shll $0x6, %r8d
movq 0x70(%rdx,%r9), %rsi
movq 0x80(%rdx,%r9), %rdi
subq 0x88(%rdx,%r9), %rdi
subq 0x60(%rdx,%r9), %rsi
shrq $0x3, %rdi
shrq $0x3, %rsi
addl %edi, %esi
movl -0x44(%rbp), %edi
addl %esi, %edi
addl %r8d, %edi
movl %edi, -0x44(%rbp)
movq -0x80(%rbp), %rdi
incq %rdi
movslq 0x28(%rcx), %rsi
cmpq %rsi, %rdi
jl 0xb5c6
movslq %r13d, %r14
movslq -0x44(%rbp), %rbx
jmp 0xb759
xorl %r14d, %r14d
xorl %ebx, %ebx
leaq -0x40(%rbp), %r13
movq %r13, %rdi
leaq 0xbcc1(%rip), %rsi      # 0x17428
callq 0xc44c
movq %r13, %rdi
movq %r14, %rsi
callq 0xc35e
movq %r13, %rdi
leaq 0xbcb4(%rip), %rsi      # 0x17435
callq 0xc44c
movq %r13, %rdi
movq %rbx, %rsi
callq 0xc35e
movq (%r12), %rax
cmpl $0x0, 0x50(%rax)
je 0xb7d9
movq %r13, %rdi
leaq 0xbc9c(%rip), %rsi      # 0x17441
callq 0xc44c
movl -0x38(%rbp), %ebx
movq (%r12), %rax
movq 0x48(%rax), %rsi
movl 0x50(%rax), %edx
movq %r13, %rdi
callq 0xc102
movq %r13, %rdi
movl %ebx, %esi
callq 0xd532
movq %r13, %rdi
leaq 0xbbd5(%rip), %rsi      # 0x173a9
callq 0xc44c
movq %r13, %rdi
leaq 0xbc1f(%rip), %rsi      # 0x17402
callq 0xc44c
addq $0x8, %r12
cmpq -0x70(%rbp), %r12
jne 0xb540
leaq -0x40(%rbp), %rdi
movl 0x8(%rdi), %ebx
xorl %esi, %esi
callq 0xc596
addl $-0x2, %ebx
leaq -0x40(%rbp), %rdi
movl %ebx, 0x8(%rdi)
leaq 0xc18b(%rip), %rsi      # 0x179a0
callq 0xc44c
addq $0x18, %r15
leaq 0xba14(%rip), %rsi      # 0x17239
movq %r15, %rdi
callq 0x9ec6
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0xa766
movq -0x60(%rbp), %rdi
callq 0x8240
leaq -0x40(%rbp), %rdi
callq 0xc56a
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x81d0
jmp 0xb865
jmp 0xb872
movq %rax, %rbx
jmp 0xb87e
jmp 0xb872
jmp 0xb872
jmp 0xb872
jmp 0xb872
movq %rax, %rbx
movq -0x60(%rbp), %rdi
callq 0x8240
leaq -0x40(%rbp), %rdi
callq 0xc56a
movq %rbx, %rdi
callq 0x84a0
nop