// File: /workspace/github_c_makefile_star2_O0/aremmell[P]libsir/tests/tests.c
// Function: sirtest_logwritesanity
bool sirtest_logwritesanity(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    static const char* logfilename = MAKE_LOG_NAME("write-validate.log");
    static const char* message     = "Lorem ipsum dolor sit amet, sea ei dicit"
                                     " regione laboramus, eos cu minim putent."
                                     " Sale omnium conceptam est in, cu nam possim"
                                     " prompta eleifend. Duo purto nostrud eu."
                                     " Alia accumsan has cu, mentitum invenire"
                                     " mel an, dicta noster legendos et pro."
                                     " Solum nobis laboramus et quo, nam putant"
                                     " dolores consequuntur ex. Sit veniam eruditi"
                                     " contentiones at. Cu ponderum oporteat"
                                     " oportere mel, has et saperet accusata"
                                     " complectitur.";

    TEST_MSG("adding log file '%s' to libsir...", logfilename);
    sirfileid id = sir_addfile(logfilename, SIRL_DEBUG, SIRO_NOHDR | SIRO_NOHOST);
    _sir_eqland(pass, 0U != id);

    (void)print_test_error(pass, false);

    TEST_MSG("writing message to stdout and %s...", logfilename);

    _sir_eqland(pass, sir_debug("%s", message));

    (void)print_test_error(pass, false);

    TEST_MSG("removing %s from libsir...", logfilename);
    _sir_eqland(pass, sir_remfile(id));

    (void)print_test_error(pass, false);

    TEST_MSG("opening %s for reading...", logfilename);

    FILE* f = fopen(logfilename, "r");
    if (!f) {
        pass = false;
    } else {
        char buf[512] = {0};
        _sir_eqland(pass, 0 != sir_readline(f, buf, 512));

        bool found = NULL != strstr(buf, message);
        _sir_eqland(pass, found);

        if (found)
            TEST_MSG(SIR_GREEN("found '%s'"), message);
        else
            TEST_MSG(SIR_RED("did not find '%s'"), message);

        _sir_safefclose(&f);
        TEST_MSG("deleting %s...", logfilename);
        rmfile(logfilename, cl_cfg.leave_logs);
    }

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
subq $0x328, %rsp            # imm = 0x328
leaq 0x220(%rsp), %rdi
xorl %esi, %esi
movl $0x108, %edx            # imm = 0x108
callq 0x4210
movl $0x100000, 0x224(%rsp) # imm = 0x100000
movw $0xff, 0x220(%rsp)
movl $0x100000, 0x22c(%rsp) # imm = 0x100000
movw $0x0, 0x228(%rsp)
leaq 0x1751b(%rip), %rdi     # 0x1d2c7
xorl %esi, %esi
leaq 0x17780(%rip), %rdx     # 0x1d535
leaq 0x17771(%rip), %rcx     # 0x1d52d
movl $0xb1, %r8d
callq 0x5ce0
testb $0x1, %al
jne 0x5dcd
jmp 0x5df0
leaq 0x220(%rsp), %rdi
addq $0xe8, %rdi
movl $0x20, %ecx
leaq 0x174df(%rip), %rdx     # 0x1d2c7
movq %rcx, %rsi
callq 0x14f50
movb $0x0, 0x21f(%rsp)
leaq 0x220(%rsp), %rdi
callq 0xf560
andb $0x1, %al
movb %al, 0x21f(%rsp)
movb 0x21f(%rsp), %al
andb $0x1, %al
movb %al, 0x21e(%rsp)
movq 0x22853(%rip), %rsi     # 0x28678
leaq 0x178dc(%rip), %rdi     # 0x1d708
movb $0x0, %al
callq 0x4180
movq 0x2283e(%rip), %rdi     # 0x28678
movl $0x80, %esi
movl $0x10400, %edx          # imm = 0x10400
callq 0xfee0
movl %eax, 0x218(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl 0x218(%rsp), %ecx
movb %al, 0xe(%rsp)
je 0x5e6c
movb 0x21e(%rsp), %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
andb $0x1, %al
movb %al, 0x21e(%rsp)
movb 0x21e(%rsp), %al
xorl %esi, %esi
andb $0x1, %al
movzbl %al, %edi
callq 0x4da0
movq 0x227e5(%rip), %rsi     # 0x28678
leaq 0x17892(%rip), %rdi     # 0x1d72c
movb $0x0, %al
callq 0x4180
movq 0x227d8(%rip), %rsi     # 0x28680
leaq 0x17379(%rip), %rdi     # 0x1d228
movb $0x0, %al
callq 0xf5f0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xd(%rsp)
jne 0x5ec5
jmp 0x5ed0
movb 0x21e(%rsp), %al
movb %al, 0xd(%rsp)
movb 0xd(%rsp), %al
andb $0x1, %al
movb %al, 0x21e(%rsp)
movb 0x21e(%rsp), %al
xorl %esi, %esi
andb $0x1, %al
movzbl %al, %edi
callq 0x4da0
movq 0x22781(%rip), %rsi     # 0x28678
leaq 0x17854(%rip), %rdi     # 0x1d752
movb $0x0, %al
callq 0x4180
movl 0x218(%rsp), %edi
callq 0xff10
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xc(%rsp)
jne 0x5f20
jmp 0x5f2b
movb 0x21e(%rsp), %al
movb %al, 0xc(%rsp)
movb 0xc(%rsp), %al
andb $0x1, %al
movb %al, 0x21e(%rsp)
movb 0x21e(%rsp), %al
xorl %esi, %esi
andb $0x1, %al
movzbl %al, %edi
callq 0x4da0
movq 0x22726(%rip), %rsi     # 0x28678
leaq 0x17816(%rip), %rdi     # 0x1d76f
movb $0x0, %al
callq 0x4180
movq 0x22711(%rip), %rdi     # 0x28678
leaq 0x1b211(%rip), %rsi     # 0x2117f
callq 0x44a0
movq %rax, 0x210(%rsp)
cmpq $0x0, 0x210(%rsp)
jne 0x5f93
movb $0x0, 0x21e(%rsp)
jmp 0x6096
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x4210
movq 0x210(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x5430
movq %rax, %rdx
xorl %eax, %eax
xorl %ecx, %ecx
cmpq %rdx, %rcx
movb %al, 0xb(%rsp)
je 0x5fd6
movb 0x21e(%rsp), %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
andb $0x1, %al
movb %al, 0x21e(%rsp)
leaq 0x10(%rsp), %rdi
movq 0x22691(%rip), %rsi     # 0x28680
callq 0x45a0
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
setne %al
andb $0x1, %al
movb %al, 0xf(%rsp)
xorl %eax, %eax
testb $0x1, 0xf(%rsp)
movb %al, 0xa(%rsp)
je 0x601d
movb 0x21e(%rsp), %al
movb %al, 0xa(%rsp)
movb 0xa(%rsp), %al
andb $0x1, %al
movb %al, 0x21e(%rsp)
testb $0x1, 0xf(%rsp)
je 0x6048
movq 0x22648(%rip), %rsi     # 0x28680
leaq 0x1774c(%rip), %rdi     # 0x1d78b
movb $0x0, %al
callq 0x4180
jmp 0x605d
movq 0x22631(%rip), %rsi     # 0x28680
leaq 0x17756(%rip), %rdi     # 0x1d7ac
movb $0x0, %al
callq 0x4180
leaq 0x210(%rsp), %rdi
callq 0x14530
movq 0x22607(%rip), %rsi     # 0x28678
leaq 0x1775c(%rip), %rdi     # 0x1d7d4
movb $0x0, %al
callq 0x4180
movq 0x225f2(%rip), %rdi     # 0x28678
movb 0x2292c(%rip), %al      # 0x289b8
andb $0x1, %al
movzbl %al, %esi
callq 0x5530
callq 0xf580
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x9(%rsp)
jne 0x60aa
jmp 0x60b5
movb 0x21e(%rsp), %al
movb %al, 0x9(%rsp)
movb 0x9(%rsp), %al
andb $0x1, %al
movb %al, 0x21e(%rsp)
movb 0x21e(%rsp), %al
xorl %esi, %esi
andb $0x1, %al
movzbl %al, %edi
callq 0x4da0
andb $0x1, %al
addq $0x328, %rsp            # imm = 0x328
retq
nop