// File: 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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq 0x5ed6(%rip), %rax      # 0xb020
movq %rax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
cmpl $0x1, -0x14(%rbp)
jle 0x5171
movl -0x14(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x9185(%rip), %rax      # 0xe2f0
movl (%rax,%rcx,4), %eax
movl %eax, -0x24(%rbp)
movslq -0x1c(%rbp), %rcx
leaq 0xc344(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x34(%rbp)
movl 0xc7e9(%rip), %eax      # 0x11978
movl %eax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
cmpl $0x2, -0x3c(%rbp)
jge 0x5374
movslq -0x1c(%rbp), %rax
leaq (%rax,%rax,4), %rcx
leaq 0xc30e(%rip), %rax      # 0x114c0
leaq (%rax,%rcx,8), %rax
movl -0x3c(%rbp), %edx
movl $0x1, %ecx
subl %edx, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x9db0
movq -0x78(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x34c0
jmp 0x51e4
cmpl $0x0, -0x34(%rbp)
jge 0x5210
movl $0x2, -0x68(%rbp)
jmp 0x5339
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x9df0
jmp 0x54dd
leaq -0x58(%rbp), %rdi
callq 0x9d90
subq $0x1, %rax
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x6c(%rbp)
jl 0x5332
cmpl $0x1, -0x18(%rbp)
jne 0x527e
cmpl $0x0, -0x38(%rbp)
jle 0x527e
movslq -0x6c(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x9dd0
movl (%rax), %eax
addl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
movl -0x20(%rbp), %edx
subl $0x1, %edx
addl -0x38(%rbp), %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x526b
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x5324
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x68(%rbp)
jmp 0x5339
movl -0x24(%rbp), %eax
movl %eax, -0x7c(%rbp)
movslq -0x6c(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x9dd0
movl -0x7c(%rbp), %ecx
addl (%rax), %ecx
movslq -0x30(%rbp), %rax
movl %ecx, -0x2c(%rbp,%rax,4)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
cmpl $0x2, -0x30(%rbp)
jne 0x5320
movl -0x2c(%rbp), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xc205(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x28(%rbp), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xc1ed(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
cmpl $0x1, -0x18(%rbp)
jle 0x5310
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
decl %esi
movl -0x18(%rbp), %edx
decl %edx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
callq 0x5120
movl %eax, -0x80(%rbp)
jmp 0x5301
movl -0x80(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x68(%rbp)
jmp 0x5339
movl $0x0, -0x4(%rbp)
movl $0x1, -0x68(%rbp)
jmp 0x5339
jmp 0x5322
jmp 0x5324
movl -0x6c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x5220
movl $0x0, -0x68(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x9df0
movl -0x68(%rbp), %eax
movl %eax, -0x84(%rbp)
testl %eax, %eax
je 0x5364
jmp 0x5351
movl -0x84(%rbp), %eax
subl $0x1, %eax
je 0x54d1
jmp 0x5362
jmp 0x5374
jmp 0x5366
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x5199
cmpl $0x1, -0x18(%rbp)
jle 0x53bc
cmpl $0x1, -0x30(%rbp)
jne 0x5398
movl -0x2c(%rbp), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xc132(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
subl $0x1, %esi
movl -0x18(%rbp), %edx
subl $0x1, %edx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
callq 0x5120
movl %eax, -0x4(%rbp)
jmp 0x54d1
cmpl $0x1, -0x18(%rbp)
je 0x53dd
movl -0x18(%rbp), %esi
leaq 0x5d7d(%rip), %rdi      # 0xb149
movb $0x0, %al
callq 0x2030
movl $0x1, %edi
callq 0x21e0
cmpl $0x0, -0x38(%rbp)
jle 0x53ef
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x54d1
cmpl $0x0, -0x30(%rbp)
jne 0x5440
leaq 0x5d66(%rip), %rdi      # 0xb162
movb $0x0, %al
callq 0x2030
movslq -0x1c(%rbp), %rcx
leaq 0xc0b2(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movslq -0x1c(%rbp), %rcx
leaq 0xc099(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x0, -0x4(%rbp)
jmp 0x54d1
cmpl $0x2, -0x30(%rbp)
jne 0x5492
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
leaq 0x5d2f(%rip), %rdi      # 0xb182
movb $0x0, %al
callq 0x2030
movl -0x2c(%rbp), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xc058(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x28(%rbp), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xc040(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x54d1
cmpl $0x1, -0x30(%rbp)
jne 0x54ca
movl -0x2c(%rbp), %esi
leaq 0x5cef(%rip), %rdi      # 0xb191
movb $0x0, %al
callq 0x2030
movl -0x2c(%rbp), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xc009(%rip), %rax      # 0x114c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x54d1
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x2250
nopw %cs:(%rax,%rax)