// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
cmpl $0x1, -0x20(%rbp)
jge 0x3610
movl $0x0, -0x4(%rbp)
jmp 0x380f
movq 0x60a9(%rip), %rax      # 0x96c0
movq %rax, -0x34(%rbp)
movl 0x60a7(%rip), %eax      # 0x96c8
movl %eax, -0x2c(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
cmpl $0x1, -0x1c(%rbp)
jle 0x364e
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0xa068(%rip), %rax      # 0xd6b0
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0x9b27(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x7, %ecx
subl -0x28(%rbp), %ecx
movslq %ecx, %rcx
cmpl $-0x1, (%rax,%rcx,4)
jle 0x37a6
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x37a4
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rdx
leaq 0x9ae9(%rip), %rcx      # 0xd180
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movl $0x7, %edx
subl -0x28(%rbp), %edx
addl -0x40(%rbp), %edx
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rsi
leaq 0x9ab8(%rip), %rdx      # 0xd180
imulq $0x28, %rsi, %rsi
addq %rsi, %rdx
movl $0x7, %esi
subl -0x28(%rbp), %esi
addl -0x40(%rbp), %esi
movslq %esi, %rsi
movl (%rdx,%rsi,4), %edx
addl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x3794
movl -0x3c(%rbp), %ecx
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rdx
addl (%rax,%rdx,4), %ecx
movslq -0x38(%rbp), %rax
movl %ecx, -0x34(%rbp,%rax,4)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x3784
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x375b
movslq -0x48(%rbp), %rax
movl -0x34(%rbp,%rax,4), %edx
movslq -0x24(%rbp), %rcx
leaq 0x9a48(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x7, %ecx
subl -0x28(%rbp), %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x371d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
subl $0x1, %edx
movl -0x20(%rbp), %ecx
subl $0x1, %ecx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
callq 0x35e0
movl %eax, -0x4(%rbp)
jmp 0x380f
jmp 0x3786
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x36b6
jmp 0x3796
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x367c
jmp 0x37a6
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x37eb
movslq -0x4c(%rbp), %rax
movl -0x34(%rbp,%rax,4), %edx
movslq -0x24(%rbp), %rcx
leaq 0x99b8(%rip), %rax      # 0xd180
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x7, %ecx
subl -0x28(%rbp), %ecx
addl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x37ad
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
subl $0x1, %edx
movl -0x20(%rbp), %ecx
subl $0x1, %ecx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
callq 0x35e0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)