// File: /workspace/github_c_makefile_star2_O3/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 0x154f0(%rip), %rbx     # 0x18b60
leaq 0x4cc9(%rip), %r13      # 0x8340
xorl %eax, %eax
cmpq %rdi, (%rbx)
je 0x3694
incq %rax
addq $0x8, %rbx
addq $0x18, %r13
cmpq $0x69, %rax
jne 0x3679
jmp 0x3864
movslq (%r13), %r8
leaq 0x198b1(%rip), %rcx     # 0x1cf50
leaq 0x198d6(%rip), %rsi     # 0x1cf7c
xorl %edx, %edx
cmpl %r8d, -0xc(%rsi)
je 0x36dd
cmpl %r8d, -0x8(%rsi)
je 0x36dd
cmpl %r8d, -0x4(%rsi)
je 0x36dd
cmpl %r8d, (%rsi)
je 0x36dd
incq %rdx
addq $0x4, %rcx
addq $0x40, %rsi
cmpq $0x8, %rdx
jne 0x36a8
movq 0x15339(%rip), %rax     # 0x18a10
movq %rax, (%rsp)
jmp 0x36fe
movq 0x1532c(%rip), %rdi     # 0x18a10
movl 0x1585e(%rip), %esi     # 0x18f48
btl %edx, %esi
jae 0x36fa
cmpl %eax, (%rcx)
jne 0x36fa
movq 0x15326(%rip), %rdi     # 0x18a20
movq %rdi, (%rsp)
leaq 0x1584b(%rip), %rax     # 0x18f50
movq %r8, 0x8(%rsp)
leaq (%rax,%r8,8), %r12
xorl %r14d, %r14d
xorl %ebp, %ebp
movq (%r12), %r15
testq %rbp, %rbp
jne 0x3739
testq %r15, %r15
jne 0x3739
cmpl $0x5e, 0x8(%rsp)
jne 0x3739
movq 0x150c9(%rip), %rdi     # 0x187f8
movq (%rbx), %rsi
callq 0x2290
jmp 0x3751
testq %r15, %r15
je 0x3751
callq 0x23e0
movq (%rax), %rcx
movsbq (%r15), %rax
testb $0x2, 0x1(%rcx,%rax,2)
je 0x376a
incq %rbp
addl $0x8, %r14d
addq $0x800, %r12            # imm = 0x800
cmpq $0x4, %rbp
jne 0x3713
jmp 0x3864
testq %rbp, %rbp
jne 0x3788
cmpl $0x5e, 0x8(%rsp)
jne 0x3788
movq 0x1507b(%rip), %rdi     # 0x187f8
movq (%rbx), %rsi
callq 0x2330
movb (%r15), %al
cmpb $0x4b, %al
jne 0x379d
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 0x15049(%rip), %rdi     # 0x187f8
movq 0x15262(%rip), %rax     # 0x18a18
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
addq $0x10, %rsp
movswl 0x20(%rsp), %esi
movl 0x15245(%rip), %r9d     # 0x18a30
movl 0xc(%r13), %eax
imull %r9d, %eax
movl 0x1523b(%rip), %ecx     # 0x18a34
cltd
idivl %ecx
decl %r12d
cmpl %esi, %eax
jl 0x37a8
movq 0x14fee(%rip), %rdi     # 0x187f8
movq (%rbx), %rsi
leal (,%r9,8), %eax
cltd
idivl %ecx
andl $0x10, %r14d
addl %eax, %r14d
leal (%r9,%r9,4), %eax
leal (%rax,%rax,4), %eax
addl %r9d, %eax
cltd
idivl %ecx
movl %eax, %r8d
xorl %edx, %edx
testb $0x1, %bpl
movl $0xb, %eax
cmovel %edx, %eax
imull %r9d, %eax
cltd
idivl %ecx
subl %eax, %r8d
incl %r12d
subq $0x8, %rsp
movq 0x8(%rsp), %rdx
movl %r14d, %ecx
movq %r15, %r9
pushq %r12
callq 0x2270
addq $0x10, %rsp
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq