// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movq %r9, 0x30(%rsp)
movl %edx, 0xc(%rsp)
movl %esi, %ebp
movq %rdi, %r15
xorl %ebx, %ebx
leaq 0x6020(%rip), %r14      # 0xb2e0
cmpl $0x2, %ecx
jl 0x52cc
leal -0x1(%rcx), %eax
movl (%r14,%rax,4), %ebx
movslq %ecx, %rcx
movl (%r14,%rcx,4), %r13d
cmpl 0x4(%r14,%rcx,4), %r13d
jge 0x54f7
movq %rcx, %rax
leaq (%rax,%rax,4), %rax
incq %rcx
movq %rcx, 0x28(%rsp)
leaq 0x91bc(%rip), %rcx      # 0xe4b0
leaq (%rcx,%rax,8), %r12
movl %ebp, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x10(%rsp), %rdi
movl %r13d, %esi
callq 0x2e23
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rsi
movq %rsi, %rcx
subq %rax, %rcx
sarq $0x2, %rcx
xorl %edx, %edx
cmpq %rax, %rsi
je 0x53cf
movl 0x9639(%rip), %esi      # 0xe978
movl 0x962f(%rip), %edi      # 0xe974
movl 0x9634(%rip), %r8d      # 0xe980
addl %edi, %r8d
movl 0x961a(%rip), %r9d      # 0xe970
addl %ebp, %r9d
decq %r8
decq %rdi
xorl %r10d, %r10d
movl (%rax,%r10,4), %r11d
addl %ebx, %r11d
leal (%r9,%r10), %r14d
movslq %r14d, %r14
cmpl (%r15,%r14,4), %r11d
jne 0x53c2
cmpl $0x1, %esi
setne %r14b
cmpl $-0x1, %esi
movq %r12, %rdx
setne %r12b
leaq 0x1(%r10), %r11
cmpq %r10, %rdi
setne %bpl
orb %r12b, %bpl
movq %rdx, %r12
cmpq %r10, %r8
setne %r10b
cmpb $0x1, %bpl
jne 0x53b2
orb %r10b, %r14b
je 0x53b2
movq %r11, %r10
cmpq %r11, %rcx
ja 0x5362
movl %r11d, %edx
movl 0x8(%rsp), %ebp
leaq 0x5f20(%rip), %r14      # 0xb2e0
jmp 0x53cf
movl 0x8(%rsp), %ebp
leaq 0x5f13(%rip), %r14      # 0xb2e0
xorl %edx, %edx
movl 0x959f(%rip), %esi      # 0xe974
movl 0x95a5(%rip), %edi      # 0xe980
addl %esi, %edi
cmpl %edi, %edx
jne 0x5414
incl 0x6035(%rip)            # 0xb41c
movq $-0x1, (%r12)
xorl %esi, %esi
subl 0x9599(%rip), %esi      # 0xe990
movl %r13d, 0x8(%r12)
movl %esi, 0xc(%r12)
movslq %edx, %rdx
subq %rdx, %rcx
jne 0x544b
movl $0xffffffff, 0x10(%r12) # imm = 0xFFFFFFFF
jmp 0x5455
cmpl %esi, %edx
jne 0x54ce
incl 0x5ffa(%rip)            # 0xb41c
movq $-0x1, (%r12)
movl %r13d, 0x8(%r12)
xorl %eax, %eax
subl 0x9559(%rip), %eax      # 0xe990
movl %eax, 0xc(%r12)
movaps 0x2bdd(%rip), %xmm0     # 0x8020
movups %xmm0, 0x10(%r12)
jmp 0x5496
movl (%rax,%rdx,4), %esi
addl %ebx, %esi
movl %esi, 0x10(%r12)
cmpq $0x2, %rcx
jb 0x5468
movl 0x4(%rax,%rdx,4), %esi
addl %ebx, %esi
movl %esi, 0x14(%r12)
jmp 0x5471
movl $0xffffffff, 0x14(%r12) # imm = 0xFFFFFFFF
cmpq $0x3, %rcx
jb 0x5484
movl 0x8(%rax,%rdx,4), %eax
addl %ebx, %eax
movl %eax, 0x18(%r12)
jmp 0x548d
movl $0xffffffff, 0x18(%r12) # imm = 0xFFFFFFFF
movl $0x2, 0x1c(%r12)
movq %r15, %rdi
movl %ebp, %esi
movl 0xc(%rsp), %edx
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %r8
movq 0x70(%rsp), %r9
pushq $0x1
pushq 0x90(%rsp)
pushq 0x90(%rsp)
pushq 0x90(%rsp)
callq 0x4dde
addq $0x20, %rsp
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x54e5
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
incl %r13d
movq 0x28(%rsp), %rax
cmpl (%r14,%rax,4), %r13d
jl 0x52fc
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5522
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2220