// File: /workspace/github_c_makefile_star2_O0/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
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xa, 0x6e20(%rip)      # 0x8160
movsd 0x3cc8(%rip), %xmm0     # 0x5010
movsd 0x3cc8(%rip), %xmm1     # 0x5018
callq 0x1060
movsd %xmm0, -0x20(%rbp)
movsd 0x3ca6(%rip), %xmm0     # 0x5008
movsd %xmm0, -0x28(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x64, -0x14(%rbp)
jge 0x13c2
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x20(%rbp), %xmm0
cvtsi2sdl -0x14(%rbp), %xmm1
callq 0x1060
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
cvttsd2si -0x30(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %edx
movslq -0x14(%rbp), %rcx
leaq 0x6dbc(%rip), %rax      # 0x8170
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x136e
movl $0x1, -0x38(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x15a0
movl %eax, -0x38(%rbp)
movl -0x8(%rbp), %eax
subl -0x38(%rbp), %eax
cmpl $0x0, %eax
jne 0x1404
movq 0x6bee(%rip), %rax      # 0x7fd8
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq 0x6bd8(%rip), %rax      # 0x7fd0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x14a1
movl -0x8(%rbp), %eax
subl -0x38(%rbp), %eax
cmpl $0x1, %eax
jne 0x143b
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x41ac(%rip), %rsi      # 0x55ce
callq 0x1dc0
movq %rax, -0x40(%rbp)
movq 0x6b9e(%rip), %rax      # 0x7fd0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x149f
movl -0x8(%rbp), %eax
subl -0x38(%rbp), %eax
cmpl $0x2, %eax
jne 0x1485
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x4175(%rip), %rsi      # 0x55ce
callq 0x1dc0
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3bca(%rip), %rsi      # 0x5044
callq 0x1dc0
movq %rax, -0x48(%rbp)
jmp 0x149d
leaq 0x3bba(%rip), %rdi      # 0x5046
movb $0x0, %al
callq 0x1090
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x11e0
jmp 0x149f
jmp 0x14a1
movq -0x40(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2730
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rdi
callq 0x1070
movl -0x8(%rbp), %eax
subl -0x38(%rbp), %eax
cmpl $0x0, %eax
jne 0x14d6
movq 0x6b0b(%rip), %rax      # 0x7fd8
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x1536
movl -0x8(%rbp), %eax
subl -0x38(%rbp), %eax
cmpl $0x1, %eax
jne 0x14ff
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x40da(%rip), %rsi      # 0x55ce
callq 0x1dc0
movq %rax, -0x40(%rbp)
jmp 0x1534
movl -0x8(%rbp), %eax
subl -0x38(%rbp), %eax
cmpl $0x2, %eax
jne 0x1528
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x40b1(%rip), %rsi      # 0x55ce
callq 0x1dc0
movq %rax, -0x40(%rbp)
jmp 0x1532
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x11e0
jmp 0x1534
jmp 0x1536
callq 0x22a0
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
movq -0x50(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x27a0
movq -0x50(%rbp), %rax
cmpl $0x1, (%rax)
je 0x1567
leaq 0x3b1d(%rip), %rdi      # 0x507d
movb $0x0, %al
callq 0x1c70
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0x1720
movq -0x40(%rbp), %rdi
callq 0x1070
movq -0x48(%rbp), %rdi
callq 0x1070
xorl %eax, %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)