// File: /workspace/github_c_makefile_star2_O2/comfies[P]custard/src/wm/monitor.c
// Function: setup_monitors
void setup_monitors() {
    monitors = construct_vector();

    monitor_t *monitor;
    if (!xrandr_is_available()) {
        monitor = (monitor_t*)calloc(1, sizeof(monitor_t));
        monitor->name = (char*)calloc(1, sizeof(char));
        monitor->geometry = (screen_geometry_t*)calloc(1,
            sizeof(screen_geometry_t));
        monitor->configuration = NULL;

        monitor->geometry->x = monitor->geometry->y = 0.0;
        monitor->geometry->height = (float)xcb_screen->height_in_pixels;
        monitor->geometry->width = (float)xcb_screen->width_in_pixels;

        monitor->geometries = NULL;
        monitor->workspace = 1;

        strcpy(monitor->name, "<xorg>");
        push_to_vector(monitors, monitor);

        return;
    }

    xcb_randr_get_monitors_reply_t *outputs = get_xrandr_outputs();

    xcb_randr_monitor_info_iterator_t iterator;
    iterator = xcb_randr_get_monitors_monitors_iterator(outputs);

    xcb_randr_monitor_info_t *monitor_information;
    char *output_name;

    while (iterator.rem) {
        monitor = (monitor_t*)calloc(1, sizeof(monitor_t));
        monitor->name = (char*)calloc(1, sizeof(char));
        monitor->geometry = (screen_geometry_t*)calloc(1,
            sizeof(screen_geometry_t));
        monitor->configuration = NULL;

        monitor_information = iterator.data;
        output_name = xcb_get_atom_name_name(
            xcb_get_atom_name_reply(xcb_connection,
                xcb_get_atom_name(xcb_connection, monitor_information->name),
            NULL));

        monitor->geometry->x = (float)monitor_information->x;
        monitor->geometry->y = (float)monitor_information->y;

        monitor->geometry->height = (float)monitor_information->height;
        monitor->geometry->width = (float)monitor_information->width;

        monitor->geometries = NULL;
        monitor->workspace = 1;

        strcpy(monitor->name, output_name);
        push_to_vector(monitors, monitor);

        xcb_randr_monitor_info_next(&iterator);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
callq 0x3808
movq %rax, 0x64a6(%rip)      # 0xc8c8
callq 0x75bc
testw %ax, %ax
je 0x6528
callq 0x75df
movq %rax, %rdi
callq 0x31a0
leaq 0x8(%rsp), %rbx
movq %rax, (%rbx)
movq %rdx, 0x8(%rbx)
pushq $0x1
popq %r14
pushq $0x10
popq %r12
testl %edx, %edx
je 0x6519
movq %r14, %rdi
pushq $0x28
popq %rsi
callq 0x3340
movq %rax, %r13
movq %r14, %rdi
movq %r14, %rsi
callq 0x3340
movq %rax, (%r13)
movq %r14, %rdi
movq %r12, %rsi
callq 0x3340
movq %rax, 0x8(%r13)
andq $0x0, 0x18(%r13)
movq 0x8(%rsp), %r15
leaq 0x6452(%rip), %rax      # 0xc8e8
movq (%rax), %rbp
movl (%r15), %esi
movq %rbp, %rdi
callq 0x3030
movq %rbp, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x3240
movq %rax, %rdi
callq 0x33b0
movq 0x8(%r13), %rcx
movq 0x8(%r15), %xmm0
punpcklwd %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
psrad $0x10, %xmm1
cvtdq2ps %xmm1, %xmm1
punpcklwd 0x224a(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
cvtdq2ps %xmm0, %xmm0
shufps $0xb4, %xmm0, %xmm1     # xmm1 = xmm1[0,1],xmm0[3,2]
movups %xmm1, (%rcx)
andq $0x0, 0x10(%r13)
movl $0x1, 0x20(%r13)
movq (%r13), %rdi
movq %rax, %rsi
callq 0x30e0
movq 0x63c8(%rip), %rdi      # 0xc8c8
movq %r13, %rsi
callq 0x3878
movq %rbx, %rdi
callq 0x3130
movl 0x10(%rsp), %edx
jmp 0x6451
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %r14
pushq $0x28
popq %rsi
movq %r14, %rdi
callq 0x3340
movq %rax, %rbx
movq %r14, %rdi
movq %r14, %rsi
callq 0x3340
movq %rax, %r15
movq %rax, (%rbx)
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x3340
movq %rax, 0x8(%rbx)
leaq 0x638f(%rip), %rcx      # 0xc8f0
movq (%rcx), %rcx
movd 0x14(%rcx), %xmm0
pxor %xmm1, %xmm1
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
cvtdq2ps %xmm0, %xmm0
shufps $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movlps %xmm0, 0x8(%rax)
movl $0x1, 0x20(%rbx)
movl $0x3e6772, 0x3(%r15)    # imm = 0x3E6772
movl $0x726f783c, (%r15)     # imm = 0x726F783C
movq 0x632f(%rip), %rdi      # 0xc8c8
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3878