// File: /workspace/github_c_makefile_star2_O0/Cotix[P]cReddit/libreddit/comment.c
// Function: redditGetCommentChildren
EXPORT_SYMBOL RedditErrno redditGetCommentChildren (RedditCommentList *list, RedditComment *parent)
{
    TokenParserResult res;
    char postText[4096];
    int i, endCount, children;
    int preCheck;

    TokenIdent ids[] = {
        ADD_TOKEN_IDENT_FUNC  ("things", getMoreChildren),
        {0}
    };

    sprintf(postText, "api_type=json&link_id=t3_%s&children=", list->post->id);
    if (parent->directChildrenCount > 20)
        children = 20;
    else
        children = parent->directChildrenCount;

    if (children == 0)
        return REDDIT_ERROR;

    strcat(postText, parent->directChildrenIds[0]);
    for (i = 1; i < children; i++) {
        strcat(postText, ",");
        strcat(postText, parent->directChildrenIds[i]);
    }

    preCheck = parent->totalReplyCount;

    res = redditRunParser(REDDIT_API_MORECHILDREN, postText, ids, list, parent);

    if (preCheck == parent->totalReplyCount)
        parent->totalReplyCount -= children;

    endCount = parent->directChildrenCount - children;
    for (i = parent->directChildrenCount - 1; i >= endCount; i--)
        free(parent->directChildrenIds[i]);

    parent->directChildrenCount = endCount;

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

// Assembly:
subq $0x10a8, %rsp           # imm = 0x10A8
movq %rdi, 0x1098(%rsp)
movq %rsi, 0x1090(%rsp)
movq %rsp, %rdi
leaq 0x783f(%rip), %rsi      # 0xacf0
movl $0x70, %edx
callq 0x2180
leaq 0x80(%rsp), %rdi
movq 0x1098(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdx
leaq 0x4efb(%rip), %rsi      # 0x83d5
movb $0x0, %al
callq 0x2290
movq 0x1090(%rsp), %rax
cmpl $0x14, 0x60(%rax)
jle 0x34f9
movl $0x14, 0x74(%rsp)
jmp 0x3508
movq 0x1090(%rsp), %rax
movl 0x60(%rax), %eax
movl %eax, 0x74(%rsp)
cmpl $0x0, 0x74(%rsp)
jne 0x351f
movl $0x1, 0x10a4(%rsp)
jmp 0x367b
leaq 0x80(%rsp), %rdi
movq 0x1090(%rsp), %rax
movq 0x70(%rax), %rax
movq (%rax), %rsi
callq 0x2260
movl $0x1, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
cmpl 0x74(%rsp), %eax
jge 0x3590
leaq 0x80(%rsp), %rdi
leaq 0x4e9f(%rip), %rsi      # 0x83fb
callq 0x2260
leaq 0x80(%rsp), %rdi
movq 0x1090(%rsp), %rax
movq 0x70(%rax), %rax
movslq 0x7c(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x2260
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x3543
movq 0x1090(%rsp), %rax
movl 0x5c(%rax), %eax
movl %eax, 0x70(%rsp)
leaq 0x80(%rsp), %rsi
movq %rsp, %rdx
movq 0x1098(%rsp), %rcx
movq 0x1090(%rsp), %r8
leaq 0x4e3c(%rip), %rdi      # 0x83fd
movb $0x0, %al
callq 0x6ed0
movl %eax, 0x108c(%rsp)
movl 0x70(%rsp), %eax
movq 0x1090(%rsp), %rcx
cmpl 0x5c(%rcx), %eax
jne 0x35f4
movl 0x74(%rsp), %edx
movq 0x1090(%rsp), %rax
movl 0x5c(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x5c(%rax)
movq 0x1090(%rsp), %rax
movl 0x60(%rax), %eax
subl 0x74(%rsp), %eax
movl %eax, 0x78(%rsp)
movq 0x1090(%rsp), %rax
movl 0x60(%rax), %eax
subl $0x1, %eax
movl %eax, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
cmpl 0x78(%rsp), %eax
jl 0x364a
movq 0x1090(%rsp), %rax
movq 0x70(%rax), %rax
movslq 0x7c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movl 0x7c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x3619
movl 0x78(%rsp), %ecx
movq 0x1090(%rsp), %rax
movl %ecx, 0x60(%rax)
cmpl $0x0, 0x108c(%rsp)
jne 0x3670
movl $0x0, 0x10a4(%rsp)
jmp 0x367b
movl $0x2, 0x10a4(%rsp)
movl 0x10a4(%rsp), %eax
addq $0x10a8, %rsp           # imm = 0x10A8
retq
nopw (%rax,%rax)