// File: /workspace/github_c_makefile_star2_O0/wuxb45[P]SLB/lib1.c
// Function: maptest_main
bool
maptest_main(int argc, char ** argv, int(*test_func)(const int, char ** const))
{
  if (argc < 4) {
    return false;
  }
  // perf
  char * const perf = getenv("MAP_TEST_PERF");
  if (perf && (strcmp(perf, "y") == 0)) {
    debug_perf_start();
  }

  if (strcmp(argv[1], "-") != 0) {
    const int fd1 = open(argv[1], O_CREAT | O_WRONLY | O_TRUNC, 00644);
    if (fd1 >= 0) {
      dup2(fd1, 1);
      close(fd1);
    }
  }

  if (strcmp(argv[2], "-") != 0) {
    const int fd2 = open(argv[2], O_CREAT | O_WRONLY | O_TRUNC, 00644);
    if (fd2 >= 0) {
      dup2(fd2, 2);
      close(fd2);
    }
  }
  // record args
  for (int i = 0; i < argc; i++) {
    fprintf(stderr, " %s", argv[i]);
  }
  fprintf(stderr, "\n");
  fflush(stderr);

  argc -= 3;
  argv += 3;

  while (argc > 0) {
    if (strcmp(argv[0], "api") != 0) {
      fprintf(stderr, "%s need `api' keyword to start benchmark\n", __func__);
      return false;
    }
    const int consume = test_func(argc, argv);
    if (consume < 0) {
      return false;
    }
    debug_assert(consume <= argc);
    argc -= consume;
    argv += consume;
  }
  debug_perf_stop();
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpl $0x4, -0x8(%rbp)
jge 0x17592
movb $0x0, -0x1(%rbp)
jmp 0x17786
leaq 0x4160(%rip), %rdi      # 0x1b6f9
callq 0x6030
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x175c3
movq -0x20(%rbp), %rdi
leaq 0x4153(%rip), %rsi      # 0x1b707
callq 0x62d0
cmpl $0x0, %eax
jne 0x175c3
callq 0x7870
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x4137(%rip), %rsi      # 0x1b709
callq 0x62d0
cmpl $0x0, %eax
je 0x17615
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x241, %esi            # imm = 0x241
movl $0x1a4, %edx            # imm = 0x1A4
movb $0x0, %al
callq 0x6440
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x17613
movl -0x24(%rbp), %edi
movl $0x1, %esi
callq 0x61a0
movl -0x24(%rbp), %edi
callq 0x6210
jmp 0x17615
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x40e5(%rip), %rsi      # 0x1b709
callq 0x62d0
cmpl $0x0, %eax
je 0x17667
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movl $0x241, %esi            # imm = 0x241
movl $0x1a4, %edx            # imm = 0x1A4
movb $0x0, %al
callq 0x6440
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jl 0x17665
movl -0x28(%rbp), %edi
movl $0x2, %esi
callq 0x61a0
movl -0x28(%rbp), %edi
callq 0x6210
jmp 0x17667
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x176a5
movq 0xa97b(%rip), %rax      # 0x21ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x4078(%rip), %rsi      # 0x1b70b
movb $0x0, %al
callq 0x62e0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1766e
movq 0xa94c(%rip), %rax      # 0x21ff8
movq (%rax), %rdi
leaq 0x40a2(%rip), %rsi      # 0x1b758
movb $0x0, %al
callq 0x62e0
movq 0xa934(%rip), %rax      # 0x21ff8
movq (%rax), %rdi
callq 0x6390
movl -0x8(%rbp), %eax
subl $0x3, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x10(%rbp)
cmpl $0x0, -0x8(%rbp)
jle 0x1777d
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x3e47(%rip), %rsi      # 0x1b540
callq 0x62d0
cmpl $0x0, %eax
je 0x17728
movq 0xa8ee(%rip), %rax      # 0x21ff8
movq (%rax), %rdi
leaq 0x3ffb(%rip), %rsi      # 0x1b70f
leaq 0x401e(%rip), %rdx      # 0x1b739
movb $0x0, %al
callq 0x62e0
movb $0x0, -0x1(%rbp)
jmp 0x17786
movq -0x18(%rbp), %rax
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq *%rax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jge 0x17744
movb $0x0, -0x1(%rbp)
jmp 0x17786
movl -0x30(%rbp), %eax
cmpl -0x8(%rbp), %eax
setle %al
movzbl %al, %edi
andl $0x1, %edi
callq 0x7640
movl -0x30(%rbp), %ecx
movl -0x8(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x8(%rbp)
movl -0x30(%rbp), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x176e1
callq 0x79c0
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)