// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, -0x20(%rbp)
jne 0x309d
leaq 0x1c7(%rip), %rax       # 0x3260
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x1127(%rip), %rsi      # 0x41cf
movb $0x0, %al
callq 0x1110
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq *%rax
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
je 0x30f2
movq -0x10(%rbp), %rax
movl (%rax), %eax
cmpl -0x34(%rbp), %eax
je 0x30f2
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %edx
leaq 0x106e(%rip), %rsi      # 0x4150
movb $0x0, %al
callq 0x1110
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
cmpl $0xac44, 0x4(%rax)      # imm = 0xAC44
je 0x312e
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x3c(%rbp), %eax
je 0x312e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
leaq 0x1041(%rip), %rsi      # 0x415e
movb $0x0, %al
callq 0x1110
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x10, 0x8(%rax)
je 0x3167
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x30(%rbp), %eax
je 0x3167
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0x1018(%rip), %rsi      # 0x416e
movb $0x0, %al
callq 0x1110
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x31a0
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
cmpl -0x2c(%rbp), %eax
je 0x31a0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edx
leaq 0xff2(%rip), %rsi       # 0x4181
movb $0x0, %al
callq 0x1110
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x3231
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x38(%rbp), %eax
je 0x3231
movq -0x8(%rbp), %rdi
leaq 0x1247(%rip), %rsi      # 0x440c
movb $0x0, %al
callq 0x1110
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x3360
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl $0xf, %ecx
subl -0x24(%rbp), %ecx
cmpl %ecx, %eax
jge 0x320e
movq -0x8(%rbp), %rdi
leaq 0x121a(%rip), %rsi      # 0x4416
movb $0x0, %al
callq 0x1110
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x31e2
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edx
leaq 0xf5d(%rip), %rsi       # 0x417d
movb $0x0, %al
callq 0x1110
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x11fa(%rip), %rsi      # 0x443a
movb $0x0, %al
callq 0x1110
movq -0x8(%rbp), %rdi
leaq 0x11c6(%rip), %rsi      # 0x4418
movb $0x0, %al
callq 0x1110
addq $0x40, %rsp
popq %rbp
retq
nop