// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
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), %r15
leaq 0x60(%rdi), %rax
movq %rax, 0x38(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x51af(%rip), %r14      # 0x14a78
movq %rdi, 0x10(%rsp)
movb 0xe1ac(%rip), %al       # 0x1da80
testb %al, %al
je 0xfbf3
movl $0x0, 0x1c(%rsp)
movl %ebp, %edi
movq %rbx, %rsi
leaq 0x5a0c(%rip), %rdx      # 0x152fc
leaq 0xdf09(%rip), %rcx      # 0x1d800
leaq 0x1c(%rsp), %r8
callq 0x3650
leal -0x61(%rax), %ecx
cmpl $0x17, %ecx
ja 0xf943
movslq (%r14,%rcx,4), %rax
addq %r14, %rax
jmpq *%rax
movq 0xd697(%rip), %rax      # 0x1cfb0
movq (%rax), %r12
movq %r12, %rdi
movl $0x3a, %esi
callq 0x3180
testq %rax, %rax
je 0xfb89
movq 0x10(%rsp), %rax
movq %r12, 0x40(%rax)
movq %rax, %r12
jmp 0xfbc0
cmpl $-0x1, %eax
je 0xfb84
cmpl $0x3f, %eax
jne 0xfbc0
movb $0x1, %r13b
movb $0x1, %al
movq %rax, 0x20(%rsp)
jmp 0xfbc3
movq 0xd645(%rip), %rax      # 0x1cfb0
movq (%rax), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3570
leal -0x1(%rax), %ecx
movb $0x1, %r13b
cmpl $0xfffe, %ecx           # imm = 0xFFFE
ja 0xfbc3
movl %eax, 0x4(%r12)
jmp 0xfbc3
movq 0xd613(%rip), %rax      # 0x1cfb0
movq (%rax), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3570
leal -0x1(%rax), %ecx
movb $0x1, %r13b
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0xfbc3
movl %eax, (%r12)
jmp 0xfbc3
movq 0xd5e2(%rip), %rax      # 0x1cfb0
movq (%rax), %rax
movq %rax, 0x38(%r12)
jmp 0xfbc0
movq 0xd5ce(%rip), %rax      # 0x1cfb0
movq (%rax), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3570
leal -0x1(%rax), %ecx
movb $0x1, %r13b
cmpl $0xfffe, %ecx           # imm = 0xFFFE
ja 0xfbc3
movl %eax, 0x8(%r12)
jmp 0xfbc3
movq 0xd59c(%rip), %rax      # 0x1cfb0
movq (%rax), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3570
movb $0x1, %r13b
testl %eax, %eax
jle 0xfbc3
movl %eax, 0xc(%r12)
jmp 0xfbc3
movq 0xd571(%rip), %rax      # 0x1cfb0
movq (%rax), %rdi
movq %rdi, 0x8(%rsp)
cmpb $0x0, (%rdi)
je 0xfbc0
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x3130
movq %rax, 0x40(%rsp)
movq 0x8(%rsp), %rax
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0xfa7e
cmpl $0x2c, %ecx
jne 0xfbc0
incq %rax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq 0x10d22
movq 0x8(%rsp), %rdi
jmp 0xfa47
movq 0xd517(%rip), %rax      # 0x1cfb0
movq (%rax), %rax
movq %rax, 0x20(%r12)
jmp 0xfbc0
movq 0xd503(%rip), %rax      # 0x1cfb0
movq (%rax), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3570
leal -0x1(%rax), %ecx
movb $0x1, %r13b
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0xfbc3
movl %eax, 0x10(%r12)
jmp 0xfbc3
movq 0xd4d1(%rip), %rax      # 0x1cfb0
movq (%rax), %rax
movq %rax, 0x30(%r12)
jmp 0xfbc0
movq 0xd4bd(%rip), %rax      # 0x1cfb0
movq (%rax), %rax
movq %rax, 0x48(%r12)
jmp 0xfbc0
movq 0xd4a9(%rip), %rax      # 0x1cfb0
movq (%rax), %rax
movq %rax, 0x28(%r12)
jmp 0xfbc0
movq 0xd495(%rip), %rax      # 0x1cfb0
movq (%rax), %rax
movq %rax, 0x50(%r12)
jmp 0xfbc0
movq 0xd481(%rip), %rax      # 0x1cfb0
movq (%rax), %r12
movq %r12, %rdi
callq 0x31c0
movb $0x1, %r13b
cmpq $0x8, %rax
jne 0xfbec
movq %r12, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x3570
testq %rax, %rax
je 0xfbce
movq 0xd44e(%rip), %rax      # 0x1cfb0
movq (%rax), %rax
movq 0x10(%rsp), %r12
movq %rax, 0x58(%r12)
jmp 0xfbc3
movq 0x38(%rsp), %rdi
movq 0xd433(%rip), %rsi      # 0x1cfb0
callq 0x10ac8
jmp 0xfbc0
xorl %r13d, %r13d
jmp 0xfbc3
movq %r12, %rdi
callq 0x31c0
leaq 0x8(%rax), %rdi
callq 0x3500
movq %rax, %r13
movabsq $0x3a464646463a3a, %rax # imm = 0x3A464646463A3A
movq %rax, (%r13)
movq %r13, %rdi
movq %r12, %rsi
callq 0x36a0
movq 0x10(%rsp), %r12
movq %r13, 0x40(%r12)
movb $0x1, %r13b
testb %r13b, %r13b
jne 0xf8ce
jmp 0xfc07
movq 0xd3db(%rip), %rax      # 0x1cfb0
movq (%rax), %rdi
leaq 0x573c(%rip), %rsi      # 0x1531b
callq 0x3560
testl %eax, %eax
je 0xfb5b
movq 0x10(%rsp), %r12
jmp 0xfbc3
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x3831
jmp 0xf8dc
cmpq $0x0, 0xa0(%r12)
jne 0xfd68
leaq 0x8(%rsp), %r12
movq $0x1, (%r12)
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0x5, (%r12)
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0x9, (%r12)
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0x49, (%r12)
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0x809, (%r12)          # imm = 0x809
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0x849, (%r12)          # imm = 0x849
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0xd, (%r12)
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0x400, (%r12)          # imm = 0x400
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0x404, (%r12)          # imm = 0x404
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0x408, (%r12)          # imm = 0x408
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0x448, (%r12)          # imm = 0x448
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0xc08, (%r12)          # imm = 0xC08
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0xc48, (%r12)          # imm = 0xC48
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x10e34
movq $0x40c, (%r12)          # imm = 0x40C
movq 0x10(%rsp), %r12
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x10e34
cmpq $0x0, 0x30(%r12)
setne %al
cmpq $0x0, 0x28(%r12)
sete %cl
testb %cl, %al
jne 0xfd94
testb $0x1, 0x20(%rsp)
jne 0xfd94
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x3b39
jmp 0xfd85