// File: /workspace/github_c_makefile_star2_O1/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
je 0x4084
movq 0x10(%rdi), %r12
jmp 0x4087
xorl %r12d, %r12d
testq %r12, %r12
movl %esi, 0x14(%rsp)
je 0x42e1
movl %esi, %ebp
andl $0x6, %ebp
movl %esi, %eax
andl $0xc, %eax
movl %eax, 0x20(%rsp)
andl $0xa, %esi
movl %esi, 0x1c(%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, (%rsp)
movq $0x0, 0x28(%rsp)
movl %ebp, 0x18(%rsp)
movq %r12, %rdi
leaq 0x100a8(%rip), %rsi     # 0x14179
callq 0x11458
movq %rax, %rbx
movq %rax, %rdi
callq 0x126e9
testl %eax, %eax
movl %eax, 0x24(%rsp)
je 0x42cb
testq %rbx, %rbx
je 0x40f8
movq 0x10(%rbx), %r13
jmp 0x40fb
xorl %r13d, %r13d
testq %r13, %r13
je 0x42cb
movq %r13, %rdi
leaq 0x10070(%rip), %rsi     # 0x1417e
callq 0x11458
movq %rax, %rbx
movq %r13, %rdi
leaq 0x1006b(%rip), %rsi     # 0x1418b
callq 0x11458
movq %rax, %r14
movq %r13, %rdi
leaq 0x1005f(%rip), %rsi     # 0x14191
callq 0x11458
movq %rax, %r15
movq %rax, %rdi
callq 0x126e9
testl %eax, %eax
je 0x4152
movq %r14, %rdi
callq 0x126cb
testl %eax, %eax
je 0x4162
xorl %ebx, %ebx
testb %bl, %bl
je 0x42cb
movq (%r13), %r13
jmp 0x40fb
movl 0x28(%r14), %esi
decl %esi
movq %r15, %rdi
callq 0x1136f
movq %rax, %r14
movq %rax, %rdi
callq 0x126f8
testl %eax, %eax
je 0x4152
movq %r14, %rdi
leaq 0x10010(%rip), %rsi     # 0x14199
callq 0x11458
movq %rax, 0x30(%rsp)
movq %r14, %rdi
leaq 0x10002(%rip), %rsi     # 0x1419f
callq 0x11458
movq %rax, %r15
movq %rbx, %rdi
callq 0x126cb
testl %eax, %eax
jne 0x420d
movq %rbx, %rdi
callq 0x10c50
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x1130
cmpq %rax, 0x28(%rsp)
jge 0x4201
movq %rax, %rbp
movq %r14, %rdi
leaq 0xffba(%rip), %rsi      # 0x14199
callq 0x11458
movq %rax, 0x8(%rsp)
movq %r14, %rdi
leaq 0xffac(%rip), %rsi      # 0x1419f
callq 0x11458
movq %rax, (%rsp)
movq %rbp, 0x28(%rsp)
movq %rbx, %rdi
callq 0x1230
movl 0x18(%rsp), %ebp
cmpl $0x6, %ebp
movq 0x30(%rsp), %r14
jne 0x425e
movq %r14, %rdi
callq 0x1056e
movb $0x1, %bl
testl %eax, %eax
je 0x4154
movq %r15, %rdi
callq 0x1056e
testl %eax, %eax
je 0x4154
movq 0x13d78(%rip), %rax     # 0x17fb8
movq (%rax), %rdi
movq 0x20(%r14), %rdx
movq 0x20(%r15), %rcx
leaq 0xff51(%rip), %rsi      # 0x141a3
xorl %eax, %eax
callq 0x1100
jmp 0x4154
cmpl $0x4, 0x20(%rsp)
jne 0x428d
movq %r14, %rdi
callq 0x1056e
testl %eax, %eax
je 0x428d
movq 0x13d40(%rip), %rax     # 0x17fb8
movq (%rax), %rdi
movq 0x20(%r14), %rdx
leaq 0xff28(%rip), %rsi      # 0x141ae
xorl %eax, %eax
callq 0x1100
movb $0x1, %bl
cmpl $0x2, 0x1c(%rsp)
jne 0x4154
movq %r15, %rdi
callq 0x1056e
testl %eax, %eax
je 0x4154
movq 0x13d07(%rip), %rax     # 0x17fb8
movq (%rax), %rdi
movq 0x20(%r15), %rdx
leaq 0xfeef(%rip), %rsi      # 0x141ae
xorl %eax, %eax
callq 0x1100
jmp 0x4154
cmpl $0x0, 0x24(%rsp)
je 0x42f2
movq (%r12), %r12
testq %r12, %r12
jne 0x40c7
jmp 0x42f2
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1056e
testl %eax, %eax
jne 0x4310
movq (%rsp), %rdi
callq 0x1056e
testl %eax, %eax
je 0x4363
movl 0x14(%rsp), %ecx
movl %ecx, %eax
notl %eax
testb $0xc, %al
jne 0x432c
movq 0x13c95(%rip), %rax     # 0x17fb8
movq (%rax), %rdi
movq 0x20(%rbx), %rdx
jmp 0x4342
testb $0xa, %al
jne 0x435e
movq 0x13c81(%rip), %rax     # 0x17fb8
movq (%rax), %rdi
movq (%rsp), %rax
movq 0x20(%rax), %rdx
leaq 0xfe65(%rip), %rsi      # 0x141ae
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1100
testb $0x8, %cl
jne 0x4372
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x13c3f(%rip), %rax     # 0x17fb8
movq (%rax), %rdi
movq 0x20(%rbx), %rdx
movq (%rsp), %rax
movq 0x20(%rax), %rcx
leaq 0xfe1c(%rip), %rsi      # 0x141ab
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1100