// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r8d, 0x4(%rsp)
movl %ecx, 0x8(%rsp)
movq %rdi, 0x50(%rsp)
testl %edx, %edx
jle 0x3d96
movl $0xffffffff, 0x20(%rsp) # imm = 0xFFFFFFFF
movq $-0x1, 0x18(%rsp)
movl $0x0, 0xc(%rsp)
cmpl $0x2, %esi
jl 0x3b9b
leal -0x1(%rsi), %eax
leaq 0x774c(%rip), %rcx      # 0xb2e0
movl (%rcx,%rax,4), %eax
movl %eax, 0xc(%rsp)
movslq 0x8(%rsp), %rax
movl $0x7, %ecx
movl 0x4(%rsp), %edi
subl %edi, %ecx
movslq %ecx, %r8
leaq (%rax,%rax,4), %rcx
leaq 0xa8f7(%rip), %r15      # 0xe4b0
leaq (%r15,%rcx,8), %rcx
movq %r8, 0x70(%rsp)
movq %rcx, 0x68(%rsp)
cmpl $0x0, (%rcx,%r8,4)
sets %cl
testl %edi, %edi
setle %dil
orb %cl, %dil
jne 0x3d7f
movq %rsi, 0x58(%rsp)
leal -0x1(%rsi), %ecx
movl %ecx, 0x2c(%rsp)
movq %rdx, 0x60(%rsp)
leal -0x1(%rdx), %ecx
movl %ecx, 0x28(%rsp)
movl 0x4(%rsp), %ecx
movl %ecx, %r13d
shlq $0x3, %rax
leaq (%rax,%rax,4), %r14
movslq %ecx, %rax
shlq $0x2, %rax
subq %rax, %r14
addq $0x1c, %r14
xorl %ebp, %ebp
movq $0x0, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x70(%rsp), %rax
addq %rbp, %rax
movq 0x68(%rsp), %rcx
movl (%rcx,%rax,4), %esi
leaq 0x30(%rsp), %rdi
callq 0x2d93
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rbx
subq %rdi, %rbx
je 0x3cc9
sarq $0x2, %rbx
movslq 0x10(%rsp), %rax
movl %eax, %ecx
notl %ecx
addl 0x4(%rsp), %ecx
cmpq $0x1, %rbx
movq %rbx, %rdx
adcq $0x0, %rdx
movl (%rdi), %esi
addl 0xc(%rsp), %esi
movl %esi, 0x18(%rsp,%rax,4)
testl %ecx, %ecx
je 0x3ccd
leaq (%rsp,%rax,4), %rsi
addq $0x18, %rsi
negq %rcx
movl $0x1, %r12d
cmpq %r12, %rdx
je 0x3d31
movl (%rdi,%r12,4), %r8d
addl 0xc(%rsp), %r8d
movl %r8d, (%rsi,%r12,4)
leaq (%rcx,%r12), %r8
incq %r8
incq %r12
cmpq $0x1, %r8
jne 0x3c93
leaq -0x1(%r12), %rcx
cmpq %rcx, %rbx
seta %bl
addq %r12, %rax
jmp 0x3cd2
xorl %ebx, %ebx
jmp 0x3d0d
incq %rax
movb $0x1, %bl
movq %rax, 0x10(%rsp)
xorl %eax, %eax
movl 0x18(%rsp,%rax,4), %ecx
leaq (%r14,%rax,4), %rdx
movl %ecx, (%r15,%rdx)
incq %rax
cmpq %rax, %r13
jne 0x3cd9
movq 0x50(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl 0x28(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %r8d
callq 0x3b48
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3d1f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
testb %bl, %bl
jne 0x3d96
incq %rbp
cmpq %r13, %rbp
jne 0x3c1e
jmp 0x3d54
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
cmpq %r12, %rbx
ja 0x3d96
movq 0x10(%rsp), %rax
movl %eax, %eax
addq %r12, %rax
movq %rax, 0x10(%rsp)
jmp 0x3d23
movq 0x10(%rsp), %rax
testl %eax, %eax
movq 0x60(%rsp), %rdx
movq 0x58(%rsp), %rsi
jle 0x3d7f
movl %eax, %eax
xorl %ecx, %ecx
movl 0x18(%rsp,%rcx,4), %edi
leaq (%r14,%rcx,4), %r8
movl %edi, (%r15,%r8)
incq %rcx
cmpq %rcx, %rax
jne 0x3d6b
decl %esi
decl %edx
movq 0x50(%rsp), %rdi
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %r8d
callq 0x3b48
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3da9
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3dc3
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2220