// File: /workspace/github_c_makefile_star2_O0/pipde[P]deos-songlib/utils/fixpitch/fixpitch.c
// Function: processData
static void
processData(FILE *in,FILE *out,RRA *h)
    {
    int i,cycle;
    double factor;
    int note;
    //double factor;

    /* fill the initial window */

    for (i = 0; i < WindowSize; ++i)
        {
        Window[WindowEnd]
            = readRRAAmplitude(in,out,h->bitsPerSample,outputComment);
        if (!feof(in))
            {
            ++SamplesRead;
            ++SamplesStored;
            WindowEnd = (WindowEnd+1) % WindowSize;
            }
        }

    //printf("%d samples read\n",SamplesRead);
    //printf("%d samples written\n",SamplesWritten);
    //printf("%d samples stored\n",SamplesStored);
    //printf("%d sample delta\n",SampleDelta);
    //printf("%d window size\n",WindowSize);

    assert(SamplesWritten + SamplesStored + SampleDelta == SamplesRead);

    //getchar();

    /* write out data until an upward zero crossing */
    
    advance(in,out,h);

    if (feof(in)) return;

    //printf("first is at time %d\n",SamplesRead);
    //getchar();

    while (SamplesWritten + SampleDelta != SamplesRead)
        {
        assert(SamplesWritten + SamplesStored + SampleDelta == SamplesRead);
        assert(peek(0) == 0 && peek(1) > 0);

        cycle = findCycleLength(&factor,&note);
        if (cycle == 0)
            {
            if (Report)
                fprintf(ReportFP,"no good cycle found, advancing\n");
            advance(in,out,h);
            }
        else if (factor == 0)
            {
            if (Report)
                fprintf(ReportFP,"no good factor found, advancing\n");
            advance(in,out,h);
            }
        else
            {
            repitch(out,cycle,factor,note);
            //printf("skipping %d samples\n",cycle);
            skip(cycle,in,out,h);
            }
        //printf("%d samples read\n",SamplesRead);
        //printf("%d samples written\n",SamplesWritten);
        //printf("%d samples stored\n",SamplesStored);
        //printf("%d sample delta\n",SampleDelta);
        //printf("sum: %d\n",SamplesWritten+SampleDelta+SamplesStored);
        //getchar();
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl 0x7d04(%rip), %eax      # 0xa938
jge 0x2cba
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0x2df0(%rip), %rcx      # 0x5a40
callq 0x4d90
movl %eax, %edx
movq 0x7cea(%rip), %rax      # 0xa948
movslq 0x7cff(%rip), %rcx      # 0xa964
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rdi
callq 0x2150
cmpl $0x0, %eax
jne 0x2caa
movl 0x7cd4(%rip), %eax      # 0xa950
addl $0x1, %eax
movl %eax, 0x7ccb(%rip)      # 0xa950
movl 0x7cd5(%rip), %eax      # 0xa960
addl $0x1, %eax
movl %eax, 0x7ccc(%rip)      # 0xa960
movl 0x7cca(%rip), %eax      # 0xa964
addl $0x1, %eax
cltd
idivl 0x7c94(%rip)            # 0xa938
movl %edx, 0x7cba(%rip)      # 0xa964
jmp 0x2cac
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2c2b
movl 0x7c94(%rip), %eax      # 0xa954
addl 0x7c9a(%rip), %eax      # 0xa960
addl 0x7c90(%rip), %eax      # 0xa95c
cmpl 0x7c7e(%rip), %eax      # 0xa950
jne 0x2cd6
jmp 0x2cf5
leaq 0x471a(%rip), %rdi      # 0x73f7
leaq 0x46f1(%rip), %rsi      # 0x73d5
movl $0x13c, %edx            # imm = 0x13C
leaq 0x4743(%rip), %rcx      # 0x7433
callq 0x20c0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x2e70
movq -0x8(%rbp), %rdi
callq 0x2150
cmpl $0x0, %eax
je 0x2d19
jmp 0x2e61
jmp 0x2d1b
movl 0x7c33(%rip), %eax      # 0xa954
addl 0x7c35(%rip), %eax      # 0xa95c
cmpl 0x7c23(%rip), %eax      # 0xa950
je 0x2e61
movl 0x7c1b(%rip), %eax      # 0xa954
addl 0x7c21(%rip), %eax      # 0xa960
addl 0x7c17(%rip), %eax      # 0xa95c
cmpl 0x7c05(%rip), %eax      # 0xa950
jne 0x2d4f
jmp 0x2d6e
leaq 0x46a1(%rip), %rdi      # 0x73f7
leaq 0x4678(%rip), %rsi      # 0x73d5
movl $0x14b, %edx            # imm = 0x14B
leaq 0x46ca(%rip), %rcx      # 0x7433
callq 0x20c0
xorl %edi, %edi
callq 0x2fc0
cmpl $0x0, %eax
jne 0x2d8b
movl $0x1, %edi
callq 0x2fc0
cmpl $0x0, %eax
jle 0x2d8b
jmp 0x2daa
leaq 0x46c9(%rip), %rdi      # 0x745b
leaq 0x463c(%rip), %rsi      # 0x73d5
movl $0x14c, %edx            # imm = 0x14C
leaq 0x468e(%rip), %rcx      # 0x7433
callq 0x20c0
leaq -0x28(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x2ff0
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0x2df1
cmpl $0x0, 0x7b4d(%rip)      # 0xa914
je 0x2dde
movq 0x7b48(%rip), %rdi      # 0xa918
leaq 0x46a0(%rip), %rsi      # 0x7477
movb $0x0, %al
callq 0x2130
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x2e70
jmp 0x2e5c
movsd -0x28(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2e32
jp 0x2e32
cmpl $0x0, 0x7b0c(%rip)      # 0xa914
je 0x2e1f
movq 0x7b07(%rip), %rdi      # 0xa918
leaq 0x467f(%rip), %rsi      # 0x7497
movb $0x0, %al
callq 0x2130
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x2e70
jmp 0x2e5a
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
movsd -0x28(%rbp), %xmm0
movl -0x2c(%rbp), %edx
callq 0x31f0
movl -0x20(%rbp), %edi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x3400
jmp 0x2e5c
jmp 0x2d1b
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)