// File: /workspace/github_c_makefile_star2_O3/pipde[P]deos-songlib/utils/skip/skip.c
// Function: main
int
main(int argc,char **argv)
    {
    int argIndex = 1;

    int i,j;
    int amp;
    int skip;
    char buffer[1024];
    FILE *in,*out;
    RRA *h;

    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: skip -sN.M [<input rra file> [<output rra file>]]\n");
        exit(-1);
        }

    h = newRRAHeader();
    
    readRRAHeader(in,h,0);

    skip = h->sampleRate * seconds;

    if (hard)
        {
        snprintf(buffer,sizeof(buffer),"modifiedBy: %s", PROGRAM_NAME);
        h->samples -= skip;
        }
    else
        snprintf(buffer,sizeof(buffer),"skip: %d\nmodifiedBy: %s",
            skip,PROGRAM_NAME);

    writeRRAHeader(out,h,buffer,0);

    for (i = 0; !feof(in); ++i)
        {
        for (j = 0; j < h->channels; ++j)
            {
            amp = readRRAAmplitude(in,out,h->bitsPerSample,0);
            if (!hard || i >= skip)
                fprintf(out,"%d\n",(int) (amp * attenuation));
            }
        }

    if (i != h->samples + 1)
        fprintf(stderr,"WARNING: %d samples found, %d expected\n",i,h->samples);

    fclose(in);
    fclose(out);

    return 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rsi, %r14
movl %edi, %ebx
movl $0x1, %r12d
cmpl $0x2, %edi
jl 0x16ab
movl $0x1, %r12d
movslq %r12d, %rax
movq (%r14,%rax,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x16ab
movb 0x2(%rsi), %r13b
testb %r13b, %r13b
je 0x1619
leaq 0x2(%rsi), %rdi
jmp 0x161e
movq 0x8(%r14,%rax,8), %rdi
movzbl 0x1(%rsi), %eax
cmpl $0x67, %eax
jg 0x1640
cmpl $0x48, %eax
je 0x1657
cmpl $0x61, %eax
jne 0x167f
callq 0x1080
movsd %xmm0, 0x5b12(%rip)     # 0x7150
jmp 0x1652
cmpl $0x73, %eax
jne 0x166d
callq 0x1080
movsd %xmm0, 0x5b1e(%rip)     # 0x7170
movb $0x1, %r15b
jmp 0x1690
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x5b10(%rip)      # 0x7178
xorl %r15d, %r15d
jmp 0x1690
cmpl $0x68, %eax
je 0x18a7
cmpl $0x76, %eax
je 0x1886
xorl %r15d, %r15d
leaq 0x29f5(%rip), %rdi      # 0x407e
xorl %eax, %eax
callq 0x1948
testb %r13b, %r13b
sete %al
andb %r15b, %al
movzbl %al, %eax
addl %eax, %r12d
incl %r12d
cmpl %ebx, %r12d
jl 0x15fa
subl %r12d, %ebx
jne 0x16bc
movq 0x5921(%rip), %rax      # 0x6fd8
movq (%rax), %rbx
jmp 0x16e0
cmpl $0x2, %ebx
je 0x16ec
cmpl $0x1, %ebx
jne 0x1930
movslq %r12d, %rax
movq (%r14,%rax,8), %rdi
leaq 0x2ad8(%rip), %rsi      # 0x41b0
callq 0x19e2
movq %rax, %rbx
movq 0x58e9(%rip), %rax      # 0x6fd0
movq (%rax), %r14
jmp 0x1716
movslq %r12d, %rbx
movq (%r14,%rbx,8), %rdi
leaq 0x2ab6(%rip), %rsi      # 0x41b0
callq 0x19e2
movq 0x8(%r14,%rbx,8), %rdi
movq %rax, %rbx
leaq 0x2907(%rip), %rsi      # 0x4015
callq 0x19e2
movq %rax, %r14
callq 0x1c53
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x2079
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%r15), %xmm0
mulsd 0x5a34(%rip), %xmm0     # 0x7170
cvttsd2si %xmm0, %r12d
movsd 0x5a2f(%rip), %xmm0     # 0x7178
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movq 0x59e8(%rip), %r8       # 0x7140
movl %r12d, -0x2c(%rbp)
jne 0x1760
jnp 0x1783
leaq 0x28b9(%rip), %rdx      # 0x4020
leaq -0x430(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r8, %rcx
xorl %eax, %eax
callq 0x10c0
subl %r12d, 0xc(%r15)
jmp 0x17a0
leaq 0x288d(%rip), %rdx      # 0x4017
leaq -0x430(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
movl %r12d, %ecx
xorl %eax, %eax
callq 0x10c0
xorl %r13d, %r13d
leaq -0x430(%rbp), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x2b14
movq %rbx, %rdi
callq 0x1170
testl %eax, %eax
jne 0x1839
xorl %r13d, %r13d
movq %rbx, %r12
cmpl $0x0, (%r15)
jle 0x1827
xorl %ebx, %ebx
movl 0x8(%r15), %edx
movq %r12, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x257c
movsd 0x598e(%rip), %xmm0     # 0x7178
ucomisd 0x2816(%rip), %xmm0     # 0x4008
jne 0x17f6
jnp 0x17fc
cmpl -0x2c(%rbp), %r13d
jl 0x1820
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x5945(%rip), %xmm0     # 0x7150
cvttsd2si %xmm0, %edx
movq %r14, %rdi
leaq 0x2b24(%rip), %rsi      # 0x433d
xorl %eax, %eax
callq 0x1150
incl %ebx
cmpl (%r15), %ebx
jl 0x17d1
incl %r13d
movq %r12, %rbx
movq %r12, %rdi
callq 0x1170
testl %eax, %eax
je 0x17c6
movl 0xc(%r15), %ecx
leal 0x1(%rcx), %eax
cmpl %eax, %r13d
jne 0x1869
movq %rbx, %rdi
callq 0x1090
movq %r14, %rdi
callq 0x1090
xorl %eax, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5788(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x27b5(%rip), %rsi      # 0x402f
movl %r13d, %edx
xorl %eax, %eax
callq 0x1150
jmp 0x1845
movq 0x58b3(%rip), %rsi      # 0x7140
movq 0x58b4(%rip), %rdx      # 0x7148
leaq 0x27bc(%rip), %rdi      # 0x4057
xorl %eax, %eax
callq 0x10b0
jmp 0x1929
leaq 0x2823(%rip), %rdi      # 0x40d1
callq 0x1070
leaq 0x2825(%rip), %rdi      # 0x40df
callq 0x1070
leaq 0x283c(%rip), %rdi      # 0x4102
callq 0x1070
movsd 0x589d(%rip), %xmm0     # 0x7170
leaq 0x278c(%rip), %rdi      # 0x4066
movb $0x1, %al
callq 0x10b0
leaq 0x2841(%rip), %rdi      # 0x4129
callq 0x1070
leaq 0x2852(%rip), %rdi      # 0x4146
callq 0x1070
leaq 0x2879(%rip), %rdi      # 0x4179
callq 0x1070
leaq 0x28a6(%rip), %rdi      # 0x41b2
callq 0x1070
leaq 0x28b2(%rip), %rdi      # 0x41ca
callq 0x1070
leaq 0x28da(%rip), %rdi      # 0x41fe
callq 0x1070
xorl %edi, %edi
callq 0x1210
leaq 0x2761(%rip), %rdi      # 0x4098
callq 0x1070
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1210
nop