// File: /workspace/github_c_makefile_star2_O1/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, 0x60f6(%rip)      # 0xc8d8
callq 0x7b34
testw %ax, %ax
je 0x690c
callq 0x7b57
movq %rax, %rdi
callq 0x31a0
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
testl %edx, %edx
je 0x68fd
xorl %r12d, %r12d
leaq 0x60df(%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
movswl 0x8(%rbp), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movq 0x8(%r14), %rcx
movss %xmm0, (%rcx)
movswl 0xa(%rbp), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss %xmm0, 0x4(%rcx)
movzwl 0xe(%rbp), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss %xmm0, 0x8(%rcx)
movzwl 0xc(%rbp), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss %xmm0, 0xc(%rcx)
movq %r12, 0x10(%r14)
movl $0x1, 0x20(%r14)
movq (%r14), %rdi
movq %rax, %rsi
callq 0x30e0
movq 0x5ff6(%rip), %rdi      # 0xc8d8
movq %r14, %rsi
callq 0x388c
movq %rbx, %rdi
callq 0x3130
cmpl $0x0, 0x10(%rsp)
jne 0x681e
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)
xorl %ecx, %ecx
movq %rcx, 0x18(%rbx)
movq %rcx, (%rax)
leaq 0x5faa(%rip), %rdx      # 0xc900
movq (%rdx), %rdx
movzwl 0x16(%rdx), %esi
cvtsi2ss %esi, %xmm0
movss %xmm0, 0x8(%rax)
movzwl 0x14(%rdx), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss %xmm0, 0xc(%rax)
movq %rcx, 0x10(%rbx)
movl $0x1, 0x20(%rbx)
movl $0x726f783c, (%r14)     # imm = 0x726F783C
movl $0x3e6772, 0x3(%r14)    # imm = 0x3E6772
movq 0x5f41(%rip), %rdi      # 0xc8d8
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x388c