// File: /workspace/github_c_makefile_star2_O3/Aethlas[P]fflz4/fflz4.c
// Function: print_tabs
void print_tabs(const cJSON *json, const unsigned int flag)
{
    const cJSON *active_title = NULL, *active_url = NULL;
    const cJSON *child = NULL;
    long lastAccessed = 0;

    cJSON_ArrayForEach(child, json) {
        const cJSON *tabs = cJSON_GetObjectItemCaseSensitive(child, "tabs");
        if (!cJSON_IsArray(tabs)) break;

        const cJSON *tab = NULL;
        cJSON_ArrayForEach(tab, tabs) {
            const cJSON *accessed = cJSON_GetObjectItemCaseSensitive(tab, "lastAccessed");
            const cJSON *index = cJSON_GetObjectItemCaseSensitive(tab, "index");
            const cJSON *entries = cJSON_GetObjectItemCaseSensitive(tab, "entries");
            if (!cJSON_IsArray(entries) || cJSON_IsNull(index)) break;

            const cJSON *entry = cJSON_GetArrayItem(entries, index->valueint-1);
            if (!cJSON_IsObject(entry)) break;

            const cJSON *title = cJSON_GetObjectItemCaseSensitive(entry, "title");
            const cJSON *url = cJSON_GetObjectItemCaseSensitive(entry, "url");

            if (!cJSON_IsNull(accessed)) {
                char *ac = cJSON_Print(accessed);
                long tmp = strtol(ac, NULL, 10);
                if (lastAccessed < tmp) {
                    lastAccessed = tmp;
                    active_title = cJSON_GetObjectItemCaseSensitive(entry, "title");
                    active_url = cJSON_GetObjectItemCaseSensitive(entry, "url");
                }
                free(ac);
            }

            if ((flag & (FLAG_T | FLAG_U)) == (FLAG_T | FLAG_U)) {
                if (cJSON_IsString(title) && cJSON_IsString(url))
                    fprintf(stdout, "%s\n%s\n\n", title->valuestring, url->valuestring);
            } else {
                if ((flag & FLAG_T) && !(flag & FLAG_C) && cJSON_IsString(title))
                    fprintf(stdout, "%s\n", title->valuestring);

                if ((flag & FLAG_U) && !(flag & FLAG_C) && cJSON_IsString(url))
                    fprintf(stdout, "%s\n", url->valuestring);
            }
        }
    }

    if (!cJSON_IsString(active_title) && !cJSON_IsString(active_url))
        return;

    if ((flag & (FLAG_C | FLAG_T)) == (FLAG_C | FLAG_T))
        fprintf(stdout, "%s\n", active_title->valuestring);
    else if ((flag & (FLAG_C | FLAG_U)) == (FLAG_C | FLAG_U))
        fprintf(stdout, "%s\n", active_url->valuestring);
    else if (flag & FLAG_C)
        fprintf(stdout, "%s\n%s\n", active_title->valuestring, active_url->valuestring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
testq %rdi, %rdi
movl %esi, 0x18(%rsp)
je 0xb88c
movq 0x10(%rdi), %r14
testq %r14, %r14
je 0xb88c
movl %esi, %r12d
andl $0x6, %r12d
movl %esi, %eax
andl $0xc, %eax
movl %eax, 0x24(%rsp)
andl $0xa, %esi
movl %esi, 0x20(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x28(%rsp)
movl %r12d, 0x1c(%rsp)
movq %r14, %rdi
leaq 0x6ae6(%rip), %rsi      # 0x12179
callq 0xf9f9
movq %rax, %rbx
movq %rax, %rdi
callq 0x10c42
testl %eax, %eax
je 0xb89e
movq %r14, 0x30(%rsp)
testq %rbx, %rbx
je 0xb879
movq 0x10(%rbx), %rbp
testq %rbp, %rbp
je 0xb879
movq %rbp, %rdi
leaq 0x6aae(%rip), %rsi      # 0x1217e
callq 0xf9f9
movq %rax, %r15
movq %rbp, %rdi
leaq 0x6aa9(%rip), %rsi      # 0x1218b
callq 0xf9f9
movq %rax, %rbx
movq %rbp, %rdi
leaq 0x6a9d(%rip), %rsi      # 0x12191
callq 0xf9f9
movq %rax, %r14
movq %rax, %rdi
callq 0x10c42
testl %eax, %eax
je 0xb879
movq %rbx, %rdi
callq 0x10c24
testl %eax, %eax
jne 0xb879
movl 0x28(%rbx), %esi
decl %esi
movq %r14, %rdi
callq 0xf8f9
movq %rax, %r14
movq %rax, %rdi
callq 0x10c51
testl %eax, %eax
je 0xb879
movq %r14, %rdi
leaq 0x6a53(%rip), %rsi      # 0x12199
callq 0xf9f9
movq %rax, %r13
movq %r14, %rdi
leaq 0x6a47(%rip), %rsi      # 0x1219f
callq 0xf9f9
movq %rax, %rbx
movq %r15, %rdi
callq 0x10c24
testl %eax, %eax
jne 0xb7ca
movq %r15, %rdi
callq 0xf1fd
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x1130
cmpq %rax, 0x28(%rsp)
jge 0xb7bd
movq %rax, %r12
movq %r14, %rdi
leaq 0x69ff(%rip), %rsi      # 0x12199
callq 0xf9f9
movq %rax, 0x10(%rsp)
movq %r14, %rdi
leaq 0x69f1(%rip), %rsi      # 0x1219f
callq 0xf9f9
movq %rax, 0x8(%rsp)
movq %r12, 0x28(%rsp)
movq %r15, %rdi
callq 0x1230
movl 0x1c(%rsp), %r12d
cmpl $0x6, %r12d
jne 0xb812
movq %r13, %rdi
callq 0xebb2
testl %eax, %eax
je 0xb870
movq %rbx, %rdi
callq 0xebb2
testl %eax, %eax
je 0xb870
movq 0xa7c1(%rip), %rax      # 0x15fb8
movq (%rax), %rdi
movq 0x20(%r13), %rdx
movq 0x20(%rbx), %rcx
leaq 0x699a(%rip), %rsi      # 0x121a3
xorl %eax, %eax
callq 0x1100
jmp 0xb870
cmpl $0x4, 0x24(%rsp)
jne 0xb841
movq %r13, %rdi
callq 0xebb2
testl %eax, %eax
je 0xb841
movq 0xa78c(%rip), %rax      # 0x15fb8
movq (%rax), %rdi
movq 0x20(%r13), %rdx
leaq 0x6974(%rip), %rsi      # 0x121ae
xorl %eax, %eax
callq 0x1100
cmpl $0x2, 0x20(%rsp)
jne 0xb870
movq %rbx, %rdi
callq 0xebb2
testl %eax, %eax
je 0xb870
movq 0xa75d(%rip), %rax      # 0x15fb8
movq (%rax), %rdi
movq 0x20(%rbx), %rdx
leaq 0x6945(%rip), %rsi      # 0x121ae
xorl %eax, %eax
callq 0x1100
movq (%rbp), %rbp
jmp 0xb6bd
movq 0x30(%rsp), %r14
movq (%r14), %r14
testq %r14, %r14
jne 0xb689
jmp 0xb89e
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xebb2
testl %eax, %eax
jne 0xb8bd
movq 0x8(%rsp), %rdi
callq 0xebb2
testl %eax, %eax
je 0xb911
movl 0x18(%rsp), %ecx
movl %ecx, %eax
notl %eax
testb $0xc, %al
jne 0xb8d9
movq 0xa6e8(%rip), %rax      # 0x15fb8
movq (%rax), %rdi
movq 0x20(%rbx), %rdx
jmp 0xb8f0
testb $0xa, %al
jne 0xb90c
movq 0xa6d4(%rip), %rax      # 0x15fb8
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdx
leaq 0x68b7(%rip), %rsi      # 0x121ae
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1100
testb $0x8, %cl
jne 0xb920
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa691(%rip), %rax      # 0x15fb8
movq (%rax), %rdi
movq 0x20(%rbx), %rdx
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rcx
leaq 0x686d(%rip), %rsi      # 0x121ab
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1100