// File: /workspace/github_cpp_makefile_star2_O1/TooruAkagi[P]GCIS_Index/gcis_uni_locate.cpp
// Function: coreAcheck(int*, int, int, int, int)
int coreAcheck(int *m,int round,int count,int tround,int startm){ //左の[0][1]をcount回開ける
    if(DEBUGFLAG==1){
        printf("\n[2-左%dオープン(%d)]count==1ならAコアを%d文字調べる\n",count,round,coredata[2]);
        for(int i = 0; i<10; i++){printf("[%d]",occart2[tround][i]);}
    }
    int rofs=0;int e[2] = {-1,-1};int etg = 0;
    if(round>1){rofs=dc2s[round-1];}
    int l = occart2[tround][1];
    int Alen = coredata[2];
    //printf("Aチェック(%d / %d)",occart2[tround][0],occart2[tround][1]);
    //count>=2 の時，必ず2つ準びできるので，for以降に行くことはない.count==1の時，Aを判定して終わる場合は
    //-1が一部残ってforを抜けるはずなので,
            for(int j = 0;j<2;j++){
                l = occart2[tround][1-j];
                std::vector<int> x;
                xdisp(x,l);
                if(l<0){
                    if(DEBUGFLAG==1){printf("-1を回避(j==%d)",j);}
                    break;}
                 if(DEBUGFLAG==1){printf("open[%d(+%d)]",l,rofs);}
                for(int i = x.size()-1;i>=0;i--){
                    if(count==1 && Alen>0){ //count1ならAコアの判定をする
                         if(DEBUGFLAG==1){printf("\n[%d-%d]",rofs+x[i],m[startm-1+Alen]);}
                        if(x[i]+rofs == m[startm-1+Alen]){
                            Alen--;continue;
                        }
                        else{return -1;}
                    }
                    else{ //count1以外か，コアを判定し終わったら
                        e[etg] = rofs+x[i];etg++;
                        if(etg==2){ //コアの横の文字が2つ集まったら
                            occart2[tround][1] = e[0]; //1こめ
                            occart2[tround][0] = e[1]; //1こめ
                            if(count>1){return coreAcheck(m,round-1,count-1,tround,startm);}
                            return 0; //Aを見終わったならそのままreturnしていいはず
                        }
                    }
                }
            }
    //coreAcheckは最低1文字ある状態で呼ぶ．
    if(count>1){
        if(etg==1){occart2[tround][1] = e[0];}
        return coreAcheck(m,round-1,count-1,tround,startm);} //無理やりチェック
    if(count != 1){printf("おかしい(count = %d)",count);exit(1);}
    if(Alen>0){return -1;}
    //printf("未定義[etg = %d]",etg);
    if(etg==0){printf("Aでぴったり切れている");occart2[tround][1] = -1;occart2[tround][0] = -1;return 0;}
    if(etg==2){printf("追加 > %d.%d",e[0],e[1]);occart2[tround][1] = e[0];occart2[tround][0] = e[1];return 0;}
    if(etg==1){printf("追加 > %d",e[0]);occart2[tround][1] = e[0];return 0;}
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %r14d
movq $-0x1, 0x10(%rsp)
xorl %ebx, %ebx
movl $0x0, %r12d
cmpl $0x2, %esi
jl 0x4377
leal -0x1(%rsi), %eax
leaq 0x6f6d(%rip), %rdx      # 0xb2e0
movl (%rdx,%rax,4), %r12d
movl %ecx, 0x2c(%rsp)
movslq %ecx, %rax
leaq (%rax,%rax,4), %rax
leaq 0xa127(%rip), %rcx      # 0xe4b0
leaq (%rcx,%rax,8), %rax
movq %rax, 0x20(%rsp)
movl 0xa5cf(%rip), %r13d     # 0xe968
movq %r8, 0x50(%rsp)
leal -0x1(%r8), %eax
movq %rax, 0x60(%rsp)
decl %esi
movq %rsi, 0x48(%rsp)
leal -0x1(%r14), %eax
movl %eax, 0x28(%rsp)
xorl %r15d, %r15d
movq %rdi, 0x58(%rsp)
movl %ebx, %eax
xorl $0x1, %eax
movq 0x20(%rsp), %rcx
movl (%rcx,%rax,4), %ebp
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
leaq 0x30(%rsp), %rdi
movl %ebp, %esi
callq 0x2e23
movl $0x0, 0xc(%rsp)
testl %ebp, %ebp
js 0x4459
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
decl %ecx
movb $0x1, %bpl
js 0x44c2
movl %ecx, %ecx
incq %rcx
movq 0x58(%rsp), %rdi
movl -0x4(%rax,%rcx,4), %edx
addl %r12d, %edx
cmpl $0x1, %r14d
jne 0x4441
testl %r13d, %r13d
jle 0x4441
movq 0x60(%rsp), %rsi
addl %r13d, %esi
movslq %esi, %rsi
cmpl (%rdi,%rsi,4), %edx
jne 0x44a6
decl %r13d
jmp 0x4452
movslq %r15d, %r15
movl %edx, 0x10(%rsp,%r15,4)
incl %r15d
cmpl $0x2, %r15d
je 0x4463
decq %rcx
jg 0x441a
jmp 0x44c2
movl $0x2, 0xc(%rsp)
jmp 0x44c0
movl 0x10(%rsp), %eax
movq 0x20(%rsp), %rcx
movl %eax, 0x4(%rcx)
movl 0x14(%rsp), %eax
movl %eax, (%rcx)
movl $0x1, 0xc(%rsp)
movl $0x2, %r15d
cmpl $0x2, %r14d
jl 0x44b8
movq 0x48(%rsp), %rsi
movl 0x28(%rsp), %edx
movl 0x2c(%rsp), %ecx
movq 0x50(%rsp), %r8
callq 0x4342
movl %eax, 0x1c(%rsp)
jmp 0x44c0
movl $0x1, 0xc(%rsp)
movl $0xffffffff, 0x1c(%rsp) # imm = 0xFFFFFFFF
jmp 0x44c0
movl $0x0, 0x1c(%rsp)
xorl %ebp, %ebp
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x44d9
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
testb %bpl, %bpl
movq 0x58(%rsp), %rdi
je 0x44f8
leal 0x1(%rbx), %eax
testl %ebx, %ebx
movl %eax, %ebx
je 0x43be
movl $0x2, 0xc(%rsp)
cmpl $0x2, 0xc(%rsp)
movl 0x1c(%rsp), %ebp
jne 0x454a
cmpl $0x2, %r14d
jl 0x4536
cmpl $0x1, %r15d
jne 0x451b
movl 0x10(%rsp), %eax
movq 0x20(%rsp), %rcx
movl %eax, 0x4(%rcx)
movq 0x48(%rsp), %rsi
movl 0x28(%rsp), %edx
movl 0x2c(%rsp), %ecx
movq 0x50(%rsp), %r8
callq 0x4342
movl %eax, %ebp
jmp 0x454a
cmpl $0x1, %r14d
jne 0x45d7
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %r13d, %r13d
jle 0x455b
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, %r15d
je 0x45ac
cmpl $0x1, %r15d
je 0x458c
xorl %ebp, %ebp
testl %r15d, %r15d
jne 0x454a
leaq 0x3bac(%rip), %rdi      # 0x8121
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x2030
movq 0x20(%rsp), %rax
movq $-0x1, (%rax)
jmp 0x454a
movl 0x10(%rsp), %ebx
leaq 0x3bb9(%rip), %rdi      # 0x8150
xorl %ebp, %ebp
movl %ebx, %esi
xorl %eax, %eax
callq 0x2030
movq 0x20(%rsp), %rax
movl %ebx, 0x4(%rax)
jmp 0x454a
movl 0x10(%rsp), %ebx
movl 0x14(%rsp), %ebp
leaq 0x3b86(%rip), %rdi      # 0x8141
movl %ebx, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2030
movq 0x20(%rsp), %rax
movl %ebx, 0x4(%rax)
movl %ebp, (%rax)
xorl %ebp, %ebp
jmp 0x454a
leaq 0x3b2a(%rip), %rdi      # 0x8108
movl %r14d, %esi
xorl %eax, %eax
callq 0x2030
movl $0x1, %edi
callq 0x21a0
jmp 0x45f4
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x460e
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2220