// File: /workspace/github_c_makefile_star2_O0/aremmell[P]libsir/src/sirerrors.c
// Function: sir_geterrorinfo
void _sir_geterrorinfo(sir_errorinfo* err) {
    if (!_sir_validptr(err))
        return;

    (void)memset(err, 0, sizeof(sir_errorinfo));

    err->func = _sir_te.loc.func;
    err->file = _sir_te.loc.file;
    err->line = _sir_te.loc.line;

    err->os_code = _sir_te.os_code;
    (void)_sir_strncpy(err->os_msg, SIR_MAXERROR, (_sir_validstrnofail(_sir_te.os_msg)
        ? _sir_te.os_msg : SIR_UNKNOWN), SIR_MAXERROR);

    err->code = _sir_geterrcode(SIR_E_UNKNOWN);

    static const size_t low  = 0;
    static const size_t high = _sir_countof(sir_errors) - 1;

    _SIR_DECLARE_BIN_SEARCH(low, high);
    _SIR_BEGIN_BIN_SEARCH()

    if (sir_errors[_mid].e == _sir_te.lasterror) {
        err->code = _sir_geterrcode(sir_errors[_mid].e);
        if (_SIR_E_PLATFORM == sir_errors[_mid].e)
            (void)_sir_strncpy(err->msg, SIR_MAXERROR, _SIR_E_PLATFORM_ERRORMSG, SIR_MAXERROR);
        else
            (void)_sir_strncpy(err->msg, SIR_MAXERROR, sir_errors[_mid].msg, SIR_MAXERROR);
        break;
    }

    _SIR_ITERATE_BIN_SEARCH((sir_errors[_mid].e < _sir_te.lasterror ? 1 : -1));
    _SIR_END_BIN_SEARCH();
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq 0x30(%rsp), %rdi
movl $0x1, %esi
leaq 0xc3c8(%rip), %rdx      # 0x105a2
leaq 0xc35d(%rip), %rcx      # 0x1053e
movl $0xec, %r8d
callq 0x4150
testb $0x1, %al
jne 0x41f5
jmp 0x44df
movq 0x30(%rsp), %rdi
xorl %esi, %esi
movl $0x220, %edx            # imm = 0x220
callq 0x21c0
movq %fs:0x0, %rax
leaq -0x150(%rax), %rax
movq 0x108(%rax), %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movq %fs:0x0, %rax
leaq -0x150(%rax), %rax
movq 0x110(%rax), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x8(%rax)
movq %fs:0x0, %rax
leaq -0x150(%rax), %rax
movl 0x118(%rax), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x10(%rax)
movq %fs:0x0, %rax
leaq -0x150(%rax), %rax
movl 0x4(%rax), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x14(%rax)
movq 0x30(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x10(%rsp)
movq %fs:0x0, %rax
leaq -0x150(%rax), %rdi
addq $0x8, %rdi
xorl %esi, %esi
leaq 0xc2ea(%rip), %rdx      # 0x105a2
leaq 0xc27f(%rip), %rcx      # 0x1053e
movl $0xf6, %r8d
callq 0x3b80
testb $0x1, %al
jne 0x42d0
jmp 0x42ee
movq %fs:0x0, %rax
leaq -0x150(%rax), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
jmp 0x42fc
leaq 0xc092(%rip), %rax      # 0x10387
movq %rax, 0x8(%rsp)
jmp 0x42fc
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
movl $0x100, %ecx            # imm = 0x100
movq %rcx, %rsi
callq 0x83d0
movl $0xfff, %edi            # imm = 0xFFF
callq 0x44f0
movw %ax, %cx
movq 0x30(%rsp), %rax
movw %cx, 0x118(%rax)
movq $0x0, 0x28(%rsp)
movq $0x17, 0x20(%rsp)
movq 0x28(%rsp), %rax
addq 0x20(%rsp), %rax
shrq %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rcx
leaq 0x118f4(%rip), %rax     # 0x15c50
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, 0x4(%rsp)
movq %fs:0x0, %rax
movq %rax, %rcx
movl 0x4(%rsp), %eax
leaq -0x150(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x4427
movq 0x18(%rsp), %rcx
leaq 0x118b9(%rip), %rax     # 0x15c50
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %edi
callq 0x44f0
movw %ax, %cx
movq 0x30(%rsp), %rax
movw %cx, 0x118(%rax)
movq 0x18(%rsp), %rax
leaq 0x11890(%rip), %rcx     # 0x15c50
shlq $0x4, %rax
addq %rax, %rcx
movl $0x80170000, %eax       # imm = 0x80170000
cmpl (%rcx), %eax
jne 0x43f2
movq 0x30(%rsp), %rdi
addq $0x11a, %rdi            # imm = 0x11A
movl $0x100, %ecx            # imm = 0x100
leaq 0xc1cc(%rip), %rdx      # 0x105b4
movq %rcx, %rsi
callq 0x83d0
jmp 0x4422
movq 0x30(%rsp), %rdi
addq $0x11a, %rdi            # imm = 0x11A
movq 0x18(%rsp), %rcx
leaq 0x11846(%rip), %rax     # 0x15c50
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
movl $0x100, %ecx            # imm = 0x100
movq %rcx, %rsi
callq 0x83d0
jmp 0x44df
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
jne 0x4438
jmp 0x44df
movq 0x18(%rsp), %rcx
leaq 0x1180c(%rip), %rax     # 0x15c50
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, (%rsp)
movq %fs:0x0, %rax
movl (%rsp), %edx
leaq -0x150(%rax), %rax
movl (%rax), %esi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0x1, %eax
cmpl %esi, %edx
cmovbl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jle 0x449d
movq 0x18(%rsp), %rax
subq $0x1, %rax
cmpq 0x28(%rsp), %rax
jb 0x449d
movq 0x18(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x44c1
movq 0x18(%rsp), %rax
addq $0x1, %rax
cmpq 0x20(%rsp), %rax
ja 0x44bd
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x44bf
jmp 0x44df
jmp 0x44c1
movq 0x28(%rsp), %rax
addq 0x20(%rsp), %rax
shrq %rax
movq %rax, 0x18(%rsp)
movb $0x1, %al
testb $0x1, %al
jne 0x4350
jmp 0x44df
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)