// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movl %esi, 0x8c(%rsp)
movq $0x0, 0x80(%rsp)
movq $0x0, 0x78(%rsp)
movq $0x0, 0x70(%rsp)
movq $0x0, 0x68(%rsp)
cmpq $0x0, 0x90(%rsp)
je 0x21eb
movq 0x90(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x21f4
xorl %eax, %eax
movq %rax, 0x10(%rsp)
jmp 0x21f4
movq 0x10(%rsp), %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x24da
movq 0x70(%rsp), %rdi
leaq 0x4b048(%rip), %rsi     # 0x4d25e
callq 0x48660
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rdi
callq 0x4a3d0
cmpl $0x0, %eax
jne 0x2234
jmp 0x24da
movq $0x0, 0x58(%rsp)
cmpq $0x0, 0x60(%rsp)
je 0x2255
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x225e
xorl %eax, %eax
movq %rax, 0x8(%rsp)
jmp 0x225e
movq 0x8(%rsp), %rax
movq %rax, 0x58(%rsp)
cmpq $0x0, 0x58(%rsp)
je 0x24c6
movq 0x58(%rsp), %rdi
leaq 0x4afe3(%rip), %rsi     # 0x4d263
callq 0x48660
movq %rax, 0x50(%rsp)
movq 0x58(%rsp), %rdi
leaq 0x4afda(%rip), %rsi     # 0x4d270
callq 0x48660
movq %rax, 0x48(%rsp)
movq 0x58(%rsp), %rdi
leaq 0x4afca(%rip), %rsi     # 0x4d276
callq 0x48660
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
callq 0x4a3d0
cmpl $0x0, %eax
je 0x22d4
movq 0x48(%rsp), %rdi
callq 0x4a350
cmpl $0x0, %eax
je 0x22d9
jmp 0x24c6
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rax
movl 0x28(%rax), %esi
subl $0x1, %esi
callq 0x48430
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
callq 0x4a410
cmpl $0x0, %eax
jne 0x2307
jmp 0x24c6
movq 0x38(%rsp), %rdi
leaq 0x4af6b(%rip), %rsi     # 0x4d27e
callq 0x48660
movq %rax, 0x30(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x4af5b(%rip), %rsi     # 0x4d284
callq 0x48660
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rdi
callq 0x4a350
cmpl $0x0, %eax
jne 0x23b8
movq 0x50(%rsp), %rdi
callq 0x47d90
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1130
movq %rax, 0x18(%rsp)
movq 0x68(%rsp), %rax
cmpq 0x18(%rsp), %rax
jge 0x23ae
movq 0x18(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x4aef3(%rip), %rsi     # 0x4d27e
callq 0x48660
movq %rax, 0x80(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x4aee0(%rip), %rsi     # 0x4d284
callq 0x48660
movq %rax, 0x78(%rsp)
movq 0x20(%rsp), %rdi
callq 0x1220
movl 0x8c(%rsp), %eax
andl $0x6, %eax
cmpl $0x6, %eax
jne 0x2414
movq 0x30(%rsp), %rdi
callq 0x47450
cmpl $0x0, %eax
je 0x240f
movq 0x28(%rsp), %rdi
callq 0x47450
cmpl $0x0, %eax
je 0x240f
movq 0x4ebcc(%rip), %rax     # 0x50fb8
movq (%rax), %rdi
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rcx
leaq 0x4ae80(%rip), %rsi     # 0x4d288
movb $0x0, %al
callq 0x1100
jmp 0x24b2
movl 0x8c(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x2462
movl 0x8c(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x2462
movq 0x30(%rsp), %rdi
callq 0x47450
cmpl $0x0, %eax
je 0x2462
movq 0x4eb70(%rip), %rax     # 0x50fb8
movq (%rax), %rdi
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rdx
leaq 0x4ae38(%rip), %rsi     # 0x4d293
movb $0x0, %al
callq 0x1100
movl 0x8c(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x24b0
movl 0x8c(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x24b0
movq 0x28(%rsp), %rdi
callq 0x47450
cmpl $0x0, %eax
je 0x24b0
movq 0x4eb22(%rip), %rax     # 0x50fb8
movq (%rax), %rdi
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rdx
leaq 0x4adea(%rip), %rsi     # 0x4d293
movb $0x0, %al
callq 0x1100
jmp 0x24b2
jmp 0x24b4
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x58(%rsp)
jmp 0x2268
jmp 0x24c8
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x70(%rsp)
jmp 0x21fe
movq 0x80(%rsp), %rdi
callq 0x47450
cmpl $0x0, %eax
jne 0x2500
movq 0x78(%rsp), %rdi
callq 0x47450
cmpl $0x0, %eax
jne 0x2500
jmp 0x25a7
movl 0x8c(%rsp), %eax
andl $0xc, %eax
cmpl $0xc, %eax
jne 0x2535
movq 0x4eaa2(%rip), %rax     # 0x50fb8
movq (%rax), %rdi
movq 0x80(%rsp), %rax
movq 0x20(%rax), %rdx
leaq 0x4ad67(%rip), %rsi     # 0x4d293
movb $0x0, %al
callq 0x1100
jmp 0x25a7
movl 0x8c(%rsp), %eax
andl $0xa, %eax
cmpl $0xa, %eax
jne 0x2567
movq 0x4ea6d(%rip), %rax     # 0x50fb8
movq (%rax), %rdi
movq 0x78(%rsp), %rax
movq 0x20(%rax), %rdx
leaq 0x4ad35(%rip), %rsi     # 0x4d293
movb $0x0, %al
callq 0x1100
jmp 0x25a5
movl 0x8c(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x25a3
movq 0x4ea3b(%rip), %rax     # 0x50fb8
movq (%rax), %rdi
movq 0x80(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x78(%rsp), %rax
movq 0x20(%rax), %rcx
leaq 0x4acf4(%rip), %rsi     # 0x4d290
movb $0x0, %al
callq 0x1100
jmp 0x25a5
jmp 0x25a7
addq $0x98, %rsp
retq
nop