// File: /workspace/github_c_makefile_star2_O0/antirez[P]stonky/canvas.c
// Function: renderCanvas
sds renderCanvas(canvas *canvas) {
    sds text = sdsempty();
    for (int y = 0; y < canvas->height; y += 4) {
        for (int x = 0; x < canvas->width; x += 2) {
            /* We need to emit groups of 8 bits according to a specific
             * arrangement. See lwTranslatePixelsGroup() for more info. */
            int byte = 0;
            if (getPixel(canvas,x,y)) byte |= (1<<0);
            if (getPixel(canvas,x,y+1)) byte |= (1<<1);
            if (getPixel(canvas,x,y+2)) byte |= (1<<2);
            if (getPixel(canvas,x+1,y)) byte |= (1<<3);
            if (getPixel(canvas,x+1,y+1)) byte |= (1<<4);
            if (getPixel(canvas,x+1,y+2)) byte |= (1<<5);
            if (getPixel(canvas,x,y+3)) byte |= (1<<6);
            if (getPixel(canvas,x+1,y+3)) byte |= (1<<7);
            char unicode[3];
            brailleTranslatePixelsGroup(byte,unicode);
            text = sdscatlen(text,unicode,3);
        }
        if (y != canvas->height-1) text = sdscatlen(text,"\n",1);
    }
    return text;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
callq 0x8610
movq %rax, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq 0x20(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x29c5
movl $0x0, 0x10(%rsp)
movl 0x10(%rsp), %eax
movq 0x20(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x2985
movl $0x0, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movl 0x10(%rsp), %esi
movl 0x14(%rsp), %edx
callq 0x2640
cmpl $0x0, %eax
je 0x2840
movl 0xc(%rsp), %eax
orl $0x1, %eax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movl 0x10(%rsp), %esi
movl 0x14(%rsp), %edx
addl $0x1, %edx
callq 0x2640
cmpl $0x0, %eax
je 0x2865
movl 0xc(%rsp), %eax
orl $0x2, %eax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movl 0x10(%rsp), %esi
movl 0x14(%rsp), %edx
addl $0x2, %edx
callq 0x2640
cmpl $0x0, %eax
je 0x288a
movl 0xc(%rsp), %eax
orl $0x4, %eax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movl 0x10(%rsp), %esi
addl $0x1, %esi
movl 0x14(%rsp), %edx
callq 0x2640
cmpl $0x0, %eax
je 0x28af
movl 0xc(%rsp), %eax
orl $0x8, %eax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movl 0x10(%rsp), %esi
addl $0x1, %esi
movl 0x14(%rsp), %edx
addl $0x1, %edx
callq 0x2640
cmpl $0x0, %eax
je 0x28d7
movl 0xc(%rsp), %eax
orl $0x10, %eax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movl 0x10(%rsp), %esi
addl $0x1, %esi
movl 0x14(%rsp), %edx
addl $0x2, %edx
callq 0x2640
cmpl $0x0, %eax
je 0x28ff
movl 0xc(%rsp), %eax
orl $0x20, %eax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movl 0x10(%rsp), %esi
movl 0x14(%rsp), %edx
addl $0x3, %edx
callq 0x2640
cmpl $0x0, %eax
je 0x2924
movl 0xc(%rsp), %eax
orl $0x40, %eax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movl 0x10(%rsp), %esi
addl $0x1, %esi
movl 0x14(%rsp), %edx
addl $0x3, %edx
callq 0x2640
cmpl $0x0, %eax
je 0x294e
movl 0xc(%rsp), %eax
orl $0x80, %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %edi
leaq 0x9(%rsp), %rsi
callq 0x29d0
movq 0x18(%rsp), %rdi
leaq 0x9(%rsp), %rsi
movl $0x3, %edx
callq 0x92b0
movq %rax, 0x18(%rsp)
movl 0x10(%rsp), %eax
addl $0x2, %eax
movl %eax, 0x10(%rsp)
jmp 0x2805
movl 0x14(%rsp), %eax
movq 0x20(%rsp), %rcx
movl 0x4(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x29b3
movq 0x18(%rsp), %rdi
leaq 0x141b0(%rip), %rsi     # 0x16b54
movl $0x1, %edx
callq 0x92b0
movq %rax, 0x18(%rsp)
jmp 0x29b5
movl 0x14(%rsp), %eax
addl $0x4, %eax
movl %eax, 0x14(%rsp)
jmp 0x27eb
movq 0x18(%rsp), %rax
addq $0x28, %rsp
retq
nop