// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x90, %rsp
movw %r9w, %ax
movl %ecx, -0x4(%rbp)
movl %r8d, -0x8(%rbp)
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movw %ax, -0x16(%rbp)
leaq 0x72be(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0xc(%rbp), %esi
callq 0x3410
movl %eax, -0x20(%rbp)
leaq 0x72a9(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
callq 0x3230
movl %eax, -0x2c(%rbp)
leaq 0x7297(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
callq 0x3230
movl %eax, -0x30(%rbp)
movl -0x14(%rbp), %eax
movzwl -0x16(%rbp), %ecx
subl $0x1, %ecx
imull %ecx, %eax
addl -0x10(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %edi
leaq -0x1c(%rbp), %rdx
movl $0x10, %esi
callq 0x8e50
leaq 0x725b(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0x20(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x32c0
movq %rax, -0x28(%rbp)
movl -0x34(%rbp), %eax
shll %eax
movq -0x28(%rbp), %rcx
movzwl 0x12(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x36(%rbp)
movl -0x34(%rbp), %eax
shll %eax
movq -0x28(%rbp), %rcx
movzwl 0x10(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x38(%rbp)
leaq 0x721b(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0x2c(%rbp), %edx
leaq 0x7216(%rip), %rax      # 0xd900
movq (%rax), %rax
movl (%rax), %ecx
movw -0x38(%rbp), %ax
movl $0x20, %esi
movzwl %ax, %r8d
movzwl -0x36(%rbp), %r9d
callq 0x3490
movl %eax, -0x3c(%rbp)
leaq 0x71e8(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
xorl %ecx, %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0x31e0
movl %eax, -0x40(%rbp)
movl -0x8(%rbp), %edi
callq 0x63b0
movl %eax, -0x1c(%rbp)
leaq 0x71be(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0x30(%rbp), %esi
leaq -0x1c(%rbp), %rcx
movl $0x4, %edx
callq 0x33e0
movl %eax, -0x44(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x32e0
movw -0x38(%rbp), %ax
movw %ax, -0x6c(%rbp)
movw -0x36(%rbp), %ax
movw %ax, -0x6a(%rbp)
leaq 0x7180(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
leaq -0x70(%rbp), %r8
movl $0x4, %ecx
callq 0x32a0
movl %eax, -0x74(%rbp)
movl -0x4(%rbp), %edi
callq 0x63b0
movl %eax, -0x1c(%rbp)
leaq 0x7154(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0x30(%rbp), %esi
leaq -0x1c(%rbp), %rcx
movl $0x4, %edx
callq 0x33e0
movl %eax, -0x78(%rbp)
movzwl -0x16(%rbp), %eax
cmpl $0x2, %eax
jne 0x67df
movl -0x2c(%rbp), %edi
movl -0x30(%rbp), %esi
movl -0x10(%rbp), %edx
movl -0x14(%rbp), %ecx
movl -0x34(%rbp), %r8d
movq -0x28(%rbp), %r9
callq 0x6880
jmp 0x6803
movl -0x2c(%rbp), %edi
movl -0x30(%rbp), %esi
movl -0x10(%rbp), %edx
movl -0x14(%rbp), %ecx
movl -0x34(%rbp), %r8d
movq -0x28(%rbp), %r9
callq 0x69b0
movl -0x8(%rbp), %edi
callq 0x63b0
movl %eax, -0x1c(%rbp)
leaq 0x70ee(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0xc(%rbp), %esi
leaq -0x1c(%rbp), %rcx
movl $0x2, %edx
callq 0x3170
movl %eax, -0x7c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x1c(%rbp)
leaq 0x70ca(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0xc(%rbp), %esi
leaq -0x1c(%rbp), %rcx
movl $0x4, %edx
callq 0x3170
movl %eax, -0x80(%rbp)
leaq 0x70ac(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0x2c(%rbp), %esi
callq 0x3140
movl %eax, -0x84(%rbp)
leaq 0x7094(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0x30(%rbp), %esi
callq 0x3220
movl %eax, -0x88(%rbp)
addq $0x90, %rsp
popq %rbp
retq
nop