// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_handler
int32_t stats_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    conn *c = (conn*)argv;
    rel_time_t now = current_time;
    char temp[1024];
    pid_t pid = getpid();
    char *pos = temp;
    struct rusage usage;

    getrusage(RUSAGE_SELF, &usage);

    pos += sprintf(pos, "STAT pid %u\r\n", pid);
    pos += sprintf(pos, "STAT uptime %u\r\n", now);
    pos += sprintf(pos, "STAT time %ld\r\n", now + stats.started);
    pos += sprintf(pos, "STAT version " VERSION "\r\n");
    pos += sprintf(pos, "STAT pointer_size %ld\r\n", 8 * sizeof(void*));
    pos += sprintf(pos, "STAT rusage_user %ld.%06ld\r\n", usage.ru_utime.tv_sec, usage.ru_utime.tv_usec);
    pos += sprintf(pos, "STAT rusage_system %ld.%06ld\r\n", usage.ru_stime.tv_sec, usage.ru_stime.tv_usec);
    pos += sprintf(pos, "STAT curr_items %u\r\n", stats.curr_items);
    pos += sprintf(pos, "STAT total_items %u\r\n", stats.total_items);
    pos += sprintf(pos, "STAT bytes %llu\r\n", stats.curr_bytes);
    pos += sprintf(pos, "STAT curr_connections %u\r\n", stats.curr_conns - 1); /* ignore listening conn */
    pos += sprintf(pos, "STAT total_connections %u\r\n", stats.total_conns);
    pos += sprintf(pos, "STAT connection_structures %u\r\n", stats.conn_structs);
    pos += sprintf(pos, "STAT cmd_get %llu\r\n", stats.get_cmds);
    pos += sprintf(pos, "STAT cmd_set %llu\r\n", stats.set_cmds);
    pos += sprintf(pos, "STAT get_hits %llu\r\n", stats.get_hits);
    pos += sprintf(pos, "STAT get_misses %llu\r\n", stats.get_misses);
    pos += sprintf(pos, "STAT bytes_read %llu\r\n", stats.bytes_read);
    pos += sprintf(pos, "STAT bytes_written %llu\r\n", stats.bytes_written);
    pos += sprintf(pos, "STAT limit_maxbytes %llu\r\n", (unsigned long long) settings.maxbytes);
    pos += sprintf(pos, "END");
    out_string(c, temp);
    return COMMAND_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movq %rdx, %rbx
leaq 0x82a5(%rip), %rax      # 0xd340
movl (%rax), %r12d
callq 0x2100
movl %eax, %ebp
movq %rsp, %r15
xorl %edi, %edi
movq %r15, %rsi
callq 0x23a0
leaq 0x3411(%rip), %rsi      # 0x84ca
leaq 0x90(%rsp), %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2400
cltq
leaq (%rsp,%rax), %r13
addq $0x90, %r13
leaq 0x33fa(%rip), %rsi      # 0x84d8
movq %r13, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %rbp
addq %r13, %rbp
leaq 0x81e8(%rip), %r14      # 0xd2e0
addq 0x40(%r14), %r12
leaq 0x33e6(%rip), %rsi      # 0x84e9
movq %rbp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2400
cltq
leaq (%rax,%rbp), %r12
movups 0x33dc(%rip), %xmm0     # 0x84f9
leaq (%rax,%rbp), %rdi
addq $0x14, %rdi
movups %xmm0, -0x14(%rdi)
movabsq $0xa0d302e322e31, %rax  # imm = 0xA0D302E322E31
movq %rax, -0x7(%rdi)
leaq 0x33d0(%rip), %rsi      # 0x850e
pushq $0x40
popq %rdx
xorl %eax, %eax
callq 0x2400
cltq
addq %rax, %r12
addq $0x14, %r12
movq (%r15), %rdx
movq 0x8(%r15), %rcx
leaq 0x33c7(%rip), %rsi      # 0x8526
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r13
addq %r12, %r13
movq 0x10(%r15), %rdx
movq 0x18(%r15), %rcx
leaq 0x33c5(%rip), %rsi      # 0x8543
movq %r13, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r13, %r15
movl (%r14), %edx
leaq 0x33ca(%rip), %rsi      # 0x8562
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movl 0x4(%r14), %edx
leaq 0x33c4(%rip), %rsi      # 0x8577
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
movq 0x8(%r14), %rdx
leaq 0x33bf(%rip), %rsi      # 0x858d
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movl 0x10(%r14), %edx
decl %edx
leaq 0x33b4(%rip), %rsi      # 0x859f
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
movl 0x14(%r14), %edx
leaq 0x33b4(%rip), %rsi      # 0x85ba
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movl 0x18(%r14), %edx
leaq 0x33b5(%rip), %rsi      # 0x85d6
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
movq 0x20(%r14), %rdx
leaq 0x33ba(%rip), %rsi      # 0x85f6
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movq 0x28(%r14), %rdx
leaq 0x33b3(%rip), %rsi      # 0x860a
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
movq 0x30(%r14), %rdx
leaq 0x33ac(%rip), %rsi      # 0x861e
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movq 0x38(%r14), %rdx
leaq 0x33a6(%rip), %rsi      # 0x8633
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
movq 0x48(%r14), %rdx
leaq 0x33a2(%rip), %rsi      # 0x864a
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movq 0x50(%r14), %rdx
leaq 0x339e(%rip), %rsi      # 0x8661
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
leaq 0x7fae(%rip), %rax      # 0xd288
movq (%rax), %rdx
leaq 0x3397(%rip), %rsi      # 0x867b
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
cltq
movl $0x444e45, (%rax,%r15)  # imm = 0x444E45
movq %rbx, %rdi
leaq 0x90(%rsp), %rsi
callq 0x3946
xorl %eax, %eax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq