// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/xpio_c_q.c
// Function: main
int main(int argc, char **argv)
{
   // test scanNum
   {
      const char *psz;
      unsigned n;

      psz = scanNum("123.", &n);
      eq_i(123, n);
      eq_i('.', *psz);

      psz = scanNum("123 ", &n);
      eq_i(123, n);
      eq_i(' ', *psz);

      psz = scanNum("2147483647", &n);
      eq_i(2147483647, n);
      eq_i('\0', *psz);
   }

   // test addrFromString
   {
      // Perversely, sockaddr_in keeps exposes integer values (sin_addr and
      // sin_port) as if they can be treated as numeric values, but stores
      // them in network byte order.
      struct sockaddr_in sin;
      struct sockaddr *psa = (struct sockaddr *) &sin;
      unsigned char *pby = (unsigned char *)&psa->sa_data;
      int e;

      e = addrFromString(&sin, "123.4.5.255:258");
      eq_i(0, e);
      eq_i(AF_INET, psa->sa_family);
      eq_i(1,   pby[0]);      // sin_port
      eq_i(2,   pby[1]);
      eq_i(123, pby[2]);      // sin_addr
      eq_i(4,   pby[3]);
      eq_i(5,   pby[4]);
      eq_i(255, pby[5]);

      e = addrFromString(&sin, ":123");
      eq_i(0, e);
      eq_i(AF_INET, psa->sa_family);
      eq_i(123, htons(sin.sin_port));
      eq_i(0, sin.sin_addr.s_addr);

      e = addrFromString(&sin, "1.2.3.4");
      eq_i(0, e);
      eq_i(AF_INET, psa->sa_family);
      eq_i(0, htons(sin.sin_port));
      eq_i(0x01020304, htonl(sin.sin_addr.s_addr));
   }

   return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0x11804(%rip), %rdi     # 0x15052
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x3bfc
movl (%rbx), %r8d
cmpl $0x7b, %r8d
jne 0x39ea
movsbl (%rax), %r8d
cmpl $0x2e, %r8d
jne 0x39ff
leaq 0x1180d(%rip), %rdi     # 0x15088
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x3bfc
movl (%rbx), %r8d
cmpl $0x7b, %r8d
jne 0x3a17
movsbl (%rax), %r8d
cmpl $0x20, %r8d
jne 0x3a2c
leaq 0x117e5(%rip), %rdi     # 0x1508d
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x3bfc
movl (%rbx), %r8d
cmpl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
jne 0x3a44
movsbl (%rax), %r8d
testl %r8d, %r8d
jne 0x3a5f
leaq 0x117c1(%rip), %rsi     # 0x15098
movq %rsp, %rdi
callq 0x3c1b
testl %eax, %eax
jne 0x3a74
movzwl (%rsp), %r8d
cmpl $0x2, %r8d
jne 0x3a89
movzbl 0x2(%rsp), %r8d
cmpl $0x1, %r8d
jne 0x3a9e
movzbl 0x3(%rsp), %r8d
cmpl $0x2, %r8d
jne 0x3ac2
movzbl 0x4(%rsp), %r8d
cmpl $0x7b, %r8d
jne 0x3ad7
movzbl 0x5(%rsp), %r8d
cmpl $0x4, %r8d
jne 0x3aec
movzbl 0x6(%rsp), %r8d
cmpl $0x5, %r8d
jne 0x3b04
movzbl 0x7(%rsp), %r8d
cmpl $0xff, %r8d
jne 0x3b1c
leaq 0x11748(%rip), %rsi     # 0x150a8
movq %rsp, %rdi
callq 0x3c1b
testl %eax, %eax
jne 0x3b37
movzwl (%rsp), %r8d
cmpl $0x2, %r8d
jne 0x3b49
movzwl 0x2(%rsp), %eax
cmpw $0x7b00, %ax            # imm = 0x7B00
jne 0x3b5b
movl 0x4(%rsp), %r8d
testl %r8d, %r8d
jne 0x3b78
leaq 0x1170a(%rip), %rsi     # 0x150ad
movq %rsp, %rdi
callq 0x3c1b
testl %eax, %eax
jne 0x3b8a
movzwl (%rsp), %r8d
cmpl $0x2, %r8d
jne 0x3ba1
movzwl 0x2(%rsp), %eax
testw %ax, %ax
jne 0x3bb7
movl 0x4(%rsp), %r8d
cmpl $0x4030201, %r8d        # imm = 0x4030201
jne 0x3be1
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x11666(%rip), %rdi     # 0x15057
leaq 0x11685(%rip), %rsi     # 0x1507d
pushq $0x24
jmp 0x3b73
leaq 0x11651(%rip), %rdi     # 0x15057
leaq 0x11670(%rip), %rsi     # 0x1507d
pushq $0x25
popq %rdx
pushq $0x2e
jmp 0x3bb4
leaq 0x11639(%rip), %rdi     # 0x15057
leaq 0x11658(%rip), %rsi     # 0x1507d
pushq $0x28
jmp 0x3b73
leaq 0x11624(%rip), %rdi     # 0x15057
leaq 0x11643(%rip), %rsi     # 0x1507d
pushq $0x29
popq %rdx
pushq $0x20
jmp 0x3bb4
leaq 0x1160c(%rip), %rdi     # 0x15057
leaq 0x1162b(%rip), %rsi     # 0x1507d
pushq $0x2c
popq %rdx
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0x3bd2
leaq 0x115f1(%rip), %rdi     # 0x15057
leaq 0x11610(%rip), %rsi     # 0x1507d
pushq $0x2d
jmp 0x3bcf
leaq 0x115dc(%rip), %rdi     # 0x15057
leaq 0x115fb(%rip), %rsi     # 0x1507d
pushq $0x3b
jmp 0x3b9a
leaq 0x115c7(%rip), %rdi     # 0x15057
leaq 0x115e6(%rip), %rsi     # 0x1507d
pushq $0x3c
jmp 0x3bb1
leaq 0x115b2(%rip), %rdi     # 0x15057
leaq 0x115d1(%rip), %rsi     # 0x1507d
pushq $0x3d
popq %rdx
pushq $0x1
popq %rbx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3170
movl %ebx, %edi
callq 0x33c0
leaq 0x1158e(%rip), %rdi     # 0x15057
leaq 0x115ad(%rip), %rsi     # 0x1507d
pushq $0x3e
jmp 0x3bb1
leaq 0x11579(%rip), %rdi     # 0x15057
leaq 0x11598(%rip), %rsi     # 0x1507d
pushq $0x3f
jmp 0x3b73
leaq 0x11564(%rip), %rdi     # 0x15057
leaq 0x11583(%rip), %rsi     # 0x1507d
pushq $0x40
popq %rdx
pushq $0x4
jmp 0x3bb4
leaq 0x1154c(%rip), %rdi     # 0x15057
leaq 0x1156b(%rip), %rsi     # 0x1507d
pushq $0x41
popq %rdx
pushq $0x5
jmp 0x3bb4
leaq 0x11534(%rip), %rdi     # 0x15057
leaq 0x11553(%rip), %rsi     # 0x1507d
pushq $0x42
popq %rdx
movl $0xff, %ecx
jmp 0x3bd2
leaq 0x11519(%rip), %rdi     # 0x15057
leaq 0x11538(%rip), %rsi     # 0x1507d
pushq $0x45
jmp 0x3b9a
leaq 0x11507(%rip), %rdi     # 0x15057
leaq 0x11526(%rip), %rsi     # 0x1507d
pushq $0x46
jmp 0x3bb1
rolw $0x8, %ax
movzwl %ax, %r8d
leaq 0x114ed(%rip), %rdi     # 0x15057
leaq 0x1150c(%rip), %rsi     # 0x1507d
pushq $0x47
popq %rdx
pushq $0x7b
jmp 0x3bb4
leaq 0x114d8(%rip), %rdi     # 0x15057
leaq 0x114f7(%rip), %rsi     # 0x1507d
pushq $0x48
jmp 0x3bcf
leaq 0x114c6(%rip), %rdi     # 0x15057
leaq 0x114e5(%rip), %rsi     # 0x1507d
pushq $0x4b
popq %rdx
pushq $-0x1
popq %r8
jmp 0x3bd0
leaq 0x114af(%rip), %rdi     # 0x15057
leaq 0x114ce(%rip), %rsi     # 0x1507d
pushq $0x4c
popq %rdx
pushq $0x2
popq %rcx
jmp 0x3bd2
rolw $0x8, %ax
movzwl %ax, %r8d
leaq 0x11491(%rip), %rdi     # 0x15057
leaq 0x114b0(%rip), %rsi     # 0x1507d
pushq $0x4d
popq %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3170
pushq $0x1
popq %rdi
callq 0x33c0
bswapl %r8d
leaq 0x1146c(%rip), %rdi     # 0x15057
leaq 0x1148b(%rip), %rsi     # 0x1507d
pushq $0x4e
popq %rdx
movl $0x1020304, %ecx        # imm = 0x1020304
jmp 0x3bd2