// File: /workspace/github_c_makefile_star2_O2/kyx0r[P]xkeyboard/xkeyboard.c
// Function: redraw_window
void redraw_window(Window exposed)
{
	int i, j, mod = 0, s;
	GC keygc;
	char *name;

	for (i = 0; i < MAX_KEYS; i++) {
		if (exposed == mykey[i]) {
			break;
		}
	}
	if (i == MAX_KEYS) {
		return;
	}
	s = xk[i].scancode;
	for (j = 0; j < 8; j++) {
		if (modifiermap[j][0] == s)
			break;
		if (modifiermap[j][1] == s)
			break;
		if (modifiermap[j][2] == s)
			break;
		if (modifiermap[j][3] == s)
			break;
	}
	keygc = mygc;
	if (j < 8) {
		if ((keystate & (1<< j)) && modindex[j] == i)
			keygc = mygcled;
	}
	for (mod = 0; mod < 4; mod++) {
		name = scanname[mod][s];
		if (!mod && !name && s == 94) {
			XUnmapWindow(dpy, mykey[i]);
		} else {
			if (!name)
				continue;
			if (islower(*name))
				continue;
			if (!mod && s == 94)
				XMapWindow(dpy, mykey[i]);
			if (name[0] == 'K' && name[1] == 'P')
				name += 3;
			int len = strlen(name);
			int dummy[3];
			XCharStruct schar;
redo:
			XQueryTextExtents(dpy, font_struct->fid, name, len,
					&dummy[0], &dummy[1], &dummy[2], &schar);
			if(schar.width > xk[i].w * sn / sd)
			{
				len--;
				goto redo;
			}
			XDrawString(dpy, mykey[i], keygc,
				8 * sn / sd + 8 * (mod & 2),
				26 * sn / sd - (11 * (mod & 1)) * sn / sd,
				name, len);
			break;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x14591(%rip), %rbx     # 0x17b60
leaq 0x3d6a(%rip), %r8       # 0x7340
xorl %eax, %eax
cmpq $0x69, %rax
je 0x37c1
cmpq %rdi, (%rbx)
je 0x35f4
incq %rax
addq $0x8, %rbx
addq $0x18, %r8
jmp 0x35d8
movslq (%r8), %r12
leaq 0x18952(%rip), %rcx     # 0x1bf50
leaq 0x18977(%rip), %rsi     # 0x1bf7c
xorl %edx, %edx
cmpq $0x8, %rdx
je 0x3654
cmpl %r12d, -0xc(%rsi)
je 0x3631
cmpl %r12d, -0x8(%rsi)
je 0x3631
cmpl %r12d, -0x4(%rsi)
je 0x3631
cmpl %r12d, (%rsi)
je 0x3631
incq %rdx
addq $0x4, %rcx
addq $0x40, %rsi
jmp 0x3607
movq 0x143d8(%rip), %rdi     # 0x17a10
movl 0x1490a(%rip), %esi     # 0x17f48
btl %edx, %esi
jae 0x364e
cmpl %eax, (%rcx)
jne 0x364e
movq 0x143d2(%rip), %rdi     # 0x17a20
movq %rdi, (%rsp)
jmp 0x365f
movq 0x143b5(%rip), %rax     # 0x17a10
movq %rax, (%rsp)
leaq 0x148ea(%rip), %rax     # 0x17f50
leaq (%rax,%r12,8), %r14
xorl %r13d, %r13d
xorl %ebp, %ebp
movq %r8, 0x8(%rsp)
cmpq $0x4, %rbp
je 0x37c1
movq (%r14), %r15
testq %rbp, %rbp
jne 0x36a2
testq %r15, %r15
jne 0x36a2
cmpl $0x5e, %r12d
jne 0x36a2
movq 0x14160(%rip), %rdi     # 0x177f8
movq (%rbx), %rsi
callq 0x2290
jmp 0x36ba
testq %r15, %r15
je 0x36ba
callq 0x23e0
movq (%rax), %rcx
movsbq (%r15), %rax
testb $0x2, 0x1(%rcx,%rax,2)
je 0x36ca
incq %rbp
addl $0x8, %r13d
addq $0x800, %r14            # imm = 0x800
jmp 0x3674
testq %rbp, %rbp
jne 0x36e7
cmpl $0x5e, %r12d
jne 0x36e7
movq 0x1411c(%rip), %rdi     # 0x177f8
movq (%rbx), %rsi
callq 0x2330
movb (%r15), %al
cmpb $0x4b, %al
jne 0x36fc
xorl %eax, %eax
cmpb $0x50, 0x1(%r15)
sete %al
leaq (%rax,%rax,2), %rax
addq %rax, %r15
movq %r15, %rdi
callq 0x20c0
movq %rax, %r12
movq 0x8(%rsp), %r14
movq 0x140e5(%rip), %rdi     # 0x177f8
movq 0x142fe(%rip), %rax     # 0x17a18
movq 0x8(%rax), %rsi
movq %r15, %rdx
movl %r12d, %ecx
leaq 0x10(%rsp), %r8
leaq 0x14(%rsp), %r9
leaq 0x1c(%rsp), %rax
pushq %rax
leaq 0x20(%rsp), %rax
pushq %rax
callq 0x22c0
popq %rcx
popq %rdx
movswl 0x20(%rsp), %esi
movl 0x142e3(%rip), %r9d     # 0x17a30
movl 0xc(%r14), %eax
imull %r9d, %eax
movl 0x142d8(%rip), %r10d    # 0x17a34
cltd
idivl %r10d
decl %r12d
cmpl %esi, %eax
jl 0x370c
movq 0x1408a(%rip), %rdi     # 0x177f8
movq (%rbx), %rsi
leal (,%r9,8), %eax
cltd
idivl %r10d
andl $0x10, %r13d
addl %eax, %r13d
imull $0x1a, %r9d, %eax
cltd
idivl %r10d
movl %eax, %r8d
xorl %edx, %edx
testb $0x1, %bpl
pushq $0xb
popq %rax
cmovel %edx, %eax
imull %r9d, %eax
cltd
idivl %r10d
subl %eax, %r8d
incl %r12d
subq $0x8, %rsp
movq 0x8(%rsp), %rdx
movl %r13d, %ecx
movq %r15, %r9
pushq %r12
callq 0x2270
popq %rcx
popq %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq