// File: /workspace/github_cpp_makefile_star2_O3/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
jle 0x1647
movq %rsi, %rbx
movl %edi, %ebp
xorl %r13d, %r13d
movl %edi, 0xc(%rsp)
movslq %r13d, %r14
movq (%rbx,%r14,8), %rax
cmpb $0x2d, (%rax)
jne 0x163b
cmpb $0x69, 0x1(%rax)
jne 0x150d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x1070
movq %rax, %r15
movl $0x8, %edx
movl $0x1, %ecx
leaq 0xb50(%rip), %rdi       # 0x2019
movl %r15d, %esi
xorl %eax, %eax
callq 0x1030
movslq %r15d, %r12
movq %r12, %rdi
callq 0x1140
movq %rax, 0x2c63(%rip)      # 0x4148
testl %r12d, %r12d
jle 0x150d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %eax, %eax
movq 0x8(%rbx,%r14,8), %rcx
movb (%rcx,%rax), %cl
movq 0x2c46(%rip), %rdx      # 0x4148
movb %cl, (%rdx,%rax)
incq %rax
cmpq %rax, %r15
jne 0x14f3
movq (%rbx,%r14,8), %rax
cmpb $0x6f, 0x1(%rax)
jne 0x155e
movq 0x8(%rbx,%r14,8), %rdi
callq 0x1070
movq %rax, %r15
movslq %r15d, %r12
movq %r12, %rdi
callq 0x1140
movq %rax, 0x2c1a(%rip)      # 0x4150
testl %r12d, %r12d
jle 0x155e
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %eax, %eax
movq 0x8(%rbx,%r14,8), %rcx
movb (%rcx,%rax), %cl
movq 0x2bfd(%rip), %rdx      # 0x4150
movb %cl, (%rdx,%rax)
incq %rax
cmpq %rax, %r15
jne 0x1544
movq (%rbx,%r14,8), %rax
movq %rax, 0x10(%rsp)
movb 0x1(%rax), %al
cmpb $0x72, %al
jne 0x15cf
movl $0x0, 0x2ba0(%rip)      # 0x4118
movq 0x8(%rbx,%r14,8), %r15
cmpb $0x0, (%r15)
je 0x15c3
xorl %ebp, %ebp
xorl %r12d, %r12d
movb (%r15,%rbp), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0x15c3
addl %r12d, %r12d
leal (%r12,%r12,4), %eax
movl %eax, 0x2b79(%rip)      # 0x4118
movsbl (%r15,%rbp), %ecx
leal (%rcx,%rax), %r12d
addl $-0x30, %r12d
movl %r12d, 0x2b65(%rip)     # 0x4118
incq %rbp
movq %r15, %rdi
callq 0x1070
cmpq %rbp, %rax
ja 0x1588
movq 0x10(%rsp), %rax
movb 0x1(%rax), %al
movl 0xc(%rsp), %ebp
cmpb $0x6c, %al
jne 0x1629
movl $0x0, 0x2b37(%rip)      # 0x4114
movq 0x8(%rbx,%r14,8), %r15
cmpb $0x0, (%r15)
je 0x1629
xorl %r14d, %r14d
xorl %r12d, %r12d
movb (%r15,%r14), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0x1629
addl %r12d, %r12d
leal (%r12,%r12,4), %eax
movl %eax, 0x2b0f(%rip)      # 0x4114
movsbl (%r15,%r14), %ecx
leal (%rcx,%rax), %r12d
addl $-0x30, %r12d
movl %r12d, 0x2afb(%rip)     # 0x4114
incq %r14
movq %r15, %rdi
callq 0x1070
cmpq %r14, %rax
ja 0x15ee
movq 0x10(%rsp), %rax
cmpb $0x68, 0x1(%rax)
je 0x1776
incl %r13d
incl %r13d
cmpl %ebp, %r13d
jl 0x1495
cmpq $0x0, 0x2af9(%rip)      # 0x4148
je 0x1776
cmpq $0x0, 0x2af3(%rip)      # 0x4150
jne 0x16a6
leaq 0x2a9a(%rip), %rbx      # 0x4100
movq %rbx, %rdi
callq 0x1070
movq %rax, %r14
movslq %r14d, %r15
movq %r15, %rdi
callq 0x1140
movq %rax, 0x2acd(%rip)      # 0x4150
testl %r15d, %r15d
jle 0x16a6
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %eax, %eax
movb (%rax,%rbx), %cl
movq 0x2ab5(%rip), %rdx      # 0x4150
movb %cl, (%rdx,%rax)
incq %rax
cmpq %rax, %r14
jne 0x1691
cmpl $-0x1, 0x2a67(%rip)     # 0x4114
jne 0x16b9
movl $0x64, 0x2a5b(%rip)     # 0x4114
cmpl $-0x1, 0x2a58(%rip)     # 0x4118
jne 0x16cc
movl $0xa, 0x2a4c(%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 0x16dc
movq 0x2a5a(%rip), %rdi      # 0x4150
leaq 0x929(%rip), %rsi       # 0x2026
callq 0x1110
movq %rax, %rbx
movl 0x2a0d(%rip), %ecx      # 0x4118
testl %ecx, %ecx
jle 0x1757
leaq 0x2a4a(%rip), %r14      # 0x4160
movl 0x29f8(%rip), %eax      # 0x4114
xorl %r15d, %r15d
testl %eax, %eax
jle 0x1748
xorl %r12d, %r12d
movsbl (%r14,%r12), %edi
movq %rbx, %rsi
callq 0x1130
incq %r12
movslq 0x29d7(%rip), %rax      # 0x4114
cmpq %rax, %r12
jl 0x1726
movl 0x29d0(%rip), %ecx      # 0x4118
incq %r15
movslq %ecx, %rdx
addq $0x64, %r14
cmpq %rdx, %r15
jl 0x171f
movq %rbx, %rdi
callq 0x10e0
movq 0x29ea(%rip), %rsi      # 0x4150
leaq 0x8bb(%rip), %rdi       # 0x2028
xorl %eax, %eax
callq 0x1030
jmp 0x177b
callq 0x13d6
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq