// File: /workspace/github_c_makefile_star2_O0/comfies[P]custard/src/ipc/ipc.c
// Function: ipc_sub_command_match_window
void ipc_sub_command_match_window(vector_t *input) {
    /*
     * Usage:
     *  custard - match window.name [expression] ([configurable] [value])...
     * custard - match window.class [expression] ([configurable] [value])...
     */

    input->remaining++;
    char *subject = vector_iterator(input);
    char *expression = vector_iterator(input);

    window_attribute_t attribute;

    if (!strcmp(subject, "window.name"))
        attribute = name;
    else if (!strcmp(subject, "window.class"))
        attribute = class;
    else return;

    rule_t *rule = create_or_get_rule(attribute, expression);
    if (!rule->rules)
        rule->rules = construct_vector();

    char *configurables[10] = {
        "borders",
        "border.size.outer",
        "border.size.inner",
        "border.color.focused",
        "border.color.unfocused",
        "border.color.background",
        "border.colors.flipped",
        "geometry",
        "monitor",
        "workspace"
    };
    unsigned int index = 0;
    kv_pair_t *setting;

    char *variable;
    char *value_string;

    while (input->remaining > 0) {
        variable = vector_iterator(input);
        value_string = vector_iterator(input);

        for (index = 0; index < 10;) {
            if (!strcmp(configurables[index++], variable)) {
                setting = create_or_get_kv_pair(rule->rules, variable);
                ipc_helper_typecast_and_assign(setting->value,
                    variable, value_string);
                break;
            }
        }
    }

    add_rule(rule);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rdi
callq 0x38c0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x38c0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x54e8(%rip), %rsi      # 0xa1d9
callq 0x3380
cmpl $0x0, %eax
jne 0x4d04
movl $0x0, -0x1c(%rbp)
jmp 0x4d29
movq -0x10(%rbp), %rdi
leaq 0x54d6(%rip), %rsi      # 0xa1e5
callq 0x3380
cmpl $0x0, %eax
jne 0x4d22
movl $0x1, -0x1c(%rbp)
jmp 0x4d27
jmp 0x4e28
jmp 0x4d29
movl -0x1c(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x7c20
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x4d54
callq 0x3860
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
leaq -0x80(%rbp), %rdi
leaq 0x7fd1(%rip), %rsi      # 0xcd30
movl $0x50, %edx
callq 0x3400
movl $0x0, -0x84(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jbe 0x4e1f
movq -0x8(%rbp), %rdi
callq 0x38c0
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rdi
callq 0x38c0
movq %rax, -0xa0(%rbp)
movl $0x0, -0x84(%rbp)
cmpl $0xa, -0x84(%rbp)
jae 0x4e1a
movl -0x84(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x84(%rbp)
movl %eax, %eax
movq -0x80(%rbp,%rax,8), %rdi
movq -0x98(%rbp), %rsi
callq 0x3380
cmpl $0x0, %eax
jne 0x4e18
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x98(%rbp), %rsi
callq 0x55f0
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x98(%rbp), %rsi
movq -0xa0(%rbp), %rdx
callq 0x4a70
jmp 0x4e1a
jmp 0x4dab
jmp 0x4d73
movq -0x28(%rbp), %rdi
callq 0x7cf0
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)