// File: /workspace/github_c_makefile_star2_O3/Cotix[P]cReddit/libreddit/link.c
// Function: redditGetListing
EXPORT_SYMBOL RedditErrno redditGetListing (RedditLinkList *list)
{
    char subred[1024], *kindStr = NULL;
    TokenParserResult res;

    TokenIdent ids[] = {
        ADD_TOKEN_IDENT_STRING("modhash", list->modhash),
        ADD_TOKEN_IDENT_STRING("kind",    kindStr),
        ADD_TOKEN_IDENT_FUNC  ("data",    getListingHelper),
        ADD_TOKEN_IDENT_STRING("after",   list->afterId),
        {0}
    };

    strcpy(subred, REDDIT_URL);
    if (list->subreddit != NULL)
        strcat(subred, list->subreddit);

    if (list->type == REDDIT_NEW)
        strcat(subred, REDDIT_SUB_NEW);
    else if (list->type == REDDIT_RISING)
        strcat(subred, REDDIT_SUB_RISING);
    else if (list->type == REDDIT_CONTR)
        strcat(subred, REDDIT_SUB_CONTROVERSIAL);
    else if (list->type == REDDIT_TOP)
        strcat(subred, REDDIT_SUB_TOP);

    strcat(subred, REDDIT_JSON);

    if (list->linkCount > 0)
        sprintf(subred + strlen(subred), "?after=%s", list->afterId);

    res = redditRunParser(subred, NULL, ids, list);

    free(kindStr);

    if (res == TOKEN_PARSER_SUCCESS)
        return REDDIT_SUCCESS;
    else
        return REDDIT_ERROR_RESPONSE;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x538, %rsp            # imm = 0x538
movq %rdi, %rbx
xorl %eax, %eax
leaq 0x8(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x221e(%rip), %rdx      # 0x61e4
movq %rdx, 0x10(%rsp)
movl $0x2, %edx
movq %rdx, 0x18(%rsp)
leaq 0x8(%rdi), %rsi
movq %rsi, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rsp)
movl %eax, 0x38(%rsp)
movb $0x1, %sil
movb %sil, 0x3c(%rsp)
movq %rax, 0x40(%rsp)
leaq 0x2108(%rip), %rdi      # 0x6106
movq %rdi, 0x48(%rsp)
movq %rdx, 0x50(%rsp)
movq %rcx, 0x58(%rsp)
movaps %xmm0, 0x60(%rsp)
movl %eax, 0x70(%rsp)
movb %sil, 0x74(%rsp)
movq %rax, 0x78(%rsp)
leaq 0x20e4(%rip), %rcx      # 0x610b
movq %rcx, 0x80(%rsp)
movabsq $0x200000003, %rcx      # imm = 0x200000003
movq %rcx, 0x88(%rsp)
movups %xmm0, 0x9d(%rsp)
movaps %xmm0, 0x90(%rsp)
leaq 0x1ce(%rip), %rcx       # 0x4226
movq %rcx, 0xb0(%rsp)
leaq 0x2185(%rip), %rcx      # 0x61ec
movq %rcx, 0xb8(%rsp)
movq %rdx, 0xc0(%rsp)
leaq 0x20(%rbx), %r14
movq %r14, 0xc8(%rsp)
movaps %xmm0, 0xd0(%rsp)
movl %eax, 0xe0(%rsp)
movb %sil, 0xe4(%rsp)
movups %xmm0, 0xe8(%rsp)
movups %xmm0, 0xf8(%rsp)
movups %xmm0, 0x108(%rsp)
movups %xmm0, 0x118(%rsp)
movabsq $0x6d6f632e746964, %rax # imm = 0x6D6F632E746964
movq %rax, 0x13e(%rsp)
movups 0x203d(%rip), %xmm0     # 0x6110
movaps %xmm0, 0x130(%rsp)
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x40f0
leaq 0x130(%rsp), %rdi
callq 0x2220
movl 0x10(%rbx), %eax
decl %eax
cmpl $0x3, %eax
ja 0x419c
leaq 0x1f67(%rip), %rcx      # 0x606c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x130(%rsp), %rdi
callq 0x20b0
movl $0x77656e2f, 0x130(%rsp,%rax) # imm = 0x77656E2F
jmp 0x4173
leaq 0x130(%rsp), %rdi
callq 0x20b0
movabsq $0x766f72746e6f632f, %rcx # imm = 0x766F72746E6F632F
movq %rcx, 0x130(%rsp,%rax)
movabsq $0x6c616973726576, %rcx # imm = 0x6C616973726576
movq %rcx, 0x137(%rsp,%rax)
jmp 0x419c
leaq 0x130(%rsp), %rdi
callq 0x20b0
movl $0x706f742f, 0x130(%rsp,%rax) # imm = 0x706F742F
movb $0x0, 0x134(%rsp,%rax)
jmp 0x419c
leaq 0x130(%rsp), %rdi
callq 0x20b0
movabsq $0x676e697369722f, %rcx # imm = 0x676E697369722F
movq %rcx, 0x130(%rsp,%rax)
leaq 0x130(%rsp), %rdi
callq 0x20b0
movl $0x6f736a2e, 0x130(%rsp,%rax) # imm = 0x6F736A2E
movw $0x6e, 0x134(%rsp,%rax)
cmpl $0x0, 0x14(%rbx)
jle 0x41ed
leaq 0x130(%rsp), %rdi
callq 0x20b0
leaq (%rsp,%rax), %rdi
addq $0x130, %rdi            # imm = 0x130
movq (%r14), %rdx
leaq 0x2025(%rip), %rsi      # 0x620b
xorl %eax, %eax
callq 0x2230
leaq 0x130(%rsp), %rdi
leaq 0x10(%rsp), %rdx
xorl %esi, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4c8e
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movq 0x8(%rsp), %rdi
callq 0x2040
addl %ebx, %ebx
movl %ebx, %eax
addq $0x538, %rsp            # imm = 0x538
popq %rbx
popq %r14
retq