// File: /workspace/github_c_makefile_star2_O2/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, %r13d
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x8(%rsi), %xmm0
leaq 0x58e53(%rip), %rsi     # 0x80822
movb $0x1, %al
callq 0x6a90
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x279fd
movq (%rax), %rdx
movl 0x8(%rax), %ecx
movq 0x10(%rax), %r8
leaq 0x58e3f(%rip), %rsi     # 0x8082f
movq %r14, %rdi
movl %r13d, %r9d
xorl %eax, %eax
callq 0x6a90
movq %r14, 0x8(%rsp)
addq $0x10, %rbx
xorl %ebp, %ebp
movq %rbx, %r14
xorl %r12d, %r12d
movq $0x0, (%rsp)
xorl %r15d, %r15d
movq %r13, 0x10(%rsp)
movq (%r14), %r14
testq %r14, %r14
je 0x27a92
movq 0x8(%r14), %rdi
cmpb $0x2e, (%rdi)
jne 0x27a48
cmpb $0x0, 0x1(%rdi)
jne 0x27a48
leaq 0x58e00(%rip), %rdi     # 0x8083c
callq 0x1c306
movq %rax, %rdi
movq %rax, 0x8(%r14)
callq 0x62d0
movq %rax, %r13
cmpl %r13d, %ebp
cmovgl %ebp, %r13d
movl 0x18(%r14), %edi
callq 0x2d0d3
cmpl %eax, %r12d
cmovlel %eax, %r12d
movl 0x1c(%r14), %edi
callq 0x2d0d3
movq (%rsp), %rcx
cmpl %eax, %ecx
cmovlel %eax, %ecx
movq %rcx, (%rsp)
movl 0x10(%r14), %edi
callq 0x2d0d3
cmpl %eax, %r15d
cmovlel %eax, %r15d
movl %r13d, %ebp
jmp 0x27a1e
leal (%r12,%rbp), %eax
addl (%rsp), %eax
addl %r15d, %eax
addl $0x5, %eax
movl %eax, 0x1c(%rsp)
movq %rbp, 0x20(%rsp)
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x27be7
movl 0x1c(%rbx), %r10d
testl %r10d, %r10d
je 0x27b8d
movq 0x8(%rbx), %rcx
movl 0x18(%rbx), %r9d
movsbl 0x14(%rbx), %r11d
movq %r12, %r8
movl 0x10(%rbx), %r12d
subq $0x8, %rsp
movq 0x10(%rsp), %r13
movq %r13, %rdi
leaq 0x58d7b(%rip), %rsi     # 0x80863
movl %ebp, %edx
movq %r8, %rbp
xorl %eax, %eax
movq %r15, %r14
movq 0x18(%rsp), %r15
pushq %r15
pushq 0x20(%rbx)
pushq %r12
movq %r14, %r12
pushq %r14
pushq %r11
pushq %r10
pushq 0x38(%rsp)
callq 0x6a90
addq $0x40, %rsp
movq 0x28(%rbx), %r8
testq %r8, %r8
je 0x27b39
movq 0x8(%rbx), %rcx
movq %r13, %rdi
leaq 0x58d53(%rip), %rsi     # 0x8087e
movl 0x1c(%rsp), %edx
movl %r15d, %r9d
xorl %eax, %eax
callq 0x6a90
movsbl 0x30(%rbx), %r8d
testl %r8d, %r8d
movq %r12, %r15
movq %rbp, %r12
movq 0x20(%rsp), %rbp
je 0x27aa8
movq 0x8(%rbx), %rcx
movl 0x34(%rbx), %r9d
movsbl 0x38(%rbx), %r10d
movl 0x3c(%rbx), %r11d
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x58d17(%rip), %rsi     # 0x8088a
movl %ebp, %edx
xorl %eax, %eax
pushq 0x18(%rsp)
pushq %r11
pushq %r10
callq 0x6a90
addq $0x20, %rsp
jmp 0x27aa8
movsbl 0x30(%rbx), %r11d
testl %r11d, %r11d
je 0x27ac1
movq 0x8(%rbx), %rcx
movl 0x18(%rbx), %r9d
movl 0x34(%rbx), %r10d
movsbl 0x14(%rbx), %r14d
movl 0x10(%rbx), %r13d
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x58c88(%rip), %rsi     # 0x80848
movl %ebp, %edx
movl %r12d, %r8d
xorl %eax, %eax
pushq 0x18(%rsp)
pushq %r11
pushq %r13
pushq %r15
pushq %r14
pushq %r10
pushq 0x38(%rsp)
callq 0x6a90
addq $0x40, %rsp
jmp 0x27aa8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq