// File: /workspace/github_c_makefile_star2_O0/ammarfaizi2[P]riyuu/src/third_party/cjson/cJSON_Utils.c
// Function: compose_patch(cJSON*, unsigned char const*, unsigned char const*, unsigned char const*, cJSON const*)
static void compose_patch(cJSON * const patches, const unsigned char * const operation, const unsigned char * const path, const unsigned char *suffix, const cJSON * const value)
{
    cJSON *patch = NULL;

    if ((patches == NULL) || (operation == NULL) || (path == NULL))
    {
        return;
    }

    patch = cJSON_CreateObject();
    if (patch == NULL)
    {
        return;
    }
    cJSON_AddItemToObject(patch, "op", cJSON_CreateString((const char*)operation));

    if (suffix == NULL)
    {
        cJSON_AddItemToObject(patch, "path", cJSON_CreateString((const char*)path));
    }
    else
    {
        size_t suffix_length = pointer_encoded_length(suffix);
        size_t path_length = strlen((const char*)path);
        unsigned char *full_path = (unsigned char*)cJSON_malloc(path_length + suffix_length + sizeof("/"));

        sprintf((char*)full_path, "%s/", (const char*)path);
        encode_string_as_pointer(full_path + path_length + 1, suffix);

        cJSON_AddItemToObject(patch, "path", cJSON_CreateString((const char*)full_path));
        cJSON_free(full_path);
    }

    if (value != NULL)
    {
        cJSON_AddItemToObject(patch, "value", cJSON_Duplicate(value, 1));
    }
    cJSON_AddItemToArray(patches, patch);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x8a99
cmpq $0x0, -0x10(%rbp)
je 0x8a99
cmpq $0x0, -0x18(%rbp)
jne 0x8a9e
jmp 0x8bcb
callq 0x4bb0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x8ab3
jmp 0x8bcb
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x49e0
movq -0x50(%rbp), %rdi
movq %rax, %rdx
leaq 0x387f(%rip), %rsi      # 0xc351
callq 0x42e0
cmpq $0x0, -0x20(%rbp)
jne 0x8b07
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
callq 0x49e0
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq 0x3842(%rip), %rsi      # 0xc33f
callq 0x42e0
jmp 0x8b8e
movq -0x20(%rbp), %rdi
callq 0x8090
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2160
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
addq -0x38(%rbp), %rdi
addq $0x2, %rdi
callq 0x6200
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x382c(%rip), %rsi      # 0xc371
movb $0x0, %al
callq 0x22f0
movq -0x48(%rbp), %rdi
addq -0x40(%rbp), %rdi
addq $0x1, %rdi
movq -0x20(%rbp), %rsi
callq 0x8100
movq -0x30(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rdi
callq 0x49e0
movq -0x60(%rbp), %rdi
movq %rax, %rdx
leaq 0x37bf(%rip), %rsi      # 0xc33f
callq 0x42e0
movq -0x48(%rbp), %rdi
callq 0x6220
cmpq $0x0, -0x28(%rbp)
je 0x8bbe
movq -0x30(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0x5770
movq -0x68(%rbp), %rdi
movq %rax, %rdx
leaq 0x378b(%rip), %rsi      # 0xc344
callq 0x42e0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x4220
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)