// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/lib/maf.c
// Function: mafWriteDelimiter
void mafWriteDelimiter(FILE *f, struct mafAli *ali, char delimiter)
/* Write next alignment to file. */
{
struct mafComp *comp;
int srcChars = 0, startChars = 0, sizeChars = 0, srcSizeChars = 0;

/* Write out alignment header */
fprintf(f, "a score=%f%c", ali->score, delimiter);

/* include region definition */
if (ali->regDef != NULL)
    fprintf(f, "r %s %d %s%c", ali->regDef->type, ali->regDef->size, ali->regDef->id, delimiter);

/* Figure out length of each field. */
for (comp = ali->components; comp != NULL; comp = comp->next)
    {
    int len = 0;
    /* a name like '.' will break some tools, so replace it
    * with a generic name */
    if (sameString(comp->src,"."))
	comp->src=cloneString("defaultName");
    len = strlen(comp->src);
    if (srcChars < len)
        srcChars = len;
    len = digitsBaseTen(comp->start);
    if (startChars < len)
        startChars = len;
    len = digitsBaseTen(comp->size);
    if (sizeChars < len)
        sizeChars = len;
    len = digitsBaseTen(comp->srcSize);
    if (srcSizeChars < len)
        srcSizeChars = len;
    }

/* Write out each component. */
for (comp = ali->components; comp != NULL; comp = comp->next)
    {
    if ((comp->size == 0) && (comp->leftStatus))
	fprintf(f, "e %-*s %*d %*d %c %*d %c%c", 
	    srcChars, comp->src, startChars, comp->start, 
	    sizeChars, comp->leftLen, comp->strand, 
	    srcSizeChars, comp->srcSize, comp->leftStatus, delimiter);
    else
	{
	fprintf(f, "s %-*s %*d %*d %c %*d %s%c", 
	    srcChars, comp->src, startChars, comp->start, 
	    sizeChars, comp->size, comp->strand, 
	    srcSizeChars, comp->srcSize, comp->text, delimiter);

	if (comp->quality)
		fprintf(f, "q %-*s %s%c",
		srcChars + startChars + sizeChars + srcSizeChars + 5,
		comp->src, comp->quality, delimiter);

	if (comp->leftStatus)
	    fprintf(f,"i %-*s %c %d %c %d%c",srcChars,comp->src,
		comp->leftStatus,comp->leftLen,comp->rightStatus,comp->rightLen, delimiter);
	}

    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movsd 0x8(%rsi), %xmm0
leaq 0x64e65(%rip), %rsi     # 0x91832
movb $0x1, %al
callq 0x6a90
movq 0x20(%r15), %rax
testq %rax, %rax
je 0x2c9fb
movq (%rax), %rdx
movl 0x8(%rax), %ecx
movq 0x10(%rax), %r8
leaq 0x64e51(%rip), %rsi     # 0x9183f
movq %r14, %rdi
movl %ebx, %r9d
xorl %eax, %eax
callq 0x6a90
movq %r14, 0x8(%rsp)
movq %rbx, 0x20(%rsp)
movq %r15, 0x10(%rsp)
movq 0x10(%r15), %rbx
testq %rbx, %rbx
je 0x2cab1
xorl %eax, %eax
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %r12d, %r12d
movl %eax, (%rsp)
movq 0x8(%rbx), %rdi
leaq 0x63e58(%rip), %rsi     # 0x90888
callq 0x6a50
testl %eax, %eax
jne 0x2ca49
leaq 0x64e0c(%rip), %rdi     # 0x9184c
callq 0x1f9f6
movq %rax, 0x8(%rbx)
movq 0x8(%rbx), %rdi
callq 0x62d0
movq %rax, %rbp
cmpl %ebp, %r12d
cmovgl %r12d, %ebp
movl 0x18(%rbx), %edi
callq 0x324b6
movl %eax, %r12d
cmpl %eax, %r15d
cmovgl %r15d, %r12d
movl 0x1c(%rbx), %edi
callq 0x324b6
movl %eax, %r13d
cmpl %eax, %r14d
cmovgl %r14d, %r13d
movl 0x10(%rbx), %edi
callq 0x324b6
movq %r12, %r8
movq %rbp, %rdx
movl %eax, %ebp
movl (%rsp), %eax
cmpl %ebp, %eax
cmovgl %eax, %ebp
movq (%rbx), %rbx
movl %ebp, %eax
movl %r13d, %r14d
movl %r8d, %r15d
movl %edx, %r12d
testq %rbx, %rbx
jne 0x2ca22
jmp 0x2cabb
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
movq 0x20(%rsp), %r12
movq 0x8(%rsp), %r15
je 0x2cc04
leal (%rdx,%r8), %eax
addl %r13d, %eax
addl %ebp, %eax
addl $0x5, %eax
movl %eax, 0x1c(%rsp)
movq %rdx, (%rsp)
movq %r8, 0x10(%rsp)
movl 0x1c(%rbx), %r10d
testl %r10d, %r10d
je 0x2cb9f
movq 0x8(%rbx), %rcx
movl 0x18(%rbx), %r9d
movsbl 0x14(%rbx), %r11d
movl 0x10(%rbx), %r14d
subq $0x8, %rsp
movq %r15, %rdi
leaq 0x64d57(%rip), %rsi     # 0x91873
xorl %eax, %eax
pushq %r12
pushq 0x20(%rbx)
pushq %r14
pushq %rbp
pushq %r11
pushq %r10
pushq %r13
callq 0x6a90
addq $0x40, %rsp
movq 0x28(%rbx), %r8
testq %r8, %r8
je 0x2cb5a
movq 0x8(%rbx), %rcx
movq %r15, %rdi
leaq 0x64d42(%rip), %rsi     # 0x9188e
movl 0x1c(%rsp), %edx
movl %r12d, %r9d
xorl %eax, %eax
callq 0x6a90
movsbl 0x30(%rbx), %r8d
testl %r8d, %r8d
je 0x2cbef
movq 0x8(%rbx), %rcx
movl 0x34(%rbx), %r9d
movsbl 0x38(%rbx), %r10d
movl 0x3c(%rbx), %r11d
subq $0x8, %rsp
movq %r15, %rdi
leaq 0x64d13(%rip), %rsi     # 0x9189a
movq 0x8(%rsp), %rdx
xorl %eax, %eax
pushq %r12
pushq %r11
pushq %r10
callq 0x6a90
addq $0x20, %rsp
jmp 0x2cbef
movsbl 0x30(%rbx), %r11d
testl %r11d, %r11d
je 0x2cafd
movq 0x8(%rbx), %rcx
movl 0x18(%rbx), %r9d
movl 0x34(%rbx), %r10d
movsbl 0x14(%rbx), %r14d
movl 0x10(%rbx), %r15d
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x64c86(%rip), %rsi     # 0x91858
xorl %eax, %eax
pushq %r12
pushq %r11
pushq %r15
movq 0x28(%rsp), %r15
pushq %rbp
pushq %r14
pushq %r10
pushq %r13
callq 0x6a90
addq $0x40, %rsp
movq (%rbx), %rbx
testq %rbx, %rbx
movq (%rsp), %rdx
movq 0x10(%rsp), %r8
jne 0x2caf0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq