// File: TooruAkagi[P]GCIS_Index/gcis_nep_locate.cpp
// Function: findAB(unsigned int*, int*, int*, int, int, int, int*, int*, int*, int*, int*, int*)
int findAB(unsigned int *D,int *D_2,int *D_3,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++){
        //printf("\n[%d(%d)]",y8,D_2[y8+1]-D_2[y8]);
        ofs=0;tg = 0;
        for(int y9=D_2[y8];y9<D_2[y8+1];y9++){
            //printf(" %d",rofs+D[y9]);
            if(rofs+D[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(D_2[y8+1]-D_2[y8]-tg>0){occart2[round][4] = rofs+D[D_2[y8]+tg];}else{occart2[round][4] = -1;}
            if(D_2[y8+1]-D_2[y8]-tg>1){occart2[round][5] = rofs+D[D_2[y8]+tg+1];}else{occart2[round][5] = -1;}
            if(D_2[y8+1]-D_2[y8]-tg>2){occart2[round][6] = rofs+D[D_2[y8]+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(D,D_2,D_3,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(D,D_2,D_3,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 %r14
pushq %rbx
subq $0x70, %rsp
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movl %ecx, -0x2c(%rbp)
movl %r8d, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
cmpl $0x1, -0x34(%rbp)
jle 0x5704
movl -0x34(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x7fb2(%rip), %rax      # 0xd6b0
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movslq -0x34(%rbp), %rcx
leaq 0x7f8c(%rip), %rax      # 0xd6b0
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x7f73(%rip), %rcx      # 0xd6b0
cmpl (%rcx,%rdx,4), %eax
jge 0x5bbc
movl $0x0, -0x48(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x20(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq -0x20(%rbp), %rcx
movl -0x4c(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x57fc
movl -0x3c(%rbp), %eax
movq -0x18(%rbp), %rcx
movslq -0x50(%rbp), %rdx
addl (%rcx,%rdx,4), %eax
movq 0x7f90(%rip), %rcx      # 0xd720
movl -0x2c(%rbp), %edx
addl 0x7ea7(%rip), %edx      # 0xd640
addl -0x44(%rbp), %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x57af
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x57b8
movl $0x0, -0x44(%rbp)
jmp 0x57fc
cmpl $-0x1, 0x7e89(%rip)     # 0xd648
jne 0x57ce
movl -0x44(%rbp), %eax
cmpl 0x7e7a(%rip), %eax      # 0xd644
jne 0x57ce
jmp 0x57fc
cmpl $0x1, 0x7e73(%rip)      # 0xd648
jne 0x57ec
movl -0x44(%rbp), %eax
movl 0x7e64(%rip), %ecx      # 0xd644
addl 0x7e6a(%rip), %ecx      # 0xd650
cmpl %ecx, %eax
jne 0x57ec
jmp 0x57fc
jmp 0x57ee
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x5762
movl -0x44(%rbp), %eax
movl 0x7e3f(%rip), %ecx      # 0xd644
addl 0x7e45(%rip), %ecx      # 0xd650
cmpl %ecx, %eax
jne 0x5a6e
movl 0x7ee3(%rip), %eax      # 0xd6fc
addl $0x1, %eax
movl %eax, 0x7eda(%rip)      # 0xd6fc
movslq -0x34(%rbp), %rcx
leaq 0x7953(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movslq -0x34(%rbp), %rcx
leaq 0x793b(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movl -0x4c(%rbp), %ecx
movslq -0x34(%rbp), %rdx
leaq 0x791f(%rip), %rax      # 0xd180
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
xorl %ecx, %ecx
subl 0x7ea9(%rip), %ecx      # 0xd71c
movslq -0x34(%rbp), %rdx
leaq 0x7902(%rip), %rax      # 0xd180
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movq -0x20(%rbp), %rax
movl -0x4c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movq -0x20(%rbp), %rcx
movslq -0x4c(%rbp), %rdx
subl (%rcx,%rdx,4), %eax
subl -0x44(%rbp), %eax
cmpl $0x0, %eax
jle 0x58dd
movl -0x3c(%rbp), %ecx
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rdx
movslq -0x4c(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
addl -0x44(%rbp), %edx
movslq %edx, %rdx
addl (%rax,%rdx,4), %ecx
movslq -0x34(%rbp), %rdx
leaq 0x78af(%rip), %rax      # 0xd180
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
jmp 0x58f6
movslq -0x34(%rbp), %rcx
leaq 0x7898(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
movq -0x20(%rbp), %rax
movl -0x4c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movq -0x20(%rbp), %rcx
movslq -0x4c(%rbp), %rdx
subl (%rcx,%rdx,4), %eax
subl -0x44(%rbp), %eax
cmpl $0x1, %eax
jle 0x594e
movl -0x3c(%rbp), %ecx
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rdx
movslq -0x4c(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
addl -0x44(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
addl (%rax,%rdx,4), %ecx
movslq -0x34(%rbp), %rdx
leaq 0x783e(%rip), %rax      # 0xd180
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
jmp 0x5967
movslq -0x34(%rbp), %rcx
leaq 0x7827(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x14(%rax) # imm = 0xFFFFFFFF
movq -0x20(%rbp), %rax
movl -0x4c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movq -0x20(%rbp), %rcx
movslq -0x4c(%rbp), %rdx
subl (%rcx,%rdx,4), %eax
subl -0x44(%rbp), %eax
cmpl $0x2, %eax
jle 0x59bf
movl -0x3c(%rbp), %ecx
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rdx
movslq -0x4c(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
addl -0x44(%rbp), %edx
addl $0x2, %edx
movslq %edx, %rdx
addl (%rax,%rdx,4), %ecx
movslq -0x34(%rbp), %rdx
leaq 0x77cd(%rip), %rax      # 0xd180
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
jmp 0x59d8
movslq -0x34(%rbp), %rcx
leaq 0x77b6(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
cmpl $0x1, 0x7c69(%rip)      # 0xd648
jne 0x59fc
movslq -0x34(%rbp), %rcx
leaq 0x7794(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x2, 0x1c(%rax)
jmp 0x5a15
movslq -0x34(%rbp), %rcx
leaq 0x7779(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x2, 0x1c(%rax)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %r8d
movl -0x34(%rbp), %r9d
addl $0x1, %r9d
movq 0x18(%rbp), %r14
movq 0x20(%rbp), %rbx
movq 0x28(%rbp), %r11
movq 0x30(%rbp), %r10
movq 0x38(%rbp), %rax
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl $0x1, 0x28(%rsp)
callq 0x4e60
jmp 0x5bac
movl -0x44(%rbp), %eax
cmpl 0x7bcd(%rip), %eax      # 0xd644
jne 0x5baa
movl 0x7c79(%rip), %eax      # 0xd6fc
addl $0x1, %eax
movl %eax, 0x7c70(%rip)      # 0xd6fc
movslq -0x34(%rbp), %rcx
leaq 0x76e9(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movslq -0x34(%rbp), %rcx
leaq 0x76d1(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movl -0x4c(%rbp), %ecx
movslq -0x34(%rbp), %rdx
leaq 0x76b5(%rip), %rax      # 0xd180
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
xorl %ecx, %ecx
subl 0x7c3f(%rip), %ecx      # 0xd71c
movslq -0x34(%rbp), %rdx
leaq 0x7698(%rip), %rax      # 0xd180
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movslq -0x34(%rbp), %rcx
leaq 0x7683(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
movslq -0x34(%rbp), %rcx
leaq 0x766a(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x14(%rax) # imm = 0xFFFFFFFF
movslq -0x34(%rbp), %rcx
leaq 0x7651(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
movslq -0x34(%rbp), %rcx
leaq 0x7638(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x1c(%rax)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %r8d
movl -0x34(%rbp), %r9d
addl $0x1, %r9d
movq 0x18(%rbp), %r14
movq 0x20(%rbp), %rbx
movq 0x28(%rbp), %r11
movq 0x30(%rbp), %r10
movq 0x38(%rbp), %rax
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl $0x1, 0x28(%rsp)
callq 0x4e60
jmp 0x5bac
jmp 0x5bae
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x572a
xorl %eax, %eax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopw (%rax,%rax)