// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %r12
movslq %r12d, %r15
cmpl %r12d, %ebx
jle 0x142a
movq (%r14,%r15,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x142a
movb 0x2(%rsi), %r13b
testb %r13b, %r13b
je 0x13a1
leaq 0x2(%rsi), %rdi
jmp 0x13a6
movq 0x8(%r14,%r15,8), %rdi
movzbl 0x1(%rsi), %eax
cmpl $0x48, %eax
je 0x13ed
cmpl $0x61, %eax
je 0x13de
cmpl $0x73, %eax
je 0x1403
cmpl $0x68, %eax
je 0x15e8
cmpl $0x76, %eax
je 0x166c
xorl %r15d, %r15d
leaq 0x2ca9(%rip), %rdi      # 0x407e
xorl %eax, %eax
callq 0x16a4
jmp 0x1413
callq 0x1080
movsd %xmm0, 0x5d65(%rip)     # 0x7150
jmp 0x1410
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x5d7a(%rip)      # 0x7178
xorl %r15d, %r15d
jmp 0x1413
callq 0x1080
movsd %xmm0, 0x5d60(%rip)     # 0x7170
movb $0x1, %r15b
testb %r13b, %r13b
sete %al
andb %r15b, %al
movzbl %al, %eax
addl %eax, %r12d
incl %r12d
jmp 0x1379
subl %r12d, %ebx
jne 0x143b
movq 0x5ba2(%rip), %rax      # 0x6fd8
movq (%rax), %rbx
jmp 0x145c
cmpl $0x2, %ebx
je 0x1468
cmpl $0x1, %ebx
jne 0x168f
movq (%r14,%r15,8), %rdi
leaq 0x2d5c(%rip), %rsi      # 0x41b0
callq 0x17d4
movq %rax, %rbx
movq 0x5b6d(%rip), %rax      # 0x6fd0
movq (%rax), %r14
jmp 0x148f
movq (%r14,%r15,8), %rdi
leaq 0x2d3d(%rip), %rsi      # 0x41b0
callq 0x17d4
movq %rax, %rbx
movq 0x8(%r14,%r15,8), %rdi
leaq 0x2b8e(%rip), %rsi      # 0x4015
callq 0x17d4
movq %rax, %r14
callq 0x1a30
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x1d95
cvtsi2sdl 0x4(%r15), %xmm0
mulsd 0x5cbe(%rip), %xmm0     # 0x7170
cvttsd2si %xmm0, %r12d
movsd 0x5cb9(%rip), %xmm0     # 0x7178
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movq 0x5c72(%rip), %r8       # 0x7140
movl %r12d, -0x2c(%rbp)
jne 0x14d6
jnp 0x14f9
leaq 0x2b43(%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 0x1516
leaq 0x2b17(%rip), %rdx      # 0x4017
leaq -0x430(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
movl %r12d, %ecx
xorl %eax, %eax
callq 0x10c0
leaq -0x430(%rbp), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x27a4
xorl %r13d, %r13d
movq %rbx, %rdi
callq 0x1170
testl %eax, %eax
jne 0x159b
movq %rbx, %r12
xorl %ebx, %ebx
cmpl (%r15), %ebx
jge 0x1593
movl 0x8(%r15), %edx
movq %r12, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x226a
movsd 0x5c1c(%rip), %xmm0     # 0x7178
ucomisd 0x2aa4(%rip), %xmm0     # 0x4008
jne 0x1568
jnp 0x156e
cmpl -0x2c(%rbp), %r13d
jl 0x158f
cvtsi2sd %eax, %xmm0
mulsd 0x5bd6(%rip), %xmm0     # 0x7150
cvttsd2si %xmm0, %edx
movq %r14, %rdi
leaq 0x2db5(%rip), %rsi      # 0x433d
xorl %eax, %eax
callq 0x1150
incl %ebx
jmp 0x153e
incl %r13d
movq %r12, %rbx
jmp 0x152d
movl 0xc(%r15), %ecx
leal 0x1(%rcx), %eax
cmpl %eax, %r13d
jne 0x15cb
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 0x5a26(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x2a53(%rip), %rsi      # 0x402f
movl %r13d, %edx
xorl %eax, %eax
callq 0x1150
jmp 0x15a7
leaq 0x2ae2(%rip), %rdi      # 0x40d1
callq 0x1070
leaq 0x2ae4(%rip), %rdi      # 0x40df
callq 0x1070
leaq 0x2afb(%rip), %rdi      # 0x4102
callq 0x1070
movsd 0x5b5c(%rip), %xmm0     # 0x7170
leaq 0x2a4b(%rip), %rdi      # 0x4066
movb $0x1, %al
callq 0x10b0
leaq 0x2b00(%rip), %rdi      # 0x4129
callq 0x1070
leaq 0x2b11(%rip), %rdi      # 0x4146
callq 0x1070
leaq 0x2b38(%rip), %rdi      # 0x4179
callq 0x1070
leaq 0x2b65(%rip), %rdi      # 0x41b2
callq 0x1070
leaq 0x2b71(%rip), %rdi      # 0x41ca
callq 0x1070
leaq 0x2b99(%rip), %rdi      # 0x41fe
callq 0x1070
jmp 0x1688
movq 0x5acd(%rip), %rsi      # 0x7140
movq 0x5ace(%rip), %rdx      # 0x7148
leaq 0x29d6(%rip), %rdi      # 0x4057
xorl %eax, %eax
callq 0x10b0
xorl %edi, %edi
callq 0x1210
leaq 0x2a02(%rip), %rdi      # 0x4098
callq 0x1070
pushq $-0x1
popq %rdi
callq 0x1210
nop