// File: /workspace/github_c_makefile_star2_O2/mishun[P]plantri/plantri.c
// Function: open_output_file
static void
open_output_file(void)

/* Open the output file, and write a header if one is called for.
   All the needed information is in global vars.  Also check if
   maxn is too large for this format, and set the global procedure
   variables write_graph() and write_dual_graph().
*/
{
    int nvf;

    if (aswitch + gswitch + sswitch + uswitch + Eswitch >= 2)
    {
        fprintf(stderr,">E %s: -a, -g, -s, -u, -E are incompatible\n",cmdname);
        exit(1);
    }

    if (!uswitch)   /*UPDATE for -E and reconconsider */
    {
        nvf = dswitch ? 2*(maxnv-(polygonsize>=0))-4 : maxnv-(polygonsize>=0);
        if ((aswitch && nvf > 99) ||
            (gswitch && nvf > 255) ||
            (sswitch && nvf > 255) ||
           (!aswitch && !gswitch && !sswitch && nvf > 255))
        {
            fprintf(stderr,">E %s: n is too large for that output format\n",
                cmdname);
            exit(1);
        }
    }

    msgfile = stderr;
    if (outfilename == NULL)
    {
        outfilename = "stdout";
        outfile = stdout;
    }
    else if ((outfile = fopen(outfilename,
        zeroswitch || aswitch || gswitch || sswitch ? "w" : "wb")) == NULL)
    {
        fprintf(stderr,
          ">E %s: can't open %s for writing\n",cmdname,outfilename);
        perror(">E ");
        exit(1);
    }

    if (zeroswitch)  /* implied by oneswitch */
        write_graph = write_dual_graph = write_digits;
    else if (aswitch)
    {
        write_graph = write_alpha;
        write_dual_graph = write_dual_alpha;
    }
    else if (gswitch)
    {
        write_graph = write_graph6;
        write_dual_graph = write_dual_graph6;
    }
    else if (sswitch)
    {
        write_graph = write_sparse6;
        write_dual_graph = write_dual_sparse6;
    }
    else if (Eswitch)
    {
        write_graph = write_edgecode;
        write_dual_graph = write_dual_edgecode;
    }
    else
    {
        write_graph = write_planar_code;
        write_dual_graph = write_dual_planar_code;
    }

    if (!uswitch && !aswitch)
    {
        if ((!zeroswitch && !hswitch && !gswitch && !sswitch && !Eswitch &&
	     fwrite(PCODE,(size_t)1,PCODELEN,outfile) != PCODELEN)
          || (!hswitch && Eswitch &&
	      fwrite(ECODE,(size_t)1,ECODELEN,outfile) != ECODELEN)
          || (hswitch && gswitch &&
	      fwrite(G6CODE,(size_t)1,G6CODELEN,outfile) != G6CODELEN)
          || (hswitch && sswitch &&
	      fwrite(S6CODE,(size_t)1,S6CODELEN,outfile) != S6CODELEN))
        {
            fprintf(stderr,">E %s: error writing header\n",cmdname);
            perror(">E ");
            exit(1);
        }
    }
}

// Assembly:
pushq %rbx
movzbl 0x1f577(%rip), %edx     # 0x24224
movzbl 0x1f574(%rip), %eax     # 0x24228
movzbl 0x1f571(%rip), %ecx     # 0x2422c
movzbl 0x1f552(%rip), %esi     # 0x24214
leal (%rcx,%rsi), %r8d
addl %eax, %r8d
addl %edx, %r8d
movzbl 0x1f55d(%rip), %edi     # 0x24230
addl %r8d, %edi
cmpl $0x2, %edi
jae 0x4fca
testb %sil, %sil
jne 0x4d43
movl 0x1f4b6(%rip), %edi     # 0x241a0
notl %edi
sarl $0x1f, %edi
addl 0x1f56b(%rip), %edi     # 0x24260
leal -0x4(,%rdi,2), %esi
cmpb $0x0, 0x1f539(%rip)     # 0x2423c
cmovel %edi, %esi
cmpl $0x64, %esi
setge %dil
testb %dil, %dl
jne 0x4fb0
movl %eax, %edi
orb %cl, %dil
cmpb $0x1, %dil
jne 0x4d2d
cmpl $0xff, %esi
jg 0x4fb0
movl %edx, %edi
orb %al, %dil
orb %cl, %dil
jne 0x4d43
cmpl $0x100, %esi            # imm = 0x100
jge 0x4fb0
movq 0x1f2ae(%rip), %rbx     # 0x23ff8
movq (%rbx), %rsi
movq %rsi, 0x1f484(%rip)     # 0x241d8
movq 0x1f4bd(%rip), %rdi     # 0x24218
testq %rdi, %rdi
je 0x4dc0
leaq 0x1987d(%rip), %r8      # 0x1e5e4
leaq 0x196e2(%rip), %rsi     # 0x1e450
cmpb $0x0, 0x1f4cb(%rip)     # 0x24240
cmovneq %r8, %rsi
testb %dl, %dl
cmovneq %r8, %rsi
testb %al, %al
cmovneq %r8, %rsi
testb %cl, %cl
cmovneq %r8, %rsi
callq 0x1080
movq %rax, 0x23d849(%rip)    # 0x2425e0
testq %rax, %rax
jne 0x4ddf
movq (%rbx), %rdi
movq 0x1f30a(%rip), %rdx     # 0x240b0
movq 0x1f46b(%rip), %rcx     # 0x24218
leaq 0x1969f(%rip), %rsi     # 0x1e453
xorl %eax, %eax
callq 0x1050
jmp 0x5003
leaq 0x19682(%rip), %rax     # 0x1e449
movq %rax, 0x1f44a(%rip)     # 0x24218
movq 0x1f203(%rip), %rax     # 0x23fd8
movq (%rax), %rax
movq %rax, 0x23d801(%rip)    # 0x2425e0
movb 0x1f45b(%rip), %cl      # 0x24240
cmpb $0x1, %cl
jne 0x4e0a
leaq 0x47b6(%rip), %rdx      # 0x95a7
movq %rdx, 0x23d7f0(%rip)    # 0x2425e8
movq %rdx, 0x23d7f1(%rip)    # 0x2425f0
movb 0x1f41f(%rip), %dl      # 0x24224
jmp 0x4eb2
cmpb $0x1, 0x1f413(%rip)     # 0x24224
jne 0x4e34
leaq 0x4a3f(%rip), %rax      # 0x9859
movq %rax, 0x23d7cf(%rip)    # 0x2425f0
leaq 0x4bc6(%rip), %rax      # 0x99ee
movq %rax, 0x23d7b9(%rip)    # 0x2425e8
jmp 0x4fae
cmpb $0x1, 0x1f3ed(%rip)     # 0x24228
jne 0x4e54
leaq 0x4d46(%rip), %rdx      # 0x9b8a
movq %rdx, 0x23d7a5(%rip)    # 0x2425f0
leaq 0x4d66(%rip), %rdx      # 0x9bb8
jmp 0x4ea9
cmpb $0x1, 0x1f3d1(%rip)     # 0x2422c
jne 0x4e74
leaq 0x4d82(%rip), %rdx      # 0x9be6
movq %rdx, 0x23d785(%rip)    # 0x2425f0
leaq 0x4da2(%rip), %rdx      # 0x9c14
jmp 0x4ea9
cmpb $0x1, 0x1f3b5(%rip)     # 0x24230
jne 0x4e94
leaq 0x4dbe(%rip), %rdx      # 0x9c42
movq %rdx, 0x23d765(%rip)    # 0x2425f0
leaq 0x5025(%rip), %rdx      # 0x9eb7
jmp 0x4ea9
leaq 0x52ad(%rip), %rdx      # 0xa148
movq %rdx, 0x23d74e(%rip)    # 0x2425f0
leaq 0x534b(%rip), %rdx      # 0xa1f4
movq %rdx, 0x23d738(%rip)    # 0x2425e8
xorl %edx, %edx
cmpb $0x0, 0x1f35b(%rip)     # 0x24214
jne 0x4fae
testb $0x1, %dl
jne 0x4fae
movb 0x1f36a(%rip), %dl      # 0x24238
orb %dl, %cl
movb 0x1f355(%rip), %sil     # 0x2422c
orb 0x1f34a(%rip), %sil     # 0x24228
orb %cl, %sil
movb 0x1f349(%rip), %cl      # 0x24230
orb %cl, %sil
testb $0x1, %sil
jne 0x4f1b
leaq 0x19582(%rip), %rdi     # 0x1e479
pushq $0x1
popq %rsi
pushq $0xf
popq %rdx
movq %rax, %rcx
callq 0x10c0
cmpq $0xf, %rax
jne 0x4feb
movb 0x1f323(%rip), %dl      # 0x24238
movb 0x1f315(%rip), %cl      # 0x24230
testb $0x1, %dl
jne 0x4f4e
testb $0x1, %cl
je 0x4f4e
movq 0x23d6b4(%rip), %rcx    # 0x2425e0
leaq 0x19556(%rip), %rdi     # 0x1e489
pushq $0x1
popq %rsi
pushq $0xd
popq %rdx
callq 0x10c0
cmpq $0xd, %rax
jne 0x4feb
movb 0x1f2ea(%rip), %dl      # 0x24238
testb $0x1, %dl
je 0x4f81
testb $0x1, 0x1f2ce(%rip)     # 0x24228
je 0x4f81
movq 0x23d67d(%rip), %rcx    # 0x2425e0
leaq 0x1952d(%rip), %rdi     # 0x1e497
pushq $0x1
popq %rsi
pushq $0xa
popq %rdx
callq 0x10c0
cmpq $0xa, %rax
jne 0x4feb
movb 0x1f2b7(%rip), %dl      # 0x24238
testb $0x1, %dl
je 0x4fae
testb $0x1, 0x1f29f(%rip)     # 0x2422c
je 0x4fae
movq 0x23d64a(%rip), %rcx    # 0x2425e0
leaq 0x19505(%rip), %rdi     # 0x1e4a2
pushq $0x1
popq %rsi
pushq $0xb
popq %rdx
callq 0x10c0
cmpq $0xb, %rax
jne 0x4feb
popq %rbx
retq
movq 0x1f041(%rip), %rax     # 0x23ff8
movq (%rax), %rdi
movq 0x1f0ef(%rip), %rdx     # 0x240b0
leaq 0x19453(%rip), %rsi     # 0x1e41b
jmp 0x4fe2
movq 0x1f027(%rip), %rax     # 0x23ff8
movq (%rax), %rdi
movq 0x1f0d5(%rip), %rdx     # 0x240b0
leaq 0x1940d(%rip), %rsi     # 0x1e3ef
xorl %eax, %eax
callq 0x1050
jmp 0x500f
movq (%rbx), %rdi
movq 0x1f0bb(%rip), %rdx     # 0x240b0
leaq 0x194b2(%rip), %rsi     # 0x1e4ae
xorl %eax, %eax
callq 0x1050
leaq 0x1946b(%rip), %rdi     # 0x1e475
callq 0x1090
pushq $0x1
popq %rdi
callq 0x10b0