// File: /workspace/github_c_makefile_star2_O2/tudurom[P]windowchef/wm.c
// Function: set_borders
static void
set_borders(struct client *client, uint32_t color, uint32_t internal_color)
{
	if (client == NULL || conf.borders == false)
		return;
	uint32_t values[1];

	color = get_color_pixel(color);
	internal_color = get_color_pixel(internal_color);

	values[0] = conf.border_width;
	xcb_configure_window(conn, client->window,
			XCB_CONFIG_WINDOW_BORDER_WIDTH, values);

	if (conf.internal_border_width == 0) {
		values[0] = color;
		xcb_change_window_attributes(conn, client->window, XCB_CW_BORDER_PIXEL, values);
	}

	if (conf.internal_border_width != 0) {
		uint32_t calc_iborder = conf.border_width - conf.internal_border_width;
		xcb_rectangle_t rect_inner[] = {
			{
				client->geom.width,
				0,
				conf.border_width - calc_iborder,
				client->geom.height + conf.border_width - calc_iborder
			},
			{
				client->geom.width + conf.border_width + calc_iborder,
				0,
				conf.border_width - calc_iborder,
				client->geom.height + conf.border_width - calc_iborder
			},
			{
				0,
				client->geom.height,
				client->geom.width + conf.border_width - calc_iborder,
				conf.border_width - calc_iborder
			},
			{
				0,
				client->geom.height + conf.border_width + calc_iborder,
				client->geom.width + conf.border_width - calc_iborder,
				conf.border_width - calc_iborder
			},
			{
				client->geom.width + conf.border_width + calc_iborder,
				conf.border_width + client->geom.height + calc_iborder,
				conf.border_width,
				conf.border_width
			}
		};

		xcb_rectangle_t rect_outer[] = {
			{
				client->geom.width + conf.border_width - calc_iborder,
				0,
				calc_iborder,
				client->geom.height + conf.border_width * 2
			},
			{
				client->geom.width + conf.border_width,
				0,
				calc_iborder,
				client->geom.height + conf.border_width * 2
			},
			{
				0,
				client->geom.height + conf.border_width - calc_iborder,
				client->geom.width + conf.border_width * 2,
				calc_iborder
			},
			{
				0,
				client->geom.height + conf.border_width,
				client->geom.width + conf.border_width * 2,
				calc_iborder
			},
			{
				1,1,1,1
			}
		};

		xcb_pixmap_t pmap = xcb_generate_id(conn);
		xcb_create_pixmap(conn, client->depth, pmap, scr->root,
			client->geom.width + (conf.border_width * 2),
			client->geom.height + (conf.border_width * 2)
		);

		xcb_gcontext_t gc = xcb_generate_id(conn);
		xcb_create_gc(conn, gc, pmap, 0, NULL);

		values[0] = color;
		xcb_change_gc(conn, gc, XCB_GC_FOREGROUND, &values[0]);
		xcb_poly_fill_rectangle(conn, pmap, gc, 5, rect_outer);

		values[0] = internal_color;
		xcb_change_gc(conn, gc, XCB_GC_FOREGROUND, &values[0]);
		xcb_poly_fill_rectangle(conn, pmap, gc, 5, rect_inner);

		values[0] = pmap;
		xcb_change_window_attributes(conn,client->window, XCB_CW_BORDER_PIXMAP,
				&values[0]);

		xcb_free_pixmap(conn,pmap);
		xcb_free_gc(conn,gc);
	}
}

// Assembly:
testq %rdi, %rdi
je 0x53e2
cmpb $0x0, 0x769c(%rip)      # 0xc7c3
je 0x53e2
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %ebp
movq %rdi, %rbx
movl %esi, %edi
callq 0x8024
movl %eax, %r14d
movl %ebp, %edi
callq 0x8024
movl %eax, %ebp
movsbl 0x7646(%rip), %eax      # 0xc7a0
leaq 0x4(%rsp), %rcx
movl %eax, (%rcx)
movq 0x7250(%rip), %rdi      # 0xc3b8
movl (%rbx), %esi
pushq $0x10
popq %rdx
callq 0x31f0
movb 0x7629(%rip), %al       # 0xc7a1
testb %al, %al
jne 0x51a3
leaq 0x4(%rsp), %rcx
movl %r14d, (%rcx)
movq 0x722d(%rip), %rdi      # 0xc3b8
movl (%rbx), %esi
pushq $0x8
popq %rdx
callq 0x3450
movb 0x7606(%rip), %al       # 0xc7a1
testb %al, %al
je 0x53d4
movsbl %al, %r8d
movsbl 0x75f2(%rip), %ecx      # 0xc7a0
movl %ecx, %eax
subl %r8d, %eax
movzwl 0x8(%rbx), %edx
leaq 0x40(%rsp), %r15
movw %dx, (%r15)
andw $0x0, 0x2(%r15)
movw %r8w, 0x4(%r15)
movzwl 0xa(%rbx), %r9d
leal (%r9,%rcx), %esi
movl %esi, %edi
subl %eax, %edi
movw %di, 0x6(%r15)
leal (%rdx,%rcx), %r10d
leal (%r10,%rax), %r11d
movw %r11w, 0x8(%r15)
andw $0x0, 0xa(%r15)
movw %r8w, 0xc(%r15)
movw %di, 0xe(%r15)
andw $0x0, 0x10(%r15)
movw %r9w, 0x12(%r15)
movl %ebp, 0xc(%rsp)
movl %r10d, %ebp
subl %eax, %ebp
movw %bp, 0x14(%r15)
movw %r8w, 0x16(%r15)
andw $0x0, 0x18(%r15)
movl %r14d, 0x8(%rsp)
leal (%rsi,%rax), %r14d
movw %r14w, 0x1a(%r15)
movw %bp, 0x1c(%r15)
movw %r8w, 0x1e(%r15)
movw %r11w, 0x20(%r15)
leaq 0x10(%rsp), %r12
movw %bp, (%r12)
andw $0x0, 0x2(%r12)
movw %ax, 0x4(%r12)
leal (%r9,%rcx,2), %r8d
movw %r8w, 0x6(%r12)
movw %r10w, 0x8(%r12)
andw $0x0, 0xa(%r12)
movw %ax, 0xc(%r12)
movw %r8w, 0xe(%r12)
andw $0x0, 0x10(%r12)
movw %r14w, 0x22(%r15)
movw %di, 0x12(%r12)
leal (%rdx,%rcx,2), %edx
movw %dx, 0x14(%r12)
movw %ax, 0x16(%r12)
andw $0x0, 0x18(%r12)
movw %cx, 0x24(%r15)
movw %cx, 0x26(%r15)
movw %si, 0x1a(%r12)
movw %dx, 0x1c(%r12)
movw %ax, 0x1e(%r12)
movabsq $0x1000100010001, %rax  # imm = 0x1000100010001
movq %rax, 0x20(%r12)
movq 0x70e9(%rip), %rdi      # 0xc3b8
callq 0x35e0
movl %eax, %r13d
movq 0x70da(%rip), %rdi      # 0xc3b8
movzbl 0x5c(%rbx), %esi
movq 0x74ef(%rip), %rax      # 0xc7d8
movl (%rax), %ecx
movsbl 0x74ae(%rip), %eax      # 0xc7a0
addl %eax, %eax
movzwl 0x8(%rbx), %edx
addw %ax, %dx
addw 0xa(%rbx), %ax
movzwl %dx, %r8d
movzwl %ax, %r9d
movl %r13d, %edx
callq 0x3100
movq 0x70a2(%rip), %rdi      # 0xc3b8
callq 0x35e0
movl %eax, %ebp
movq 0x7094(%rip), %rdi      # 0xc3b8
movl %eax, %esi
movl %r13d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3520
leaq 0x4(%rsp), %r14
movl 0x8(%rsp), %eax
movl %eax, (%r14)
movq 0x7072(%rip), %rdi      # 0xc3b8
pushq $0x4
popq %rdx
movl %ebp, %esi
movq %r14, %rcx
callq 0x30f0
movq 0x705e(%rip), %rdi      # 0xc3b8
pushq $0x5
popq %rcx
movl %r13d, %esi
movl %ebp, %edx
movq %r12, %r8
callq 0x36d0
movl 0xc(%rsp), %eax
movl %eax, (%r14)
movq 0x7040(%rip), %rdi      # 0xc3b8
movl %ebp, %esi
pushq $0x4
popq %r12
movl %r12d, %edx
movq %r14, %rcx
callq 0x30f0
movq 0x7028(%rip), %rdi      # 0xc3b8
movl %r13d, %esi
movl %ebp, %edx
pushq $0x5
popq %rcx
movq %r15, %r8
callq 0x36d0
movl %r13d, (%r14)
movq 0x700e(%rip), %rdi      # 0xc3b8
movl (%rbx), %esi
movl %r12d, %edx
movq %r14, %rcx
callq 0x3450
movq 0x6ffa(%rip), %rdi      # 0xc3b8
movl %r13d, %esi
callq 0x3570
movq 0x6feb(%rip), %rdi      # 0xc3b8
movl %ebp, %esi
callq 0x31c0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq