// File: /workspace/github_c_makefile_star2_O2/seanpringle[P]xoat/./client.c
// Function: client_place_spot
void client_place_spot(Client *c, int spot, int mon, int force)
{
	if (!c) return;
	int i; Client *t;

	// try to center over our transient parent
	if (!force && c->transient && (t = window_build_client(c->transient)))
	{
		if (t->manage)
		{
			spot = t->spot;
			mon = t->monitor;
		}
		client_free(t);
	}
	else
	// try to center over top-most window in our group
	if (!force && c->leader && c->type == atoms[_NET_WM_WINDOW_TYPE_DIALOG])
	{
		for_windows(i, t) if (t->manage && t->window != c->window && t->leader == c->leader)
		{
			spot = t->spot;
			mon = t->monitor;
			break;
		}
	}
	c->spot = spot; c->monitor = mon;

	Monitor *m = &monitors[c->monitor];
	int x = m->spots[spot].x, y = m->spots[spot].y, w = m->spots[spot].w, h = m->spots[spot].h;

	if (c->type == atoms[_NET_WM_WINDOW_TYPE_DIALOG])
	{
		x += (w - c->attr.width)/2;
		y += (h - c->attr.height)/2;
		w = c->attr.width + settings.border * 2;
		h = c->attr.height + settings.border * 2;
	}
	else
	if (c->full)
	{
		XMoveResizeWindow(display, c->window, m->x, m->y, m->w, m->h);
		return;
	}
	else
	// _NET_WM_STATE_MAXIMIZE_VERT may apply to a window in spot2
	if (c->maxv && spot == SPOT2)
	{
		h = m->h - (y - m->y);
	}
	else
	// _NET_WM_STATE_MAXIMIZE_HORZ may apply to a window in spot3
	if (c->maxh && spot == SPOT3)
	{
		w = m->w;
	}
	else
	if (c->max && spot == SPOT1)
	{
		h = m->h - (y - m->y);
		w = m->w;
	}

	w -= settings.border * 2; h -= settings.border * 2;
	int sw = w, sh = h; long sr; XSizeHints size;

	if (XGetWMNormalHints(display, c->window, &size, &sr))
	{
		w = MIN(MAX(w, size.flags & PMinSize ? size.min_width : 16), size.flags & PMaxSize ? size.max_width : m->w);
		h = MIN(MAX(h, size.flags & PMinSize ? size.min_height: 16), size.flags & PMaxSize ? size.max_height: m->h);

		if (size.flags & PResizeInc)
		{
			w -= (w - (size.flags & PBaseSize ? size.base_width : 0)) % size.width_inc;
			h -= (h - (size.flags & PBaseSize ? size.base_height: 0)) % size.height_inc;
		}
		if (size.flags & PAspect)
		{
			double ratio = (double) w / h;
			double minr  = (double) size.min_aspect.x / size.min_aspect.y;
			double maxr  = (double) size.max_aspect.x / size.max_aspect.y;
				if (ratio < minr) h = (int)(w / minr);
			else if (ratio > maxr) w = (int)(h * maxr);
		}
	}
	// center if smaller than supplied size
	if (w < sw) x += (sw-w)/2;
	if (h < sh) y += (sh-h)/2;

	// bump onto screen
	x = MAX(m->x, MIN(x, m->x + m->w - w - settings.border * 2));
	y = MAX(m->y, MIN(y, m->y + m->h - h - settings.border * 2));

	XMoveResizeWindow(display, c->window, x, y, w, h);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
testq %rdi, %rdi
je 0x6467
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
testl %ecx, %ecx
je 0x6212
movslq %r15d, %rax
movq %rax, 0x118(%rbx)
movw %r14w, 0x100(%rbx)
movswq %r14w, %rcx
imulq $0x48, %rcx, %rcx
leaq 0x8a8e(%rip), %r12      # 0xebc0
addq %rcx, %r12
movswl 0x8(%r12,%rax,8), %r13d
movswl 0xa(%r12,%rax,8), %edi
movswl 0xc(%r12,%rax,8), %r14d
movswl 0xe(%r12,%rax,8), %ebp
movq 0xa0(%rbx), %rax
pushq $0x2
popq %r8
cmpq 0x8bd9(%rip), %rax      # 0xed38
jne 0x61d0
movl 0x10(%rbx), %ecx
movl 0x14(%rbx), %esi
subl %ecx, %r14d
movl %r14d, %eax
cltd
idivl %r8d
addl %eax, %r13d
subl %esi, %ebp
movl %ebp, %eax
cltd
idivl %r8d
addl %eax, %edi
movl %edi, %r15d
movl 0x9039(%rip), %eax      # 0xf1c0
leal (%rcx,%rax,2), %r14d
leal (%rsi,%rax,2), %ebp
movl 0x902c(%rip), %eax      # 0xf1c0
addl %eax, %eax
subl %eax, %r14d
subl %eax, %ebp
movq 0x8a0e(%rip), %rdi      # 0xebb0
movq (%rbx), %rsi
movq %rsp, %rdx
leaq 0x50(%rsp), %rcx
callq 0x30e0
testl %eax, %eax
je 0x624e
movq (%rsp), %rcx
testb $0x10, %cl
je 0x62d9
movl 0x18(%rsp), %eax
jmp 0x62dc
cmpw $0x0, 0x10a(%rbx)
je 0x639f
movq 0x89cb(%rip), %rdi      # 0xebb0
movq (%rbx), %rsi
movswl (%r12), %edx
movswl 0x2(%r12), %ecx
movswl 0x4(%r12), %r8d
movswl 0x6(%r12), %r9d
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3300
movq 0x90(%rbx), %rdi
testq %rdi, %rdi
je 0x625c
callq 0x56d6
testq %rax, %rax
je 0x625c
cmpw $0x0, 0x104(%rax)
je 0x6241
movl 0x118(%rax), %r15d
movzwl 0x100(%rax), %r14d
movq %rax, %rdi
callq 0x5dae
jmp 0x6111
movl %r14d, %r8d
movl %ebp, %r9d
movl %r15d, %r10d
jmp 0x640e
cmpq $0x0, 0x98(%rbx)
je 0x6111
movq 0xa0(%rbx), %rax
cmpq 0x8ac0(%rip), %rax      # 0xed38
jne 0x6111
callq 0x5607
movl 0x8b17(%rip), %ecx      # 0xeda0
xorl %eax, %eax
testw %cx, %cx
cmovlel %eax, %ecx
movzwl %cx, %ecx
leaq 0x8b05(%rip), %rdx      # 0xeda0
cmpq %rax, %rcx
je 0x6111
movq 0x8(%rdx,%rax,8), %rsi
testq %rsi, %rsi
je 0x62d4
cmpw $0x0, 0x104(%rsi)
je 0x62d4
movq (%rsi), %rdi
cmpq (%rbx), %rdi
je 0x62d4
movq 0x98(%rsi), %rdi
cmpq 0x98(%rbx), %rdi
je 0x64c1
incq %rax
jmp 0x629b
pushq $0x10
popq %rax
movl %r15d, %r10d
pushq $0x2
popq %rdi
cmpl %eax, %r14d
cmovgl %r14d, %eax
testb $0x20, %cl
jne 0x62f6
movswl 0x4(%r12), %r8d
jmp 0x62fb
movl 0x20(%rsp), %r8d
cmpl %r8d, %eax
cmovll %eax, %r8d
testb $0x10, %cl
je 0x630d
movl 0x1c(%rsp), %eax
jmp 0x6310
pushq $0x10
popq %rax
cmpl %eax, %ebp
cmovgl %ebp, %eax
testb $0x20, %cl
jne 0x6322
movswl 0x6(%r12), %r9d
jmp 0x6327
movl 0x24(%rsp), %r9d
cmpl %r9d, %eax
cmovll %eax, %r9d
testb $0x40, %cl
je 0x6362
xorl %edx, %edx
btl $0x8, %ecx
movl $0x0, %esi
jae 0x6348
movl 0x40(%rsp), %edx
movl 0x44(%rsp), %esi
movl %r8d, %eax
subl %edx, %eax
cltd
idivl 0x28(%rsp)
subl %edx, %r8d
movl %r9d, %eax
subl %esi, %eax
cltd
idivl 0x2c(%rsp)
subl %edx, %r9d
testb %cl, %cl
jns 0x63f3
cvtsi2sd %r8d, %xmm1
cvtdq2pd 0x30(%rsp), %xmm2
movapd %xmm1, %xmm0
unpcklpd %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
cvtsi2sd %r9d, %xmm2
divpd %xmm2, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
ucomisd %xmm0, %xmm2
jbe 0x63cf
divsd %xmm2, %xmm1
cvttsd2si %xmm1, %r9d
jmp 0x63f3
cmpl $0x2, %r15d
jne 0x6476
cmpw $0x0, 0x10e(%rbx)
je 0x6476
movswl 0x6(%r12), %ebp
movswl 0x2(%r12), %eax
movl %edi, %r15d
subl %edi, %ebp
addl %eax, %ebp
jmp 0x618e
cvtsi2sdl 0x38(%rsp), %xmm1
cvtsi2sdl 0x3c(%rsp), %xmm2
divsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x63f3
cvtsi2sd %r9d, %xmm0
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %r8d
subl %r8d, %r14d
jle 0x6401
movl %r14d, %eax
cltd
idivl %edi
addl %eax, %r13d
subl %r9d, %ebp
jle 0x640e
movl %ebp, %eax
cltd
idivl %edi
addl %eax, %r10d
movswl (%r12), %eax
movswl 0x4(%r12), %ecx
movl 0x8da1(%rip), %esi      # 0xf1c0
movl %eax, %edx
subl %r8d, %edx
addl %ecx, %edx
subl %esi, %edx
subl %esi, %edx
cmpl %edx, %r13d
cmovbl %r13d, %edx
cmpl %eax, %edx
cmovbel %eax, %edx
movswl 0x2(%r12), %eax
movswl 0x6(%r12), %edi
leal (%r9,%rsi,2), %esi
movl %eax, %ecx
subl %esi, %ecx
addl %edi, %ecx
cmpl %ecx, %r10d
cmovbl %r10d, %ecx
cmpl %eax, %ecx
cmovbel %eax, %ecx
movq 0x8751(%rip), %rdi      # 0xebb0
movq (%rbx), %rsi
callq 0x3300
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3, %r15d
jne 0x648b
cmpw $0x0, 0x110(%rbx)
je 0x648b
movl %edi, %r15d
jmp 0x64ae
cmpl $0x1, %r15d
jne 0x64b9
cmpq $0x0, 0x120(%rbx)
je 0x64b9
movswl 0x6(%r12), %ebp
movswl 0x2(%r12), %eax
movl %edi, %r15d
subl %edi, %ebp
addl %eax, %ebp
movswl 0x4(%r12), %r14d
jmp 0x618e
movl %edi, %r15d
jmp 0x618e
movl 0x118(%rsi), %r15d
movzwl 0x100(%rsi), %r14d
jmp 0x6111