// File: /workspace/github_c_makefile_star2_O1/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 0x7e89
movl 0x38(%rbx), %eax
incl %eax
movl %eax, 0x38(%rbx)
leaq 0x4a2d(%rip), %rcx      # 0xc870
cmpl (%rcx), %eax
jge 0x7e82
testl %eax, %eax
je 0x7e89
xorl %eax, %eax
movl %eax, 0x24(%rbx)
leaq 0x4a89(%rip), %rcx      # 0xc8e0
movq (%rcx), %rcx
movq 0xe8(%rcx), %rcx
movq 0x10(%rbx), %rdx
movslq (%rdx), %rdx
shlq $0x7, %rdx
movl 0x18(%rcx,%rdx), %esi
movl %esi, 0x2c(%rbx)
movl %eax, 0x28(%rbx)
movl 0x1c(%rcx,%rdx), %eax
movl %eax, 0x30(%rbx)
jmp 0x801d
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
testb $0x1, %bpl
je 0x7f4f
movl 0x44(%rbx), %eax
testl %eax, %eax
je 0x7edc
testl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
jne 0x7f4f
movl 0x3c(%rbx), %ecx
movl %ecx, 0x24(%rbx)
movl %eax, 0x2c(%rbx)
movl $0x0, 0x44(%rbx)
leaq 0x4a22(%rip), %rax      # 0xc8e0
movq (%rax), %rdi
movq (%rbx), %rsi
leaq 0x4835(%rip), %rax      # 0xc700
movq (%rax), %rdx
callq 0x3230
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
jmp 0x7f4f
leal -0x1(%r14), %eax
cmpl $0x1, %eax
ja 0x7f4f
movslq 0x24(%rbx), %rax
movl %eax, 0x3c(%rbx)
movslq 0x2c(%rbx), %rcx
movl %ecx, 0x44(%rbx)
movl $0x0, 0x24(%rbx)
leaq 0x49df(%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 0x47cf(%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 0x8015
movl 0x48(%rbx), %eax
testl %eax, %eax
je 0x7fa2
testl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
jne 0x8015
movl 0x40(%rbx), %ecx
movl %ecx, 0x28(%rbx)
movl %eax, 0x30(%rbx)
movl $0x0, 0x48(%rbx)
leaq 0x495c(%rip), %rax      # 0xc8e0
movq (%rax), %rdi
movq (%rbx), %rsi
leaq 0x4777(%rip), %rax      # 0xc708
movq (%rax), %rdx
callq 0x3230
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
jmp 0x8015
decl %r14d
cmpl $0x1, %r14d
ja 0x8015
movslq 0x28(%rbx), %rax
movl %eax, 0x40(%rbx)
movslq 0x30(%rbx), %rcx
movl %ecx, 0x48(%rbx)
movl $0x0, 0x28(%rbx)
leaq 0x4919(%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 0x4711(%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 0x5b26
testb $0x4, %bpl
je 0x8106
movslq 0x38(%rbx), %rdx
leaq (,%rdx,4), %rax
shlq $0x4, %rdx
leaq 0x4842(%rip), %rcx      # 0xc880
leaq 0x28(%rbx), %rsi
movl (%rcx,%rdx), %edx
cmpl %edx, 0x28(%rbx)
jge 0x804c
movl %edx, (%rsi)
leaq 0x24(%rbx), %rdx
movl 0xc(%rcx,%rax,4), %edi
cmpl %edi, 0x24(%rbx)
jge 0x805b
movl %edi, (%rdx)
movl 0x28(%rbx), %edi
leaq 0x487b(%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), %ebp
addl 0x30(%rbx), %edi
movl %edi, %r10d
subl %r11d, %r10d
addl %ebp, %r10d
testl %r10d, %r10d
jle 0x80be
leaq 0x30(%rbx), %r10
addl %ebp, %edi
subl %r11d, %edi
incl %edi
movl (%rsi), %r11d
movq %rsi, %r14
cmpl (%rcx,%rax,4), %r11d
jg 0x80b1
movl (%r10), %r11d
movq %r10, %r14
decl %r11d
movl %r11d, (%r14)
decl %edi
cmpl $0x1, %edi
jg 0x809f
movl 0x24(%rbx), %esi
movl 0x18(%r8,%r9), %r8d
movl 0x4(%rcx,%rax,4), %r9d
addl 0x2c(%rbx), %esi
movl %esi, %edi
subl %r8d, %edi
addl %r9d, %edi
testl %edi, %edi
jle 0x8106
leaq 0x2c(%rbx), %rdi
addl %r9d, %esi
subl %r8d, %esi
incl %esi
movl (%rdx), %r8d
movq %rdx, %r9
cmpl 0xc(%rcx,%rax,4), %r8d
jg 0x80f9
movl (%rdi), %r8d
movq %rdi, %r9
decl %r8d
movl %r8d, (%r9)
decl %esi
cmpl $0x1, %esi
jg 0x80e6
movq %rbx, %rdi
callq 0x751b
movq %rbx, %rdi
callq 0x680c
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq