// File: /workspace/github_c_makefile_star2_O0/Aethlas[P]fflz4/fflz4.c
// Function: get_firefox_profile
char *get_firefox_profile(void)
{
    char *home = NULL, *source = NULL, *result_path = NULL;
    char path[4096] = {0}, profile[256] = {0};
    size_t SIZE = 0;
    int len = 0;

    home = getenv("HOME");
    if (!home) FAILED(0, "Get $HOME failed\n");

    sprintf(path, "%s/.mozilla/firefox/profiles.ini", home);
    source = get_file_content(path, "r", 0, &SIZE);

    /* get firefox profile */
    for (const char *tok = strtok(source, "\n"); tok && *tok; tok = strtok(NULL, "\n")) {
        if (strstr(tok, "Path")) {
            char *r = strstr(tok, "=");
            size_t pos = r-tok+1, len = strlen(tok);
            size_t j = 0;
            for (size_t i = pos; i < len; ++i) {
                profile[j++] = tok[i];
            }
            profile[j] = '\0';
            break;
        }
    }

    if (strlen(profile))
        len = asprintf(&result_path, "%s/.mozilla/firefox/%s/", home, profile);

    if (!len) FAILED(0, "Get profile path failed\n");

    free(source);
    return result_path;
}

// Assembly:
subq $0x1168, %rsp           # imm = 0x1168
movq $0x0, 0x1160(%rsp)
movq $0x0, 0x1158(%rsp)
movq $0x0, 0x1150(%rsp)
leaq 0x150(%rsp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x10c0
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x10c0
movq $0x0, 0x48(%rsp)
movl $0x0, 0x44(%rsp)
leaq 0x4bb3f(%rip), %rdi     # 0x4d137
callq 0x1030
movq %rax, 0x1160(%rsp)
cmpq $0x0, 0x1160(%rsp)
jne 0x1634
jmp 0x1612
movq 0x4f9df(%rip), %rax     # 0x50ff8
movq (%rax), %rdi
leaq 0x4bb19(%rip), %rsi     # 0x4d13c
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x11f0
leaq 0x150(%rsp), %rdi
movq 0x1160(%rsp), %rdx
leaq 0x4bb03(%rip), %rsi     # 0x4d14e
movb $0x0, %al
callq 0x11e0
leaq 0x150(%rsp), %rdi
leaq 0x4bc50(%rip), %rsi     # 0x4d2b1
xorl %eax, %eax
movl %eax, %edx
leaq 0x48(%rsp), %rcx
callq 0x2020
movq %rax, 0x1158(%rsp)
movq 0x1158(%rsp), %rdi
leaq 0x4bc08(%rip), %rsi     # 0x4d28e
callq 0x11c0
movq %rax, 0x38(%rsp)
xorl %eax, %eax
cmpq $0x0, 0x38(%rsp)
movb %al, 0xf(%rsp)
je 0x16b0
movq 0x38(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x16bd
jmp 0x178c
movq 0x38(%rsp), %rdi
leaq 0x4baa6(%rip), %rsi     # 0x4d16f
callq 0x1210
cmpq $0x0, %rax
je 0x1770
movq 0x38(%rsp), %rdi
leaq 0x4ba90(%rip), %rsi     # 0x4d174
callq 0x1210
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rcx, %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
movq 0x38(%rsp), %rdi
callq 0x10a0
movq %rax, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
cmpq 0x20(%rsp), %rax
jae 0x1764
movq 0x38(%rsp), %rax
movq 0x10(%rsp), %rcx
movb (%rax,%rcx), %cl
movq 0x18(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x18(%rsp)
movb %cl, 0x50(%rsp,%rax)
movq 0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x1726
movq 0x18(%rsp), %rax
movb $0x0, 0x50(%rsp,%rax)
jmp 0x178c
jmp 0x1772
xorl %eax, %eax
movl %eax, %edi
leaq 0x4bb11(%rip), %rsi     # 0x4d28e
callq 0x11c0
movq %rax, 0x38(%rsp)
jmp 0x1690
leaq 0x50(%rsp), %rdi
callq 0x10a0
cmpq $0x0, %rax
je 0x17c3
movq 0x1160(%rsp), %rdx
leaq 0x50(%rsp), %rcx
leaq 0x1150(%rsp), %rdi
leaq 0x4b9be(%rip), %rsi     # 0x4d176
movb $0x0, %al
callq 0x1190
movl %eax, 0x44(%rsp)
cmpl $0x0, 0x44(%rsp)
jne 0x17ee
jmp 0x17cc
movq 0x4f825(%rip), %rax     # 0x50ff8
movq (%rax), %rdi
leaq 0x4b9b1(%rip), %rsi     # 0x4d18e
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x11f0
movq 0x1158(%rsp), %rdi
callq 0x1220
movq 0x1150(%rsp), %rax
addq $0x1168, %rsp           # imm = 0x1168
retq
nopl (%rax,%rax)