// File: /workspace/github_c_makefile_star2_O3/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 0x7eb1
movl 0x38(%rbx), %eax
incl %eax
movl %eax, 0x38(%rbx)
leaq 0x4a00(%rip), %rcx      # 0xc870
cmpl (%rcx), %eax
jge 0x7eaa
testl %eax, %eax
je 0x7eb1
xorl %esi, %esi
movl %esi, 0x24(%rbx)
leaq 0x4a5c(%rip), %rcx      # 0xc8e0
movq (%rcx), %rcx
movq 0xe8(%rcx), %rcx
movq 0x10(%rbx), %rdx
movslq (%rdx), %rdx
shlq $0x7, %rdx
movl %esi, 0x28(%rbx)
movq 0x18(%rcx,%rdx), %rcx
movq %rcx, 0x2c(%rbx)
jmp 0x8055
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
testb $0x1, %bpl
je 0x7f77
movl 0x44(%rbx), %eax
testl %eax, %eax
je 0x7f04
testl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
jne 0x7f77
movl 0x3c(%rbx), %ecx
movl %ecx, 0x24(%rbx)
movl %eax, 0x2c(%rbx)
movl $0x0, 0x44(%rbx)
leaq 0x49fa(%rip), %rax      # 0xc8e0
movq (%rax), %rdi
movq (%rbx), %rsi
leaq 0x480d(%rip), %rax      # 0xc700
movq (%rax), %rdx
callq 0x3230
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
jmp 0x7f77
leal -0x1(%r14), %eax
cmpl $0x1, %eax
ja 0x7f77
movslq 0x24(%rbx), %rax
movl %eax, 0x3c(%rbx)
movslq 0x2c(%rbx), %rcx
movl %ecx, 0x44(%rbx)
movl $0x0, 0x24(%rbx)
leaq 0x49b7(%rip), %rdx      # 0xc8e0
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 0x47a7(%rip), %rax      # 0xc700
movq (%rax), %rdx
movl $0x6, %ecx
movl $0x20, %r8d
xorl %r9d, %r9d
pushq $0x2
pushq %r10
callq 0x3460
addq $0x10, %rsp
testb $0x2, %bpl
je 0x803d
movl 0x48(%rbx), %eax
testl %eax, %eax
je 0x7fca
testl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
jne 0x803d
movl 0x40(%rbx), %ecx
movl %ecx, 0x28(%rbx)
movl %eax, 0x30(%rbx)
movl $0x0, 0x48(%rbx)
leaq 0x4934(%rip), %rax      # 0xc8e0
movq (%rax), %rdi
movq (%rbx), %rsi
leaq 0x474f(%rip), %rax      # 0xc708
movq (%rax), %rdx
callq 0x3230
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
jmp 0x803d
decl %r14d
cmpl $0x1, %r14d
ja 0x803d
movslq 0x28(%rbx), %rax
movl %eax, 0x40(%rbx)
movslq 0x30(%rbx), %rcx
movl %ecx, 0x48(%rbx)
movl $0x0, 0x28(%rbx)
leaq 0x48f1(%rip), %rdx      # 0xc8e0
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 0x46e9(%rip), %rax      # 0xc708
movq (%rax), %rdx
movl $0x6, %ecx
movl $0x20, %r8d
xorl %r9d, %r9d
pushq $0x2
pushq %r10
callq 0x3460
addq $0x10, %rsp
movq %rbx, %rdi
callq 0x5afe
testb $0x4, %bpl
je 0x8116
movl 0x28(%rbx), %esi
movl 0x38(%rbx), %eax
shll $0x2, %eax
cltq
leaq 0x481f(%rip), %rcx      # 0xc880
movl (%rcx,%rax,4), %edx
cmpl %edx, %esi
jge 0x806d
movl %edx, 0x28(%rbx)
movl %edx, %esi
movl 0x24(%rbx), %edx
movl 0xc(%rcx,%rax,4), %edi
cmpl %edi, %edx
jge 0x807d
movl %edi, 0x24(%rbx)
movl %edi, %edx
movl 0x30(%rbx), %edi
leaq 0x4859(%rip), %r8       # 0xc8e0
movq (%r8), %r8
movq 0xe8(%r8), %r8
movq 0x10(%rbx), %r9
movslq (%r9), %r9
shlq $0x7, %r9
movl 0x1c(%r8,%r9), %r11d
movl 0x8(%rcx,%rax,4), %r10d
leal (%rdi,%rsi), %ebp
subl %r11d, %ebp
addl %r10d, %ebp
testl %ebp, %ebp
jle 0x80d9
addl %edi, %r10d
addl %esi, %r10d
subl %r11d, %r10d
incl %r10d
cmpl (%rcx,%rax,4), %esi
jle 0x80cb
decl %esi
movl %esi, 0x28(%rbx)
jmp 0x80d0
decl %edi
movl %edi, 0x30(%rbx)
decl %r10d
cmpl $0x1, %r10d
ja 0x80bf
movl 0x2c(%rbx), %esi
movl 0x18(%r8,%r9), %r8d
movl 0x4(%rcx,%rax,4), %edi
leal (%rsi,%rdx), %r9d
subl %r8d, %r9d
addl %edi, %r9d
testl %r9d, %r9d
jle 0x8116
addl %esi, %edi
addl %edx, %edi
subl %r8d, %edi
incl %edi
cmpl 0xc(%rcx,%rax,4), %edx
jle 0x810a
decl %edx
movl %edx, 0x24(%rbx)
jmp 0x810f
decl %esi
movl %esi, 0x2c(%rbx)
decl %edi
cmpl $0x1, %edi
ja 0x80fd
movq %rbx, %rdi
callq 0x7514
movq %rbx, %rdi
callq 0x67ec
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq