// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: maptest_pass
int
maptest_pass(const int argc, char ** const argv, char ** const pref, struct pass_info * const pi)
{
  if ((argc < 10) || (strcmp(argv[0], "pass") != 0)) return -1;

  const u64 c = strtoull(argv[1], NULL, 10);
  const u64 cc = c ? c : process_affinity_core_count();
  const u64 end_type = strtoull(argv[2], NULL, 10);
  const u64 magic = strtoull(argv[3], NULL, 10);
  const u64 rep = strtoull(argv[4], NULL, 10);
  const u64 vlen = strtoull(argv[5], NULL, 10);
  const u64 pset = strtoull(argv[6], NULL, 10);
  const u64 pdel = strtoull(argv[7], NULL, 10);
  const u64 pget = strtoull(argv[8], NULL, 10);
  const u64 rgen_opt = strtoull(argv[9], NULL, 10);
  if (end_type > 1) return -1;

  const u64 nr_cores = process_affinity_core_count();
  u64 cores[nr_cores];
  process_affinity_core_list(nr_cores, cores);
  struct damp * const damp = damp_create(7, 0.004, 0.05);
  struct maptest_papi_info * const papi_info = maptest_papi_prepare();

  char out[1024] = {};
  // per-worker data
  struct maptest_worker_info info[cc];
  struct maptest_worker_info *infov[cc];
  rgen_next_func next_func = (rgen_opt == MAPTEST_GEN_OPT_NOWAIT) ? rgen_next_nowait : rgen_next_wait;
  for (u64 i = 0; i < cc; i++) {
    memset(&(info[i]), 0, sizeof(info[i]));
    infov[i] = &(info[i]);
    info[i].thread_func = pi->wf;
    info[i].api = pi->api;
    info[i].gen = rgen_dup(pi->gen0);
    info[i].rgen_next = next_func;
    info[i].seed = ((i >> 2) + 73) * 17 * 117;
    info[i].vlen = vlen;
    info[i].pset = pset;
    info[i].pdel = pset + pdel;
    info[i].pget = pset + pdel + pget;
    info[i].end_type = end_type;
    if (end_type == MAPTEST_END_COUNT) {
      info[i].end_magic = magic;
    }
    info[i].vctr = vctr_create(pi->vctr_size);
    if (papi_info) {
      info[i].papi_info = papi_info;
      info[i].papi_vctr = vctr_create(papi_info->nr);
    }

    if (rgen_opt == MAPTEST_GEN_OPT_WAIT) {
      const bool rconv = rgen_async_convert(info[i].gen, cores[i % nr_cores] + 1);
      (void)rconv;
      debug_assert(rconv);
    } else if (rgen_opt == MAPTEST_GEN_OPT_NOWAIT) {
      const bool rconv = rgen_async_convert(info[i].gen, cores[i % nr_cores] + 1);
      (void)rconv;
      debug_assert(rconv);
    }
  }

  bool done = false;
  const double t0 = time_sec();
  // until: rep times, or done determined by damp
  for (u64 r = 0; rep ? (r < rep) : (done == false); r++) {
    // prepare
    const double dt1 = time_diff_sec(t0);
    for (u64 i = 0; i < cc; i++) {
      vctr_reset(info[i].vctr);
      if (info[i].papi_vctr) vctr_reset(info[i].papi_vctr);
      rgen_async_wait_all(info[i].gen);
    }

    // set end-time
    if (end_type == MAPTEST_END_TIME) {
      const u64 end_time = time_nsec() + (UINT64_C(1000000000) * magic);
      for (u64 i = 0; i < cc; i++) {
        info[i].end_magic = end_time;
      }
    }

    const double dt = thread_fork_join_private(cc, maptest_thread_func, (void **)infov);
    struct vctr * const va = vctr_create(pi->vctr_size);
    for (u64 i = 0; i < cc; i++) vctr_merge(va, infov[i]->vctr);
    done = pi->af(va, dt, damp, out);
    vctr_destroy(va);

    maptest_papi_report(papi_info, infov, cc, stderr);

    // stderr messages
    fprintf(stderr, " try %"PRIu64" %.2lf %.2lf ", r, dt1, dt);
    for (int i = 0; pref[i]; i++) fprintf(stderr, "%s ", pref[i]);
    for (int i = 0; i < 10; i++) fprintf(stderr, "%s ", argv[i]);
    fprintf(stderr, "%s", out);
    fflush(stderr);
  }

  // clean up
  damp_destroy(damp);
  if (papi_info) free(papi_info);
  for (u64 i = 0; i < cc; i++) {
    rgen_destroy(info[i].gen);
    vctr_destroy(info[i].vctr);
    if (info[i].papi_vctr) vctr_destroy(info[i].papi_vctr);
  }

  // done messages
  for (int i = 0; pref[i]; i++) fprintf(stdout, "%s ", pref[i]);
  for (int i = 0; i < 10; i++) fprintf(stdout, "%s ", argv[i]);
  fprintf(stdout, "%s", out);
  fflush(stdout);
  return 10;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x488, %rsp            # imm = 0x488
movq %rcx, -0x58(%rbp)
pushq $-0x1
popq %rbx
cmpl $0xa, %edi
jl 0x102f3
movq %rdx, %r15
movq %rsi, %r12
movq (%rsi), %rdi
leaq 0x2805(%rip), %rsi      # 0x125c8
callq 0x62f0
testl %eax, %eax
jne 0x102f3
movq 0x8(%r12), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x62c0
movq %rax, %r14
testq %rax, %rax
jne 0xfdef
callq 0x760d
movq %rax, %r14
movq 0x10(%r12), %rdi
pushq $0xa
popq %r13
xorl %esi, %esi
movl %r13d, %edx
callq 0x62c0
movq %rax, -0x78(%rbp)
movq 0x18(%r12), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x62c0
movq %rax, -0xa0(%rbp)
movq 0x20(%r12), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x62c0
movq %rax, -0xb0(%rbp)
movq 0x28(%r12), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x62c0
movq %rax, -0x70(%rbp)
movq 0x30(%r12), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x62c0
movq %rax, -0x30(%rbp)
movq 0x38(%r12), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x62c0
movq %rax, -0x38(%rbp)
movq 0x40(%r12), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x62c0
movq %rax, -0x50(%rbp)
movq 0x48(%r12), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x62c0
cmpq $0x1, -0x78(%rbp)
ja 0x102f3
movq %r12, -0x98(%rbp)
movq %r15, -0x90(%rbp)
movq %rax, %r12
callq 0x760d
movq %rax, %rdi
movq %rsp, -0xa8(%rbp)
movq %rsp, %rsi
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %rsi
movq %rsi, %rsp
movq %rdi, -0x48(%rbp)
movq %rsi, -0x40(%rbp)
callq 0x76b2
pushq $0x7
popq %rdi
vmovsd 0x21db(%rip), %xmm0     # 0x120c0
vmovsd 0x21db(%rip), %xmm1     # 0x120c8
callq 0x8dd3
movq %rax, -0x80(%rbp)
leaq -0x4b0(%rbp), %rdi
xorl %ebx, %ebx
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x6210
movq %rsp, %r13
imulq $0x78, %r14, %rax
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r13
movq %r13, %rsp
movq %rsp, %r15
leaq 0xf(,%r14,8), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movq %r12, -0x68(%rbp)
cmpq $0x2, %r12
leaq -0x64c6(%rip), %rax     # 0x9a7e
leaq -0x64d4(%rip), %rcx     # 0x9a77
cmoveq %rax, %rcx
movq %rcx, -0x60(%rbp)
movq -0x30(%rbp), %r12
movq -0x38(%rbp), %rax
addq %r12, %rax
movq %rax, -0x38(%rbp)
addq %rax, -0x50(%rbp)
movq %r13, -0x88(%rbp)
cmpq %rbx, %r14
je 0x10065
vxorpd %xmm0, %xmm0, %xmm0
vmovupd %ymm0, 0x50(%r13)
vmovupd %ymm0, 0x30(%r13)
vmovupd %ymm0, 0x10(%r13)
andq $0x0, 0x70(%r13)
movq %r13, (%r15,%rbx,8)
movq -0x58(%rbp), %rcx
movq 0x18(%rcx), %rax
movq %rax, (%r13)
movq 0x8(%rcx), %rax
movq %rax, 0x8(%r13)
movq (%rcx), %rdi
vzeroupper
callq 0x9eff
movq %rbx, %rcx
shrq $0x2, %rcx
imulq $0x7c5, %rcx, %rcx      # imm = 0x7C5
addq $0x2372d, %rcx          # imm = 0x2372D
movq %rax, 0x10(%r13)
movq -0x60(%rbp), %rax
movq %rax, 0x18(%r13)
movq %rcx, 0x20(%r13)
movq -0x70(%rbp), %rax
movq %rax, 0x28(%r13)
movq %r12, 0x30(%r13)
movq -0x38(%rbp), %rax
movq %rax, 0x38(%r13)
movq -0x50(%rbp), %rax
movq %rax, 0x40(%r13)
movq -0x78(%rbp), %rax
movq %rax, 0x48(%r13)
cmpq $0x1, %rax
jne 0x1000e
movq -0xa0(%rbp), %rax
movq %rax, 0x50(%r13)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x903e
movq %rax, 0x60(%r13)
movq -0x68(%rbp), %rax
cmpq $0x1, %rax
je 0x1002f
cmpq $0x2, %rax
jne 0x10055
movq 0x10(%r13), %rdi
movq %rbx, %rax
xorl %edx, %edx
divq -0x48(%rbp)
movq -0x40(%rbp), %rax
movq (%rax,%rdx,8), %rsi
incq %rsi
callq 0x9f95
testb %al, %al
jne 0x10055
callq 0x6e43
incq %rbx
addq $0x78, %r13
movq -0x30(%rbp), %r12
jmp 0xff6d
callq 0x6ca5
vmovsd %xmm0, -0x68(%rbp)
imulq $0x3b9aca00, -0xa0(%rbp), %rax # imm = 0x3B9ACA00
movq %rax, -0x48(%rbp)
movq -0x88(%rbp), %rbx
leaq 0x70(%rbx), %rax
movq %rax, -0x60(%rbp)
leaq 0x50(%rbx), %rax
movq %rax, -0x40(%rbp)
xorl %edx, %edx
movq 0x8f5a(%rip), %r13      # 0x18ff8
xorl %ecx, %ecx
movq -0x98(%rbp), %r12
movq -0xb0(%rbp), %rax
testq %rax, %rax
je 0x100bd
cmpq %rax, %rcx
jb 0x100c6
jmp 0x10245
testb $0x1, %dl
jne 0x10245
movq %rcx, -0x38(%rbp)
callq 0x6ca5
vmovsd %xmm0, -0x30(%rbp)
movq -0x60(%rbp), %rbx
movq %r14, %r12
subq $0x1, %r12
jb 0x10106
movq -0x10(%rbx), %rdi
callq 0x90f9
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x100f7
callq 0x90f9
movq -0x60(%rbx), %rdi
callq 0x9ed1
addq $0x78, %rbx
jmp 0x100db
cmpq $0x0, -0x78(%rbp)
jne 0x1012c
callq 0x6c7b
addq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %r14, %rdx
subq $0x1, %rdx
jb 0x1012c
movq %rax, (%rcx)
addq $0x78, %rcx
jmp 0x1011d
vmovsd -0x30(%rbp), %xmm0
vsubsd -0x68(%rbp), %xmm0, %xmm0
vmovsd %xmm0, -0x70(%rbp)
movq %r14, %rdi
leaq 0x1bf(%rip), %rsi       # 0x10304
movq %r15, %rdx
callq 0x7851
vmovsd %xmm0, -0x30(%rbp)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x903e
movq %rax, %rbx
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x1017f
movq (%r15,%r12,8), %rax
movq 0x60(%rax), %rsi
movq %rbx, %rdi
callq 0x90d0
incq %r12
jmp 0x10165
movq %rbx, %rdi
vmovsd -0x30(%rbp), %xmm0
movq -0x80(%rbp), %rsi
leaq -0x4b0(%rbp), %rdx
movq -0x58(%rbp), %rax
callq *0x20(%rax)
movq %rax, -0x50(%rbp)
movq %rbx, %rdi
callq 0x6060
movq (%r13), %rdi
leaq 0x241d(%rip), %rsi      # 0x125cd
movq -0x38(%rbp), %rdx
vmovsd -0x70(%rbp), %xmm0
vmovsd -0x30(%rbp), %xmm1
movb $0x2, %al
callq 0x6300
movq -0x90(%rbp), %rbx
movq -0x98(%rbp), %r12
movq (%rbx), %rdx
testq %rdx, %rdx
je 0x101f3
movq (%r13), %rdi
leaq 0x23fd(%rip), %rsi      # 0x125e3
xorl %eax, %eax
callq 0x6300
addq $0x8, %rbx
jmp 0x101d3
xorl %ebx, %ebx
movq (%r13), %rsi
cmpq $0xa, %rbx
je 0x10219
movq (%r12,%rbx,8), %rdx
movq %rsi, %rdi
leaq 0x23d6(%rip), %rsi      # 0x125e3
xorl %eax, %eax
callq 0x6300
incq %rbx
jmp 0x101f5
leaq -0x4b0(%rbp), %rdi
callq 0x6200
movq (%r13), %rdi
callq 0x63b0
movq -0x38(%rbp), %rcx
incq %rcx
movq -0x88(%rbp), %rbx
movq -0x50(%rbp), %rdx
jmp 0x100a7
movq -0x80(%rbp), %rdi
callq 0x6060
addq $0x70, %rbx
movq -0x90(%rbp), %r15
pushq $0xa
popq %r13
subq $0x1, %r14
jb 0x10283
movq -0x60(%rbx), %rdi
callq 0x9a86
movq -0x10(%rbx), %rdi
callq 0x6060
movq (%rbx), %rdi
callq 0x6060
addq $0x78, %rbx
jmp 0x1025d
movq 0x8d4e(%rip), %r14      # 0x18fd8
leaq 0x2352(%rip), %rbx      # 0x125e3
movq (%r15), %rdx
testq %rdx, %rdx
je 0x102ac
movq (%r14), %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6300
addq $0x8, %r15
jmp 0x10291
leaq 0x2330(%rip), %rbx      # 0x125e3
xorl %r15d, %r15d
movq (%r14), %rsi
cmpq $0xa, %r15
je 0x102d5
movq (%r12,%r15,8), %rdx
movq %rsi, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6300
incq %r15
jmp 0x102b6
leaq -0x4b0(%rbp), %rdi
callq 0x6200
movq (%r14), %rdi
callq 0x63b0
movq -0xa8(%rbp), %rsp
movl %r13d, %ebx
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq