// File: /workspace/github_c_makefile_star2_O3/lengjingzju[P]json/json.c
// Function: json_deepcopy
json_object *json_deepcopy(json_object *json)
{
    json_object *new_json = NULL;
    json_object *item = NULL, *node = NULL;

    switch (json->type_member) {
    case JSON_NULL:   new_json = json_create_null();                        break;
    case JSON_BOOL:   new_json = json_create_bool(json->value.vnum.vbool);  break;
    case JSON_INT:    new_json = json_create_int(json->value.vnum.vint);    break;
    case JSON_HEX:    new_json = json_create_hex(json->value.vnum.vhex);    break;
    case JSON_LINT:   new_json = json_create_lint(json->value.vnum.vlint);  break;
    case JSON_LHEX:   new_json = json_create_lhex(json->value.vnum.vlhex);  break;
    case JSON_DOUBLE: new_json = json_create_double(json->value.vnum.vdbl); break;
    case JSON_STRING: new_json = json_create_string(&json->value.vstr);     break;
    case JSON_ARRAY:  new_json = json_create_array();                       break;
    case JSON_OBJECT: new_json = json_create_object();                      break;
    default:                                                                break;
    }

    if (new_json) {
        if (json_string_strdup(&json->jkey, &new_json->jkey) < 0) {
            JsonErr("add key failed!\n");
            json_del_object(new_json);
            return NULL;
        }
        if (json->type_member == JSON_ARRAY || json->type_member == JSON_OBJECT) {
            json_list_for_each_entry(item, &json->value.head, list, json_object) {
                if ((node = json_deepcopy(item)) == NULL) {
                    JsonErr("copy failed!\n");
                    json_del_object(new_json);
                    return NULL;
                }
                json_list_add_tail(&node->list, &new_json->value.head);
            }
        }
    }

    return new_json;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl 0x8(%rdi), %eax
andl $0xf, %eax
cmpl $0x9, %eax
ja 0x5057
movq %rdi, %rbx
leaq 0x7211(%rip), %rcx      # 0xc138
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %edi, %edi
jmp 0x4fb2
movq 0x18(%rbx), %rax
movq %rsp, %rsi
movq %rax, (%rsi)
movl $0x4, %edi
jmp 0x4fa6
movl $0x9, %edi
jmp 0x4fb2
movl 0x18(%rbx), %eax
movq %rsp, %rsi
movl %eax, (%rsi)
movl $0x2, %edi
jmp 0x4fa6
movl 0x18(%rbx), %eax
movq %rsp, %rsi
movl %eax, (%rsi)
movl $0x3, %edi
jmp 0x4fa6
leaq 0x18(%rbx), %rsi
movl $0x7, %edi
jmp 0x4fa6
movb 0x18(%rbx), %al
movq %rsp, %rsi
movb %al, (%rsi)
movl $0x1, %edi
jmp 0x4fa6
movq 0x18(%rbx), %rax
movq %rsp, %rsi
movq %rax, (%rsi)
movl $0x5, %edi
jmp 0x4fa6
movsd 0x18(%rbx), %xmm0
movq %rsp, %rsi
movsd %xmm0, (%rsi)
movl $0x6, %edi
callq 0x2280
jmp 0x4fb7
movl $0x8, %edi
callq 0x2030
movq %rax, %r14
testq %rax, %rax
je 0x5057
leaq 0x8(%rbx), %r15
leaq 0x8(%r14), %rsi
movq %r15, %rdi
callq 0x21a0
testl %eax, %eax
js 0x501f
movl (%r15), %eax
andl $0xe, %eax
cmpl $0x8, %eax
jne 0x505a
movq 0x18(%rbx), %r12
addq $0x18, %rbx
cmpq %rbx, %r12
je 0x505a
leaq 0x76ff(%rip), %r15      # 0xc6f5
movq %r12, %rdi
callq 0x2250
testq %rax, %rax
je 0x502d
movq 0x20(%r14), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq %rax, (%rcx)
movq %rax, 0x20(%r14)
movq (%r12), %r12
cmpq %rbx, %r12
jne 0x4ff6
jmp 0x505a
leaq 0x76dc(%rip), %r15      # 0xc702
movl $0x36b, %edx            # imm = 0x36B
jmp 0x5032
movl $0x372, %edx            # imm = 0x372
leaq 0x7263(%rip), %rdi      # 0xc29c
leaq 0x72f9(%rip), %rsi      # 0xc339
xorl %eax, %eax
callq 0x20e0
movq %r15, %rdi
callq 0x2080
movq %r14, %rdi
callq 0x2260
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq