// File: TooruAkagi[P]GCIS_Index/gcis_uni_locate.cpp
// Function: bitload(bool*, unsigned char, int, int)
int bitload(bool *ar,unsigned char a2,int p,int mx){
    int a = a2;
    //if(mote==1){printf("<%d>",a);}
    ar[p+0] = a/128;a-=ar[p+0]*128;
    //if(mote==1){printf("<%d>",a);}
    if(p+1<mx){ar[p+1] = a/64;a-=ar[p+1]*64;}else{return -1;}
    //if(mote==1){printf("<%d>",a);}
    if(p+2<mx){ar[p+2] = a/32;a-=ar[p+2]*32;}else{return -1;}
    //if(mote==1){printf("<%d>",a);}
    if(p+3<mx){ar[p+3] = a/16;a-=ar[p+3]*16;}else{return -1;}
    //if(mote==1){printf("<%d>",a);}
    //if(mx-5<=p && mx< 120000 && mx > 90000){printf(" / %d < %d(%d) / ",p+4,mx,ar[p+4]);exit(5);}
    if(p+4<mx){ar[p+4] = a/8;a-=ar[p+4]*8;}else{return -1;}
    //if(mote==1){printf("<%d>",a);}
    //if(mx-5<=p && mx< 120000 && mx > 90000){printf(" / %d < %d(%d) / ",p+4,mx,ar[p+4]);exit(5);} 
    if(p+5<mx){ar[p+5] = a/4;a-=ar[p+5]*4;}else{return -1;}
    //if(mote==1){printf("<%d>",a);}
    if(p+6<mx){ar[p+6] = a/2;a-=ar[p+6]*2;}else{return -1;}
    //if(mote==1){printf("<%d>",a);}
    if(p+7<mx){ar[p+7] = a/1;a-=ar[p+7]*1;}else{return -1;}
    //if(mote==1){printf("<%d>",a);}
    if(p+8>=mx){return -1;}
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movzbl -0x11(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl $0x80, %ecx
cltd
idivl %ecx
cmpl $0x0, %eax
setne %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
andb $0x1, %dl
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %ecx
shll $0x7, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
cmpl -0x1c(%rbp), %eax
jge 0x80f0
movl -0x20(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cmpl $0x0, %eax
setne %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
andb $0x1, %dl
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %ecx
shll $0x6, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x80fc
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x833e
movl -0x18(%rbp), %eax
addl $0x2, %eax
cmpl -0x1c(%rbp), %eax
jge 0x814d
movl -0x20(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
cmpl $0x0, %eax
setne %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
andb $0x1, %dl
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %ecx
shll $0x5, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x8159
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x833e
movl -0x18(%rbp), %eax
addl $0x3, %eax
cmpl -0x1c(%rbp), %eax
jge 0x81aa
movl -0x20(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
cmpl $0x0, %eax
setne %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
andb $0x1, %dl
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %ecx
shll $0x4, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x81b6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x833e
movl -0x18(%rbp), %eax
addl $0x4, %eax
cmpl -0x1c(%rbp), %eax
jge 0x8207
movl -0x20(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %eax
setne %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
andb $0x1, %dl
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %ecx
shll $0x3, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x8213
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x833e
movl -0x18(%rbp), %eax
addl $0x5, %eax
cmpl -0x1c(%rbp), %eax
jge 0x8264
movl -0x20(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl $0x0, %eax
setne %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x5, %ecx
movslq %ecx, %rcx
andb $0x1, %dl
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x5, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %ecx
shll $0x2, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x8270
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x833e
movl -0x18(%rbp), %eax
addl $0x6, %eax
cmpl -0x1c(%rbp), %eax
jge 0x82c0
movl -0x20(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %eax
setne %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x6, %ecx
movslq %ecx, %rcx
andb $0x1, %dl
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x6, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %ecx
shll %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x82c9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x833e
movl -0x18(%rbp), %eax
addl $0x7, %eax
cmpl -0x1c(%rbp), %eax
jge 0x831a
movl -0x20(%rbp), %eax
movl $0x1, %ecx
cltd
idivl %ecx
cmpl $0x0, %eax
setne %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x7, %ecx
movslq %ecx, %rcx
andb $0x1, %dl
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x7, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %ecx
shll $0x0, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x8323
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x833e
movl -0x18(%rbp), %eax
addl $0x8, %eax
cmpl -0x1c(%rbp), %eax
jl 0x8337
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x833e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)