// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/kvserver.c
// Function: kv_worker
static void *
kv_worker(void * const ptr)
{
  if (ptr == NULL) return NULL;
  struct server_wi * const wi = (typeof(wi))ptr;
  struct stream2 * const s2 = server_wi_stream2(wi);
  struct kvmap_api * const api = (typeof(api))server_wi_private(wi);
  while ((!feof(s2->r)) && (!ferror(s2->r)) && (!ferror(s2->w))) {
    char opcode;
    if (fread(&opcode, sizeof(opcode), 1, s2->r) != 1) break;
    bool r = false;
    switch(opcode) {
    case 'G':
      r = kv_get(s2, api); break;
    case 'P':
      r = kv_probe(s2, api); break;
    case 'S':
      r = kv_set(s2, api); break;
    case 'D':
      r = kv_del(s2, api); break;
    case 'C':
      r = kv_clean(s2, api); break;
    default:
      break;
    }
    if (r == false) break;
  }
  server_wi_destroy(wi);
  return NULL;
}

// Assembly:
testq %rdi, %rdi
je 0x7161
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0xb38d
movq %rax, %r14
movq %rbx, %rdi
callq 0xb397
movq %rax, %r15
movq 0x8(%r14), %rdi
callq 0x6330
testl %eax, %eax
jne 0x714b
movq 0x8(%r14), %r13
movq %r13, %rdi
callq 0x60c0
testl %eax, %eax
jne 0x714b
movq (%r14), %rdi
callq 0x60c0
testl %eax, %eax
jne 0x714b
movl $0x1, %esi
movl $0x1, %edx
leaq -0x29(%rbp), %rdi
movq %r13, %rcx
callq 0x60f0
cmpq $0x1, %rax
jne 0x714b
movzbl -0x29(%rbp), %eax
cmpl $0x46, %eax
jle 0x7030
cmpl $0x53, %eax
je 0x70e7
cmpl $0x50, %eax
je 0x7087
cmpl $0x47, %eax
jne 0x714b
movq %r14, %rdi
xorl %esi, %esi
callq 0x7164
testq %rax, %rax
je 0x714b
movq %rax, %r12
movq (%r15), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq *0x8(%r15)
movq %rax, %r13
movq %r12, %rdi
callq 0x6060
testq %r13, %r13
movq (%r14), %rcx
setne -0x2a(%rbp)
movl $0x1, %esi
movl $0x1, %edx
leaq -0x2a(%rbp), %rdi
callq 0x6550
cmpq $0x1, %rax
jne 0x713e
testq %r13, %r13
je 0x7131
movq %r13, %rdi
callq 0xb53b
movq (%r14), %rcx
movl $0x1, %edx
movq %r13, %rdi
movq %rax, %rsi
callq 0x6550
movq %rax, %r12
movq %r13, %rdi
callq 0x6060
cmpq $0x1, %r12
je 0x7131
jmp 0x714b
cmpl $0x43, %eax
je 0x70c9
cmpl $0x44, %eax
jne 0x714b
movq %r14, %rdi
xorl %esi, %esi
callq 0x7164
testq %rax, %rax
je 0x714b
movq %rax, %r12
movq (%r15), %rdi
movq %rax, %rsi
callq *0x20(%r15)
movl %eax, %r13d
movq %r12, %rdi
callq 0x6060
movq (%r14), %rcx
movb %r13b, -0x2d(%rbp)
movl $0x1, %esi
movl $0x1, %edx
leaq -0x2d(%rbp), %rdi
jmp 0x7126
movq %r14, %rdi
xorl %esi, %esi
callq 0x7164
testq %rax, %rax
je 0x714b
movq %rax, %r12
movq (%r15), %rdi
movq %rax, %rsi
callq *0x10(%r15)
movl %eax, %r13d
movq %r12, %rdi
callq 0x6060
movq (%r14), %rcx
movb %r13b, -0x2b(%rbp)
movl $0x1, %esi
movl $0x1, %edx
leaq -0x2b(%rbp), %rdi
jmp 0x7126
movq (%r15), %rdi
callq *0x28(%r15)
movq (%r14), %rcx
movb $0x1, -0x2e(%rbp)
movl $0x1, %esi
movl $0x1, %edx
leaq -0x2e(%rbp), %rdi
jmp 0x7126
movq %r14, %rdi
movl $0x1, %esi
callq 0x7164
testq %rax, %rax
je 0x714b
movq %rax, %r12
movq (%r15), %rdi
movq %rax, %rsi
callq *0x18(%r15)
movl %eax, %r13d
movq %r12, %rdi
callq 0x6060
movq (%r14), %rcx
movb %r13b, -0x2c(%rbp)
movl $0x1, %esi
movl $0x1, %edx
leaq -0x2c(%rbp), %rdi
callq 0x6550
cmpq $0x1, %rax
jne 0x714b
movq (%r14), %rdi
callq 0x63b0
jmp 0x6f21
testq %r13, %r13
je 0x714b
movq %r13, %rdi
callq 0x6060
movq %rbx, %rdi
callq 0xb3a1
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
xorl %eax, %eax
retq