// File: /workspace/github_c_makefile_star2_O3/comfies[P]custard/src/wm/decorations.c
// Function: multi_border
void multi_border(xcb_window_t window,
    unsigned int inner_size, unsigned int outer_size,
    color_t primary_color, color_t secondary_color,
    unsigned short border_type) {

    unsigned int values[1];

    xcb_get_geometry_cookie_t geometry_cookie = xcb_get_geometry(xcb_connection,
        window);
    xcb_get_geometry_reply_t *geometry;

    xcb_pixmap_t pixmap = xcb_generate_id(xcb_connection);
    xcb_gcontext_t graphics_context = xcb_generate_id(xcb_connection);

    unsigned int border_size = (outer_size * (border_type - 1)) + inner_size;

    values[0] = border_size;
    configure_window(window, XCB_CONFIG_WINDOW_BORDER_WIDTH, values);

    geometry = xcb_get_geometry_reply(xcb_connection, geometry_cookie, NULL);

    unsigned short height = (unsigned short)((border_size * 2) +
        geometry->height);
    unsigned short width = (unsigned short)((border_size * 2) +
        geometry->width);

    xcb_create_pixmap(xcb_connection, 32, pixmap, xcb_screen->root,
        width, height);
    xcb_create_gc(xcb_connection, graphics_context, pixmap, 0, NULL);

    values[0] = get_raw_color_value(secondary_color);
    xcb_change_gc(xcb_connection, graphics_context,
        XCB_GC_FOREGROUND, values);

    xcb_rectangle_t outer_border[4] = { { 0, 0, width, height } };
    xcb_poly_fill_rectangle(xcb_connection, pixmap, graphics_context,
        4, outer_border);

    values[0] = get_raw_color_value(primary_color);
    xcb_change_gc(xcb_connection, graphics_context,
        XCB_GC_FOREGROUND, values);

    if (border_type == 2)
        double_border_transient(pixmap, graphics_context,
            inner_size, outer_size, border_size, geometry);
    else {
        triple_border_transient(pixmap, graphics_context,
            inner_size, outer_size, border_size, geometry);
        values[0] = get_raw_color_value(secondary_color);
    }

    xcb_change_window_attributes(xcb_connection, window,
        XCB_CW_BACK_PIXEL, values);

    values[0] = pixmap;
    xcb_change_window_attributes(xcb_connection, window,
        XCB_CW_BORDER_PIXMAP, values);

    xcb_free_pixmap(xcb_connection, pixmap);
    xcb_free_gc(xcb_connection, graphics_context);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %r9d, %r13d
movq %r13, 0x38(%rsp)
movl %r8d, %ebx
movl %ecx, 0x28(%rsp)
movl %edx, %r12d
movl %esi, %ebp
movl %edi, %r14d
leaq 0x6e5f(%rip), %r15      # 0xc8f8
movq (%r15), %rdi
movl %r14d, %esi
callq 0x3400
movl %eax, 0x18(%rsp)
movq (%r15), %rdi
callq 0x3230
movl %eax, 0x14(%rsp)
movq (%r15), %rdi
callq 0x3230
movl %eax, 0x20(%rsp)
leal -0x1(%r13), %r15d
movl %r12d, 0x10(%rsp)
imull %r12d, %r15d
movl %ebp, 0xc(%rsp)
addl %ebp, %r15d
leaq 0x8(%rsp), %rdx
movl %r15d, (%rdx)
movl %r14d, 0x2c(%rsp)
movl %r14d, %edi
movl $0x10, %esi
callq 0x7650
leaq 0x6e03(%rip), %r14      # 0xc8f8
movq (%r14), %rdi
movl 0x18(%rsp), %esi
xorl %edx, %edx
callq 0x32c0
movq %r15, 0x18(%rsp)
leal (%r15,%r15), %esi
movzwl 0x12(%rax), %edx
addw %si, %dx
movq %rax, 0x30(%rsp)
addw 0x10(%rax), %si
movq (%r14), %rdi
leaq 0x6dda(%rip), %rcx      # 0xc900
movq (%rcx), %rcx
movl (%rcx), %ecx
movzwl %si, %ebp
movzwl %dx, %r9d
movl %r9d, 0x24(%rsp)
movl $0x20, %esi
movl 0x14(%rsp), %r15d
movl %r15d, %edx
movl %ebp, %r8d
callq 0x3480
movq (%r14), %rdi
movl 0x20(%rsp), %r13d
movl %r13d, %esi
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x31e0
movl %ebx, %edx
shrl $0x8, %edx
movl %ebx, %eax
shrl $0x10, %eax
movl %ebx, %ecx
shrl $0x18, %ecx
movl $0xff000000, %r12d      # imm = 0xFF000000
movl %ebx, %esi
andl %r12d, %esi
movl $0xff, %r14d
andl %r14d, %ebx
imull %ecx, %ebx
imull $0x8081, %ebx, %edi     # imm = 0x8081
shrl $0x7, %edi
movl $0x1ff0000, %r8d        # imm = 0x1FF0000
andl %r8d, %edi
orl %esi, %edi
andl %r14d, %edx
imull %ecx, %edx
imull $0x8081, %edx, %edx     # imm = 0x8081
shrl $0xf, %edx
movl $0x1ff00, %esi          # imm = 0x1FF00
andl %esi, %edx
andl %r14d, %eax
imull %ecx, %eax
imull $0x8081, %eax, %ebx     # imm = 0x8081
shrl $0x17, %ebx
orl %edi, %ebx
orl %edx, %ebx
leaq 0x8(%rsp), %rcx
movl %ebx, (%rcx)
leaq 0x6d23(%rip), %r15      # 0xc8f8
movq (%r15), %rdi
movl %r13d, %esi
movl $0x4, %edx
callq 0x33d0
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %r8
movaps %xmm0, (%r8)
movaps %xmm0, 0x10(%r8)
movw %bp, 0x4(%r8)
movl 0x24(%rsp), %eax
movw %ax, 0x6(%r8)
movq (%r15), %rdi
movl 0x14(%rsp), %esi
movl %esi, %ebp
movl %r13d, %edx
movl $0x4, %ecx
callq 0x32a0
movl 0x28(%rsp), %esi
movl %esi, %eax
shrl $0x8, %eax
movl %esi, %ecx
shrl $0x10, %ecx
movl %esi, %edx
shrl $0x18, %edx
andl %esi, %r12d
andl %r14d, %esi
imull %edx, %esi
imull $0x8081, %esi, %esi     # imm = 0x8081
shrl $0x7, %esi
movl $0x1ff0000, %edi        # imm = 0x1FF0000
andl %edi, %esi
orl %r12d, %esi
andl %r14d, %eax
imull %edx, %eax
imull $0x8081, %eax, %eax     # imm = 0x8081
shrl $0xf, %eax
movl $0x1ff00, %edi          # imm = 0x1FF00
andl %edi, %eax
andl %r14d, %ecx
imull %edx, %ecx
imull $0x8081, %ecx, %edx     # imm = 0x8081
shrl $0x17, %edx
orl %esi, %edx
orl %eax, %edx
leaq 0x8(%rsp), %rcx
movl %edx, (%rcx)
movq (%r15), %rdi
movl %r13d, %esi
movl $0x4, %edx
callq 0x33d0
cmpl $0x2, 0x38(%rsp)
jne 0x5cb1
movl %ebp, %r12d
movl %ebp, %edi
movl %r13d, %esi
movl 0xc(%rsp), %edx
movl 0x10(%rsp), %ecx
movq 0x18(%rsp), %r8
movq 0x30(%rsp), %r9
callq 0x5d29
jmp 0x5cd4
movl %ebp, %r12d
movl %ebp, %edi
movl %r13d, %esi
movl 0xc(%rsp), %edx
movl 0x10(%rsp), %ecx
movq 0x18(%rsp), %r8
movq 0x30(%rsp), %r9
callq 0x5dd5
movl %ebx, 0x8(%rsp)
movq (%r15), %rdi
leaq 0x8(%rsp), %rbx
movl 0x2c(%rsp), %ebp
movl %ebp, %esi
movl $0x2, %edx
movq %rbx, %rcx
callq 0x3170
movl %r12d, (%rbx)
movq (%r15), %rdi
movl %ebp, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x3170
movq (%r15), %rdi
movl %r12d, %esi
callq 0x3140
movq (%r15), %rdi
movl %r13d, %esi
callq 0x3220
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq