// File: /workspace/github_c_makefile_star2_O1/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), %rdx
testq %rdx, %rdx
movl $0x400, %eax            # imm = 0x400
cmoveq %rax, %rdx
movq %rdx, 0x28(%rdi)
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
movq 0x28(%rsi), %rdi
testq %rdi, %rdi
je 0x479f
leaq 0x2bcd(%rip), %rax      # 0x7347
movq %rax, 0x18(%rbx)
movl $0x241, %esi            # imm = 0x241
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x11b0
movl %eax, (%rbx)
testl %eax, %eax
js 0x481c
movq 0x28(%rbx), %rax
jmp 0x47d3
leaq 0x2c84(%rip), %rdx      # 0x742a
movq %rdx, 0x18(%rbx)
movzbl %cl, %ecx
leaq 0x18(,%rcx,8), %rcx
movq 0x10(%r14), %rdx
cmpq %rcx, %rdx
cmovaq %rdx, %rcx
movslq 0x38(%rbx), %rdx
imulq %rcx, %rdx
cmpq $0x401, %rdx            # imm = 0x401
cmovaeq %rdx, %rax
movq %rax, 0x20(%rbx)
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x47fe
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x47fe
movq (%rax), %rdx
movq %rdx, 0x20(%rbx)
movq %rcx, 0x8(%rbx)
movq $0x0, 0x8(%rax)
jmp 0x4810
movq 0x20(%rbx), %rdi
callq 0x1160
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x484a
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
xorl %eax, %eax
jmp 0x4886
leaq 0x5c39(%rip), %rdi      # 0xa45c
leaq 0x5e12(%rip), %rsi      # 0xa63c
movl $0x711, %edx            # imm = 0x711
xorl %eax, %eax
callq 0x10d0
movq 0x28(%r14), %rsi
leaq 0x5d93(%rip), %rdi      # 0xa5d4
xorl %eax, %eax
callq 0x10d0
jmp 0x4870
leaq 0x5c0b(%rip), %rdi      # 0xa45c
leaq 0x5de4(%rip), %rsi      # 0xa63c
movl $0x72a, %edx            # imm = 0x72A
xorl %eax, %eax
callq 0x10d0
leaq 0x60f5(%rip), %rdi      # 0xa960
callq 0x1070
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x488e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq