// File: /workspace/github_cpp_makefile_star2_O1/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 %ecx, 0x10(%rsp)
movq %rdi, 0x48(%rsp)
testl %edx, %edx
jle 0x3e94
movl $0xffffffff, 0x20(%rsp) # imm = 0xFFFFFFFF
movq $-0x1, 0x18(%rsp)
xorl %edi, %edi
movl $0x0, %r13d
cmpl $0x2, %esi
jl 0x3c63
leal -0x1(%rsi), %eax
leaq 0x7681(%rip), %rcx      # 0xb2e0
movl (%rcx,%rax,4), %r13d
movslq 0x10(%rsp), %rcx
movl $0x7, %eax
subl %r8d, %eax
movslq %eax, %r9
leaq (%rcx,%rcx,4), %rax
leaq 0xa832(%rip), %r12      # 0xe4b0
leaq (%r12,%rax,8), %rax
movq %r9, 0x70(%rsp)
movq %rax, 0x68(%rsp)
cmpl $0x0, (%rax,%r9,4)
js 0x3e4e
testl %r8d, %r8d
setg %dil
movl %r8d, 0x14(%rsp)
movq %rdx, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rcx, 0x50(%rsp)
jle 0x3e1f
leal -0x1(%rsi), %eax
movl %eax, 0x2c(%rsp)
leal -0x1(%rdx), %eax
movl %eax, 0x28(%rsp)
movl %r8d, %ebx
leaq (,%rcx,8), %rax
leaq (%rax,%rax,4), %r14
movslq %r8d, %rax
shlq $0x2, %rax
subq %rax, %r14
addq $0x1c, %r14
xorl %r15d, %r15d
movq $0x0, 0x8(%rsp)
movb %dil, 0x7(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x70(%rsp), %rax
addq %r15, %rax
movq 0x68(%rsp), %rcx
movl (%rcx,%rax,4), %esi
leaq 0x30(%rsp), %rdi
callq 0x2e23
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rax
subq %rdx, %rax
setne %bpl
je 0x3df1
sarq $0x2, %rax
movslq 0x8(%rsp), %rcx
movl %ecx, %esi
notl %esi
addl 0x14(%rsp), %esi
cmpq $0x1, %rax
movq %rax, %rdi
adcq $0x0, %rdi
movl (%rdx), %r8d
addl %r13d, %r8d
movl %r8d, 0x18(%rsp,%rcx,4)
testl %esi, %esi
je 0x3da2
leaq (%rsp,%rcx,4), %r9
addq $0x18, %r9
negq %rsi
movl $0x1, %r8d
cmpq %r8, %rdi
je 0x3ddd
movl (%rdx,%r8,4), %r10d
addl %r13d, %r10d
movl %r10d, (%r9,%r8,4)
leaq (%rsi,%r8), %r10
incq %r10
incq %r8
cmpq $0x1, %r10
jne 0x3d72
leaq -0x1(%r8), %rdx
cmpq %rdx, %rax
seta %bpl
addq %r8, %rcx
jmp 0x3da5
incq %rcx
movq %rcx, 0x8(%rsp)
xorl %eax, %eax
movl 0x18(%rsp,%rax,4), %ecx
leaq (%r14,%rax,4), %rdx
movl %ecx, (%r12,%rdx)
incq %rax
cmpq %rax, %rbx
jne 0x3dac
movq 0x48(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl 0x28(%rsp), %edx
movl 0x10(%rsp), %ecx
movl 0x14(%rsp), %r8d
callq 0x3c18
jmp 0x3df1
cmpq %r8, %rax
seta %bpl
movq 0x8(%rsp), %rax
addl %r8d, %eax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3e08
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
testb %bpl, %bpl
jne 0x3e2a
incq %r15
cmpq %rbx, %r15
setb %dil
jne 0x3cef
jmp 0x3e2f
movq $0x0, 0x8(%rsp)
jmp 0x3e2f
movb 0x7(%rsp), %dil
testb $0x1, %dil
movl 0x14(%rsp), %r8d
movq 0x60(%rsp), %rdx
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rcx
movq 0x8(%rsp), %rdi
jne 0x3e94
testl %edi, %edi
jle 0x3e82
movl %edi, %eax
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rcx
movslq %r8d, %rdi
shlq $0x2, %rdi
subq %rdi, %rcx
addq $0x1c, %rcx
xorl %r9d, %r9d
movl 0x18(%rsp,%r9,4), %r10d
leaq (%rcx,%r9,4), %rdi
movl %r10d, (%r12,%rdi)
incq %r9
cmpq %r9, %rax
jne 0x3e6d
decl %esi
decl %edx
movq 0x48(%rsp), %rdi
movl 0x10(%rsp), %ecx
callq 0x3c18
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3ea7
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3ec1
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2220