// File: /workspace/github_c_makefile_star2_O0/comfies[P]custard/src/wm/custard.c
// Function: finalize
void finalize() {
    /* Free used memory for windows */
    if (windows) {
        log_debug("Freeing memory for windows");
        window_t *window;
        while ((window = vector_iterator(windows)))
            unmanage_window(window->id);
        deconstruct_vector(windows);
    }

    kv_pair_t *kv_pair;
    monitor_t *monitor;
    labeled_grid_geometry_t *labeled_geometry;
    if (monitors) {
        log_debug("Freeing memory for monitors");
        while ((monitor = vector_iterator(monitors))) {
            free(monitor->name);
            free(monitor->geometry);

            if (monitor->geometries) {
                while ((labeled_geometry = vector_iterator(
                    monitor->geometries))) {
                    free(labeled_geometry->label);
                    free(labeled_geometry->geometry);
                    free(labeled_geometry);
                }
                deconstruct_vector(monitor->geometries);
            }

            if (monitor->configuration) {
                while ((kv_pair = vector_iterator(monitor->configuration))) {
                    free(kv_pair->key);
                    free(kv_pair->value);
                    free(kv_pair);
                }
                deconstruct_vector(monitor->configuration);
            }
        }
    }

    if (configuration) {
        log_debug("Freeing memory for configuration");
        while ((kv_pair = vector_iterator(configuration))) {
            free(kv_pair->key);
            free(kv_pair->value);
            free(kv_pair);
        }
        deconstruct_vector(configuration);
    }

    /* Free rules, if any */

    if (rules) {
        log_debug("Freeing memory for rules");
        rule_t *rule;
        while ((rule = vector_iterator(rules))) {
            free(rule->expression);

            if (rule->rules) {
                while ((kv_pair = vector_iterator(rule->rules))) {
                    free(kv_pair->key);
                    free(kv_pair->value);
                    free(kv_pair);
                }
                deconstruct_vector(rule->rules);
            }
        }
        deconstruct_vector(rules);
    }

    finalize_xcb();
    finalize_ewmh();
    finalize_socket();

    free(rc_path);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq 0x7ab9(%rip), %rax      # 0xd8e8
cmpq $0x0, (%rax)
je 0x5e90
movl $0x3, %edi
leaq 0x4570(%rip), %rsi      # 0xa3b1
leaq 0x476e(%rip), %rdx      # 0xa5b6
movl $0xc0, %ecx
leaq 0x476b(%rip), %r8       # 0xa5bf
movb $0x0, %al
callq 0x5bf0
leaq 0x7a86(%rip), %rax      # 0xd8e8
movq (%rax), %rdi
callq 0x38c0
movq %rax, -0x8(%rbp)
cmpq $0x0, %rax
je 0x5e81
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x8680
jmp 0x5e5b
leaq 0x7a60(%rip), %rax      # 0xd8e8
movq (%rax), %rdi
callq 0x3b00
leaq 0x7a41(%rip), %rax      # 0xd8d8
cmpq $0x0, (%rax)
je 0x5fae
movl $0x3, %edi
leaq 0x4504(%rip), %rsi      # 0xa3b1
leaq 0x4702(%rip), %rdx      # 0xa5b6
movl $0xcb, %ecx
leaq 0x471a(%rip), %r8       # 0xa5da
movb $0x0, %al
callq 0x5bf0
leaq 0x7a0a(%rip), %rax      # 0xd8d8
movq (%rax), %rdi
callq 0x38c0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5fac
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3060
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3060
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x5f52
jmp 0x5f0a
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x38c0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x5f45
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3060
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x3060
movq -0x20(%rbp), %rdi
callq 0x3060
jmp 0x5f0a
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3b00
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x5fa7
jmp 0x5f5f
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x38c0
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x5f9a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x3060
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3060
movq -0x10(%rbp), %rdi
callq 0x3060
jmp 0x5f5f
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x3b00
jmp 0x5ec7
jmp 0x5fae
leaq 0x790b(%rip), %rax      # 0xd8c0
cmpq $0x0, (%rax)
je 0x602d
movl $0x3, %edi
leaq 0x43ea(%rip), %rsi      # 0xa3b1
leaq 0x45e8(%rip), %rdx      # 0xa5b6
movl $0xe6, %ecx
leaq 0x461c(%rip), %r8       # 0xa5f6
movb $0x0, %al
callq 0x5bf0
leaq 0x78d8(%rip), %rax      # 0xd8c0
movq (%rax), %rdi
callq 0x38c0
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x601e
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x3060
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3060
movq -0x10(%rbp), %rdi
callq 0x3060
jmp 0x5fe1
leaq 0x789b(%rip), %rax      # 0xd8c0
movq (%rax), %rdi
callq 0x3b00
leaq 0x78ac(%rip), %rax      # 0xd8e0
cmpq $0x0, (%rax)
je 0x60ef
movl $0x3, %edi
leaq 0x4367(%rip), %rsi      # 0xa3b1
leaq 0x4565(%rip), %rdx      # 0xa5b6
movl $0xf2, %ecx
leaq 0x45ba(%rip), %r8       # 0xa617
movb $0x0, %al
callq 0x5bf0
leaq 0x7875(%rip), %rax      # 0xd8e0
movq (%rax), %rdi
callq 0x38c0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x60e0
movq -0x28(%rbp), %rax
movq (%rax), %rdi
callq 0x3060
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x60de
jmp 0x6096
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x38c0
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x60d1
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x3060
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3060
movq -0x10(%rbp), %rdi
callq 0x3060
jmp 0x6096
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3b00
jmp 0x6064
leaq 0x77f9(%rip), %rax      # 0xd8e0
movq (%rax), %rdi
callq 0x3b00
callq 0x8aa0
callq 0x8e00
callq 0x5220
movq 0x77c3(%rip), %rdi      # 0xd8c8
callq 0x3060
addq $0x30, %rsp
popq %rbp
retq