// File: TooruAkagi[P]GCIS_Index/gcis_uni_locate.cpp
// Function: rightopennd3(int*, int, int, int, int)
int rightopennd3(int *m,int round,int count,int tround,int mode){ //左の[4-6]をcount回開ける
    //printf("\n[%d-右%dオープン(%d)]",mode,count,round);
    //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;
    if(round>1){rofs=dc2s[round-1];}
    if(occart2[tround][7-mode] > -1){
        for(int k = 0; k<mode; k++){
            std::vector<int> x;
            xdisp(x,occart2[tround][7-mode+k]);
            //printf("\noccart2[%d] = %d",7-mode+k,occart2[tround][7-mode]);
            for(int i = 0;i<x.size();i++){
                a[tg] = rofs+x[i];tg++;
                //printf(" got(%d [+%d]) ",rofs+D[i],rofs);
                if(tg==mode){
                    for(int j = 0;j<mode;j++){
                        //printf("\noccart2[%d] = %d",7-mode+j,a[j]);
                        occart2[tround][7-mode+j] = a[j];
                    }
                    return rightopennd3(m,round-1,count-1,tround,mode);
                }
            }
        }
    }
    //printf("完全には埋まらず"); //右が3つ出てこない場合でも，展開は続行する(展開の過程で3つうまることもある)
    for(int j = 0;j<tg;j++){
        //printf("\noccart2[%d] = %d",7-mode+j,a[j]);
        occart2[tround][7-mode+j] = a[j];
    }
    return rightopennd3(m,round-1,count-1,tround,mode);
}

// 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)
cmpl $0x1, -0x18(%rbp)
jge 0x484e
movl $0x0, -0x4(%rbp)
jmp 0x4a99
movq 0x6e83(%rip), %rax      # 0xb6d8
movq %rax, -0x2c(%rbp)
movl 0x6e81(%rip), %eax      # 0xb6e0
movl %eax, -0x24(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
cmpl $0x1, -0x14(%rbp)
jle 0x488c
movl -0x14(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x9a6a(%rip), %rax      # 0xe2f0
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
movslq -0x1c(%rbp), %rcx
leaq 0xcc29(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x7, %ecx
subl -0x20(%rbp), %ecx
movslq %ecx, %rcx
cmpl $-0x1, (%rax,%rcx,4)
jle 0x4a35
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x4a33
leaq -0x50(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x9db0
movq -0x78(%rbp), %rdi
movslq -0x1c(%rbp), %rax
leaq (%rax,%rax,4), %rcx
leaq 0xcbda(%rip), %rax      # 0x114c0
leaq (%rax,%rcx,8), %rax
movl -0x20(%rbp), %edx
movl -0x38(%rbp), %ecx
subl %edx, %ecx
addl $0x7, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %esi
callq 0x34c0
jmp 0x4902
movl $0x0, -0x60(%rbp)
movslq -0x60(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x9d90
movq %rax, %rcx
movq -0x80(%rbp), %rax
cmpq %rcx, %rax
jae 0x4a08
movl -0x34(%rbp), %eax
movl %eax, -0x84(%rbp)
movslq -0x60(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x9dd0
movl -0x84(%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)
movl -0x30(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x49f8
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x49c4
movslq -0x64(%rbp), %rax
movl -0x2c(%rbp,%rax,4), %edx
movslq -0x1c(%rbp), %rcx
leaq 0xcb39(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x7, %ecx
subl -0x20(%rbp), %ecx
addl -0x64(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x496c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x9df0
jmp 0x4aa5
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 0x4820
movl %eax, -0x88(%rbp)
jmp 0x49e6
movl -0x88(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x68(%rbp)
jmp 0x4a0f
jmp 0x49fa
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x4909
movl $0x0, -0x68(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x9df0
movl -0x68(%rbp), %eax
testl %eax, %eax
je 0x4a23
jmp 0x4a21
jmp 0x4a99
jmp 0x4a25
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x48ba
jmp 0x4a35
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x4a7a
movslq -0x6c(%rbp), %rax
movl -0x2c(%rbp,%rax,4), %edx
movslq -0x1c(%rbp), %rcx
leaq 0xca69(%rip), %rax      # 0x114c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x7, %ecx
subl -0x20(%rbp), %ecx
addl -0x6c(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x4a3c
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 0x4820
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x2250
nop