// File: /workspace/github_c_makefile_star2_O0/redis-force[P]rpm/module/rpm_hashmap.c
// Function: hash_map_remove_internal
static int32_t
hash_map_remove_internal(hash_map *map, const void *key, size_t ksiz, uint8_t call_free)
{
  size_t hash, index, table;
  hash_map_entry *entry, *prev;
  hash_table *hash_table;

  if (map->tables[0].size == 0) {
    return -1;
  }
  if (HASH_MAP_IS_REHASHING(map)) {
    hash_map_rehash_step(map, 1);
  }

  hash = HASH_MAP_HASH_CODE(map, key, ksiz);
  for (table = 0; table <= 1; ++table) {
    hash_table = &map->tables[table];
    index = hash & hash_table->size_mask;
    entry = hash_table->buckets[index];
    prev = NULL;
    while (entry) {
      if (HASH_MAP_COMPARE_KEYS(map, entry->key, entry->ksize, key, ksiz)) {
        if (prev) {
          prev->next = entry->next;
        } else {
          hash_table->buckets[index] = entry->next;
        }

        if (call_free) {
          HASH_MAP_ENTRY_FREE_KEY(map, entry);
          HASH_MAP_ENTRY_FREE_VALUE(map, entry);
        }
        HASH_MAP_FREE(map, entry);
        hash_table->used--;
        return 0;
      }
      prev = entry;
      entry = entry->next;
    }
    if (!HASH_MAP_IS_REHASHING(map)) {
      break;
    }
  }

  return -1;
}

// Assembly:
subq $0x58, %rsp
movb %cl, %al
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movb %al, 0x37(%rsp)
movq 0x48(%rsp), %rax
cmpq $0x0, 0x50(%rax)
jne 0x9f22
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
jmp 0xa12f
movq 0x48(%rsp), %rax
cmpq $-0x1, 0x88(%rax)
je 0x9f40
movq 0x48(%rsp), %rdi
movl $0x1, %esi
callq 0x9850
movq 0x48(%rsp), %rax
movq (%rax), %rax
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq *%rax
movl %eax, %eax
movq %rax, 0x28(%rsp)
movq $0x0, 0x18(%rsp)
cmpq $0x1, 0x18(%rsp)
ja 0xa127
movq 0x48(%rsp), %rax
addq $0x48, %rax
movq 0x18(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, (%rsp)
movq 0x28(%rsp), %rax
movq (%rsp), %rcx
andq 0x10(%rcx), %rax
movq %rax, 0x20(%rsp)
movq (%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0xa101
movq 0x48(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0xa00b
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x48(%rsp), %rdi
movq 0x10(%rsp), %rcx
movq (%rcx), %rsi
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rdx
movq 0x40(%rsp), %rcx
movq 0x38(%rsp), %r8
callq *%rax
cmpl $0x0, %eax
je 0xa01e
jmp 0xa0e4
movq 0x10(%rsp), %rax
movq (%rax), %rax
cmpq 0x40(%rsp), %rax
jne 0xa0e4
cmpq $0x0, 0x8(%rsp)
je 0xa03a
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x20(%rax)
jmp 0xa053
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rdx
movq (%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpb $0x0, 0x37(%rsp)
je 0xa0b7
movq 0x48(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0xa087
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x48(%rsp), %rdi
movq 0x10(%rsp), %rcx
movq (%rcx), %rsi
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rdx
callq *%rax
movq 0x48(%rsp), %rax
cmpq $0x0, 0x28(%rax)
je 0xa0b5
movq 0x48(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x48(%rsp), %rdi
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rsi
movq 0x10(%rsp), %rcx
movq 0x18(%rcx), %rdx
callq *%rax
jmp 0xa0b7
movq 0x48(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x5040
movq (%rsp), %rax
movq 0x18(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x18(%rax)
movl $0x0, 0x54(%rsp)
jmp 0xa12f
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x9fbe
movq 0x48(%rsp), %rax
cmpq $-0x1, 0x88(%rax)
jne 0xa112
jmp 0xa127
jmp 0xa114
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x9f69
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax,%rax)