// File: /workspace/github_c_makefile_star2_O3/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 0x161(%rip), %r12       # 0x2a54
cmovneq %rcx, %r12
leaq 0x1901(%rip), %rdi      # 0x41ff
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 0x2937
cmpl $0x1, %edx
je 0x2937
leaq 0x1853(%rip), %rsi      # 0x4180
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x4(%r15), %edx
cmpl $-0x1, %edx
je 0x2959
cmpl $0xac44, %edx           # imm = 0xAC44
je 0x2959
leaq 0x183f(%rip), %rsi      # 0x418e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x8(%r15), %edx
cmpl $-0x1, %edx
je 0x2978
cmpl $0x10, %edx
je 0x2978
leaq 0x1830(%rip), %rsi      # 0x419e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x10(%r15), %edx
leal 0x1(%rdx), %eax
cmpl $0x2, %eax
jb 0x2995
leaq 0x1826(%rip), %rsi      # 0x41b1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0xc(%r15), %eax
incl %eax
cmpl $0x2, %eax
jb 0x2a27
leaq 0x1a8d(%rip), %rdi      # 0x4438
movl $0x9, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1210
movl 0xc(%r15), %edx
leal 0x9(%rdx), %eax
movl $0xe, %ebp
cmpl $0x13, %eax
jb 0x2a01
movl $0xfffffff2, %ebp       # imm = 0xFFFFFFF2
movl %edx, %eax
cltq
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rcx
leal (%rcx,%rsi), %eax
addl %esi, %ecx
addl $0x9, %ecx
incl %ebp
cmpl $0x12, %ecx
ja 0x29d5
movl %ebp, %eax
addl $0xd, %eax
jae 0x2a16
negl %ebp
movl $0x30, %edi
movq %rbx, %rsi
callq 0x1100
decl %ebp
jne 0x2a01
movl 0xc(%r15), %edx
leaq 0x1790(%rip), %rsi      # 0x41ad
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
leaq 0x1a31(%rip), %rsi      # 0x445f
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1140
leaq 0x1a00(%rip), %rsi      # 0x4442
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1140