// File: TooruAkagi[P]GCIS_Index/gcis_uni_locate.cpp
// Function: findAB(int*, int, int, int, int*, int*, int*, int*, int*, int*)
int findAB(int *m,int startm,int mrlen,int round,int *kmpc,int *B1,int *B2,int *B3,int *Ls,int *Rs){
    //printf("\nAコアがある場合の[");
    //for(int i2 = 0;i2<coredata[5];i2++){printf("%d ",m[startm+coredata[4]+i2]);}
    //printf("]Bを探す(round %d)\nkmpc = ",round);
    //for(int i2 = 0;i2<mrlen;i2++){printf("%d ",kmpc[i2]);}
    int len = 0;
    int rofs=0;
    if(round>1){rofs=dc2s[round-1];}
    //int bs = 0; //コアが完全一致した時，どこまで戻るか
    //int fis = -1;
    int i = 0;
    int tg = 0;
    int ofs = 0;
    //int kpofs = 0;
    //int e2[2];
    for(int y8=dc2s[round];y8<dc2s[round+1];y8++){ //変数y8
        std::vector<int> x;
        xdisp(x,y8);
        //printf("\n[%d(%d)]",y8,D_2[y8+1]-D_2[y8]);
        ofs=0;tg = 0;
        for(int y9=0;y9<x.size();y9++){
            //printf(" %d",rofs+D[y9]);
            if(rofs+x[y9]==m[startm+coredata[4]+tg]){ //coredata[4]だけずらす
            tg++;
            }else{tg=0;break;}//先頭からしか見ないので不一致が会ったら即forを脱出する
            if(coredata[6]==-1 && tg==coredata[5]){break;} //Cコアがないなら，B判定でbreak
            if(coredata[6]==1 && tg==coredata[5]+coredata[8]){break;} //Cコアがあり，5+8ならbreak
            
        }
        //printf(" / 一致数%d(出現)[%d+%d]",tg,coredata[5],coredata[8]);
        if(tg==coredata[5]+coredata[8]){ //Cコアがある場合は最後にBCコア，そうでない場合はBコアが出現
            //printf("\n(BC出現[%d / %d])",tg,D_2[y8+1]-D_2[y8]);
            coreans++;
            occart2[round][0] = -1;
            occart2[round][1] = -1;
            occart2[round][2] = y8;
            occart2[round][3] = -ocofs; //先頭から出現するのでずれなし
            if(x.size()-tg>0){occart2[round][4] = rofs+x[tg];}else{occart2[round][4] = -1;}
            if(x.size()-tg>1){occart2[round][5] = rofs+x[tg+1];}else{occart2[round][5] = -1;}
            if(x.size()-tg>2){occart2[round][6] = rofs+x[tg+2];}else{occart2[round][6] = -1;}
            if(coredata[6]==1){
                occart2[round][7] = 2;
                //printf("\n(BC出現[%d / %d])",tg,D_2[y8+1]-D_2[y8]);
            } //Cコアがあるなら，BC発見にする
            else{
                //printf("\n(B出現[%d])[Cなし]",tg);
                occart2[round][7] = 2; //B発見(Aはまだ)
            }
            //for(int i = 0;i<10;i++){printf("[%d]",occart2[round][i]);}
            //exit(2);
            findups(m,startm,mrlen,round+1,B1,B2,B3,Ls,Rs,1); //その不完全なコアの出現を探す
        }
        else if(tg==coredata[5]){ //最後にBコアだけ出現
           // printf("\n(B出現[%d])",tg);
            coreans++;
            occart2[round][0] = -1;
            occart2[round][1] = -1;
            occart2[round][2] = y8;
            occart2[round][3] = -ocofs; //先頭から出現するのでずれなし + コアと出現位置のズレ + Aコアのずれを補正
            occart2[round][4] = -1;
            occart2[round][5] = -1;
            occart2[round][6] = -1;
            occart2[round][7] = 0; //Bのみ発見(Aはまだ)
            //for(int i = 0;i<10;i++){printf("[%d]",occart2[round][i]);}
           findups(m,startm,mrlen,round+1,B1,B2,B3,Ls,Rs,1); //その不完全なコアの出現を探す
        }
    }
    //printf("\nend of searching.(%d)[%d]",len,i);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0xb8, %rsp
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
cmpl $0x1, -0x1c(%rbp)
jle 0x6c6b
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x768b(%rip), %rax      # 0xe2f0
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movslq -0x1c(%rbp), %rcx
leaq 0x7665(%rip), %rax      # 0xe2f0
movl (%rax,%rcx,4), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x764c(%rip), %rcx      # 0xe2f0
cmpl (%rcx,%rdx,4), %eax
jge 0x70f3
leaq -0x60(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x9db0
movq -0x78(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0x34c0
jmp 0x6cc8
movl $0x0, -0x44(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x70(%rbp)
movslq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x9d90
movq %rax, %rcx
movq -0x80(%rbp), %rax
cmpq %rcx, %rax
jae 0x6da9
movl -0x38(%rbp), %eax
movl %eax, -0x84(%rbp)
movslq -0x70(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x9dd0
movq %rax, %rcx
movl -0x84(%rbp), %eax
addl (%rcx), %eax
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
addl 0xac54(%rip), %edx      # 0x11980
addl -0x40(%rbp), %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x6d5c
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x6d65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x9df0
jmp 0x70ff
movl $0x0, -0x40(%rbp)
jmp 0x6da9
cmpl $-0x1, 0xac1c(%rip)     # 0x11988
jne 0x6d7b
movl -0x40(%rbp), %eax
cmpl 0xac0d(%rip), %eax      # 0x11984
jne 0x6d7b
jmp 0x6da9
cmpl $0x1, 0xac06(%rip)      # 0x11988
jne 0x6d99
movl -0x40(%rbp), %eax
movl 0xabf7(%rip), %ecx      # 0x11984
addl 0xabfd(%rip), %ecx      # 0x11990
cmpl %ecx, %eax
jne 0x6d99
jmp 0x6da9
jmp 0x6d9b
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x6cdd
movl -0x40(%rbp), %eax
movl 0xabd2(%rip), %ecx      # 0x11984
addl 0xabd8(%rip), %ecx      # 0x11990
cmpl %ecx, %eax
jne 0x6fec
movl 0x7666(%rip), %eax      # 0xe42c
addl $0x1, %eax
movl %eax, 0x765d(%rip)      # 0xe42c
movslq -0x1c(%rbp), %rcx
leaq 0xa6e6(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movslq -0x1c(%rbp), %rcx
leaq 0xa6ce(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movl -0x48(%rbp), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xa6b2(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
xorl %ecx, %ecx
subl 0xab80(%rip), %ecx      # 0x119a0
movslq -0x1c(%rbp), %rdx
leaq 0xa695(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
leaq -0x60(%rbp), %rdi
callq 0x9d90
movslq -0x40(%rbp), %rcx
subq %rcx, %rax
cmpq $0x0, %rax
jbe 0x6e80
movl -0x38(%rbp), %eax
movl %eax, -0x88(%rbp)
movslq -0x40(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x9dd0
movl -0x88(%rbp), %ecx
addl (%rax), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xa64c(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
jmp 0x6e99
movslq -0x1c(%rbp), %rcx
leaq 0xa635(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
leaq -0x60(%rbp), %rdi
callq 0x9d90
movslq -0x40(%rbp), %rcx
subq %rcx, %rax
cmpq $0x1, %rax
jbe 0x6ee9
movl -0x38(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x9dd0
movl -0x8c(%rbp), %ecx
addl (%rax), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xa5e3(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
jmp 0x6f02
movslq -0x1c(%rbp), %rcx
leaq 0xa5cc(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x14(%rax) # imm = 0xFFFFFFFF
leaq -0x60(%rbp), %rdi
callq 0x9d90
movslq -0x40(%rbp), %rcx
subq %rcx, %rax
cmpq $0x2, %rax
jbe 0x6f52
movl -0x38(%rbp), %eax
movl %eax, -0x90(%rbp)
movl -0x40(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x9dd0
movl -0x90(%rbp), %ecx
addl (%rax), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xa57a(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
jmp 0x6f6b
movslq -0x1c(%rbp), %rcx
leaq 0xa563(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
cmpl $0x1, 0xaa16(%rip)      # 0x11988
jne 0x6f8f
movslq -0x1c(%rbp), %rcx
leaq 0xa541(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x2, 0x1c(%rax)
jmp 0x6fa8
movslq -0x1c(%rbp), %rcx
leaq 0xa526(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x2, 0x1c(%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
incl %ecx
movq -0x30(%rbp), %r8
movq 0x10(%rbp), %r9
movq 0x18(%rbp), %r10
movq 0x20(%rbp), %r11
movq 0x28(%rbp), %rbx
movq %rsp, %rax
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
movl $0x1, 0x18(%rax)
callq 0x62e0
jmp 0x6fe7
jmp 0x70dc
movl -0x40(%rbp), %eax
cmpl 0xa98f(%rip), %eax      # 0x11984
jne 0x70da
movl 0x742b(%rip), %eax      # 0xe42c
incl %eax
movl %eax, 0x7423(%rip)      # 0xe42c
movslq -0x1c(%rbp), %rax
leaq (%rax,%rax,4), %rcx
leaq 0xa4a8(%rip), %rax      # 0x114c0
movq %rax, -0x98(%rbp)
movl $0xffffffff, (%rax,%rcx,8) # imm = 0xFFFFFFFF
movslq -0x1c(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
movl $0xffffffff, 0x4(%rax,%rcx,8) # imm = 0xFFFFFFFF
movl -0x48(%rbp), %edx
movslq -0x1c(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
movl %edx, 0x8(%rax,%rcx,8)
movl 0xa955(%rip), %edx      # 0x119a0
negl %edx
movslq -0x1c(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
movl %edx, 0xc(%rax,%rcx,8)
movslq -0x1c(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
movl $0xffffffff, 0x10(%rax,%rcx,8) # imm = 0xFFFFFFFF
movslq -0x1c(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
movl $0xffffffff, 0x14(%rax,%rcx,8) # imm = 0xFFFFFFFF
movslq -0x1c(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
movl $0xffffffff, 0x18(%rax,%rcx,8) # imm = 0xFFFFFFFF
movslq -0x1c(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
movl $0x0, 0x1c(%rax,%rcx,8)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
incl %ecx
movq -0x30(%rbp), %r8
movq 0x10(%rbp), %r9
movq 0x18(%rbp), %r10
movq 0x20(%rbp), %r11
movq 0x28(%rbp), %rbx
movq %rsp, %rax
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
movl $0x1, 0x18(%rax)
callq 0x62e0
jmp 0x70d8
jmp 0x70da
jmp 0x70dc
leaq -0x60(%rbp), %rdi
callq 0x9df0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x6c91
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x2250
nopl (%rax,%rax)