// File: /workspace/github_c_makefile_star2_O1/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 0xe59f(%rip), %rsi      # 0x12de0
callq 0x10f0
testl %eax, %eax
je 0x485b
leaq 0xdb83(%rip), %rsi      # 0x123d4
movq %r15, %rdi
callq 0x1120
jmp 0x4872
cmpl $0x4, 0x14892(%rip)     # 0x190f4
jge 0x4927
movq 0x14769(%rip), %rax     # 0x18fd8
movq (%rax), %rax
movq %rax, (%r12)
testq %rax, %rax
je 0x4938
leaq 0xe560(%rip), %rsi      # 0x12de6
movq %rbx, %rdi
callq 0x10f0
testl %eax, %eax
je 0x48e5
movq $0x0, (%r14)
leaq 0xde2d(%rip), %rsi      # 0x126cd
movq %rbx, %rdi
callq 0x10f0
testl %eax, %eax
je 0x48be
leaq 0xdb21(%rip), %rsi      # 0x123d4
movq %rbx, %rdi
callq 0x1120
movq %rax, (%r14)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x48d4
callq 0x1080
cmpb $0x0, 0x14872(%rip)     # 0x19144
je 0x4910
leaq 0xe502(%rip), %rsi      # 0x12ddd
movq %rbx, %rdi
callq 0x1120
jmp 0x48f8
cmpl $0x4, 0x14808(%rip)     # 0x190f4
jge 0x4931
movq 0x146db(%rip), %rax     # 0x18fd0
movq (%rax), %rax
movq %rax, (%r14)
testq %rax, %rax
je 0x4991
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
cmpl $0x1, 0x147dd(%rip)     # 0x190f4
jle 0x49ea
movq %rbx, %rdi
callq 0x2448
jmp 0x48d4
callq 0x242c
jmp 0x4868
callq 0x2512
jmp 0x48ee
cmpl $0x0, 0x147b5(%rip)     # 0x190f4
jle 0x4946
callq 0x2549
cmpl $0x0, 0x147a7(%rip)     # 0x190f4
jle 0x496a
movq 0x146a2(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
leaq 0xe3fe(%rip), %rsi      # 0x12d5e
movq %r15, %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x14783(%rip)     # 0x190f4
jle 0x4987
movq 0x1467e(%rip), %rax     # 0x18ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10d0
movl $0xc, %edi
callq 0x1180
cmpl $0x0, 0x1475c(%rip)     # 0x190f4
jle 0x499f
callq 0x252e
cmpl $0x0, 0x1474e(%rip)     # 0x190f4
jle 0x49c3
movq 0x14649(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
leaq 0xe3a5(%rip), %rsi      # 0x12d5e
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x1472a(%rip)     # 0x190f4
jle 0x49e0
movq 0x14625(%rip), %rax     # 0x18ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10d0
movl $0xd, %edi
callq 0x1180
jne 0x49f1
callq 0x24f7
cmpl $0x0, 0x146fc(%rip)     # 0x190f4
jle 0x4a15
movq 0x145f7(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
leaq 0xe37a(%rip), %rsi      # 0x12d85
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x146d8(%rip)     # 0x190f4
jle 0x4a32
movq 0x145d3(%rip), %rax     # 0x18ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10d0
movl $0xb, %edi
callq 0x1180