// File: 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
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x18bb
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %ecx
movl $0x2d, %eax
cmpl %ecx, %eax
jne 0x18ab
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %ecx
movl $0x69, %eax
cmpl %ecx, %eax
jne 0x1618
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x10a0
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %esi
leaq 0xc87(%rip), %rdi       # 0x223c
movl $0x8, %edx
movl $0x1, %ecx
movb $0x0, %al
callq 0x1030
movslq -0x18(%rbp), %rdi
callq 0x1160
movq %rax, 0x2b82(%rip)      # 0x4158
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x1616
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movb (%rax,%rcx), %dl
movq 0x2b54(%rip), %rax      # 0x4158
movslq -0x1c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x15dd
jmp 0x1618
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %ecx
movl $0x6f, %eax
cmpl %ecx, %eax
jne 0x169c
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x10a0
movl %eax, -0x20(%rbp)
movslq -0x20(%rbp), %rdi
callq 0x1160
movq %rax, 0x2b06(%rip)      # 0x4160
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x169a
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movb (%rax,%rcx), %dl
movq 0x2ad8(%rip), %rax      # 0x4160
movslq -0x24(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1661
jmp 0x169c
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %ecx
movl $0x72, %eax
cmpl %ecx, %eax
jne 0x1789
movl $0x0, 0x2a65(%rip)      # 0x4128
movl $0x0, -0x28(%rbp)
movslq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x10a0
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jae 0x1787
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
subl $0x30, %ecx
movl $0xa, %eax
cmpl %ecx, %eax
jle 0x1775
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
cmpl $0x0, %eax
jl 0x1775
imull $0xa, 0x29e3(%rip), %eax # 0x4128
movl %eax, 0x29dd(%rip)      # 0x4128
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
addl 0x29bb(%rip), %eax      # 0x4128
movl %eax, 0x29b5(%rip)      # 0x4128
jmp 0x1777
jmp 0x1787
jmp 0x1779
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x16ca
jmp 0x1789
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %ecx
movl $0x6c, %eax
cmpl %ecx, %eax
jne 0x1876
movl $0x0, 0x2974(%rip)      # 0x4124
movl $0x0, -0x2c(%rbp)
movslq -0x2c(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x10a0
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0x1874
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
subl $0x30, %ecx
movl $0xa, %eax
cmpl %ecx, %eax
jle 0x1862
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
cmpl $0x0, %eax
jl 0x1862
imull $0xa, 0x28f2(%rip), %eax # 0x4124
movl %eax, 0x28ec(%rip)      # 0x4124
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
addl 0x28ca(%rip), %eax      # 0x4124
movl %eax, 0x28c4(%rip)      # 0x4124
jmp 0x1864
jmp 0x1874
jmp 0x1866
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x17b7
jmp 0x1876
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %ecx
movl $0x68, %eax
cmpl %ecx, %eax
jne 0x18a0
callq 0x1470
movl $0x0, -0x4(%rbp)
jmp 0x1a4a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x18ad
jmp 0x18ad
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x154d
cmpq $0x0, 0x2895(%rip)      # 0x4158
jne 0x18d6
callq 0x1470
movl $0x0, -0x4(%rbp)
jmp 0x1a4a
cmpq $0x0, 0x2882(%rip)      # 0x4160
jne 0x1937
leaq 0x2829(%rip), %rdi      # 0x4110
callq 0x10a0
movl %eax, -0x30(%rbp)
movslq -0x30(%rbp), %rdi
callq 0x1160
movq %rax, 0x2861(%rip)      # 0x4160
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x1935
movslq -0x34(%rbp), %rcx
leaq 0x27f7(%rip), %rax      # 0x4110
movb (%rax,%rcx), %dl
movq 0x283d(%rip), %rax      # 0x4160
movslq -0x34(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1906
jmp 0x1937
cmpl $-0x1, 0x27e6(%rip)     # 0x4124
jne 0x194a
movl $0x64, 0x27da(%rip)     # 0x4124
cmpl $-0x1, 0x27d7(%rip)     # 0x4128
jne 0x195d
movl $0xa, 0x27cb(%rip)      # 0x4128
xorl %eax, %eax
movl %eax, %edi
callq 0x10f0
movl %eax, %edi
callq 0x1100
movl $0x0, -0x38(%rbp)
cmpl $0xa, -0x38(%rbp)
jge 0x19a6
movl -0x38(%rbp), %esi
movl $0x64, %edi
callq 0x1320
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x1999
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x199b
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1974
movq 0x27b3(%rip), %rdi      # 0x4160
leaq 0x895(%rip), %rsi       # 0x2249
callq 0x1140
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl 0x275b(%rip), %eax      # 0x4128
jge 0x1a25
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl 0x2745(%rip), %eax      # 0x4124
jge 0x1a18
movq -0x48(%rbp), %rdi
movslq -0x4c(%rbp), %rcx
leaq 0x2780(%rip), %rax      # 0x4170
imulq $0x64, %rcx, %rcx
addq %rcx, %rax
movslq -0x50(%rbp), %rcx
movsbl (%rax,%rcx), %edx
leaq 0x845(%rip), %rsi       # 0x224b
movb $0x0, %al
callq 0x1180
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x19d6
jmp 0x1a1a
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x19c4
movq -0x48(%rbp), %rdi
callq 0x1110
movq 0x272b(%rip), %rsi      # 0x4160
leaq 0x812(%rip), %rdi       # 0x224e
movb $0x0, %al
callq 0x1030
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)