// File: /workspace/github_c_makefile_star2_O3/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)
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movq 0x28(%rsi), %rax
testq %rax, %rax
je 0x4b8d
leaq 0x2754(%rip), %rcx      # 0x72bd
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 0x4c02
movq 0x28(%rbx), %rdi
jmp 0x4bc1
leaq 0x2809(%rip), %rax      # 0x739d
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 0x4bec
movq 0x8(%rcx), %rax
testq %rax, %rax
je 0x4bec
movq (%rcx), %rdx
movq %rdx, 0x20(%rbx)
movq %rax, 0x8(%rbx)
movq $0x0, 0x8(%rcx)
jmp 0x4bfa
callq 0x1150
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x4c30
movq %rax, 0x10(%rbx)
xorl %eax, %eax
jmp 0x4c6c
leaq 0x5853(%rip), %rdi      # 0xa45c
leaq 0x5a2c(%rip), %rsi      # 0xa63c
movl $0x711, %edx            # imm = 0x711
xorl %eax, %eax
callq 0x10c0
movq 0x28(%r14), %rsi
leaq 0x59ad(%rip), %rdi      # 0xa5d4
xorl %eax, %eax
callq 0x10c0
jmp 0x4c56
leaq 0x5825(%rip), %rdi      # 0xa45c
leaq 0x59fe(%rip), %rsi      # 0xa63c
movl $0x72a, %edx            # imm = 0x72A
xorl %eax, %eax
callq 0x10c0
leaq 0x5d0f(%rip), %rdi      # 0xa960
callq 0x1060
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4c74
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq