// File: /workspace/github_c_makefile_star2_O2/pipde[P]deos-songlib/utils/processtab/processtab.c
// Function: main
int 
main(int argc, char *argv[])
	{
    ASTTab *tab;
    Composition *composition;
    FILE *in;
    FILE *out = 0, *makefileOut = 0;
    char fileNameBuffer[256];
    char *baseName;
    int argIndex = 1;

	programCmdLine = argv[0];
    argIndex = processOptions(argc,argv);
    
    if (argc-argIndex == 0 && useStdIn)
        {
        baseName = "song";
        in = stdin;
        }
    else if (argc-argIndex == 1 && !useStdIn)
        {
  		baseName = getBaseFilename(argv[argIndex]);
        in = OpenFile(argv[argIndex],"r");
        }
    else
        {
        printHelp();
        exit(-1);
        }
    
    /* outputProgramName can be overriden via command line argument */
    if (outputProgramName == 0) outputProgramName = baseName;

    if (useStdOutForMakefile)
    	{
    	/* Print makefile to stdout, and exit */
    	
    	tab = parseTab(in);
		if (useStdIn) fclose(in);
    	composition = newCompositionFromTab(tab);
		outputMakefile(composition, stdout, baseName);
    	}
    else if (useStdOut)
        {
        /* Print songlib program to stdout, and exit */
        
        out = stdout;
    	tab = parseTab(in);
		if (useStdIn) fclose(in);
    	composition = newCompositionFromTab(tab);
    	outputSonglibFile(composition, out, baseName, outputProgramName, outputVersion);
        }
    else
        {
        /* Print songlib output and makefile to files, and display feedback via stdout */
        
		printf("Processing tab '%s':\n", baseName);
		
		printf("Parsing tab into syntax tree...\n");
    	tab = parseTab(in);
		if (useStdIn) fclose(in);
		
		/* Uncomment the following lines to get a printout of the tab syntax tree */
		//printf("Printing syntax tree...\n");
		//printASTTab(tab, stdout);
		
    	printf("Transforming syntax tree into composition...\n");
    	composition = newCompositionFromTab(tab);
        sprintf(fileNameBuffer, "%s.c", baseName);  
        
	    printf("Outputting %s...\n", fileNameBuffer);
        out = fopen(fileNameBuffer, "w");
    	outputSonglibFile(composition, out, baseName, outputProgramName, outputVersion);
	    fclose(out);
	    
	    if (!skipMakefile)
	    	{
			printf("Outputting makefile...\n");
		    makefileOut = fopen("makefile", "w");
			outputMakefile(composition, makefileOut, baseName);
			fclose(makefileOut);
			}
			
		printf("Done with tab '%s'.\n\n", baseName);
		}
    
    return 0;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rax
movq %rax, 0x7e74(%rip)      # 0x9170
pushq $0x1
popq %r15
leaq 0x3cfd(%rip), %r12      # 0x5004
movslq %r15d, %r13
cmpl %r15d, %ebx
jle 0x13de
movq (%r14,%r13,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x13de
movb 0x2(%rsi), %bpl
testb %bpl, %bpl
je 0x132f
leaq 0x2(%rsi), %rdi
jmp 0x1334
movq 0x8(%r14,%r13,8), %rdi
movzbl 0x1(%rsi), %eax
leal -0x68(%rax), %ecx
cmpl $0xe, %ecx
ja 0x1352
movslq (%r12,%rcx,4), %rax
addq %r12, %rax
jmpq *%rax
movb $0x1, 0x7e28(%rip)      # 0x9178
jmp 0x13c6
cmpl $0x56, %eax
jne 0x1663
callq 0x47a8
movq %rax, 0x7da9(%rip)      # 0x9110
jmp 0x138b
cmpb $0x1, 0x7e0a(%rip)      # 0x917a
je 0x164c
movb $0x1, 0x7dfe(%rip)      # 0x917b
jmp 0x13c6
callq 0x47a8
movq %rax, 0x7ddd(%rip)      # 0x9168
movb $0x1, %al
jmp 0x13c8
cmpb $0x1, 0x7de4(%rip)      # 0x917a
je 0x1655
movb $0x1, 0x7dd6(%rip)      # 0x9179
jmp 0x13c6
cmpb $0x1, 0x7dcd(%rip)      # 0x9179
je 0x1655
cmpb $0x1, 0x7dc2(%rip)      # 0x917b
je 0x164c
movb $0x1, 0x7db4(%rip)      # 0x917a
xorl %eax, %eax
testb %bpl, %bpl
sete %cl
andb %al, %cl
movzbl %cl, %eax
addl %eax, %r15d
incl %r15d
jmp 0x1307
subl %r15d, %ebx
jne 0x1402
cmpb $0x1, 0x7d8e(%rip)      # 0x9178
jne 0x1402
movq 0x7be5(%rip), %rax      # 0x8fd8
movq (%rax), %r14
leaq 0x3d29(%rip), %rbx      # 0x5126
jmp 0x1488
cmpl $0x1, %ebx
jne 0x1671
cmpb $0x0, 0x7d66(%rip)      # 0x9178
jne 0x1671
movq (%r14,%r13,8), %rdi
callq 0x47a8
movq %rax, %r15
pushq $0x2f
popq %rsi
movq %rax, %rdi
callq 0x10c0
movq %rax, %rbx
pushq $0x5c
popq %rsi
movq %r15, %rdi
callq 0x10c0
cmpq %rax, %rbx
cmovaq %rbx, %rax
leaq 0x1(%rax), %rbx
testq %rax, %rax
cmoveq %r15, %rbx
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x10c0
testq %rax, %rax
je 0x1462
movb $0x0, (%rax)
movq %rbx, %rdi
callq 0x47a8
movq %rax, %rbx
movq %r15, %rdi
callq 0x1030
movq (%r14,%r13,8), %rdi
leaq 0x46d0(%rip), %rsi      # 0x5b50
callq 0x4740
movq %rax, %r14
cmpq $0x0, 0x7cd8(%rip)      # 0x9168
jne 0x1499
movq %rbx, 0x7ccf(%rip)      # 0x9168
cmpb $0x1, 0x7cda(%rip)      # 0x917a
jne 0x14e0
movq %r14, %rdi
callq 0x2b3e
movq %rax, %r15
cmpb $0x1, 0x7cc4(%rip)      # 0x9178
jne 0x14be
movq %r14, %rdi
callq 0x1070
movq %r15, %rdi
callq 0x3ac1
movq 0x7b03(%rip), %rcx      # 0x8fd0
movq (%rcx), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0x1691
jmp 0x1638
cmpb $0x1, 0x7c92(%rip)      # 0x9179
jne 0x1538
movq 0x7ae0(%rip), %rax      # 0x8fd0
movq (%rax), %r15
movq %r14, %rdi
callq 0x2b3e
movq %rax, %r12
cmpb $0x1, 0x7c73(%rip)      # 0x9178
jne 0x150f
movq %r14, %rdi
callq 0x1070
movq %r12, %rdi
callq 0x3ac1
movq 0x7c4a(%rip), %rcx      # 0x9168
movq 0x7beb(%rip), %r8       # 0x9110
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x19c6
jmp 0x1638
leaq 0x3bec(%rip), %rdi      # 0x512b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10a0
leaq 0x4607(%rip), %rdi      # 0x5b57
callq 0x1060
movq %r14, %rdi
callq 0x2b3e
movq %rax, %r15
cmpb $0x1, 0x7c11(%rip)      # 0x9178
jne 0x1571
movq %r14, %rdi
callq 0x1070
leaq 0x45ff(%rip), %rdi      # 0x5b77
callq 0x1060
movq %r15, %rdi
callq 0x3ac1
movq %rax, %r14
leaq 0x3bb2(%rip), %rsi      # 0x5141
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x11a0
leaq 0x3ba0(%rip), %rdi      # 0x5146
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
leaq 0x3ba1(%rip), %rsi      # 0x5158
movq %r15, %rdi
callq 0x1180
movq %rax, %r15
movq 0x7b9f(%rip), %rcx      # 0x9168
movq 0x7b40(%rip), %r8       # 0x9110
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x19c6
movq %r15, %rdi
callq 0x1070
cmpb $0x0, 0x7b8e(%rip)      # 0x917b
jne 0x1627
leaq 0x45ae(%rip), %rdi      # 0x5ba4
callq 0x1060
leaq 0x3b58(%rip), %rdi      # 0x515a
leaq 0x3b4f(%rip), %rsi      # 0x5158
callq 0x1180
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1691
movq %r15, %rdi
callq 0x1070
leaq 0x3b35(%rip), %rdi      # 0x5163
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10a0
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4568(%rip), %rdi      # 0x5bbb
jmp 0x165c
leaq 0x4580(%rip), %rdi      # 0x5bdc
callq 0x1060
jmp 0x1671
leaq 0x3b0f(%rip), %rdi      # 0x5179
xorl %eax, %eax
callq 0x10a0
callq 0x2a3c
pushq $-0x1
popq %rdi
callq 0x11b0
callq 0x2a3c
jmp 0x168a
callq 0x2a20
xorl %edi, %edi
callq 0x11b0