// File: /workspace/github_c_makefile_star2_O3/baskerville[P]bspwm/src/geometry.c
// Function: on_dir_side
bool on_dir_side(xcb_rectangle_t r1, xcb_rectangle_t r2, direction_t dir)
{
	xcb_point_t r1_max = {r1.x + r1.width - 1, r1.y + r1.height - 1};
	xcb_point_t r2_max = {r2.x + r2.width - 1, r2.y + r2.height - 1};

	/* Eliminate rectangles on the opposite side */
	switch (directional_focus_tightness) {
		case TIGHTNESS_LOW:
			switch (dir) {
				case DIR_NORTH:
					if (r2.y > r1_max.y) {
						return false;
					}
					break;
				case DIR_WEST:
					if (r2.x > r1_max.x) {
						return false;
					}
					break;
				case DIR_SOUTH:
					if (r2_max.y < r1.y) {
						return false;
					}
					break;
				case DIR_EAST:
					if (r2_max.x < r1.x) {
						return false;
					}
					break;
				default:
					return false;
			}
			break;
		case TIGHTNESS_HIGH:
			switch (dir) {
				case DIR_NORTH:
					if (r2.y >= r1.y) {
						return false;
					}
					break;
				case DIR_WEST:
					if (r2.x >= r1.x) {
						return false;
					}
					break;
				case DIR_SOUTH:
					if (r2_max.y <= r1_max.y) {
						return false;
					}
					break;
				case DIR_EAST:
					if (r2_max.x <= r1_max.x) {
						return false;
					}
					break;
				default:
					return false;
			}
			break;
		default:
			return false;
	}

	/* Is there a shared vertical/horizontal range? */
	switch (dir) {
		case DIR_NORTH:
		case DIR_SOUTH:
			return
				(r2.x >= r1.x && r2.x <= r1_max.x) ||
				(r2_max.x >= r1.x && r2_max.x <= r1_max.x) ||
				(r1.x > r2.x && r1.x < r2_max.x);
			break;
		case DIR_WEST:
		case DIR_EAST:
			return
				(r2.y >= r1.y && r2.y <= r1_max.y) ||
				(r2_max.y >= r1.y && r2_max.y <= r1_max.y) ||
				(r1.y > r2.y && r1_max.y < r2_max.y);
			break;
		default:
			return false;
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rax
shrq $0x20, %rax
movq %rdi, %r9
shrq $0x30, %r9
movq %rsi, %r11
shrq $0x20, %r11
movq %rsi, %rbx
shrq $0x30, %rbx
movswl %di, %ecx
leal (%rax,%rdi), %r8d
decl %r8d
sarl $0x10, %edi
leal (%rdi,%r9), %r10d
decl %r10d
movswl %si, %r9d
addl %esi, %r11d
decl %r11d
sarl $0x10, %esi
addl %esi, %ebx
decl %ebx
leaq 0x23bad(%rip), %rax     # 0x29ddc
movl (%rax), %eax
cmpl $0x1, %eax
je 0x625f
testl %eax, %eax
jne 0x62c2
cmpl $0x3, %edx
ja 0x62c2
movl %edx, %eax
leaq 0x1917c(%rip), %rdx     # 0x1f3c8
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movswl %r10w, %eax
cmpl %eax, %esi
jle 0x628b
jmp 0x62c2
cmpl $0x3, %edx
ja 0x62c2
movl %edx, %eax
leaq 0x1914b(%rip), %rdx     # 0x1f3b8
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
cmpl %edi, %esi
jl 0x628b
jmp 0x62c2
movswl %bx, %eax
cmpl %eax, %edi
jle 0x628b
jmp 0x62c2
cmpw %r10w, %bx
jle 0x62c2
movb $0x1, %al
cmpl %ecx, %r9d
jl 0x629b
movswl %r8w, %edx
cmpl %edx, %r9d
jle 0x62c4
movswl %r11w, %edx
cmpl %edx, %ecx
jg 0x62a9
cmpw %r8w, %r11w
jle 0x62c4
cmpl %ecx, %r9d
setl %sil
cmpl %edx, %ecx
setl %al
andb %sil, %al
jmp 0x62c4
movswl %r11w, %eax
cmpl %eax, %ecx
jle 0x62d7
xorl %eax, %eax
popq %rbx
retq
movswl %r8w, %eax
cmpl %eax, %r9d
jg 0x62c2
jmp 0x62d7
cmpw %r8w, %r11w
jle 0x62c2
cmpl %edi, %esi
jl 0x62e5
movswl %r10w, %ecx
movb $0x1, %al
cmpl %ecx, %esi
jle 0x62c4
cmpl %edi, %esi
setl %cl
movswl %bx, %eax
cmpl %eax, %edi
setle %dl
cmpw %r10w, %bx
setle %al
setg %sil
andb %cl, %sil
andb %dl, %al
orb %sil, %al
jmp 0x62c4
cmpl %ecx, %r9d
jge 0x62c2
jmp 0x62d7