// File: /workspace/github_c_makefile_star2_O3/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 0x6fdb
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
testl %ecx, %ecx
je 0x6da5
movslq %ebp, %rax
movq %rax, 0x118(%rbx)
movw %r14w, 0x100(%rbx)
movswq %r14w, %rcx
leaq (%rcx,%rcx,8), %rcx
leaq 0x7f31(%rip), %rdx      # 0xebc0
leaq (%rdx,%rcx,8), %r15
movswl 0x8(%r15,%rax,8), %r12d
movswl 0xa(%r15,%rax,8), %esi
movswl 0xc(%r15,%rax,8), %r14d
movswl 0xe(%r15,%rax,8), %r13d
movq 0xa0(%rbx), %rax
cmpq 0x807f(%rip), %rax      # 0xed38
jne 0x6d67
movl 0x10(%rbx), %eax
movl 0x14(%rbx), %ecx
subl %eax, %r14d
movl %r14d, %edx
shrl $0x1f, %edx
addl %r14d, %edx
sarl %edx
addl %edx, %r12d
subl %ecx, %r13d
movl %r13d, %edx
shrl $0x1f, %edx
addl %r13d, %edx
sarl %edx
addl %edx, %esi
movl %esi, %ebp
movl 0x84d2(%rip), %edx      # 0xf1c0
leal (%rax,%rdx,2), %r14d
leal (%rcx,%rdx,2), %r13d
movl 0x84c4(%rip), %eax      # 0xf1c0
addl %eax, %eax
subl %eax, %r14d
subl %eax, %r13d
movq 0x7ea5(%rip), %rdi      # 0xebb0
movq (%rbx), %rsi
movq %rsp, %rdx
leaq 0x50(%rsp), %rcx
callq 0x30e0
testl %eax, %eax
je 0x6df0
movq (%rsp), %rcx
movl $0x10, %edx
movl $0x10, %eax
testb $0x10, %cl
je 0x6d3e
movl 0x18(%rsp), %edx
movl 0x1c(%rsp), %eax
cmpl %edx, %r14d
cmovgl %r14d, %edx
cmpl %eax, %r13d
cmovgl %r13d, %eax
testb $0x20, %cl
movl %ebp, %r10d
jne 0x6e7c
movswl 0x4(%r15), %r8d
movswl 0x6(%r15), %r9d
jmp 0x6e86
cmpw $0x0, 0x10a(%rbx)
je 0x6f05
movq 0x7e34(%rip), %rdi      # 0xebb0
movq (%rbx), %rsi
movswl (%r15), %edx
movswl 0x2(%r15), %ecx
movswl 0x4(%r15), %r8d
movswl 0x6(%r15), %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 0x6dfe
callq 0x6145
testq %rax, %rax
je 0x6dfe
movq %rax, %r15
cmpw $0x0, 0x104(%rax)
je 0x6dd7
movl 0x118(%r15), %ebp
movzwl 0x100(%r15), %r14d
movq 0x128(%r15), %rdi
callq 0x3220
movq %r15, %rdi
callq 0x3220
jmp 0x6c6e
movl %r14d, %r8d
movl %r13d, %r9d
movl %ebp, %r10d
jmp 0x6f86
cmpq $0x0, 0x98(%rbx)
je 0x6c6e
movq 0xa0(%rbx), %rax
cmpq 0x7f1e(%rip), %rax      # 0xed38
jne 0x6c6e
callq 0x604f
movswq 0x7f73(%rip), %rax      # 0xeda0
testq %rax, %rax
jle 0x6c6e
xorl %ecx, %ecx
leaq 0x7f61(%rip), %rdx      # 0xeda0
movq 0x8(%rdx,%rcx,8), %rsi
testq %rsi, %rsi
je 0x6e6f
cmpw $0x0, 0x104(%rsi)
je 0x6e6f
movq (%rsi), %rdi
cmpq (%rbx), %rdi
je 0x6e6f
movq 0x98(%rsi), %rdi
cmpq 0x98(%rbx), %rdi
je 0x702f
incq %rcx
cmpq %rcx, %rax
jne 0x6e3f
jmp 0x6c6e
movl 0x20(%rsp), %r8d
movl 0x24(%rsp), %r9d
cmpl %r8d, %edx
cmovll %edx, %r8d
cmpl %r9d, %eax
cmovll %eax, %r9d
testb $0x40, %cl
je 0x6ec8
xorl %edx, %edx
btl $0x8, %ecx
movl $0x0, %esi
jae 0x6eae
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 0x6f60
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 0x6f33
divsd %xmm2, %xmm1
cvttsd2si %xmm1, %r9d
jmp 0x6f60
cmpl $0x2, %ebp
jne 0x6fea
cmpw $0x0, 0x10e(%rbx)
je 0x6fea
movswl 0x6(%r15), %r13d
movswl 0x2(%r15), %eax
movl %esi, %ebp
subl %esi, %r13d
addl %eax, %r13d
jmp 0x6cf6
xorps %xmm1, %xmm1
cvtsi2sdl 0x38(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtsi2sdl 0x3c(%rsp), %xmm2
divsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x6f60
xorps %xmm0, %xmm0
cvtsi2sd %r9d, %xmm0
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %r8d
subl %r8d, %r14d
jle 0x6f73
movl %r14d, %eax
shrl $0x1f, %eax
addl %r14d, %eax
sarl %eax
addl %eax, %r12d
subl %r9d, %r13d
jle 0x6f86
movl %r13d, %eax
shrl $0x1f, %eax
addl %r13d, %eax
sarl %eax
addl %eax, %r10d
movswl (%r15), %eax
movswl 0x4(%r15), %ecx
movl 0x822b(%rip), %esi      # 0xf1c0
movl %eax, %edx
subl %r8d, %edx
addl %ecx, %edx
subl %esi, %edx
subl %esi, %edx
cmpl %edx, %r12d
cmovbl %r12d, %edx
cmpl %eax, %edx
cmovbel %eax, %edx
movswl 0x2(%r15), %eax
movswl 0x6(%r15), %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 0x7bdd(%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, %ebp
jne 0x6ffd
cmpw $0x0, 0x110(%rbx)
je 0x6ffd
movl %esi, %ebp
jmp 0x701e
cmpl $0x1, %ebp
jne 0x7028
cmpq $0x0, 0x120(%rbx)
je 0x7028
movswl 0x6(%r15), %r13d
movswl 0x2(%r15), %eax
movl %esi, %ebp
subl %esi, %r13d
addl %eax, %r13d
movswl 0x4(%r15), %r14d
jmp 0x6cf6
movl %esi, %ebp
jmp 0x6cf6
movl 0x118(%rsi), %ebp
movzwl 0x100(%rsi), %r14d
jmp 0x6c6e