// File: gpertea[P]gclib/htest.cpp
// Function: run_Khashl(GResUsage&, GPVec<HStrData>&, char const*)
void run_Khashl(GResUsage& swatch, GPVec<HStrData> & hstrs, const char* label) {
  int num_add=0, num_rm=0, num_clr=0;
  klib::KHashMapCached<const char*, int, cstr_hash, cstr_eq > khmap;
  GMessage("----------------- %s ----------------\n", label);
  swatch.start();
  int cl_i=0;
  int prevcmd=2;
  for (int i=0;i<hstrs.Count();i++) {
	  if (hstrs[i]->cmd==prevcmd) {
		  if (prevcmd==2) continue;
	  } else prevcmd=hstrs[i]->cmd;
	  switch (hstrs[i]->cmd) {
		case 0:if (cl_i==0) cl_i=i;
			khmap[hstrs[i]->str.chars()]=i; num_add++; break;
		case 1:if (qryMode) break;
			khmap.del(khmap.get(hstrs[i]->str.chars())); num_rm++; break;
		case 2:
			if (qryMode) {
				//run some query tests here
				for(int j=cl_i;j<i;j+=3) {
					if (hstrs[j]->cmd) continue;
					int v=khmap[hstrs[j]->str.chars()];
					if (v!=j)
						GError("Error at <%s>, invalid value for key %s!\n",label, hstrs[j]->str.chars() );
				}
			}
			cl_i=0;
			khmap.clear(); num_clr++; break;
	  }
  }
  swatch.stop();
  khmap.clear();
  GMessage("  (%d inserts, %d deletions, %d clears)\n", num_add, num_rm, num_clr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x10a80
movq -0x18(%rbp), %rsi
leaq 0x66b1(%rip), %rdi      # 0x144d1
xorl %eax, %eax
callq 0x26f0
jmp 0xde29
movq -0x8(%rbp), %rdi
callq 0xcf80
jmp 0xde34
movl $0x0, -0x50(%rbp)
movl $0x2, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10250
movl %eax, -0x7c(%rbp)
jmp 0xde5d
movl -0x80(%rbp), %eax
movl -0x7c(%rbp), %ecx
cmpl %ecx, %eax
jge 0xe174
movq -0x10(%rbp), %rdi
movl -0x58(%rbp), %esi
callq 0x10270
movq %rax, -0x88(%rbp)
jmp 0xde80
movq -0x88(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
cmpl -0x54(%rbp), %eax
jne 0xdeb8
cmpl $0x2, -0x54(%rbp)
jne 0xdeb6
jmp 0xe166
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x10cf0
jmp 0xe1b5
jmp 0xdedc
movq -0x10(%rbp), %rdi
movl -0x58(%rbp), %esi
callq 0x10270
movq %rax, -0x90(%rbp)
jmp 0xdecd
movq -0x90(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rdi
movl -0x58(%rbp), %esi
callq 0x10270
movq %rax, -0x98(%rbp)
jmp 0xdef1
movq -0x98(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x9c(%rbp)
testl %eax, %eax
je 0xdf2e
jmp 0xdf09
movl -0x9c(%rbp), %eax
subl $0x1, %eax
je 0xdfaf
jmp 0xdf1a
movl -0x9c(%rbp), %eax
subl $0x2, %eax
je 0xe02d
jmp 0xe164
cmpl $0x0, -0x50(%rbp)
jne 0xdf3a
movl -0x58(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x58(%rbp), %esi
movl %esi, -0xac(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10270
movq %rax, -0xa8(%rbp)
jmp 0xdf55
movq -0xa8(%rbp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0xb610
movq %rax, -0xb8(%rbp)
jmp 0xdf71
movq -0xb8(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x10aa0
movq %rax, -0xc0(%rbp)
jmp 0xdf92
movq -0xc0(%rbp), %rax
movl -0xac(%rbp), %ecx
movl %ecx, (%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xe164
testb $0x1, 0xc2b3(%rip)      # 0x1a269
je 0xdfbd
jmp 0xe164
movq -0x10(%rbp), %rdi
movl -0x58(%rbp), %esi
callq 0x10270
movq %rax, -0xc8(%rbp)
jmp 0xdfd2
movq -0xc8(%rbp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0xb610
movq %rax, -0xd0(%rbp)
jmp 0xdfee
movq -0xd0(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x10c40
movl %eax, -0xd4(%rbp)
jmp 0xe00e
movl -0xd4(%rbp), %esi
leaq -0x40(%rbp), %rdi
callq 0x10b00
jmp 0xe01f
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xe164
testb $0x1, 0xc235(%rip)      # 0x1a269
je 0xe149
movl -0x50(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x58(%rbp), %eax
jge 0xe147
movq -0x10(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x10270
movq %rax, -0xe0(%rbp)
jmp 0xe061
movq -0xe0(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
je 0xe075
jmp 0xe139
movq -0x10(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x10270
movq %rax, -0xe8(%rbp)
jmp 0xe08a
movq -0xe8(%rbp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0xb610
movq %rax, -0xf0(%rbp)
jmp 0xe0a6
movq -0xf0(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x10aa0
movq %rax, -0xf8(%rbp)
jmp 0xe0c7
movq -0xf8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x6c(%rbp), %eax
je 0xe137
movq -0x18(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x10(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x10270
movq %rax, -0x100(%rbp)
jmp 0xe0fb
movq -0x100(%rbp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0xb610
movq %rax, -0x110(%rbp)
jmp 0xe117
movq -0x110(%rbp), %rdx
movq -0x108(%rbp), %rsi
leaq 0x6408(%rip), %rdi      # 0x14534
xorl %eax, %eax
callq 0x2640
jmp 0xe135
jmp 0xe137
jmp 0xe139
movl -0x6c(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x6c(%rbp)
jmp 0xe040
jmp 0xe149
movl $0x0, -0x50(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x10c90
jmp 0xe15b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xe166
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xde49
movq -0x8(%rbp), %rdi
callq 0xd060
jmp 0xe17f
leaq -0x40(%rbp), %rdi
callq 0x10c90
jmp 0xe18a
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
movl -0x24(%rbp), %ecx
leaq 0x63c4(%rip), %rdi      # 0x1455e
xorl %eax, %eax
callq 0x26f0
jmp 0xe1a3
leaq -0x40(%rbp), %rdi
callq 0x10cf0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x2400
nop