// File: /workspace/github_c_makefile_star2_O3/desion[P]terminal/src/hdict.c
// Function: hdb_info
int hdb_info(hdb_t *hdb, char *buf, int size)
{
    int len = 0;
    len += snprintf(buf+len, size-len, "%2s %20s %10s %5s %3s %9s %8s %13s %s\n", 
            "id", "label", "version", "state", "ref", "num_qry", "idx_num", "open_time", "path");
    if (len < size) 
        len += snprintf(buf+len, size-len, "---------------------------------------------------------------------------------------\n");
    int pass, k;
    hdict_t *hdict;
    LOCK(hdb);
    for (pass = 0; pass < 2; ++pass) {
        const char *state;
        struct hdict_list_t *hlist;
        switch (pass) {
        case 0:
            state = "OPEN";
            hlist = &hdb->open_list;
            break;
        case 1:
            state = "CLOSE";
            hlist = &hdb->close_list;
            break;
        default:
            state = NULL;
            hlist = NULL;
        }

        k = 0;
        for (hdict = TAILQ_FIRST(hlist); hdict; hdict = TAILQ_NEXT(hdict, link)) {
            ++k;
            if (len < size) {
                struct tm tm;
                localtime_r(&hdict->open_time, &tm);
                len += snprintf(buf+len, size-len, "%2lu %20s %u %5s %2d %10d %8d %02d%02d%02d-%02d%02d%02d %s\n",
                    hdict->hdid,
                    hdict->hdict_meta->label,
                    hdict->hdict_meta->version,
                    state,
                    hdict->ref,
                    hdict->num_qry,
                    hdict->idx_num,
                    tm.tm_year - 100, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
                    hdict->path);
            }
        }
    }
    UNLK(hdb);
    return len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edx, %ebp
movq %rdi, 0x8(%rsp)
movslq %edx, %r12
leaq 0x2692(%rip), %r10      # 0x5943
leaq 0x2681(%rip), %r11      # 0x5939
leaq 0x2672(%rip), %rbx      # 0x5931
leaq 0x2663(%rip), %r14      # 0x5929
leaq 0x2658(%rip), %r15      # 0x5925
leaq 0x264b(%rip), %r13      # 0x591f
leaq 0x260c(%rip), %rdx      # 0x58e7
leaq 0x262c(%rip), %rcx      # 0x590e
leaq 0x2628(%rip), %r8       # 0x5911
leaq 0x2627(%rip), %r9       # 0x5917
movq %rsi, 0x18(%rsp)
movq %rsi, %rdi
movq %r12, %rsi
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %rbx
pushq %r14
pushq %r15
pushq %r13
callq 0x2160
addq $0x30, %rsp
movl %eax, %r13d
subl %eax, %r12d
jle 0x3335
movslq %r13d, %rdi
addq 0x18(%rsp), %rdi
movslq %r12d, %rsi
leaq 0x261d(%rip), %rdx      # 0x5948
xorl %eax, %eax
callq 0x2160
addl %eax, %r13d
movq 0x8(%rsp), %rdi
callq 0x2470
movb $0x1, %cl
xorl %eax, %eax
movl %ebp, 0x14(%rsp)
movl %ecx, 0x10(%rsp)
testb $0x1, %al
leaq 0x264d(%rip), %rdx      # 0x59a1
leaq 0x264b(%rip), %rcx      # 0x59a6
cmovneq %rcx, %rdx
movq %rdx, 0x20(%rsp)
movzbl %al, %eax
andl $0x1, %eax
shll $0x4, %eax
movq 0x8(%rsp), %rcx
movq 0x28(%rcx,%rax), %r12
testq %r12, %r12
je 0x343f
movl %ebp, %r14d
subl %r13d, %r14d
jle 0x3436
leaq 0x40(%r12), %rdi
leaq 0x40(%rsp), %rsi
callq 0x2080
movslq %r13d, %rdi
addq 0x18(%rsp), %rdi
movslq %r14d, %rsi
movq 0x50(%r12), %rcx
movq 0x58(%r12), %r8
movl (%r8), %r9d
addq $0x5, %r8
movl 0x4c(%r12), %eax
movq %rax, 0x38(%rsp)
movl 0x48(%r12), %eax
movq %rax, 0x30(%rsp)
movl 0x28(%r12), %eax
movq %rax, 0x28(%rsp)
movl 0x54(%rsp), %r14d
addl $-0x64, %r14d
movl 0x50(%rsp), %ebp
incl %ebp
movl 0x4c(%rsp), %ebx
movl 0x48(%rsp), %r15d
movl 0x40(%rsp), %r10d
movl 0x44(%rsp), %r11d
subq $0x8, %rsp
leaq 0x25aa(%rip), %rdx      # 0x59ac
xorl %eax, %eax
pushq 0x20(%r12)
pushq %r10
pushq %r11
pushq %r15
pushq %rbx
pushq %rbp
movl 0x4c(%rsp), %ebp
pushq %r14
pushq 0x68(%rsp)
pushq 0x78(%rsp)
pushq 0x88(%rsp)
pushq 0x78(%rsp)
callq 0x2160
addq $0x60, %rsp
addl %eax, %r13d
movq (%r12), %r12
jmp 0x3377
movb $0x1, %al
testb $0x1, 0x10(%rsp)
movl $0x0, %ecx
jne 0x3347
movq 0x8(%rsp), %rdi
callq 0x22b0
movl %r13d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq