// File: /workspace/github_c_makefile_star2_O1/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 0x786a(%rip), %rax      # 0xd340
movl (%rax), %r12d
callq 0x2100
movl %eax, %ebp
movq %rsp, %r15
xorl %edi, %edi
movq %r15, %rsi
callq 0x23a0
leaq 0x2a16(%rip), %rsi      # 0x850a
leaq 0x90(%rsp), %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2400
cltq
leaq (%rsp,%rax), %r13
addq $0x90, %r13
leaq 0x29ff(%rip), %rsi      # 0x8518
movq %r13, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %rbp
addq %r13, %rbp
leaq 0x77ad(%rip), %r14      # 0xd2e0
addq 0x40(%r14), %r12
leaq 0x29eb(%rip), %rsi      # 0x8529
movq %rbp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2400
cltq
leaq (%rax,%rbp), %r12
movups 0x29e1(%rip), %xmm0     # 0x8539
leaq (%rax,%rbp), %rdi
addq $0x14, %rdi
movups %xmm0, -0x14(%rdi)
movabsq $0xa0d302e322e31, %rax  # imm = 0xA0D302E322E31
movq %rax, -0x7(%rdi)
leaq 0x29d5(%rip), %rsi      # 0x854e
movl $0x40, %edx
xorl %eax, %eax
callq 0x2400
cltq
addq %rax, %r12
addq $0x14, %r12
movq (%r15), %rdx
movq 0x8(%r15), %rcx
leaq 0x29ca(%rip), %rsi      # 0x8566
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r13
addq %r12, %r13
movq 0x10(%r15), %rdx
movq 0x18(%r15), %rcx
leaq 0x29c8(%rip), %rsi      # 0x8583
movq %r13, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r13, %r15
movl (%r14), %edx
leaq 0x29cd(%rip), %rsi      # 0x85a2
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movl 0x4(%r14), %edx
leaq 0x29c7(%rip), %rsi      # 0x85b7
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
movq 0x8(%r14), %rdx
leaq 0x29c2(%rip), %rsi      # 0x85cd
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movl 0x10(%r14), %edx
decl %edx
leaq 0x29b7(%rip), %rsi      # 0x85df
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
movl 0x14(%r14), %edx
leaq 0x29b7(%rip), %rsi      # 0x85fa
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movl 0x18(%r14), %edx
leaq 0x29b8(%rip), %rsi      # 0x8616
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
movq 0x20(%r14), %rdx
leaq 0x29bd(%rip), %rsi      # 0x8636
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movq 0x28(%r14), %rdx
leaq 0x29b6(%rip), %rsi      # 0x864a
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
movq 0x30(%r14), %rdx
leaq 0x29af(%rip), %rsi      # 0x865e
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movq 0x38(%r14), %rdx
leaq 0x29a9(%rip), %rsi      # 0x8673
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
movq 0x48(%r14), %rdx
leaq 0x29a5(%rip), %rsi      # 0x868a
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
movq 0x50(%r14), %rdx
leaq 0x29a1(%rip), %rsi      # 0x86a1
movq %r12, %rdi
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r12, %r15
leaq 0x7571(%rip), %rax      # 0xd288
movq (%rax), %rdx
leaq 0x299a(%rip), %rsi      # 0x86bb
movq %r15, %rdi
xorl %eax, %eax
callq 0x2400
cltq
movl $0x444e45, (%rax,%r15)  # imm = 0x444E45
movq %rbx, %rdi
leaq 0x90(%rsp), %rsi
callq 0x41c9
xorl %eax, %eax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq