// File: /workspace/github_c_makefile_star2_O0/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
subq $0x450, %rsp            # imm = 0x450
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x1610
movl %eax, -0x14(%rbp)
movl -0x8(%rbp), %eax
subl -0x14(%rbp), %eax
cmpl $0x0, %eax
jne 0x1381
movq 0x6c77(%rip), %rax      # 0x7fd8
movq (%rax), %rax
movq %rax, -0x438(%rbp)
movq 0x6c5e(%rip), %rax      # 0x7fd0
movq (%rax), %rax
movq %rax, -0x440(%rbp)
jmp 0x142a
movl -0x8(%rbp), %eax
subl -0x14(%rbp), %eax
cmpl $0x1, %eax
jne 0x13be
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x439c(%rip), %rsi      # 0x573b
callq 0x1990
movq %rax, -0x438(%rbp)
movq 0x6c1e(%rip), %rax      # 0x7fd0
movq (%rax), %rax
movq %rax, -0x440(%rbp)
jmp 0x1428
movl -0x8(%rbp), %eax
subl -0x14(%rbp), %eax
cmpl $0x2, %eax
jne 0x140e
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x435f(%rip), %rsi      # 0x573b
callq 0x1990
movq %rax, -0x438(%rbp)
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3cd6(%rip), %rsi      # 0x50d6
callq 0x1990
movq %rax, -0x440(%rbp)
jmp 0x1426
leaq 0x3cc3(%rip), %rdi      # 0x50d8
movb $0x0, %al
callq 0x1090
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x11e0
jmp 0x1428
jmp 0x142a
callq 0x1e70
movq %rax, -0x448(%rbp)
movq -0x438(%rbp), %rdi
movq -0x448(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x2370
movq -0x448(%rbp), %rax
cvtsi2sdl 0x4(%rax), %xmm0
mulsd 0x6cef(%rip), %xmm0     # 0x8150
cvttsd2si %xmm0, %eax
movl %eax, -0x24(%rbp)
movsd 0x6ce8(%rip), %xmm0     # 0x8158
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x147d
jp 0x147d
jmp 0x14b2
leaq -0x430(%rbp), %rdi
movq 0x6c95(%rip), %rcx      # 0x8120
movl $0x400, %esi            # imm = 0x400
leaq 0x3c84(%rip), %rdx      # 0x511b
movb $0x0, %al
callq 0x10a0
movl -0x24(%rbp), %edx
movq -0x448(%rbp), %rax
movl 0xc(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0xc(%rax)
jmp 0x14d6
leaq -0x430(%rbp), %rdi
movl -0x24(%rbp), %ecx
movq 0x6c5d(%rip), %r8       # 0x8120
movl $0x400, %esi            # imm = 0x400
leaq 0x3c43(%rip), %rdx      # 0x5112
movb $0x0, %al
callq 0x10a0
movq -0x440(%rbp), %rdi
movq -0x448(%rbp), %rsi
leaq -0x430(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x3310
movl $0x0, -0x18(%rbp)
movq -0x438(%rbp), %rdi
callq 0x1140
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1518
jmp 0x15b4
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x448(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x15a4
movq -0x438(%rbp), %rdi
movq -0x440(%rbp), %rsi
movq -0x448(%rbp), %rax
movl 0x8(%rax), %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2aa0
movl %eax, -0x20(%rbp)
movsd 0x6bff(%rip), %xmm0     # 0x8158
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1566
jp 0x1566
jmp 0x156e
movl -0x18(%rbp), %eax
cmpl -0x24(%rbp), %eax
jl 0x1594
movq -0x440(%rbp), %rdi
cvtsi2sdl -0x20(%rbp), %xmm0
mulsd 0x6bae(%rip), %xmm0     # 0x8130
cvttsd2si %xmm0, %edx
leaq 0x3e48(%rip), %rsi      # 0x53d5
movb $0x0, %al
callq 0x1120
jmp 0x1596
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x151f
jmp 0x15a6
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x14fb
movl -0x18(%rbp), %eax
movq -0x448(%rbp), %rcx
movl 0xc(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
je 0x15ed
movq 0x6a29(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
movl -0x18(%rbp), %edx
movq -0x448(%rbp), %rax
movl 0xc(%rax), %ecx
leaq 0x3b44(%rip), %rsi      # 0x512a
movb $0x0, %al
callq 0x1120
movq -0x438(%rbp), %rdi
callq 0x1070
movq -0x440(%rbp), %rdi
callq 0x1070
xorl %eax, %eax
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq