// File: /workspace/github_c_makefile_star2_O2/lengjingzju[P]json/json.c
// Function: print_val_init
static int _print_val_init(json_print_t *print_ptr, json_print_choice_t *choice)
{
    print_ptr->format_flag = choice->format_flag;
    print_ptr->plus_size = choice->plus_size ? choice->plus_size : JSON_PRINT_SIZE_PLUS_DEF;

    print_ptr->fd = -1;
    if (choice->path) {
        print_ptr->realloc = _print_file_ptr_realloc;
        if ((print_ptr->fd = open(choice->path, O_CREAT|O_TRUNC|O_WRONLY|O_BINARY, 0666)) < 0) {
            JsonErr("open(%s) failed!\n", choice->path);
            goto err;
        }
        print_ptr->size = print_ptr->plus_size;
    } else {
        size_t item_size = 0;
        size_t total_size = 0;

        print_ptr->realloc = _print_str_ptr_realloc;
        item_size = (choice->format_flag) ? JSON_FORMAT_ITEM_SIZE_DEF : JSON_UNFORMAT_ITEM_SIZE_DEF;
        if (choice->item_size > item_size)
            item_size = choice->item_size;

        total_size = print_ptr->item_total * item_size;
        if (total_size < JSON_PRINT_SIZE_PLUS_DEF)
            total_size = JSON_PRINT_SIZE_PLUS_DEF;
        print_ptr->size = total_size;
    }

    if (choice->ptr && choice->ptr->p) {
        print_ptr->size = choice->ptr->size;
        print_ptr->ptr = choice->ptr->p;
        choice->ptr->p = NULL;
    } else {
        if ((print_ptr->ptr = (char *)json_malloc(print_ptr->size)) == NULL) {
            JsonErr("malloc failed!\n");
            goto err;
        }
    }
    print_ptr->cur = print_ptr->ptr;

    return 0;
err:
    _print_val_release(print_ptr, true, NULL, NULL);
    return -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movb 0x1c(%rsi), %cl
movb %cl, 0x40(%rdi)
movq 0x8(%rsi), %rax
testq %rax, %rax
movl $0x400, %edi            # imm = 0x400
cmoveq %rdi, %rax
movq %rax, 0x28(%rbx)
orl $-0x1, (%rbx)
movq 0x28(%rsi), %rax
testq %rax, %rax
je 0x2b1a
leaq 0x2eb6(%rip), %rcx      # 0x59ac
movq %rcx, 0x18(%rbx)
movq %rax, %rdi
movl $0x241, %esi            # imm = 0x241
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x11a0
movl %eax, (%rbx)
testl %eax, %eax
js 0x2b8c
movq 0x28(%rbx), %rdi
jmp 0x2b4e
leaq 0x2f68(%rip), %rax      # 0x5a89
movq %rax, 0x18(%rbx)
movzbl %cl, %eax
leaq 0x18(,%rax,8), %rax
movq 0x10(%r14), %rcx
cmpq %rax, %rcx
cmovaq %rcx, %rax
movslq 0x38(%rbx), %rcx
imulq %rax, %rcx
cmpq $0x401, %rcx            # imm = 0x401
cmovaeq %rcx, %rdi
movq %rdi, 0x20(%rbx)
movq 0x20(%r14), %rcx
testq %rcx, %rcx
je 0x2b76
movq 0x8(%rcx), %rax
testq %rax, %rax
je 0x2b76
movq (%rcx), %rdx
movq %rdx, 0x20(%rbx)
movq %rax, 0x8(%rbx)
andq $0x0, 0x8(%rcx)
jmp 0x2b84
callq 0x1150
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x2bba
movq %rax, 0x10(%rbx)
xorl %eax, %eax
jmp 0x2bf2
leaq 0x58c9(%rip), %rdi      # 0x845c
leaq 0x5aa2(%rip), %rsi      # 0x863c
movl $0x711, %edx            # imm = 0x711
xorl %eax, %eax
callq 0x10c0
movq 0x28(%r14), %rsi
leaq 0x5a23(%rip), %rdi      # 0x85d4
xorl %eax, %eax
callq 0x10c0
jmp 0x2be0
leaq 0x589b(%rip), %rdi      # 0x845c
leaq 0x5a74(%rip), %rsi      # 0x863c
movl $0x72a, %edx            # imm = 0x72A
xorl %eax, %eax
callq 0x10c0
leaq 0x5d85(%rip), %rdi      # 0x8960
callq 0x1060
pushq $0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2bfa
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq