// File: /workspace/github_c_makefile_star2_O2/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
leaq 0x8(%rsp), %rax
andq $0x0, (%rax)
leaq 0x22fd(%rip), %rcx      # 0x61e4
movq %rcx, 0x10(%rsp)
pushq $0x2
popq %rcx
movq %rcx, 0x18(%rsp)
leaq 0x8(%rdi), %rdx
movq %rdx, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rsp)
andl $0x0, 0x38(%rsp)
movb $0x1, %dl
movb %dl, 0x3c(%rsp)
andq $0x0, 0x40(%rsp)
leaq 0x21e9(%rip), %rsi      # 0x6106
movq %rsi, 0x48(%rsp)
movq %rcx, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movaps %xmm0, 0x60(%rsp)
andl $0x0, 0x70(%rsp)
movb %dl, 0x74(%rsp)
andq $0x0, 0x78(%rsp)
leaq 0x21c4(%rip), %rax      # 0x610b
movq %rax, 0x80(%rsp)
movabsq $0x200000003, %rax      # imm = 0x200000003
movq %rax, 0x88(%rsp)
movups %xmm0, 0x9d(%rsp)
movaps %xmm0, 0x90(%rsp)
leaq 0x1ce(%rip), %rax       # 0x4146
movq %rax, 0xb0(%rsp)
leaq 0x2265(%rip), %rax      # 0x61ec
movq %rax, 0xb8(%rsp)
movq %rcx, 0xc0(%rsp)
leaq 0x20(%rdi), %r14
movq %r14, 0xc8(%rsp)
andl $0x0, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movb %dl, 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 0x211d(%rip), %xmm0     # 0x6110
movaps %xmm0, 0x130(%rsp)
movq (%rdi), %rsi
testq %rsi, %rsi
je 0x4010
leaq 0x130(%rsp), %rdi
callq 0x2260
movl 0x10(%rbx), %eax
decl %eax
cmpl $0x3, %eax
ja 0x40bc
leaq 0x2047(%rip), %rcx      # 0x606c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x130(%rsp), %rdi
callq 0x20d0
movl $0x77656e2f, 0x130(%rsp,%rax) # imm = 0x77656E2F
jmp 0x4093
leaq 0x130(%rsp), %rdi
callq 0x20d0
movabsq $0x766f72746e6f632f, %rcx # imm = 0x766F72746E6F632F
movq %rcx, 0x130(%rsp,%rax)
movabsq $0x6c616973726576, %rcx # imm = 0x6C616973726576
movq %rcx, 0x137(%rsp,%rax)
jmp 0x40bc
leaq 0x130(%rsp), %rdi
callq 0x20d0
movl $0x706f742f, 0x130(%rsp,%rax) # imm = 0x706F742F
movb $0x0, 0x134(%rsp,%rax)
jmp 0x40bc
leaq 0x130(%rsp), %rdi
callq 0x20d0
movabsq $0x676e697369722f, %rcx # imm = 0x676E697369722F
movq %rcx, 0x130(%rsp,%rax)
leaq 0x130(%rsp), %rdi
callq 0x20d0
movl $0x6f736a2e, 0x130(%rsp,%rax) # imm = 0x6F736A2E
movw $0x6e, 0x134(%rsp,%rax)
cmpl $0x0, 0x14(%rbx)
jle 0x410d
leaq 0x130(%rsp), %rdi
callq 0x20d0
leaq (%rsp,%rax), %rdi
addq $0x130, %rdi            # imm = 0x130
movq (%r14), %rdx
leaq 0x2105(%rip), %rsi      # 0x620b
xorl %eax, %eax
callq 0x2290
leaq 0x130(%rsp), %rdi
leaq 0x10(%rsp), %rdx
xorl %esi, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4ac0
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movq 0x8(%rsp), %rdi
callq 0x2050
addl %ebx, %ebx
movl %ebx, %eax
addq $0x538, %rsp            # imm = 0x538
popq %rbx
popq %r14
retq