// File: /workspace/github_c_makefile_star2_O0/tudurom[P]windowchef/wm.c
// Function: snap_window
static void
snap_window(struct client *client, enum position pos)
{
	int16_t mon_x, mon_y, win_x, win_y;
	uint16_t mon_w, mon_h, win_w, win_h;

	if (client == NULL)
		return;

	if (is_special(client)) {
		reset_window(client);
		set_focused(client);
	}

	fit_on_screen(client);

	win_x = client->geom.x;
	win_y = client->geom.y;
	win_w = client->geom.width + 2 * conf.border_width;
	win_h = client->geom.height + 2 * conf.border_width;

	get_monitor_size(client, &mon_x, &mon_y, &mon_w, &mon_h);

	switch (pos) {
		case TOP_LEFT:
			win_x = mon_x + conf.gap_left;
			win_y = mon_y + conf.gap_up;
			break;

		case TOP_RIGHT:
			win_x = mon_x + mon_w - conf.gap_right - win_w;
			win_y = mon_y + conf.gap_up;
			break;

		case BOTTOM_LEFT:
			win_x = mon_x + conf.gap_left;
			win_y = mon_y + mon_h - conf.gap_down - win_h;
			break;

		case BOTTOM_RIGHT:
			win_x = mon_x + mon_w - conf.gap_right - win_w;
			win_y = mon_y + mon_h - conf.gap_down - win_h;
			break;

		case CENTER:
			win_x = mon_x + (mon_w - win_w) / 2;
			win_y = mon_y + (mon_h - win_h) / 2;
			break;

		default:
			return;
	}

	client->geom.x = win_x;
	client->geom.y = win_y;
	teleport_window(client->window, win_x, win_y);
	center_pointer(client);
	xcb_flush(conn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x9dfb
jmp 0xa006
movq -0x8(%rbp), %rdi
callq 0x5780
testb $0x1, %al
jne 0x9e0a
jmp 0x9e1c
movq -0x8(%rbp), %rdi
callq 0x57f0
movq -0x8(%rbp), %rdi
callq 0x6a10
movq -0x8(%rbp), %rdi
callq 0x5060
movq -0x8(%rbp), %rax
movw 0x4(%rax), %ax
movw %ax, -0x12(%rbp)
movq -0x8(%rbp), %rax
movw 0x6(%rax), %ax
movw %ax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edx
movsbl 0x5975(%rip), %eax      # 0xf7c0
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
movw %ax, -0x1a(%rbp)
movq -0x8(%rbp), %rax
movzwl 0xa(%rax), %edx
movsbl 0x595b(%rip), %eax      # 0xf7c0
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
movw %ax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xe(%rbp), %rsi
leaq -0x10(%rbp), %rdx
leaq -0x16(%rbp), %rcx
leaq -0x18(%rbp), %r8
callq 0x5550
movl -0xc(%rbp), %eax
movq %rax, -0x28(%rbp)
subq $0x4, %rax
ja 0x9fc1
movq -0x28(%rbp), %rax
leaq 0x21f7(%rip), %rcx      # 0xc09c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movswl -0xe(%rbp), %eax
movsbl 0x590a(%rip), %ecx      # 0xf7c3
addl %ecx, %eax
movw %ax, -0x12(%rbp)
movswl -0x10(%rbp), %eax
movsbl 0x58fb(%rip), %ecx      # 0xf7c5
addl %ecx, %eax
movw %ax, -0x14(%rbp)
jmp 0x9fc3
movswl -0xe(%rbp), %eax
movzwl -0x16(%rbp), %ecx
addl %ecx, %eax
movsbl 0x58e0(%rip), %ecx      # 0xf7c6
subl %ecx, %eax
movzwl -0x1a(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x12(%rbp)
movswl -0x10(%rbp), %eax
movsbl 0x58c8(%rip), %ecx      # 0xf7c5
addl %ecx, %eax
movw %ax, -0x14(%rbp)
jmp 0x9fc3
movswl -0xe(%rbp), %eax
movsbl 0x58b0(%rip), %ecx      # 0xf7c3
addl %ecx, %eax
movw %ax, -0x12(%rbp)
movswl -0x10(%rbp), %eax
movzwl -0x18(%rbp), %ecx
addl %ecx, %eax
movsbl 0x589a(%rip), %ecx      # 0xf7c4
subl %ecx, %eax
movzwl -0x1c(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x14(%rbp)
jmp 0x9fc3
movswl -0xe(%rbp), %eax
movzwl -0x16(%rbp), %ecx
addl %ecx, %eax
movsbl 0x587a(%rip), %ecx      # 0xf7c6
subl %ecx, %eax
movzwl -0x1a(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x12(%rbp)
movswl -0x10(%rbp), %eax
movzwl -0x18(%rbp), %ecx
addl %ecx, %eax
movsbl 0x585b(%rip), %ecx      # 0xf7c4
subl %ecx, %eax
movzwl -0x1c(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x14(%rbp)
jmp 0x9fc3
movswl -0xe(%rbp), %eax
movl %eax, -0x30(%rbp)
movzwl -0x16(%rbp), %eax
movzwl -0x1a(%rbp), %ecx
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x30(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x12(%rbp)
movswl -0x10(%rbp), %eax
movl %eax, -0x2c(%rbp)
movzwl -0x18(%rbp), %eax
movzwl -0x1c(%rbp), %ecx
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x2c(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x14(%rbp)
jmp 0x9fc3
jmp 0xa006
movw -0x12(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0x4(%rax)
movw -0x14(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0x6(%rax)
movq -0x8(%rbp), %rax
movl (%rax), %edi
movw -0x12(%rbp), %ax
movswl %ax, %esi
movswl -0x14(%rbp), %edx
callq 0x5460
movq -0x8(%rbp), %rdi
callq 0x70b0
movq 0x53d7(%rip), %rdi      # 0xf3d8
callq 0x3400
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)