// File: /workspace/github_c_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4297
movl 0x8(%rdi), %eax
decl %eax
cmpl $0x5, %eax
ja 0x4297
leaq 0x32a4(%rip), %rcx      # 0x7328
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x18, %edi
callq *0x60f0(%rip)           # 0xa188
testq %rax, %rax
je 0x4297
movq %rax, %rbx
movq $0x0, (%rax)
movl $0x1, 0x8(%rax)
jmp 0x4299
movq 0x10(%rdi), %r12
callq 0x3d61
testq %rax, %rax
je 0x4297
movq %rax, %rbx
cmpl $0x5, 0x8(%rax)
jne 0x41c8
movq 0x10(%rbx), %r14
jmp 0x41cb
movsd 0x10(%rdi), %xmm0
movsd %xmm0, (%rsp)
movl $0x18, %edi
callq *0x6094(%rip)           # 0xa188
testq %rax, %rax
je 0x4297
movq %rax, %rbx
movq $0x0, (%rax)
movl $0x3, 0x8(%rax)
movsd (%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
jmp 0x4299
movq 0x10(%rdi), %r14
callq 0x3d03
testq %rax, %rax
je 0x4297
movq %rax, %rbx
cmpl $0x4, 0x8(%rax)
jne 0x4218
movq 0x10(%rbx), %r15
jmp 0x421b
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x4297
callq 0x36dc
testq %rax, %rax
je 0x4297
movq %rax, %r14
movl $0x18, %edi
callq *0x601a(%rip)           # 0xa188
testq %rax, %rax
je 0x426f
movq %rax, %rbx
movq $0x0, (%rax)
movl $0x2, 0x8(%rax)
movq %r14, 0x10(%rax)
jmp 0x4299
movl 0x10(%rdi), %ebp
movl $0x18, %edi
callq *0x5fe9(%rip)           # 0xa188
testq %rax, %rax
je 0x4297
movq %rax, %rbx
xorl %eax, %eax
testl %ebp, %ebp
setne %al
movq $0x0, (%rbx)
movl $0x6, 0x8(%rbx)
movl %eax, 0x10(%rbx)
jmp 0x4299
xorl %r14d, %r14d
testq %r12, %r12
je 0x4299
cmpq $0x0, 0x10(%r12)
je 0x4299
xorl %r13d, %r13d
movq 0x8(%r12), %rax
movq (%rax,%r13,8), %rdi
callq 0x405b
testq %rax, %rax
je 0x426a
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x42ab
cmpl $-0x1, %eax
je 0x427a
incq %r13
cmpq 0x10(%r12), %r13
jb 0x41e3
jmp 0x4299
xorl %r15d, %r15d
testq %r14, %r14
je 0x4299
cmpq $0x0, 0x18(%r14)
je 0x4299
xorl %ebp, %ebp
movq 0x8(%r14), %rax
movq (%rax,%rbp,8), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x3826
movq %rax, %rdi
callq 0x405b
testq %rax, %rax
je 0x426a
movq %rax, %r12
movq %r15, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x430f
cmpl $-0x1, %eax
je 0x4287
incq %rbp
cmpq 0x18(%r14), %rbp
jb 0x4229
jmp 0x4299
movq %rbx, %rdi
jmp 0x4292
movq %r14, %rdi
callq *0x5f08(%rip)           # 0xa180
jmp 0x4297
movq %rbx, %rdi
callq 0x3c53
movq %r15, %rdi
jmp 0x4292
movq %rbx, %rdi
callq 0x3c53
movq %r12, %rdi
callq 0x3c53
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq