// File: /workspace/github_c_makefile_star2_O0/wuxb45[P]SLB/lib1.c
// Function: rgen_async_convert
bool
rgen_async_convert(struct rgen * const gen, const u64 cpu)
{
  if (gen->async_worker) {
    return false; // already converted
  }
  struct rgen_worker_info * const info = &(gen->wi);
  memset(info, 0, sizeof(*info));
  info->real_next = gen->next_wait;
  const u64 g = UINT64_C(1) << 30;
  const u64 usize = gen->unit_u64 ? sizeof(u64) : sizeof(u32);
  info->mem = pages_alloc_best(g, true, &(info->alloc_size));
  info->buffer_nr = g / (RGEN_ASYNC_BUFFER_NR * usize);
  info->cpu = cpu;
  atomic_store(&(info->running), true);
  for (u64 j = 0; j < RGEN_ASYNC_BUFFER_NR; j++) {
    info->buffers_u64[j] = (u64 *)(&(info->mem[j * info->buffer_nr * usize]));
    atomic_store(&(info->avail[j]), false);
  }
  gen->next_wait = rgen_async_next_wait;
  gen->next_nowait = rgen_async_next_nowait;
  if (thread_create_at(cpu, &(info->thread), rgen_worker, gen) == 0) {
    char thname[32];
    sprintf(thname, "rgen_async_%"PRIu64, cpu);
    pthread_setname_np(info->thread, thname);
    info->reader_id = 0;
    info->i = 0;
    gen->async_worker = true;
    return true;
  } else {
    rgen_clean_async_buffers(info);
    return false;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $-0x20, %rsp
subq $0xe0, %rsp
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movq 0xc0(%rsp), %rax
testb $0x1, 0x15(%rax)
je 0xcbba
movb $0x0, 0xcf(%rsp)
jmp 0xce5c
movq 0xc0(%rsp), %rax
addq $0xf0, %rax
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x18(%rsp)
vpxor %xmm0, %xmm0, %xmm0
vmovaps %ymm0, 0x20(%rsp)
vmovdqu %ymm0, 0x110(%rax)
vmovdqu %ymm0, 0x100(%rax)
vmovdqu %ymm0, 0xe0(%rax)
vmovdqu %ymm0, 0xc0(%rax)
vmovdqu %ymm0, 0xa0(%rax)
vmovdqu %ymm0, 0x80(%rax)
vmovdqu %ymm0, 0x60(%rax)
vmovdqu %ymm0, 0x40(%rax)
vmovdqu %ymm0, 0x20(%rax)
vmovdqu %ymm0, (%rax)
movq 0xc0(%rsp), %rax
movq (%rax), %rcx
movq 0xb0(%rsp), %rax
movq %rcx, 0xb8(%rax)
movq $0x40000000, 0xa8(%rsp) # imm = 0x40000000
movq 0xc0(%rsp), %rax
movzbl 0x14(%rax), %eax
andl $0x1, %eax
leaq 0x4(,%rax,4), %rax
movq %rax, 0xa0(%rsp)
movq 0xb0(%rsp), %rdx
addq $0x28, %rdx
movl $0x40000000, %edi       # imm = 0x40000000
movq %rdi, 0x58(%rsp)
movl $0x1, %esi
vzeroupper
callq 0x8d40
movq %rax, %rdx
movq 0x58(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq %rdx, 0x20(%rcx)
movq 0xa0(%rsp), %rcx
shlq $0x2, %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq 0xb0(%rsp), %rax
movq %rcx, 0xc0(%rax)
movq 0xb8(%rsp), %rcx
movq 0xb0(%rsp), %rax
movq %rcx, 0xc8(%rax)
movq 0xb0(%rsp), %rcx
movb $0x1, 0x9f(%rsp)
movb 0x9f(%rsp), %al
xchgb %al, 0xd8(%rcx)
movq $0x0, 0x90(%rsp)
cmpq $0x4, 0x90(%rsp)
jae 0xcd82
movq 0xb0(%rsp), %rax
movq 0x90(%rsp), %rcx
movq 0x20(%rax), %rdx
movq 0xc0(%rax), %rdi
movq %rcx, %rsi
imulq %rdi, %rsi
movq 0xa0(%rsp), %rdi
imulq %rdi, %rsi
addq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
movq 0xb0(%rsp), %rcx
movq 0x90(%rsp), %rdx
movb $0x0, 0x8f(%rsp)
movb 0x8f(%rsp), %al
xchgb %al, 0x70(%rcx,%rdx)
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
jmp 0xcd09
movq 0xc0(%rsp), %rax
leaq 0xdf(%rip), %rcx        # 0xce70
movq %rcx, (%rax)
movq 0xc0(%rsp), %rax
leaq 0x1cd(%rip), %rcx       # 0xcf70
movq %rcx, 0x8(%rax)
movq 0xb8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
addq $0xd0, %rsi
movq 0xc0(%rsp), %rcx
leaq 0x273(%rip), %rdx       # 0xd040
callq 0x8aa0
cmpl $0x0, %eax
jne 0xce47
leaq 0x60(%rsp), %rdi
movq 0xb8(%rsp), %rdx
leaq 0xe64a(%rip), %rsi      # 0x1b435
movb $0x0, %al
callq 0x64f0
movq 0xb0(%rsp), %rax
movq 0xd0(%rax), %rdi
leaq 0x60(%rsp), %rsi
callq 0x61d0
movq 0xb0(%rsp), %rax
movq $0x0, 0x120(%rax)
movq 0xb0(%rsp), %rax
movq $0x0, 0x128(%rax)
movq 0xc0(%rsp), %rax
movb $0x1, 0x15(%rax)
movb $0x1, 0xcf(%rsp)
jmp 0xce5c
movq 0xb0(%rsp), %rdi
callq 0xc330
movb $0x0, 0xcf(%rsp)
movb 0xcf(%rsp), %al
andb $0x1, %al
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)