// File: /workspace/github_c_makefile_star2_O1/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, 0x7dd6(%rip)      # 0x9170
movl $0x1, %r15d
cmpl $0x2, %edi
jl 0x1488
movl $0x1, %r15d
leaq 0x3c4e(%rip), %r12      # 0x5004
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, 0x7d82(%rip)      # 0x9178
jmp 0x146c
cmpl $0x56, %eax
jne 0x1714
callq 0x4c54
movq %rax, 0x7d03(%rip)      # 0x9110
jmp 0x1431
cmpb $0x1, 0x7d64(%rip)      # 0x917a
je 0x16fd
movb $0x1, 0x7d58(%rip)      # 0x917b
jmp 0x146c
callq 0x4c54
movq %rax, 0x7d37(%rip)      # 0x9168
movb $0x1, %al
jmp 0x146e
cmpb $0x1, 0x7d3e(%rip)      # 0x917a
je 0x1706
movb $0x1, 0x7d30(%rip)      # 0x9179
jmp 0x146c
cmpb $0x1, 0x7d27(%rip)      # 0x9179
je 0x1706
cmpb $0x1, 0x7d1c(%rip)      # 0x917b
je 0x16fd
movb $0x1, 0x7d0e(%rip)      # 0x917a
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, 0x7ce4(%rip)      # 0x9178
jne 0x14ac
movq 0x7b3b(%rip), %rax      # 0x8fd8
movq (%rax), %r14
leaq 0x3c7f(%rip), %rbx      # 0x5126
jmp 0x153b
cmpl $0x1, %ebx
jne 0x1722
cmpb $0x0, 0x7cbc(%rip)      # 0x9178
jne 0x1722
movslq %r15d, %r12
movq (%r14,%r12,8), %rdi
callq 0x4c54
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 0x4c54
movq %rax, %rbx
movq %r15, %rdi
callq 0x1030
movq (%r14,%r12,8), %rdi
leaq 0x461d(%rip), %rsi      # 0x5b50
callq 0x4bde
movq %rax, %r14
cmpq $0x0, 0x7c25(%rip)      # 0x9168
jne 0x154c
movq %rbx, 0x7c1c(%rip)      # 0x9168
cmpb $0x1, 0x7c27(%rip)      # 0x917a
jne 0x1593
movq %r14, %rdi
callq 0x2df6
movq %rax, %r15
cmpb $0x1, 0x7c11(%rip)      # 0x9178
jne 0x1571
movq %r14, %rdi
callq 0x1070
movq %r15, %rdi
callq 0x3f53
movq 0x7a50(%rip), %rcx      # 0x8fd0
movq (%rcx), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0x1744
jmp 0x16eb
cmpb $0x1, 0x7bdf(%rip)      # 0x9179
jne 0x15eb
movq 0x7a2d(%rip), %rax      # 0x8fd0
movq (%rax), %r15
movq %r14, %rdi
callq 0x2df6
movq %rax, %r12
cmpb $0x1, 0x7bc0(%rip)      # 0x9178
jne 0x15c2
movq %r14, %rdi
callq 0x1070
movq %r12, %rdi
callq 0x3f53
movq 0x7b97(%rip), %rcx      # 0x9168
movq 0x7b38(%rip), %r8       # 0x9110
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1aca
jmp 0x16eb
leaq 0x3b39(%rip), %rdi      # 0x512b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10a0
leaq 0x4554(%rip), %rdi      # 0x5b57
callq 0x1060
movq %r14, %rdi
callq 0x2df6
movq %rax, %r15
cmpb $0x1, 0x7b5e(%rip)      # 0x9178
jne 0x1624
movq %r14, %rdi
callq 0x1070
leaq 0x454c(%rip), %rdi      # 0x5b77
callq 0x1060
movq %r15, %rdi
callq 0x3f53
movq %rax, %r14
leaq 0x3aff(%rip), %rsi      # 0x5141
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x11a0
leaq 0x3aed(%rip), %rdi      # 0x5146
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
leaq 0x3aee(%rip), %rsi      # 0x5158
movq %r15, %rdi
callq 0x1180
movq %rax, %r15
movq 0x7aec(%rip), %rcx      # 0x9168
movq 0x7a8d(%rip), %r8       # 0x9110
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1aca
movq %r15, %rdi
callq 0x1070
cmpb $0x0, 0x7adb(%rip)      # 0x917b
jne 0x16da
leaq 0x44fb(%rip), %rdi      # 0x5ba4
callq 0x1060
leaq 0x3aa5(%rip), %rdi      # 0x515a
leaq 0x3a9c(%rip), %rsi      # 0x5158
callq 0x1180
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1744
movq %r15, %rdi
callq 0x1070
leaq 0x3a82(%rip), %rdi      # 0x5163
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 0x44b7(%rip), %rdi      # 0x5bbb
jmp 0x170d
leaq 0x44cf(%rip), %rdi      # 0x5bdc
callq 0x1060
jmp 0x1722
leaq 0x3a5e(%rip), %rdi      # 0x5179
xorl %eax, %eax
callq 0x10a0
callq 0x2cb5
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x11b0
callq 0x2c99
jmp 0x173d
callq 0x2cb5
xorl %edi, %edi
callq 0x11b0