// File: /workspace/github_c_makefile_star2_O1/pipde[P]deos-songlib/lib/rra.c
// Function: updateRRAHeader
void
updateRRAHeader(FILE *fp, int samples)
    {
    char *attribute;
    int digits;
    long tmp = ftell(fp);
    fseek(fp,0L,SEEK_SET);
    fprintf(stderr,"fp = %ld \n",ftell(fp));

    attribute = readAttribute(fp);
    fprintf(stderr,"attribute : %s\n",attribute);

    if(!strcmp(attribute,"RRAUDIO"))
        fprintf(stderr,"Its an RRA file \n");
    

    attribute = readAttribute(fp);
    fprintf(stderr,"attribute : %s\n",attribute);
    while(attribute != 0)
        {
        if(strcmp(attribute,"samples") == 0)
            {
            fprintf(fp,": 000000000000000\n");
            digits = determineDigits(samples);
            fseek(fp,-digits-1,SEEK_CUR);
            fprintf(fp,"%d\n",samples);
            fseek(fp,-1,SEEK_CUR);
            attribute = readAttribute(fp);
            fprintf(stderr,"attribute : %s\n",attribute);
            if(!strcmp(attribute,"samples"))
                continue;
            break;
            }
        fprintf(stderr,"attribute : %s\n",attribute);
        attribute = readAttribute(fp);
        }
    fseek(fp,tmp,SEEK_SET);         
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
callq 0x1150
movq %rax, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x11a0
movq 0x4cd4(%rip), %r13      # 0x5ff8
movq (%r13), %r14
movq %rbx, %rdi
callq 0x1150
leaq 0x2111(%rip), %rsi      # 0x3448
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1140
movq %rbx, %rdi
callq 0x213c
movq %rax, %r14
movq (%r13), %rdi
leaq 0x20f9(%rip), %rsi      # 0x3453
movq %rax, %rdx
xorl %eax, %eax
callq 0x1140
leaq 0x1e9d(%rip), %rsi      # 0x3208
movq %r14, %rdi
callq 0x1120
testl %eax, %eax
jne 0x138d
movq (%r13), %rcx
leaq 0x20e1(%rip), %rdi      # 0x3463
pushq $0x11
popq %rsi
pushq $0x1
popq %rdx
callq 0x1210
movq %rbx, %rdi
callq 0x213c
movq %rax, %r14
movq (%r13), %rdi
leaq 0x20b0(%rip), %rsi      # 0x3453
movq %rax, %rdx
xorl %eax, %eax
callq 0x1140
testq %r14, %r14
je 0x1483
leaq 0x1ed4(%rip), %r15      # 0x3291
leaq 0x208f(%rip), %r12      # 0x3453
movq %r14, %rdi
movq %r15, %rsi
callq 0x1120
testl %eax, %eax
jne 0x145e
leaq 0x2097(%rip), %rdi      # 0x3475
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1210
movl %ebp, %edi
callq 0x2a3e
notl %eax
movslq %eax, %rsi
movq %rbx, %rdi
pushq $0x1
popq %r14
movl %r14d, %edx
callq 0x11a0
movq %rbx, %rdi
leaq 0x1d9c(%rip), %rsi      # 0x31ad
movl %ebp, %edx
xorl %eax, %eax
callq 0x1140
movq %rbx, %rdi
pushq $-0x1
popq %rsi
movl %r14d, %edx
callq 0x11a0
movq %rbx, %rdi
callq 0x213c
movq %rax, %r14
movq (%r13), %rdi
movq %r12, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1140
movq %r14, %rdi
movq %r15, %rsi
callq 0x1120
testq %r14, %r14
je 0x1483
testl %eax, %eax
je 0x13c4
jmp 0x1483
movq (%r13), %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1140
movq %rbx, %rdi
callq 0x213c
movq %rax, %r14
testq %rax, %rax
jne 0x13c4
movq %rbx, %rdi
movq (%rsp), %rsi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a0
nop