// File: /workspace/github_c_makefile_star2_O3/pipde[P]deos-songlib/utils/repitch/repitch.c
// Function: main
int
main(int argc,char **argv)
    {
    int freqCount;
    double twelfthRoot;
    skip = 10;
    twelfthRoot = pow(2.0, (1.0/12.0));

    double baseFreq = 8.859;    // number of samples for Eb 8 at 44,100 sample rate
    for (freqCount = 0; freqCount < 100; freqCount++)
    {
        double target = baseFreq * pow(twelfthRoot,freqCount);
        int samples = (int)target;
        targetFreqs[freqCount] = samples;
    }

    int argIndex = 1;

    FILE *in,*out;
    RRA *r, *r2;

    argIndex = processOptions(argc,argv);

    if (argc-argIndex == 0)
        {
        in = stdin;
        out = stdout;
        }
    else if (argc-argIndex == 1)
        {
        in = OpenFile(argv[argIndex],"r");
        out = stdout;
        }
    else if (argc-argIndex == 2)
        {
        in = OpenFile(argv[argIndex],"r");
        out = OpenFile(argv[argIndex+1],"w");
        }
    else
        {
        printf("usage: filter [<input rra file> [<output wave file>]]\n");
        exit(-1);
        }

    r2 = readRRA(in,0);
    fclose(in);

    if (argc-argIndex == 0)
        {
        in = stdin;
        }
    else if (argc-argIndex == 1)
        {
        in = OpenFile(argv[argIndex],"r");
        }
    else if (argc-argIndex == 2)
        {
        in = OpenFile(argv[argIndex],"r");
        }
    else
        {
        exit(-1);
        }

    r = newRRAHeader();
    readRRAHeader(in, r, 0);
    
    if (r->channels != 1)
        Fatal("rrarepitch only works on mono audio files\n");

    processData(in,out,r, r2);

    fclose(in);
    fclose(out);

    return 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2ef8, %rsp           # imm = 0x2EF8
movq %rsi, %r15
movl %edi, %r13d
movl $0xa, 0x5b80(%rip)      # 0x7180
leaq 0x5b89(%rip), %rbx      # 0x7190
xorl %r14d, %r14d
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
movsd 0x29ee(%rip), %xmm0     # 0x4008
callq 0x1090
mulsd 0x29e9(%rip), %xmm0     # 0x4010
cvttsd2si %xmm0, %eax
movl %eax, (%rbx)
incq %r14
addq $0x4, %rbx
cmpq $0x64, %r14
jne 0x160a
movl $0x1, %r14d
cmpl $0x2, %r13d
jl 0x16d8
movl %r13d, %r12d
movl $0x1, %r14d
leaq 0x2ad2(%rip), %rbx      # 0x412c
movq (%r15,%r14,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x16d8
cmpb $0x0, 0x2(%rsi)
je 0x166f
leaq 0x2(%rsi), %rdi
jmp 0x1674
movq 0x8(%r15,%r14,8), %rdi
movzbl 0x1(%rsi), %eax
cmpl $0x6f, %eax
je 0x1692
cmpl $0x76, %eax
je 0x1af5
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1b30
jmp 0x16c7
callq 0x1080
cvttsd2si %xmm0, %eax
movl %eax, 0x5c7f(%rip)      # 0x7320
movl $0x7, %edi
subl %eax, %edi
movsd 0x2968(%rip), %xmm0     # 0x4018
callq 0x1050
mulsd 0x2963(%rip), %xmm0     # 0x4020
cvttsd2si %xmm0, %eax
movl %eax, 0x5ab9(%rip)      # 0x7180
incq %r14
cmpq %r14, %r12
jne 0x165a
movl %r13d, -0x30(%rbp)
xorl %r12d, %r12d
jmp 0x16e4
movl %r13d, %r12d
subl %r14d, %r12d
jne 0x16ff
movl %r13d, -0x30(%rbp)
movq 0x58ed(%rip), %rax      # 0x6fd8
movq (%rax), %r13
movq 0x58db(%rip), %rax      # 0x6fd0
movq (%rax), %rbx
movb $0x1, %al
movl %eax, -0x38(%rbp)
jmp 0x1772
cmpl $0x2, %r12d
je 0x1737
cmpl $0x1, %r12d
jne 0x1b18
movslq %r14d, %rax
movq (%r15,%rax,8), %rdi
leaq 0x2edd(%rip), %rsi      # 0x45fa
callq 0x1bca
movq %rax, %r13
movq 0x58a4(%rip), %rax      # 0x6fd0
movq (%rax), %rbx
movl $0x1, %r12d
jmp 0x1767
movslq %r14d, %rbx
movq (%r15,%rbx,8), %rdi
leaq 0x2eb5(%rip), %rsi      # 0x45fa
callq 0x1bca
movq %rax, %r13
movq 0x8(%r15,%rbx,8), %rdi
leaq 0x28fb(%rip), %rsi      # 0x4054
callq 0x1bca
movq %rax, %rbx
movl $0x2, %r12d
movl $0x0, -0x38(%rbp)
movl %r14d, -0x30(%rbp)
movq %r13, %rdi
xorl %esi, %esi
callq 0x2132
movq %rax, %r14
movq %r13, %rdi
callq 0x10a0
cmpb $0x0, -0x38(%rbp)
je 0x1799
movq 0x5844(%rip), %rax      # 0x6fd8
movq (%rax), %r15
jmp 0x17c7
cmpl $0x2, %r12d
je 0x17b0
cmpl $0x1, %r12d
movl -0x30(%rbp), %eax
jne 0x1b24
cltq
jmp 0x17b4
movslq -0x30(%rbp), %rax
movq (%r15,%rax,8), %rdi
leaq 0x2e3b(%rip), %rsi      # 0x45fa
callq 0x1bca
movq %rax, %r15
callq 0x1e3b
movq %rax, %r12
movq %r15, -0x30(%rbp)
movq %r15, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x2261
cmpl $0x1, (%r12)
je 0x17f5
leaq 0x2868(%rip), %rdi      # 0x4056
xorl %eax, %eax
callq 0x1b30
cmpl $0x0, 0xc(%r12)
jle 0x1848
movq $-0xc350, %r15          # imm = 0xFFFF3CB0
leaq 0x17bc(%rip), %r13      # 0x2fc7
movl 0x8(%r12), %edx
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
movq %r13, %rcx
callq 0x2764
cmpq $0xbb7, %r15            # imm = 0xBB7
ja 0x1830
movl %eax, -0x2f20(%rbp,%r15,4)
movslq 0xc(%r12), %rax
leaq 0x1(%r15), %rcx
addq $0xc351, %r15           # imm = 0xC351
cmpq %rax, %r15
movq %rcx, %r15
jl 0x180b
movslq 0x5931(%rip), %rax      # 0x7180
xorl %r15d, %r15d
movl $0x989680, %r13d        # imm = 0x989680
movl $0x0, %r12d
cmpq $0xb53, %rax            # imm = 0xB53
jg 0x18cc
movl %eax, %ecx
leaq -0x2f20(,%rax,4), %rdx
addq %rbp, %rdx
xorl %r12d, %r12d
movq %rax, %rsi
movl $0x0, %edi
testl %eax, %eax
jle 0x18a8
xorl %r8d, %r8d
xorl %edi, %edi
movl -0x2f20(%rbp,%r8,4), %r9d
subl (%rdx,%r8,4), %r9d
movl %r9d, %r10d
negl %r10d
cmovsl %r9d, %r10d
addl %r10d, %edi
incq %r8
cmpq %r8, %rcx
jne 0x1887
movl %r13d, %r8d
negl %r8d
cmovsl %r13d, %r8d
cmpl %r8d, %edi
cmovbl %esi, %r12d
cmovbl %edi, %r13d
incq %rsi
addq $0x4, %rdx
cmpl $0xb54, %esi            # imm = 0xB54
jne 0x1879
movl $0x1f4, %eax            # imm = 0x1F4
leaq 0x58b8(%rip), %rcx      # 0x7190
xorl %edx, %edx
movl (%rdx,%rcx), %esi
movl %r12d, %edi
subl %esi, %edi
movl %edi, %r8d
negl %r8d
cmovsl %edi, %r8d
cmpl %eax, %r8d
cmovlel %esi, %r15d
cmovll %r8d, %eax
addq $0x4, %rdx
cmpq $0x190, %rdx            # imm = 0x190
jne 0x18da
leaq 0x2776(%rip), %rdi      # 0x4081
movl %r12d, %esi
xorl %eax, %eax
callq 0x10c0
movl $0xac44, %eax           # imm = 0xAC44
xorl %edx, %edx
idivl %r12d
leaq 0x2774(%rip), %rdi      # 0x409a
movl %eax, %esi
xorl %eax, %eax
callq 0x10c0
leaq 0x277f(%rip), %rdi      # 0x40b5
movl %r13d, %esi
xorl %eax, %eax
callq 0x10c0
cvtsi2sd %r12d, %xmm0
cvtsi2sd %r15d, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x5802(%rip)     # 0x7158
leaq 0x276b(%rip), %rdi      # 0x40c8
movb $0x1, %al
callq 0x10c0
leaq 0x2768(%rip), %rdx      # 0x40d3
movq %rbx, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x2cfc
movl 0xc(%r14), %eax
testl %eax, %eax
movq -0x30(%rbp), %r15
jle 0x1ab2
leaq 0x290e(%rip), %r12      # 0x429d
xorpd %xmm2, %xmm2
ucomisd 0x26ad(%rip), %xmm2     # 0x4048
jb 0x1ad6
movq 0x18(%r14), %rcx
movq (%rcx), %rcx
cvttsd2si %xmm2, %edx
decl %eax
cmpl %edx, %eax
movsd %xmm2, -0x38(%rbp)
jle 0x1a5b
leal 0x1(%rdx), %esi
xorl %edi, %edi
testl %edx, %edx
setg %dil
movl %edx, %r8d
subl %edi, %r8d
leal 0x2(%rdx), %edi
cmpl %eax, %esi
cmovgel %esi, %edi
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
movapd %xmm2, %xmm0
movslq %edx, %rax
xorps %xmm2, %xmm2
cvtsi2sdl (%rcx,%rax,4), %xmm2
subsd %xmm1, %xmm0
movslq %r8d, %rax
xorps %xmm1, %xmm1
cvtsi2sdl (%rcx,%rax,4), %xmm1
movapd %xmm2, %xmm4
movsd 0x2623(%rip), %xmm5     # 0x4028
mulsd %xmm5, %xmm4
subsd %xmm1, %xmm4
movslq %esi, %rax
xorps %xmm3, %xmm3
cvtsi2sdl (%rcx,%rax,4), %xmm3
movapd %xmm3, %xmm1
mulsd %xmm5, %xmm1
addsd %xmm4, %xmm1
movslq %edi, %rax
xorps %xmm4, %xmm4
cvtsi2sdl (%rcx,%rax,4), %xmm4
subsd %xmm4, %xmm1
mulsd 0x25f5(%rip), %xmm1     # 0x4030
movsd 0x25f5(%rip), %xmm4     # 0x4038
ucomisd %xmm0, %xmm4
jbe 0x1a67
subsd %xmm2, %xmm1
addsd %xmm1, %xmm1
mulsd %xmm0, %xmm1
addsd %xmm2, %xmm1
jmp 0x1a7f
cltq
xorps %xmm1, %xmm1
cvtsi2sdl (%rcx,%rax,4), %xmm1
jmp 0x1a7f
subsd %xmm1, %xmm3
addsd %xmm3, %xmm3
addsd 0x25c9(%rip), %xmm0     # 0x4040
mulsd %xmm3, %xmm0
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %edx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1160
movsd -0x38(%rbp), %xmm2
addsd 0x56bb(%rip), %xmm2     # 0x7158
movl 0xc(%r14), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
ucomisd %xmm2, %xmm0
ja 0x1993
movq %r15, %rdi
callq 0x10a0
movq %rbx, %rdi
callq 0x10a0
xorl %eax, %eax
addq $0x2ef8, %rsp           # imm = 0x2EF8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x260d(%rip), %rdi      # 0x40ea
leaq 0x260d(%rip), %rsi      # 0x40f1
leaq 0x2610(%rip), %rcx      # 0x40fb
movl $0xc3, %edx
callq 0x10e0
movq 0x564c(%rip), %rsi      # 0x7148
movq 0x564d(%rip), %rdx      # 0x7150
leaq 0x2613(%rip), %rdi      # 0x411d
xorl %eax, %eax
callq 0x10c0
xorl %edi, %edi
callq 0x1220
leaq 0x2627(%rip), %rdi      # 0x4146
callq 0x1070
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1220
nop