// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/kvclient.c
// Function: main
int
main(int argc, char ** argv)
{
  struct tcpmap * map = NULL;
  if (argc < 3) {
    printf("Usage: %s <host> <port>\n", argv[0]);
    printf("Use default setting: localhost 9999\n");
    map = tcpmap_create("localhost", 9999);
  } else {
    map = tcpmap_create(argv[1], atoi(argv[2]));
  }

  if (map == NULL) {
    printf("failed\n");
    exit(0);
  }

  struct kv * const kv = malloc(1024);
  struct kv * const out = malloc(1024);

  kv_refill_str(kv, "abc", "123");
  printf("set %c/t\n", tcpmap_set(map, kv) ? 't': 'f');

  kv_refill_str(kv, "hello", "45678");
  printf("set %c/t\n", tcpmap_set(map, kv) ? 't': 'f');

  kv_refill_str(kv, "notthere", "");
  printf("get %c/f\n", tcpmap_get(map, kv, out) ? 't':'f');
  printf("probe %c/f\n", tcpmap_probe(map, kv) ? 't':'f');

  kv_refill_str(kv, "hello", "");
  printf("get %c/t\n", tcpmap_get(map, kv, out) ? 't':'f');

  kv_refill_str(kv, "abc", "");
  printf("get %c/t\n", tcpmap_get(map, kv, out) ? 't':'f');

  kv_refill_str(kv, "abc", "");
  printf("del %c/t\n", tcpmap_del(map, kv) ? 't':'f');

  kv_refill_str(kv, "abc", "");
  printf("get %c/f\n", tcpmap_get(map, kv, out) ? 't':'f');
  free(kv);
  free(out);

  tcpmap_destroy(map);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jg 0x6dfa
movq (%rsi), %rsi
leaq 0xd22b(%rip), %rdi      # 0x14004
xorl %eax, %eax
callq 0x61b0
leaq 0xd291(%rip), %rdi      # 0x14078
callq 0x60c0
leaq 0xd22a(%rip), %rdi      # 0x1401d
movl $0x270f, %esi           # imm = 0x270F
jmp 0x6e0c
movq 0x8(%rsi), %rbx
movq 0x10(%rsi), %rdi
callq 0x64e0
movq %rbx, %rdi
movl %eax, %esi
callq 0x10bf5
movq %rax, %rbx
testq %rax, %rax
je 0x7041
movl $0x400, %edi            # imm = 0x400
callq 0x63a0
movq %rax, %r14
movl $0x400, %edi            # imm = 0x400
callq 0x63a0
movq %rax, %r15
leaq 0xd1e9(%rip), %rsi      # 0x14027
leaq 0xd1e6(%rip), %rdx      # 0x1402b
movq %r14, %rdi
callq 0xb4b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10ddc
testb %al, %al
movl $0x74, %eax
movl $0x66, %esi
cmovnel %eax, %esi
movl $0x74, %r12d
leaq 0xd1bb(%rip), %r13      # 0x1402f
movq %r13, %rdi
xorl %eax, %eax
callq 0x61b0
leaq 0xd1b4(%rip), %rsi      # 0x14039
leaq 0xd1b3(%rip), %rdx      # 0x1403f
movq %r14, %rdi
callq 0xb4b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10ddc
testb %al, %al
movl $0x66, %esi
cmovnel %r12d, %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x61b0
leaq 0xd18a(%rip), %rsi      # 0x14045
leaq 0xd8bb(%rip), %r13      # 0x1477d
movq %r14, %rdi
movq %r13, %rdx
callq 0xb4b0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %r12
callq 0x10c24
testq %rax, %rax
movl $0x66, %esi
movl $0x74, %eax
cmovnel %eax, %esi
movl $0x74, %r15d
leaq 0xd153(%rip), %rdi      # 0x1404e
xorl %eax, %eax
callq 0x61b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10db3
testb %al, %al
movl $0x66, %esi
cmovnel %r15d, %esi
leaq 0xd139(%rip), %rdi      # 0x14058
xorl %eax, %eax
callq 0x61b0
movq %r14, %rdi
leaq 0xd109(%rip), %rsi      # 0x14039
movq %r13, %rdx
movq %r13, %r15
callq 0xb4b0
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x10c24
testq %rax, %rax
movl $0x66, %esi
movl $0x74, %eax
cmovnel %eax, %esi
leaq 0xd104(%rip), %rdi      # 0x14064
xorl %eax, %eax
callq 0x61b0
movq %r14, %rdi
leaq 0xd0b6(%rip), %r13      # 0x14027
movq %r13, %rsi
movq %r15, %rdx
callq 0xb4b0
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x10c24
testq %rax, %rax
movl $0x66, %esi
movl $0x74, %eax
cmovnel %eax, %esi
leaq 0xd0c3(%rip), %rdi      # 0x14064
xorl %eax, %eax
callq 0x61b0
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xb4b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10e05
testb %al, %al
movl $0x66, %esi
movl $0x74, %eax
cmovnel %eax, %esi
leaq 0xd097(%rip), %rdi      # 0x1406e
xorl %eax, %eax
callq 0x61b0
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xb4b0
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x10c24
testq %rax, %rax
movl $0x66, %esi
movl $0x74, %eax
cmovnel %eax, %esi
leaq 0xd03d(%rip), %rdi      # 0x1404e
xorl %eax, %eax
callq 0x61b0
movq %r14, %rdi
callq 0x6060
movq %r12, %rdi
callq 0x6060
movq %rbx, %rdi
callq 0x10e98
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd054(%rip), %rdi      # 0x1409c
callq 0x60c0
xorl %edi, %edi
callq 0x6530