// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x20(%rsp), %rax
movb 0x1c(%rax), %cl
movq 0x28(%rsp), %rax
andb $0x1, %cl
movb %cl, 0x40(%rax)
movq 0x20(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x320d
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x3219
movl $0x400, %eax            # imm = 0x400
movq %rax, 0x8(%rsp)
jmp 0x3219
movq 0x8(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x28(%rsp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq 0x20(%rsp), %rax
cmpq $0x0, 0x28(%rax)
je 0x32c7
movq 0x28(%rsp), %rax
leaq 0x75e2(%rip), %rcx      # 0xa830
movq %rcx, 0x18(%rax)
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rdi
movl $0x241, %esi            # imm = 0x241
movl $0x1b6, %edx            # imm = 0x1B6
movb $0x0, %al
callq 0x11a0
movq 0x28(%rsp), %rcx
movl %eax, (%rcx)
cmpl $0x0, %eax
jge 0x32b0
jmp 0x327a
leaq 0xd773(%rip), %rdi      # 0x109f4
leaq 0xda1b(%rip), %rsi      # 0x10ca3
movl $0x711, %edx            # imm = 0x711
movb $0x0, %al
callq 0x10c0
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rsi
leaq 0xd997(%rip), %rdi      # 0x10c3b
movb $0x0, %al
callq 0x10c0
jmp 0x341d
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x20(%rax)
jmp 0x335c
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x28(%rsp), %rax
leaq 0x76fb(%rip), %rcx      # 0xa9e0
movq %rcx, 0x18(%rax)
movq 0x20(%rsp), %rax
movb 0x1c(%rax), %dl
movl $0x18, %eax
movl $0x20, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cltq
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
cmpq 0x18(%rsp), %rax
jbe 0x3326
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x28(%rsp), %rax
movslq 0x38(%rax), %rax
imulq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x400, 0x10(%rsp)      # imm = 0x400
jae 0x334e
movq $0x400, 0x10(%rsp)      # imm = 0x400
movq 0x10(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x20(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x33b6
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x33b6
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rax
movq $0x0, 0x8(%rax)
jmp 0x3401
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x1160
movq 0x28(%rsp), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0x33ff
jmp 0x33d5
leaq 0xd618(%rip), %rdi      # 0x109f4
leaq 0xd8c0(%rip), %rsi      # 0x10ca3
movl $0x72a, %edx            # imm = 0x72A
movb $0x0, %al
callq 0x10c0
leaq 0xd610(%rip), %rdi      # 0x10a06
movb $0x0, %al
callq 0x10c0
jmp 0x341d
jmp 0x3401
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, 0x34(%rsp)
jmp 0x343b
movq 0x28(%rsp), %rdi
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x46e0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
nop