// File: /workspace/github_c_makefile_star2_O0/Aethlas[P]fflz4/fflz4.c
// Function: get_bookmark_file
char *get_bookmark_file(const char *path)
{
    char *buf = NULL, *result = NULL, *p = NULL;
    int len = 0;
    char filep[4096] = {0};
    time_t t1 = 0, t2 = -1;
    struct dirent *entry;
    DIR *dp;

    len = path[strlen(path)-1] == '/'? asprintf(&buf, "%s%s/", path, BOOKMARK) : asprintf(&buf, "%s/%s/", path, BOOKMARK);
    if (!len) FAILED(0, "Not enough memory\n");

    dp = opendir(buf);
    if (!dp) FAILED(0, "Open directory failed at: %s\n", buf);

    while ((entry = readdir(dp))) {
        if (strstr(entry->d_name, "bookmarks")) {
            sprintf(filep, "%s%s", buf, entry->d_name);
            t1 = get_last_modified(filep);
            if (t2 == -1) {
                t2 = t1;
                p = filep;
            }
            else if (t1 > t2) {
                t2 = t1;
                p = filep;
            }
        }
    }

    result = strdup(p);
    if (!result) FAILED(0, "Get bookmark file failed\n");

    closedir(dp);
    free(buf);
    return result;
}

// Assembly:
subq $0x1058, %rsp           # imm = 0x1058
movq %rdi, 0x1050(%rsp)
movq $0x0, 0x1048(%rsp)
movq $0x0, 0x1040(%rsp)
movq $0x0, 0x1038(%rsp)
movl $0x0, 0x1034(%rsp)
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x10c0
movq $0x0, 0x28(%rsp)
movq $-0x1, 0x20(%rsp)
movq 0x1050(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x1050(%rsp), %rdi
callq 0x10a0
movq %rax, %rcx
movq 0x8(%rsp), %rax
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
jne 0x1aab
movq 0x1050(%rsp), %rdx
movq 0x4f691(%rip), %rcx     # 0x51120
leaq 0x1048(%rsp), %rdi
leaq 0x4b709(%rip), %rsi     # 0x4d1a7
movb $0x0, %al
callq 0x1190
movl %eax, 0x4(%rsp)
jmp 0x1ad4
movq 0x1050(%rsp), %rdx
movq 0x4f666(%rip), %rcx     # 0x51120
leaq 0x1048(%rsp), %rdi
leaq 0x4b6e4(%rip), %rsi     # 0x4d1ad
movb $0x0, %al
callq 0x1190
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x1034(%rsp)
cmpl $0x0, 0x1034(%rsp)
jne 0x1b0d
jmp 0x1aeb
movq 0x4f506(%rip), %rax     # 0x50ff8
movq (%rax), %rdi
leaq 0x4b60e(%rip), %rsi     # 0x4d10a
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x11f0
movq 0x1048(%rsp), %rdi
callq 0x1090
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x1b53
jmp 0x1b29
movq 0x4f4c8(%rip), %rax     # 0x50ff8
movq (%rax), %rdi
movq 0x1048(%rsp), %rdx
leaq 0x4b672(%rip), %rsi     # 0x4d1b4
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x11f0
jmp 0x1b55
movq 0x10(%rsp), %rdi
callq 0x1150
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0x1c09
movq 0x18(%rsp), %rdi
addq $0x13, %rdi
leaq 0x4b654(%rip), %rsi     # 0x4d1d2
callq 0x1210
cmpq $0x0, %rax
je 0x1c04
leaq 0x30(%rsp), %rdi
movq 0x1048(%rsp), %rdx
movq 0x18(%rsp), %rcx
addq $0x13, %rcx
leaq 0x4b636(%rip), %rsi     # 0x4d1dc
movb $0x0, %al
callq 0x11e0
leaq 0x30(%rsp), %rdi
callq 0x1e80
movq %rax, 0x28(%rsp)
cmpq $-0x1, 0x20(%rsp)
jne 0x1bdd
movq 0x28(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x1038(%rsp)
jmp 0x1c02
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
jle 0x1c00
movq 0x28(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x1038(%rsp)
jmp 0x1c02
jmp 0x1c04
jmp 0x1b55
movq 0x1038(%rsp), %rdi
callq 0x1200
movq %rax, 0x1040(%rsp)
cmpq $0x0, 0x1040(%rsp)
jne 0x1c4d
jmp 0x1c2b
movq 0x4f3c6(%rip), %rax     # 0x50ff8
movq (%rax), %rdi
leaq 0x4b5a5(%rip), %rsi     # 0x4d1e1
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x11f0
movq 0x10(%rsp), %rdi
callq 0x10d0
movq 0x1048(%rsp), %rdi
callq 0x1220
movq 0x1040(%rsp), %rax
addq $0x1058, %rsp           # imm = 0x1058
retq
nopw %cs:(%rax,%rax)