// File: aempirei[P]Chat-Art/pgmtobraile.c
// Function: braileencode
void braileencode(FILE *fpout, uint8_t *data, size_t width, size_t height) {
	for(size_t y = 0; y < height; y += 4) {
		for(size_t x = 0; x < width; x += 2) {
			wint_t wch = 0x2800;
			if(BIT0(data,x,y,width) > 0x80) wch |= 0x01;
			if(BIT1(data,x,y,width) > 0x80) wch |= 0x02;
			if(BIT2(data,x,y,width) > 0x80) wch |= 0x04;
			if(BIT3(data,x,y,width) > 0x80) wch |= 0x08;
			if(BIT4(data,x,y,width) > 0x80) wch |= 0x10;
			if(BIT5(data,x,y,width) > 0x80) wch |= 0x20;
			if(BIT6(data,x,y,width) > 0x80) wch |= 0x40;
			if(BIT7(data,x,y,width) > 0x80) wch |= 0x80;
			fputwc(wch, fpout);
		}
		fputwc(L'\n', fpout);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x1669
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x164a
movl $0x2800, -0x34(%rbp)    # imm = 0x2800
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x0, %rcx
movq -0x28(%rbp), %rdx
addq $0x0, %rdx
imulq -0x18(%rbp), %rdx
addq %rdx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jle 0x14db
movl -0x34(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x0, %rcx
movq -0x28(%rbp), %rdx
addq $0x1, %rdx
imulq -0x18(%rbp), %rdx
addq %rdx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jle 0x150b
movl -0x34(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x0, %rcx
movq -0x28(%rbp), %rdx
addq $0x2, %rdx
imulq -0x18(%rbp), %rdx
addq %rdx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jle 0x153b
movl -0x34(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
movq -0x28(%rbp), %rdx
addq $0x0, %rdx
imulq -0x18(%rbp), %rdx
addq %rdx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jle 0x156b
movl -0x34(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
movq -0x28(%rbp), %rdx
addq $0x1, %rdx
imulq -0x18(%rbp), %rdx
addq %rdx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jle 0x159b
movl -0x34(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
movq -0x28(%rbp), %rdx
addq $0x2, %rdx
imulq -0x18(%rbp), %rdx
addq %rdx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jle 0x15cb
movl -0x34(%rbp), %eax
orl $0x20, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x0, %rcx
movq -0x28(%rbp), %rdx
addq $0x3, %rdx
imulq -0x18(%rbp), %rdx
addq %rdx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jle 0x15fb
movl -0x34(%rbp), %eax
orl $0x40, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
movq -0x28(%rbp), %rdx
addq $0x3, %rdx
imulq -0x18(%rbp), %rdx
addq %rdx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jle 0x162d
movl -0x34(%rbp), %eax
orl $0x80, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %edi
movq -0x8(%rbp), %rsi
callq 0x1060
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
jmp 0x1496
movq -0x8(%rbp), %rsi
movl $0xa, %edi
callq 0x1060
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0x1480
addq $0x40, %rsp
popq %rbp
retq
nop