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

#if !defined(__WIN__)
    static const char* filename1 = "./logs/faildupefile.log";
    static const char* filename2 = "logs/faildupefile.log";
#else
    static const char* filename1 = "logs\\faildupefile.log";
    static const char* filename2 = "logs/faildupefile.log";
#endif

    static const char* filename3 = "logs/not-a-dupe.log";
    static const char* filename4 = "logs/also-not-a-dupe.log";

    TEST_MSG("adding log file '%s'...", filename1);

    /* should be fine; no other files added yet. */
    sirfileid fid = sir_addfile(filename1, SIRL_ALL, SIRO_DEFAULT);
    _sir_eqland(pass, 0U != fid);

    TEST_MSG("trying again to add log file '%s'...", filename1);

    /* should fail. this is the same file we already added. */
    _sir_eqland(pass, 0U == sir_addfile(filename1, SIRL_ALL, SIRO_DEFAULT));

    if (pass)
        PRINT_EXPECTED_ERROR();

    TEST_MSG("adding log file '%s'...", filename2);

    /* should also fail. this is the same file we already added, even
     * if the path strings don't match. */
    _sir_eqland(pass, 0U == sir_addfile(filename2, SIRL_ALL, SIRO_DEFAULT));

    if (pass)
        PRINT_EXPECTED_ERROR();

    TEST_MSG("adding log file '%s'...", filename3);

    /* should pass. this is a different file. */
    sirfileid fid2 = sir_addfile(filename3, SIRL_ALL, SIRO_DEFAULT);
    _sir_eqland(pass, 0U != fid2);

    /* should also pass. */
    sirfileid fid3 = sir_addfile(filename4, SIRL_ALL, SIRO_DEFAULT);
    _sir_eqland(pass, 0U != fid3);

    _sir_eqland(pass, sir_info("hello three valid files"));

    /* should now fail since we added it earlier. */
    _sir_eqland(pass, 0U == sir_addfile(filename3, SIRL_ALL, SIRO_DEFAULT));

    if (pass)
        PRINT_EXPECTED_ERROR();

    /* don't remove all of the log files in order to also test
     * cache tear-down. */
    _sir_eqland(pass, sir_remfile(fid));
    _sir_eqland(pass, sir_cleanup());

    rmfile(filename1, cl_cfg.leave_logs);
    rmfile(filename2, cl_cfg.leave_logs);
    rmfile(filename3, cl_cfg.leave_logs);
    rmfile(filename4, cl_cfg.leave_logs);

    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
movl $0x108, %edx            # imm = 0x108
callq 0x4210
movl $0x100000, 0x24(%rsp)   # imm = 0x100000
movw $0xff, 0x20(%rsp)
movl $0x100000, 0x2c(%rsp)   # imm = 0x100000
movw $0x0, 0x28(%rsp)
leaq 0x15e4a(%rip), %rdi     # 0x1d2c7
xorl %esi, %esi
leaq 0x166be(%rip), %rdx     # 0x1db44
leaq 0x160a0(%rip), %rcx     # 0x1d52d
movl $0x1fa, %r8d            # imm = 0x1FA
callq 0x5ce0
testb $0x1, %al
jne 0x749e
jmp 0x74be
leaq 0x20(%rsp), %rdi
addq $0xe8, %rdi
movl $0x20, %ecx
leaq 0x15e11(%rip), %rdx     # 0x1d2c7
movq %rcx, %rsi
callq 0x14f50
movb $0x0, 0x1f(%rsp)
leaq 0x20(%rsp), %rdi
callq 0xf560
andb $0x1, %al
movb %al, 0x1f(%rsp)
movb 0x1f(%rsp), %al
andb $0x1, %al
movb %al, 0x1e(%rsp)
movq 0x211c4(%rip), %rsi     # 0x286a8
leaq 0x166b3(%rip), %rdi     # 0x1db9e
movb $0x0, %al
callq 0x4180
movq 0x211af(%rip), %rdi     # 0x286a8
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0xfee0
movl %eax, 0x18(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl 0x18(%rsp), %ecx
movb %al, 0xf(%rsp)
je 0x7522
movb 0x1e(%rsp), %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
andb $0x1, %al
movb %al, 0x1e(%rsp)
movq 0x21175(%rip), %rsi     # 0x286a8
leaq 0x1667e(%rip), %rdi     # 0x1dbb8
movb $0x0, %al
callq 0x4180
movq 0x21160(%rip), %rdi     # 0x286a8
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0xfee0
movl %eax, %edx
xorl %eax, %eax
xorl %ecx, %ecx
cmpl %edx, %ecx
movb %al, 0xe(%rsp)
jne 0x756d
movb 0x1e(%rsp), %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
andb $0x1, %al
movb %al, 0x1e(%rsp)
testb $0x1, 0x1e(%rsp)
je 0x758a
movl $0x1, %esi
movl %esi, %edi
callq 0x4da0
movq 0x2111f(%rip), %rsi     # 0x286b0
leaq 0x16606(%rip), %rdi     # 0x1db9e
movb $0x0, %al
callq 0x4180
movq 0x2110a(%rip), %rdi     # 0x286b0
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0xfee0
movl %eax, %edx
xorl %eax, %eax
xorl %ecx, %ecx
cmpl %edx, %ecx
movb %al, 0xd(%rsp)
jne 0x75cb
movb 0x1e(%rsp), %al
movb %al, 0xd(%rsp)
movb 0xd(%rsp), %al
andb $0x1, %al
movb %al, 0x1e(%rsp)
testb $0x1, 0x1e(%rsp)
je 0x75e8
movl $0x1, %esi
movl %esi, %edi
callq 0x4da0
movq 0x210c9(%rip), %rsi     # 0x286b8
leaq 0x165a8(%rip), %rdi     # 0x1db9e
movb $0x0, %al
callq 0x4180
movq 0x210b4(%rip), %rdi     # 0x286b8
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0xfee0
movl %eax, 0x14(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl 0x14(%rsp), %ecx
movb %al, 0xc(%rsp)
je 0x762d
movb 0x1e(%rsp), %al
movb %al, 0xc(%rsp)
movb 0xc(%rsp), %al
andb $0x1, %al
movb %al, 0x1e(%rsp)
movq 0x21082(%rip), %rdi     # 0x286c0
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0xfee0
movl %eax, 0x10(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl 0x10(%rsp), %ecx
movb %al, 0xb(%rsp)
je 0x7667
movb 0x1e(%rsp), %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
andb $0x1, %al
movb %al, 0x1e(%rsp)
leaq 0x16567(%rip), %rdi     # 0x1dbdf
movb $0x0, %al
callq 0xf770
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xa(%rsp)
jne 0x768e
jmp 0x7696
movb 0x1e(%rsp), %al
movb %al, 0xa(%rsp)
movb 0xa(%rsp), %al
andb $0x1, %al
movb %al, 0x1e(%rsp)
movq 0x21011(%rip), %rdi     # 0x286b8
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0xfee0
movl %eax, %edx
xorl %eax, %eax
xorl %ecx, %ecx
cmpl %edx, %ecx
movb %al, 0x9(%rsp)
jne 0x76cc
movb 0x1e(%rsp), %al
movb %al, 0x9(%rsp)
movb 0x9(%rsp), %al
andb $0x1, %al
movb %al, 0x1e(%rsp)
testb $0x1, 0x1e(%rsp)
je 0x76e9
movl $0x1, %esi
movl %esi, %edi
callq 0x4da0
movl 0x18(%rsp), %edi
callq 0xff10
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x8(%rsp)
jne 0x7701
jmp 0x7709
movb 0x1e(%rsp), %al
movb %al, 0x8(%rsp)
movb 0x8(%rsp), %al
andb $0x1, %al
movb %al, 0x1e(%rsp)
callq 0xf580
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x7(%rsp)
jne 0x7727
jmp 0x772f
movb 0x1e(%rsp), %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
andb $0x1, %al
movb %al, 0x1e(%rsp)
movq 0x20f68(%rip), %rdi     # 0x286a8
movb 0x21272(%rip), %al      # 0x289b8
andb $0x1, %al
movzbl %al, %esi
callq 0x5530
movq 0x20f59(%rip), %rdi     # 0x286b0
movb 0x2125b(%rip), %al      # 0x289b8
andb $0x1, %al
movzbl %al, %esi
callq 0x5530
movq 0x20f4a(%rip), %rdi     # 0x286b8
movb 0x21244(%rip), %al      # 0x289b8
andb $0x1, %al
movzbl %al, %esi
callq 0x5530
movq 0x20f3b(%rip), %rdi     # 0x286c0
movb 0x2122d(%rip), %al      # 0x289b8
andb $0x1, %al
movzbl %al, %esi
callq 0x5530
movb 0x1e(%rsp), %al
xorl %esi, %esi
andb $0x1, %al
movzbl %al, %edi
callq 0x4da0
andb $0x1, %al
addq $0x128, %rsp            # imm = 0x128
retq
nop