// File: /workspace/github_c_makefile_star2_O2/yugecin[P]evilwm/screen.c
// Function: maximise_client
void maximise_client(Client *c, int action, int hv) {
	if (hv & MAXIMISE_GAPS) {
		c->gapindex++;
		if (c->gapindex >= opt_numgaps) {
			c->gapindex = -1;
		} else if (c->gapindex) {
			// it's already maximised, just need to apply gaps
			c->x = 0;
			c->width = DisplayWidth(dpy, c->screen->screen);
			c->y = 0;
			c->height = DisplayHeight(dpy, c->screen->screen);
			goto skip_wm_state;
		}
	}

	if (hv & MAXIMISE_HORZ) {
		if (c->oldw) {
			if (action == NET_WM_STATE_REMOVE
					|| action == NET_WM_STATE_TOGGLE) {
				c->x = c->oldx;
				c->width = c->oldw;
				c->oldw = 0;
				XDeleteProperty(dpy, c->window, xa_evilwm_unmaximised_horz);
				c->gapindex = -1;
			}
		} else {
			if (action == NET_WM_STATE_ADD
					|| action == NET_WM_STATE_TOGGLE) {
				unsigned long props[2];
				c->oldx = c->x;
				c->oldw = c->width;
				c->x = 0;
				c->width = DisplayWidth(dpy, c->screen->screen);
				props[0] = c->oldx;
				props[1] = c->oldw;
				XChangeProperty(dpy, c->window, xa_evilwm_unmaximised_horz,
						XA_CARDINAL, 32, PropModeReplace,
						(unsigned char *)&props, 2);
			}
		}
	}
	if (hv & MAXIMISE_VERT) {
		if (c->oldh) {
			if (action == NET_WM_STATE_REMOVE
					|| action == NET_WM_STATE_TOGGLE) {
				c->y = c->oldy;
				c->height = c->oldh;
				c->oldh = 0;
				XDeleteProperty(dpy, c->window, xa_evilwm_unmaximised_vert);
				c->gapindex = -1;
			}
		} else {
			if (action == NET_WM_STATE_ADD
					|| action == NET_WM_STATE_TOGGLE) {
				unsigned long props[2];
				c->oldy = c->y;
				c->oldh = c->height;
				c->y = 0;
				c->height = DisplayHeight(dpy, c->screen->screen);
				props[0] = c->oldy;
				props[1] = c->oldh;
				XChangeProperty(dpy, c->window, xa_evilwm_unmaximised_vert,
						XA_CARDINAL, 32, PropModeReplace,
						(unsigned char *)&props, 2);
			}
		}
	}
	ewmh_set_net_wm_state(c);
skip_wm_state:
	if (hv & MAXIMISE_GAPS) {
		apply_gaps(c);
	}
	moveresize(c);
	discard_enter_events(c);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
testb $0x4, %bpl
je 0x7af1
movl 0x38(%rbx), %eax
incl %eax
movl %eax, 0x38(%rbx)
leaq 0x5dbf(%rip), %rcx      # 0xd870
cmpl (%rcx), %eax
jge 0x7aed
testl %eax, %eax
je 0x7af1
andl $0x0, 0x24(%rbx)
leaq 0x5e1c(%rip), %rcx      # 0xd8e0
movq (%rcx), %rcx
movq 0xe8(%rcx), %rcx
movq 0x10(%rbx), %rdx
movslq (%rdx), %rdx
andl $0x0, 0x28(%rbx)
shlq $0x7, %rdx
movq 0x18(%rcx,%rdx), %rcx
movq %rcx, 0x2c(%rbx)
xorl %esi, %esi
jmp 0x7c8c
orl $-0x1, 0x38(%rbx)
testb $0x1, %bpl
je 0x7ba8
movl 0x44(%rbx), %eax
testl %eax, %eax
je 0x7b3e
testl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
jne 0x7ba8
movl 0x3c(%rbx), %ecx
movl %ecx, 0x24(%rbx)
movl %eax, 0x2c(%rbx)
andl $0x0, 0x44(%rbx)
leaq 0x5dbd(%rip), %rax      # 0xd8e0
movq (%rax), %rdi
movq (%rbx), %rsi
leaq 0x5bd0(%rip), %rax      # 0xd700
movq (%rax), %rdx
callq 0x3230
orl $-0x1, 0x38(%rbx)
jmp 0x7ba8
leal -0x1(%r14), %eax
cmpl $0x1, %eax
ja 0x7ba8
movslq 0x24(%rbx), %rax
movl %eax, 0x3c(%rbx)
movslq 0x2c(%rbx), %rcx
movl %ecx, 0x44(%rbx)
andl $0x0, 0x24(%rbx)
leaq 0x5d80(%rip), %rdx      # 0xd8e0
movq (%rdx), %rdi
movq 0xe8(%rdi), %rdx
movq 0x10(%rbx), %rsi
movslq (%rsi), %rsi
shlq $0x7, %rsi
movl 0x18(%rdx,%rsi), %edx
movl %edx, 0x2c(%rbx)
movq %rsp, %r10
movq %rax, (%r10)
movq %rcx, 0x8(%r10)
movq (%rbx), %rsi
leaq 0x5b70(%rip), %rax      # 0xd700
movq (%rax), %rdx
pushq $0x6
popq %rcx
pushq $0x20
popq %r8
xorl %r9d, %r9d
pushq $0x2
pushq %r10
callq 0x3460
popq %rcx
popq %rdx
testb $0x2, %bpl
je 0x7c5f
movl 0x48(%rbx), %eax
testl %eax, %eax
je 0x7bf5
testl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
jne 0x7c5f
movl 0x40(%rbx), %ecx
movl %ecx, 0x28(%rbx)
movl %eax, 0x30(%rbx)
andl $0x0, 0x48(%rbx)
leaq 0x5d06(%rip), %rax      # 0xd8e0
movq (%rax), %rdi
movq (%rbx), %rsi
leaq 0x5b21(%rip), %rax      # 0xd708
movq (%rax), %rdx
callq 0x3230
orl $-0x1, 0x38(%rbx)
jmp 0x7c5f
decl %r14d
cmpl $0x1, %r14d
ja 0x7c5f
movslq 0x28(%rbx), %rax
movl %eax, 0x40(%rbx)
movslq 0x30(%rbx), %rcx
movl %ecx, 0x48(%rbx)
andl $0x0, 0x28(%rbx)
leaq 0x5cc9(%rip), %rdx      # 0xd8e0
movq (%rdx), %rdi
movq 0xe8(%rdi), %rdx
movq 0x10(%rbx), %rsi
movslq (%rsi), %rsi
shlq $0x7, %rsi
movl 0x1c(%rdx,%rsi), %edx
movl %edx, 0x30(%rbx)
movq %rsp, %r10
movq %rax, (%r10)
movq %rcx, 0x8(%r10)
movq (%rbx), %rsi
leaq 0x5ac1(%rip), %rax      # 0xd708
movq (%rax), %rdx
pushq $0x6
popq %rcx
pushq $0x20
popq %r8
xorl %r9d, %r9d
pushq $0x2
pushq %r10
callq 0x3460
popq %rcx
popq %rdx
movq %rbx, %rdi
callq 0x57e0
testb $0x4, %bpl
jne 0x7c86
movq %rbx, %rdi
callq 0x7184
movq %rbx, %rdi
callq 0x648d
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl 0x28(%rbx), %esi
movl 0x38(%rbx), %eax
shll $0x2, %eax
cltq
leaq 0x5be8(%rip), %rcx      # 0xd880
movl (%rcx,%rax,4), %edx
cmpl %edx, %esi
jge 0x7ca4
movl %edx, 0x28(%rbx)
movl %edx, %esi
movl 0x24(%rbx), %edx
movl 0xc(%rcx,%rax,4), %edi
cmpl %edi, %edx
jge 0x7cb4
movl %edi, 0x24(%rbx)
movl %edi, %edx
movl 0x30(%rbx), %r9d
leaq 0x5c21(%rip), %rdi      # 0xd8e0
movq (%rdi), %rdi
movq 0xe8(%rdi), %rdi
movq 0x10(%rbx), %r8
movslq (%r8), %r8
shlq $0x7, %r8
leal (%r9,%rsi), %r10d
subl 0x1c(%rdi,%r8), %r10d
addl 0x8(%rcx,%rax,4), %r10d
testl %r10d, %r10d
jle 0x7d02
cmpl (%rcx,%rax,4), %esi
jle 0x7cf6
decl %esi
movl %esi, 0x28(%rbx)
decl %r10d
jmp 0x7ce2
decl %r9d
movl %r9d, 0x30(%rbx)
decl %r10d
jmp 0x7ce2
movl 0x2c(%rbx), %esi
leal (%rsi,%rdx), %r9d
subl 0x18(%rdi,%r8), %r9d
addl 0x4(%rcx,%rax,4), %r9d
testl %r9d, %r9d
jle 0x7c6d
cmpl 0xc(%rcx,%rax,4), %edx
jle 0x7d2c
decl %edx
movl %edx, 0x24(%rbx)
decl %r9d
jmp 0x7d13
decl %esi
movl %esi, 0x2c(%rbx)
decl %r9d
jmp 0x7d13