// File: /workspace/github_c_makefile_star2_O1/Cyan4973[P]FiniteStateEntropy/programs/bench.c
// Function: BMK_benchCore_Files
int BMK_benchCore_Files(const char** fileNamesTable, int nbFiles)
{
    int fileIdx=0;

    U64 totals = 0;
    U64 totalz = 0;
    double totalc = 0.;
    double totald = 0.;

    // Loop for each file
    while (fileIdx<nbFiles) {
        FILE*  inFile;
        const char* inFileName;
        U64    inFileSize;
        size_t benchedSize;
        int nbChunks;
        size_t maxCompressedChunkSize;
        size_t readSize;
        char* orig_buff;
        char* compressedBuffer; size_t compressedBuffSize;

        /* Check file existence */
        inFileName = fileNamesTable[fileIdx++];
        inFile = fopen( inFileName, "rb" );
        if (inFile==NULL) { DISPLAY( "Pb opening %s\n", inFileName); return 11; }

        /* Memory allocation & restrictions */
        inFileSize = BMK_GetFileSize(inFileName);
        if (inFileSize==0) { DISPLAY( "%s is empty\n", inFileName); return 11; }
        benchedSize = 256 MB;
        if ((U64)benchedSize > inFileSize) benchedSize = (size_t)inFileSize;
        else DISPLAY("FSE Core Loop speed evaluation, testing %i KB ...\n", (int)(benchedSize>>10));

        /* Alloc */
        orig_buff = (char*)malloc(benchedSize);
        nbChunks = 1;
        maxCompressedChunkSize = FSE_compressBound((int)benchedSize);
        compressedBuffSize = nbChunks * maxCompressedChunkSize;
        compressedBuffer = (char*)malloc(compressedBuffSize);

        if (!orig_buff || !compressedBuffer) {
            DISPLAY("\nError: not enough memory!\n");
            free(orig_buff);
            free(compressedBuffer);
            fclose(inFile);
            return 12;
        }

        /* Fill input buffer */
        DISPLAY("Loading %s...       \r", inFileName);
        readSize = fread(orig_buff, 1, benchedSize, inFile);
        fclose(inFile);

        if (readSize != benchedSize) {
            DISPLAY("\nError: problem reading file '%s' (%i read, should be %i) !!    \n", inFileName, (int)readSize, (int)benchedSize);
            free(orig_buff);
            free(compressedBuffer);
            return 13;
        }

        /* Bench */
        BMK_benchCore_Mem(compressedBuffer, orig_buff, (int)benchedSize, 255, BMK_tableLog, inFileName, &totalz, &totalc, &totald);
        totals += benchedSize;

        free(orig_buff);
        free(compressedBuffer);
    }

    if (nbFiles > 1)
        DISPLAY("%-16.16s :%10llu ->%10llu (%5.2f%%), %6.1f MB/s , %6.1f MB/s\n", "  TOTAL", (long long unsigned int)totals, (long long unsigned int)totalz, (double)totalz/(double)totals*100., (double)totals/totalc/1000., (double)totals/totald/1000.);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6f8, %rsp            # imm = 0x6F8
movl %esi, %r15d
movq %rdi, 0xe0(%rsp)
testl %esi, %esi
movl $0x0, %r12d
cmovgl %esi, %r12d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
leaq 0xebab(%rip), %r14      # 0x123d4
leaq 0xeba7(%rip), %rbp      # 0x123d7
movsd %xmm0, 0x48(%rsp)
xorl %ecx, %ecx
movq $0x0, 0xa8(%rsp)
movq $0x0, 0xa0(%rsp)
cmpq %r12, %rcx
je 0x404a
movl %eax, 0x5c(%rsp)
movq %rcx, 0xe8(%rsp)
movq 0xe0(%rsp), %rax
movq (%rax,%rcx,8), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x1120
testq %rax, %rax
jne 0x38a4
movq 0x15770(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
xorl %ebx, %ebx
movq %rbp, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x1110
movl $0xb, %eax
jmp 0x3ef1
movq %rax, %rbx
movq %r13, 0x10(%rsp)
movq %r13, %rdi
leaq 0xf0(%rsp), %rsi
callq 0x10a0
testl %eax, %eax
jne 0x38df
movl 0x108(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x38df
movq 0x120(%rsp), %rbp
jmp 0x38e1
xorl %ebp, %ebp
testq %rbp, %rbp
jne 0x390f
movq 0x1570b(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
xorl %ebx, %ebx
leaq 0xebf3(%rip), %rsi      # 0x124ec
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x1110
movl $0xb, %eax
jmp 0x3eea
cmpq $0x10000000, %rbp       # imm = 0x10000000
jb 0x3922
callq 0x17e9
movl $0x10000000, %ebp       # imm = 0x10000000
movq %rbp, %rdi
callq 0x1150
movq %rax, %r14
movq %rbp, %rdi
callq 0x92a2
movq %rax, %rdi
callq 0x1150
movq %rax, %r13
testq %r14, %r14
setne %al
testq %r13, %r13
setne %cl
movq 0x156a5(%rip), %rdx     # 0x18ff8
movq (%rdx), %rdi
testb %cl, %al
je 0x3e8a
movq %r12, 0x98(%rsp)
leaq 0xeae1(%rip), %rsi      # 0x1244e
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x1110
movl $0x1, %esi
movq %r14, %rdi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
callq 0x1080
cmpq %rbp, %r12
jne 0x3ea1
movl %r15d, 0x58(%rsp)
movl 0x1573d(%rip), %ebx     # 0x190e8
movl $0xff, 0xc(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x52e2
movq %rax, 0x38(%rsp)
leaq 0xf0(%rsp), %r15
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
movq %r14, 0x20(%rsp)
movq %r14, %rdx
movq %rbp, %rcx
callq 0x796e
movl 0xc(%rsp), %r8d
leaq 0x4f0(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x8a6c
movq %rax, %rbx
movl 0xc(%rsp), %esi
movl %ebx, %edi
callq 0x89ac
movl 0xc(%rsp), %edx
movq %rax, 0x90(%rsp)
movq %rax, %rdi
movq %r12, %rsi
movl %ebx, %ecx
callq 0x86a0
movl %ebx, %edi
callq 0x798c
movl 0xc(%rsp), %edx
movq %rax, 0xb0(%rsp)
movq %rax, %rdi
movq %r12, %rsi
movl %ebx, %ecx
callq 0x79ab
movq 0x155a8(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
leaq 0xe62b(%rip), %rsi      # 0x12085
leaq 0xea44(%rip), %rdx      # 0x124a5
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x1567d(%rip)     # 0x190ec
jle 0x3f09
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x80(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xc0(%rsp)
movl $0x1, %r12d
xorl %ebx, %ebx
movq $0x0, 0x88(%rsp)
movq $0x0, 0x28(%rsp)
movsd 0xe554(%rip), %xmm0     # 0x12008
movapd %xmm0, 0x60(%rsp)
movapd %xmm0, 0x70(%rsp)
movq 0x10(%rsp), %r15
movq %r13, 0xb8(%rsp)
movq %rbx, 0x18(%rsp)
movq 0x1551f(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
leaq 0xea87(%rip), %rsi      # 0x1256a
movl %r12d, %edx
movq %r15, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x1110
xorl %eax, %eax
movb %al, (%r13,%rax)
incq %rax
cmpq %rax, %rbp
jne 0x3af5
movq %r12, 0x40(%rsp)
callq 0x1070
movq %rax, %rbx
callq 0x1070
cmpq %rbx, %rax
je 0x3b0f
callq 0x1070
movq %rax, %rbx
callq 0x1070
subq %rbx, %rax
xorpd %xmm0, %xmm0
cmpq $0x1e847f, %rax         # imm = 0x1E847F
jg 0x3b9c
xorl %r15d, %r15d
movq 0x90(%rsp), %r14
movq 0x20(%rsp), %r13
movq %rbx, %r12
movq %rbp, %rdi
callq 0x92a2
movq 0xb8(%rsp), %rdi
movq %rax, %rsi
movq %r13, %rdx
movq %rbp, %rcx
movq %r14, %r8
callq 0x8e2f
movq %rax, %rbx
incl %r15d
callq 0x1070
subq %r12, %rax
cmpq $0x1e8480, %rax         # imm = 0x1E8480
jl 0x3b48
movq %rbx, 0x18(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movq 0x10(%rsp), %r15
movq 0xb8(%rsp), %r13
movq %r12, %rbx
movsd %xmm0, 0x30(%rsp)
callq 0x1070
movq %rax, %r14
movq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x70ca
testl %eax, %eax
jne 0x3e22
subq %rbx, %r14
cvtsi2sd %r14, %xmm4
movapd 0x70(%rsp), %xmm3
movapd %xmm3, %xmm1
movsd 0x30(%rsp), %xmm0
mulsd %xmm0, %xmm1
movapd %xmm4, %xmm2
divsd %xmm0, %xmm2
cmpltsd %xmm1, %xmm4
andpd %xmm4, %xmm2
andnpd %xmm3, %xmm4
orpd %xmm2, %xmm4
movapd %xmm4, 0x70(%rsp)
movq %r12, %xmm1
punpckldq 0xe439(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xe441(%rip), %xmm1     # 0x12050
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0x80(%rsp), %xmm1
divsd %xmm1, %xmm0
mulsd 0xe3e8(%rip), %xmm0     # 0x12018
movq 0x153c1(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
divsd %xmm4, %xmm1
divsd 0xe3ca(%rip), %xmm1     # 0x12010
leaq 0xe456(%rip), %rsi      # 0x120a3
movq 0x40(%rsp), %rdx
movq %r15, %rcx
movl %ebp, %r8d
movl %r12d, %r9d
movapd %xmm0, 0xc0(%rsp)
movsd %xmm1, 0xd8(%rsp)
movb $0x2, %al
callq 0x1110
movq 0x20(%rsp), %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x10c0
callq 0x1070
movq %rax, %rbx
callq 0x1070
cmpq %rbx, %rax
je 0x3c8b
callq 0x1070
movq %rax, %rbx
callq 0x1070
movq %rbx, 0x30(%rsp)
subq %rbx, %rax
xorpd %xmm0, %xmm0
cmpq $0x1e847f, %rax         # imm = 0x1E847F
jg 0x3d15
movq %rbp, %r12
movq %r13, %rbp
xorl %r15d, %r15d
movq 0x20(%rsp), %r13
movq 0x18(%rsp), %rbx
movq %r13, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
movq 0xb0(%rsp), %r8
callq 0x7b3a
movq %rax, %r14
incl %r15d
callq 0x1070
subq 0x30(%rsp), %rax
cmpq $0x1e8480, %rax         # imm = 0x1E8480
jl 0x3cc9
movq %r14, 0x88(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movq 0x10(%rsp), %r15
movq %rbp, %r13
movq %r12, %rbp
movsd %xmm0, 0xd0(%rsp)
callq 0x1070
movq %rax, %r14
movq 0x88(%rsp), %rbx
movq %rbx, %rdi
callq 0x70ca
testl %eax, %eax
movq 0x40(%rsp), %r12
jne 0x3e46
cmpq %rbp, %rbx
jne 0x3e46
subq 0x30(%rsp), %r14
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
movapd 0x60(%rsp), %xmm3
movapd %xmm3, %xmm1
movsd 0xd0(%rsp), %xmm4
mulsd %xmm4, %xmm1
movapd %xmm0, %xmm2
divsd %xmm4, %xmm2
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
movapd %xmm0, 0x60(%rsp)
movq 0x15262(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
movsd 0x80(%rsp), %xmm2
divsd %xmm0, %xmm2
divsd 0xe262(%rip), %xmm2     # 0x12010
leaq 0xe31e(%rip), %rsi      # 0x120d3
movl %r12d, %edx
movq %r15, %rcx
movl %ebp, %r8d
movq 0x18(%rsp), %r9
movapd 0xc0(%rsp), %xmm0
movsd 0xd8(%rsp), %xmm1
movb $0x3, %al
callq 0x1110
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x52e2
movb $0x1, %bl
movq %rax, 0x28(%rsp)
cmpq %rax, 0x38(%rsp)
je 0x3e63
movq 0x151f8(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
xorl %ebx, %ebx
leaq 0xe7c8(%rip), %rsi      # 0x125d4
movq %r15, %rdx
movq 0x38(%rsp), %rcx
movq 0x28(%rsp), %r8
xorl %eax, %eax
callq 0x1110
jmp 0x3e63
movq 0x151cf(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
xorl %ebx, %ebx
leaq 0xe74c(%rip), %rsi      # 0x12581
movq %r15, %rdx
xorl %eax, %eax
callq 0x1110
movq 0x40(%rsp), %r12
jmp 0x3e63
movq 0x151ab(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
xorl %ebx, %ebx
leaq 0xe750(%rip), %rsi      # 0x125a9
movq %r15, %rdx
xorl %eax, %eax
callq 0x1110
testb %bl, %bl
je 0x4040
leal 0x1(%r12), %eax
cmpl 0x15275(%rip), %r12d    # 0x190ec
movl %eax, %r12d
movq 0x18(%rsp), %rbx
jl 0x3acd
jmp 0x3f3a
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x180c
movl $0xc, %eax
xorl %ebx, %ebx
jmp 0x3ee3
movq 0x15150(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
xorl %ebx, %ebx
leaq 0xe5b0(%rip), %rsi      # 0x12464
movq 0x10(%rsp), %rdx
movl %r12d, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x1110
movq %r14, %rdi
callq 0x1030
movq %r13, %rdi
callq 0x1030
movl $0xd, %eax
movq 0x98(%rsp), %r12
leaq 0xe4ea(%rip), %r14      # 0x123d4
leaq 0xe4e6(%rip), %rbp      # 0x123d7
movq 0xe8(%rsp), %rcx
incq %rcx
testb %bl, %bl
jne 0x3850
jmp 0x4052
xorpd %xmm0, %xmm0
movapd %xmm0, 0xc0(%rsp)
movsd 0xe0ea(%rip), %xmm0     # 0x12008
movapd %xmm0, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
movq $0x0, 0x28(%rsp)
xorl %ebx, %ebx
movq 0x10(%rsp), %r15
movq 0x28(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x3fd0
addq %rbx, 0xa8(%rsp)
movsd 0x50(%rsp), %xmm0
addsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x48(%rsp), %xmm0
addsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq 0x90(%rsp), %rdi
callq 0x1030
movq 0xb0(%rsp), %rdi
callq 0x1030
addq %rbp, 0xa0(%rsp)
movq 0x20(%rsp), %rdi
callq 0x1030
movq %r13, %rdi
callq 0x1030
movb $0x1, %bl
movl 0x58(%rsp), %r15d
movq 0x98(%rsp), %r12
leaq 0xe414(%rip), %r14      # 0x123d4
leaq 0xe410(%rip), %rbp      # 0x123d7
movl 0x5c(%rsp), %eax
jmp 0x3ef1
movsd 0xe040(%rip), %xmm0     # 0x12018
movapd 0xc0(%rsp), %xmm3
ucomisd %xmm3, %xmm0
movq 0x1500c(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
xorps %xmm2, %xmm2
cvtsi2sd %ebp, %xmm2
movapd %xmm2, %xmm1
divsd 0x70(%rsp), %xmm1
movsd 0xe008(%rip), %xmm0     # 0x12010
divsd %xmm0, %xmm1
divsd 0x60(%rsp), %xmm2
divsd %xmm0, %xmm2
leaq 0xe156(%rip), %rsi      # 0x12173
leaq 0xe117(%rip), %rax      # 0x1213b
cmovaq %rax, %rsi
movq %r15, %rdx
movl %ebp, %ecx
movl %ebx, %r8d
movapd %xmm3, %xmm0
movb $0x3, %al
callq 0x1110
jmp 0x3f4a
movq 0x18(%rsp), %rbx
jmp 0x3f3a
xorl %eax, %eax
cmpl $0x2, %r15d
jge 0x4064
addq $0x6f8, %rsp            # imm = 0x6F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rsi
movsd 0x50(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
callq 0x184d
xorl %eax, %eax
jmp 0x4052
nopl (%rax)