// File: /workspace/github_c_makefile_star2_O1/xapi-project[P]rrd-client-lib/parson/parson.c
// Function: json_value_deep_copy
JSON_Value * json_value_deep_copy(const JSON_Value *value) {
    size_t i = 0;
    JSON_Value *return_value = NULL, *temp_value_copy = NULL, *temp_value = NULL;
    const char *temp_string = NULL, *temp_key = NULL;
    char *temp_string_copy = NULL;
    JSON_Array *temp_array = NULL, *temp_array_copy = NULL;
    JSON_Object *temp_object = NULL, *temp_object_copy = NULL;

    switch (json_value_get_type(value)) {
        case JSONArray:
            temp_array = json_value_get_array(value);
            return_value = json_value_init_array();
            if (return_value == NULL) {
                return NULL;
            }
            temp_array_copy = json_value_get_array(return_value);
            for (i = 0; i < json_array_get_count(temp_array); i++) {
                temp_value = json_array_get_value(temp_array, i);
                temp_value_copy = json_value_deep_copy(temp_value);
                if (temp_value_copy == NULL) {
                    json_value_free(return_value);
                    return NULL;
                }
                if (json_array_add(temp_array_copy, temp_value_copy) == JSONFailure) {
                    json_value_free(return_value);
                    json_value_free(temp_value_copy);
                    return NULL;
                }
            }
            return return_value;
        case JSONObject:
            temp_object = json_value_get_object(value);
            return_value = json_value_init_object();
            if (return_value == NULL) {
                return NULL;
            }
            temp_object_copy = json_value_get_object(return_value);
            for (i = 0; i < json_object_get_count(temp_object); i++) {
                temp_key = json_object_get_name(temp_object, i);
                temp_value = json_object_get_value(temp_object, temp_key);
                temp_value_copy = json_value_deep_copy(temp_value);
                if (temp_value_copy == NULL) {
                    json_value_free(return_value);
                    return NULL;
                }
                if (json_object_add(temp_object_copy, temp_key, temp_value_copy) == JSONFailure) {
                    json_value_free(return_value);
                    json_value_free(temp_value_copy);
                    return NULL;
                }
            }
            return return_value;
        case JSONBoolean:
            return json_value_init_boolean(json_value_get_boolean(value));
        case JSONNumber:
            return json_value_init_number(json_value_get_number(value));
        case JSONString:
            temp_string = json_value_get_string(value);
            if (temp_string == NULL) {
                return NULL;
            }
            temp_string_copy = parson_strdup(temp_string);
            if (temp_string_copy == NULL) {
                return NULL;
            }
            return_value = json_value_init_string_no_copy(temp_string_copy);
            if (return_value == NULL) {
                parson_free(temp_string_copy);
            }
            return return_value;
        case JSONNull:
            return json_value_init_null();
        case JSONError:
            return NULL;
        default:
            return NULL;
    }
}

// Assembly:
testq %rdi, %rdi
je 0x4201
movl 0x8(%rdi), %eax
jmp 0x4206
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
decl %eax
cmpl $0x5, %eax
ja 0x44aa
leaq 0x3115(%rip), %rcx      # 0x7338
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x18, %edi
callq *0x5f59(%rip)           # 0xa190
testq %rax, %rax
je 0x44aa
movq %rax, %rbx
movq $0x0, (%rax)
movl $0x1, 0x8(%rax)
jmp 0x44ac
testq %rdi, %rdi
je 0x433d
cmpl $0x5, 0x8(%rdi)
jne 0x433d
movq 0x10(%rdi), %r12
jmp 0x4340
xorps %xmm0, %xmm0
testq %rdi, %rdi
je 0x4285
cmpl $0x3, 0x8(%rdi)
jne 0x4285
movsd 0x10(%rdi), %xmm0
movsd %xmm0, (%rsp)
movl $0x18, %edi
callq *0x5efb(%rip)           # 0xa190
testq %rax, %rax
je 0x44aa
movq %rax, %rbx
movq $0x0, (%rax)
movl $0x3, 0x8(%rax)
movsd (%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
jmp 0x44ac
testq %rdi, %rdi
je 0x435d
cmpl $0x4, 0x8(%rdi)
jne 0x435d
movq 0x10(%rdi), %r14
jmp 0x4360
testq %rdi, %rdi
je 0x4384
cmpl $0x2, 0x8(%rdi)
jne 0x4384
movq 0x10(%rdi), %rdi
jmp 0x4386
movl $0x1, %ebp
testq %rdi, %rdi
je 0x4310
cmpl $0x6, 0x8(%rdi)
jne 0x4310
xorl %ebp, %ebp
cmpl $0x0, 0x10(%rdi)
setne %bpl
movl $0x18, %edi
callq *0x5e75(%rip)           # 0xa190
testq %rax, %rax
je 0x44aa
movq %rax, %rbx
movq $0x0, (%rax)
movl $0x6, 0x8(%rax)
movl %ebp, 0x10(%rax)
jmp 0x44ac
xorl %r12d, %r12d
callq 0x3e75
testq %rax, %rax
je 0x44aa
movq %rax, %rbx
cmpl $0x5, 0x8(%rax)
jne 0x43ce
movq 0x10(%rbx), %r14
jmp 0x43d1
xorl %r14d, %r14d
callq 0x3e18
testq %rax, %rax
je 0x44aa
movq %rax, %rbx
cmpl $0x4, 0x8(%rax)
jne 0x4435
movq 0x10(%rbx), %r15
jmp 0x4438
xorl %edi, %edi
testq %rdi, %rdi
je 0x44aa
callq 0x37b6
testq %rax, %rax
je 0x44aa
movq %rax, %r14
movl $0x18, %edi
callq *0x5de5(%rip)           # 0xa190
testq %rax, %rax
je 0x44be
movq %rax, %rbx
movq $0x0, (%rax)
movl $0x2, 0x8(%rax)
movq %r14, 0x10(%rax)
jmp 0x44c0
xorl %r14d, %r14d
xorl %r13d, %r13d
testq %r12, %r12
je 0x43e0
movq 0x10(%r12), %rax
jmp 0x43e2
xorl %eax, %eax
cmpq %rax, %r13
jae 0x44ac
testq %r12, %r12
je 0x4402
cmpq %r13, 0x10(%r12)
jbe 0x4402
movq 0x8(%r12), %rax
movq (%rax,%r13,8), %rdi
jmp 0x4404
xorl %edi, %edi
callq 0x41f7
testq %rax, %rax
je 0x44a2
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x44d0
incq %r13
cmpl $-0x1, %eax
jne 0x43d4
movq %rbx, %rdi
callq 0x3d65
movq %r15, %rdi
jmp 0x44a5
xorl %r15d, %r15d
xorl %ebp, %ebp
testq %r14, %r14
je 0x4445
movq 0x18(%r14), %rax
jmp 0x4447
xorl %eax, %eax
cmpq %rax, %rbp
jae 0x44ac
testq %r14, %r14
je 0x4461
cmpq %rbp, 0x18(%r14)
jbe 0x4461
movq 0x8(%r14), %rax
movq (%rax,%rbp,8), %r12
jmp 0x4464
xorl %r12d, %r12d
movq %r14, %rdi
movq %r12, %rsi
callq 0x3936
movq %rax, %rdi
callq 0x41f7
testq %rax, %rax
je 0x44a2
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x4530
incq %rbp
cmpl $-0x1, %eax
jne 0x443a
movq %rbx, %rdi
callq 0x3d65
movq %r13, %rdi
jmp 0x44a5
movq %rbx, %rdi
callq 0x3d65
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
testq %rbx, %rbx
jne 0x44ac
movq %r14, %rdi
callq *0x5cba(%rip)           # 0xa188
jmp 0x44ac