// File: /workspace/github_c_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rax
movq %rax, 0x8dd6(%rip)      # 0xa170
movl $0x1, %r15d
cmpl $0x2, %edi
jl 0x1488
movl $0x1, %r15d
leaq 0x4c4e(%rip), %r12      # 0x6004
movslq %r15d, %rax
movq (%r14,%rax,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x1488
movb 0x2(%rsi), %bpl
testb %bpl, %bpl
je 0x13d5
leaq 0x2(%rsi), %rdi
jmp 0x13da
movq 0x8(%r14,%rax,8), %rdi
movzbl 0x1(%rsi), %eax
leal -0x68(%rax), %ecx
cmpl $0xe, %ecx
ja 0x13f8
movslq (%r12,%rcx,4), %rax
addq %r12, %rax
jmpq *%rax
movb $0x1, 0x8d82(%rip)      # 0xa178
jmp 0x146c
cmpl $0x56, %eax
jne 0x1714
callq 0x523a
movq %rax, 0x8d03(%rip)      # 0xa110
jmp 0x1431
cmpb $0x1, 0x8d64(%rip)      # 0xa17a
je 0x16fd
movb $0x1, 0x8d58(%rip)      # 0xa17b
jmp 0x146c
callq 0x523a
movq %rax, 0x8d37(%rip)      # 0xa168
movb $0x1, %al
jmp 0x146e
cmpb $0x1, 0x8d3e(%rip)      # 0xa17a
je 0x1706
movb $0x1, 0x8d30(%rip)      # 0xa179
jmp 0x146c
cmpb $0x1, 0x8d27(%rip)      # 0xa179
je 0x1706
cmpb $0x1, 0x8d1c(%rip)      # 0xa17b
je 0x16fd
movb $0x1, 0x8d0e(%rip)      # 0xa17a
xorl %eax, %eax
testb %bpl, %bpl
sete %cl
andb %al, %cl
movzbl %cl, %eax
addl %eax, %r15d
incl %r15d
cmpl %ebx, %r15d
jl 0x13b6
subl %r15d, %ebx
jne 0x14ac
cmpb $0x1, 0x8ce4(%rip)      # 0xa178
jne 0x14ac
movq 0x8b3b(%rip), %rax      # 0x9fd8
movq (%rax), %r14
leaq 0x4c7f(%rip), %rbx      # 0x6126
jmp 0x153b
cmpl $0x1, %ebx
jne 0x1722
cmpb $0x0, 0x8cbc(%rip)      # 0xa178
jne 0x1722
movslq %r15d, %r12
movq (%r14,%r12,8), %rdi
callq 0x523a
movq %rax, %r15
movq %rax, %rdi
movl $0x2f, %esi
callq 0x10c0
movq %rax, %rbx
movq %r15, %rdi
movl $0x5c, %esi
callq 0x10c0
cmpq %rax, %rbx
cmovaq %rbx, %rax
leaq 0x1(%rax), %rbx
testq %rax, %rax
cmoveq %r15, %rbx
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x10c0
testq %rax, %rax
je 0x1515
movb $0x0, (%rax)
movq %rbx, %rdi
callq 0x523a
movq %rax, %rbx
movq %r15, %rdi
callq 0x1030
movq (%r14,%r12,8), %rdi
leaq 0x561d(%rip), %rsi      # 0x6b50
callq 0x51d2
movq %rax, %r14
cmpq $0x0, 0x8c25(%rip)      # 0xa168
jne 0x154c
movq %rbx, 0x8c1c(%rip)      # 0xa168
cmpb $0x1, 0x8c27(%rip)      # 0xa17a
jne 0x1593
movq %r14, %rdi
callq 0x2e3e
movq %rax, %r15
cmpb $0x1, 0x8c11(%rip)      # 0xa178
jne 0x1571
movq %r14, %rdi
callq 0x1070
movq %r15, %rdi
callq 0x3fcb
movq 0x8a50(%rip), %rcx      # 0x9fd0
movq (%rcx), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0x1744
jmp 0x16eb
cmpb $0x1, 0x8bdf(%rip)      # 0xa179
jne 0x15eb
movq 0x8a2d(%rip), %rax      # 0x9fd0
movq (%rax), %r15
movq %r14, %rdi
callq 0x2e3e
movq %rax, %r12
cmpb $0x1, 0x8bc0(%rip)      # 0xa178
jne 0x15c2
movq %r14, %rdi
callq 0x1070
movq %r12, %rdi
callq 0x3fcb
movq 0x8b97(%rip), %rcx      # 0xa168
movq 0x8b38(%rip), %r8       # 0xa110
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1ace
jmp 0x16eb
leaq 0x4b39(%rip), %rdi      # 0x612b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10a0
leaq 0x5554(%rip), %rdi      # 0x6b57
callq 0x1060
movq %r14, %rdi
callq 0x2e3e
movq %rax, %r15
cmpb $0x1, 0x8b5e(%rip)      # 0xa178
jne 0x1624
movq %r14, %rdi
callq 0x1070
leaq 0x554c(%rip), %rdi      # 0x6b77
callq 0x1060
movq %r15, %rdi
callq 0x3fcb
movq %rax, %r14
leaq 0x4aff(%rip), %rsi      # 0x6141
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x11a0
leaq 0x4aed(%rip), %rdi      # 0x6146
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
leaq 0x4aee(%rip), %rsi      # 0x6158
movq %r15, %rdi
callq 0x1180
movq %rax, %r15
movq 0x8aec(%rip), %rcx      # 0xa168
movq 0x8a8d(%rip), %r8       # 0xa110
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1ace
movq %r15, %rdi
callq 0x1070
cmpb $0x0, 0x8adb(%rip)      # 0xa17b
jne 0x16da
leaq 0x54fb(%rip), %rdi      # 0x6ba4
callq 0x1060
leaq 0x4aa5(%rip), %rdi      # 0x615a
leaq 0x4a9c(%rip), %rsi      # 0x6158
callq 0x1180
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1744
movq %r15, %rdi
callq 0x1070
leaq 0x4a82(%rip), %rdi      # 0x6163
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10a0
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x54b7(%rip), %rdi      # 0x6bbb
jmp 0x170d
leaq 0x54cf(%rip), %rdi      # 0x6bdc
callq 0x1060
jmp 0x1722
leaq 0x4a5e(%rip), %rdi      # 0x6179
xorl %eax, %eax
callq 0x10a0
callq 0x2cfd
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x11b0
callq 0x2ce1
jmp 0x173d
callq 0x2cfd
xorl %edi, %edi
callq 0x11b0