// File: /workspace/github_c_makefile_star2_O1/pipde[P]deos-songlib/lib/rra.c
// Function: writeRRAHeader
void
writeRRAHeader(FILE *out,RRA *w,char *tag, void (*handler)(FILE *,RRA *))
    {
    int digits,i;
    int prevSkip=-1,prevBPS=-1,prevChannels=-1,prevSamples=-1,prevSR=-1;
    if (handler == 0) handler = defaultTagWriter;

    fprintf(out,"RRAUDIO\n");

    handler(out,w);

    if (w->channels != DEFAULT_CHANNELS && w->channels != prevChannels)
        {
        fprintf(out,"channels: %d\n",w->channels);
        prevChannels = w->channels;
        }
    if (w->sampleRate != DEFAULT_SAMPLE_RATE && w->sampleRate != prevSR)
        {
        fprintf(out,"sampleRate: %d\n",w->sampleRate);
        prevSR = w->sampleRate;
        }
    if (w->bitsPerSample != DEFAULT_BPS && w->bitsPerSample != prevBPS)
        {
        fprintf(out,"bitsPerSample: %d\n",w->bitsPerSample);
        prevBPS = w->bitsPerSample;
        }
    if (w->skip != 0 && w->skip != prevSkip)
        {
        fprintf(out,"skip: %d\n",w->skip);
        prevSkip = w->skip;
        }

    if (w->samples != 0 && w->samples != prevSamples)
        {
        //fprintf(stderr,"samples: 000000000000000\n");
        fprintf(out,"samples: ");
        digits = determineDigits(w->samples); 
        for(i = 0; i<15-digits;i++)
            fprintf(out,"0");
        //fseek(out,-digits-1,SEEK_CUR);
        fprintf(out,"%d\n",w->samples);
        prevSamples = w->samples;
        }

    fprintf(out,"%s\n",tag);

    fprintf(out,"%%%%\n");
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
testq %rcx, %rcx
leaq 0x139(%rip), %r12       # 0x29a9
cmovneq %rcx, %r12
leaq 0x984(%rip), %rdi       # 0x31ff
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1210
movq %rbx, %rdi
movq %r15, %rsi
callq *%r12
movl (%r15), %edx
cmpl $-0x1, %edx
je 0x28b4
cmpl $0x1, %edx
je 0x28b4
leaq 0x8d6(%rip), %rsi       # 0x3180
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x4(%r15), %edx
cmpl $-0x1, %edx
je 0x28d6
cmpl $0xac44, %edx           # imm = 0xAC44
je 0x28d6
leaq 0x8c2(%rip), %rsi       # 0x318e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x8(%r15), %edx
cmpl $-0x1, %edx
je 0x28f5
cmpl $0x10, %edx
je 0x28f5
leaq 0x8b3(%rip), %rsi       # 0x319e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x10(%r15), %edx
leal 0x1(%rdx), %eax
cmpl $0x2, %eax
jb 0x2912
leaq 0x8a9(%rip), %rsi       # 0x31b1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0xc(%r15), %eax
incl %eax
cmpl $0x2, %eax
jb 0x297c
leaq 0xb14(%rip), %rdi       # 0x3438
movl $0x9, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1210
movl 0xc(%r15), %edi
callq 0x2a3e
cmpl $0xe, %eax
jg 0x2967
movl $0xf, %ecx
subl %eax, %ecx
cmpl $0x2, %ecx
movl $0x1, %ebp
cmovgel %ecx, %ebp
movl $0x30, %edi
movq %rbx, %rsi
callq 0x1100
decl %ebp
jne 0x2956
movl 0xc(%r15), %edx
leaq 0x83b(%rip), %rsi       # 0x31ad
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
leaq 0xadc(%rip), %rsi       # 0x345f
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1140
leaq 0xaab(%rip), %rsi       # 0x3442
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1140