// File: /workspace/github_c_makefile_star2_O0/lengjingzju[P]json/json.c
// Function: json_parse_common
json_object *json_parse_common(json_parse_choice_t *choice)
{
    json_object *json = NULL;
    json_parse_t parse_val = {0};
    size_t mem_size = 0, total_size = 0;

    parse_val.read_size = parse_val.read_size ? parse_val.read_size : JSON_PARSE_READ_SIZE_DEF;
    parse_val.mem = choice->mem ? choice->mem : &s_invalid_json_mem;
    parse_val.fd = -1;
    if (choice->path) {
        if ((parse_val.fd = open(choice->path, O_RDONLY|O_BINARY)) < 0) {
            JsonErr("open(%s) failed!\n", choice->path);
            return NULL;
        }
        if (choice->str_len) {
            total_size = choice->str_len;
        } else {
            total_size = lseek(parse_val.fd, 0, SEEK_END);
            lseek(parse_val.fd, 0, SEEK_SET);
        }
        parse_val.skip_blank = _skip_blank;
        parse_val.parse_string = _json_parse_string;
        parse_val.parse_value = _json_parse_value;
    } else {
        parse_val.str = choice->str;
        total_size = choice->str_len ? choice->str_len : strlen(choice->str);
        parse_val.size = total_size;
        if (choice->mem) {
            parse_val.reuse_flag = choice->reuse_flag;
        }
        parse_val.skip_blank = _skip_blank_rapid;
        if (parse_val.reuse_flag) {
            parse_val.parse_string = _json_parse_string_reuse;
        } else {
            parse_val.parse_string = _json_parse_string_rapid;
        }
        parse_val.parse_value = _json_parse_value_rapid;
    }

    if (choice->mem && !choice->mem->valid) {
        pjson_memory_init(choice->mem);
        mem_size = total_size / JSON_PARSE_NUM_DIV_DEF;
        if (mem_size < choice->mem_size)
            mem_size = choice->mem_size;
        choice->mem->obj_mgr.mem_size = mem_size;
        choice->mem->key_mgr.mem_size = mem_size;
        choice->mem->str_mgr.mem_size = mem_size;
    }

#if !JSON_PARSE_SINGLE_VALUE
    parse_val.skip_blank(&parse_val);
    if (parse_val.str[parse_val.offset] != '{' && parse_val.str[parse_val.offset] != '[') {
        JsonErr("The first object isn't object or array\n");
        goto end;
    }
#endif

    if (parse_val.parse_value(&parse_val, &json) < 0) {
        if (choice->mem) {
            pjson_memory_free(choice->mem);
        } else {
            json_del_object(json);
        }
        json = NULL;
        goto end;
    }

#if !JSON_PARSE_FINISHED_CHAR
    parse_val.skip_blank(&parse_val);
    if (parse_val.str[parse_val.offset]) {
        JsonErr("Extra trailing characters!\n%s\n", parse_val.str + parse_val.offset);
        if (choice->mem) {
            pjson_memory_free(choice->mem);
        } else {
            json_del_object(json);
        }
        json = NULL;
        goto end;
    }
#endif

end:
    if (choice->path) {
        if (parse_val.str)
            json_free(parse_val.str);
        if (parse_val.fd >= 0)
            close(parse_val.fd);
    }
    return json;
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xb8(%rsp)
movq $0x0, 0xb0(%rsp)
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
movl $0x88, %edx
callq 0x10f0
movq $0x0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x6252
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x625e
movl $0x2000, %eax           # imm = 0x2000
movq %rax, 0x10(%rsp)
jmp 0x625e
movq 0x10(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xb8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x628a
movq 0xb8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x6298
leaq 0x10047(%rip), %rax     # 0x162d8
movq %rax, 0x8(%rsp)
jmp 0x6298
movq 0x8(%rsp), %rax
movq %rax, 0x60(%rsp)
movl $0xffffffff, 0x28(%rsp) # imm = 0xFFFFFFFF
movq 0xb8(%rsp), %rax
cmpq $0x0, 0x28(%rax)
je 0x6393
movq 0xb8(%rsp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x11a0
movl %eax, 0x28(%rsp)
cmpl $0x0, %eax
jge 0x6322
jmp 0x62dd
leaq 0xa710(%rip), %rdi      # 0x109f4
leaq 0xa93e(%rip), %rsi      # 0x10c29
movl $0xe0e, %edx            # imm = 0xE0E
movb $0x0, %al
callq 0x10c0
movq 0xb8(%rsp), %rax
movq 0x28(%rax), %rsi
leaq 0xa931(%rip), %rdi      # 0x10c3b
movb $0x0, %al
callq 0x10c0
movq $0x0, 0xc0(%rsp)
jmp 0x6613
movq 0xb8(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x6344
movq 0xb8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x18(%rsp)
jmp 0x636a
movl 0x28(%rsp), %edi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x10e0
movq %rax, 0x18(%rsp)
movl 0x28(%rsp), %edi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x10e0
leaq 0x2bf(%rip), %rax       # 0x6630
movq %rax, 0x68(%rsp)
leaq 0x363(%rip), %rax       # 0x66e0
movq %rax, 0x70(%rsp)
leaq 0x657(%rip), %rax       # 0x69e0
movq %rax, 0x78(%rsp)
jmp 0x6446
movq 0xb8(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x58(%rsp)
movq 0xb8(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x63c5
movq 0xb8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, (%rsp)
jmp 0x63da
movq 0xb8(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0x10b0
movq %rax, (%rsp)
movq (%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xb8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x640d
movq 0xb8(%rsp), %rax
movb 0x18(%rax), %al
andb $0x1, %al
movb %al, 0x50(%rsp)
leaq 0xe4c(%rip), %rax       # 0x7260
movq %rax, 0x68(%rsp)
testb $0x1, 0x50(%rsp)
je 0x642e
leaq 0xea9(%rip), %rax       # 0x72d0
movq %rax, 0x70(%rsp)
jmp 0x643a
leaq 0x153b(%rip), %rax      # 0x7970
movq %rax, 0x70(%rsp)
leaq 0x187f(%rip), %rax      # 0x7cc0
movq %rax, 0x78(%rsp)
movq 0xb8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x64ee
movq 0xb8(%rsp), %rax
movq 0x20(%rax), %rax
testb $0x1, (%rax)
jne 0x64ee
movq 0xb8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x2df0
movq 0x18(%rsp), %rax
shrq $0x3, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq 0xb8(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x64af
movq 0xb8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rcx
movq 0xb8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x18(%rax)
movq 0x20(%rsp), %rcx
movq 0xb8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x38(%rax)
movq 0x20(%rsp), %rcx
movq 0xb8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x58(%rax)
leaq 0x28(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq *0x78(%rsp)
cmpl $0x0, %eax
jge 0x6544
movq 0xb8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x6526
movq 0xb8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x2e50
jmp 0x6533
movq 0xb0(%rsp), %rdi
callq 0x2b20
movq $0x0, 0xb0(%rsp)
jmp 0x65d0
leaq 0x28(%rsp), %rdi
callq *0x68(%rsp)
movq 0x58(%rsp), %rax
movq 0x38(%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x65ce
jmp 0x655f
leaq 0xa48e(%rip), %rdi      # 0x109f4
leaq 0xa6bc(%rip), %rsi      # 0x10c29
movl $0xe49, %edx            # imm = 0xE49
movb $0x0, %al
callq 0x10c0
movq 0x58(%rsp), %rsi
addq 0x38(%rsp), %rsi
leaq 0xa6c3(%rip), %rdi      # 0x10c4d
movb $0x0, %al
callq 0x10c0
movq 0xb8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x65b3
movq 0xb8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x2e50
jmp 0x65c0
movq 0xb0(%rsp), %rdi
callq 0x2b20
movq $0x0, 0xb0(%rsp)
jmp 0x65d0
jmp 0x65d0
movq 0xb8(%rsp), %rax
cmpq $0x0, 0x28(%rax)
je 0x6603
cmpq $0x0, 0x58(%rsp)
je 0x65f1
movq 0x58(%rsp), %rdi
callq 0x1030
cmpl $0x0, 0x28(%rsp)
jl 0x6601
movl 0x28(%rsp), %edi
callq 0x1100
jmp 0x6603
movq 0xb0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
addq $0xc8, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)