// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq %r9d, %rax
movq %rcx, -0x8(%rsp)
movq %rdx, -0x10(%rsp)
cmpq $-0x1, %rax
je 0x16ee
movl (%rcx,%rax,4), %ebx
movslq (%r8), %r14
movl 0x4(%rsi,%r14,4), %r15d
movl %r15d, %r12d
subl (%rsi,%r14,4), %r12d
cmpl %ebx, %r12d
jl 0x16de
xorl %ebp, %ebp
cmpq $0x2, %rax
jl 0x15ce
leaq 0x80d6(%rip), %rcx      # 0x96a0
movl -0x4(%rcx,%rax,4), %ebp
movl (%rdx,%rax,4), %r9d
movq 0x8137(%rip), %r11      # 0x9710
testl %ebx, %ebx
movl $0x0, %r13d
cmovgl %ebx, %r13d
leal -0x1(%r15), %r10d
addl %ebx, %r9d
decl %r9d
subq $0x1, %r13
jb 0x1613
movslq %r10d, %r10
movl (%rdi,%r10,4), %edx
addl %ebp, %edx
movslq %r9d, %rcx
decl %r10d
leal -0x1(%rcx), %r9d
cmpl (%r11,%rcx,4), %edx
je 0x15ef
jmp 0x16de
testq %rax, %rax
je 0x16ee
cmpl %r12d, %ebx
jne 0x1657
movslq 0x4(%r8), %r9
testq %r9, %r9
js 0x16f2
movslq 0x4(%rsi,%r9,4), %rcx
movl -0x4(%rdi,%rcx,4), %ecx
addl %ebp, %ecx
movl %ecx, (%r8)
movslq 0x4(%rsi,%r9,4), %rcx
movl -0x8(%rdi,%rcx,4), %ecx
addl %ebp, %ecx
movl %ecx, 0x4(%r8)
movl 0x4(%rsi,%r14,4), %r15d
movl %r15d, %r12d
subl (%rsi,%r14,4), %r12d
leal 0x1(%rbx), %r11d
movl %ebx, %r13d
notl %r13d
cmpl %r12d, %r11d
jne 0x16a5
movslq 0x4(%r8), %r10
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
testq %r10, %r10
js 0x1682
movslq 0x4(%rsi,%r10,4), %rcx
movl -0x4(%rdi,%rcx,4), %r9d
addl %ebp, %r9d
movl %r9d, 0x4(%r8)
movl 0x4(%rsi,%r14,4), %ecx
addl %r13d, %ecx
movslq %ecx, %rcx
movl (%rdi,%rcx,4), %ecx
addl %ebp, %ecx
movl %ecx, (%r8)
movl 0x4(%rsi,%r14,4), %r15d
movl %r15d, %r12d
subl (%rsi,%r14,4), %r12d
cmpl %r12d, %r11d
jge 0x16cc
addl %r13d, %r15d
movslq %r15d, %rcx
movl (%rdi,%rcx,4), %ecx
addl %ebp, %ecx
movl %ecx, (%r8)
movl 0x4(%rsi,%r14,4), %ecx
subl %ebx, %ecx
addl $-0x2, %ecx
movslq %ecx, %rcx
addl (%rdi,%rcx,4), %ebp
movl %ebp, 0x4(%r8)
decq %rax
movq -0x8(%rsp), %rcx
movq -0x10(%rsp), %rdx
jmp 0x1596
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x16e3
decl %eax
jmp 0x16e3