// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/iniconf.c
// Function: ini_dump
int ini_dump(ini_conf_t* ini, char* buf, size_t len)
{
    if (!ini || !buf || !ini)
        return -1;
    size_t wlen = 0;
    dict_iterator* it = dict_get_iterator(ini);
    dict_entry* de = NULL;
    while((de = dict_next(it)) != NULL) {
        const char* k = (const char*)dict_get_entry_key(de);
        ini_sec_t* v = (ini_sec_t*)dict_get_entry_val(de);

        if(wlen >= len) return -1;

        wlen += snprintf(buf + wlen, len - wlen, "[%s]\n", k);
        if(wlen >= len) return -1;

        int ret = ini_save_sec_buf(v, buf + wlen, len - wlen);
        if(ret <= 0) return -1;
        wlen += ret;
    }
    dict_release_iterator(it);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r12
testq %rdi, %rdi
sete %dl
movq %rsi, -0x48(%rbp)
testq %rsi, %rsi
sete %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orb %dl, %cl
jne 0x40d5
callq 0x2f8b
movq %rax, %rbx
xorl %r14d, %r14d
movq %r12, -0x38(%rbp)
movq %rax, -0x40(%rbp)
movq %rbx, %rdi
callq 0x2ffd
testq %rax, %rax
je 0x40cb
movq %r12, %rsi
subq %r14, %rsi
jbe 0x4088
movq 0x10(%rax), %r15
movq 0x8(%rax), %rcx
movq -0x48(%rbp), %rax
leaq (%rax,%r14), %rdi
movq %r14, %r13
xorl %r14d, %r14d
leaq 0x41c2(%rip), %rdx      # 0x813a
xorl %eax, %eax
callq 0x2170
cltq
addq %rax, %r13
movq %r12, %rbx
movq %r13, -0x30(%rbp)
subq %r13, %rbx
jbe 0x40b3
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x40a1
movq -0x48(%rbp), %rax
movq -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq %r15, %rdi
callq 0x2f8b
movq %rax, -0x50(%rbp)
xorl %r12d, %r12d
movq -0x50(%rbp), %rdi
callq 0x2ffd
testq %rax, %rax
je 0x4091
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %r15
leaq (%r15,%r12), %rdi
movq %rbx, %rsi
subq %r12, %rsi
xorl %r13d, %r13d
leaq 0x41c2(%rip), %rdx      # 0x81b8
xorl %eax, %eax
callq 0x2170
movslq %eax, %r14
addq %r12, %r14
movq %rbx, %rsi
subq %r14, %rsi
jbe 0x4071
leaq (%r15,%r14), %rdi
xorl %r13d, %r13d
leaq 0x4127(%rip), %rdx      # 0x8140
xorl %eax, %eax
callq 0x2170
cltq
addq %rax, %r14
movq %rbx, %rsi
subq %r14, %rsi
jbe 0x4071
leaq (%r15,%r14), %rdi
xorl %r13d, %r13d
leaq 0x417d(%rip), %rdx      # 0x81b8
movq -0x60(%rbp), %rcx
xorl %eax, %eax
callq 0x2170
cltq
addq %rax, %r14
movq %rbx, %rsi
subq %r14, %rsi
jbe 0x4071
leaq (%r15,%r14), %rdi
leaq 0x413b(%rip), %rdx      # 0x8199
xorl %eax, %eax
callq 0x2170
cltq
addq %rax, %r14
cmpq %rbx, %r14
setb %r13b
movq %r14, %r12
testb %r13b, %r13b
jne 0x3fc0
movq -0x38(%rbp), %r12
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x40a1
movq %r14, -0x30(%rbp)
xorl %r14d, %r14d
jmp 0x40b7
movq -0x50(%rbp), %rdi
callq 0x307e
movl %r12d, %ecx
movq -0x38(%rbp), %r12
testl %ecx, %ecx
setg %r14b
movl $0x0, %eax
cmovlel %eax, %ecx
addq %rcx, -0x30(%rbp)
movq -0x40(%rbp), %rbx
testb %r14b, %r14b
movq -0x30(%rbp), %r14
jne 0x3f3e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x40d5
movq %rbx, %rdi
callq 0x307e
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq