// File: /workspace/github_cpp_makefile_star2_O2/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, %r12
movl %esi, %ebp
movq %rdi, %r14
leaq 0x14(%rdi), %rax
movq %rax, 0x28(%rsp)
leaq 0x18(%rdi), %rax
movq %rax, 0x20(%rsp)
leaq 0x78(%rdi), %r15
leaq 0x60(%rdi), %rax
movq %rax, 0x38(%rsp)
xorl %r13d, %r13d
leaq 0x48fd(%rip), %rbx      # 0x12a98
movq %rdi, 0x10(%rsp)
movq %rdx, 0x30(%rsp)
movb 0xf905(%rip), %al       # 0x1dab0
testb %al, %al
je 0xe433
andl $0x0, 0x1c(%rsp)
movl %ebp, %edi
movq %r12, %rsi
leaq 0x5158(%rip), %rdx      # 0x1331c
leaq 0xf665(%rip), %rcx      # 0x1d830
leaq 0x1c(%rsp), %r8
callq 0x3690
leal -0x61(%rax), %ecx
cmpl $0x17, %ecx
ja 0xe212
movslq (%rbx,%rcx,4), %rax
addq %rbx, %rax
movq 0xedc5(%rip), %rcx      # 0x1cfb0
jmpq *%rax
movq (%rcx), %r14
movq %r14, %rdi
pushq $0x3a
popq %rsi
callq 0x3170
testq %rax, %rax
je 0xe3cc
movq 0x10(%rsp), %rax
movq %r14, 0x40(%rax)
jmp 0xe2ec
movb $0x1, %cl
cmpl $0x3f, %eax
je 0xe40a
cmpl $-0x1, %eax
jne 0xe407
jmp 0xe738
movq 0x38(%rsp), %rdi
movq 0xed79(%rip), %rsi      # 0x1cfb0
callq 0xf5e8
jmp 0xe407
movq (%rcx), %rax
movq %rax, 0x50(%r14)
jmp 0xe407
movq (%rcx), %rax
movq %rax, 0x20(%r14)
jmp 0xe407
movq (%rcx), %rax
movq %rax, 0x48(%r14)
jmp 0xe407
movq (%rcx), %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x35b0
leal -0x1(%rax), %ecx
cmpl $0xfffe, %ecx           # imm = 0xFFFE
ja 0xe407
movl %eax, 0x8(%r14)
jmp 0xe407
movq (%rcx), %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x35b0
leal -0x1(%rax), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0xe407
movl %eax, (%r14)
jmp 0xe407
movq (%rcx), %r14
movq %r14, %rdi
callq 0x31b0
cmpq $0x8, %rax
jne 0xe429
movq %r14, %rdi
xorl %esi, %esi
pushq $0x10
popq %rdx
callq 0x35b0
movq 0xecd9(%rip), %rcx      # 0x1cfb0
movq (%rcx), %r14
testq %rax, %rax
je 0xe412
movq 0x10(%rsp), %rax
movq %r14, 0x58(%rax)
movq %rax, %r14
jmp 0xe407
movq (%rcx), %rax
movq %rax, 0x28(%r14)
jmp 0xe407
movq (%rcx), %rax
movq %rax, 0x38(%r14)
jmp 0xe407
movq (%rcx), %rax
movq %rax, 0x30(%r14)
jmp 0xe407
movq (%rcx), %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x35b0
leal -0x1(%rax), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0xe407
movl %eax, 0x10(%r14)
jmp 0xe407
movq (%rcx), %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x35b0
leal -0x1(%rax), %ecx
cmpl $0xfffe, %ecx           # imm = 0xFFFE
ja 0xe407
movl %eax, 0x4(%r14)
jmp 0xe407
movq (%rcx), %r14
movq %r14, 0x8(%rsp)
cmpb $0x0, (%r14)
je 0xe429
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x3120
movq %rax, 0x40(%rsp)
movq 0x8(%rsp), %r14
movzbl (%r14), %eax
testl %eax, %eax
je 0xe3a6
cmpl $0x2c, %eax
jne 0xe429
incq %r14
movq %r14, 0x8(%rsp)
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq 0xf81a
jmp 0xe36a
movq (%rcx), %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x35b0
testl %eax, %eax
jle 0xe407
movl %eax, 0xc(%r14)
jmp 0xe407
movq %r14, %rdi
callq 0x31b0
leaq 0x8(%rax), %rdi
callq 0x3520
movq %rax, %r12
movabsq $0x3a464646463a3a, %rax # imm = 0x3A464646463A3A
movq %rax, (%r12)
movq %r12, %rdi
movq %r14, %rsi
callq 0x36e0
movq 0x10(%rsp), %r14
movq %r12, 0x40(%r14)
movq 0x30(%rsp), %r12
movl %r13d, %ecx
movl %ecx, %r13d
jmp 0xe1a5
movq %r14, %rdi
leaq 0x4f1f(%rip), %rsi      # 0x1333b
callq 0x35a0
testl %eax, %eax
je 0xe2e3
movl %r13d, %ecx
movq 0x10(%rsp), %r14
jmp 0xe40a
leaq 0xf676(%rip), %rdi      # 0x1dab0
callq 0x3720
testl %eax, %eax
je 0xe1b3
leaq 0x4e5f(%rip), %rax      # 0x132ad
movq %rax, 0xf3db(%rip)      # 0x1d830
pushq $0x1
popq %rcx
movl %ecx, 0xf3da(%rip)      # 0x1d838
andq $0x0, 0xf3da(%rip)      # 0x1d840
movl $0x73, 0xf3d8(%rip)     # 0x1d848
leaq 0x4e3b(%rip), %rax      # 0x132b2
movq %rax, 0xf3d2(%rip)      # 0x1d850
movl %ecx, 0xf3d4(%rip)      # 0x1d858
andq $0x0, 0xf3d4(%rip)      # 0x1d860
pushq $0x68
popq %rdx
movl %edx, 0xf3d3(%rip)      # 0x1d868
leaq 0x4e1b(%rip), %rax      # 0x132b7
movq %rax, 0xf3cd(%rip)      # 0x1d870
movl %ecx, 0xf3cf(%rip)      # 0x1d878
andq $0x0, 0xf3cf(%rip)      # 0x1d880
movl $0x6e, 0xf3cd(%rip)     # 0x1d888
leaq 0x4df8(%rip), %rax      # 0x132ba
movq %rax, 0xf3c7(%rip)      # 0x1d890
movl %ecx, 0xf3c9(%rip)      # 0x1d898
andq $0x0, 0xf3c9(%rip)      # 0x1d8a0
movl $0x6d, 0xf3c7(%rip)     # 0x1d8a8
leaq 0x4dda(%rip), %rax      # 0x132c2
movq %rax, 0xf3c1(%rip)      # 0x1d8b0
movl %ecx, 0xf3c3(%rip)      # 0x1d8b8
andq $0x0, 0xf3c3(%rip)      # 0x1d8c0
movl $0x74, 0xf3c1(%rip)     # 0x1d8c8
leaq 0x4db1(%rip), %rax      # 0x132bf
movq %rax, 0xf3bb(%rip)      # 0x1d8d0
movl %ecx, 0xf3bd(%rip)      # 0x1d8d8
andq $0x0, 0xf3bd(%rip)      # 0x1d8e0
movl $0x64, 0xf3bb(%rip)     # 0x1d8e8
leaq 0x4124(%rip), %rax      # 0x12658
movq %rax, 0xf3b5(%rip)      # 0x1d8f0
movl %ecx, 0xf3b7(%rip)      # 0x1d8f8
andq $0x0, 0xf3b7(%rip)      # 0x1d900
movl $0x61, 0xf3b5(%rip)     # 0x1d908
leaq 0x4d8d(%rip), %rax      # 0x132e7
movq %rax, 0xf3af(%rip)      # 0x1d910
movl %ecx, 0xf3b1(%rip)      # 0x1d918
andq $0x0, 0xf3b1(%rip)      # 0x1d920
movl $0x70, 0xf3af(%rip)     # 0x1d928
leaq 0x47d4(%rip), %rax      # 0x12d54
movq %rax, 0xf3a9(%rip)      # 0x1d930
movl %ecx, 0xf3ab(%rip)      # 0x1d938
andq $0x0, 0xf3ab(%rip)      # 0x1d940
movl $0x6f, 0xf3a9(%rip)     # 0x1d948
leaq 0x4d24(%rip), %rax      # 0x132ca
movq %rax, 0xf3a3(%rip)      # 0x1d950
movl %ecx, 0xf3a5(%rip)      # 0x1d958
andq $0x0, 0xf3a5(%rip)      # 0x1d960
movl $0x69, 0xf3a3(%rip)     # 0x1d968
leaq 0x4d08(%rip), %rax      # 0x132d4
movq %rax, 0xf39d(%rip)      # 0x1d970
movl %ecx, 0xf39f(%rip)      # 0x1d978
andq $0x0, 0xf39f(%rip)      # 0x1d980
movl $0x6b, 0xf39d(%rip)     # 0x1d988
leaq 0x4cec(%rip), %rax      # 0x132de
movq %rax, 0xf397(%rip)      # 0x1d990
movl %ecx, 0xf399(%rip)      # 0x1d998
andq $0x0, 0xf399(%rip)      # 0x1d9a0
movl $0x77, 0xf397(%rip)     # 0x1d9a8
leaq 0x4ccd(%rip), %rax      # 0x132e5
movq %rax, 0xf391(%rip)      # 0x1d9b0
movl %ecx, 0xf393(%rip)      # 0x1d9b8
andq $0x0, 0xf393(%rip)      # 0x1d9c0
movl $0x62, 0xf391(%rip)     # 0x1d9c8
leaq 0x4cae(%rip), %rax      # 0x132ec
movq %rax, 0xf38b(%rip)      # 0x1d9d0
movl %ecx, 0xf38d(%rip)      # 0x1d9d8
andq $0x0, 0xf38d(%rip)      # 0x1d9e0
movl $0x71, 0xf38b(%rip)     # 0x1d9e8
leaq 0x4c8e(%rip), %rax      # 0x132f2
movq %rax, 0xf385(%rip)      # 0x1d9f0
movl %ecx, 0xf387(%rip)      # 0x1d9f8
andq $0x0, 0xf387(%rip)      # 0x1da00
movl $0x78, 0xf385(%rip)     # 0x1da08
leaq 0x4c72(%rip), %rax      # 0x132fc
movq %rax, 0xf37f(%rip)      # 0x1da10
andl $0x0, 0xf380(%rip)      # 0x1da18
movq 0x28(%rsp), %rax
movq %rax, 0xf37c(%rip)      # 0x1da20
movl %ecx, 0xf37e(%rip)      # 0x1da28
leaq 0x4c53(%rip), %rax      # 0x13304
movq %rax, 0xf378(%rip)      # 0x1da30
andl $0x0, 0xf379(%rip)      # 0x1da38
movq 0x20(%rsp), %rax
movq %rax, 0xf375(%rip)      # 0x1da40
movl %ecx, 0xf377(%rip)      # 0x1da48
leaq 0x4c34(%rip), %rsi      # 0x1330c
movq %rsi, 0xf371(%rip)      # 0x1da50
andl $0x0, 0xf372(%rip)      # 0x1da58
movq %rax, 0xf373(%rip)      # 0x1da60
movl %ecx, 0xf375(%rip)      # 0x1da68
leaq 0x4c1d(%rip), %rax      # 0x13317
movq %rax, 0xf36f(%rip)      # 0x1da70
andl $0x0, 0xf370(%rip)      # 0x1da78
andq $0x0, 0xf370(%rip)      # 0x1da80
movl %edx, 0xf372(%rip)      # 0x1da88
xorps %xmm0, %xmm0
movaps %xmm0, 0xf380(%rip)     # 0x1daa0
movaps %xmm0, 0xf369(%rip)     # 0x1da90
leaq 0xf382(%rip), %rdi      # 0x1dab0
callq 0x3290
jmp 0xe1b3
cmpq $0x0, 0xa0(%r14)
jne 0xe88a
leaq 0x8(%rsp), %r14
movq $0x1, (%r14)
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0x5, (%r14)
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0x9, (%r14)
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0x49, (%r14)
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0x809, (%r14)          # imm = 0x809
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0x849, (%r14)          # imm = 0x849
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0xd, (%r14)
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0x400, (%r14)          # imm = 0x400
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0x404, (%r14)          # imm = 0x404
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0x408, (%r14)          # imm = 0x408
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0x448, (%r14)          # imm = 0x448
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0xc08, (%r14)          # imm = 0xC08
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0xc48, (%r14)          # imm = 0xC48
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xf974
movq $0x40c, (%r14)          # imm = 0x40C
movq 0x10(%rsp), %r14
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0xf974
cmpq $0x0, 0x30(%r14)
setne %al
cmpq $0x0, 0x28(%r14)
sete %cl
andb %al, %cl
orb %r13b, %cl
testb $0x1, %cl
jne 0xe8b3
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xe716(%rip), %rax      # 0x1cfd0
movq (%rax), %rdi
movq 0xeb5c(%rip), %rsi      # 0x1d420
movq (%r12), %rdx
xorl %eax, %eax
callq 0x35e0
jmp 0xe8a4
nop