// File: /workspace/github_c_makefile_star2_O3/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 0x3818
movq %rax, 0x60ee(%rip)      # 0xc8d8
callq 0x7ae8
testw %ax, %ax
je 0x68f8
callq 0x7b0b
movq %rax, %rdi
callq 0x31a0
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
testl %edx, %edx
je 0x68e9
xorl %r12d, %r12d
leaq 0x60d7(%rip), %r13      # 0xc8f8
leaq 0x8(%rsp), %rbx
movl $0x1, %edi
movl $0x28, %esi
callq 0x3340
movq %rax, %r14
movl $0x1, %edi
movl $0x1, %esi
callq 0x3340
movq %rax, (%r14)
movl $0x1, %edi
movl $0x10, %esi
callq 0x3340
movq %rax, 0x8(%r14)
movq %r12, 0x18(%r14)
movq 0x8(%rsp), %rbp
movq (%r13), %r15
movl (%rbp), %esi
movq %r15, %rdi
callq 0x3030
movq %r15, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x3240
movq %rax, %rdi
callq 0x33b0
movq 0x8(%r14), %rcx
movq 0x8(%rbp), %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 0x1e8a(%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)
movq %r12, 0x10(%r14)
movl $0x1, 0x20(%r14)
movq (%r14), %rdi
movq %rax, %rsi
callq 0x30e0
movq 0x600a(%rip), %rdi      # 0xc8d8
movq %r14, %rsi
callq 0x3884
movq %rbx, %rdi
callq 0x3130
cmpl $0x0, 0x10(%rsp)
jne 0x6826
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
movl $0x28, %esi
callq 0x3340
movq %rax, %rbx
movl $0x1, %edi
movl $0x1, %esi
callq 0x3340
movq %rax, %r14
movq %rax, (%rbx)
movl $0x1, %edi
movl $0x10, %esi
callq 0x3340
movq %rax, 0x8(%rbx)
leaq 0x5fc7(%rip), %rcx      # 0xc900
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(%r14)    # imm = 0x3E6772
movl $0x726f783c, (%r14)     # imm = 0x726F783C
movq 0x5f67(%rip), %rdi      # 0xc8d8
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3884