// File: /workspace/github_c_makefile_star2_O0/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: load_builtin_caps
static int load_builtin_caps(void) {
    int i, j;
    const char *term = getenv("TERM");

    if (!term) {
        return TB_ERR_NO_TERM;
    }

    // Check for exact TERM match
    for (i = 0; builtin_terms[i].name != NULL; i++) {
        if (strcmp(term, builtin_terms[i].name) == 0) {
            for (j = 0; j < TB_CAP__COUNT; j++) {
                global.caps[j] = builtin_terms[i].caps[j];
            }
            return TB_OK;
        }
    }

    // Check for partial TERM or alias match
    for (i = 0; builtin_terms[i].name != NULL; i++) {
        if (strstr(term, builtin_terms[i].name) != NULL ||
            (*(builtin_terms[i].alias) != '\0' &&
                strstr(term, builtin_terms[i].alias) != NULL))
        {
            for (j = 0; j < TB_CAP__COUNT; j++) {
                global.caps[j] = builtin_terms[i].caps[j];
            }
            return TB_OK;
        }
    }

    return TB_ERR_UNSUPPORTED_TERM;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x27707(%rip), %rdi     # 0x33fc6
callq 0x6030
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xc8db
movl $0xfffffff9, -0x4(%rbp) # imm = 0xFFFFFFF9
jmp 0xca73
movl $0x0, -0x8(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0x2da93(%rip), %rax     # 0x3a380
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0xc983
movq -0x18(%rbp), %rdi
movslq -0x8(%rbp), %rcx
leaq 0x2da73(%rip), %rax     # 0x3a380
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x6310
cmpl $0x0, %eax
jne 0xc973
movl $0x0, -0xc(%rbp)
cmpl $0x24, -0xc(%rbp)
jge 0xc967
movslq -0x8(%rbp), %rcx
leaq 0x2da47(%rip), %rax     # 0x3a380
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movslq -0xc(%rbp), %rcx
leaq 0x2f541(%rip), %rax     # 0x3be98
movq %rdx, 0x50(%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xc928
movl $0x0, -0x4(%rbp)
jmp 0xca73
jmp 0xc975
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xc8e2
movl $0x0, -0x8(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0x2d9eb(%rip), %rax     # 0x3a380
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0xca6c
movq -0x18(%rbp), %rdi
movslq -0x8(%rbp), %rcx
leaq 0x2d9cb(%rip), %rax     # 0x3a380
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x65f0
cmpq $0x0, %rax
jne 0xca0d
movslq -0x8(%rbp), %rcx
leaq 0x2d9ab(%rip), %rax     # 0x3a380
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xca5c
movq -0x18(%rbp), %rdi
movslq -0x8(%rbp), %rcx
leaq 0x2d989(%rip), %rax     # 0x3a380
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
callq 0x65f0
cmpq $0x0, %rax
je 0xca5c
movl $0x0, -0xc(%rbp)
cmpl $0x24, -0xc(%rbp)
jge 0xca53
movslq -0x8(%rbp), %rcx
leaq 0x2d95b(%rip), %rax     # 0x3a380
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movslq -0xc(%rbp), %rcx
leaq 0x2f455(%rip), %rax     # 0x3be98
movq %rdx, 0x50(%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xca14
movl $0x0, -0x4(%rbp)
jmp 0xca73
jmp 0xca5e
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xc98a
movl $0xffffffef, -0x4(%rbp) # imm = 0xFFFFFFEF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)