// File: /workspace/github_cpp_makefile_star2_O1/TooruAkagi[P]GCIS_Index/genpattern.cpp
// Function: main
int main(int argc, char *argv[])
{
     for(int i = 0;i<argc;i++){
    //printf("[%d : %s]",i,argv[i]);
    if('-'==argv[i][0]){ //符号
        if('i'==argv[i][1]){ //input
            int k = strlen(argv[i+1]);
            printf("<<%d,%d,%d>>",k,sizeof(argv[i+1]),sizeof(argv[i+1][0]));
            fname = (char*)malloc(k);
            for(int k2=0;k2<k;k2++){fname[k2]=argv[i+1][k2];}
        }
        if('o'==argv[i][1]){ //output
            int k = strlen(argv[i+1]);
            wname = (char*)malloc(k);
            for(int k2=0;k2<k;k2++){wname[k2]=argv[i+1][k2];}
        }
        if('r'==argv[i][1]){ //mode
            querysuu=0;
            for(int k = 0;k<strlen(argv[i+1]);k++){
                if(10 > argv[i+1][k]-'0' && argv[i+1][k]-'0'>=0){
                querysuu *=10;
                querysuu += argv[i+1][k] - '0';
                }
                else{break;}
            }
        }
        if('l'==argv[i][1]){ //mode
            plength=0;
            for(int k = 0;k<strlen(argv[i+1]);k++){
                if(10 > argv[i+1][k]-'0' && argv[i+1][k]-'0'>=0){
                plength *=10;
                plength += argv[i+1][k] - '0';
                }
                else{break;}
            }
        }
        if('h'==argv[i][1]){shelp();return 0;} //help
        i++;
        continue;
    }
  }
  if(fname==NULL){shelp();return 0;}
  if(wname==NULL){
    int k = strlen(defaultwname);
    wname = (char*)malloc(k);
    for(int k2=0;k2<k;k2++){wname[k2]=defaultwname[k2];}
  }
  if(plength==-1){plength=MLONG;}
  if(querysuu==-1){querysuu=MREP;}

    srand((unsigned int)time(NULL));
    for(int i = 0;i<MREP;i++){
        int t = qrmload(MLONG,i);
        if(t!=0){i--;} //continue
    }
    FILE *fp;
    fp = fopen(wname, "w");
    for(int jo = 0;jo<querysuu;jo++){for(int i = 0;i<plength;i++){fprintf(fp,"%c",ptlist[jo][i]);}}
    fclose(fp);
    printf("\npattern has been saved in %s\n",wname);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testl %edi, %edi
setg %cl
jle 0x165c
movq %rsi, %rbx
xorl %r14d, %r14d
movl %edi, 0xc(%rsp)
movslq %r14d, %rbp
movq (%rbx,%rbp,8), %rax
cmpb $0x2d, (%rax)
jne 0x163b
movb %cl, 0xb(%rsp)
cmpb $0x69, 0x1(%rax)
jne 0x1512
movq 0x8(%rbx,%rbp,8), %rdi
callq 0x1070
movq %rax, %r15
movl $0x8, %edx
movl $0x1, %ecx
leaq 0xb4b(%rip), %rdi       # 0x2019
movl %r15d, %esi
xorl %eax, %eax
callq 0x1030
movslq %r15d, %r12
movq %r12, %rdi
callq 0x1140
movq %rax, 0x2c5e(%rip)      # 0x4148
testl %r12d, %r12d
jle 0x1512
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %eax, %eax
movq 0x8(%rbx,%rbp,8), %rcx
movb (%rcx,%rax), %cl
movq 0x2c41(%rip), %rdx      # 0x4148
movb %cl, (%rdx,%rax)
incq %rax
cmpq %rax, %r15
jne 0x14f8
movq (%rbx,%rbp,8), %rax
cmpb $0x6f, 0x1(%rax)
jne 0x1563
movq 0x8(%rbx,%rbp,8), %rdi
callq 0x1070
movq %rax, %r15
movslq %r15d, %r12
movq %r12, %rdi
callq 0x1140
movq %rax, 0x2c15(%rip)      # 0x4150
testl %r12d, %r12d
jle 0x1563
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %eax, %eax
movq 0x8(%rbx,%rbp,8), %rcx
movb (%rcx,%rax), %cl
movq 0x2bf8(%rip), %rdx      # 0x4150
movb %cl, (%rdx,%rax)
incq %rax
cmpq %rax, %r15
jne 0x1549
movq (%rbx,%rbp,8), %rax
movq %rax, 0x10(%rsp)
cmpb $0x72, 0x1(%rax)
jne 0x15c8
movl $0x0, 0x2b9c(%rip)      # 0x4118
movq 0x8(%rbx,%rbp,8), %r15
cmpb $0x0, (%r15)
je 0x15c8
xorl %r13d, %r13d
xorl %r12d, %r12d
movb (%r15,%r13), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0x15c8
addl %r12d, %r12d
leal (%r12,%r12,4), %eax
movl %eax, 0x2b74(%rip)      # 0x4118
movsbl (%r15,%r13), %ecx
leal (%rcx,%rax), %r12d
addl $-0x30, %r12d
movl %r12d, 0x2b60(%rip)     # 0x4118
incq %r13
movq %r15, %rdi
callq 0x1070
cmpq %r13, %rax
ja 0x158d
movq 0x10(%rsp), %rax
cmpb $0x6c, 0x1(%rax)
jne 0x1629
movl $0x0, 0x2b37(%rip)      # 0x4114
movq 0x8(%rbx,%rbp,8), %r15
cmpb $0x0, (%r15)
je 0x1629
xorl %r13d, %r13d
xorl %r12d, %r12d
movb (%r15,%r13), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0x1629
addl %r12d, %r12d
leal (%r12,%r12,4), %eax
movl %eax, 0x2b0f(%rip)      # 0x4114
movsbl (%r15,%r13), %ecx
leal (%rcx,%rax), %r12d
addl $-0x30, %r12d
movl %r12d, 0x2afb(%rip)     # 0x4114
incq %r13
movq %r15, %rdi
callq 0x1070
cmpq %r13, %rax
ja 0x15ee
movq 0x10(%rsp), %rax
cmpb $0x68, 0x1(%rax)
je 0x164c
incl %r14d
movl 0xc(%rsp), %edi
incl %r14d
cmpl %edi, %r14d
setl %cl
jl 0x1496
jmp 0x165c
callq 0x13d6
testb $0x1, 0xb(%rsp)
jne 0x178c
cmpq $0x0, 0x2ae4(%rip)      # 0x4148
je 0x1787
cmpq $0x0, 0x2ade(%rip)      # 0x4150
jne 0x16bb
leaq 0x2a85(%rip), %rbx      # 0x4100
movq %rbx, %rdi
callq 0x1070
movq %rax, %r14
movslq %r14d, %r15
movq %r15, %rdi
callq 0x1140
movq %rax, 0x2ab8(%rip)      # 0x4150
testl %r15d, %r15d
jle 0x16bb
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %eax, %eax
movb (%rax,%rbx), %cl
movq 0x2aa0(%rip), %rdx      # 0x4150
movb %cl, (%rdx,%rax)
incq %rax
cmpq %rax, %r14
jne 0x16a6
cmpl $-0x1, 0x2a52(%rip)     # 0x4114
jne 0x16ce
movl $0x64, 0x2a46(%rip)     # 0x4114
cmpl $-0x1, 0x2a43(%rip)     # 0x4118
jne 0x16e1
movl $0xa, 0x2a37(%rip)      # 0x4118
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x10c0
movl %eax, %edi
callq 0x10d0
movl $0x64, %edi
movl %ebx, %esi
callq 0x12ec
incl %ebx
cmpl $0xa, %ebx
jne 0x16f1
movq 0x2a45(%rip), %rdi      # 0x4150
leaq 0x914(%rip), %rsi       # 0x2026
callq 0x1110
movq %rax, %rbx
cmpl $0x0, 0x29f7(%rip)      # 0x4118
jle 0x1768
leaq 0x2a36(%rip), %r14      # 0x4160
xorl %r15d, %r15d
cmpl $0x0, 0x29e0(%rip)      # 0x4114
jle 0x1755
xorl %r12d, %r12d
movsbl (%r14,%r12), %edi
movq %rbx, %rsi
callq 0x1130
incq %r12
movslq 0x29c4(%rip), %rax      # 0x4114
cmpq %rax, %r12
jl 0x1739
incq %r15
movslq 0x29b9(%rip), %rax      # 0x4118
addq $0x64, %r14
cmpq %rax, %r15
jl 0x172d
movq %rbx, %rdi
callq 0x10e0
movq 0x29d9(%rip), %rsi      # 0x4150
leaq 0x8aa(%rip), %rdi       # 0x2028
xorl %eax, %eax
callq 0x1030
jmp 0x178c
callq 0x13d6
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop