// File: /workspace/github_cpp_makefile_star2_O1/TooruAkagi[P]GCIS_Index/gcis_nep_locate.cpp
// Function: rightopennd3(unsigned int*, int*, int, int, int, int)
int rightopennd3(unsigned int *D,int *D_2,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++){
            //printf("\noccart2[%d] = %d",7-mode+k,occart2[tround][7-mode]);
            for(int i = D_2[occart2[tround][7-mode+k]];i<D_2[1+occart2[tround][7-mode+k]];i++){
                a[tg] = rofs+D[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(D,D_2,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(D,D_2,round-1,count-1,tround,mode);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r8d, 0x10(%rsp)
testl %ecx, %ecx
jle 0x20d8
movl $0xffffffff, 0x28(%rsp) # imm = 0xFFFFFFFF
movq $-0x1, 0x20(%rsp)
xorl %r11d, %r11d
movl $0x0, 0x14(%rsp)
cmpl $0x2, %edx
jl 0x1ebd
leal -0x1(%rdx), %eax
leaq 0x87eb(%rip), %r10      # 0xa6a0
movl (%r10,%rax,4), %eax
movl %eax, 0x14(%rsp)
movslq 0x10(%rsp), %r10
movl $0x7, %eax
subl %r9d, %eax
movslq %eax, %r8
leaq (%r10,%r10,4), %rax
leaq 0x8298(%rip), %r15      # 0xa170
leaq (%r15,%rax,8), %r13
cmpl $0x0, (%r13,%r8,4)
js 0x2094
testl %r9d, %r9d
setg 0xe(%rsp)
movq %rcx, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq %r10, 0x48(%rsp)
jle 0x207b
leal -0x1(%rdx), %eax
movl %eax, 0x34(%rsp)
leal -0x1(%rcx), %eax
movl %eax, 0x30(%rsp)
movl %r9d, %ebx
movl %r9d, %eax
negl %eax
movq %rax, 0x68(%rsp)
leaq 0x4(%rdi), %rax
movq %rax, 0x60(%rsp)
leaq (,%r10,8), %rax
leaq (%rax,%rax,4), %r12
movslq %r9d, %rax
shlq $0x2, %rax
subq %rax, %r12
addq $0x1c, %r12
xorl %r14d, %r14d
xorl %r11d, %r11d
movq %rdi, 0x18(%rsp)
movq %rsi, 0x70(%rsp)
movq %r8, 0x40(%rsp)
movq %r13, 0x38(%rsp)
leaq (%r14,%r8), %rax
movslq (%r13,%rax,4), %rcx
movslq (%rsi,%rcx,4), %rax
movslq 0x4(%rsi,%rcx,4), %rcx
cmpl %ecx, %eax
setl %bpl
jge 0x2063
movslq %r11d, %rdx
movl (%rdi,%rax,4), %r10d
addl 0x14(%rsp), %r10d
movl %r10d, 0x20(%rsp,%rdx,4)
leaq 0x1(%rdx), %r13
cmpl %r9d, %r13d
je 0x1ff0
movq %r13, %r8
movl %r13d, %ebp
addq 0x68(%rsp), %rbp
leaq 0x24(%rsp), %rdi
leaq (%rdi,%rdx,4), %rdi
movq 0x60(%rsp), %rdx
leaq (%rdx,%rax,4), %r13
movl %eax, %r11d
notl %r11d
addl %ecx, %r11d
xorl %edx, %edx
cmpl %edx, %r11d
je 0x2041
movl (%r13,%rdx,4), %r10d
addl 0x14(%rsp), %r10d
movl %r10d, (%rdi,%rdx,4)
incq %rdx
movl %ebp, %r10d
addl %edx, %r10d
jne 0x1fbd
addq %rdx, %rax
cmpq %rcx, %rax
setl %bpl
movq %r8, %r13
addq %rdx, %r13
movq 0x18(%rsp), %rdi
movb %bpl, 0xf(%rsp)
xorl %eax, %eax
movl 0x20(%rsp,%rax,4), %ecx
leaq (%r12,%rax,4), %rdx
movl %ecx, (%r15,%rdx)
incq %rax
cmpq %rax, %rbx
jne 0x1ff7
movl 0x34(%rsp), %edx
movl 0x30(%rsp), %ecx
movl 0x10(%rsp), %r8d
movl %r9d, %ebp
callq 0x1e6f
movl %ebp, %r9d
movq 0x70(%rsp), %rsi
movq 0x18(%rsp), %rdi
movq %r13, %r11
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %r13
movb 0xf(%rsp), %bpl
jmp 0x2063
addq %rdx, %rax
incq %rax
cmpq %rcx, %rax
setl %bpl
addl %r8d, %edx
movl %edx, %r11d
movq 0x18(%rsp), %rdi
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %r13
testb %bpl, %bpl
jne 0x207e
incq %r14
cmpq %rbx, %r14
setb 0xe(%rsp)
jne 0x1f5d
jmp 0x207e
xorl %r11d, %r11d
testb $0x1, 0xe(%rsp)
movq 0x58(%rsp), %rcx
movq 0x50(%rsp), %rdx
movq 0x48(%rsp), %r10
jne 0x20d8
testl %r11d, %r11d
jle 0x20ca
movl %r11d, %eax
shlq $0x3, %r10
leaq (%r10,%r10,4), %r10
movslq %r9d, %r11
shlq $0x2, %r11
subq %r11, %r10
addq $0x1c, %r10
xorl %r11d, %r11d
movl 0x20(%rsp,%r11,4), %ebx
leaq (%r10,%r11,4), %r14
movl %ebx, (%r15,%r14)
incq %r11
cmpq %r11, %rax
jne 0x20b5
decl %edx
decl %ecx
movl 0x10(%rsp), %r8d
callq 0x1e6f
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq