// File: /workspace/github_c_makefile_star2_O2/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 0x12c(%rip), %r12       # 0x26d7
cmovneq %rcx, %r12
leaq 0xc49(%rip), %rdi       # 0x31ff
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1210
movq %rbx, %rdi
movq %r15, %rsi
callq *%r12
movl (%r15), %edx
cmpl $-0x1, %edx
je 0x25eb
cmpl $0x1, %edx
je 0x25eb
leaq 0xb9f(%rip), %rsi       # 0x3180
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x4(%r15), %edx
cmpl $-0x1, %edx
je 0x260d
cmpl $0xac44, %edx           # imm = 0xAC44
je 0x260d
leaq 0xb8b(%rip), %rsi       # 0x318e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x8(%r15), %edx
cmpl $-0x1, %edx
je 0x262c
cmpl $0x10, %edx
je 0x262c
leaq 0xb7c(%rip), %rsi       # 0x319e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x10(%r15), %edx
leal 0x1(%rdx), %eax
cmpl $0x2, %eax
jb 0x2649
leaq 0xb72(%rip), %rsi       # 0x31b1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0xc(%r15), %eax
incl %eax
cmpl $0x2, %eax
jb 0x26aa
leaq 0xddd(%rip), %rdi       # 0x3438
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1210
movl 0xc(%r15), %edi
callq 0x2763
pushq $0xf
popq %rcx
subl %eax, %ecx
xorl %r12d, %r12d
testl %ecx, %ecx
cmovgl %ecx, %r12d
pushq $0x30
popq %rbp
subl $0x1, %r12d
jb 0x2695
movl %ebp, %edi
movq %rbx, %rsi
callq 0x1100
jmp 0x2683
movl 0xc(%r15), %edx
leaq 0xb0d(%rip), %rsi       # 0x31ad
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
leaq 0xdae(%rip), %rsi       # 0x345f
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1140
leaq 0xd7d(%rip), %rsi       # 0x3442
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1140