// File: aempirei[P]Chat-Art/pgmtobrailedux.c
// Function: braileencode
void braileencode(FILE *fpout, int *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)>mid) wch |= 0x01;
			if(BIT1(data,x,y,width)>mid) wch |= 0x02;
			if(BIT2(data,x,y,width)>mid) wch |= 0x04;
			if(BIT3(data,x,y,width)>mid) wch |= 0x08;
			if(BIT4(data,x,y,width)>mid) wch |= 0x10;
			if(BIT5(data,x,y,width)>mid) wch |= 0x20;
			if(BIT6(data,x,y,width)>mid) wch |= 0x40;
			if(BIT7(data,x,y,width)>mid) 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 0x1719
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x16fa
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
movl (%rax,%rcx,4), %eax
cmpl 0x2b18(%rip), %eax      # 0x4098
jle 0x158b
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
movl (%rax,%rcx,4), %eax
cmpl 0x2ae8(%rip), %eax      # 0x4098
jle 0x15bb
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
movl (%rax,%rcx,4), %eax
cmpl 0x2ab8(%rip), %eax      # 0x4098
jle 0x15eb
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
movl (%rax,%rcx,4), %eax
cmpl 0x2a88(%rip), %eax      # 0x4098
jle 0x161b
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
movl (%rax,%rcx,4), %eax
cmpl 0x2a58(%rip), %eax      # 0x4098
jle 0x164b
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
movl (%rax,%rcx,4), %eax
cmpl 0x2a28(%rip), %eax      # 0x4098
jle 0x167b
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
movl (%rax,%rcx,4), %eax
cmpl 0x29f8(%rip), %eax      # 0x4098
jle 0x16ab
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
movl (%rax,%rcx,4), %eax
cmpl 0x29c8(%rip), %eax      # 0x4098
jle 0x16dd
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 0x1546
movq -0x8(%rbp), %rsi
movl $0xa, %edi
callq 0x1060
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0x1530
addq $0x40, %rsp
popq %rbp
retq
nop