// File: /workspace/github_cpp_makefile_star2_O3/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:
testl %ecx, %ecx
jle 0x1f3e
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r15
movl $0xffffffff, 0x20(%rsp) # imm = 0xFFFFFFFF
movq $-0x1, 0x18(%rsp)
xorl %ebp, %ebp
cmpl $0x2, %edx
jl 0x1db6
leal -0x1(%rdx), %eax
leaq 0x88ed(%rip), %rdi      # 0xa6a0
movl (%rdi,%rax,4), %ebp
movslq %r8d, %rbx
movl $0x7, %eax
subl %r9d, %eax
movslq %eax, %rdi
leaq (%rbx,%rbx,4), %rax
leaq 0x83a1(%rip), %r11      # 0xa170
leaq (%r11,%rax,8), %r12
cmpl $0x0, (%r12,%rdi,4)
sets %al
testl %r9d, %r9d
setle %r10b
orb %al, %r10b
jne 0x1ed8
movq %rbx, 0x28(%rsp)
movl %r8d, 0x8(%rsp)
movq %rdx, 0x40(%rsp)
leal -0x1(%rdx), %eax
movl %eax, 0x14(%rsp)
movq %rcx, 0x38(%rsp)
leal -0x1(%rcx), %eax
movl %eax, 0x10(%rsp)
movl %r9d, %r14d
movl $0x1, %edx
movl %r9d, 0xc(%rsp)
subl %r9d, %edx
xorl %r10d, %r10d
xorl %r8d, %r8d
movq %r15, 0x30(%rsp)
leaq (%r10,%rdi), %rax
movslq (%r12,%rax,4), %rax
movslq (%rsi,%rax,4), %rbx
movl 0x4(%rsi,%rax,4), %r13d
cmpl %ebx, %r13d
jle 0x1e81
movl %r8d, %ecx
movslq %r8d, %rax
leaq (%rsp,%rax,4), %r8
addq $0x18, %r8
movl %eax, %r9d
addq %rdx, %r9
leaq (%r15,%rbx,4), %rax
subl %ebx, %r13d
xorl %ebx, %ebx
movl (%rax,%rbx,4), %r15d
addl %ebp, %r15d
movl %r15d, (%r8,%rbx,4)
movl %r9d, %r15d
addl %ebx, %r15d
je 0x1ee1
incq %rbx
cmpl %ebx, %r13d
jne 0x1e5b
movl %ecx, %r8d
addl %ebx, %r8d
movq 0x30(%rsp), %r15
incq %r10
cmpq %r14, %r10
jne 0x1e28
testl %r8d, %r8d
movl 0xc(%rsp), %r9d
movl %r8d, %eax
movl 0x8(%rsp), %r8d
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
movq 0x28(%rsp), %rdi
jle 0x1ed8
movl %eax, %eax
shlq $0x3, %rdi
leaq (%rdi,%rdi,4), %r14
movslq %r9d, %rdi
shlq $0x2, %rdi
subq %rdi, %r14
addq $0x1c, %r14
xorl %ebx, %ebx
movl 0x18(%rsp,%rbx,4), %edi
leaq (%r14,%rbx,4), %r10
movl %edi, (%r11,%r10)
incq %rbx
cmpq %rbx, %rax
jne 0x1ec4
decl %edx
decl %ecx
movq %r15, %rdi
jmp 0x1f2b
movl 0x10(%rsp), %ecx
movq 0x28(%rsp), %rax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rax
movl 0xc(%rsp), %r9d
movslq %r9d, %rdx
shlq $0x2, %rdx
subq %rdx, %rax
addq $0x1c, %rax
xorl %r10d, %r10d
movq 0x30(%rsp), %rdi
movl 0x18(%rsp,%r10,4), %edx
leaq (%rax,%r10,4), %r8
movl %edx, (%r11,%r8)
incq %r10
cmpq %r10, %r14
jne 0x1f0d
movl 0x14(%rsp), %edx
movl 0x8(%rsp), %r8d
callq 0x1d78
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
xorl %eax, %eax
retq