LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilecache.c
// Function: sirfile_writeheader
bool _sirfile_writeheader(sirfile* sf, const char* msg) {
    bool retval = _sirfile_validate(sf) && _sir_validstr(msg);

    if (retval) {
        time_t now = -1;
        (void)time(&now);

        char timestamp[SIR_MAXTIME] = {0};
        bool fmttime = _sir_formattime(now, timestamp, SIR_FHTIMEFORMAT);
        if (!fmttime)
            return false;

        char header[SIR_MAXFHEADER] = {0};
        (void)snprintf(header, SIR_MAXFHEADER, SIR_FHFORMAT, msg, timestamp);

        retval = _sirfile_write(sf, header);
    }

    return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x3c66
testb %al, %al
je 0x3f5a
leaq 0x59da(%rip), %rdx      # 0x9867
pushq $0x1
popq %rsi
movq %r14, %rdi
movl $0x9e, %ecx
callq 0x3b76
testb %al, %al
je 0x3f5a
leaq 0x8(%rsp), %r12
orq $-0x1, (%r12)
movq %r12, %rdi
callq 0x22b0
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq (%r12), %rdi
leaq 0x599f(%rip), %rdx      # 0x987c
movq %r15, %rsi
callq 0x3f6e
movl %eax, %ebp
movb $0x1, %al
testb %bpl, %bpl
je 0x3f55
leaq 0x50(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%r12)
movaps %xmm0, 0x60(%r12)
movaps %xmm0, 0x50(%r12)
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq %r15, (%rsp)
leaq 0x5966(%rip), %r8       # 0x9896
pushq $0x1
popq %rdx
movl $0x80, %esi
movl $0x80, %ecx
movq %r12, %rdi
movq %r14, %r9
xorl %eax, %eax
callq 0x2040
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3cf8
andb %al, %bpl
jmp 0x3f5c
xorl %ebp, %ebp
movl %ebp, %eax
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilecache.c
// Function: sirfile_needsroll
bool _sirfile_needsroll(sirfile* sf) {
    bool retval = _sirfile_validate(sf);

    if (retval) {
        struct stat st = {0};
        int getstat    = fstat(fileno(sf->f), &st);

        if (0 != getstat) { /* if fstat fails, try stat on the path. */
            getstat = stat(sf->path, &st);
            if (0 != getstat)
                return _sir_handleerr(errno);
        }

        retval = st.st_size + BUFSIZ >= SIR_FROLLSIZE ||
            SIR_FROLLSIZE - (st.st_size + BUFSIZ) <= BUFSIZ;
    }

    return retval;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
callq 0x3c66
testb %al, %al
je 0x4061
leaq 0x8(%rsp), %r14
movl $0x90, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x21b0
movq 0x10(%rbx), %rdi
callq 0x22c0
movl %eax, %edi
movq %r14, %rsi
callq 0x2430
testl %eax, %eax
je 0x4065
movq (%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2250
testl %eax, %eax
je 0x4065
callq 0x2080
movl (%rax), %edi
leaq 0x5866(%rip), %rsi      # 0x98ac
leaq 0x57c1(%rip), %rdx      # 0x980e
movl $0xbc, %ecx
addq $0x98, %rsp
popq %rbx
popq %r14
jmp 0x3231
xorl %eax, %eax
jmp 0x4071
cmpq $0x4fc000, 0x38(%rsp)   # imm = 0x4FC000
setge %al
addq $0x98, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/include/sir/helpers.h
// Function: _sir_validptrptr
static inline
bool __sir_validptrptr(const void* restrict* pp, bool fail, const char* func,
    const char* file, uint32_t line) {
    bool valid = NULL != pp;
    if (fail && !valid) {
        (void)__sir_seterror(_SIR_E_NULLPTR, func, file, line);
        SIR_ASSERT(!valid && fail);
    }
    return valid;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x4273
movl %edx, %ecx
leaq 0x55a5(%rip), %rdx      # 0x980e
movl $0x800b0000, %edi       # imm = 0x800B0000
callq 0x3138
testq %rbx, %rbx
setne %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilecache.c
// Function: sirfile_archive
bool _sirfile_archive(sirfile* sf, const char* newpath) {
    bool retval = _sirfile_validate(sf) && _sir_validstr(newpath);

    if (retval) {
#if defined(__WIN__)
        /* apparently, need to close the old file first on windows. */
        _sirfile_close(sf);
#endif
        if (0 != rename(sf->path, newpath)) {
            retval = _sir_handleerr(errno);
        } else {
            retval = _sirfile_open(sf);
            if (retval)
                _sir_selflog("archived '%s' " SIR_R_ARROW " '%s'", sf->path, newpath);
        }
    }

    return retval;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x3c66
testb %al, %al
je 0x44a5
leaq 0x54ad(%rip), %rdx      # 0x9909
pushq $0x1
popq %rsi
movq %r14, %rdi
movl $0x12c, %ecx            # imm = 0x12C
callq 0x3b76
testb %al, %al
je 0x44a5
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x2390
testl %eax, %eax
je 0x44af
callq 0x2080
movl (%rax), %edi
leaq 0x547c(%rip), %rsi      # 0x9909
leaq 0x537a(%rip), %rdx      # 0x980e
movl $0x134, %ecx            # imm = 0x134
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3231
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3bad
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilecache.c
// Function: sir_fcache_find
sirfile* _sir_fcache_find(const sirfcache* sfc, const void* match, sir_fcache_pred pred) {
    bool valid = _sir_validptr(sfc) && _sir_validptr(match) && _sir_validfnptr(pred);

    if (valid) {
        for (size_t n = 0; n < sfc->count; n++) {
            if (pred(match, sfc->files[n]))
                return sfc->files[n];
        }
    }

    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x5412(%rip), %rdx      # 0x9982
pushq $0x1
popq %rsi
movl $0x237, %ecx            # imm = 0x237
callq 0x3cb7
testb %al, %al
je 0x45bd
leaq 0x53fa(%rip), %rdx      # 0x9982
pushq $0x1
popq %rsi
movq %r15, %rdi
movl $0x237, %ecx            # imm = 0x237
callq 0x3cb7
testb %al, %al
je 0x45bd
xorl %r12d, %r12d
xorl %r13d, %r13d
cmpq 0x80(%r14), %r13
jae 0x45c0
movq (%r14,%r13,8), %rsi
movq %r15, %rdi
callq *%rbx
testb %al, %al
jne 0x45cd
incq %r13
jmp 0x45a2
xorl %r12d, %r12d
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq (%r14,%r13,8), %r12
jmp 0x45c0
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilecache.c
// Function: sir_fcache_shift
void _sir_fcache_shift(sirfcache* sfc, size_t idx) {
    if (_sir_validptr(sfc) && sfc->count <= SIR_MAXFILES) {
        for (size_t n = idx; n < sfc->count - 1; n++) {
            sfc->files[n] = sfc->files[n + 1];
            sfc->files[n + 1] = NULL;
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x526f(%rip), %rdx      # 0x9970
pushq $0x1
popq %rsi
movl $0x1e3, %ecx            # imm = 0x1E3
callq 0x3cb7
testb %al, %al
je 0x473b
movq 0x80(%rbx), %rax
cmpq $0x10, %rax
ja 0x473b
decq %rax
cmpq %rax, %r14
jae 0x473b
movq 0x8(%rbx,%r14,8), %rcx
movq %rcx, (%rbx,%r14,8)
andq $0x0, 0x8(%rbx,%r14,8)
incq %r14
jmp 0x4722
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilecache.c
// Function: sir_fcache_destroy
bool _sir_fcache_destroy(sirfcache* sfc) {
    bool retval = _sir_validptr(sfc);

    if (retval) {
        while (sfc->count > 0) {
            size_t idx = sfc->count - 1;
            SIR_ASSERT(_sirfile_validate(sfc->files[idx]));
            _sirfile_destroy(&sfc->files[idx]);
            sfc->files[idx] = NULL;
            sfc->count--;
        }

        (void)_sir_explicit_memset(sfc, 0, sizeof(sirfcache));
    }

    return retval;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x5242(%rip), %rdx      # 0x9993
pushq $0x1
popq %rsi
movl $0x244, %ecx            # imm = 0x244
callq 0x3cb7
movl %eax, %ebp
testb %al, %al
je 0x47a6
movq 0x80(%rbx), %rax
testq %rax, %rax
je 0x4797
leaq (%rbx,%rax,8), %r14
addq $-0x8, %r14
movq %r14, %rdi
callq 0x3c8a
andq $0x0, (%r14)
movq 0x80(%rbx), %rax
decq %rax
movq %rax, 0x80(%rbx)
jmp 0x476b
movl $0x88, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x56a2
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilesystem.c
// Function: sir_getrelbasepath
bool _sir_getrelbasepath(const char* restrict path, bool* restrict relative,
    const char* restrict* restrict base_path, sir_rel_to rel_to) {
    if (!_sir_validstr(path) || !_sir_validptr(relative) ||
        !_sir_validptrptr(base_path) || !_sir_ispathrelative(path, relative))
        return false;

    if (*relative) {
        switch (rel_to) {
            case SIR_PATH_REL_TO_APP: return NULL != (*base_path = _sir_getappdir());
            case SIR_PATH_REL_TO_CWD: return NULL != (*base_path = _sir_getcwd());
            default: return _sir_seterror(_SIR_E_INVALID);
        }
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x4fb2(%rip), %rsi      # 0x9aad
movl $0x1c1, %edx            # imm = 0x1C1
callq 0x4a88
testb %al, %al
je 0x4b64
leaq 0x4f9d(%rip), %rdx      # 0x9aad
pushq $0x1
popq %rsi
movq %r14, %rdi
movl $0x1c1, %ecx            # imm = 0x1C1
callq 0x4ab0
testb %al, %al
je 0x4b64
leaq 0x4f82(%rip), %rsi      # 0x9aad
movq %rbx, %rdi
movl $0x1c2, %edx            # imm = 0x1C2
callq 0x4d4b
testb %al, %al
je 0x4b64
movq %r15, %rdi
movq %r14, %rsi
callq 0x4fe3
testb %al, %al
je 0x4b64
movb $0x1, %al
cmpb $0x1, (%r14)
jne 0x4b66
cmpl $0x1, %ebp
je 0x4b71
cmpl $0x2, %ebp
jne 0x4b81
callq 0x4f51
jmp 0x4b76
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x4d6f
movq %rax, (%rbx)
testq %rax, %rax
setne %al
jmp 0x4b66
leaq 0x4f25(%rip), %rsi      # 0x9aad
leaq 0x4e63(%rip), %rdx      # 0x99f2
movl $0x800c0000, %edi       # imm = 0x800C0000
movl $0x1c9, %ecx            # imm = 0x1C9
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3138
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilesystem.c
// Function: sir_pathexists
bool _sir_pathexists(const char* path, bool* exists, sir_rel_to rel_to) {
    if (!_sir_validstr(path) || !_sir_validptr(exists))
        return false;

    *exists = false;

    struct stat st = {0};
    bool stat_ret  = _sir_pathgetstat(path, &st, rel_to);
    if (!stat_ret)
        return false;

    *exists = (st.st_size != SIR_STAT_NONEXISTENT);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4e44(%rip), %rsi      # 0x9a08
movl $0x89, %edx
callq 0x4a88
testb %al, %al
je 0x4c24
leaq 0x4e2f(%rip), %rdx      # 0x9a08
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0x89, %ecx
callq 0x4ab0
testb %al, %al
je 0x4c24
movb $0x0, (%rbx)
leaq 0x8(%rsp), %r15
movl $0x90, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x21b0
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x4904
testb %al, %al
je 0x4c26
movl $0xffffff02, %ecx       # imm = 0xFFFFFF02
cmpq %rcx, 0x38(%rsp)
setne (%rbx)
jmp 0x4c26
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilesystem.c
// Function: sir_openfile
bool _sir_openfile(FILE* restrict* restrict f, const char* restrict path,
    const char* restrict mode, sir_rel_to rel_to) {
    if (!_sir_validptrptr(f) || !_sir_validstr(path) || !_sir_validstr(mode))
        return false;

    bool relative         = false;
    const char* base_path = NULL;

    if (!_sir_getrelbasepath(path, &relative, &base_path, rel_to))
        return false;

    if (relative) {
        char abs_path[SIR_MAXPATH] = {0};
        (void)snprintf(abs_path, SIR_MAXPATH, "%s/%s", base_path, path);

        int ret = _sir_fopen(f, abs_path, mode);
        _sir_safefree(&base_path);
        return 0 == ret;
    }

    return 0 == _sir_fopen(f, path, mode);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1028, %rsp           # imm = 0x1028
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x4dc1(%rip), %rsi      # 0x9a18
movl $0x99, %edx
callq 0x4d4b
testb %al, %al
je 0x4d22
leaq 0x4da8(%rip), %rsi      # 0x9a18
movq %r15, %rdi
movl $0x99, %edx
callq 0x4a88
testb %al, %al
je 0x4d22
leaq 0x4d8c(%rip), %rsi      # 0x9a18
movq %rbx, %rdi
movl $0x99, %edx
callq 0x4a88
testb %al, %al
je 0x4d22
leaq 0x17(%rsp), %rsi
movb $0x0, (%rsi)
leaq 0x18(%rsp), %rdx
andq $0x0, (%rdx)
movq %r15, %rdi
movl %ebp, %ecx
callq 0x4ae2
testb %al, %al
je 0x4d22
cmpb $0x1, 0x17(%rsp)
jne 0x4d36
leaq 0x20(%rsp), %r12
movl $0x1000, %edx           # imm = 0x1000
movq %r12, %rdi
xorl %esi, %esi
callq 0x21b0
leaq 0x18(%rsp), %r13
movq (%r13), %r9
movq %r15, (%rsp)
leaq 0x4d13(%rip), %r8       # 0x9a02
pushq $0x1
popq %rdx
movl $0x1000, %esi           # imm = 0x1000
movl $0x1000, %ecx           # imm = 0x1000
movq %r12, %rdi
xorl %eax, %eax
callq 0x2040
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x551e
movl %eax, %ebx
movq %r13, %rdi
callq 0x5098
testl %ebx, %ebx
jmp 0x4d46
xorl %eax, %eax
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x551e
testl %eax, %eax
sete %al
jmp 0x4d24
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilesystem.c
// Function: sir_getappbasename
char* _sir_getappbasename(void) {
    char* filename = _sir_getappfilename();
    if (!_sir_validstr(filename)) {
        _sir_safefree(&filename);
        return NULL;
    }

    const char* retval = _sir_getbasename(filename);
    char* bname = strndup(retval, strnlen(retval, SIR_MAXPATH));

    _sir_safefree(&filename);
    return bname;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
callq 0x4da1
movq %rax, %rbx
movq %rax, 0x8(%rsp)
leaq 0x4b7d(%rip), %rsi      # 0x9a55
movq %rax, %rdi
movl $0x17d, %edx            # imm = 0x17D
callq 0x4a88
testb %al, %al
je 0x4f11
movq %rbx, %rdi
callq 0x4f26
movq %rax, %rbx
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rdi
callq 0x21c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2200
movq %rax, %rbx
jmp 0x4f13
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x5098
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilesystem.c
// Function: sir_getappdir
char* _sir_getappdir(void) {
    char* filename = _sir_getappfilename();
    if (!_sir_validstr(filename)) {
        _sir_safefree(&filename);
        return NULL;
    }

    const char* retval = _sir_getdirname(filename);
    char* dname = strndup(retval, strnlen(retval, SIR_MAXPATH));

    _sir_safefree(&filename);
    return dname;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
callq 0x4da1
movq %rax, %rbx
movq %rax, 0x8(%rsp)
leaq 0x4aff(%rip), %rsi      # 0x9a69
movq %rax, %rdi
movl $0x18b, %edx            # imm = 0x18B
callq 0x4a88
testb %al, %al
je 0x4fa3
movq %rbx, %rdi
callq 0x4fb8
movq %rax, %rbx
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rdi
callq 0x21c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2200
movq %rax, %rbx
jmp 0x4fa5
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x5098
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilesystem.c
// Function: sir_ispathrelative
bool _sir_ispathrelative(const char* restrict path, bool* restrict relative) {
    bool valid = _sir_validstr(path) && _sir_validptr(relative);

    if (valid) {
#if !defined(__WIN__)
        if (path[0] == '/' || (path[0] == '~' && path[1] == '/'))
            *relative = false;
        else
            *relative = true;
#else /* __WIN__ */
        *relative = (TRUE == PathIsRelativeA(path));
#endif
    }

    return valid;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4aa5(%rip), %rsi      # 0x9a99
movl $0x1af, %edx            # imm = 0x1AF
callq 0x4a88
testb %al, %al
je 0x5036
leaq 0x4a90(%rip), %rdx      # 0x9a99
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0x1af, %ecx            # imm = 0x1AF
callq 0x4ab0
testb %al, %al
je 0x5036
movzbl (%r14), %eax
cmpl $0x2f, %eax
je 0x5032
cmpl $0x7e, %eax
jne 0x503a
cmpb $0x2f, 0x1(%r14)
jne 0x503a
xorl %eax, %eax
jmp 0x503c
xorl %eax, %eax
jmp 0x5040
movb $0x1, %al
movb %al, (%rbx)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirfilesystem.c
// Function: sir_deletefile
bool _sir_deletefile(const char* restrict path) {
    if (!_sir_validstr(path))
        return false;

#if !defined(__WIN__)
    return (0 == unlink(path)) ? true : _sir_handleerr(errno);
#else /* __WIN__ */
    return (FALSE != DeleteFileA(path)) ? true : _sir_handlewin32err(GetLastError());
#endif
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x4a6e(%rip), %rsi      # 0x9ac1
movl $0x285, %edx            # imm = 0x285
callq 0x4a88
testb %al, %al
je 0x508d
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
je 0x5091
callq 0x2080
movl (%rax), %edi
leaq 0x4a46(%rip), %rsi      # 0x9ac1
leaq 0x4970(%rip), %rdx      # 0x99f2
movl $0x289, %ecx            # imm = 0x289
popq %rbx
jmp 0x3231
xorl %eax, %eax
jmp 0x5093
movb $0x1, %al
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_safeclose
void _sir_safeclose(int* restrict fd) {
    if (!fd || 0 > *fd)
        return;

    if (-1 == close(*fd))
        (void)_sir_handleerr(errno);

    *fd = -1;
}

// Assembly:
testq %rdi, %rdi
je 0x50ee
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
testl %edi, %edi
js 0x50ed
callq 0x21d0
cmpl $-0x1, %eax
jne 0x50ea
callq 0x2080
movl (%rax), %edi
leaq 0x49f6(%rip), %rsi      # 0x9ad1
leaq 0x49fe(%rip), %rdx      # 0x9ae0
pushq $0x31
popq %rcx
callq 0x3231
orl $-0x1, (%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_safefclose
void _sir_safefclose(FILE* restrict* restrict f) {
    if (!f || !*f)
        return;

    if (0 != fclose(*f))
        (void)_sir_handleerr(errno);

    *f = NULL;
}

// Assembly:
testq %rdi, %rdi
je 0x512b
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x512a
callq 0x2110
testl %eax, %eax
je 0x5126
callq 0x2080
movl (%rax), %edi
leaq 0x49d6(%rip), %rsi      # 0x9aed
leaq 0x49c2(%rip), %rdx      # 0x9ae0
pushq $0x3b
popq %rcx
callq 0x3231
andq $0x0, (%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_validfd
bool _sir_validfd(int fd) {
    /** stdin, stdout, stderr use up 0, 1, 2 */
    if (2 >= fd)
        return _sir_handleerr(EBADF);

#if !defined(__WIN__)
    int ret = fcntl(fd, F_GETFL);
#else /* __WIN__ */
# if !defined(SIR_MSVCRT_MINGW)
    invalparamfn old = _set_thread_local_invalid_parameter_handler(_sir_invalidparameter);
# endif
    struct _stat st;
    int ret = _fstat(fd, &st);
# if !defined(SIR_MSVCRT_MINGW)
    _set_thread_local_invalid_parameter_handler(old);
# endif
#endif
    return (-1 != ret || EBADF != errno) ? true : _sir_handleerr(errno);
}

// Assembly:
pushq %rax
cmpl $0x3, %edi
jge 0x514c
pushq $0x43
popq %rcx
leaq 0x49c1(%rip), %rsi      # 0x9afd
leaq 0x499d(%rip), %rdx      # 0x9ae0
pushq $0x9
popq %rdi
popq %rax
jmp 0x3231
pushq $0x3
popq %rsi
xorl %eax, %eax
callq 0x20e0
cmpl $-0x1, %eax
jne 0x5169
callq 0x2080
cmpl $0x9, (%rax)
jne 0x5169
pushq $0x51
jmp 0x5134
movb $0x1, %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: _sir_validupdatedata
bool __sir_validupdatedata(const sir_update_config_data* data, const char* func,
    const char* file, uint32_t line) {
    if (!_sir_validptr(data))
        return false;

    bool valid = true;
    if ((data->fields & SIRU_ALL) == 0U || (data->fields & ~SIRU_ALL) != 0U)
        valid = false;

    if (valid && _sir_bittest(data->fields, SIRU_LEVELS))
        valid = _sir_validptrnofail(data->levels) &&
                _sir_validlevels(*data->levels);

    if (valid && _sir_bittest(data->fields, SIRU_OPTIONS))
        valid = _sir_validptrnofail(data->opts) &&
                _sir_validopts(*data->opts);

    if (valid && _sir_bittest(data->fields, SIRU_SYSLOG_ID))
        valid = _sir_validstrnofail(data->sl_identity);

    if (valid && _sir_bittest(data->fields, SIRU_SYSLOG_CAT))
        valid = _sir_validstrnofail(data->sl_category);

    if (!valid) {
        SIR_ASSERT(valid);
        (void)__sir_seterror(_SIR_E_INVALID, func, file, line);
    }

    return valid;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x4983(%rip), %rdx      # 0x9b0a
pushq $0x1
popq %rsi
pushq $0x57
popq %rcx
callq 0x525d
testb %al, %al
je 0x524f
movl (%r12), %ecx
testb $0xf, %cl
setne %dl
cmpl $0x10, %ecx
setb %al
andb %dl, %al
movl %eax, %edx
xorb $0x1, %dl
testb $0x1, %cl
sete %cl
orb %dl, %cl
jne 0x51de
movq 0x8(%r12), %rax
testq %rax, %rax
je 0x523d
movzwl (%rax), %edi
leaq 0x493b(%rip), %rsi      # 0x9b0a
leaq 0x490a(%rip), %rdx      # 0x9ae0
pushq $0x60
popq %rcx
callq 0x528f
testb %al, %al
je 0x523d
testb $0x2, (%r12)
je 0x520f
movq 0x10(%r12), %rax
testq %rax, %rax
je 0x523d
movl (%rax), %edi
leaq 0x490e(%rip), %rsi      # 0x9b0a
leaq 0x48dd(%rip), %rdx      # 0x9ae0
pushq $0x64
popq %rcx
callq 0x52c2
testb %al, %al
je 0x523d
testb $0x4, (%r12)
je 0x5225
movq 0x18(%r12), %rax
testq %rax, %rax
je 0x523d
cmpb $0x0, (%rax)
je 0x523d
movb $0x1, %al
testb $0x8, (%r12)
je 0x5251
movq 0x20(%r12), %rcx
testq %rcx, %rcx
je 0x523d
cmpb $0x0, (%rcx)
jne 0x5251
movl $0x800c0000, %edi       # imm = 0x800C0000
movq %r15, %rsi
movq %r14, %rdx
movl %ebx, %ecx
callq 0x3138
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: _sir_validlevels
bool __sir_validlevels(sir_levels levels, const char* func,
    const char* file, uint32_t line) {
    if ((SIRL_ALL == levels || SIRL_NONE == levels) ||
        ((_sir_bittest(levels, SIRL_INFO)           ||
         _sir_bittest(levels, SIRL_DEBUG)           ||
         _sir_bittest(levels, SIRL_NOTICE)          ||
         _sir_bittest(levels, SIRL_WARN)            ||
         _sir_bittest(levels, SIRL_ERROR)           ||
         _sir_bittest(levels, SIRL_CRIT)            ||
         _sir_bittest(levels, SIRL_ALERT)           ||
         _sir_bittest(levels, SIRL_EMERG))          &&
         ((levels & ~SIRL_ALL) == 0U)))
         return true;

    _sir_selflog("invalid levels: %04"PRIx16, levels);
    return __sir_seterror(_SIR_E_LEVELS, func, file, line);
}

// Assembly:
testl %edi, %edi
je 0x52a8
cmpl $0xff, %edi
je 0x52a8
testb $-0x2, %dil
je 0x52ab
cmpw $0x100, %di             # imm = 0x100
jae 0x52b8
movb $0x1, %al
retq
cmpw $0x100, %di             # imm = 0x100
setb %al
testb %dil, %al
jne 0x52a8
movl $0x80080000, %edi       # imm = 0x80080000
jmp 0x3138
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: _sir_validtextcolor
bool __sir_validtextcolor(sir_colormode mode, sir_textcolor color, const char* func,
    const char* file, uint32_t line) {
    bool valid = false;
    switch (mode) {
        case SIRCM_16:
            /* in 16-color mode:
             * compare to 30..37, 39, 40..47, 49, 90..97, 100..107. */
            valid = SIRTC_DEFAULT == color ||
                    (color >= 30U && color <= 37U) || color == 39U ||
                    (color >= 40U && color <= 47U) || color == 49U ||
                    (color >= 90U && color <= 97U) || (color >= 100U && color <= 107U);
            break;
        case SIRCM_256:
            /* in 256-color mode: compare to 0..255. sir_textcolor is unsigned,
             * so only need to ensure it's <= 255. */
            valid = SIRTC_DEFAULT == color || color <= 255U;
            break;
        case SIRCM_RGB: {
            /* in RGB-color mode: mask and compare to 0x00ffffff. */
            valid = SIRTC_DEFAULT == color || ((color & 0xff000000U) == 0U);
            break;
        }
        case SIRCM_INVALID: // GCOVR_EXCL_START
        default:
            valid = false;
            break;
    } // GCOVR_EXCL_STOP

    if (!valid) {
        _sir_selflog("invalid text color for mode %d %08"PRIx32" (%"PRIu32")",
            mode, color, color);
        (void)__sir_seterror(_SIR_E_TEXTCOLOR, func, file, line);
    }

    return valid;
}

// Assembly:
cmpl $0x2, %edi
je 0x539e
cmpl $0x1, %edi
je 0x5392
testl %edi, %edi
jne 0x53a8
movb $0x1, %al
cmpl $0x27, %esi
ja 0x53c3
movl %esi, %edi
movabsq $0xbfc0000000, %r9      # imm = 0xBFC0000000
btq %rdi, %r9
jae 0x53c3
retq
movb $0x1, %al
cmpl $0x101, %esi            # imm = 0x101
jb 0x5391
jmp 0x53a8
movb $0x1, %al
cmpl $0x1000000, %esi        # imm = 0x1000000
jb 0x5391
pushq %rax
movl $0x80120000, %edi       # imm = 0x80120000
movq %rdx, %rsi
movq %rcx, %rdx
movl %r8d, %ecx
callq 0x3138
xorl %eax, %eax
addq $0x8, %rsp
retq
cmpl $0x100, %esi            # imm = 0x100
je 0x5391
movl %esi, %edi
andl $-0x8, %edi
cmpl $0x28, %edi
je 0x5391
addl $-0x31, %esi
cmpl $0x3b, %esi
jae 0x53a8
movabsq $0x7f9fe0000000001, %rdi # imm = 0x7F9FE0000000001
btq %rsi, %rdi
jb 0x5391
jmp 0x53a8
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_strncpy
int _sir_strncpy(char* restrict dest, size_t destsz, const char* restrict src,
    size_t count) {
    if (_sir_validptr(dest) && _sir_validstr(src)) {
#if defined(__HAVE_STDC_SECURE_OR_EXT1__)
        int ret = strncpy_s(dest, destsz, src, count);
        if (0 != ret) {
            (void)_sir_handleerr(ret);
            return -1;
        }
        return 0;
#else
        SIR_UNUSED(count);
        size_t cpy = strlcpy(dest, src, destsz);
        SIR_ASSERT_UNUSED(cpy < destsz, cpy);
        return 0;
#endif
    }

    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x4708(%rip), %rdx      # 0x9b20
pushq $0x1
popq %rsi
movl $0xea, %ecx
callq 0x525d
pushq $-0x1
popq %rbp
testb %al, %al
je 0x546d
leaq 0x46ed(%rip), %rdx      # 0x9b20
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0xea, %ecx
callq 0x52f4
testb %al, %al
je 0x546d
testq %r15, %r15
je 0x546b
decq %r15
xorl %eax, %eax
cmpq %rax, %r15
je 0x5466
movb (%rbx,%rax), %cl
movb %cl, (%r14,%rax)
incq %rax
testb %cl, %cl
jne 0x5451
jmp 0x546b
movb $0x0, (%r14,%rax)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_strncat
int _sir_strncat(char* restrict dest, size_t destsz, const char* restrict src,
    size_t count) {
    if (_sir_validptr(dest) && _sir_validstr(src)) {
#if defined(__HAVE_STDC_SECURE_OR_EXT1__)
        int ret = strncat_s(dest, destsz, src, count);
        if (0 != ret) {
            (void)_sir_handleerr(ret);
            return -1;
        }
        return 0;
#else
        SIR_UNUSED(count);
        size_t cat = strlcat(dest, src, destsz);
        SIR_ASSERT_UNUSED(cat < destsz, cat);
        return 0;
#endif
    }

    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x469c(%rip), %rdx      # 0x9b2d
pushq $0x1
popq %rsi
movl $0xff, %ecx
callq 0x525d
pushq $-0x1
popq %rbp
testb %al, %al
je 0x5511
leaq 0x4681(%rip), %rdx      # 0x9b2d
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0xff, %ecx
callq 0x52f4
testb %al, %al
je 0x5511
leaq (%r15,%r14), %rax
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x54dd
cmpb $0x0, (%r15,%rcx)
je 0x54d7
incq %rcx
jmp 0x54c6
addq %r15, %rcx
movq %rcx, %rax
movq %rax, %rcx
subq %r15, %rcx
xorl %ebp, %ebp
cmpq %r14, %rcx
je 0x5511
notq %rcx
addq %r14, %rcx
movb (%rbx), %dl
testb %dl, %dl
je 0x550c
testq %rcx, %rcx
je 0x5505
movb %dl, (%rax)
incq %rax
decq %rcx
jmp 0x5507
xorl %ecx, %ecx
incq %rbx
jmp 0x54f0
movb $0x0, (%rax)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_getchar
bool _sir_getchar(char* input) {
#if defined(__WIN__)
# if defined(__EMBARCADEROC__) && (__clang_major__ < 15)
    if (input)
        *input = (char)getch();
# else
    if (input)
        *input = (char)_getch();
# endif
     return true;
#else /* !__WIN__ */
    struct termios cur = {0};
    if (0 != tcgetattr(STDIN_FILENO, &cur))
        return _sir_handleerr(errno);

    struct termios new = cur;
    new.c_lflag &= ~(ICANON | ECHO);

    if (0 != tcsetattr(STDIN_FILENO, TCSANOW, &new))
        return _sir_handleerr(errno);

    int ch = getchar();

    if (NULL != input)
        *input = (char)ch;

    return 0 == tcsetattr(STDIN_FILENO, TCSANOW, &cur) ? true
        : _sir_handleerr(errno);
#endif
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %rsi
movups %xmm0, 0x2c(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
xorl %edi, %edi
callq 0x2350
testl %eax, %eax
je 0x561a
callq 0x2080
movl (%rax), %edi
leaq 0x4539(%rip), %rsi      # 0x9b45
leaq 0x44cd(%rip), %rdx      # 0x9ae0
movl $0x136, %ecx            # imm = 0x136
jmp 0x568f
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movaps 0x20(%rsp), %xmm2
leaq 0x40(%rsp), %rdx
movaps %xmm0, (%rdx)
movups 0x2c(%rsp), %xmm0
movups %xmm0, 0x2c(%rdx)
movaps %xmm2, 0x20(%rdx)
movaps %xmm1, 0x10(%rdx)
andb $-0xb, 0xc(%rdx)
xorl %edi, %edi
xorl %esi, %esi
callq 0x2360
movl $0x13c, %ebp            # imm = 0x13C
testl %eax, %eax
jne 0x5678
callq 0x2230
testq %rbx, %rbx
je 0x5663
movb %al, (%rbx)
movq %rsp, %rdx
xorl %edi, %edi
xorl %esi, %esi
callq 0x2360
movl $0x144, %ebp            # imm = 0x144
testl %eax, %eax
je 0x569e
callq 0x2080
movl (%rax), %edi
leaq 0x44bf(%rip), %rsi      # 0x9b45
leaq 0x4453(%rip), %rdx      # 0x9ae0
movl %ebp, %ecx
callq 0x3231
addq $0x88, %rsp
popq %rbx
popq %rbp
retq
movb $0x1, %al
jmp 0x5694
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_strremove
char* _sir_strremove(char *str, const char *sub) {
    if (!str)
        return NULL;

    if (!sub)
        return str;

    char* r;
    char* q;

    if (*sub && (q = r = strstr(str, sub)) != NULL) {
        size_t len = strnlen(sub, strlen(str));
        const char* p;

        while ((r = strstr(p = r + len, sub)) != NULL)
            while (p < r)
                *q++ = *p++;

        while ((*q++ = *p++) != '\0');
    }

    return str;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x573e
movq %rsi, %r14
cmpb $0x0, (%rsi)
je 0x573e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2450
testq %rax, %rax
je 0x573e
movq %rax, %r15
movq %rbx, %rdi
callq 0x2130
movq %r14, %rdi
movq %rax, %rsi
callq 0x21c0
movq %rax, %r12
movq %r15, %rbp
leaq (%r15,%r12), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x2450
testq %rax, %rax
jne 0x5720
jmp 0x572a
movb (%r13), %cl
incq %r13
movb %cl, (%rbp)
incq %rbp
cmpq %rax, %r13
jb 0x5713
movq %rax, %r15
jmp 0x56fd
addq %r12, %r15
xorl %eax, %eax
movb (%r15,%rax), %cl
movb %cl, (%rbp,%rax)
incq %rax
testb %cl, %cl
jne 0x572f
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_strsqueeze
char* _sir_strsqueeze(char *str) {
    if (!str)
        return NULL;

    unsigned long j;

    for (unsigned long i = j = 0; str[i]; ++i)
        if ((i > 0 && !isspace((unsigned char)(str[i - 1])))
                   || !isspace((unsigned char)(str[i])))
            str[j++] = str[i];

    str[j] = '\0';

    return str;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
je 0x57a6
xorl %r14d, %r14d
xorl %r15d, %r15d
movzbl (%rbx,%r15), %r12d
testq %r12, %r12
je 0x57a1
callq 0x2480
testq %r15, %r15
je 0x578a
movq (%rax), %rcx
movzbl -0x1(%rbx,%r15), %edx
testb $0x20, 0x1(%rcx,%rdx,2)
je 0x5795
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r12,2)
jne 0x579c
movb %r12b, (%rbx,%r14)
incq %r14
incq %r15
jmp 0x5766
movb $0x0, (%rbx,%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_strredact
char* _sir_strredact(char *str, const char *sub, const char c) {
    if (!str)
        return NULL;

    if (!sub)
        return str;

    char *p = strstr(str, sub);

    if (!c || !p)
        return str;

    (void)_sir_explicit_memset(p, c, strnlen(sub, strlen(str)));

    return _sir_strredact(str, sub, c);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
testb %bl, %bl
sete %dl
orb %al, %cl
orb %dl, %cl
je 0x57e8
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rsi, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2450
testq %rax, %rax
je 0x57d9
movq %rax, %r12
movq %r14, %rdi
callq 0x2130
movq %r15, %rdi
movq %rax, %rsi
callq 0x21c0
movq 0x95b8(%rip), %rcx      # 0xedd0
movq %r12, %rdi
movl %ebx, %esi
movq %rax, %rdx
callq *%rcx
jmp 0x57eb
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_strreplace
char* _sir_strreplace(char *str, const char c, const char n) {
    if (!str)
        return NULL;

    char *i = str;

    if (!c || !n)
        return str;

    while ((i = strchr(i, c)) != NULL)
        *i++ = n;

    return str;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
testq %rdi, %rdi
je 0x585e
movl %edx, %ebx
testb %sil, %sil
sete %al
testb %bl, %bl
sete %cl
orb %al, %cl
jne 0x585e
movsbl %sil, %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x2140
testq %rax, %rax
je 0x585e
movq %rax, %rdi
incq %rdi
movb %bl, (%rax)
jmp 0x5848
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirhelpers.c
// Function: sir_strcreplace
size_t _sir_strcreplace(char *str, const char c, const char n, int32_t max) {
    char*  i   = str;
    size_t cnt = 0;

    if (!str || !c || !n || !max)
        return cnt;

    while (cnt < (size_t)max && (i = strchr(i, c)) != NULL) {
        *i++ = n;
        cnt++;
    }

    return cnt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
testq %rdi, %rdi
sete %al
testb %sil, %sil
sete %dl
orb %al, %dl
testb %bl, %bl
sete %al
testl %ecx, %ecx
sete %r8b
orb %al, %r8b
orb %dl, %r8b
jne 0x58b8
movsbl %sil, %ebp
movslq %ecx, %r14
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x58c0
movl %ebp, %esi
callq 0x2140
testq %rax, %rax
je 0x58bd
movq %rax, %rdi
incq %rdi
movb %bl, (%rax)
incq %r15
jmp 0x589a
xorl %r14d, %r14d
jmp 0x58c0
movq %r15, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_makeinit
bool _sir_makeinit(sirinit* si) {
    bool retval = _sir_validptr(si);

    if (retval) {
        (void)memset(si, 0, sizeof(sirinit));

        si->d_stdout.opts   = SIRO_DEFAULT;
        si->d_stdout.levels = SIRL_DEFAULT;

        si->d_stderr.opts   = SIRO_DEFAULT;
        si->d_stderr.levels = SIRL_DEFAULT;

#if !defined(SIR_NO_SYSTEM_LOGGERS)
        si->d_syslog.opts   = SIRO_DEFAULT;
        si->d_syslog.levels = SIRL_DEFAULT;
#else
        si->d_syslog.opts   = SIRO_MSGONLY;
        si->d_syslog.levels = SIRL_NONE;
#endif
    }

    return retval;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x42bb(%rip), %rdx      # 0x9b98
pushq $0x1
popq %rsi
pushq $0x5b
popq %rcx
callq 0x5923
movl %eax, %ebp
testb %al, %al
je 0x591a
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x21b0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0x100, %cx             # imm = 0x100
movw %cx, (%rbx)
movl %eax, 0xc(%rbx)
movw %cx, 0x8(%rbx)
movl %eax, 0x14(%rbx)
movw %cx, 0x10(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_init_sanity
bool _sir_init_sanity(const sirinit* si) {
    if (!_sir_validptr(si))
        return false;

    bool levelcheck = true;
    _sir_eqland(levelcheck, _sir_validlevels(si->d_stdout.levels));
    _sir_eqland(levelcheck, _sir_validlevels(si->d_stderr.levels));

    bool regcheck = true;
    _sir_eqland(regcheck, SIRL_NONE == si->d_stdout.levels);
    _sir_eqland(regcheck, SIRL_NONE == si->d_stderr.levels);

#if !defined(SIR_NO_SYSTEM_LOGGERS)
    _sir_eqland(levelcheck, _sir_validlevels(si->d_syslog.levels));
    _sir_eqland(regcheck, SIRL_NONE == si->d_syslog.levels);
#endif

    if (regcheck)
        _sir_selflog("warning: no level registrations set!");

    bool optscheck = true;
    _sir_eqland(optscheck, _sir_validopts(si->d_stdout.opts));
    _sir_eqland(optscheck, _sir_validopts(si->d_stderr.opts));

#if !defined(SIR_NO_SYSTEM_LOGGERS)
    _sir_eqland(optscheck, _sir_validopts(si->d_syslog.opts));
#endif

    return levelcheck && optscheck;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x4054(%rip), %rdx      # 0x9bda
pushq $0x1
popq %rsi
movl $0x11e, %ecx            # imm = 0x11E
callq 0x5923
testb %al, %al
je 0x5c3e
movzwl (%rbx), %edi
leaq 0x4035(%rip), %r14      # 0x9bda
leaq 0x3ffa(%rip), %r15      # 0x9ba6
movq %r14, %rsi
movq %r15, %rdx
movl $0x122, %ecx            # imm = 0x122
callq 0x528f
movb %al, 0x7(%rsp)
movzwl 0x8(%rbx), %edi
movq %r14, %rsi
movq %r15, %rdx
movl $0x123, %ecx            # imm = 0x123
callq 0x528f
movl %eax, %r13d
movzwl 0x10(%rbx), %edi
movq %r14, %rsi
movq %r15, %rdx
movl $0x12a, %ecx            # imm = 0x12A
callq 0x528f
movl %eax, %r12d
andb %r13b, %r12b
movl 0x4(%rbx), %edi
movq %r14, %rsi
movq %r15, %rdx
movl $0x132, %ecx            # imm = 0x132
callq 0x52c2
movl %eax, %ebp
movl 0xc(%rbx), %edi
movq %r14, %rsi
movq %r15, %rdx
movl $0x133, %ecx            # imm = 0x133
callq 0x52c2
movl %eax, %r13d
movl 0x14(%rbx), %edi
movq %r14, %rsi
movq %r15, %rdx
movl $0x136, %ecx            # imm = 0x136
callq 0x52c2
andb 0x7(%rsp), %al
andb %r12b, %al
andb %bpl, %r13b
andb %al, %r13b
jmp 0x5c41
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_locksection
void* _sir_locksection(sir_mutex_id mid) {
    sir_mutex* m = NULL;
    void* sec    = NULL;

    bool enter = _sir_mapmutexid(mid, &m, &sec) && _sir_mutexlock(m);
    SIR_ASSERT(enter);

    return enter ? sec : NULL;
}

// Assembly:
subq $0x18, %rsp
leaq 0x10(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0x8(%rsp), %rdx
andq $0x0, (%rdx)
callq 0x6425
testb %al, %al
je 0x5c87
movq 0x10(%rsp), %rdi
callq 0x73b3
testb $0x1, %al
je 0x5c87
movq 0x8(%rsp), %rax
jmp 0x5c89
xorl %eax, %eax
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_reset_tls
void _sir_reset_tls(void) {
    _sir_resetstr(_sir_tid);
    (void)memset(&_sir_last_thrd_chk, 0, sizeof(sir_time));
    _sir_last_timestamp = 0;
    _sir_reset_tls_error();
}

// Assembly:
pushq %rax
movq %fs:0x0, %rax
movb $0x0, -0x30(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
andq $0x0, -0x10(%rax)
popq %rax
jmp 0x35db
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_syslog_reset
void _sir_syslog_reset(sir_syslog_dest* ctx) {
#if !defined(SIR_NO_SYSTEM_LOGGERS)
    if (_sir_validptr(ctx)) {
        uint32_t old       = ctx->_state.mask;
        ctx->_state.mask   = 0U;
        ctx->_state.logger = NULL;
        _sir_selflog("state reset; mask was %08"PRIx32, old);
    }
#else
    SIR_UNUSED(ctx);
#endif
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x4030(%rip), %rdx      # 0x9cfa
pushq $0x1
popq %rsi
movl $0x487, %ecx            # imm = 0x487
callq 0x5923
testb %al, %al
je 0x5ce4
andl $0x0, 0x8(%rbx)
andq $0x0, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_unlocksection
void _sir_unlocksection(sir_mutex_id mid) {
    sir_mutex* m = NULL;
    void* sec    = NULL;

    bool leave = _sir_mapmutexid(mid, &m, &sec) && _sir_mutexunlock(m);
    SIR_ASSERT_UNUSED(leave, leave);
}

// Assembly:
subq $0x18, %rsp
leaq 0x8(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0x10(%rsp), %rdx
andq $0x0, (%rdx)
callq 0x6425
testb %al, %al
je 0x5e20
movq 0x8(%rsp), %rdi
callq 0x743b
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_cleanup
bool _sir_cleanup(void) {
    if (!_sir_sanity())
        return false;

    _SIR_LOCK_SECTION(sirfcache, sfc, SIRMI_FILECACHE, false);
    bool cleanup   = true;
    bool destroyfc = _sir_fcache_destroy(sfc);
    SIR_ASSERT(destroyfc);

    _SIR_UNLOCK_SECTION(SIRMI_FILECACHE);
    _sir_eqland(cleanup, destroyfc);

#if !defined(SIR_NO_PLUGINS)
    _SIR_LOCK_SECTION(sir_plugincache, spc, SIRMI_PLUGINCACHE, false);
    bool destroypc = _sir_plugin_cache_destroy(spc);
    SIR_ASSERT(destroypc);
    _SIR_UNLOCK_SECTION(SIRMI_PLUGINCACHE);
    _sir_eqland(cleanup, destroypc);
#endif

    _SIR_LOCK_SECTION(sirconfig, _cfg, SIRMI_CONFIG, false);

#if !defined(SIR_NO_SYSTEM_LOGGERS)
    if (!_sir_syslog_close(&_cfg->si.d_syslog)) {
        cleanup = false;
        _sir_selflog("error: failed to close system logger!");
    }

    _sir_syslog_reset(&_cfg->si.d_syslog);
#endif

#if !defined(SIR_NO_TEXT_STYLING)
    if (!_sir_resettextstyles()) {
        cleanup = false;
        _sir_selflog("error: failed to reset text styles!");
    }
#endif

#if defined(__HAVE_ATOMIC_H__)
    atomic_store(&_sir_magic, 0);
#else
    _sir_magic = 0U;
#endif

    _sir_reset_tls();

    (void)memset(_cfg, 0, sizeof(sirconfig));
    _SIR_UNLOCK_SECTION(SIRMI_CONFIG);

    _sir_selflog("cleaned up %s", (cleanup ? "successfully" : "with errors"));

    SIR_ASSERT(cleanup);
    return cleanup;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x5f4b
testb %al, %al
je 0x5f38
pushq $0x1
popq %rdi
callq 0x5c53
testq %rax, %rax
je 0x5ee7
movq %rax, %rdi
callq 0x4743
movl %eax, %ebx
pushq $0x1
popq %rdi
callq 0x5df7
pushq $0x2
popq %rdi
callq 0x5c53
testq %rax, %rax
je 0x5f01
movq %rax, %rdi
callq 0x7c90
movl %eax, %r15d
pushq $0x2
popq %rdi
callq 0x5df7
xorl %edi, %edi
callq 0x5c53
testq %rax, %rax
je 0x5f1b
movq %rax, %r14
movq %rax, %r12
addq $0x10, %r12
movq %r12, %rdi
callq 0x5f7a
movl %eax, %r13d
movq %r12, %rdi
callq 0x5cbf
callq 0x826f
movl %eax, %ebp
andb %r15b, %bpl
andb %r13b, %bpl
andb %bl, %bpl
xorl %eax, %eax
xchgq %rax, 0x9616(%rip)      # 0xf4e0
callq 0x5c8e
movl $0x290, %edx            # imm = 0x290
movq %r14, %rdi
xorl %esi, %esi
callq 0x21b0
xorl %edi, %edi
callq 0x5df7
jmp 0x5f3a
leaq 0x3cd3(%rip), %rsi      # 0x9bc1
leaq 0x3cb1(%rip), %rdx      # 0x9ba6
movl $0x800f0000, %edi       # imm = 0x800F0000
movl $0xd9, %ecx
jmp 0x5f33
leaq 0x3cb9(%rip), %rsi      # 0x9bc1
leaq 0x3c97(%rip), %rdx      # 0x9ba6
movl $0x800f0000, %edi       # imm = 0x800F0000
movl $0xe2, %ecx
jmp 0x5f33
leaq 0x3c9f(%rip), %rsi      # 0x9bc1
leaq 0x3c7d(%rip), %rdx      # 0x9ba6
movl $0x800f0000, %edi       # imm = 0x800F0000
movl $0xe9, %ecx
callq 0x3138
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_updatelevels
static
bool _sir_updatelevels(const char* name, sir_levels* old, const sir_levels* new) {
    bool retval = _sir_validstr(name) && _sir_validptr(old) && _sir_validptr(new);
    if (retval) {
        if (*old != *new) {
            _sir_selflog("updating %s levels from %04"PRIx16" to %04"PRIx16, name, *old, *new);
            *old = *new;
        } else {
            _sir_selflog("skipped superfluous update of %s levels: %04"PRIx16, name, *old);
        }
    }
    return retval;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
leaq 0x3d7f(%rip), %rdx      # 0x9d66
pushq $0x1
popq %rsi
movl $0x145, %ecx            # imm = 0x145
callq 0x62aa
testb %al, %al
je 0x603e
leaq 0x3d67(%rip), %rdx      # 0x9d66
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0x145, %ecx            # imm = 0x145
callq 0x5923
testb %al, %al
je 0x603e
leaq 0x3d4c(%rip), %rdx      # 0x9d66
pushq $0x1
popq %rsi
movq %r14, %rdi
movl $0x145, %ecx            # imm = 0x145
callq 0x5923
testb %al, %al
je 0x603e
movzwl (%r14), %ecx
movb $0x1, %al
cmpw %cx, (%rbx)
je 0x6040
movw %cx, (%rbx)
jmp 0x6040
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_updateopts
static
bool _sir_updateopts(const char* name, sir_options* old, const sir_options* new) {
    bool retval = _sir_validstr(name) && _sir_validptr(old) && _sir_validptr(new);
    if (retval) {
        if (*old != *new) {
            _sir_selflog("updating %s options from %08"PRIx32" to %08"PRIx32, name, *old, *new);
            *old = *new;
        } else {
            _sir_selflog("skipped superfluous update of %s options: %08"PRIx32, name, *old);
        }
    }
    return retval;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
leaq 0x3d0b(%rip), %rdx      # 0x9d78
pushq $0x1
popq %rsi
movl $0x153, %ecx            # imm = 0x153
callq 0x62aa
testb %al, %al
je 0x60c1
leaq 0x3cf3(%rip), %rdx      # 0x9d78
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0x153, %ecx            # imm = 0x153
callq 0x5923
testb %al, %al
je 0x60c1
leaq 0x3cd8(%rip), %rdx      # 0x9d78
pushq $0x1
popq %rsi
movq %r14, %rdi
movl $0x153, %ecx            # imm = 0x153
callq 0x5923
testb %al, %al
je 0x60c1
movl (%r14), %ecx
movb $0x1, %al
cmpl %ecx, (%rbx)
je 0x60c3
movl %ecx, (%rbx)
jmp 0x60c3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_sysloglevels
bool _sir_sysloglevels(sirinit* si, const sir_update_config_data* data) {
    bool updated = _sir_updatelevels(SIR_DESTNAME_SYSLOG, &si->d_syslog.levels, data->levels);
    if (updated) {
        _sir_setbitshigh(&si->d_syslog._state.mask, SIRSL_UPDATED | SIRSL_LEVELS);
        updated = _sir_syslog_updated(si, data);
        _sir_setbitslow(&si->d_syslog._state.mask, SIRSL_UPDATED | SIRSL_LEVELS);
    }
    return updated;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rsi
movq 0x8(%r14), %rdx
leaq 0x3ae7(%rip), %rdi      # 0x9bf9
callq 0x5fd6
testb %al, %al
je 0x6130
orb $0x22, 0x18(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x613a
andb $-0x23, 0x18(%rbx)
jmp 0x6132
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_syslogopts
bool _sir_syslogopts(sirinit* si, const sir_update_config_data* data) {
    bool updated = _sir_updateopts(SIR_DESTNAME_SYSLOG, &si->d_syslog.opts, data->opts);
    if (updated) {
        _sir_setbitshigh(&si->d_syslog._state.mask, SIRSL_UPDATED | SIRSL_OPTIONS);
        updated = _sir_syslog_updated(si, data);
        _sir_setbitslow(&si->d_syslog._state.mask, SIRSL_UPDATED | SIRSL_OPTIONS);
    }
    return updated;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x14(%rdi), %rsi
movq 0x10(%r14), %rdx
leaq 0x3a21(%rip), %rdi      # 0x9bf9
callq 0x605c
testb %al, %al
je 0x61f6
orb $0x24, 0x18(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x613a
andb $-0x25, 0x18(%rbx)
jmp 0x61f8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq