// File: /workspace/github_c_makefile_star2_O0/Aethlas[P]fflz4/fflz4.c
// Function: get_bookmarks
void get_bookmarks(const char *path, const unsigned int flag)
{
    cJSON *json = NULL;
    char *result = NULL;

    result = extract_jsonlz4(path);
    if (!result) FAILED(0, "Failed to read jsonlz4 at: %s\n", path);

    json = cJSON_Parse(result);
    if (!json) goto cleanup;

    if (flag & FLAG_D) {
        char *js = cJSON_Print(json);
        fprintf(stdout, "%s\n", js);
        free(js);
        goto cleanup;
    }

    const cJSON *children = cJSON_GetObjectItemCaseSensitive(json, "children");
    if (!cJSON_IsArray(children)) goto cleanup;

    const cJSON *child = NULL;

    /* get bookmarks toolbar */
    cJSON_ArrayForEach(child, children) {
        const cJSON *root = cJSON_GetObjectItemCaseSensitive(child, "root");
        if (cJSON_IsString(root)) {
            if (!strcmp(root->valuestring, "toolbarFolder")) {
                children = cJSON_GetObjectItemCaseSensitive(child, "children");
                break;
            }
        }
    }

    if (cJSON_IsArray(children))
        print_bookmarks(child, children, flag);
    else
        FAILED(0, "Failed to get bookmarks toolbar\n");

cleanup:
    if (json) cJSON_Delete(json);
    free(result);
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movl %esi, 0x3c(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x40(%rsp), %rdi
callq 0x1ee0
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0x1cdf
jmp 0x1cb8
movq 0x4f339(%rip), %rax     # 0x50ff8
movq (%rax), %rdi
movq 0x40(%rsp), %rdx
leaq 0x4b569(%rip), %rsi     # 0x4d237
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x11f0
movq 0x28(%rsp), %rdi
callq 0x47d70
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x1cfb
jmp 0x1e59
movl 0x3c(%rsp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x1d42
movq 0x30(%rsp), %rdi
callq 0x47d90
movq %rax, 0x20(%rsp)
movq 0x4f29b(%rip), %rax     # 0x50fb8
movq (%rax), %rdi
movq 0x20(%rsp), %rdx
leaq 0x4b567(%rip), %rsi     # 0x4d293
movb $0x0, %al
callq 0x1100
movq 0x20(%rsp), %rdi
callq 0x1220
jmp 0x1e59
movq 0x30(%rsp), %rdi
leaq 0x4b549(%rip), %rsi     # 0x4d297
callq 0x48660
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
callq 0x4a3d0
cmpl $0x0, %eax
jne 0x1d6c
jmp 0x1e59
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x1d8c
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, (%rsp)
jmp 0x1d94
xorl %eax, %eax
movq %rax, (%rsp)
jmp 0x1d94
movq (%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x1e0f
movq 0x10(%rsp), %rdi
leaq 0x4b4ef(%rip), %rsi     # 0x4d2a0
callq 0x48660
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
callq 0x47450
cmpl $0x0, %eax
je 0x1dfe
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdi
leaq 0x4b4cb(%rip), %rsi     # 0x4d2a5
callq 0x10f0
cmpl $0x0, %eax
jne 0x1dfc
movq 0x10(%rsp), %rdi
leaq 0x4b4a7(%rip), %rsi     # 0x4d297
callq 0x48660
movq %rax, 0x18(%rsp)
jmp 0x1e0f
jmp 0x1dfe
jmp 0x1e00
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x1d9d
movq 0x18(%rsp), %rdi
callq 0x4a3d0
cmpl $0x0, %eax
je 0x1e33
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0x3c(%rsp), %edx
callq 0x25b0
jmp 0x1e57
jmp 0x1e35
movq 0x4f1bc(%rip), %rax     # 0x50ff8
movq (%rax), %rdi
leaq 0x4b46d(%rip), %rsi     # 0x4d2b3
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x11f0
jmp 0x1e59
cmpq $0x0, 0x30(%rsp)
je 0x1e6b
movq 0x30(%rsp), %rdi
callq 0x47590
movq 0x28(%rsp), %rdi
callq 0x1220
addq $0x48, %rsp
retq
nopw (%rax,%rax)