// File: /workspace/github_cpp_makefile_star2_O3/TooruAkagi[P]GCIS_Index/gcis_uni_locate.cpp
// Function: rpsck(int*, int*, int*, int*, int)
int rpsck(int *m,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];
    std::vector<int> x;
    xdisp(x,l);
    if(x.size()<mlen){
        if(DEBUGFLAG==1){printf("\n長さにより左が確実に不一致");}
        return -1;}
    int rofs=0;if(round>1){rofs=dc2s[round-1];}
    for(i = 0;i<mlen;i++){
        if(x[x.size()-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)",x[x.size()-1-i]+rofs,rofs);}
    }
    //printf("[正解]");
    if(round==0){return 0;}
    //printf("<状況チェック%d-%d>",mlen,D_2[l+1]-D_2[l]);
    if(mlen ==x.size()){
        //printf("ゲート1");
        if(e2[1]<0){/*printf("<round %d>まで一致",round-1);*/return round-1;}
        n2 = e2[1];
        std::vector<int> x2;
        xdisp(x2,n2);
        e2[0] = rofs+x2[x2.size()-1];
        e2[1] = rofs+x2[x2.size()-2];
    } //e2[1]の左側2つ
    if(mlen+1==x.size()){
        //printf("ゲート2");
        if(e2[1]<0){e2[1]=-1;}
        else{
            n2 = e2[1];
            std::vector<int> x2;
            xdisp(x2,n2);
            e2[1] = rofs+x2[x2.size()-1];} //e2があるなら定義，なければ-1
        e2[0] = rofs+x[x.size()-1-mlen];
    } //e2[0]の左端とe2[1]の右側2つ
    if(mlen+1<x.size()){
        //printf("ゲート3");
        e2[0] = rofs+x[x.size()-1-mlen];
        e2[1] = rofs+x[x.size()-2-mlen];
    } //e2[0]のさらに左側2つ
    //printf("next e2[%d,%d(+%d)] =>",e2[0],e2[1],rofs);
    return rpsck(m,Ls,B1,e2,round-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
cmpl $-0x1, %r8d
je 0x2f14
movl %r8d, %ebx
movq %rdx, %r12
movq %rdi, %r13
movslq %r8d, %rax
movq %rsi, 0x40(%rsp)
movl (%rsi,%rax,4), %r14d
movl (%rdx,%rax,4), %r15d
movq %rcx, 0x48(%rsp)
movl (%rcx), %esi
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x2d93
movslq %r15d, %r10
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
subq %rdi, %rax
movq %rax, %rcx
sarq $0x2, %rcx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq %r10, %rcx
jb 0x2fed
movq %r12, 0x50(%rsp)
xorl %r12d, %r12d
cmpl $0x2, %ebx
jl 0x2e6b
leal -0x1(%rbx), %edx
leaq 0x8479(%rip), %rsi      # 0xb2e0
movl (%rsi,%rdx,4), %r12d
testl %r15d, %r15d
jle 0x2e9f
leaq (%rdi,%rax), %rdx
addl %r10d, %r14d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movslq %esi, %r8
movl (%rdx,%r8,4), %r8d
addl %r12d, %r8d
leal (%r14,%rsi), %r9d
movslq %r9d, %r9
cmpl (%r13,%r9,4), %r8d
jne 0x2ff2
decl %esi
decq %r15
jne 0x2e7c
testl %ebx, %ebx
je 0x2f1b
cmpq %r10, %rcx
jne 0x2f22
movq 0x48(%rsp), %r15
movl 0x4(%r15), %esi
testl %esi, %esi
js 0x2f8a
movq %r10, %r14
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x2d93
movq (%rsp), %rdi
movq 0x8(%rsp), %rax
movl -0x4(%rax), %ecx
addl %r12d, %ecx
movl %ecx, (%r15)
movl -0x8(%rax), %eax
addl %r12d, %eax
movl %eax, 0x4(%r15)
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
subq %rdi, %rax
movq %rax, %rcx
sarq $0x2, %rcx
movq %r14, %r10
jmp 0x2f27
xorl %ebp, %ebp
jmp 0x2fff
xorl %ebp, %ebp
jmp 0x2fed
movq 0x48(%rsp), %r15
leaq 0x1(%r10), %r14
cmpq %r14, %rcx
jne 0x2fab
movl 0x4(%r15), %esi
testl %esi, %esi
js 0x2f90
movq %r10, %rbp
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x2d93
movq (%rsp), %rdi
movq 0x8(%rsp), %rax
movl -0x4(%rax), %eax
addl %r12d, %eax
movl %eax, 0x4(%r15)
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
subq %rdi, %rax
movq %rax, %rcx
sarq $0x2, %rcx
movq %rbp, %r10
jmp 0x2f98
decl %ebx
movl %ebx, %ebp
jmp 0x2fed
movl $0xffffffff, 0x4(%r15)  # imm = 0xFFFFFFFF
movq %r10, %rdx
notq %rdx
leaq (%rdi,%rax), %rsi
movl (%rsi,%rdx,4), %edx
addl %r12d, %edx
movl %edx, (%r15)
movq 0x40(%rsp), %rsi
cmpq %r14, %rcx
jbe 0x2fd1
subq %r10, %rcx
notq %r10
addq %rdi, %rax
movl (%rax,%r10,4), %eax
addl %r12d, %eax
movl %eax, (%r15)
addl -0x8(%rdi,%rcx,4), %r12d
movl %r12d, 0x4(%r15)
decl %ebx
movq %r13, %rdi
movq 0x50(%rsp), %rdx
movq %r15, %rcx
movl %ebx, %r8d
callq 0x2ddb
movl %eax, %ebp
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2fff
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3012
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x3032
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
jmp 0x3032
jmp 0x302f
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x3049
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2220