// File: TooruAkagi[P]GCIS_Index/gcis_nep_locate.cpp
// Function: qrmload(int, int, int*)
int qrmload(int c,int jo,int *anst){ //mの中に，english.001.2 の中からc文字をランダムに選択して保存する
    char chr;FILE *fp;
    long long int qsize = std::filesystem::file_size(qname); //qsizeには，ファイルのサイズが書かれているはず
    fp = fopen(qname, "r"); // open file or return null
    if(fp == NULL) {
        printf("%s such file doesn't exist!\n", qname);
        return -1;
    }
    int i = 0;
    jswt = 0;
    int rlen = rand()%(qsize-c);
    if(runmode==2){rlen = qstart;}
    anst[jo] = rlen;
    fseek(fp,rlen,SEEK_SET); //指定したシークまで移動する
    printf("\nquery%d : [%lld]rlen[%d]から[%d]文字(%lld)\n[",jo,qsize,rlen,c,qsize);
    if(CHECKFLAG == 1){checkpz[0]=rlen;checkpz[1]=c;}
    for(i=0;i<c;i++) { //c文字
        chr = fgetc(fp);
        m[i] = chr;
        if(chr<0){m[i]=chr + 256;}
        if(m[i]==10){jswt=1;}
        if(DEBUGFLAG==1){printf("%c",chr);}
    }
    printf("]");
    return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x52c4(%rip), %rsi      # 0xc180
leaq -0x58(%rbp), %rdi
movq %rdi, -0x80(%rbp)
movl $0x2, %edx
callq 0x84e0
movq -0x80(%rbp), %rdi
callq 0x21b0
movq %rax, -0x78(%rbp)
jmp 0x6edd
leaq -0x58(%rbp), %rdi
callq 0x84b0
movq -0x78(%rbp), %rax
movq %rax, -0x30(%rbp)
movq 0x528b(%rip), %rdi      # 0xc180
leaq 0x215f(%rip), %rsi      # 0x905b
callq 0x2170
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x6f47
movq 0x526d(%rip), %rsi      # 0xc180
leaq 0x2143(%rip), %rdi      # 0x905d
movb $0x0, %al
callq 0x2030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x704d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x84b0
jmp 0x7059
movl $0x0, -0x68(%rbp)
movl $0x0, 0x67c0(%rip)      # 0xd718
callq 0x2060
cltq
movq -0x30(%rbp), %rcx
movslq -0x8(%rbp), %rdx
subq %rdx, %rcx
cqto
idivq %rcx
movl %edx, %eax
movl %eax, -0x6c(%rbp)
cmpl $0x2, 0x51c5(%rip)      # 0xc140
jne 0x6f86
movl 0x51c9(%rip), %eax      # 0xc14c
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x28(%rbp), %rdi
movslq -0x6c(%rbp), %rsi
xorl %edx, %edx
callq 0x2160
movl -0xc(%rbp), %esi
movq -0x30(%rbp), %rdx
movl -0x6c(%rbp), %ecx
movl -0x8(%rbp), %r8d
movq -0x30(%rbp), %r9
leaq 0x2222(%rip), %rdi      # 0x91de
movb $0x0, %al
callq 0x2030
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x7039
movq -0x28(%rbp), %rdi
callq 0x21e0
movb %al, -0x19(%rbp)
movsbl -0x19(%rbp), %edx
movq 0x6737(%rip), %rax      # 0xd720
movslq -0x68(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movsbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jge 0x7011
movsbl -0x19(%rbp), %edx
addl $0x100, %edx            # imm = 0x100
movq 0x6716(%rip), %rax      # 0xd720
movslq -0x68(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x6708(%rip), %rax      # 0xd720
movslq -0x68(%rbp), %rcx
cmpl $0xa, (%rax,%rcx,4)
jne 0x702c
movl $0x1, 0x66ec(%rip)      # 0xd718
jmp 0x702e
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x6fca
leaq 0x2153(%rip), %rdi      # 0x9193
movb $0x0, %al
callq 0x2030
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x21f0
nopw %cs:(%rax,%rax)