// File: /workspace/github_c_makefile_star2_O3/pipde[P]deos-songlib/utils/processtab/processtab.c
// Function: outputMakefile
static void 
outputMakefile(Composition *c, FILE *out, char *baseName)
	{
	int i, j;
    bool usedStdAttribute;
	char cfiles[MAX_LENGTH_ATTRIBUTE_INCLUDES] = "";
	char includes[MAX_LENGTH_ATTRIBUTE_INCLUDES] = "";	
    
    /* determine attribute processors to add to makefile */
    for (i = 0; i < c->attributeNameCount; i++)
        {
        usedStdAttribute = false;
        for (j = 0; j < STD_ATTRIBUTE_COUNT; j++)
        	{
        	if (strcmp(c->attributeNames[i], stdAttributes[j]) == 0)
        		{
        		usedStdAttribute = true;
        		break;
        		}
	        }
        if (!usedStdAttribute)
        	{
        	sprintf(cfiles, "%s.c ", c->attributeNames[i]);
        	sprintf(includes, "%s.h ", c->attributeNames[i]);
        	}
        }
        
    fprintf(out, "# This file was generated by %s %s.\n", PROGRAM_NAME, PROGRAM_VERSION);
    fprintf(out, "\n");
    fprintf(out, "BASENAME = %s\n", baseName);
    fprintf(out, "CC = gcc\n");
    fprintf(out, "DEBUG = -DMIN_DEBUG_LEVEL=3 -DMAX_DEBUG_LEVEL=6 -g #-p\n");
    fprintf(out, "CFLAGS = -Wall -pg $(DEBUG)\n");
    fprintf(out, "\n");
    fprintf(out, "BIN = $(BASENAME)\n");
    fprintf(out, "TAB = $(BASENAME).tab\n");
    fprintf(out, "MAIN = $(BASENAME).c\n");
    fprintf(out, "CFILES = $(MAIN) %s\n", cfiles);
    fprintf(out, "INCLUDES = %s\n", includes);
    fprintf(out, "RRAS = $(BASENAME).rra\n");
    fprintf(out, "\n");
    fprintf(out, ".PHONY : mix play clean\n");
    fprintf(out, "\n");
    fprintf(out, "play : mix\n");
    fprintf(out, "\trplay $(RRAS)\n");
    fprintf(out, "\n");
    fprintf(out, "mix : $(RRAS)\n");
    fprintf(out, "\n");
    fprintf(out, "%%.rra : $(BIN)\n");
    fprintf(out, "\t./$<\n");
    fprintf(out, "\n");
    fprintf(out, "$(BIN) : $(CFILES) $(INCLUDES)\n");
    fprintf(out, "\t$(CC) $(CFILES) -o $(BIN) -L/usr/local/lib -lsong -ltab -lm $(CFLAGS)\n");
    fprintf(out, "\n");
    fprintf(out, "clean :\n");
    fprintf(out, "\trm -f $(RRAS) $(BIN) gmon.out\n");
    fprintf(out, "\n");
    fprintf(out, "really-clean : clean\n");
    fprintf(out, "\trm -f $(MAIN) makefile\n");
    fprintf(out, "\n");
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movq %rdx, (%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %r15
leaq 0x410(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x10d0
leaq 0x10(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x10d0
movl 0x28(%r15), %r14d
testl %r14d, %r14d
jle 0x17ff
leaq 0x898a(%rip), %r13      # 0xa120
xorl %ebp, %ebp
movq 0x20(%r15), %rax
movq (%rax,%rbp,8), %r12
xorl %ebx, %ebx
leaq (%rbx,%r13), %rsi
movq %r12, %rdi
callq 0x1110
testl %eax, %eax
je 0x17f4
addq $0x14, %rbx
cmpq $0x3c, %rbx
jne 0x17a2
leaq 0x410(%rsp), %rdi
leaq 0x49f7(%rip), %rsi      # 0x61c2
movq %r12, %rdx
xorl %eax, %eax
callq 0x11a0
movq 0x20(%r15), %rax
movq (%rax,%rbp,8), %rdx
leaq 0x10(%rsp), %rdi
leaq 0x49df(%rip), %rsi      # 0x61c8
xorl %eax, %eax
callq 0x11a0
movl 0x28(%r15), %r14d
incq %rbp
movslq %r14d, %rax
cmpq %rax, %rbp
jl 0x1798
movq 0x88fa(%rip), %rdx      # 0xa100
movq 0x88fb(%rip), %rcx      # 0xa108
leaq 0x49ba(%rip), %rsi      # 0x61ce
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1130
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10f0
leaq 0x49bc(%rip), %rsi      # 0x61f3
movq %rbx, %rdi
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x1130
leaq 0x49b6(%rip), %rdi      # 0x6202
movl $0x9, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
leaq 0x49a7(%rip), %rdi      # 0x620c
movl $0x37, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
leaq 0x49c6(%rip), %rdi      # 0x6244
movl $0x1c, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10f0
leaq 0x49bd(%rip), %rdi      # 0x6261
movl $0x12, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
leaq 0x49b7(%rip), %rdi      # 0x6274
movl $0x16, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
leaq 0x49b5(%rip), %rdi      # 0x628b
movl $0x15, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
leaq 0x49b2(%rip), %rsi      # 0x62a1
leaq 0x410(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1130
leaq 0x49ae(%rip), %rsi      # 0x62b6
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1130
leaq 0x49a7(%rip), %rdi      # 0x62c5
movl $0x17, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10f0
leaq 0x4999(%rip), %rdi      # 0x62dd
movl $0x18, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10f0
leaq 0x498c(%rip), %rdi      # 0x62f6
movl $0xb, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
leaq 0x497f(%rip), %rdi      # 0x6302
movl $0xf, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10f0
leaq 0x4969(%rip), %rdi      # 0x6312
movl $0xe, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10f0
leaq 0x4952(%rip), %rsi      # 0x6321
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1130
leaq 0x4952(%rip), %rdi      # 0x6332
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10f0
leaq 0x4933(%rip), %rdi      # 0x6339
movl $0x1f, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
leaq 0x493a(%rip), %rdi      # 0x6359
movl $0x47, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10f0
leaq 0x495c(%rip), %rdi      # 0x63a1
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
leaq 0x494c(%rip), %rdi      # 0x63aa
movl $0x1f, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10f0
leaq 0x4946(%rip), %rdi      # 0x63ca
movl $0x15, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
leaq 0x4943(%rip), %rdi      # 0x63e0
movl $0x18, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11c0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10f0
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq