// File: /workspace/github_cpp_makefile_star2_O3/CoinBlack[P]blackcoin-seeder/main.cpp
// Function: CDnsSeedOpts::ParseCommandLine(int, char**)
void ParseCommandLine(int argc, char **argv) {
    static const char *help = "Blackcoin-seeder\n"
                              "Usage: %s -h <host> -n <ns> [-m <mbox>] [-t <threads>] [-p <port>]\n"
                              "\n"
                              "Options:\n"
                              "-s <seed>       Seed node to collect peers from (replaces default)\n"
                              "-h <host>       Hostname of the DNS seed\n"
                              "-n <ns>         Hostname of the nameserver\n"
                              "-m <mbox>       E-Mail address reported in SOA records\n"
                              "-t <threads>    Number of crawlers to run in parallel (default 96)\n"
                              "-d <threads>    Number of DNS server threads (default 4)\n"
                              "-a <address>    Address to listen on (default ::)\n"
                              "-p <port>       UDP port to listen on (default 53)\n"
                              "-o <ip:port>    Tor proxy IP/Port\n"
                              "-i <ip:port>    IPV4 SOCKS5 proxy IP/Port\n"
                              "-k <ip:port>    IPV6 SOCKS5 proxy IP/Port\n"
                              "-w f1,f2,...    Allow these flag combinations as filters\n"
                              "--p2port <port> P2P port to connect to\n"
                              "--magic <hex>   Magic string/network prefix\n"
                              "--minheight <n> Minimum height of block chain\n"
                              "--testnet       Use testnet\n"
                              "--wipeban       Wipe list of banned nodes\n"
                              "--wipeignore    Wipe list of ignored nodes\n"
                              "-?, --help      Show this text\n"
                              "\n";
    bool showHelp = false;

    while(1) {
      static struct option long_options[] = {
        {"seed", required_argument, 0, 's'},
        {"host", required_argument, 0, 'h'},
        {"ns",   required_argument, 0, 'n'},
        {"mbox", required_argument, 0, 'm'},
        {"threads", required_argument, 0, 't'},
        {"dnsthreads", required_argument, 0, 'd'},
        {"address", required_argument, 0, 'a'},
        {"port", required_argument, 0, 'p'},
        {"onion", required_argument, 0, 'o'},
        {"proxyipv4", required_argument, 0, 'i'},
        {"proxyipv6", required_argument, 0, 'k'},
        {"filter", required_argument, 0, 'w'},
        {"p2port", required_argument, 0, 'b'},
        {"magic", required_argument, 0, 'q'},
        {"minheight", required_argument, 0, 'x'},
        {"testnet", no_argument, &fUseTestNet, 1},
        {"wipeban", no_argument, &fWipeBan, 1},
        {"wipeignore", no_argument, &fWipeBan, 1},
        {"help", no_argument, 0, 'h'},
        {0, 0, 0, 0}
      };
      int option_index = 0;
      int c = getopt_long(argc, argv, "s:h:n:m:t:a:p:d:o:i:k:w:b:q:x:", long_options, &option_index);
      if (c == -1) break;
      switch (c) {
        case 's': {
          vSeeds.emplace_back(optarg);
          break;
        }

        case 'h': {
          host = optarg;
          break;
        }
        
        case 'm': {
          mbox = optarg;
          break;
        }
        
        case 'n': {
          ns = optarg;
          break;
        }
        
        case 't': {
          int n = strtol(optarg, NULL, 10);
          if (n > 0 && n < 1000) nThreads = n;
          break;
        }

        case 'd': {
          int n = strtol(optarg, NULL, 10);
          if (n > 0 && n < 1000) nDnsThreads = n;
          break;
        }

        case 'a': {
          if (strchr(optarg, ':')==NULL) {
            char* ip4_addr = (char*) malloc(strlen(optarg)+8);
            strcpy(ip4_addr, "::FFFF:");
            strcat(ip4_addr, optarg);
            ip_addr = ip4_addr;
          } else {
            ip_addr = optarg;
          }
          break;
        }

        case 'p': {
          int p = strtol(optarg, NULL, 10);
          if (p > 0 && p < 65536) nPort = p;
          break;
        }

        case 'o': {
          tor = optarg;
          break;
        }

        case 'i': {
          ipv4_proxy = optarg;
          break;
        }

        case 'k': {
          ipv6_proxy = optarg;
          break;
        }

        case 'w': {
          char* ptr = optarg;
          while (*ptr != 0) {
            unsigned long l = strtoul(ptr, &ptr, 0);
            if (*ptr == ',') {
                ptr++;
            } else if (*ptr != 0) {
                break;
            }
            filter_whitelist.insert(l);
          }
          break;
        }

        case 'b': {
          int p = strtol(optarg, NULL, 10);
          if (p > 0 && p < 65536) nP2Port = p;
          break;
        }

        case 'q': {
          long int n;
          unsigned int c;
          if (strlen(optarg)!=8) {
            break; /* must be 4 hex-encoded bytes */
          }
          n = strtol(optarg, NULL, 16);
          if (n==0 && strcmp(optarg, "00000000")) {
            break; /* hex decode failed */
          }
          magic = optarg;
          break;
        }

        case 'x': {
          int n = strtol(optarg, NULL, 10);
          if (n > 0 && n <= 0x7fffffff) nMinimumHeight = n;
          break;
        }

        case '?': {
          showHelp = true;
          break;
        }
      }
    }
    if (filter_whitelist.empty()) {
        filter_whitelist.insert(NODE_NETWORK); // x1
        filter_whitelist.insert(NODE_NETWORK | NODE_BLOOM); // x5
        filter_whitelist.insert(NODE_NETWORK | NODE_WITNESS); // x9
        filter_whitelist.insert(NODE_NETWORK | NODE_WITNESS | NODE_COMPACT_FILTERS); // x49
        filter_whitelist.insert(NODE_NETWORK | NODE_WITNESS | NODE_P2P_V2); // x809
        filter_whitelist.insert(NODE_NETWORK | NODE_WITNESS | NODE_P2P_V2 | NODE_COMPACT_FILTERS); //x849
        filter_whitelist.insert(NODE_NETWORK | NODE_WITNESS | NODE_BLOOM); // xd
        filter_whitelist.insert(NODE_NETWORK_LIMITED); // x400
        filter_whitelist.insert(NODE_NETWORK_LIMITED | NODE_BLOOM); // x404
        filter_whitelist.insert(NODE_NETWORK_LIMITED | NODE_WITNESS); // x408
        filter_whitelist.insert(NODE_NETWORK_LIMITED | NODE_WITNESS | NODE_COMPACT_FILTERS); // x448
        filter_whitelist.insert(NODE_NETWORK_LIMITED | NODE_WITNESS | NODE_P2P_V2); // xc08
        filter_whitelist.insert(NODE_NETWORK_LIMITED | NODE_WITNESS | NODE_P2P_V2 | NODE_COMPACT_FILTERS); // xc48
        filter_whitelist.insert(NODE_NETWORK_LIMITED | NODE_WITNESS | NODE_BLOOM); // x40c
    }
    if (host != NULL && ns == NULL) showHelp = true;
    if (showHelp) fprintf(stderr, help, argv[0]);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %r12
leaq 0x14(%rdi), %rax
movq %rax, 0x30(%rsp)
leaq 0x18(%rdi), %rax
movq %rax, 0x28(%rsp)
leaq 0x78(%rdi), %rbx
leaq 0x60(%rdi), %rax
movq %rax, 0x38(%rsp)
xorl %r15d, %r15d
leaq 0x5493(%rip), %r14      # 0x14a98
movq %rdx, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
movb 0xe46b(%rip), %al       # 0x1da80
testb %al, %al
je 0xf8a9
movl $0x0, 0x1c(%rsp)
movl %ebp, %edi
movq %r13, %rsi
leaq 0x5ceb(%rip), %rdx      # 0x1531c
leaq 0xe1c8(%rip), %rcx      # 0x1d800
leaq 0x1c(%rsp), %r8
callq 0x3650
leal -0x61(%rax), %ecx
cmpl $0x17, %ecx
ja 0xf67d
movslq (%r14,%rcx,4), %rax
addq %r14, %rax
movq 0xd958(%rip), %rcx      # 0x1cfb0
jmpq *%rax
movq (%rcx), %r13
movq %r13, %rdi
movl $0x3a, %esi
callq 0x3180
testq %rax, %rax
je 0xf84b
movq %r13, 0x40(%r12)
jmp 0xf89f
movb $0x1, %cl
cmpl $0x3f, %eax
je 0xf843
cmpl $-0x1, %eax
jne 0xf840
jmp 0xf8bd
movq 0x38(%rsp), %rdi
movq 0xd90e(%rip), %rsi      # 0x1cfb0
callq 0x10734
jmp 0xf840
movq (%rcx), %rax
movq %rax, 0x50(%r12)
jmp 0xf840
movq (%rcx), %rax
movq %rax, 0x20(%r12)
jmp 0xf840
movq (%rcx), %rax
movq %rax, 0x48(%r12)
jmp 0xf840
movq (%rcx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3570
leal -0x1(%rax), %ecx
cmpl $0xfffe, %ecx           # imm = 0xFFFE
ja 0xf840
movl %eax, 0x8(%r12)
jmp 0xf840
movq (%rcx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3570
leal -0x1(%rax), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0xf840
movl %eax, (%r12)
jmp 0xf840
movq (%rcx), %r13
movq %r13, %rdi
callq 0x31c0
cmpq $0x8, %rax
jne 0xf89f
movq %r13, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x3570
movq 0xd863(%rip), %rcx      # 0x1cfb0
movq (%rcx), %r13
testq %rax, %rax
je 0xf888
movq %r13, 0x58(%r12)
jmp 0xf89f
movq (%rcx), %rax
movq %rax, 0x28(%r12)
jmp 0xf840
movq (%rcx), %rax
movq %rax, 0x38(%r12)
jmp 0xf840
movq (%rcx), %rax
movq %rax, 0x30(%r12)
jmp 0xf840
movq (%rcx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3570
leal -0x1(%rax), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0xf840
movl %eax, 0x10(%r12)
jmp 0xf840
movq (%rcx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3570
leal -0x1(%rax), %ecx
cmpl $0xfffe, %ecx           # imm = 0xFFFE
ja 0xf840
movl %eax, 0x4(%r12)
jmp 0xf840
movq (%rcx), %r13
movq %r13, 0x8(%rsp)
cmpb $0x0, (%r13)
je 0xf89f
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x3130
movq %rax, 0x40(%rsp)
movq 0x8(%rsp), %r13
movzbl (%r13), %eax
testl %eax, %eax
je 0xf819
cmpl $0x2c, %eax
jne 0xf89f
incq %r13
movq %r13, 0x8(%rsp)
movq %rbx, %rdi
leaq 0x40(%rsp), %rsi
callq 0x10986
jmp 0xf7db
movq (%rcx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3570
testl %eax, %eax
jle 0xf840
movl %eax, 0xc(%r12)
movl %r15d, %ecx
movl %ecx, %r15d
jmp 0xf60f
movq %r13, %rdi
callq 0x31c0
leaq 0x8(%rax), %rdi
callq 0x3500
movq %rax, %r12
movabsq $0x3a464646463a3a, %rax # imm = 0x3A464646463A3A
movq %rax, (%r12)
movq %r12, %rdi
movq %r13, %rsi
callq 0x36a0
movq 0x20(%rsp), %rax
movq %r12, 0x40(%rax)
movq 0x20(%rsp), %r12
jmp 0xf89f
movq %r13, %rdi
leaq 0x5aa9(%rip), %rsi      # 0x1533b
callq 0x3560
testl %eax, %eax
je 0xf759
movl %r15d, %ecx
movq 0x10(%rsp), %r13
jmp 0xf843
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x3831
jmp 0xf61d
cmpq $0x0, 0xa0(%r12)
jne 0xfa0b
leaq 0x8(%rsp), %r14
movq $0x1, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0x5, (%r14)
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0x9, (%r14)
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0x49, (%r14)
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0x809, (%r14)          # imm = 0x809
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0x849, (%r14)          # imm = 0x849
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0xd, (%r14)
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0x400, (%r14)          # imm = 0x400
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0x404, (%r14)          # imm = 0x404
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0x408, (%r14)          # imm = 0x408
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0x448, (%r14)          # imm = 0x448
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0xc08, (%r14)          # imm = 0xC08
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0xc48, (%r14)          # imm = 0xC48
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a98
movq $0x40c, (%r14)          # imm = 0x40C
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x10a98
cmpq $0x0, 0x30(%r12)
setne %al
cmpq $0x0, 0x28(%r12)
sete %cl
andb %al, %cl
orb %r15b, %cl
testb $0x1, %cl
jne 0xfa36
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x3b39
jmp 0xfa27