// File: /workspace/github_c_makefile_star2_O1/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 0x6f69
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
testl %ecx, %ecx
je 0x6d13
movslq %ebp, %rax
movq %rax, 0x118(%rbx)
movw %r14w, 0x100(%rbx)
movswq %r14w, %rcx
leaq (%rcx,%rcx,8), %rcx
leaq 0x7fb3(%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 0x8101(%rip), %rax      # 0xed38
jne 0x6cd5
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 0x8554(%rip), %edx      # 0xf1c0
leal (%rax,%rdx,2), %r14d
leal (%rcx,%rdx,2), %r13d
movl 0x8546(%rip), %eax      # 0xf1c0
addl %eax, %eax
subl %eax, %r14d
subl %eax, %r13d
movq 0x7f27(%rip), %rdi      # 0xebb0
movq (%rbx), %rsi
movq %rsp, %rdx
leaq 0x50(%rsp), %rcx
callq 0x30e0
movl %r14d, %r8d
movl %r13d, %r9d
testl %eax, %eax
je 0x6ef1
movq (%rsp), %rcx
movl $0x10, %r8d
testb $0x10, %cl
je 0x6cbb
movl 0x18(%rsp), %r8d
cmpl %r8d, %r14d
cmovgl %r14d, %r8d
testb $0x20, %cl
jne 0x6ddc
movswl 0x4(%r15), %eax
jmp 0x6de0
cmpw $0x0, 0x10a(%rbx)
je 0x6df1
movq 0x7ec6(%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 0x6d5e
callq 0x6148
testq %rax, %rax
je 0x6d5e
movq %rax, %r15
cmpw $0x0, 0x104(%rax)
je 0x6d45
movl 0x118(%r15), %ebp
movzwl 0x100(%r15), %r14d
movq 0x128(%r15), %rdi
callq 0x3220
movq %r15, %rdi
callq 0x3220
jmp 0x6bec
cmpq $0x0, 0x98(%rbx)
je 0x6bec
movq 0xa0(%rbx), %rax
cmpq 0x7fbe(%rip), %rax      # 0xed38
jne 0x6bec
callq 0x606d
movswq 0x8013(%rip), %rax      # 0xeda0
testq %rax, %rax
jle 0x6bec
xorl %ecx, %ecx
leaq 0x8001(%rip), %rdx      # 0xeda0
movq 0x8(%rdx,%rcx,8), %rsi
testq %rsi, %rsi
je 0x6dcf
cmpw $0x0, 0x104(%rsi)
je 0x6dcf
movq (%rsi), %rdi
cmpq (%rbx), %rdi
je 0x6dcf
movq 0x98(%rsi), %rdi
cmpq 0x98(%rbx), %rdi
je 0x6fbd
incq %rcx
cmpq %rcx, %rax
jne 0x6d9f
jmp 0x6bec
movl 0x20(%rsp), %eax
cmpl %eax, %r8d
jl 0x6e24
testb $0x20, %cl
jne 0x6e1f
movswl 0x4(%r15), %r8d
jmp 0x6e24
cmpl $0x2, %ebp
jne 0x6f78
cmpw $0x0, 0x10e(%rbx)
je 0x6f78
movswl 0x6(%r15), %r13d
movswl 0x2(%r15), %eax
movl %esi, %ebp
subl %esi, %r13d
addl %eax, %r13d
jmp 0x6c74
movl 0x20(%rsp), %r8d
movl $0x10, %r9d
testb $0x10, %cl
je 0x6e34
movl 0x1c(%rsp), %r9d
cmpl %r9d, %r13d
cmovgl %r13d, %r9d
testb $0x20, %cl
jne 0x6e47
movswl 0x6(%r15), %eax
jmp 0x6e4b
movl 0x24(%rsp), %eax
cmpl %eax, %r9d
jl 0x6e61
testb $0x20, %cl
jne 0x6e5c
movswl 0x6(%r15), %r9d
jmp 0x6e61
movl 0x24(%rsp), %r9d
testb $0x40, %cl
je 0x6e95
xorl %edx, %edx
btl $0x8, %ecx
movl $0x0, %esi
jae 0x6e7b
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 0x6ef1
cvtsi2sd %r8d, %xmm2
cvtsi2sd %r9d, %xmm0
movapd %xmm2, %xmm1
cvtsi2sdl 0x30(%rsp), %xmm3
cvtsi2sdl 0x34(%rsp), %xmm4
divsd %xmm0, %xmm1
divsd %xmm4, %xmm3
ucomisd %xmm1, %xmm3
jbe 0x6ecc
divsd %xmm3, %xmm2
cvttsd2si %xmm2, %r9d
jmp 0x6ef1
xorps %xmm2, %xmm2
cvtsi2sdl 0x38(%rsp), %xmm2
xorps %xmm3, %xmm3
cvtsi2sdl 0x3c(%rsp), %xmm3
divsd %xmm3, %xmm2
ucomisd %xmm2, %xmm1
jbe 0x6ef1
mulsd %xmm0, %xmm2
cvttsd2si %xmm2, %r8d
subl %r8d, %r14d
jle 0x6f04
movl %r14d, %eax
shrl $0x1f, %eax
addl %r14d, %eax
sarl %eax
addl %eax, %r12d
subl %r9d, %r13d
jle 0x6f16
movl %r13d, %eax
shrl $0x1f, %eax
addl %r13d, %eax
sarl %eax
addl %eax, %ebp
movswl (%r15), %eax
movswl 0x4(%r15), %ecx
movl 0x829b(%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, %ebp
cmovbl %ebp, %ecx
cmpl %eax, %ecx
cmovbel %eax, %ecx
movq 0x7c4f(%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 0x6f8b
cmpw $0x0, 0x110(%rbx)
je 0x6f8b
movl %esi, %ebp
jmp 0x6fac
cmpl $0x1, %ebp
jne 0x6fb6
cmpq $0x0, 0x120(%rbx)
je 0x6fb6
movswl 0x6(%r15), %r13d
movswl 0x2(%r15), %eax
movl %esi, %ebp
subl %esi, %r13d
addl %eax, %r13d
movswl 0x4(%r15), %r14d
jmp 0x6c74
movl %esi, %ebp
jmp 0x6c74
movl 0x118(%rsi), %ebp
movzwl 0x100(%rsi), %r14d
jmp 0x6bec