// File: /workspace/github_c_makefile_star2_O2/Cyan4973[P]FiniteStateEntropy/programs/fileio.c
// Function: get_fileHandle
static void get_fileHandle(const char* input_filename, const char* output_filename, FILE** pfinput, FILE** pfoutput)
{
    if (!strcmp (input_filename, stdinmark)) {
        DISPLAYLEVEL(4,"Using stdin for input\n");
        *pfinput = stdin;
        SET_BINARY_MODE(stdin);
    } else {
        *pfinput = fopen(input_filename, "rb");
    }

    if (*pfinput == 0) EXM_THROW(12, "Pb opening %s", input_filename);

    if (!strcmp (output_filename, stdoutmark)) {
        DISPLAYLEVEL(4,"Using stdout for output\n");
        *pfoutput = stdout;
        SET_BINARY_MODE(stdout);
    } else {
        /* Check if destination file already exists */
        *pfoutput=0;
        if (strcmp(output_filename,nulmark)) *pfoutput = fopen( output_filename, "rb" );
        if (*pfoutput!=0) {
            fclose(*pfoutput);
            if (!g_overwrite) {
                char ch;
                if (g_displayLevel <= 1)   /* No interaction possible */
                    EXM_THROW(11, "Operation aborted : %s already exists", output_filename);
                DISPLAYLEVEL(2, "Warning : %s already exists\n", output_filename);
                DISPLAYLEVEL(2, "Overwrite ? (Y/N) : ");
                ch = (char)getchar();
                if ((ch!='Y') && (ch!='y')) EXM_THROW(11, "Operation aborted : %s already exists", output_filename);
        }   }
        *pfoutput = fopen( output_filename, "wb" );
    }

    if ( *pfoutput==0) EXM_THROW(13, "Pb opening %s", output_filename);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
leaq 0xc12b(%rip), %rsi      # 0xfde0
callq 0x10f0
testl %eax, %eax
je 0x3ccf
leaq 0xb70f(%rip), %rsi      # 0xf3d4
movq %r15, %rdi
callq 0x1120
jmp 0x3ce6
cmpl $0x4, 0x1241e(%rip)     # 0x160f4
jge 0x3d81
movq 0x122f5(%rip), %rax     # 0x15fd8
movq (%rax), %rax
movq %rax, (%r12)
testq %rax, %rax
je 0x3e75
leaq 0xc0ec(%rip), %rsi      # 0xfde6
movq %rbx, %rdi
callq 0x10f0
testl %eax, %eax
je 0x3d56
andq $0x0, (%r14)
leaq 0xb9bc(%rip), %rsi      # 0xf6cd
movq %rbx, %rdi
callq 0x10f0
testl %eax, %eax
je 0x3d45
leaq 0xb6b0(%rip), %rsi      # 0xf3d4
movq %rbx, %rdi
callq 0x1120
movq %rax, (%r14)
testq %rax, %rax
je 0x3d45
movq %rax, %rdi
callq 0x1080
cmpb $0x0, 0x12401(%rip)     # 0x16144
je 0x3dc0
leaq 0xc091(%rip), %rsi      # 0xfddd
movq %rbx, %rdi
callq 0x1120
jmp 0x3d69
cmpl $0x4, 0x12397(%rip)     # 0x160f4
jge 0x3da2
movq 0x1226a(%rip), %rax     # 0x15fd0
movq (%rax), %rax
movq %rax, (%r14)
testq %rax, %rax
je 0x3ece
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x12270(%rip), %rax     # 0x15ff8
movq (%rax), %rcx
leaq 0xbfb5(%rip), %rdi      # 0xfd47
pushq $0x16
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
jmp 0x3cdc
movq 0x1224f(%rip), %rax     # 0x15ff8
movq (%rax), %rcx
leaq 0xbfb9(%rip), %rdi      # 0xfd6c
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
jmp 0x3d5f
cmpl $0x1, 0x1232d(%rip)     # 0x160f4
jle 0x3f2b
movq 0x12224(%rip), %r15     # 0x15ff8
movq (%r15), %rdi
leaq 0xbfcd(%rip), %rsi      # 0xfdab
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x2, 0x12305(%rip)     # 0x160f4
jge 0x3e5b
callq 0x1100
andl $0xdf, %eax
cmpl $0x59, %eax
je 0x3d45
cmpl $0x0, 0x122e9(%rip)     # 0x160f4
jle 0x3f79
movq (%r15), %rdi
leaq 0xbafd(%rip), %rsi      # 0xf918
pushq $0xb
popq %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x122c8(%rip)     # 0x160f4
jle 0x3f79
movq (%r15), %rdi
leaq 0xbf49(%rip), %rsi      # 0xfd85
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x122a7(%rip)     # 0x160f4
jle 0x3f79
movq (%r15), %rsi
jmp 0x3f71
movq (%r15), %rcx
leaq 0xbf63(%rip), %rdi      # 0xfdc8
pushq $0x14
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
jmp 0x3df1
cmpl $0x0, 0x12278(%rip)     # 0x160f4
jle 0x3eca
movq 0x12173(%rip), %rbx     # 0x15ff8
movq (%rbx), %rdi
leaq 0xba89(%rip), %rsi      # 0xf918
pushq $0xc
popq %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x12254(%rip)     # 0x160f4
jle 0x3eca
movq (%rbx), %rdi
leaq 0xbeb2(%rip), %rsi      # 0xfd5e
movq %r15, %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x12237(%rip)     # 0x160f4
jle 0x3eca
movq (%rbx), %rsi
pushq $0xa
popq %rdi
callq 0x10d0
pushq $0xc
jmp 0x3f25
cmpl $0x0, 0x1221f(%rip)     # 0x160f4
jle 0x3f23
movq 0x1211a(%rip), %r14     # 0x15ff8
movq (%r14), %rdi
leaq 0xba30(%rip), %rsi      # 0xf918
pushq $0xd
popq %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x121fb(%rip)     # 0x160f4
jle 0x3f23
movq (%r14), %rdi
leaq 0xbe59(%rip), %rsi      # 0xfd5e
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x121de(%rip)     # 0x160f4
jle 0x3f23
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x10d0
pushq $0xd
popq %rdi
callq 0x1180
jne 0x3f79
movq 0x120c4(%rip), %r14     # 0x15ff8
movq (%r14), %rdi
leaq 0xb9da(%rip), %rsi      # 0xf918
pushq $0xb
popq %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x121a5(%rip)     # 0x160f4
jle 0x3f79
movq (%r14), %rdi
leaq 0xbe2a(%rip), %rsi      # 0xfd85
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x12188(%rip)     # 0x160f4
jle 0x3f79
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x10d0
pushq $0xb
jmp 0x3f25