// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
leaq 0x8(%rsp), %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movq %rbx, %rdi
callq 0x94a9
movl %eax, %ebp
leaq 0xbba2(%rip), %rsi      # 0x10aa9
leaq 0xbb56(%rip), %r14      # 0x10a64
pushq $0x1
popq %r15
movl %r15d, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3410
movq %r14, %rdi
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x9a6b
movl %eax, %ebx
testl %eax, %eax
setne %r12b
leaq 0xbb83(%rip), %rsi      # 0x10ac3
movl %r15d, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3410
movq %r14, %rdi
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x9a6b
testl %eax, %eax
sete %r15b
andb %r12b, %r15b
andb %bpl, %r15b
cmpb $0x1, %r15b
jne 0x4f7b
pushq $0x1
popq %rdi
movl %edi, %esi
callq 0x3ac9
leaq 0xbb27(%rip), %rsi      # 0x10aa9
leaq 0xbadd(%rip), %r14      # 0x10a66
pushq $0x1
popq %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3410
movq %r14, %rdi
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x9a6b
testl %eax, %eax
sete %al
andb %al, %r15b
cmpb $0x1, %r15b
jne 0x4fc0
pushq $0x1
popq %rdi
movl %edi, %esi
callq 0x3ac9
leaq 0xbae2(%rip), %rsi      # 0x10aa9
leaq 0xbaae(%rip), %r14      # 0x10a7c
pushq $0x1
popq %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3410
movq %r14, %rdi
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x9a6b
testl %eax, %eax
setne %al
andb %al, %r15b
leaq 0xba94(%rip), %rdi      # 0x10a90
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x9a6b
testl %eax, %eax
setne %r12b
leaq 0xbad2(%rip), %rdi      # 0x10aea
xorl %eax, %eax
callq 0x95a2
movl %eax, %ebp
movq %r14, %rdi
movl $0xff, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x9a6b
testl %eax, %eax
sete %r14b
andb %bpl, %r14b
andb %r12b, %r14b
andb %r15b, %r14b
cmpb $0x1, %r14b
jne 0x5052
pushq $0x1
popq %rdi
movl %edi, %esi
callq 0x3ac9
movl %ebx, %edi
callq 0x9a70
andb %al, %r14b
callq 0x94ae
movl %eax, %ebx
andb %r14b, %bl
movzbl 0x1689b(%rip), %esi     # 0x1b908
leaq 0xb9f0(%rip), %rdi      # 0x10a64
callq 0x3fbf
movzbl 0x16888(%rip), %esi     # 0x1b908
leaq 0xb9df(%rip), %rdi      # 0x10a66
callq 0x3fbf
movzbl 0x16875(%rip), %esi     # 0x1b908
leaq 0xb9e2(%rip), %rdi      # 0x10a7c
callq 0x3fbf
movzbl 0x16862(%rip), %esi     # 0x1b908
leaq 0xb9e3(%rip), %rdi      # 0x10a90
callq 0x3fbf
movzbl %bl, %edi
xorl %esi, %esi
callq 0x3ac9
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq