// File: TooruAkagi[P]GCIS_Index/gcis_uni_locate.cpp
// Function: qrmload(int*, int, int, int*)
int qrmload(int *m,int c,int jo,int *anst){ //mの中に，english.001.2 の中からc文字をランダムに選択して保存する
    char chr;
    FILE *fp;
    long long int qsize = std::filesystem::file_size(qname);
    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("\nrlen[%d]から[%d]文字(%lld)\n[",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;}
        //printf("\n%x(%d)",m[i],i);
        //if(DEBUGFLAG==1){printf("%c",m[i]);}
    }
    printf("]");
    return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq 0x6370(%rip), %rsi      # 0xe210
leaq -0x60(%rbp), %rdi
movq %rdi, -0x88(%rbp)
movl $0x2, %edx
callq 0x9e50
movq -0x88(%rbp), %rdi
callq 0x2200
movq %rax, -0x80(%rbp)
jmp 0x7ec7
leaq -0x60(%rbp), %rdi
callq 0x9f30
movq -0x80(%rbp), %rax
movq %rax, -0x38(%rbp)
movq 0x6331(%rip), %rdi      # 0xe210
leaq 0x3155(%rip), %rsi      # 0xb03b
callq 0x21c0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x7f31
movq 0x6313(%rip), %rsi      # 0xe210
leaq 0x3139(%rip), %rdi      # 0xb03d
movb $0x0, %al
callq 0x2030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8026
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x9f30
jmp 0x8032
movl $0x0, -0x70(%rbp)
movl $0x0, 0x658e(%rip)      # 0xe4d0
callq 0x2060
cltq
movq -0x38(%rbp), %rcx
movslq -0x14(%rbp), %rdx
subq %rdx, %rcx
cqto
idivq %rcx
movl %edx, %eax
movl %eax, -0x74(%rbp)
cmpl $0x2, 0x61f7(%rip)      # 0xe15c
jne 0x7f70
movl 0x61fb(%rip), %eax      # 0xe168
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %edx
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x30(%rbp), %rdi
movslq -0x74(%rbp), %rsi
xorl %edx, %edx
callq 0x21b0
movl -0x74(%rbp), %esi
movl -0x14(%rbp), %edx
movq -0x38(%rbp), %rcx
leaq 0x3241(%rip), %rdi      # 0xb1df
movb $0x0, %al
callq 0x2030
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8012
movq -0x30(%rbp), %rdi
callq 0x2230
movb %al, -0x21(%rbp)
movsbl -0x21(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x70(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movsbl -0x21(%rbp), %eax
cmpl $0x0, %eax
jge 0x7fed
movsbl -0x21(%rbp), %edx
addl $0x100, %edx            # imm = 0x100
movq -0x10(%rbp), %rax
movslq -0x70(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movslq -0x70(%rbp), %rcx
cmpl $0xa, (%rax,%rcx,4)
jne 0x8005
movl $0x1, 0x64cb(%rip)      # 0xe4d0
jmp 0x8007
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x7fac
leaq 0x31a6(%rip), %rdi      # 0xb1bf
movb $0x0, %al
callq 0x2030
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x2250
nopl (%rax,%rax)