// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
callq 0x4ee9
movq %rax, 0x10(%rsp)
cmpl 0x4(%rbx), %ebp
jge 0x28b2
movl %ebp, %eax
orl $0x1, %eax
movl %eax, 0x20(%rsp)
movl %ebp, %eax
orl $0x2, %eax
movl %eax, 0x1c(%rsp)
movl %ebp, 0x18(%rsp)
movl %ebp, %eax
orl $0x3, %eax
movl %eax, 0x24(%rsp)
xorl %r12d, %r12d
cmpl (%rbx), %r12d
jge 0x2884
movq %rbx, %rdi
movl %r12d, %esi
movl 0x18(%rsp), %r14d
movl %r14d, %edx
callq 0x260b
xorl %r15d, %r15d
testl %eax, %eax
setne %r15b
movq %rbx, %rdi
movl %r12d, %esi
movl 0x20(%rsp), %edx
callq 0x260b
leal 0x2(%r15), %ebp
testl %eax, %eax
cmovel %r15d, %ebp
movq %rbx, %rdi
movl %r12d, %esi
movl 0x1c(%rsp), %edx
callq 0x260b
leal 0x4(%rbp), %r13d
testl %eax, %eax
cmovel %ebp, %r13d
leal 0x1(%r12), %r15d
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x260b
leal 0x8(%r13), %ebp
testl %eax, %eax
cmovel %r13d, %ebp
movq %rbx, %rdi
movl %r15d, %esi
movl 0x20(%rsp), %edx
callq 0x260b
movl %ebp, %r13d
orl $0x10, %r13d
testl %eax, %eax
cmovel %ebp, %r13d
movq %rbx, %rdi
movl %r15d, %esi
movl 0x1c(%rsp), %edx
callq 0x260b
movl %r13d, %ebp
orl $0x20, %ebp
testl %eax, %eax
cmovel %r13d, %ebp
movq %rbx, %rdi
movl %r12d, %esi
movl 0x24(%rsp), %r14d
movl %r14d, %edx
callq 0x260b
movl %ebp, %r13d
orl $0x40, %r13d
testl %eax, %eax
cmovel %ebp, %r13d
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x260b
movl %r13d, %ecx
orl $0x80, %ecx
testl %eax, %eax
cmovel %r13d, %ecx
movb $-0x1e, 0xd(%rsp)
movl %ecx, %eax
shrl $0x6, %eax
xorb $-0x60, %al
movb %al, 0xe(%rsp)
andb $0x3f, %cl
orb $-0x80, %cl
movb %cl, 0xf(%rsp)
movq 0x10(%rsp), %rdi
leaq 0xd(%rsp), %rsi
pushq $0x3
popq %rdx
callq 0x5534
movq %rax, 0x10(%rsp)
addl $0x2, %r12d
jmp 0x2762
movl 0x4(%rbx), %eax
decl %eax
movl 0x18(%rsp), %ebp
cmpl %eax, %ebp
je 0x28aa
movq 0x10(%rsp), %rdi
leaq 0xb12f(%rip), %rsi      # 0xd9cc
pushq $0x1
popq %rdx
callq 0x5534
movq %rax, 0x10(%rsp)
addl $0x4, %ebp
jmp 0x2737
movq 0x10(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop