// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movl %edx, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x38(%rbp), %rdi
movslq -0x40(%rbp), %rax
addq %rax, %rdi
movl -0x3c(%rbp), %eax
subl -0x40(%rbp), %eax
movslq %eax, %rsi
leaq 0x377a(%rip), %rdx      # 0x70cb
leaq 0x379a(%rip), %rcx      # 0x70f2
leaq 0x3796(%rip), %r8       # 0x70f5
leaq 0x3795(%rip), %r9       # 0x70fb
leaq 0x3796(%rip), %r15      # 0x7103
leaq 0x3795(%rip), %r14      # 0x7109
leaq 0x3792(%rip), %rbx      # 0x710d
leaq 0x3793(%rip), %r11      # 0x7115
leaq 0x3794(%rip), %r10      # 0x711d
leaq 0x3797(%rip), %rax      # 0x7127
movq %r15, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movb $0x0, %al
callq 0x2170
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x39ea
movq -0x38(%rbp), %rdi
movslq -0x40(%rbp), %rax
addq %rax, %rdi
movl -0x3c(%rbp), %eax
subl -0x40(%rbp), %eax
movslq %eax, %rsi
leaq 0x374f(%rip), %rdx      # 0x712c
movb $0x0, %al
callq 0x2170
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2490
movl $0x0, -0x44(%rbp)
cmpl $0x2, -0x44(%rbp)
jge 0x3bbd
movl -0x44(%rbp), %eax
movl %eax, -0x9c(%rbp)
testl %eax, %eax
je 0x3a20
jmp 0x3a13
movl -0x9c(%rbp), %eax
subl $0x1, %eax
je 0x3a39
jmp 0x3a52
leaq 0x375e(%rip), %rax      # 0x7185
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x60(%rbp)
jmp 0x3a62
leaq 0x374a(%rip), %rax      # 0x718a
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rax
addq $0x38, %rax
movq %rax, -0x60(%rbp)
jmp 0x3a62
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x3bad
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x3b9b
movq -0x50(%rbp), %rdi
addq $0x40, %rdi
leaq -0x98(%rbp), %rsi
callq 0x2080
movq -0x38(%rbp), %rdi
movslq -0x40(%rbp), %rax
addq %rax, %rdi
movl -0x3c(%rbp), %eax
subl -0x40(%rbp), %eax
movslq %eax, %rsi
movq -0x50(%rbp), %rax
movq 0x50(%rax), %rcx
movq -0x50(%rbp), %rax
movq 0x58(%rax), %r8
addq $0x5, %r8
movq -0x50(%rbp), %rax
movq 0x58(%rax), %rax
movl (%rax), %r9d
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rdx
movl 0x4c(%rdx), %edx
movl %edx, -0xb0(%rbp)
movq -0x50(%rbp), %rdx
movl 0x48(%rdx), %edx
movl %edx, -0xac(%rbp)
movq -0x50(%rbp), %rdx
movl 0x28(%rdx), %r13d
movl -0x84(%rbp), %r12d
subl $0x64, %r12d
movl -0x88(%rbp), %r15d
addl $0x1, %r15d
movl -0x8c(%rbp), %r14d
movl -0x90(%rbp), %ebx
movl -0x94(%rbp), %r11d
movl -0x98(%rbp), %r10d
movq -0x50(%rbp), %rdx
movq 0x20(%rdx), %rdx
movq %rdx, -0xa8(%rbp)
leaq 0x3648(%rip), %rdx      # 0x7190
movq %rax, (%rsp)
movl -0xb0(%rbp), %eax
movl %eax, 0x8(%rsp)
movl -0xac(%rbp), %eax
movl %eax, 0x10(%rsp)
movq -0xa8(%rbp), %rax
movl %r13d, 0x18(%rsp)
movl %r12d, 0x20(%rsp)
movl %r15d, 0x28(%rsp)
movl %r14d, 0x30(%rsp)
movl %ebx, 0x38(%rsp)
movl %r11d, 0x40(%rsp)
movl %r10d, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movb $0x0, %al
callq 0x2170
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x3b9d
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x3a74
jmp 0x3baf
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x39fa
movq -0x30(%rbp), %rdi
callq 0x22d0
movl -0x40(%rbp), %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax,%rax)