// File: /workspace/github_cpp_makefile_star2_O3/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 $0x48, %rsp
movq %r9, 0x40(%rsp)
movl %edx, 0xc(%rsp)
movl %esi, %ebp
movq %rdi, %r15
xorl %ebx, %ebx
leaq 0x60c2(%rip), %r12      # 0xb2e0
cmpl $0x2, %ecx
jl 0x522a
leal -0x1(%rcx), %eax
movl (%r12,%rax,4), %ebx
movslq %ecx, %rcx
movl (%r12,%rcx,4), %r13d
cmpl 0x4(%r12,%rcx,4), %r13d
jge 0x5443
movq %rcx, %rax
leaq (%rax,%rax,4), %rax
incq %rcx
movq %rcx, 0x38(%rsp)
leaq 0x925e(%rip), %rcx      # 0xe4b0
leaq (%rcx,%rax,8), %rax
movq %rax, 0x28(%rsp)
movl %ebp, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x10(%rsp), %rdi
movl %r13d, %esi
callq 0x2d93
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdi
movq %rdi, %rcx
subq %rax, %rcx
sarq $0x2, %rcx
movl 0x96dd(%rip), %esi      # 0xe974
movl 0x96e3(%rip), %edx      # 0xe980
cmpq %rax, %rdi
je 0x5310
movl 0x96d0(%rip), %edi      # 0xe978
addl %esi, %edx
movl 0x96bf(%rip), %r8d      # 0xe970
addl %ebp, %r8d
leaq -0x1(%rdx), %r9
movq %rsi, 0x30(%rsp)
leaq -0x1(%rsi), %r10
xorl %r11d, %r11d
movl (%rax,%r11,4), %r14d
addl %ebx, %r14d
leal (%r8,%r11), %r12d
movslq %r12d, %r12
cmpl (%r15,%r12,4), %r14d
jne 0x5317
cmpl $0x1, %edi
setne %r12b
cmpl $-0x1, %edi
setne %bpl
leaq 0x1(%r11), %r14
cmpq %r11, %r10
setne %sil
orb %bpl, %sil
cmpq %r11, %r9
setne %r11b
cmpb $0x1, %sil
jne 0x531a
orb %r11b, %r12b
je 0x531a
movq %r14, %r11
cmpq %r14, %rcx
ja 0x52c4
jmp 0x531a
addl %esi, %edx
xorl %r14d, %r14d
jmp 0x532a
xorl %r14d, %r14d
movl 0x8(%rsp), %ebp
leaq 0x5fbb(%rip), %r12      # 0xb2e0
movq 0x30(%rsp), %rsi
cmpl %edx, %r14d
jne 0x538f
incl 0x60e7(%rip)            # 0xb41c
movq 0x28(%rsp), %r8
movq $-0x1, (%r8)
movl %r13d, 0x8(%r8)
xorl %esi, %esi
subl 0x9643(%rip), %esi      # 0xe990
movl %esi, 0xc(%r8)
movslq %edx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
subq %rsi, %rcx
je 0x5363
movl (%rax,%rsi,4), %edx
addl %ebx, %edx
movl %edx, 0x10(%r8)
cmpq $0x1, %rcx
jbe 0x53c5
movl 0x4(%rax,%rsi,4), %edx
addl %ebx, %edx
movl %edx, 0x14(%r8)
movl $0x2, %edx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
cmpq $0x2, %rcx
je 0x53d7
movl 0x8(%rax,%rsi,4), %edi
addl %ebx, %edi
jmp 0x53d7
cmpl %esi, %r14d
jne 0x541a
incl 0x607e(%rip)            # 0xb41c
movq 0x28(%rsp), %r8
movq $-0x1, %rcx
movq %rcx, (%r8)
movl %r13d, 0x8(%r8)
xorl %eax, %eax
subl 0x95d7(%rip), %eax      # 0xe990
xorl %edx, %edx
movl %eax, 0xc(%r8)
movq %rcx, 0x10(%r8)
jmp 0x53d2
movl $0xffffffff, 0x14(%r8)  # imm = 0xFFFFFFFF
movl $0x2, %edx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl %edi, 0x18(%r8)
movl %edx, 0x1c(%r8)
movq %r15, %rdi
movl %ebp, %esi
movl 0xc(%rsp), %edx
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %r8
movq 0x80(%rsp), %r9
pushq $0x1
pushq 0xa0(%rsp)
pushq 0xa0(%rsp)
pushq 0xa0(%rsp)
callq 0x4d40
addq $0x20, %rsp
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5431
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
incl %r13d
movq 0x38(%rsp), %rax
cmpl (%r12,%rax,4), %r13d
jl 0x525f
xorl %eax, %eax
addq $0x48, %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 0x546e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2220