#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct option {
  char *member_0;
  int *member_2;
  int member_3;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ config_send(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                               char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ device_check(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int);
int getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ no_argument;
char *optarg;
int optind;
int parse_ip_address(char *, int /*<<< orphan*/ *);
int parse_key(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ required_argument;
int strlen(char *);
int tcp_connect_to(char *, int);
int main(int argc, char *argv[]) {
  int option = 0;
  int dhcp = 0;
  int manual_param_count = 0;
  uint8_t address[4] = {0};
  uint8_t mask[4] = {0};
  uint8_t gateway[4] = {0};
  uint8_t nameserver[4] = {0};
  uint8_t key[16] = {0};
  char *label = NULL;
  char *netlight_address = NULL;
  int sockfd = -1;
  struct option long_options[] = {{"dhcp", no_argument, &dhcp, 1},
                                  {"address", required_argument, 0, 'a'},
                                  {"mask", required_argument, 0, 'm'},
                                  {"gateway", required_argument, 0, 'g'},
                                  {"nameserver", required_argument, 0, 'n'},
                                  {"label", required_argument, 0, 'l'},
                                  {"key", required_argument, 0, 'k'},
                                  {0, 0, 0, 0}};
  int option_index = 0;
  int result = 0;
  while ((option = getopt_long(argc, argv, "da:m:g:n:l:k:", long_options,
                               &option_index)) != -1) {
    switch (option) {
    case 0:
      break;
    case 'd':
      dhcp = 1;
      break;
    case 'a':
      result = parse_ip_address(optarg, address);
      if (result != 1) {
        error("Error parsing address parameter");
      }
      manual_param_count += 1;
      break;
    case 'm':
      result = parse_ip_address(optarg, mask);
      if (result != 1) {
        error("Error parsing mask parameter");
      }
      manual_param_count += 1;
      break;
    case 'g':
      result = parse_ip_address(optarg, gateway);
      if (result != 1) {
        error("Error parsing gateway parameter");
      }
      manual_param_count += 1;
      break;
    case 'n':
      result = parse_ip_address(optarg, nameserver);
      if (result != 1) {
        error("Error parsing nameserver parameter");
      }
      manual_param_count += 1;
      break;
    case 'l':
      label = optarg;
      if (strlen(label) > 16) {
        error("Label exceeds maximum length");
      }
      break;
    case 'k':
      if (strlen(optarg) != (16 * 2)) {
        error("Key must be 32 hex digits (16 bytes) long");
      }
      result = parse_key(optarg, key);
      if (result != 1) {
        error("Error parsing encryption key");
      }
      break;
    default:
      print_usage();
      exit(EXIT_FAILURE);
    }
  }
  if (label != NULL) {
    printf("LABEL: %s\n", label);
  }
  printf("DHCP: %d\n", dhcp);
  if (optind >= argc || argv[optind] == NULL) {
    puts("ERROR: Target NetLight network address required");
    print_usage();
    exit(EXIT_FAILURE);
  } else {
    netlight_address = argv[optind];
  }
  if ((dhcp == 1 && manual_param_count > 0) ||
      (dhcp == 0 && manual_param_count == 0)) {
    error("Specify either --dhcp or the manual network configuration "
          "parameters, but not both");
  }
  if (dhcp == 0 && manual_param_count != 4) {
    error("All the manual network parameters must be specified");
  }
  sockfd = tcp_connect_to(netlight_address, 3601);
  if (sockfd < 0) {
    exit(-1);
  }
  if (!device_check(sockfd, "NL5", 1, 0)) {
    close(sockfd);
    error("Did not find NL5 at host address");
  }
  config_send(sockfd, address, mask, gateway, nameserver, label, key);
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <memset@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <memset@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <memset@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <memset@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   10a0 <memset@plt>
movq   $0x0,-0xa8(%rbp)
movq   $0x0,-0xb0(%rbp)
movl   $0xffffffff,-0xb4(%rbp)
ff ff ff
lea    -0x180(%rbp),%rdi
lea    0xd71(%rip),%rax
mov    %rax,-0x180(%rbp)
mov    0x2d2b(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x178(%rbp)
lea    -0x18(%rbp),%rax
mov    %eax,-0x170(%rbp)
movl   $0x1,-0x16c(%rbp)
add    $0x18,%rdi
lea    0xf38(%rip),%rax
mov    %rax,-0x168(%rbp)
mov    0x2d04(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x160(%rbp)
movl   $0x0,-0x158(%rbp)
movl   $0x61,-0x154(%rbp)
add    $0x18,%rdi
lea    0xd08(%rip),%rax
mov    %rax,-0x150(%rbp)
mov    0x2ccd(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x148(%rbp)
movl   $0x0,-0x140(%rbp)
movl   $0x6d,-0x13c(%rbp)
add    $0x18,%rdi
lea    0xcd6(%rip),%rax
mov    %rax,-0x138(%rbp)
mov    0x2c96(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x130(%rbp)
movl   $0x0,-0x128(%rbp)
movl   $0x67,-0x124(%rbp)
add    $0x18,%rdi
lea    0xca7(%rip),%rax
mov    %rax,-0x120(%rbp)
mov    0x2c5f(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x118(%rbp)
movl   $0x0,-0x110(%rbp)
movl   $0x6e,-0x10c(%rbp)
add    $0x18,%rdi
lea    0xc7b(%rip),%rax
mov    %rax,-0x108(%rbp)
mov    0x2c28(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x100(%rbp)
movl   $0x0,-0xf8(%rbp)
movl   $0x6c,-0xf4(%rbp)
add    $0x18,%rdi
lea    0xd38(%rip),%rax
mov    %rax,-0xf0(%rbp)
mov    0x2bf1(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0xe8(%rbp)
movl   $0x0,-0xe0(%rbp)
movl   $0x6b,-0xdc(%rbp)
add    $0x18,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   10a0 <memset@plt>
movl   $0x0,-0x184(%rbp)
movl   $0x0,-0x188(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x180(%rbp),%rcx
lea    0xbe5(%rip),%rdx
lea    -0x184(%rbp),%r8
call   1080 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     16b8 <main+0x4d8>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18c(%rbp)
test   %eax,%eax
je     14f8 <main+0x318>
jmp    146c <main+0x28c>
mov    -0x18c(%rbp),%eax
sub    $0x61,%eax
je     1509 <main+0x329>
jmp    1480 <main+0x2a0>
mov    -0x18c(%rbp),%eax
sub    $0x64,%eax
je     14fd <main+0x31d>
jmp    1494 <main+0x2b4>
mov    -0x18c(%rbp),%eax
sub    $0x67,%eax
je     1589 <main+0x3a9>
jmp    14a8 <main+0x2c8>
mov    -0x18c(%rbp),%eax
sub    $0x6b,%eax
je     1640 <main+0x460>
jmp    14bc <main+0x2dc>
mov    -0x18c(%rbp),%eax
sub    $0x6c,%eax
je     1609 <main+0x429>
jmp    14d0 <main+0x2f0>
mov    -0x18c(%rbp),%eax
sub    $0x6d,%eax
je     1549 <main+0x369>
jmp    14e4 <main+0x304>
mov    -0x18c(%rbp),%eax
sub    $0x6e,%eax
je     15c9 <main+0x3e9>
jmp    169e <main+0x4be>
jmp    16b3 <main+0x4d3>
movl   $0x1,-0x18(%rbp)
jmp    16b3 <main+0x4d3>
mov    0x2ae8(%rip),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <parse_ip_address@plt>
mov    %eax,-0x188(%rbp)
cmpl   $0x1,-0x188(%rbp)
je     153b <main+0x35b>
lea    0xafb(%rip),%rdi
call   10d0 <error@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    16b3 <main+0x4d3>
mov    0x2aa8(%rip),%rax
mov    (%rax),%rdi
lea    -0x40(%rbp),%rsi
call   1060 <parse_ip_address@plt>
mov    %eax,-0x188(%rbp)
cmpl   $0x1,-0x188(%rbp)
je     157b <main+0x39b>
lea    0xadb(%rip),%rdi
call   10d0 <error@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    16b3 <main+0x4d3>
mov    0x2a68(%rip),%rax
mov    (%rax),%rdi
lea    -0x50(%rbp),%rsi
call   1060 <parse_ip_address@plt>
mov    %eax,-0x188(%rbp)
cmpl   $0x1,-0x188(%rbp)
je     15bb <main+0x3db>
lea    0xab8(%rip),%rdi
call   10d0 <error@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    16b3 <main+0x4d3>
mov    0x2a28(%rip),%rax
mov    (%rax),%rdi
lea    -0x60(%rbp),%rsi
call   1060 <parse_ip_address@plt>
mov    %eax,-0x188(%rbp)
cmpl   $0x1,-0x188(%rbp)
je     15fb <main+0x41b>
lea    0xa98(%rip),%rdi
call   10d0 <error@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    16b3 <main+0x4d3>
mov    0x29e8(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x10,%eax
jle    163b <main+0x45b>
lea    0xa7b(%rip),%rdi
call   10d0 <error@plt>
jmp    16b3 <main+0x4d3>
mov    0x29b1(%rip),%rax
mov    (%rax),%rdi
call   1070 <strlen@plt>
cmp    $0x20,%eax
je     1664 <main+0x484>
lea    0xa6f(%rip),%rdi
call   10d0 <error@plt>
mov    0x298d(%rip),%rax
mov    (%rax),%rdi
lea    -0xa0(%rbp),%rsi
call   10c0 <parse_key@plt>
mov    %eax,-0x188(%rbp)
cmpl   $0x1,-0x188(%rbp)
je     1699 <main+0x4b9>
lea    0xa64(%rip),%rdi
call   10d0 <error@plt>
jmp    16b3 <main+0x4d3>
mov    $0x0,%al
call   1100 <print_usage@plt>
mov    0x2914(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    1429 <main+0x249>
cmpq   $0x0,-0xa8(%rbp)
je     16db <main+0x4fb>
mov    -0xa8(%rbp),%rsi
lea    0xa41(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xa3b(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x28ed(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1717 <main+0x537>
mov    -0x10(%rbp),%rax
mov    0x28d7(%rip),%rcx
movslq (%rcx),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1738 <main+0x558>
lea    0xa0c(%rip),%rdi
call   1050 <puts@plt>
mov    $0x0,%al
call   1100 <print_usage@plt>
mov    0x288f(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x289d(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0xb0(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    1765 <main+0x585>
cmpl   $0x0,-0x1c(%rbp)
jg     1779 <main+0x599>
cmpl   $0x0,-0x18(%rbp)
jne    1785 <main+0x5a5>
cmpl   $0x0,-0x1c(%rbp)
jne    1785 <main+0x5a5>
lea    0x9da(%rip),%rdi
call   10d0 <error@plt>
cmpl   $0x0,-0x18(%rbp)
jne    17a5 <main+0x5c5>
cmpl   $0x4,-0x1c(%rbp)
je     17a5 <main+0x5c5>
lea    0xa0d(%rip),%rdi
call   10d0 <error@plt>
mov    -0xb0(%rbp),%rdi
mov    $0xe11,%esi
call   1040 <tcp_connect_to@plt>
mov    %eax,-0xb4(%rbp)
cmpl   $0x0,-0xb4(%rbp)
jge    17d3 <main+0x5f3>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0xb4(%rbp),%edi
lea    0xa01(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   10f0 <device_check@plt>
cmp    $0x0,%eax
jne    180c <main+0x62c>
mov    -0xb4(%rbp),%edi
call   10b0 <close@plt>
lea    0x9de(%rip),%rdi
call   10d0 <error@plt>
mov    -0xb4(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    -0x60(%rbp),%r8
mov    -0xa8(%rbp),%r9
lea    -0xa0(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <config_send@plt>
mov    -0xb4(%rbp),%edi
call   10b0 <close@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x0,0x10(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
lea    0xe0c(%rip),%rax
mov    %rax,0x60(%rsp)
mov    0x2d90(%rip),%rax
movslq (%rax),%rax
mov    %rax,0x68(%rsp)
lea    0x10(%rsp),%rax
mov    %eax,0x70(%rsp)
movl   $0x1,0x74(%rsp)
lea    0xfde(%rip),%rax
mov    %rax,0x78(%rsp)
mov    0x2d74(%rip),%rax
movslq (%rax),%rax
mov    %rax,0x80(%rsp)
movabs $0x6100000000,%rcx
mov    %rcx,0x88(%rsp)
lea    0xdb5(%rip),%rcx
mov    %rcx,0x90(%rsp)
mov    %rax,0x98(%rsp)
movabs $0x6d00000000,%rcx
mov    %rcx,0xa0(%rsp)
lea    0xd91(%rip),%rcx
mov    %rcx,0xa8(%rsp)
mov    %rax,0xb0(%rsp)
movabs $0x6700000000,%rcx
mov    %rcx,0xb8(%rsp)
lea    0xd70(%rip),%rcx
mov    %rcx,0xc0(%rsp)
mov    %rax,0xc8(%rsp)
movabs $0x6e00000000,%rcx
mov    %rcx,0xd0(%rsp)
lea    0xd52(%rip),%rcx
mov    %rcx,0xd8(%rsp)
mov    %rax,0xe0(%rsp)
movabs $0x6c00000000,%rcx
mov    %rcx,0xe8(%rsp)
lea    0xe1d(%rip),%rcx
mov    %rcx,0xf0(%rsp)
mov    %rax,0xf8(%rsp)
movabs $0x6b00000000,%rax
mov    %rax,0x100(%rsp)
movups %xmm0,0x108(%rsp)
movq   $0x0,0x118(%rsp)
movl   $0x0,0x14(%rsp)
xor    %r15d,%r15d
lea    0x60(%rsp),%r13
lea    0x14(%rsp),%r14
lea    0xc82(%rip),%r12
xor    %eax,%eax
mov    %rax,0x18(%rsp)
jmp    1390 <main+0x1c0>
add    $0x1,%r15d
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
lea    0xcbf(%rip),%rdx
mov    %r13,%rcx
mov    %r14,%r8
call   1080 <getopt_long@plt>
lea    -0x61(%rax),%ecx
cmp    $0xd,%ecx
ja     13e3 <main+0x213>
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
mov    0x2c39(%rip),%rax
mov    (%rax),%rdi
lea    0x50(%rsp),%rsi
call   1060 <parse_ip_address@plt>
cmp    $0x1,%eax
je     13dd <main+0x20d>
lea    0xc91(%rip),%rdi
call   10c0 <error@plt>
add    $0x1,%r15d
jmp    1390 <main+0x1c0>
test   %eax,%eax
je     1390 <main+0x1c0>
jmp    14ff <main+0x32f>
movl   $0x1,0x10(%rsp)
jmp    1390 <main+0x1c0>
mov    0x2bfb(%rip),%rax
mov    (%rax),%rdi
lea    0x30(%rsp),%rsi
call   1060 <parse_ip_address@plt>
cmp    $0x1,%eax
je     1387 <main+0x1b7>
lea    0xc8c(%rip),%rdi
call   10c0 <error@plt>
jmp    1387 <main+0x1b7>
mov    0x2bcd(%rip),%rax
mov    (%rax),%rdi
lea    0x40(%rsp),%rsi
call   1060 <parse_ip_address@plt>
cmp    $0x1,%eax
je     1449 <main+0x279>
lea    0xc45(%rip),%rdi
call   10c0 <error@plt>
add    $0x1,%r15d
jmp    1390 <main+0x1c0>
mov    0x2b9f(%rip),%rax
mov    (%rax),%rdi
call   1070 <strlen@plt>
cmp    $0x20,%eax
je     1472 <main+0x2a2>
lea    0xc99(%rip),%rdi
call   10c0 <error@plt>
mov    0x2b7f(%rip),%rax
mov    (%rax),%rdi
lea    0x120(%rsp),%rsi
call   10b0 <parse_key@plt>
cmp    $0x1,%eax
je     1390 <main+0x1c0>
lea    0xc97(%rip),%rdi
call   10c0 <error@plt>
jmp    1390 <main+0x1c0>
mov    0x2b4e(%rip),%rax
mov    (%rax),%rdi
mov    %rdi,0x18(%rsp)
call   1070 <strlen@plt>
cmp    $0x11,%eax
jl     1390 <main+0x1c0>
lea    0xc22(%rip),%rdi
call   10c0 <error@plt>
jmp    1390 <main+0x1c0>
mov    0x2b20(%rip),%rax
mov    (%rax),%rdi
lea    0x20(%rsp),%rsi
call   1060 <parse_ip_address@plt>
cmp    $0x1,%eax
je     14f6 <main+0x326>
lea    0xbd5(%rip),%rdi
call   10c0 <error@plt>
add    $0x1,%r15d
jmp    1390 <main+0x1c0>
cmp    $0xffffffff,%eax
jne    1623 <main+0x453>
mov    0x18(%rsp),%r14
test   %r14,%r14
je     1523 <main+0x353>
lea    0xc34(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xc2a(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x2aa4(%rip),%rax
movslq (%rax),%rax
cmp    %ebp,%eax
jge    1617 <main+0x447>
mov    (%rbx,%rax,8),%rbx
test   %rbx,%rbx
je     1617 <main+0x447>
mov    0x10(%rsp),%eax
cmp    $0x1,%eax
jne    1562 <main+0x392>
test   %r15d,%r15d
jg     1569 <main+0x399>
mov    %eax,%ecx
or     %r15d,%ecx
jne    1579 <main+0x3a9>
lea    0xc22(%rip),%rdi
call   10c0 <error@plt>
mov    0x10(%rsp),%eax
test   %eax,%eax
jne    158f <main+0x3bf>
cmp    $0x4,%r15d
je     158f <main+0x3bf>
lea    0xc5b(%rip),%rdi
call   10c0 <error@plt>
mov    %rbx,%rdi
mov    $0xe11,%esi
call   1040 <tcp_connect_to@plt>
test   %eax,%eax
js     1638 <main+0x468>
mov    %eax,%ebx
lea    0xc6c(%rip),%rsi
mov    %eax,%edi
mov    $0x1,%edx
xor    %ecx,%ecx
call   10e0 <device_check@plt>
test   %eax,%eax
jne    15d2 <main+0x402>
mov    %ebx,%edi
call   10a0 <close@plt>
lea    0xc50(%rip),%rdi
call   10c0 <error@plt>
lea    0x120(%rsp),%rax
mov    %rax,(%rsp)
lea    0x50(%rsp),%rsi
lea    0x40(%rsp),%rdx
lea    0x30(%rsp),%rcx
lea    0x20(%rsp),%r8
mov    %ebx,%edi
mov    %r14,%r9
call   1030 <config_send@plt>
mov    %ebx,%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb44(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10f0 <print_usage@plt>
mov    0x298f(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i32*, i32, i32 }
@.str = [5 x i8] c"dhcp\00"
@no_argument = global i32 0
@.str.1 = [8 x i8] c"address\00"
@required_argument = global i32 0
@.str.2 = [5 x i8] c"mask\00"
@.str.3 = [8 x i8] c"gateway\00"
@.str.4 = [11 x i8] c"nameserver\00"
@.str.5 = [6 x i8] c"label\00"
@.str.6 = [4 x i8] c"key\00"
@.str.7 = [14 x i8] c"da:m:g:n:l:k:\00"
@optarg = global i8* null
@.str.8 = [32 x i8] c"Error parsing address parameter\00"
@.str.9 = [29 x i8] c"Error parsing mask parameter\00"
@.str.10 = [32 x i8] c"Error parsing gateway parameter\00"
@.str.11 = [35 x i8] c"Error parsing nameserver parameter\00"
@.str.12 = [29 x i8] c"Label exceeds maximum length\00"
@.str.13 = [42 x i8] c"Key must be 32 hex digits (16 bytes) long\00"
@.str.14 = [29 x i8] c"Error parsing encryption key\00"
@EXIT_FAILURE = global i32 0
@.str.15 = [11 x i8] c"LABEL: %s\0A\00"
@.str.16 = [10 x i8] c"DHCP: %d\0A\00"
@optind = global i32 0
@.str.17 = [48 x i8] c"ERROR: Target NetLight network address required\00"
@.str.18 = [83 x i8] c"Specify either --dhcp or the manual network configuration parameters, but not both\00"
@.str.19 = [52 x i8] c"All the manual network parameters must be specified\00"
@.str.20 = [4 x i8] c"NL5\00"
@.str.21 = [33 x i8] c"Did not find NL5 at host address\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [4 x i32]
%10 = alloca [4 x i32]
%11 = alloca [4 x i32]
%12 = alloca [4 x i32]
%13 = alloca [16 x i32]
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca [8 x %struct.option]
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%20 = bitcast [4 x i32]* %9 to i8*
%21 = bitcast [4 x i32]* %10 to i8*
%22 = bitcast [4 x i32]* %11 to i8*
%23 = bitcast [4 x i32]* %12 to i8*
%24 = bitcast [16 x i32]* %13 to i8*
store i8* null, i8** %14
store i8* null, i8** %15
store i32 -1, i32* %16
%25 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %17, i64 0, i64 0
%26 = getelementptr inbounds %struct.option, %struct.option* %25, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %26
%27 = getelementptr inbounds %struct.option, %struct.option* %25, i32 0, i32 1
%28 = load i32, i32* @no_argument
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i32*
store i32* %30, i32** %27
%31 = getelementptr inbounds %struct.option, %struct.option* %25, i32 0, i32 2
%32 = ptrtoint i32* %7 to i32
store i32 %32, i32* %31
%33 = getelementptr inbounds %struct.option, %struct.option* %25, i32 0, i32 3
store i32 1, i32* %33
%34 = getelementptr inbounds %struct.option, %struct.option* %25, i64 1
%35 = getelementptr inbounds %struct.option, %struct.option* %34, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %35
%36 = getelementptr inbounds %struct.option, %struct.option* %34, i32 0, i32 1
%37 = load i32, i32* @required_argument
%38 = sext i32 %37 to i64
%39 = inttoptr i64 %38 to i32*
store i32* %39, i32** %36
%40 = getelementptr inbounds %struct.option, %struct.option* %34, i32 0, i32 2
store i32 0, i32* %40
%41 = getelementptr inbounds %struct.option, %struct.option* %34, i32 0, i32 3
store i32 97, i32* %41
%42 = getelementptr inbounds %struct.option, %struct.option* %34, i64 1
%43 = getelementptr inbounds %struct.option, %struct.option* %42, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %43
%44 = getelementptr inbounds %struct.option, %struct.option* %42, i32 0, i32 1
%45 = load i32, i32* @required_argument
%46 = sext i32 %45 to i64
%47 = inttoptr i64 %46 to i32*
store i32* %47, i32** %44
%48 = getelementptr inbounds %struct.option, %struct.option* %42, i32 0, i32 2
store i32 0, i32* %48
%49 = getelementptr inbounds %struct.option, %struct.option* %42, i32 0, i32 3
store i32 109, i32* %49
%50 = getelementptr inbounds %struct.option, %struct.option* %42, i64 1
%51 = getelementptr inbounds %struct.option, %struct.option* %50, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %51
%52 = getelementptr inbounds %struct.option, %struct.option* %50, i32 0, i32 1
%53 = load i32, i32* @required_argument
%54 = sext i32 %53 to i64
%55 = inttoptr i64 %54 to i32*
store i32* %55, i32** %52
%56 = getelementptr inbounds %struct.option, %struct.option* %50, i32 0, i32 2
store i32 0, i32* %56
%57 = getelementptr inbounds %struct.option, %struct.option* %50, i32 0, i32 3
store i32 103, i32* %57
%58 = getelementptr inbounds %struct.option, %struct.option* %50, i64 1
%59 = getelementptr inbounds %struct.option, %struct.option* %58, i32 0, i32 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %59
%60 = getelementptr inbounds %struct.option, %struct.option* %58, i32 0, i32 1
%61 = load i32, i32* @required_argument
%62 = sext i32 %61 to i64
%63 = inttoptr i64 %62 to i32*
store i32* %63, i32** %60
%64 = getelementptr inbounds %struct.option, %struct.option* %58, i32 0, i32 2
store i32 0, i32* %64
%65 = getelementptr inbounds %struct.option, %struct.option* %58, i32 0, i32 3
store i32 110, i32* %65
%66 = getelementptr inbounds %struct.option, %struct.option* %58, i64 1
%67 = getelementptr inbounds %struct.option, %struct.option* %66, i32 0, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %67
%68 = getelementptr inbounds %struct.option, %struct.option* %66, i32 0, i32 1
%69 = load i32, i32* @required_argument
%70 = sext i32 %69 to i64
%71 = inttoptr i64 %70 to i32*
store i32* %71, i32** %68
%72 = getelementptr inbounds %struct.option, %struct.option* %66, i32 0, i32 2
store i32 0, i32* %72
%73 = getelementptr inbounds %struct.option, %struct.option* %66, i32 0, i32 3
store i32 108, i32* %73
%74 = getelementptr inbounds %struct.option, %struct.option* %66, i64 1
%75 = getelementptr inbounds %struct.option, %struct.option* %74, i32 0, i32 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8** %75
%76 = getelementptr inbounds %struct.option, %struct.option* %74, i32 0, i32 1
%77 = load i32, i32* @required_argument
%78 = sext i32 %77 to i64
%79 = inttoptr i64 %78 to i32*
store i32* %79, i32** %76
%80 = getelementptr inbounds %struct.option, %struct.option* %74, i32 0, i32 2
store i32 0, i32* %80
%81 = getelementptr inbounds %struct.option, %struct.option* %74, i32 0, i32 3
store i32 107, i32* %81
%82 = getelementptr inbounds %struct.option, %struct.option* %74, i64 1
%83 = bitcast %struct.option* %82 to i8*
store i32 0, i32* %18
store i32 0, i32* %19
br label %84
84: ; preds = %165, %2
%85 = load i32, i32* %4
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %17, i64 0, i64 0
%88 = call i32 @getopt_long(i32 %85, i8** %86, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), %struct.option* %87, i32* %18)
store i32 %88, i32* %6
%89 = icmp ne i32 %88, -1
br i1 %89, label %90, label %166
90: ; preds = %84
%91 = load i32, i32* %6
switch i32 %91, label %161 [
i32 0, label %92
i32 100, label %93
i32 97, label %94
i32 109, label %105
i32 103, label %116
i32 110, label %127
i32 108, label %138
i32 107, label %146
]
92: ; preds = %90
br label %165
93: ; preds = %90
store i32 1, i32* %7
br label %165
94: ; preds = %90
%95 = load i8*, i8** @optarg
%96 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%97 = call i32 @parse_ip_address(i8* %95, i32* %96)
store i32 %97, i32* %19
%98 = load i32, i32* %19
%99 = icmp ne i32 %98, 1
br i1 %99, label %100, label %102
100: ; preds = %94
%101 = call i32 @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0))
br label %102
102: ; preds = %100, %94
%103 = load i32, i32* %8
%104 = add nsw i32 %103, 1
store i32 %104, i32* %8
br label %165
105: ; preds = %90
%106 = load i8*, i8** @optarg
%107 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%108 = call i32 @parse_ip_address(i8* %106, i32* %107)
store i32 %108, i32* %19
%109 = load i32, i32* %19
%110 = icmp ne i32 %109, 1
br i1 %110, label %111, label %113
111: ; preds = %105
%112 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
br label %113
113: ; preds = %111, %105
%114 = load i32, i32* %8
%115 = add nsw i32 %114, 1
store i32 %115, i32* %8
br label %165
116: ; preds = %90
%117 = load i8*, i8** @optarg
%118 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 0
%119 = call i32 @parse_ip_address(i8* %117, i32* %118)
store i32 %119, i32* %19
%120 = load i32, i32* %19
%121 = icmp ne i32 %120, 1
br i1 %121, label %122, label %124
122: ; preds = %116
%123 = call i32 @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0))
br label %124
124: ; preds = %122, %116
%125 = load i32, i32* %8
%126 = add nsw i32 %125, 1
store i32 %126, i32* %8
br label %165
127: ; preds = %90
%128 = load i8*, i8** @optarg
%129 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 0
%130 = call i32 @parse_ip_address(i8* %128, i32* %129)
store i32 %130, i32* %19
%131 = load i32, i32* %19
%132 = icmp ne i32 %131, 1
br i1 %132, label %133, label %135
133: ; preds = %127
%134 = call i32 @error(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0))
br label %135
135: ; preds = %133, %127
%136 = load i32, i32* %8
%137 = add nsw i32 %136, 1
store i32 %137, i32* %8
br label %165
138: ; preds = %90
%139 = load i8*, i8** @optarg
store i8* %139, i8** %14
%140 = load i8*, i8** %14
%141 = call i32 @strlen(i8* %140)
%142 = icmp sgt i32 %141, 16
br i1 %142, label %143, label %145
143: ; preds = %138
%144 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0))
br label %145
145: ; preds = %143, %138
br label %165
146: ; preds = %90
%147 = load i8*, i8** @optarg
%148 = call i32 @strlen(i8* %147)
%149 = icmp ne i32 %148, 32
br i1 %149, label %150, label %152
150: ; preds = %146
%151 = call i32 @error(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0))
br label %152
152: ; preds = %150, %146
%153 = load i8*, i8** @optarg
%154 = getelementptr inbounds [16 x i32], [16 x i32]* %13, i64 0, i64 0
%155 = call i32 @parse_key(i8* %153, i32* %154)
store i32 %155, i32* %19
%156 = load i32, i32* %19
%157 = icmp ne i32 %156, 1
br i1 %157, label %158, label %160
158: ; preds = %152
%159 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0))
br label %160
160: ; preds = %158, %152
br label %165
161: ; preds = %90
%162 = call i32 (...) @print_usage()
%163 = load i32, i32* @EXIT_FAILURE
%164 = call i32 @exit(i32 %163)
unreachable
165: ; preds = %160, %145, %135, %124, %113, %102, %93, %92
br label %84
166: ; preds = %84
%167 = load i8*, i8** %14
%168 = icmp ne i8* %167, null
br i1 %168, label %169, label %172
169: ; preds = %166
%170 = load i8*, i8** %14
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* %170)
br label %172
172: ; preds = %169, %166
%173 = load i32, i32* %7
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i32 %173)
%175 = load i32, i32* @optind
%176 = load i32, i32* %4
%177 = icmp sge i32 %175, %176
br i1 %177, label %185, label %178
178: ; preds = %172
%179 = load i8**, i8*** %5
%180 = load i32, i32* @optind
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds i8*, i8** %179, i64 %181
%183 = load i8*, i8** %182
%184 = icmp eq i8* %183, null
br i1 %184, label %185, label %190
185: ; preds = %178, %172
%186 = call i32 @puts(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.17, i64 0, i64 0))
%187 = call i32 (...) @print_usage()
%188 = load i32, i32* @EXIT_FAILURE
%189 = call i32 @exit(i32 %188)
unreachable
190: ; preds = %178
%191 = load i8**, i8*** %5
%192 = load i32, i32* @optind
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds i8*, i8** %191, i64 %193
%195 = load i8*, i8** %194
store i8* %195, i8** %15
br label %196
196: ; preds = %190
%197 = load i32, i32* %7
%198 = icmp eq i32 %197, 1
br i1 %198, label %199, label %202
199: ; preds = %196
%200 = load i32, i32* %8
%201 = icmp sgt i32 %200, 0
br i1 %201, label %208, label %202
202: ; preds = %199, %196
%203 = load i32, i32* %7
%204 = icmp eq i32 %203, 0
br i1 %204, label %205, label %210
205: ; preds = %202
%206 = load i32, i32* %8
%207 = icmp eq i32 %206, 0
br i1 %207, label %208, label %210
208: ; preds = %205, %199
%209 = call i32 @error(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.18, i64 0, i64 0))
br label %210
210: ; preds = %208, %205, %202
%211 = load i32, i32* %7
%212 = icmp eq i32 %211, 0
br i1 %212, label %213, label %218
213: ; preds = %210
%214 = load i32, i32* %8
%215 = icmp ne i32 %214, 4
br i1 %215, label %216, label %218
216: ; preds = %213
%217 = call i32 @error(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.19, i64 0, i64 0))
br label %218
218: ; preds = %216, %213, %210
%219 = load i8*, i8** %15
%220 = call i32 @tcp_connect_to(i8* %219, i32 3601)
store i32 %220, i32* %16
%221 = load i32, i32* %16
%222 = icmp slt i32 %221, 0
br i1 %222, label %223, label %225
223: ; preds = %218
%224 = call i32 @exit(i32 -1)
unreachable
225: ; preds = %218
%226 = load i32, i32* %16
%227 = call i32 @device_check(i32 %226, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i32 1, i32 0)
%228 = icmp ne i32 %227, 0
br i1 %228, label %233, label %229
229: ; preds = %225
%230 = load i32, i32* %16
%231 = call i32 @close(i32 %230)
%232 = call i32 @error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.21, i64 0, i64 0))
br label %233
233: ; preds = %229, %225
%234 = load i32, i32* %16
%235 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%236 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%237 = getelementptr inbounds [4 x i32], [4 x i32]* %11, i64 0, i64 0
%238 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 0
%239 = load i8*, i8** %14
%240 = getelementptr inbounds [16 x i32], [16 x i32]* %13, i64 0, i64 0
%241 = call i32 @config_send(i32 %234, i32* %235, i32* %236, i32* %237, i32* %238, i8* %239, i32* %240)
%242 = load i32, i32* %16
%243 = call i32 @close(i32 %242)
ret i32 0
}

LLVM IR (-O2):
%struct.option = type { i8*, i32*, i32, i32 }
@.str = [5 x i8] c"dhcp\00"
@no_argument = global i32 0
@.str.1 = [8 x i8] c"address\00"
@required_argument = global i32 0
@.str.2 = [5 x i8] c"mask\00"
@.str.3 = [8 x i8] c"gateway\00"
@.str.4 = [11 x i8] c"nameserver\00"
@.str.5 = [6 x i8] c"label\00"
@.str.6 = [4 x i8] c"key\00"
@.str.7 = [14 x i8] c"da:m:g:n:l:k:\00"
@optarg = global i8* null
@.str.8 = [32 x i8] c"Error parsing address parameter\00"
@.str.9 = [29 x i8] c"Error parsing mask parameter\00"
@.str.10 = [32 x i8] c"Error parsing gateway parameter\00"
@.str.11 = [35 x i8] c"Error parsing nameserver parameter\00"
@.str.12 = [29 x i8] c"Label exceeds maximum length\00"
@.str.13 = [42 x i8] c"Key must be 32 hex digits (16 bytes) long\00"
@.str.14 = [29 x i8] c"Error parsing encryption key\00"
@EXIT_FAILURE = global i32 0
@.str.15 = [11 x i8] c"LABEL: %s\0A\00"
@.str.16 = [10 x i8] c"DHCP: %d\0A\00"
@optind = global i32 0
@.str.17 = [48 x i8] c"ERROR: Target NetLight network address required\00"
@.str.18 = [83 x i8] c"Specify either --dhcp or the manual network configuration parameters, but not both\00"
@.str.19 = [52 x i8] c"All the manual network parameters must be specified\00"
@.str.20 = [4 x i8] c"NL5\00"
@.str.21 = [33 x i8] c"Did not find NL5 at host address\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [4 x i32]
%5 = alloca [4 x i32]
%6 = alloca [4 x i32]
%7 = alloca [4 x i32]
%8 = alloca [16 x i32]
%9 = alloca [8 x %struct.option]
%10 = alloca i32
%11 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%12 = bitcast [4 x i32]* %4 to i8*
%13 = bitcast [4 x i32]* %5 to i8*
%14 = bitcast [4 x i32]* %6 to i8*
%15 = bitcast [4 x i32]* %7 to i8*
%16 = bitcast [16 x i32]* %8 to i8*
%17 = bitcast [8 x %struct.option]* %9 to i8*
%18 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 0
%19 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %19
%20 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 0, i32 1
%21 = load i32, i32* @no_argument
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
store i32* %23, i32** %20
%24 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 0, i32 2
%25 = ptrtoint i32* %3 to i64
%26 = trunc i64 %25 to i32
store i32 %26, i32* %24
%27 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 0, i32 3
store i32 1, i32* %27
%28 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %28
%29 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 1, i32 1
%30 = load i32, i32* @required_argument
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i32*
store i32* %32, i32** %29
%33 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 1, i32 2
store i32 0, i32* %33
%34 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 1, i32 3
store i32 97, i32* %34
%35 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 2, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %35
%36 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 2, i32 1
store i32* %32, i32** %36
%37 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 2, i32 2
store i32 0, i32* %37
%38 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 2, i32 3
store i32 109, i32* %38
%39 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 3, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %39
%40 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 3, i32 1
store i32* %32, i32** %40
%41 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 3, i32 2
store i32 0, i32* %41
%42 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 3, i32 3
store i32 103, i32* %42
%43 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 4, i32 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %43
%44 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 4, i32 1
store i32* %32, i32** %44
%45 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 4, i32 2
store i32 0, i32* %45
%46 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 4, i32 3
store i32 110, i32* %46
%47 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 5, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %47
%48 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 5, i32 1
store i32* %32, i32** %48
%49 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 5, i32 2
store i32 0, i32* %49
%50 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 5, i32 3
store i32 108, i32* %50
%51 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 6, i32 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8** %51
%52 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 6, i32 1
store i32* %32, i32** %52
%53 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 6, i32 2
store i32 0, i32* %53
%54 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 6, i32 3
store i32 107, i32* %54
%55 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %9, i64 0, i64 7
%56 = bitcast %struct.option* %55 to i8*
%57 = bitcast i32* %10 to i8*
store i32 0, i32* %10
%58 = getelementptr inbounds [16 x i32], [16 x i32]* %8, i64 0, i64 0
%59 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%60 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%61 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%62 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
br label %63
63: ; preds = %67, %2
%64 = phi i32 [ 0, %2 ], [ %68, %67 ]
%65 = phi i8* [ null, %2 ], [ %69, %67 ]
%66 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), %struct.option* %18, i32* %10)
switch i32 %66, label %121 [
i32 -1, label %125
i32 0, label %67
i32 100, label %70
i32 97, label %71
i32 109, label %79
i32 103, label %87
i32 110, label %95
i32 108, label %103
i32 107, label %109
]
67: ; preds = %63, %115, %119, %103, %107, %101, %93, %85, %77, %70
%68 = phi i32 [ %64, %119 ], [ %64, %115 ], [ %64, %107 ], [ %64, %103 ], [ %102, %101 ], [ %94, %93 ], [ %86, %85 ], [ %78, %77 ], [ %64, %70 ], [ %64, %63 ]
%69 = phi i8* [ %65, %119 ], [ %65, %115 ], [ %104, %107 ], [ %104, %103 ], [ %65, %101 ], [ %65, %93 ], [ %65, %85 ], [ %65, %77 ], [ %65, %70 ], [ %65, %63 ]
br label %63
70: ; preds = %63
store i32 1, i32* %3
br label %67
71: ; preds = %63
%72 = load i8*, i8** @optarg
%73 = call i32 @parse_ip_address(i8* %72, i32* %62)
%74 = icmp eq i32 %73, 1
br i1 %74, label %77, label %75
75: ; preds = %71
%76 = call i32 @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0))
br label %77
77: ; preds = %75, %71
%78 = add nsw i32 %64, 1
br label %67
79: ; preds = %63
%80 = load i8*, i8** @optarg
%81 = call i32 @parse_ip_address(i8* %80, i32* %61)
%82 = icmp eq i32 %81, 1
br i1 %82, label %85, label %83
83: ; preds = %79
%84 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
br label %85
85: ; preds = %83, %79
%86 = add nsw i32 %64, 1
br label %67
87: ; preds = %63
%88 = load i8*, i8** @optarg
%89 = call i32 @parse_ip_address(i8* %88, i32* %60)
%90 = icmp eq i32 %89, 1
br i1 %90, label %93, label %91
91: ; preds = %87
%92 = call i32 @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0))
br label %93
93: ; preds = %91, %87
%94 = add nsw i32 %64, 1
br label %67
95: ; preds = %63
%96 = load i8*, i8** @optarg
%97 = call i32 @parse_ip_address(i8* %96, i32* %59)
%98 = icmp eq i32 %97, 1
br i1 %98, label %101, label %99
99: ; preds = %95
%100 = call i32 @error(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0))
br label %101
101: ; preds = %99, %95
%102 = add nsw i32 %64, 1
br label %67
103: ; preds = %63
%104 = load i8*, i8** @optarg
%105 = call i32 @strlen(i8* %104)
%106 = icmp sgt i32 %105, 16
br i1 %106, label %107, label %67
107: ; preds = %103
%108 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0))
br label %67
109: ; preds = %63
%110 = load i8*, i8** @optarg
%111 = call i32 @strlen(i8* %110)
%112 = icmp eq i32 %111, 32
br i1 %112, label %115, label %113
113: ; preds = %109
%114 = call i32 @error(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0))
br label %115
115: ; preds = %113, %109
%116 = load i8*, i8** @optarg
%117 = call i32 @parse_key(i8* %116, i32* %58)
%118 = icmp eq i32 %117, 1
br i1 %118, label %67, label %119
119: ; preds = %115
%120 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0))
br label %67
121: ; preds = %63
%122 = call i32 (...) @print_usage()
%123 = load i32, i32* @EXIT_FAILURE
%124 = call i32 @exit(i32 %123)
unreachable
125: ; preds = %63
%126 = icmp eq i8* %65, null
br i1 %126, label %129, label %127
127: ; preds = %125
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* %65)
br label %129
129: ; preds = %127, %125
%130 = load i32, i32* %3
%131 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i32 %130)
%132 = load i32, i32* @optind
%133 = icmp slt i32 %132, %0
br i1 %133, label %134, label %139
134: ; preds = %129
%135 = sext i32 %132 to i64
%136 = getelementptr inbounds i8*, i8** %1, i64 %135
%137 = load i8*, i8** %136
%138 = icmp eq i8* %137, null
br i1 %138, label %139, label %144
139: ; preds = %134, %129
%140 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.17, i64 0, i64 0))
%141 = call i32 (...) @print_usage()
%142 = load i32, i32* @EXIT_FAILURE
%143 = call i32 @exit(i32 %142)
unreachable
144: ; preds = %134
%145 = load i32, i32* %3
%146 = icmp eq i32 %145, 1
%147 = icmp sgt i32 %64, 0
%148 = select i1 %146, i1 %147, i1 false
br i1 %148, label %153, label %149
149: ; preds = %144
%150 = icmp eq i32 %145, 0
%151 = icmp eq i32 %64, 0
%152 = select i1 %150, i1 %151, i1 false
br i1 %152, label %153, label %156
153: ; preds = %149, %144
%154 = call i32 @error(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.18, i64 0, i64 0))
%155 = load i32, i32* %3
br label %156
156: ; preds = %153, %149
%157 = phi i32 [ %155, %153 ], [ %145, %149 ]
%158 = icmp eq i32 %157, 0
%159 = icmp ne i32 %64, 4
%160 = select i1 %158, i1 %159, i1 false
br i1 %160, label %161, label %163
161: ; preds = %156
%162 = call i32 @error(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.19, i64 0, i64 0))
br label %163
163: ; preds = %161, %156
%164 = call i32 @tcp_connect_to(i8* %137, i32 3601)
%165 = icmp slt i32 %164, 0
br i1 %165, label %166, label %168
166: ; preds = %163
%167 = call i32 @exit(i32 -1)
unreachable
168: ; preds = %163
%169 = call i32 @device_check(i32 %164, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i32 1, i32 0)
%170 = icmp eq i32 %169, 0
br i1 %170, label %171, label %174
171: ; preds = %168
%172 = call i32 @close(i32 %164)
%173 = call i32 @error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.21, i64 0, i64 0))
br label %174
174: ; preds = %171, %168
%175 = call i32 @config_send(i32 %164, i32* %62, i32* %61, i32* %60, i32* %59, i8* %65, i32* %58)
%176 = call i32 @close(i32 %164)
ret i32 0
}