// File: tenup-coin[P]seeder/main.cpp
// Function: CDnsSeedOpts::ParseCommandLine(int, char**)
void ParseCommandLine(int argc, char **argv) {
    static const char *help = "tenup-seeder\n"
                              "Usage: %s -h <host> -n <ns> [-m <mbox>] [-t <threads>] [-p <port>]\n"
                              "\n"
                              "Options:\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"
                              "-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"
                              "--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[] = {
        {"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'},
        {"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'},
        {"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, "h:n:m:t:p:d:o:i:k:w:", long_options, &option_index);
      if (c == -1) break;
      switch (c) {
        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 '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 '?': {
          showHelp = true;
          break;
        }
      }
    }
    if (filter_whitelist.empty()) {
        filter_whitelist.insert(1);
        filter_whitelist.insert(5);
        filter_whitelist.insert(9);
        filter_whitelist.insert(13);
    }
    if (host != NULL && ns == NULL) showHelp = true;
    if (showHelp) fprintf(stderr, help, argv[0]);
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movb $0x0, -0x19(%rbp)
cmpb $0x0, 0x25114(%rip)     # 0x4a9c0
jne 0x25b70
leaq 0x25107(%rip), %rdi     # 0x4a9c0
callq 0x4840
cmpl $0x0, %eax
je 0x25b70
movq -0xb8(%rbp), %rax
leaq 0xe8e9(%rip), %rcx      # 0x341be
movq %rcx, 0x24f04(%rip)     # 0x4a7e0
movl $0x1, 0x24f02(%rip)     # 0x4a7e8
movq $0x0, 0x24eff(%rip) # 0x4a7f0
movl $0x68, 0x24efd(%rip)    # 0x4a7f8
leaq 0xe8c1(%rip), %rcx      # 0x341c3
movq %rcx, 0x24ef7(%rip)     # 0x4a800
movl $0x1, 0x24ef5(%rip)     # 0x4a808
movq $0x0, 0x24ef2(%rip) # 0x4a810
movl $0x6e, 0x24ef0(%rip)    # 0x4a818
leaq 0xe897(%rip), %rcx      # 0x341c6
movq %rcx, 0x24eea(%rip)     # 0x4a820
movl $0x1, 0x24ee8(%rip)     # 0x4a828
movq $0x0, 0x24ee5(%rip) # 0x4a830
movl $0x6d, 0x24ee3(%rip)    # 0x4a838
leaq 0xe872(%rip), %rcx      # 0x341ce
movq %rcx, 0x24edd(%rip)     # 0x4a840
movl $0x1, 0x24edb(%rip)     # 0x4a848
movq $0x0, 0x24ed8(%rip) # 0x4a850
movl $0x74, 0x24ed6(%rip)    # 0x4a858
leaq 0xe842(%rip), %rcx      # 0x341cb
movq %rcx, 0x24ed0(%rip)     # 0x4a860
movl $0x1, 0x24ece(%rip)     # 0x4a868
movq $0x0, 0x24ecb(%rip) # 0x4a870
movl $0x64, 0x24ec9(%rip)    # 0x4a878
leaq 0xe820(%rip), %rcx      # 0x341d6
movq %rcx, 0x24ec3(%rip)     # 0x4a880
movl $0x1, 0x24ec1(%rip)     # 0x4a888
movq $0x0, 0x24ebe(%rip) # 0x4a890
movl $0x70, 0x24ebc(%rip)    # 0x4a898
leaq 0xd9e5(%rip), %rcx      # 0x333c8
movq %rcx, 0x24eb6(%rip)     # 0x4a8a0
movl $0x1, 0x24eb4(%rip)     # 0x4a8a8
movq $0x0, 0x24eb1(%rip) # 0x4a8b0
movl $0x6f, 0x24eaf(%rip)    # 0x4a8b8
leaq 0xe7cb(%rip), %rcx      # 0x341db
movq %rcx, 0x24ea9(%rip)     # 0x4a8c0
movl $0x1, 0x24ea7(%rip)     # 0x4a8c8
movq $0x0, 0x24ea4(%rip) # 0x4a8d0
movl $0x69, 0x24ea2(%rip)    # 0x4a8d8
leaq 0xe7a8(%rip), %rcx      # 0x341e5
movq %rcx, 0x24e9c(%rip)     # 0x4a8e0
movl $0x1, 0x24e9a(%rip)     # 0x4a8e8
movq $0x0, 0x24e97(%rip) # 0x4a8f0
movl $0x6b, 0x24e95(%rip)    # 0x4a8f8
leaq 0xe785(%rip), %rcx      # 0x341ef
movq %rcx, 0x24e8f(%rip)     # 0x4a900
movl $0x1, 0x24e8d(%rip)     # 0x4a908
movq $0x0, 0x24e8a(%rip) # 0x4a910
movl $0x77, 0x24e88(%rip)    # 0x4a918
leaq 0xe75f(%rip), %rcx      # 0x341f6
movq %rcx, 0x24e82(%rip)     # 0x4a920
movl $0x0, 0x24e80(%rip)     # 0x4a928
movq %rax, %rcx
addq $0xc, %rcx
movq %rcx, 0x24e7a(%rip)     # 0x4a930
movl $0x1, 0x24e78(%rip)     # 0x4a938
leaq 0xe737(%rip), %rcx      # 0x341fe
movq %rcx, 0x24e72(%rip)     # 0x4a940
movl $0x0, 0x24e70(%rip)     # 0x4a948
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, 0x24e6a(%rip)     # 0x4a950
movl $0x1, 0x24e68(%rip)     # 0x4a958
leaq 0xe70f(%rip), %rcx      # 0x34206
movq %rcx, 0x24e62(%rip)     # 0x4a960
movl $0x0, 0x24e60(%rip)     # 0x4a968
addq $0x10, %rax
movq %rax, 0x24e5d(%rip)     # 0x4a970
movl $0x1, 0x24e5b(%rip)     # 0x4a978
leaq 0xe6ed(%rip), %rax      # 0x34211
movq %rax, 0x24e55(%rip)     # 0x4a980
movl $0x0, 0x24e53(%rip)     # 0x4a988
movq $0x0, 0x24e50(%rip) # 0x4a990
movl $0x68, 0x24e4e(%rip)    # 0x4a998
leaq 0x24c8f(%rip), %rdi     # 0x4a7e0
addq $0x1c0, %rdi            # imm = 0x1C0
xorl %esi, %esi
movl $0x20, %edx
callq 0x4270
leaq 0x24e55(%rip), %rdi     # 0x4a9c0
callq 0x4330
movl $0x0, -0x20(%rbp)
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
leaq 0xe691(%rip), %rdx      # 0x34216
leaq 0x24c54(%rip), %rcx     # 0x4a7e0
leaq -0x20(%rbp), %r8
callq 0x47a0
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x24(%rbp)
jne 0x25ba3
jmp 0x25d9d
movl -0x24(%rbp), %eax
addl $-0x3f, %eax
movl %eax, %ecx
movq %rcx, -0xc0(%rbp)
subl $0x38, %eax
ja 0x25d98
movq -0xc0(%rbp), %rax
leaq 0xdea7(%rip), %rcx      # 0x33a70
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0xb8(%rbp), %rax
movq 0x243a8(%rip), %rcx     # 0x49f88
movq (%rcx), %rcx
movq %rcx, 0x28(%rax)
jmp 0x25d98
movq -0xb8(%rbp), %rax
movq 0x2438e(%rip), %rcx     # 0x49f88
movq (%rcx), %rcx
movq %rcx, 0x18(%rax)
jmp 0x25d98
movq -0xb8(%rbp), %rax
movq 0x24374(%rip), %rcx     # 0x49f88
movq (%rcx), %rcx
movq %rcx, 0x20(%rax)
jmp 0x25d98
movq 0x24361(%rip), %rax     # 0x49f88
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x46c0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x25c56
cmpl $0x3e8, -0x28(%rbp)     # imm = 0x3E8
jge 0x25c56
movq -0xb8(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x25d98
movq 0x24326(%rip), %rax     # 0x49f88
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x46c0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jle 0x25c92
cmpl $0x3e8, -0x2c(%rbp)     # imm = 0x3E8
jge 0x25c92
movq -0xb8(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0x25d98
movq 0x242ea(%rip), %rax     # 0x49f88
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x46c0
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jle 0x25cce
cmpl $0x10000, -0x30(%rbp)   # imm = 0x10000
jge 0x25cce
movq -0xb8(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, 0x4(%rax)
jmp 0x25d98
movq -0xb8(%rbp), %rax
movq 0x242a7(%rip), %rcx     # 0x49f88
movq (%rcx), %rcx
movq %rcx, 0x30(%rax)
jmp 0x25d98
movq -0xb8(%rbp), %rax
movq 0x2428d(%rip), %rcx     # 0x49f88
movq (%rcx), %rcx
movq %rcx, 0x38(%rax)
jmp 0x25d98
movq -0xb8(%rbp), %rax
movq 0x24273(%rip), %rcx     # 0x49f88
movq (%rcx), %rcx
movq %rcx, 0x40(%rax)
jmp 0x25d98
movq 0x24263(%rip), %rax     # 0x49f88
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x25d92
movq -0x38(%rbp), %rdi
leaq -0x38(%rbp), %rsi
xorl %edx, %edx
callq 0x4170
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
jne 0x25d65
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x25d75
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x25d73
jmp 0x25d92
jmp 0x25d75
movq -0xb8(%rbp), %rdi
addq $0x48, %rdi
leaq -0x40(%rbp), %rsi
callq 0x298c0
movq %rax, -0x50(%rbp)
movb %dl, -0x48(%rbp)
jmp 0x25d2c
jmp 0x25d98
movb $0x1, -0x19(%rbp)
jmp 0x258a5
movq -0xb8(%rbp), %rdi
addq $0x48, %rdi
callq 0x29910
testb $0x1, %al
jne 0x25db6
jmp 0x25e5a
movq -0xb8(%rbp), %rdi
addq $0x48, %rdi
movq $0x1, -0x58(%rbp)
leaq -0x58(%rbp), %rsi
callq 0x29930
movq -0xb8(%rbp), %rdi
movq %rax, -0x68(%rbp)
movb %dl, -0x60(%rbp)
addq $0x48, %rdi
movq $0x5, -0x70(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x29930
movq -0xb8(%rbp), %rdi
movq %rax, -0x80(%rbp)
movb %dl, -0x78(%rbp)
addq $0x48, %rdi
movq $0x9, -0x88(%rbp)
leaq -0x88(%rbp), %rsi
callq 0x29930
movq -0xb8(%rbp), %rdi
movq %rax, -0x98(%rbp)
movb %dl, -0x90(%rbp)
addq $0x48, %rdi
movq $0xd, -0xa0(%rbp)
leaq -0xa0(%rbp), %rsi
callq 0x29930
movq %rax, -0xb0(%rbp)
movb %dl, -0xa8(%rbp)
movq -0xb8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x25e7a
movq -0xb8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x25e7a
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
je 0x25e9f
movq 0x24141(%rip), %rax     # 0x49fc8
movq (%rax), %rdi
movq 0x2464f(%rip), %rsi     # 0x4a4e0
movq -0x18(%rbp), %rax
movq (%rax), %rdx
movb $0x0, %al
callq 0x4700
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)