// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x40(%rsp)
movl %edx, 0x1c(%rsp)
movl %esi, 0xc(%rsp)
movq %rdi, %r12
xorl %ebp, %ebp
leaq 0x551b(%rip), %rbx      # 0xa2f0
cmpl $0x2, %ecx
jl 0x4de0
leal -0x1(%rcx), %eax
movl (%rbx,%rax,4), %ebp
movslq %ecx, %rax
movl (%rbx,%rax,4), %r15d
incl %ecx
movq %rcx, 0x38(%rsp)
movslq %ecx, %rcx
movq %rcx, 0x48(%rsp)
imulq $0x28, %rax, %rax
leaq 0x86bf(%rip), %r13      # 0xd4c0
addq %rax, %r13
leaq 0x20(%rsp), %r14
movq %r13, 0x10(%rsp)
movq 0x48(%rsp), %rax
cmpl (%rbx,%rax,4), %r15d
jge 0x4fe5
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq %r14, %rdi
movl %r15d, %esi
callq 0x2c26
movl %r15d, 0x8(%rsp)
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %r14
subq %rax, %r14
sarq $0x2, %r14
movl 0x8b36(%rip), %edi      # 0xd988
movl 0x8b2c(%rip), %ecx      # 0xd984
movl 0x8b32(%rip), %edx      # 0xd990
addl %ecx, %edx
movl 0x8b19(%rip), %r8d      # 0xd980
addl 0xc(%rsp), %r8d
leaq -0x1(%rdx), %r9
pushq $0x1
popq %r10
movq %rcx, 0x50(%rsp)
subq %rcx, %r10
xorl %r11d, %r11d
cmpq %r11, %r14
je 0x4ec8
movl (%rax,%r11,4), %ecx
addl %ebp, %ecx
leal (%r8,%r11), %r15d
movslq %r15d, %r15
cmpl (%r12,%r15,4), %ecx
jne 0x4ecd
cmpl $0x1, %edi
sete %r15b
cmpl $-0x1, %edi
sete %bl
leaq 0x1(%r11), %rcx
movq %r10, %r13
addq %r11, %r13
sete %sil
cmpq %r11, %r9
sete %r13b
testb %sil, %bl
jne 0x4ecf
movq %rcx, %r11
andb %r13b, %r15b
je 0x4e7f
jmp 0x4ecf
movl %r14d, %ecx
jmp 0x4ecf
xorl %ecx, %ecx
movl 0x8(%rsp), %r15d
movq 0x10(%rsp), %r13
cmpl %edx, %ecx
jne 0x4f3c
incl 0x5549(%rip)            # 0xa42c
orq $-0x1, (%r13)
movl %r15d, 0x8(%r13)
xorl %ecx, %ecx
subl 0x8aac(%rip), %ecx      # 0xd9a0
movl %ecx, 0xc(%r13)
movslq %edx, %rdx
pushq $-0x1
popq %rcx
subq %rdx, %r14
je 0x4f08
movl (%rax,%rdx,4), %ecx
addl %ebp, %ecx
movl %ecx, 0x10(%r13)
cmpq $0x1, %r14
jbe 0x4f79
movl 0x4(%rax,%rdx,4), %ecx
addl %ebp, %ecx
movl %ecx, 0x14(%r13)
pushq $-0x1
popq %rcx
pushq $0x2
popq %rsi
cmpq $0x2, %r14
leaq 0x53c3(%rip), %rbx      # 0xa2f0
leaq 0x20(%rsp), %r14
je 0x4f90
movl 0x8(%rax,%rdx,4), %ecx
addl %ebp, %ecx
jmp 0x4f90
cmpl 0x50(%rsp), %ecx
leaq 0x53a9(%rip), %rbx      # 0xa2f0
leaq 0x20(%rsp), %r14
jne 0x4fd5
incl 0x54d4(%rip)            # 0xa42c
orq $-0x1, (%r13)
movl %r15d, 0x8(%r13)
xorl %esi, %esi
xorl %eax, %eax
subl 0x8a35(%rip), %eax      # 0xd9a0
movl %eax, 0xc(%r13)
orq $-0x1, 0x10(%r13)
pushq $-0x1
popq %rcx
jmp 0x4f90
orl $-0x1, 0x14(%r13)
pushq $-0x1
popq %rcx
pushq $0x2
popq %rsi
leaq 0x5365(%rip), %rbx      # 0xa2f0
leaq 0x20(%rsp), %r14
movl %ecx, 0x18(%r13)
movl %esi, 0x1c(%r13)
movq %r12, %rdi
movl 0xc(%rsp), %esi
movl 0x1c(%rsp), %edx
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %r8
movq 0x90(%rsp), %r9
pushq $0x1
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
callq 0x4920
addq $0x20, %rsp
movq %r14, %rdi
callq 0x6e42
incl %r15d
jmp 0x4e0e
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x6e42
movq %rbx, %rdi
callq 0x2240