// File: /workspace/github_c_makefile_star2_O1/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 0x167b
movl $0x1, %r12d
movslq %r12d, %rax
movq (%r14,%rax,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x167b
movb 0x2(%rsi), %r13b
testb %r13b, %r13b
je 0x15e9
leaq 0x2(%rsi), %rdi
jmp 0x15ee
movq 0x8(%r14,%rax,8), %rdi
movzbl 0x1(%rsi), %eax
cmpl $0x67, %eax
jg 0x1610
cmpl $0x48, %eax
je 0x1627
cmpl $0x61, %eax
jne 0x164f
callq 0x1080
movsd %xmm0, 0x5b42(%rip)     # 0x7150
jmp 0x1622
cmpl $0x73, %eax
jne 0x163d
callq 0x1080
movsd %xmm0, 0x5b4e(%rip)     # 0x7170
movb $0x1, %r15b
jmp 0x1660
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x5b40(%rip)      # 0x7178
xorl %r15d, %r15d
jmp 0x1660
cmpl $0x68, %eax
je 0x1877
cmpl $0x76, %eax
je 0x1856
xorl %r15d, %r15d
leaq 0x2a25(%rip), %rdi      # 0x407e
xorl %eax, %eax
callq 0x1918
testb %r13b, %r13b
sete %al
andb %r15b, %al
movzbl %al, %eax
addl %eax, %r12d
incl %r12d
cmpl %ebx, %r12d
jl 0x15ca
subl %r12d, %ebx
jne 0x168c
movq 0x5951(%rip), %rax      # 0x6fd8
movq (%rax), %rbx
jmp 0x16b0
cmpl $0x2, %ebx
je 0x16bc
cmpl $0x1, %ebx
jne 0x1900
movslq %r12d, %rax
movq (%r14,%rax,8), %rdi
leaq 0x2b08(%rip), %rsi      # 0x41b0
callq 0x19b2
movq %rax, %rbx
movq 0x5919(%rip), %rax      # 0x6fd0
movq (%rax), %r14
jmp 0x16e6
movslq %r12d, %rbx
movq (%r14,%rbx,8), %rdi
leaq 0x2ae6(%rip), %rsi      # 0x41b0
callq 0x19b2
movq 0x8(%r14,%rbx,8), %rdi
movq %rax, %rbx
leaq 0x2937(%rip), %rsi      # 0x4015
callq 0x19b2
movq %rax, %r14
callq 0x1c2f
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x203c
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%r15), %xmm0
mulsd 0x5a64(%rip), %xmm0     # 0x7170
cvttsd2si %xmm0, %r12d
movsd 0x5a5f(%rip), %xmm0     # 0x7178
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movq 0x5a18(%rip), %r8       # 0x7140
movl %r12d, -0x2c(%rbp)
jne 0x1730
jnp 0x1753
leaq 0x28e9(%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 0x1770
leaq 0x28bd(%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 0x2a8d
movq %rbx, %rdi
callq 0x1170
testl %eax, %eax
jne 0x1809
xorl %r13d, %r13d
movq %rbx, %r12
cmpl $0x0, (%r15)
jle 0x17f7
xorl %ebx, %ebx
movl 0x8(%r15), %edx
movq %r12, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x2528
movsd 0x59be(%rip), %xmm0     # 0x7178
ucomisd 0x2846(%rip), %xmm0     # 0x4008
jne 0x17c6
jnp 0x17cc
cmpl -0x2c(%rbp), %r13d
jl 0x17f0
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x5975(%rip), %xmm0     # 0x7150
cvttsd2si %xmm0, %edx
movq %r14, %rdi
leaq 0x2b54(%rip), %rsi      # 0x433d
xorl %eax, %eax
callq 0x1150
incl %ebx
cmpl (%r15), %ebx
jl 0x17a1
incl %r13d
movq %r12, %rbx
movq %r12, %rdi
callq 0x1170
testl %eax, %eax
je 0x1796
movl 0xc(%r15), %ecx
leal 0x1(%rcx), %eax
cmpl %eax, %r13d
jne 0x1839
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 0x57b8(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x27e5(%rip), %rsi      # 0x402f
movl %r13d, %edx
xorl %eax, %eax
callq 0x1150
jmp 0x1815
movq 0x58e3(%rip), %rsi      # 0x7140
movq 0x58e4(%rip), %rdx      # 0x7148
leaq 0x27ec(%rip), %rdi      # 0x4057
xorl %eax, %eax
callq 0x10b0
jmp 0x18f9
leaq 0x2853(%rip), %rdi      # 0x40d1
callq 0x1070
leaq 0x2855(%rip), %rdi      # 0x40df
callq 0x1070
leaq 0x286c(%rip), %rdi      # 0x4102
callq 0x1070
movsd 0x58cd(%rip), %xmm0     # 0x7170
leaq 0x27bc(%rip), %rdi      # 0x4066
movb $0x1, %al
callq 0x10b0
leaq 0x2871(%rip), %rdi      # 0x4129
callq 0x1070
leaq 0x2882(%rip), %rdi      # 0x4146
callq 0x1070
leaq 0x28a9(%rip), %rdi      # 0x4179
callq 0x1070
leaq 0x28d6(%rip), %rdi      # 0x41b2
callq 0x1070
leaq 0x28e2(%rip), %rdi      # 0x41ca
callq 0x1070
leaq 0x290a(%rip), %rdi      # 0x41fe
callq 0x1070
xorl %edi, %edi
callq 0x1210
leaq 0x2791(%rip), %rdi      # 0x4098
callq 0x1070
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1210
nop