// File: /workspace/github_c_makefile_star2_O0/mrdotx[P]st/boxdraw.c
// Function: drawbox
void
drawbox(int x, int y, int w, int h, XftColor *fg, XftColor *bg, ushort bd)
{
	ushort cat = bd & ~(BDB | 0xff);  /* mask out bold and data */
	if (bd & (BDL | BDA)) {
		/* lines (light/double/heavy/arcs) */
		drawboxlines(x, y, w, h, fg, bd);

	} else if (cat == BBD) {
		/* lower (8-X)/8 block */
		int d = DIV((uint8_t)bd * h, 8);
		XftDrawRect(xd, fg, x, y + d, w, h - d);

	} else if (cat == BBU) {
		/* upper X/8 block */
		XftDrawRect(xd, fg, x, y, w, DIV((uint8_t)bd * h, 8));

	} else if (cat == BBL) {
		/* left X/8 block */
		XftDrawRect(xd, fg, x, y, DIV((uint8_t)bd * w, 8), h);

	} else if (cat == BBR) {
		/* right (8-X)/8 block */
		int d = DIV((uint8_t)bd * w, 8);
		XftDrawRect(xd, fg, x + d, y, w - d, h);

	} else if (cat == BBQ) {
		/* Quadrants */
		int w2 = DIV(w, 2), h2 = DIV(h, 2);
		if (bd & TL)
			XftDrawRect(xd, fg, x, y, w2, h2);
		if (bd & TR)
			XftDrawRect(xd, fg, x + w2, y, w - w2, h2);
		if (bd & BL)
			XftDrawRect(xd, fg, x, y + h2, w2, h - h2);
		if (bd & BR)
			XftDrawRect(xd, fg, x + w2, y + h2, w - w2, h - h2);

	} else if (bd & BBS) {
		/* Shades - data is 1/2/3 for 25%/50%/75% alpha, respectively */
		int d = (uint8_t)bd;
		XftColor xfc;
		XRenderColor xrc = { .alpha = 0xffff };

		xrc.red = DIV(fg->color.red * d + bg->color.red * (4 - d), 4);
		xrc.green = DIV(fg->color.green * d + bg->color.green * (4 - d), 4);
		xrc.blue = DIV(fg->color.blue * d + bg->color.blue * (4 - d), 4);

		XftColorAllocValue(xdpy, xvis, xcmap, &xrc, &xfc);
		XftDrawRect(xd, &xfc, x, y, w, h);
		XftColorFree(xdpy, xvis, xcmap, &xfc);

	} else if (cat == BRL) {
		/* braille, each data bit corresponds to one dot at 2x4 grid */
		int w1 = DIV(w, 2);
		int h1 = DIV(h, 4), h2 = DIV(h, 2), h3 = DIV(3 * h, 4);

		if (bd & 1)   XftDrawRect(xd, fg, x, y, w1, h1);
		if (bd & 2)   XftDrawRect(xd, fg, x, y + h1, w1, h2 - h1);
		if (bd & 4)   XftDrawRect(xd, fg, x, y + h2, w1, h3 - h2);
		if (bd & 8)   XftDrawRect(xd, fg, x + w1, y, w - w1, h1);
		if (bd & 16)  XftDrawRect(xd, fg, x + w1, y + h1, w - w1, h2 - h1);
		if (bd & 32)  XftDrawRect(xd, fg, x + w1, y + h2, w - w1, h3 - h2);
		if (bd & 64)  XftDrawRect(xd, fg, x, y + h3, w1, h - h3);
		if (bd & 128) XftDrawRect(xd, fg, x + w1, y + h3, w - w1, h - h3);

	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movw 0x10(%rbp), %ax
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movl %ecx, -0x10(%rbp)
movq %r8, -0x18(%rbp)
movq %r9, -0x20(%rbp)
movzwl 0x10(%rbp), %eax
andl $0xffff7f00, %eax       # imm = 0xFFFF7F00
movw %ax, -0x22(%rbp)
movzwl 0x10(%rbp), %eax
andl $0x300, %eax            # imm = 0x300
cmpl $0x0, %eax
je 0x14f9a
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %ecx
movq -0x18(%rbp), %r8
movzwl 0x10(%rbp), %r9d
callq 0x154f0
jmp 0x154dc
movzwl -0x22(%rbp), %eax
cmpl $0x400, %eax            # imm = 0x400
jne 0x14fe8
movw 0x10(%rbp), %ax
movzbl %al, %eax
imull -0x10(%rbp), %eax
addl $0x4, %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, -0x28(%rbp)
movq 0xcaf3(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
addl -0x28(%rbp), %ecx
movl -0xc(%rbp), %r8d
movl -0x10(%rbp), %r9d
subl -0x28(%rbp), %r9d
callq 0x63f0
jmp 0x154da
movzwl -0x22(%rbp), %eax
cmpl $0xc00, %eax            # imm = 0xC00
jne 0x15033
movq 0xcabe(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x8(%rbp), %ecx
movl -0xc(%rbp), %r8d
movw 0x10(%rbp), %ax
movzbl %al, %eax
imull -0x10(%rbp), %eax
addl $0x4, %eax
movl $0x8, %r9d
cltd
idivl %r9d
movl -0x64(%rbp), %edx
movl %eax, %r9d
callq 0x63f0
jmp 0x154d8
movzwl -0x22(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jne 0x1507e
movq 0xca73(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x8(%rbp), %ecx
movw 0x10(%rbp), %ax
movzbl %al, %eax
imull -0xc(%rbp), %eax
addl $0x4, %eax
movl $0x8, %r8d
cltd
idivl %r8d
movl -0x68(%rbp), %edx
movl %eax, %r8d
movl -0x10(%rbp), %r9d
callq 0x63f0
jmp 0x154d6
movzwl -0x22(%rbp), %eax
cmpl $0x1000, %eax           # imm = 0x1000
jne 0x150cc
movw 0x10(%rbp), %ax
movzbl %al, %eax
imull -0xc(%rbp), %eax
addl $0x4, %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, -0x2c(%rbp)
movq 0xca0f(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
addl -0x2c(%rbp), %edx
movl -0x8(%rbp), %ecx
movl -0xc(%rbp), %r8d
subl -0x2c(%rbp), %r8d
movl -0x10(%rbp), %r9d
callq 0x63f0
jmp 0x154d4
movzwl -0x22(%rbp), %eax
cmpl $0x1400, %eax           # imm = 0x1400
jne 0x151c6
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x30(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x34(%rbp)
movzwl 0x10(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x15127
movq 0xc9a8(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
movl -0x30(%rbp), %r8d
movl -0x34(%rbp), %r9d
callq 0x63f0
movzwl 0x10(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x15158
movq 0xc97e(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
addl -0x30(%rbp), %edx
movl -0x8(%rbp), %ecx
movl -0xc(%rbp), %r8d
subl -0x30(%rbp), %r8d
movl -0x34(%rbp), %r9d
callq 0x63f0
movzwl 0x10(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x15189
movq 0xc94d(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
addl -0x34(%rbp), %ecx
movl -0x30(%rbp), %r8d
movl -0x10(%rbp), %r9d
subl -0x34(%rbp), %r9d
callq 0x63f0
movzwl 0x10(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x151c1
movq 0xc91c(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
addl -0x30(%rbp), %edx
movl -0x8(%rbp), %ecx
addl -0x34(%rbp), %ecx
movl -0xc(%rbp), %r8d
subl -0x30(%rbp), %r8d
movl -0x10(%rbp), %r9d
subl -0x34(%rbp), %r9d
callq 0x63f0
jmp 0x154d2
movzwl 0x10(%rbp), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x152e0
movw 0x10(%rbp), %ax
movzbl %al, %eax
movl %eax, -0x38(%rbp)
movq 0x2a37(%rip), %rax      # 0x17c20
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x8(%rax), %eax
imull -0x38(%rbp), %eax
movq -0x20(%rbp), %rcx
movzwl 0x8(%rcx), %ecx
movl $0x4, %edx
subl -0x38(%rbp), %edx
imull %edx, %ecx
addl %ecx, %eax
addl $0x2, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movw %ax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movzwl 0xa(%rax), %eax
imull -0x38(%rbp), %eax
movq -0x20(%rbp), %rcx
movzwl 0xa(%rcx), %ecx
movl $0x4, %edx
subl -0x38(%rbp), %edx
imull %edx, %ecx
addl %ecx, %eax
addl $0x2, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movw %ax, -0x4e(%rbp)
movq -0x18(%rbp), %rax
movzwl 0xc(%rax), %eax
imull -0x38(%rbp), %eax
movq -0x20(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
movl $0x4, %edx
subl -0x38(%rbp), %edx
imull %edx, %ecx
addl %ecx, %eax
addl $0x2, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movw %ax, -0x4c(%rbp)
movq 0xc824(%rip), %rdi      # 0x21aa8
movq 0xc835(%rip), %rsi      # 0x21ac0
movq 0xc81e(%rip), %rdx      # 0x21ab0
leaq -0x50(%rbp), %rcx
leaq -0x48(%rbp), %r8
callq 0x6740
movq 0xc812(%rip), %rdi      # 0x21ab8
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
movl -0xc(%rbp), %r8d
movl -0x10(%rbp), %r9d
leaq -0x48(%rbp), %rsi
callq 0x63f0
movq 0xc7e4(%rip), %rdi      # 0x21aa8
movq 0xc7f5(%rip), %rsi      # 0x21ac0
movq 0xc7de(%rip), %rdx      # 0x21ab0
leaq -0x48(%rbp), %rcx
callq 0x6610
jmp 0x154d0
movzwl -0x22(%rbp), %eax
cmpl $0x1800, %eax           # imm = 0x1800
jne 0x154ce
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x54(%rbp)
movl -0x10(%rbp), %eax
addl $0x2, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, -0x58(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x5c(%rbp)
imull $0x3, -0x10(%rbp), %eax
addl $0x2, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, -0x60(%rbp)
movzwl 0x10(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1535e
movq 0xc771(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
movl -0x54(%rbp), %r8d
movl -0x58(%rbp), %r9d
callq 0x63f0
movzwl 0x10(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1538f
movq 0xc747(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
addl -0x58(%rbp), %ecx
movl -0x54(%rbp), %r8d
movl -0x5c(%rbp), %r9d
subl -0x58(%rbp), %r9d
callq 0x63f0
movzwl 0x10(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x153c0
movq 0xc716(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
addl -0x5c(%rbp), %ecx
movl -0x54(%rbp), %r8d
movl -0x60(%rbp), %r9d
subl -0x5c(%rbp), %r9d
callq 0x63f0
movzwl 0x10(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x153f1
movq 0xc6e5(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
addl -0x54(%rbp), %edx
movl -0x8(%rbp), %ecx
movl -0xc(%rbp), %r8d
subl -0x54(%rbp), %r8d
movl -0x58(%rbp), %r9d
callq 0x63f0
movzwl 0x10(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x15429
movq 0xc6b4(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
addl -0x54(%rbp), %edx
movl -0x8(%rbp), %ecx
addl -0x58(%rbp), %ecx
movl -0xc(%rbp), %r8d
subl -0x54(%rbp), %r8d
movl -0x5c(%rbp), %r9d
subl -0x58(%rbp), %r9d
callq 0x63f0
movzwl 0x10(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x15461
movq 0xc67c(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
addl -0x54(%rbp), %edx
movl -0x8(%rbp), %ecx
addl -0x5c(%rbp), %ecx
movl -0xc(%rbp), %r8d
subl -0x54(%rbp), %r8d
movl -0x60(%rbp), %r9d
subl -0x5c(%rbp), %r9d
callq 0x63f0
movzwl 0x10(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x15492
movq 0xc644(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
addl -0x60(%rbp), %ecx
movl -0x54(%rbp), %r8d
movl -0x10(%rbp), %r9d
subl -0x60(%rbp), %r9d
callq 0x63f0
movzwl 0x10(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x154cc
movq 0xc611(%rip), %rdi      # 0x21ab8
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
addl -0x54(%rbp), %edx
movl -0x8(%rbp), %ecx
addl -0x60(%rbp), %ecx
movl -0xc(%rbp), %r8d
subl -0x54(%rbp), %r8d
movl -0x10(%rbp), %r9d
subl -0x60(%rbp), %r9d
callq 0x63f0
jmp 0x154ce
jmp 0x154d0
jmp 0x154d2
jmp 0x154d4
jmp 0x154d6
jmp 0x154d8
jmp 0x154da
jmp 0x154dc
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)