// File: /workspace/github_cpp_makefile_star2_O3/TooruAkagi[P]GCIS_Index/gcis_nep_locate.cpp
// Function: rpsck(unsigned int*, int*, int*, int*, int*, int)
int rpsck(unsigned int *D,int *D_2,int *Ls,int *B1,int *e2,int round){
    //不一致があれば-1を，round x まで合っていればxを返す．
    if(DEBUGFLAG==1){printf("\nrpsck / [round %d]",round);}
    if(round==-1){return 0;}
    int starti = Ls[round];
    int mlen = B1[round];
    int i = 0;int n2;
    int l = e2[0];
    if(D_2[l+1]-D_2[l]<mlen){
        if(DEBUGFLAG==1){printf("\n長さにより左が確実に不一致");}
        return -1;}
    if(DEBUGFLAG==1){
        printf("open -> [%d] :",l);
        printf("Debug[%d文字,%d / %d/%d]",D_2[l+1]-D_2[l],mlen,starti+mlen-1-i,D_2[l+1]-1-i);
    }
    int rofs=0;if(round>1){rofs=dc2s[round-1];}
    for(i = 0;i<mlen;i++){
        if(D[D_2[l+1]-1-i]+rofs!=m[starti+mlen-1-i]){
            //printf("\n[round %d で 左不一致 %d != %d]",round,D[D_2[l+1]-1-i]+rofs,m[starti+mlen-1-i]);
            return -1;
        }
        if(DEBUGFLAG==1){printf("\nrhit%d(%d)",D[D_2[l+1]-1-i]+rofs,rofs);}
    }
    //printf("[正解]");
    if(round==0){return 0;}
    //printf("<状況チェック%d-%d>",mlen,D_2[l+1]-D_2[l]);
    if(mlen ==D_2[l+1]-D_2[l]){
        //printf("ゲート1");
        if(e2[1]<0){/*printf("<round %d>まで一致",round-1);*/return round-1;}
        n2 = e2[1];
        e2[0] = rofs+D[D_2[n2+1]-1];
        e2[1] = rofs+D[D_2[n2+1]-2];
    } //e2[1]の左側2つ
    if(mlen+1==D_2[l+1]-D_2[l]){
        //printf("ゲート2");
        if(e2[1]<0){e2[1]=-1;}
        else{
            n2 = e2[1];
            e2[1] = rofs+D[D_2[n2+1]-1];} //e2があるなら定義，なければ-1
        e2[0] = rofs+D[D_2[l+1]-1-mlen];
    } //e2[0]の左端とe2[1]の右側2つ
    if(mlen+1<D_2[l+1]-D_2[l]){
        //printf("ゲート3");
        e2[0] = rofs+D[D_2[l+1]-1-mlen];
        e2[1] = rofs+D[D_2[l+1]-2-mlen];
    } //e2[0]のさらに左側2つ
    //printf("next e2[%d,%d(+%d)] =>",e2[0],e2[1],rofs);
    return rpsck(D,D_2,Ls,B1,e2,round-1);
}

// Assembly:
cmpl $-0x1, %r9d
je 0x1739
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq (%r8), %r14
movslq %r9d, %r15
movl (%rcx,%r15,4), %r10d
movl 0x4(%rsi,%r14,4), %r12d
movl %r12d, %r13d
subl (%rsi,%r14,4), %r13d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r10d, %r13d
jl 0x172e
movq %rdx, -0x18(%rsp)
movq 0x9145(%rip), %r9       # 0xa710
leaq (%rsi,%r14,4), %rax
movq %rax, -0x20(%rsp)
leaq (%rsi,%r14,4), %rax
addq $0x4, %rax
movq %rcx, -0x10(%rsp)
movq %rax, -0x8(%rsp)
xorl %ebp, %ebp
cmpq $0x2, %r15
jl 0x15fa
leaq 0x90ab(%rip), %rax      # 0xa6a0
movl -0x4(%rax,%r15,4), %ebp
testl %r10d, %r10d
jle 0x1632
movq -0x18(%rsp), %rax
movl (%rax,%r15,4), %edx
movl %r10d, %r11d
leal -0x1(%r12), %eax
decl %edx
movslq %eax, %rcx
movl (%rdi,%rcx,4), %ecx
addl %ebp, %ecx
leal (%rdx,%r11), %ebx
movslq %ebx, %rbx
cmpl (%r9,%rbx,4), %ecx
jne 0x1729
decl %eax
decq %r11
jne 0x1612
movq %r15, %r11
subq $0x1, %r11
jb 0x173c
cmpl %r13d, %r10d
movq -0x8(%rsp), %rbx
jne 0x1683
movslq 0x4(%r8), %rax
testq %rax, %rax
js 0x1740
movslq 0x4(%rsi,%rax,4), %rcx
movl -0x4(%rdi,%rcx,4), %r14d
addl %ebp, %r14d
movl %r14d, (%r8)
movslq 0x4(%rsi,%rax,4), %rax
movl -0x8(%rdi,%rax,4), %eax
addl %ebp, %eax
movl %eax, 0x4(%r8)
movl (%rbx), %r12d
movl %r12d, %r13d
movq -0x20(%rsp), %rax
subl (%rax), %r13d
leal 0x1(%r10), %edx
movl %r10d, %r15d
notl %r15d
cmpl %r13d, %edx
movq -0x10(%rsp), %rcx
jne 0x16d5
movslq 0x4(%r8), %rax
testq %rax, %rax
js 0x16ad
movslq 0x4(%rsi,%rax,4), %rax
movl -0x4(%rdi,%rax,4), %eax
addl %ebp, %eax
jmp 0x16b2
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x4(%r8)
movl (%rbx), %eax
addl %r15d, %eax
cltq
movl (%rdi,%rax,4), %r14d
addl %ebp, %r14d
movl %r14d, (%r8)
movl (%rbx), %r12d
movl %r12d, %r13d
movq -0x20(%rsp), %rax
subl (%rax), %r13d
cmpl %r13d, %edx
jge 0x16fb
addl %r15d, %r12d
movslq %r12d, %rax
movl (%rdi,%rax,4), %r14d
addl %ebp, %r14d
movl %r14d, (%r8)
movl (%rbx), %eax
subl %r10d, %eax
addl $-0x2, %eax
cltq
addl (%rdi,%rax,4), %ebp
movl %ebp, 0x4(%r8)
movl (%rcx,%r11,4), %r10d
movslq %r14d, %rax
leaq (%rsi,%rax,4), %rdx
movq %rdx, -0x20(%rsp)
leaq (%rsi,%rax,4), %rax
addq $0x4, %rax
movl (%rax), %r12d
movl %r12d, %r13d
subl -0x4(%rax), %r13d
movq %r11, %r15
cmpl %r10d, %r13d
jge 0x15e1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
xorl %eax, %eax
jmp 0x172e
decl %r15d
movl %r15d, %eax
jmp 0x172e