// File: /workspace/github_c_makefile_star2_O0/Cotix[P]cReddit/src/main.c
// Function: drawScreen
void drawScreen(LinkScreen *screen)
{
    int i, screenLines;
    wchar_t *tmpbuf;
    int bufSize, 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->linkOpenSize; 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->list->linkCount) {
            if (screen->screenLineCount <= i)
                linkScreenRenderLine(screen, i, COLS);

            mvaddwstr(i - screen->offset, 0, screen->screenLines[i]);
        } else {
            mvaddwstr(i - screen->offset, 0, tmpbuf);
        }

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



    if (screen->linkOpen) {
        if (screen->helpOpen == 0)
            linkScreenRenderLinkText(screen, tmpbuf, bufLen, screenLines);
        else
            linkScreenRenderHelpText(screen, tmpbuf, bufLen, screenLines);
    }

    free(tmpbuf);

    refresh();
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0x3fc6
jmp 0x427d
movq 0x5ffb(%rip), %rax      # 0x9fc8
movl (%rax), %eax
addl $0x1, %eax
cltq
shlq $0x2, %rax
movl %eax, 0xc(%rsp)
movq 0x5fe5(%rip), %rax      # 0x9fc8
movl (%rax), %eax
movl %eax, 0x8(%rsp)
movslq 0xc(%rsp), %rdi
callq 0x2250
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movslq 0xc(%rsp), %rdx
xorl %esi, %esi
callq 0x2110
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x8(%rsp), %eax
jge 0x4039
movq 0x10(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl $0x20, (%rax,%rcx,4)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x4011
movq 0x20(%rsp), %rax
movl 0xc(%rax), %eax
movq 0x20(%rsp), %rcx
addl 0x8(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movq 0x20(%rsp), %rcx
movl 0x8(%rcx), %ecx
movq 0x20(%rsp), %rdx
addl 0xc(%rdx), %ecx
addl $0x1, %ecx
movq 0x20(%rsp), %rdx
addl 0x28(%rdx), %ecx
cmpl %ecx, %eax
jge 0x40bd
movq 0x5f5e(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x1c(%rsp), %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x4097
jmp 0x40b0
movq 0x5f42(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x10(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x4058
movq 0x5f1c(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl $0x100, %esi            # imm = 0x100
xorl %eax, %eax
movl %eax, %edx
callq 0x22b0
movq 0x20(%rsp), %rax
movl 0xc(%rax), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x18(%rsp), %eax
jge 0x420c
movl 0x1c(%rsp), %eax
movq 0x20(%rsp), %rcx
cmpl 0x10(%rcx), %eax
jne 0x4115
movq 0x5edc(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl $0x200, %esi            # imm = 0x200
xorl %eax, %eax
movl %eax, %edx
callq 0x22b0
movl 0x1c(%rsp), %eax
movq 0x20(%rsp), %rcx
movq (%rcx), %rcx
cmpl 0x14(%rcx), %eax
jge 0x4197
movq 0x20(%rsp), %rax
movl 0x14(%rax), %eax
cmpl 0x1c(%rsp), %eax
jg 0x414b
movq 0x20(%rsp), %rdi
movl 0x1c(%rsp), %esi
movq 0x5e84(%rip), %rax      # 0x9fc8
movl (%rax), %edx
callq 0x3a10
movq 0x5e8e(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x1c(%rsp), %esi
movq 0x20(%rsp), %rax
subl 0xc(%rax), %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x416f
jmp 0x4195
movq 0x5e6a(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
jmp 0x41d4
movq 0x5e42(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl 0x1c(%rsp), %esi
movq 0x20(%rsp), %rax
subl 0xc(%rax), %esi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
jne 0x41bb
jmp 0x41d4
movq 0x5e1e(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movq 0x10(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2280
movl 0x1c(%rsp), %eax
movq 0x20(%rsp), %rcx
cmpl 0x10(%rcx), %eax
jne 0x41fa
movq 0x5df7(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
movl $0x100, %esi            # imm = 0x100
xorl %eax, %eax
movl %eax, %edx
callq 0x22b0
jmp 0x41fc
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x40e1
movq 0x20(%rsp), %rax
movb 0x2c(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x4264
movq 0x20(%rsp), %rax
movb 0x2c(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x424b
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl 0x8(%rsp), %edx
movl 0x18(%rsp), %ecx
callq 0x3d00
jmp 0x4262
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl 0x8(%rsp), %edx
movl 0x18(%rsp), %ecx
callq 0x3ee0
jmp 0x4264
movq 0x10(%rsp), %rdi
callq 0x2220
movq 0x5d6b(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
callq 0x2210
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)