// File: /workspace/github_c_makefile_star2_O0/Cotix[P]cReddit/src/main.c
// Function: commentScreenDisplay
void commentScreenDisplay(CommentScreen *screen)
{
    int i, screenLines;
    wchar_t *tmpbuf;
    int bufSize, lastLine, bufLen;

    if (screen == NULL)
        return ;

    bufSize = sizeof(wchar_t) * (COLS + 1);
    bufLen = COLS;
    tmpbuf = malloc(bufSize);
    memset(tmpbuf, 0, bufSize);

    for (i = 0; i < bufLen; i++)
        tmpbuf[i] = L' ';

    screenLines = screen->offset + screen->displayed + 1;

    for (i = 0; i < screen->displayed + screen->offset + 1 + screen->commentOpenSize; i++)
        mvaddwstr(i, 0, tmpbuf);

    attron(COLOR_PAIR(1));

    for(i = screen->offset; i < screenLines; i++) {
        if(i == screen->selected)
            attron(COLOR_PAIR(2));

        if (i < screen->lineCount && screen->lines[i]->text != NULL)
            mvaddwstr(i - screen->offset, 0, screen->lines[i]->text);
        else
            mvaddwstr(i - screen->offset, 0, tmpbuf);

        if (i == screen->selected)
            attron(COLOR_PAIR(1));
    }

    if (screen->commentOpen) {
        RedditComment *current;
        lastLine = screenLines - screen->offset;

        for (i = lastLine; i < lastLine + screen->commentOpenSize; i++)
            mvaddwstr(i, 0, tmpbuf);

        for (i = 0; i < bufLen; i++)
            tmpbuf[i] = L'-';

        tmpbuf[bufLen] = (wchar_t)0;
        attron(COLOR_PAIR(2));
        mvaddwstr(lastLine, 0, tmpbuf);

        attron(COLOR_PAIR(1));
        if (screen->lineCount >= screen->selected) {
            current = screen->lines[screen->selected]->comment;
            if (current != NULL) {
                swprintf(tmpbuf, bufLen, L"%s - %d Score - %s", current->author, current->ups, current->created_utc);
                mvaddwstr(lastLine + 1, 0, tmpbuf);
                swprintf(tmpbuf, bufLen, L"-------");
                mvaddwstr(lastLine + 2, 0, tmpbuf);

                mvaddwstr(lastLine + 3, 0, &(current->wbodyEsc[current->advance] ));
            }
        }
    }

    free(tmpbuf);
    refresh();
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x3176
jmp 0x3641
movq 0x6e4b(%rip), %rax      # 0x9fc8
movl (%rax), %eax
addl $0x1, %eax
cltq
shlq $0x2, %rax
movl %eax, 0x1c(%rsp)
movq 0x6e35(%rip), %rax      # 0x9fc8
movl (%rax), %eax
movl %eax, 0x14(%rsp)
movslq 0x1c(%rsp), %rdi
callq 0x2250
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
movslq 0x1c(%rsp), %rdx
xorl %esi, %esi
callq 0x2110
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x14(%rsp), %eax
jge 0x31e9
movq 0x20(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movl $0x20, (%rax,%rcx,4)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x31c1
movq 0x30(%rsp), %rax
movl 0x1c(%rax), %eax
movq 0x30(%rsp), %rcx
addl 0x18(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movq 0x30(%rsp), %rcx
movl 0x18(%rcx), %ecx
movq 0x30(%rsp), %rdx
addl 0x1c(%rdx), %ecx
addl $0x1, %ecx
movq 0x30(%rsp), %rdx
addl 0x28(%rdx), %ecx
cmpl %ecx, %eax
jge 0x326d
movq 0x6dae(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x2c(%rsp), %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x3247
jmp 0x3260
movq 0x6d92(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x20(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x3208
movq 0x6d6c(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl $0x100, %esi            # imm = 0x100
xorl %eax, %eax
movl %eax, %edx
callq 0x22b0
movq 0x30(%rsp), %rax
movl 0x1c(%rax), %eax
movl %eax, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x28(%rsp), %eax
jge 0x33af
movl 0x2c(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x32c5
movq 0x6d2c(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl $0x200, %esi            # imm = 0x200
xorl %eax, %eax
movl %eax, %edx
callq 0x22b0
movl 0x2c(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x333a
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, (%rax)
je 0x333a
movq 0x6cee(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x2c(%rsp), %esi
movq 0x30(%rsp), %rax
subl 0x1c(%rax), %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x330f
jmp 0x3338
movq 0x6cca(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
jmp 0x3377
movq 0x6c9f(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x2c(%rsp), %esi
movq 0x30(%rsp), %rax
subl 0x1c(%rax), %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x335e
jmp 0x3377
movq 0x6c7b(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x20(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
movl 0x2c(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x339d
movq 0x6c54(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl $0x100, %esi            # imm = 0x100
xorl %eax, %eax
movl %eax, %edx
callq 0x22b0
jmp 0x339f
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x3291
movq 0x30(%rsp), %rax
movb 0x2c(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x3628
movl 0x28(%rsp), %eax
movq 0x30(%rsp), %rcx
subl 0x1c(%rcx), %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movl 0x18(%rsp), %ecx
movq 0x30(%rsp), %rdx
addl 0x28(%rdx), %ecx
cmpl %ecx, %eax
jge 0x3433
movq 0x6be8(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x2c(%rsp), %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x340d
jmp 0x3426
movq 0x6bcc(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x20(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x33dd
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x14(%rsp), %eax
jge 0x3463
movq 0x20(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movl $0x2d, (%rax,%rcx,4)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x343b
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movq 0x6b65(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl $0x200, %esi            # imm = 0x200
xorl %eax, %eax
movl %eax, %edx
callq 0x22b0
movq 0x6b4d(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x18(%rsp), %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x34a8
jmp 0x34c1
movq 0x6b31(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x20(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
movq 0x6b18(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl $0x100, %esi            # imm = 0x100
xorl %eax, %eax
movl %eax, %edx
callq 0x22b0
movq 0x30(%rsp), %rax
movl 0x8(%rax), %eax
movq 0x30(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jl 0x3626
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x30(%rsp), %rcx
movslq 0x20(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x3624
movq 0x20(%rsp), %rdi
movslq 0x14(%rsp), %rsi
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x8(%rsp), %rax
movl 0x50(%rax), %r8d
movq 0x8(%rsp), %rax
movq 0x78(%rax), %r9
leaq 0x3dce(%rip), %rdx      # 0x7314
movb $0x0, %al
callq 0x2270
movq 0x6a8c(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x18(%rsp), %esi
addl $0x1, %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x356c
jmp 0x3585
movq 0x6a6d(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x20(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
movq 0x20(%rsp), %rdi
movslq 0x14(%rsp), %rsi
leaq 0x3dca(%rip), %rdx      # 0x7360
movb $0x0, %al
callq 0x2270
movq 0x6a3c(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x18(%rsp), %esi
addl $0x2, %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x35bc
jmp 0x35d5
movq 0x6a1d(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x20(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
movq 0x6a04(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x18(%rsp), %esi
addl $0x3, %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x35f4
jmp 0x3624
movq 0x69e5(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rsi
movq 0x8(%rsp), %rax
movslq 0x84(%rax), %rax
shlq $0x2, %rax
addq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
jmp 0x3626
jmp 0x3628
movq 0x20(%rsp), %rdi
callq 0x2220
movq 0x69a7(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
callq 0x2210
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)