// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: kvmap_api_helper
int
kvmap_api_helper(int argc, char ** const argv, struct kvmap_api ** const out, struct kvmap_mm * const mm, const bool use_ucache)
{
  if (argc < 3 || strcmp(argv[0], "api") != 0) {
    return -1;
  }
  const u64 mb = strtoull(argv[1], NULL, 10);
  if (mb == 0) {
    // no icache
    return 2 + kvmap_api_helper_map(argc - 2, argv + 2, out, mm);
  }

  // index + icache
  struct icache * const cache = icache_create(NULL, mb);
  if (cache == NULL) {
    fprintf(stderr, "icache_create() failed\n");
    return -1;
  }
  icache_wrap_mm(cache, mm);
  struct kvmap_api * map_api = NULL;
  const int n1 = kvmap_api_helper_map(argc - 2, argv + 2, &map_api, mm);
  if (n1 < 0) {
    icache_destroy(cache);
    return -1;
  }
  struct kvmap_api * const icache_api = use_ucache ? ucache_api_create(cache) : icache_api_create(cache);
  if (icache_api == NULL) {
    kvmap_api_destroy(map_api);
    icache_destroy(cache);
    return -1;
  }
  icache_wrap_kvmap(cache, map_api);
  *out = icache_api;
  return 2 + n1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0x3, %edi
jl 0xbe3a
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %rbx
movl %edi, %r15d
movl %r8d, -0x2c(%rbp)
movq (%rsi), %rdi
leaq 0x988e(%rip), %rsi      # 0x15508
callq 0x62f0
testl %eax, %eax
jne 0xbe3a
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x62c0
testq %rax, %rax
je 0xbe10
movq %r12, -0x38(%rbp)
xorl %edi, %edi
movq %rax, %rsi
callq 0xbfab
testq %rax, %rax
je 0xbe4c
movq %rax, %r12
vmovups (%r13), %ymm0
vmovups 0x20(%r13), %ymm1
vmovups 0x30(%r13), %ymm2
vmovups %ymm2, 0x80(%rax)
vmovups %ymm1, 0x70(%rax)
vmovups %ymm0, 0x50(%rax)
cmpq $0x0, 0x10(%r13)
je 0xbd03
leaq 0x632b(%rip), %rax      # 0x12017
movq %rax, 0x10(%r13)
movq %r12, 0x18(%r13)
leaq 0x63cf(%rip), %rax      # 0x120ca
movq %rax, 0x30(%r13)
movq %r12, 0x38(%r13)
leaq 0x6479(%rip), %rax      # 0x12183
movq %rax, 0x20(%r13)
movq %r12, 0x28(%r13)
leaq 0x647d(%rip), %rax      # 0x12196
movq %rax, 0x40(%r13)
movq %r12, 0x48(%r13)
leaq -0x40(%rbp), %rdx
movq $0x0, (%rdx)
addl $-0x2, %r15d
addq $0x10, %rbx
movl %r15d, %edi
movq %rbx, %rsi
movq %r13, %rcx
vzeroupper
callq 0xbe53
testl %eax, %eax
js 0xbe32
movl %eax, %r14d
movl $0x58, %edi
callq 0x63a0
movq %r12, (%rax)
leaq 0x655e(%rip), %rcx      # 0x122c2
leaq 0x572f(%rip), %rdx      # 0x1149a
cmpb $0x0, -0x2c(%rbp)
cmovneq %rcx, %rdx
leaq 0x6734(%rip), %rcx      # 0x124ae
leaq 0x592d(%rip), %rsi      # 0x116ae
cmovneq %rcx, %rsi
leaq 0x6843(%rip), %rcx      # 0x125cf
leaq 0x5a72(%rip), %rdi      # 0x11805
cmovneq %rcx, %rdi
leaq 0x6846(%rip), %rcx      # 0x125e4
leaq 0x5abd(%rip), %r8       # 0x11862
cmovneq %rcx, %r8
movq %rdx, 0x8(%rax)
movq %rsi, 0x10(%rax)
movq %rdi, 0x18(%rax)
movq %r8, 0x20(%rax)
leaq 0x5aff(%rip), %rcx      # 0x118bf
movq %rcx, 0x28(%rax)
leaq 0x370(%rip), %rcx       # 0xc13b
movq %rcx, 0x30(%rax)
leaq 0x5b8e(%rip), %rcx      # 0x11964
movq %rcx, 0x38(%rax)
leaq 0x5c14(%rip), %rcx      # 0x119f5
movq %rcx, 0x40(%rax)
leaq 0x5c48(%rip), %rcx      # 0x11a34
movq %rcx, 0x48(%rax)
leaq 0x5c5d(%rip), %rcx      # 0x11a54
movq %rcx, 0x50(%rax)
movq -0x40(%rbp), %rcx
movq %rcx, 0x10150(%r12)
movq -0x38(%rbp), %rcx
movq %rax, (%rcx)
jmp 0xbe2c
addl $-0x2, %r15d
addq $0x10, %rbx
movl %r15d, %edi
movq %rbx, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0xbe53
movl %eax, %r14d
addl $0x2, %r14d
jmp 0xbe3a
movq %r12, %rdi
callq 0xc13b
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6b5d
jmp 0xbe3a