// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
leaq 0x154f0(%rip), %rcx     # 0x18b60
xorl %eax, %eax
cmpq %rdi, (%rcx)
je 0x3689
incq %rax
addq $0x8, %rcx
cmpq $0x69, %rax
jne 0x3672
movl $0x69, %eax
cmpl $0x69, %eax
je 0x38ca
movl %eax, %ebp
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
leaq 0x4c9a(%rip), %rdx      # 0x8340
movslq (%rdx,%rcx,8), %r12
cmpl %r12d, 0x198bf(%rip)    # 0x1cf70
jne 0x3765
movb $0x1, %dil
xorl %esi, %esi
movq 0x1534d(%rip), %r8      # 0x18a10
testb $0x1, %dil
je 0x36e9
movl 0x15879(%rip), %edi     # 0x18f48
btl %esi, %edi
jae 0x36e9
movl %esi, %esi
leaq 0x19873(%rip), %rdi     # 0x1cf50
cmpl %eax, (%rdi,%rsi,4)
jne 0x36e9
movq 0x15337(%rip), %r8      # 0x18a20
movq %r8, 0x8(%rsp)
leaq (%rdx,%rcx,8), %rax
movq %rax, 0x18(%rsp)
leaq 0x15852(%rip), %rax     # 0x18f50
leaq (%rax,%r12,8), %r13
xorl %r14d, %r14d
xorl %ebx, %ebx
movq (%r13), %r15
testq %rbx, %rbx
jne 0x3734
testq %r15, %r15
jne 0x3734
cmpl $0x5e, %r12d
jne 0x3734
movq 0x150d6(%rip), %rdi     # 0x187f8
leaq 0x15437(%rip), %rax     # 0x18b60
movq (%rax,%rbp,8), %rsi
callq 0x2290
jmp 0x374c
testq %r15, %r15
je 0x374c
callq 0x23e0
movq (%rax), %rax
movsbq (%r15), %rcx
testb $0x2, 0x1(%rax,%rcx,2)
je 0x37b1
incq %rbx
addl $0x8, %r14d
addq $0x800, %r13            # imm = 0x800
cmpq $0x4, %rbx
jne 0x3707
jmp 0x38ca
movb $0x1, %dil
xorl %esi, %esi
leaq 0x19803(%rip), %r8      # 0x1cf74
cmpl %r12d, (%r8)
je 0x36bc
cmpl %r12d, 0x4(%r8)
je 0x36bc
cmpl %r12d, 0x8(%r8)
je 0x36bc
cmpq $0x7, %rsi
setb %dil
je 0x38d9
incq %rsi
leaq 0x40(%r8), %r9
cmpl %r12d, 0x3c(%r8)
movq %r9, %r8
jne 0x3771
jmp 0x36bc
testq %rbx, %rbx
jne 0x37d3
cmpl $0x5e, %r12d
jne 0x37d3
movq 0x15035(%rip), %rdi     # 0x187f8
leaq 0x15396(%rip), %rax     # 0x18b60
movq (%rax,%rbp,8), %rsi
callq 0x2330
cmpb $0x4b, (%r15)
movq %rbp, 0x10(%rsp)
jne 0x37ef
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
leaq 0x20(%rsp), %rbp
movq 0x18(%rsp), %r13
movq 0x14fed(%rip), %rdi     # 0x187f8
movq 0x15206(%rip), %rax     # 0x18a18
movq 0x8(%rax), %rsi
movq %r15, %rdx
movl %r12d, %ecx
movq %rbp, %r8
leaq 0x24(%rsp), %r9
leaq 0x2c(%rsp), %rax
pushq %rax
leaq 0x30(%rsp), %rax
pushq %rax
callq 0x22c0
addq $0x10, %rsp
movswl 0x30(%rsp), %esi
movl 0x151eb(%rip), %r9d     # 0x18a30
movl 0xc(%r13), %eax
imull %r9d, %eax
movl 0x151e1(%rip), %ecx     # 0x18a34
cltd
idivl %ecx
decl %r12d
cmpl %esi, %eax
jl 0x3804
movq 0x14f94(%rip), %rdi     # 0x187f8
movq 0x10(%rsp), %rax
leaq 0x152f0(%rip), %rdx     # 0x18b60
movq (%rdx,%rax,8), %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, %bl
movl $0xb, %eax
cmovel %edx, %eax
imull %r9d, %eax
cltd
idivl %ecx
subl %eax, %r8d
incl %r12d
subq $0x8, %rsp
movq 0x10(%rsp), %rdx
movl %r14d, %ecx
movq %r15, %r9
pushq %r12
callq 0x2270
addq $0x10, %rsp
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %esi
jmp 0x36bc