// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %rax
movq %rsi, %rbx
movl %edi, %r15d
xorl %eax, %eax
movl %edi, (%rsp)
cmpl %r15d, %eax
jge 0x161f
movslq %eax, %r12
movq (%rbx,%r12,8), %r14
cmpb $0x2d, (%r14)
jne 0x1618
movl %eax, 0x4(%rsp)
movb 0x1(%r14), %al
cmpb $0x69, %al
jne 0x1512
movq 0x8(%rbx,%r12,8), %rdi
callq 0x1070
movq %rax, %r13
leaq 0xb5b(%rip), %rdi       # 0x2019
movl %r13d, %esi
pushq $0x8
popq %rdx
pushq $0x1
popq %rcx
xorl %eax, %eax
callq 0x1030
movslq %r13d, %r13
movq %r13, %rdi
callq 0x1140
movq %rax, 0x2c68(%rip)      # 0x4148
testl %r13d, %r13d
movl $0x0, %eax
cmovlel %eax, %r13d
xorl %eax, %eax
cmpq %rax, %r13
je 0x150a
movq 0x8(%rbx,%r12,8), %rcx
movb (%rcx,%rax), %cl
movq 0x2c46(%rip), %rdx      # 0x4148
movb %cl, (%rdx,%rax)
incq %rax
jmp 0x14ee
movq (%rbx,%r12,8), %r14
movb 0x1(%r14), %al
cmpb $0x6f, %al
jne 0x1564
movq 0x8(%rbx,%r12,8), %rdi
callq 0x1070
movslq %eax, %r13
movq %r13, %rdi
callq 0x1140
movq %rax, 0x2c1e(%rip)      # 0x4150
testl %r13d, %r13d
movl $0x0, %eax
cmovlel %eax, %r13d
xorl %eax, %eax
cmpq %rax, %r13
je 0x155c
movq 0x8(%rbx,%r12,8), %rcx
movb (%rcx,%rax), %cl
movq 0x2bfc(%rip), %rdx      # 0x4150
movb %cl, (%rdx,%rax)
incq %rax
jmp 0x1540
movq (%rbx,%r12,8), %r14
movb 0x1(%r14), %al
cmpb $0x72, %al
jne 0x15bd
andl $0x0, 0x2ba9(%rip)      # 0x4118
movq 0x8(%rbx,%r12,8), %r13
xorl %ebp, %ebp
xorl %r15d, %r15d
movq %r13, %rdi
callq 0x1070
cmpq %rbp, %rax
jbe 0x15b5
movb (%r13,%rbp), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0x15b5
imull $0xa, %r15d, %eax
movl %eax, 0x2b7d(%rip)      # 0x4118
movsbl (%r13,%rbp), %ecx
leal (%rax,%rcx), %r15d
addl $-0x30, %r15d
movl %r15d, 0x2b68(%rip)     # 0x4118
incq %rbp
jmp 0x1579
movb 0x1(%r14), %al
movl (%rsp), %r15d
cmpb $0x6c, %al
jne 0x160e
andl $0x0, 0x2b4c(%rip)      # 0x4114
movq 0x8(%rbx,%r12,8), %r13
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %r13, %rdi
callq 0x1070
cmpq %r12, %rax
jbe 0x160a
movb (%r13,%r12), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0x160a
imull $0xa, %ebp, %eax
movl %eax, 0x2b21(%rip)      # 0x4114
movsbl (%r13,%r12), %ecx
leal (%rax,%rcx), %ebp
addl $-0x30, %ebp
movl %ebp, 0x2b0f(%rip)      # 0x4114
incq %r12
jmp 0x15d2
movb 0x1(%r14), %al
cmpb $0x68, %al
je 0x1682
movl 0x4(%rsp), %eax
incl %eax
incl %eax
jmp 0x1484
cmpq $0x0, 0x2b21(%rip)      # 0x4148
je 0x1682
cmpq $0x0, 0x2b1f(%rip)      # 0x4150
je 0x170d
cmpl $-0x1, 0x2ad6(%rip)     # 0x4114
jne 0x164a
movl $0x64, 0x2aca(%rip)     # 0x4114
cmpl $-0x1, 0x2ac7(%rip)     # 0x4118
jne 0x165d
movl $0xa, 0x2abb(%rip)      # 0x4118
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x10d0
movl %eax, %edi
callq 0x10e0
pushq $0x64
popq %rbp
cmpl $0xa, %ebx
je 0x1689
movl %ebp, %edi
movl %ebx, %esi
callq 0x12ec
incl %ebx
jmp 0x1670
callq 0x13d4
jmp 0x16fc
movq 0x2ac0(%rip), %rdi      # 0x4150
leaq 0x98f(%rip), %rsi       # 0x2026
callq 0x1110
movq %rax, %rbx
leaq 0x2aba(%rip), %r14      # 0x4160
xorl %r15d, %r15d
movslq 0x2a68(%rip), %rax      # 0x4118
cmpq %rax, %r15
jge 0x16df
xorl %r12d, %r12d
movslq 0x2a55(%rip), %rax      # 0x4114
cmpq %rax, %r12
jge 0x16d6
movsbl (%r14,%r12), %edi
movq %rbx, %rsi
callq 0x1130
incq %r12
jmp 0x16b8
incq %r15
addq $0x64, %r14
jmp 0x16a9
movq %rbx, %rdi
callq 0x10f0
movq 0x2a62(%rip), %rsi      # 0x4150
leaq 0x933(%rip), %rdi       # 0x2028
xorl %eax, %eax
callq 0x1030
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x29ec(%rip), %rbx      # 0x4100
movq %rbx, %rdi
callq 0x1070
movslq %eax, %r14
movq %r14, %rdi
callq 0x1140
movq %rax, 0x2a22(%rip)      # 0x4150
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
cmpq %rax, %r14
je 0x1637
movb (%rax,%rbx), %cl
movq 0x2a06(%rip), %rdx      # 0x4150
movb %cl, (%rdx,%rax)
incq %rax
jmp 0x1737