// File: jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: DisassemblyCache::initialize(int, int)
void DisassemblyCache::initialize (int4 min, int4 hashsize)

{
    minimumreuse = min;
    mask = hashsize - 1;
    uintb masktest = coveringmask ((uintb)mask);
    if (masktest != (uintb)mask) // -hashsize- must be a power of 2
        throw LowlevelError ("Bad windowsize for disassembly cache");
    list = new ParserContext*[minimumreuse];
    nextfree = 0;
    hashtable = new ParserContext*[hashsize];
    for (int4 i = 0; i < minimumreuse; ++i) {
        ParserContext* pos = new ParserContext (contextcache);
        pos->initialize (75, 20, constspace);
        list[i] = pos;
    }
    // Make sure all hashtable positions point to a real ParserContext
    ParserContext* pos = list[0];
    for (int4 i = 0; i < hashsize; ++i)
        hashtable[i] = pos;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movl %esi, 0x8c(%rsp)
movl %edx, 0x88(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x20(%rsp)
movl 0x8c(%rsp), %ecx
movl %ecx, 0x10(%rax)
movl 0x88(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, 0x14(%rax)
movl 0x14(%rax), %eax
movl %eax, %edi
callq 0xd0f20
movq 0x20(%rsp), %rcx
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movl 0x14(%rcx), %ecx
cmpq %rcx, %rax
je 0x11bc64
movb $0x1, 0x4b(%rsp)
movl $0x20, %edi
callq 0xd2b40
movq %rax, 0x10(%rsp)
leaq 0x5f(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xe0c80
movq 0x18(%rsp), %rdx
leaq 0x6c8d7(%rip), %rsi     # 0x1884b2
leaq 0x60(%rsp), %rdi
callq 0xe00a0
jmp 0x11bbe7
movq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0xd1ae0
jmp 0x11bbf8
movq 0x10(%rsp), %rdi
movb $0x0, 0x4b(%rsp)
movq 0xac287(%rip), %rsi     # 0x1c7e90
movq 0xabfc0(%rip), %rdx     # 0x1c7bd0
callq 0xe01f0
jmp 0x11bddd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x50(%rsp)
movl %eax, 0x4c(%rsp)
jmp 0x11bc42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x50(%rsp)
movl %eax, 0x4c(%rsp)
leaq 0x60(%rsp), %rdi
callq 0xd4550
leaq 0x5f(%rsp), %rdi
callq 0xd8ec0
testb $0x1, 0x4b(%rsp)
jne 0x11bc55
jmp 0x11bc5f
movq 0x10(%rsp), %rdi
callq 0xd5400
jmp 0x11bdd3
movq 0x20(%rsp), %rax
movslq 0x10(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xce140
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, 0x20(%rax)
movslq 0x88(%rsp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xce140
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x28(%rax)
movl $0x0, 0x44(%rsp)
movq 0x20(%rsp), %rcx
movl 0x44(%rsp), %eax
cmpl 0x10(%rcx), %eax
jge 0x11bd81
movl $0xa8, %edi
callq 0xd8380
movq %rax, %rdi
movq 0x20(%rsp), %rax
movq %rdi, %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rsi
callq 0xde910
jmp 0x11bd14
movq 0x20(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, 0x38(%rsp)
movq 0x38(%rsp), %rdi
movq 0x8(%rax), %rcx
movl $0x4b, %esi
movl $0x14, %edx
callq 0xd91f0
movq 0x20(%rsp), %rax
movq 0x38(%rsp), %rdx
movq 0x18(%rax), %rax
movslq 0x44(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x11bcde
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x50(%rsp)
movl %eax, 0x4c(%rsp)
movl $0xa8, %esi
callq 0xd8620
jmp 0x11bdd3
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x88(%rsp), %eax
jge 0x11bdcb
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %rdx
movq 0x28(%rax), %rax
movslq 0x2c(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x11bd9a
addq $0x98, %rsp
retq
movq 0x50(%rsp), %rdi
callq 0xe0be0
nopl (%rax)