// File: /workspace/github_cpp_makefile_star2_O2/TooruAkagi[P]GCIS_Index/gcis_uni_locate.cpp
// Function: coreCcheck(int*, int, int, int)
int coreCcheck(int *m,int round,int count,int tround){ //一つレベルの高い分割を2つ抑える．[-B][C*][**]と3つが得られる．
    //コアCが出現するかを確認する．出現するなら，余った部分をrightopennd3に回す．
    //coredata[7]がcoredata[8]回出現するのを見届ける
    if(DEBUGFLAG==1){
        printf("\n[Cコア%dを%d回チェック(%d-%d / %d)]",coredata[7],coredata[8],round,tround,count);
        for(int i = 0; i<10; i++){printf("[%d]",occart2[tround][i]);}
    }
    if(count<1){return 0;}
    //printf("\n");
    int a[3] = {-1,-1,-1};int tg = 0;
    int rofs=0;int Clef = coredata[8];
    if(round>1){rofs=dc2s[round-1];}
    for(int u = 0;u<3;u++){
        if(occart2[tround][4+u] > -1){
            if(DEBUGFLAG==1){
                 printf("\n展開:occart2[%d] = %d",4+u,occart2[tround][4+u]);
            }
            std::vector<int> x;
            xdisp(x,occart2[tround][4+u]);
            for(int i = 0;i<x.size();i++){
                if(Clef>0 && count==1){
                    if(rofs+x[i]==coredata[7]){
                        Clef--;
                        if(DEBUGFLAG==1){printf("\n[hit %d(%d) / あと%d]",rofs+x[i],x[i],Clef);}
                        continue;}else{return -1;}
                }
                //if(fround==0){return 0;} //Clefがなくなって，froundが0ならもう右はあっているのでは
                a[tg] = rofs+x[i];tg++;
                 if(DEBUGFLAG==1){printf(" got(%d [+%d]) ",rofs+x[i],rofs);}
                if(tg==3){
                    for(int j = 0;j<3;j++){
                         if(DEBUGFLAG==1){printf("\noccart2[%d] = %d",4+j,a[j]);}
                        occart2[tround][4+j] = a[j];
                    }
                    if(Clef==0){occart2[tround][7] += 2;return rightopennd3(m,round-1,count-1,tround,3);} //Cコア把握
                    return coreCcheck(m,round-1,count-1,tround);
                }
            }
        }
    }
    if(count==1){//Cの存在を確かめた上で右分割が足りない場合
        if(tg==0 || Clef>0){printf("おかしい!(%d,%d)",tg,Clef);exit(7);}
        if(tg>=1){occart2[tround][4] = a[0];}
        if(tg>=2){occart2[tround][5] = a[1];}
        occart2[tround][7] += 2;
        return rightopennd3(m,round-1,count-1,tround,3);
    }
    else{ //countがもっと高い
        if(tg>=1){occart2[tround][4] = a[0];}
        if(tg>=2){occart2[tround][5] = a[1];}
        return coreCcheck(m,round-1,count-1,tround);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, 0xc(%rsp)
movq %rdi, 0x30(%rsp)
testl %edx, %edx
jle 0x3c8e
movl %edx, %r15d
orl $-0x1, 0x20(%rsp)
orq $-0x1, 0x18(%rsp)
leal -0x1(%rsi), %eax
movl %eax, 0x8(%rsp)
xorl %r12d, %r12d
movl $0x0, %ebp
cmpl $0x2, %esi
jl 0x3ab7
movl 0x8(%rsp), %eax
leaq 0x683c(%rip), %rcx      # 0xa2f0
movl (%rcx,%rax,4), %ebp
movl 0x9ed2(%rip), %r13d     # 0xd990
movslq 0xc(%rsp), %rax
leal -0x1(%r15), %ecx
movl %ecx, 0x14(%rsp)
imulq $0x28, %rax, %rax
leaq 0x99ea(%rip), %rcx      # 0xd4c0
leaq (%rax,%rcx), %rdx
addq $0x1c, %rdx
movq %rdx, 0x38(%rsp)
movq %rax, 0x28(%rsp)
addq %rcx, %rax
movq %rax, 0x58(%rsp)
xorl %ecx, %ecx
cmpq $0x3, %rcx
je 0x3c19
movq 0x58(%rsp), %rax
movl 0x10(%rax,%rcx,4), %esi
testl %esi, %esi
js 0x3c11
movq %rcx, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x2c26
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %r14
subq %rax, %r14
sarq $0x2, %r14
movl 0x9e4b(%rip), %ecx      # 0xd98c
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0x3bf9
cmpl $0x1, %r15d
setne %sil
testl %r13d, %r13d
setle %dil
movl (%rax,%rbx,4), %edx
addl %ebp, %edx
orb %sil, %dil
jne 0x3b6e
cmpl %ecx, %edx
jne 0x3b84
decl %r13d
jmp 0x3b7f
movslq %r12d, %r12
movl %edx, 0x18(%rsp,%r12,4)
incl %r12d
cmpl $0x3, %r12d
je 0x3b8d
incq %rbx
jmp 0x3b43
pushq $-0x1
popq %rax
movl %eax, 0x10(%rsp)
jmp 0x3bf9
xorl %eax, %eax
movq 0x38(%rsp), %rdx
cmpq $0x3, %rax
je 0x3ba7
movl 0x18(%rsp,%rax,4), %ecx
movl %ecx, -0xc(%rdx,%rax,4)
incq %rax
jmp 0x3b94
testl %r13d, %r13d
je 0x3bce
movq 0x30(%rsp), %rdi
movl 0x8(%rsp), %esi
movl 0x14(%rsp), %edx
movl 0xc(%rsp), %ecx
callq 0x3a68
movl %eax, 0x10(%rsp)
pushq $0x3
popq %rax
movl %eax, %r12d
jmp 0x3bf9
addl $0x2, (%rdx)
xorl %r13d, %r13d
movq 0x30(%rsp), %rdi
movl 0x8(%rsp), %esi
movl 0x14(%rsp), %edx
movl 0xc(%rsp), %ecx
pushq $0x3
popq %r12
movl %r12d, %r8d
callq 0x3825
movl $0x0, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x6e42
cmpq %rbx, %r14
movq 0x60(%rsp), %rcx
ja 0x3cdf
incq %rcx
jmp 0x3af2
cmpl $0x1, %r15d
jne 0x3c92
testl %r12d, %r12d
je 0x3cf2
testl %r13d, %r13d
jg 0x3cf2
testl %r12d, %r12d
jle 0x3c64
movl 0x18(%rsp), %eax
movq 0x28(%rsp), %rcx
leaq 0x987a(%rip), %rdx      # 0xd4c0
movl %eax, 0x10(%rcx,%rdx)
cmpl $0x1, %r12d
je 0x3c64
movl 0x1c(%rsp), %eax
movq 0x28(%rsp), %rcx
leaq 0x9860(%rip), %rdx      # 0xd4c0
movl %eax, 0x14(%rcx,%rdx)
movq 0x38(%rsp), %rax
addl $0x2, (%rax)
movl $0x0, 0x10(%rsp)
pushq $0x3
popq %r8
movq 0x30(%rsp), %rdi
movl 0x8(%rsp), %esi
xorl %edx, %edx
movl 0xc(%rsp), %ecx
callq 0x3825
jmp 0x3cdf
xorl %eax, %eax
jmp 0x3ce3
testl %r12d, %r12d
jle 0x3cc5
movl 0x18(%rsp), %eax
movq 0x28(%rsp), %rcx
leaq 0x9819(%rip), %rdx      # 0xd4c0
movl %eax, 0x10(%rcx,%rdx)
cmpl $0x1, %r12d
je 0x3cc5
movl 0x1c(%rsp), %eax
movq 0x28(%rsp), %rcx
leaq 0x97ff(%rip), %rdx      # 0xd4c0
movl %eax, 0x14(%rcx,%rdx)
movq 0x30(%rsp), %rdi
movl 0x8(%rsp), %esi
movl 0x14(%rsp), %edx
movl 0xc(%rsp), %ecx
callq 0x3a68
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x342a(%rip), %rdi      # 0x7123
movl %r12d, %esi
movl %r13d, %edx
xorl %eax, %eax
callq 0x2030
pushq $0x7
popq %rdi
callq 0x21c0
jmp 0x3d10
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x6e42
movq %rbx, %rdi
callq 0x2240