// File: /workspace/github_c_makefile_star2_O3/pipde[P]deos-songlib/utils/rra/rrastrip.c
// Function: main
int main( int argc, char* argv[] ){
        int i;
        int argIndex = processOptions( argc, argv );
        FILE *in, *out;
        char* inFile;
        char buffer[4096];
        /*for( i = argIndex; i < argc; i++){
                in = OpenFile(argv[i], "r");
                sprintf(buffer, "%s%s", "stripped_", argv[i]);
                out = OpenFile(buffer, "w");
                rraStrip( argv[i], in, out );
        }*/
        if( argc-argIndex == 0){
                in = stdin;
                out = stdout;
                inFile = "stdin";
        }else 
        if(argc - argIndex == 1 && !inPlace){
                in = OpenFile(argv[argIndex],"r");
                out = stdout;
                inFile = argv[argIndex];
        }else if(argc - argIndex == 2 && !inPlace){
                in = OpenFile(argv[argIndex],"r");
                out = OpenFile(argv[argIndex+1],"w");
                inFile = argv[argIndex];
        }else if( argc - argIndex >= 1 && inPlace){
                for( i = argIndex; i < argc; i++){
                        sprintf(buffer,"mv %s %s%s",argv[i], argv[i],".temp");
                        system(buffer);
                        sprintf(buffer,"%s%s",argv[i],".temp");
                        in = OpenFile(buffer,"r");
                        out = OpenFile(argv[i],"w");
                        inFile = argv[i];
                        rraStrip( inFile, in, out );
                        if( !badFile ){
                                sprintf(buffer,"rm %s%s",argv[i],".temp");
                                system(buffer);
                        }else{
                                badFile = 0;
                                sprintf(buffer,"mv %s%s %s",argv[i],".temp", argv[i]);
                                printf("Running command: %s\n",buffer);
                                system(buffer);
                        }
                }
                return 0;
        }else{
                printf("usage: rrastrip [-aN ] [ -i ] [<input rra>] [<output rra>]\n");
                exit(0);
        }
        rraStrip( inFile, in, out );
        return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rsi, %rbx
movl %edi, %r14d
movl $0x1, %r12d
cmpl $0x2, %edi
jl 0x1876
movl $0x1, %r12d
movslq %r12d, %rax
movq (%rbx,%rax,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x1876
movb 0x2(%rsi), %r13b
testb %r13b, %r13b
je 0x1813
leaq 0x2(%rsi), %rdi
jmp 0x1818
movq 0x8(%rbx,%rax,8), %rdi
movzbl 0x1(%rsi), %eax
cmpl $0x61, %eax
je 0x1851
cmpl $0x69, %eax
je 0x1842
cmpl $0x76, %eax
je 0x1a41
xorl %r15d, %r15d
leaq 0x28f9(%rip), %rdi      # 0x4132
xorl %eax, %eax
callq 0x1a74
jmp 0x185f
movl $0x1, 0x5928(%rip)      # 0x7174
xorl %r15d, %r15d
jmp 0x185f
callq 0x1200
movl %eax, 0x58fc(%rip)      # 0x7158
movb $0x1, %r15b
testb %r13b, %r13b
sete %al
andb %r15b, %al
movzbl %al, %eax
addl %eax, %r12d
incl %r12d
cmpl %r14d, %r12d
jl 0x17f8
movl %r14d, %eax
subl %r12d, %eax
jne 0x189e
movq 0x5753(%rip), %rax      # 0x6fd8
movq (%rax), %r14
movq 0x5741(%rip), %rax      # 0x6fd0
movq (%rax), %rdx
leaq 0x2849(%rip), %rdi      # 0x40e2
jmp 0x1a25
movl %eax, %edx
xorl $0x1, %edx
movl 0x58cb(%rip), %ecx      # 0x7174
orl %ecx, %edx
je 0x19d5
movl %eax, %edx
xorl $0x2, %edx
orl %ecx, %edx
je 0x19f7
testl %eax, %eax
jle 0x1a64
testl %ecx, %ecx
je 0x1a64
cmpl %r12d, %r14d
jle 0x1a2d
movslq %r12d, %rcx
leaq (%rbx,%rcx,8), %r13
movl %eax, %eax
movq %rax, -0x30(%rbp)
leaq 0x280a(%rip), %r14      # 0x40f5
leaq -0x1030(%rbp), %r15
xorl %ebx, %ebx
movq (%r13,%rbx,8), %rcx
movq %r15, %rdi
leaq 0x27e7(%rip), %rsi      # 0x40ea
movq %rcx, %rdx
movq %r14, %r8
xorl %eax, %eax
callq 0x1210
movq %r15, %rdi
callq 0x10b0
movq (%r13,%rbx,8), %rdx
movq %r15, %rdi
leaq 0x27d7(%rip), %rsi      # 0x40fe
movq %r14, %rcx
xorl %eax, %eax
callq 0x1210
movq %r15, %rdi
leaq 0x2cdf(%rip), %rsi      # 0x461a
callq 0x1b0e
movq %rax, %r12
movq (%r13,%rbx,8), %rdi
leaq 0x2799(%rip), %rsi      # 0x40e8
callq 0x1b0e
movq (%r13,%rbx,8), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x15dc
cmpl $0x0, 0x580d(%rip)      # 0x7178
je 0x19a6
movl $0x0, 0x5801(%rip)      # 0x7178
movq (%r13,%rbx,8), %rdx
movq %r15, %rdi
leaq 0x277d(%rip), %rsi      # 0x4103
movq %r14, %rcx
movq %rdx, %r8
xorl %eax, %eax
callq 0x1210
leaq 0x2774(%rip), %rdi      # 0x410e
movq %r15, %rsi
xorl %eax, %eax
callq 0x10c0
jmp 0x19bf
movq (%r13,%rbx,8), %rdx
movq %r15, %rdi
leaq 0x2746(%rip), %rsi      # 0x40fb
movq %r14, %rcx
xorl %eax, %eax
callq 0x1210
movq %r15, %rdi
callq 0x10b0
incq %rbx
cmpl %ebx, -0x30(%rbp)
jne 0x18f4
jmp 0x1a2d
movslq %r12d, %r15
movq (%rbx,%r15,8), %rdi
leaq 0x2c37(%rip), %rsi      # 0x461a
callq 0x1b0e
movq %rax, %r14
movq 0x55de(%rip), %rax      # 0x6fd0
movq (%rax), %rdx
jmp 0x1a21
movslq %r12d, %r15
movq (%rbx,%r15,8), %rdi
leaq 0x2c15(%rip), %rsi      # 0x461a
callq 0x1b0e
movq %rax, %r14
movq 0x8(%rbx,%r15,8), %rdi
leaq 0x26cf(%rip), %rsi      # 0x40e8
callq 0x1b0e
movq %rax, %rdx
movq (%rbx,%r15,8), %rdi
movq %r14, %rsi
callq 0x15dc
xorl %eax, %eax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5700(%rip), %rsi      # 0x7148
movq 0x5701(%rip), %rdx      # 0x7150
leaq 0x26cd(%rip), %rdi      # 0x4123
xorl %eax, %eax
callq 0x10c0
xorl %edi, %edi
callq 0x1220
leaq 0x26e1(%rip), %rdi      # 0x414c
callq 0x1070
jmp 0x1a5d
nop