#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 */

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
char *inet_ntop(int /*<<< orphan*/, unsigned char *, char *, int);
int inet_pton(int /*<<< orphan*/, char *, unsigned char *);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char const *);
int read(int, unsigned char *, int);
int sscanf(char *, char *, unsigned char *, unsigned char *, unsigned char *,
           unsigned char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char *sprefix = NULL, *smac = NULL;
  const char *p;
  unsigned char mac[6];
  unsigned char address[16];
  char saddress[100];
  int i, rc, fd;
  int random_prefix = 0, random_subnet = 0, print_prefix = 0;
  const char *usage =
      "Usage: generate-ipv6-address [-p] [-s] {-r | prefix} [mac-48]\n";
  i = 1;
  while (i < argc) {
    if (argv[i][0] != '-') {
      break;
    } else if (strcmp(argv[i], "--") == 0) {
      i++;
      break;
    } else if (strcmp(argv[i], "-p") == 0) {
      print_prefix = 1;
      i++;
    } else if (strcmp(argv[i], "-s") == 0) {
      random_subnet = 1;
      i++;
    } else if (strcmp(argv[i], "-r") == 0) {
      random_prefix = 1;
      i++;
    } else {
      goto usage;
    }
  }
  if (!random_prefix) {
    if (i >= argc)
      goto usage;
    sprefix = argv[i];
    i++;
  }
  if (i < argc) {
    smac = argv[i];
    i++;
  } else {
    smac = NULL;
  }
  if (i < argc)
    goto usage;
  if (!smac || random_prefix || random_subnet) {
    fd = open("/dev/urandom", O_RDONLY);
    if (fd < 0) {
      perror("open(random)");
      exit(1);
    }
  } else {
    fd = -1;
  }
  if (random_prefix) {
    address[0] = (0xFC | 0x01);
    rc = read(fd, address + 1, 5);
    if (rc != 5) {
      perror("read(random)");
      exit(1);
    }
    memset(address + 6, 0, 2);
  } else {
    rc = inet_pton(AF_INET6, sprefix, address);
    if (rc != 1)
      goto usage;
  }
  if (random_subnet) {
    if (address[6] != 0 || address[7] != 0) {
      fprintf(stderr, "Cannot use -s with this prefix.\n");
      exit(1);
    } else {
      rc = read(fd, address + 6, 2);
      if (rc != 2) {
        perror("read(random)");
        exit(1);
      }
    }
  }
  if (print_prefix) {
    memset(address + 8, 0, 8);
  } else if (smac) {
    rc = sscanf(smac, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx", &mac[0], &mac[1],
                &mac[2], &mac[3], &mac[4], &mac[5]);
    if (rc != 6)
      goto usage;
    if ((mac[0] & 1) != 0) {
      fprintf(stderr, "Warning: group bit is not 0.\n");
      mac[0] &= ~1;
    }
    address[8] = mac[0] ^ 2;
    address[9] = mac[1];
    address[10] = mac[2];
    address[11] = 0xFF;
    address[12] = 0xFE;
    address[13] = mac[3];
    address[14] = mac[4];
    address[15] = mac[5];
  } else {
    rc = read(fd, address + 8, 8);
    if (rc != 8) {
      perror("read(random)");
      exit(1);
    }
    address[8] &= ~3;
  }
  if (fd >= 0)
    close(fd);
  p = inet_ntop(AF_INET6, address, saddress, 100);
  if (p == NULL) {
    perror("inet_ntop");
    exit(1);
  }
  printf("%s\n", p);
  return 0;
usage:
  fputs(usage, stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0xc0(%rbp)
movl   $0x0,-0xc4(%rbp)
movl   $0x0,-0xc8(%rbp)
lea    0xde2(%rip),%rax
mov    %rax,-0xd0(%rbp)
movl   $0x1,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    137e <main+0x1ae>
mov    -0x10(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     125e <main+0x8e>
jmp    137e <main+0x1ae>
mov    -0x10(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdcb(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1297 <main+0xc7>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    137e <main+0x1ae>
mov    -0x10(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd95(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12da <main+0x10a>
movl   $0x1,-0xc8(%rbp)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    136f <main+0x19f>
mov    -0x10(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd55(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    131d <main+0x14d>
movl   $0x1,-0xc4(%rbp)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    136a <main+0x19a>
mov    -0x10(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd15(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1360 <main+0x190>
movl   $0x1,-0xc0(%rbp)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1365 <main+0x195>
jmp    176c <main+0x59c>
jmp    136a <main+0x19a>
jmp    136f <main+0x19f>
jmp    1374 <main+0x1a4>
jmp    1379 <main+0x1a9>
jmp    122f <main+0x5f>
cmpl   $0x0,-0xc0(%rbp)
jne    13c1 <main+0x1f1>
mov    -0xb4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     139f <main+0x1cf>
jmp    176c <main+0x59c>
mov    -0x10(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13f7 <main+0x227>
mov    -0x10(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    13ff <main+0x22f>
movq   $0x0,-0x20(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1413 <main+0x243>
jmp    176c <main+0x59c>
cmpq   $0x0,-0x20(%rbp)
je     1438 <main+0x268>
cmpl   $0x0,-0xc0(%rbp)
jne    1438 <main+0x268>
cmpl   $0x0,-0xc4(%rbp)
je     147b <main+0x2ab>
mov    0x2ba9(%rip),%rax
mov    (%rax),%esi
lea    0xc03(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,-0xbc(%rbp)
cmpl   $0x0,-0xbc(%rbp)
jge    1476 <main+0x2a6>
lea    0xbf1(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    1485 <main+0x2b5>
movl   $0xffffffff,-0xbc(%rbp)
ff ff ff
cmpl   $0x0,-0xc0(%rbp)
je     14f0 <main+0x320>
movb   $0xfd,-0x40(%rbp)
mov    -0xbc(%rbp),%edi
lea    -0x40(%rbp),%rsi
add    $0x1,%rsi
mov    $0x5,%edx
call   1080 <read@plt>
mov    %eax,-0xb8(%rbp)
cmpl   $0x5,-0xb8(%rbp)
je     14d7 <main+0x307>
lea    0xb9d(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    -0x40(%rbp),%rdi
add    $0x6,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1060 <memset@plt>
jmp    1523 <main+0x353>
mov    0x2ae9(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   10b0 <inet_pton@plt>
mov    %eax,-0xb8(%rbp)
cmpl   $0x1,-0xb8(%rbp)
je     151e <main+0x34e>
jmp    176c <main+0x59c>
jmp    1523 <main+0x353>
cmpl   $0x0,-0xc4(%rbp)
je     15b4 <main+0x3e4>
movzbl -0x3a(%rbp),%eax
cmp    $0x0,%eax
jne    154a <main+0x37a>
movzbl -0x39(%rbp),%eax
cmp    $0x0,%eax
je     1569 <main+0x399>
mov    0x2a7f(%rip),%rax
mov    (%rax),%edi
lea    0xb18(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0xbc(%rbp),%edi
lea    -0x40(%rbp),%rsi
add    $0x6,%rsi
mov    $0x2,%edx
call   1080 <read@plt>
mov    %eax,-0xb8(%rbp)
cmpl   $0x2,-0xb8(%rbp)
je     15aa <main+0x3da>
lea    0xaca(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    15af <main+0x3df>
jmp    15b4 <main+0x3e4>
cmpl   $0x0,-0xc8(%rbp)
je     15da <main+0x40a>
lea    -0x40(%rbp),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
jmp    16f6 <main+0x526>
cmpq   $0x0,-0x20(%rbp)
je     16a6 <main+0x4d6>
mov    -0x20(%rbp),%rdi
lea    -0x2e(%rbp),%rdx
lea    -0x2e(%rbp),%rcx
add    $0x1,%rcx
lea    -0x2e(%rbp),%r8
add    $0x2,%r8
lea    -0x2e(%rbp),%r9
add    $0x3,%r9
lea    -0x2e(%rbp),%r10
add    $0x4,%r10
lea    -0x2e(%rbp),%rax
add    $0x5,%rax
lea    0xa77(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   10c0 <sscanf@plt>
mov    %eax,-0xb8(%rbp)
cmpl   $0x6,-0xb8(%rbp)
je     1642 <main+0x472>
jmp    176c <main+0x59c>
movzbl -0x2e(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1671 <main+0x4a1>
mov    0x2977(%rip),%rax
mov    (%rax),%edi
lea    0xa55(%rip),%rsi
call   10a0 <fprintf@plt>
movzbl -0x2e(%rbp),%eax
and    $0xfffffffe,%eax
mov    %al,-0x2e(%rbp)
movzbl -0x2e(%rbp),%eax
xor    $0x2,%eax
mov    %al,-0x38(%rbp)
mov    -0x2d(%rbp),%al
mov    %al,-0x37(%rbp)
mov    -0x2c(%rbp),%al
mov    %al,-0x36(%rbp)
movb   $0xff,-0x35(%rbp)
movb   $0xfe,-0x34(%rbp)
mov    -0x2b(%rbp),%al
mov    %al,-0x33(%rbp)
mov    -0x2a(%rbp),%al
mov    %al,-0x32(%rbp)
mov    -0x29(%rbp),%al
mov    %al,-0x31(%rbp)
jmp    16f1 <main+0x521>
mov    -0xbc(%rbp),%edi
lea    -0x40(%rbp),%rsi
add    $0x8,%rsi
mov    $0x8,%edx
call   1080 <read@plt>
mov    %eax,-0xb8(%rbp)
cmpl   $0x8,-0xb8(%rbp)
je     16e7 <main+0x517>
lea    0x98d(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
movzbl -0x38(%rbp),%eax
and    $0xfffffffc,%eax
mov    %al,-0x38(%rbp)
jmp    16f6 <main+0x526>
cmpl   $0x0,-0xbc(%rbp)
jl     170e <main+0x53e>
mov    -0xbc(%rbp),%edi
call   1070 <close@plt>
mov    0x28cb(%rip),%rax
mov    (%rax),%edi
lea    -0x40(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
mov    $0x64,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1751 <main+0x581>
lea    0x993(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x28(%rbp),%rsi
lea    0x983(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret
mov    -0xd0(%rbp),%rdi
mov    0x2856(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jl     12ad <main+0xdd>
mov    %edi,0x2c(%rsp)
mov    %edi,%r12d
movl   $0x0,0x28(%rsp)
mov    $0x1,%r14d
mov    $0x2,%r13d
lea    0xe30(%rip),%rbp
movl   $0x0,0xc(%rsp)
xor    %r15d,%r15d
jmp    1239 <main+0x69>
nopl   0x0(%rax)
movl   $0x1,0x28(%rsp)
add    $0x1,%r14
add    $0x1,%r13d
cmp    %r14,%r12
je     12ca <main+0xfa>
mov    (%rbx,%r14,8),%rdi
cmpb   $0x2d,(%rdi)
jne    12c5 <main+0xf5>
mov    %rbp,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12cd <main+0xfd>
mov    (%rbx,%r14,8),%rdi
lea    0xde4(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1220 <main+0x50>
mov    (%rbx,%r14,8),%rdi
lea    0xdd2(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12a0 <main+0xd0>
mov    (%rbx,%r14,8),%rdi
lea    0xdc0(%rip),%rsi
call   1090 <strcmp@plt>
mov    $0x1,%r15d
test   %rax,%rax
je     1228 <main+0x58>
jmp    14fd <main+0x32d>
nopl   (%rax)
movl   $0x1,0xc(%rsp)
jmp    1228 <main+0x58>
movl   $0x0,0x28(%rsp)
mov    $0x1,%r13d
movl   $0x0,0xc(%rsp)
jmp    12e6 <main+0x116>
mov    %r14d,%r13d
jmp    12cd <main+0xfd>
mov    %r12d,%r13d
test   %r15d,%r15d
mov    0x2c(%rsp),%edi
je     12e6 <main+0x116>
mov    $0x1,%bpl
xor    %r15d,%r15d
cmp    %edi,%r13d
jl     1303 <main+0x133>
xor    %r14d,%r14d
jmp    130e <main+0x13e>
cmp    %edi,%r13d
jge    14fd <main+0x32d>
mov    %edi,%ecx
movslq %r13d,%rax
mov    (%rbx,%rax,8),%r15
add    $0x1,%r13d
xor    %ebp,%ebp
cmp    %edi,%r13d
jge    12e1 <main+0x111>
movslq %r13d,%rax
mov    (%rbx,%rax,8),%r14
add    $0x1,%r13d
cmp    %edi,%r13d
jl     14fd <main+0x32d>
test   %r14,%r14
sete   %al
or     %bpl,%al
jne    132e <main+0x15e>
mov    $0xffffffff,%ebx
cmpl   $0x0,0xc(%rsp)
je     134d <main+0x17d>
mov    0x2cb3(%rip),%rax
mov    (%rax),%esi
lea    0xd0d(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
js     154d <main+0x37d>
test   %bpl,%bpl
je     1384 <main+0x1b4>
movb   $0xfd,0x10(%rsp)
lea    0x11(%rsp),%rsi
mov    %ebx,%edi
mov    $0x5,%edx
call   1080 <read@plt>
cmp    $0x5,%eax
jne    151c <main+0x34c>
lea    0x16(%rsp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1060 <memset@plt>
jmp    13a3 <main+0x1d3>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rdx
mov    %r15,%rsi
call   10b0 <inet_pton@plt>
cmp    $0x1,%eax
jne    14fd <main+0x32d>
cmpl   $0x0,0xc(%rsp)
je     13d2 <main+0x202>
mov    0x16(%rsp),%al
or     0x17(%rsp),%al
jne    152e <main+0x35e>
lea    0x16(%rsp),%rsi
mov    %ebx,%edi
mov    $0x2,%edx
call   1080 <read@plt>
cmp    $0x2,%eax
jne    151c <main+0x34c>
cmpl   $0x0,0x28(%rsp)
je     13f7 <main+0x227>
lea    0x18(%rsp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
test   %ebx,%ebx
jns    1490 <main+0x2c0>
jmp    1497 <main+0x2c7>
test   %r14,%r14
je     14dc <main+0x30c>
lea    0x7(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0x9(%rsp),%r9
lea    0xa(%rsp),%rax
lea    0xb(%rsp),%rbp
lea    0xc73(%rip),%rsi
lea    0x6(%rsp),%rdx
mov    %r14,%rdi
push   %rbp
push   %rax
call   10c0 <sscanf@plt>
add    $0x10,%rsp
cmp    $0x6,%eax
jne    14fd <main+0x32d>
mov    0x6(%rsp),%al
test   $0x1,%al
je     1463 <main+0x293>
mov    0x2b85(%rip),%rax
mov    (%rax),%edi
lea    0xc63(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x6(%rsp),%al
and    $0xfe,%al
mov    %al,0x6(%rsp)
xor    $0x2,%al
mov    %al,0x18(%rsp)
movzwl 0x7(%rsp),%eax
mov    %ax,0x19(%rsp)
movw   $0xfeff,0x1b(%rsp)
mov    0x9(%rsp),%al
mov    %al,0x1d(%rsp)
movzwl 0xa(%rsp),%eax
mov    %ax,0x1e(%rsp)
test   %ebx,%ebx
js     1497 <main+0x2c7>
mov    %ebx,%edi
call   1070 <close@plt>
mov    0x2b42(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
lea    0x30(%rsp),%rdx
mov    $0x64,%ecx
call   1030 <inet_ntop@plt>
test   %rax,%rax
je     1525 <main+0x355>
lea    0xc1f(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x18(%rsp),%rsi
mov    %ebx,%edi
mov    $0x8,%edx
call   1080 <read@plt>
cmp    $0x8,%eax
jne    151c <main+0x34c>
andb   $0xfc,0x18(%rsp)
test   %ebx,%ebx
jns    1490 <main+0x2c0>
jmp    1497 <main+0x2c7>
mov    0x2acc(%rip),%rax
mov    (%rax),%esi
lea    0xaf3(%rip),%rdi
call   1050 <fputs@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xb42(%rip),%rdi
jmp    1554 <main+0x384>
lea    0xba9(%rip),%rdi
jmp    1554 <main+0x384>
mov    0x2a9b(%rip),%rax
mov    (%rax),%edi
lea    0xb34(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xb04(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"Usage: generate-ipv6-address [-p] [-s] {-r | prefix} [mac-48]\0A\00"
@.str.1 = [3 x i8] c"--\00"
@.str.2 = [3 x i8] c"-p\00"
@.str.3 = [3 x i8] c"-s\00"
@.str.4 = [3 x i8] c"-r\00"
@.str.5 = [13 x i8] c"/dev/urandom\00"
@O_RDONLY = global i32 0
@.str.6 = [13 x i8] c"open(random)\00"
@.str.7 = [13 x i8] c"read(random)\00"
@AF_INET6 = global i32 0
@stderr = global i32 0
@.str.8 = [33 x i8] c"Cannot use -s with this prefix.\0A\00"
@.str.9 = [36 x i8] c"%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx\00"
@.str.10 = [30 x i8] c"Warning: group bit is not 0.\0A\00"
@.str.11 = [10 x i8] c"inet_ntop\00"
@.str.12 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [6 x i8]
%10 = alloca [16 x i8]
%11 = alloca [100 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
store i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8** %18
store i32 1, i32* %12
br label %19
19: ; preds = %83, %2
%20 = load i32, i32* %12
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %84
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %12
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 45
br i1 %32, label %33, label %34
33: ; preds = %23
br label %84
34: ; preds = %23
%35 = load i8**, i8*** %5
%36 = load i32, i32* %12
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %34
%43 = load i32, i32* %12
%44 = add nsw i32 %43, 1
store i32 %44, i32* %12
br label %84
45: ; preds = %34
%46 = load i8**, i8*** %5
%47 = load i32, i32* %12
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
%51 = call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %45
store i32 1, i32* %17
%54 = load i32, i32* %12
%55 = add nsw i32 %54, 1
store i32 %55, i32* %12
br label %81
56: ; preds = %45
%57 = load i8**, i8*** %5
%58 = load i32, i32* %12
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8*, i8** %57, i64 %59
%61 = load i8*, i8** %60
%62 = call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %56
store i32 1, i32* %16
%65 = load i32, i32* %12
%66 = add nsw i32 %65, 1
store i32 %66, i32* %12
br label %80
67: ; preds = %56
%68 = load i8**, i8*** %5
%69 = load i32, i32* %12
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %68, i64 %70
%72 = load i8*, i8** %71
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %67
store i32 1, i32* %15
%76 = load i32, i32* %12
%77 = add nsw i32 %76, 1
store i32 %77, i32* %12
br label %79
78: ; preds = %67
br label %289
79: ; preds = %75
br label %80
80: ; preds = %79, %64
br label %81
81: ; preds = %80, %53
br label %82
82: ; preds = %81
br label %83
83: ; preds = %82
br label %19
84: ; preds = %42, %33, %19
%85 = load i32, i32* %15
%86 = icmp ne i32 %85, 0
br i1 %86, label %100, label %87
87: ; preds = %84
%88 = load i32, i32* %12
%89 = load i32, i32* %4
%90 = icmp sge i32 %88, %89
br i1 %90, label %91, label %92
91: ; preds = %87
br label %289
92: ; preds = %87
%93 = load i8**, i8*** %5
%94 = load i32, i32* %12
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i8*, i8** %93, i64 %95
%97 = load i8*, i8** %96
store i8* %97, i8** %6
%98 = load i32, i32* %12
%99 = add nsw i32 %98, 1
store i32 %99, i32* %12
br label %100
100: ; preds = %92, %84
%101 = load i32, i32* %12
%102 = load i32, i32* %4
%103 = icmp slt i32 %101, %102
br i1 %103, label %104, label %112
104: ; preds = %100
%105 = load i8**, i8*** %5
%106 = load i32, i32* %12
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8*, i8** %105, i64 %107
%109 = load i8*, i8** %108
store i8* %109, i8** %7
%110 = load i32, i32* %12
%111 = add nsw i32 %110, 1
store i32 %111, i32* %12
br label %113
112: ; preds = %100
store i8* null, i8** %7
br label %113
113: ; preds = %112, %104
%114 = load i32, i32* %12
%115 = load i32, i32* %4
%116 = icmp slt i32 %114, %115
br i1 %116, label %117, label %118
117: ; preds = %113
br label %289
118: ; preds = %113
%119 = load i8*, i8** %7
%120 = icmp ne i8* %119, null
br i1 %120, label %121, label %127
121: ; preds = %118
%122 = load i32, i32* %15
%123 = icmp ne i32 %122, 0
br i1 %123, label %127, label %124
124: ; preds = %121
%125 = load i32, i32* %16
%126 = icmp ne i32 %125, 0
br i1 %126, label %127, label %136
127: ; preds = %124, %121, %118
%128 = load i32, i32* @O_RDONLY
%129 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %128)
store i32 %129, i32* %14
%130 = load i32, i32* %14
%131 = icmp slt i32 %130, 0
br i1 %131, label %132, label %135
132: ; preds = %127
%133 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%134 = call i32 @exit(i32 1)
unreachable
135: ; preds = %127
br label %137
136: ; preds = %124
store i32 -1, i32* %14
br label %137
137: ; preds = %136, %135
%138 = load i32, i32* %15
%139 = icmp ne i32 %138, 0
br i1 %139, label %140, label %155
140: ; preds = %137
%141 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
store i8 -3, i8* %141
%142 = load i32, i32* %14
%143 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%144 = getelementptr inbounds i8, i8* %143, i64 1
%145 = call i32 @read(i32 %142, i8* %144, i32 5)
store i32 %145, i32* %13
%146 = load i32, i32* %13
%147 = icmp ne i32 %146, 5
br i1 %147, label %148, label %151
148: ; preds = %140
%149 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%150 = call i32 @exit(i32 1)
unreachable
151: ; preds = %140
%152 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%153 = getelementptr inbounds i8, i8* %152, i64 6
%154 = call i32 @memset(i8* %153, i32 0, i32 2)
br label %164
155: ; preds = %137
%156 = load i32, i32* @AF_INET6
%157 = load i8*, i8** %6
%158 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%159 = call i32 @inet_pton(i32 %156, i8* %157, i8* %158)
store i32 %159, i32* %13
%160 = load i32, i32* %13
%161 = icmp ne i32 %160, 1
br i1 %161, label %162, label %163
162: ; preds = %155
br label %289
163: ; preds = %155
br label %164
164: ; preds = %163, %151
%165 = load i32, i32* %16
%166 = icmp ne i32 %165, 0
br i1 %166, label %167, label %193
167: ; preds = %164
%168 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 6
%169 = load i8, i8* %168
%170 = zext i8 %169 to i32
%171 = icmp ne i32 %170, 0
br i1 %171, label %177, label %172
172: ; preds = %167
%173 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 7
%174 = load i8, i8* %173
%175 = zext i8 %174 to i32
%176 = icmp ne i32 %175, 0
br i1 %176, label %177, label %181
177: ; preds = %172, %167
%178 = load i32, i32* @stderr
%179 = call i32 @fprintf(i32 %178, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
%180 = call i32 @exit(i32 1)
unreachable
181: ; preds = %172
%182 = load i32, i32* %14
%183 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%184 = getelementptr inbounds i8, i8* %183, i64 6
%185 = call i32 @read(i32 %182, i8* %184, i32 2)
store i32 %185, i32* %13
%186 = load i32, i32* %13
%187 = icmp ne i32 %186, 2
br i1 %187, label %188, label %191
188: ; preds = %181
%189 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%190 = call i32 @exit(i32 1)
unreachable
191: ; preds = %181
br label %192
192: ; preds = %191
br label %193
193: ; preds = %192, %164
%194 = load i32, i32* %17
%195 = icmp ne i32 %194, 0
br i1 %195, label %196, label %200
196: ; preds = %193
%197 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%198 = getelementptr inbounds i8, i8* %197, i64 8
%199 = call i32 @memset(i8* %198, i32 0, i32 8)
br label %270
200: ; preds = %193
%201 = load i8*, i8** %7
%202 = icmp ne i8* %201, null
br i1 %202, label %203, label %253
203: ; preds = %200
%204 = load i8*, i8** %7
%205 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 0
%206 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 1
%207 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 2
%208 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 3
%209 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 4
%210 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 5
%211 = call i32 @sscanf(i8* %204, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %205, i8* %206, i8* %207, i8* %208, i8* %209, i8* %210)
store i32 %211, i32* %13
%212 = load i32, i32* %13
%213 = icmp ne i32 %212, 6
br i1 %213, label %214, label %215
214: ; preds = %203
br label %289
215: ; preds = %203
%216 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 0
%217 = load i8, i8* %216
%218 = zext i8 %217 to i32
%219 = and i32 %218, 1
%220 = icmp ne i32 %219, 0
br i1 %220, label %221, label %229
221: ; preds = %215
%222 = load i32, i32* @stderr
%223 = call i32 @fprintf(i32 %222, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
%224 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 0
%225 = load i8, i8* %224
%226 = zext i8 %225 to i32
%227 = and i32 %226, -2
%228 = trunc i32 %227 to i8
store i8 %228, i8* %224
br label %229
229: ; preds = %221, %215
%230 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 0
%231 = load i8, i8* %230
%232 = zext i8 %231 to i32
%233 = xor i32 %232, 2
%234 = trunc i32 %233 to i8
%235 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 8
store i8 %234, i8* %235
%236 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 1
%237 = load i8, i8* %236
%238 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 9
store i8 %237, i8* %238
%239 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 2
%240 = load i8, i8* %239
%241 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 10
store i8 %240, i8* %241
%242 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 11
store i8 -1, i8* %242
%243 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 12
store i8 -2, i8* %243
%244 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 3
%245 = load i8, i8* %244
%246 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 13
store i8 %245, i8* %246
%247 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 4
%248 = load i8, i8* %247
%249 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 14
store i8 %248, i8* %249
%250 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 5
%251 = load i8, i8* %250
%252 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 15
store i8 %251, i8* %252
br label %269
253: ; preds = %200
%254 = load i32, i32* %14
%255 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%256 = getelementptr inbounds i8, i8* %255, i64 8
%257 = call i32 @read(i32 %254, i8* %256, i32 8)
store i32 %257, i32* %13
%258 = load i32, i32* %13
%259 = icmp ne i32 %258, 8
br i1 %259, label %260, label %263
260: ; preds = %253
%261 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%262 = call i32 @exit(i32 1)
unreachable
263: ; preds = %253
%264 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 8
%265 = load i8, i8* %264
%266 = zext i8 %265 to i32
%267 = and i32 %266, -4
%268 = trunc i32 %267 to i8
store i8 %268, i8* %264
br label %269
269: ; preds = %263, %229
br label %270
270: ; preds = %269, %196
%271 = load i32, i32* %14
%272 = icmp sge i32 %271, 0
br i1 %272, label %273, label %276
273: ; preds = %270
%274 = load i32, i32* %14
%275 = call i32 @close(i32 %274)
br label %276
276: ; preds = %273, %270
%277 = load i32, i32* @AF_INET6
%278 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%279 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%280 = call i8* @inet_ntop(i32 %277, i8* %278, i8* %279, i32 100)
store i8* %280, i8** %8
%281 = load i8*, i8** %8
%282 = icmp eq i8* %281, null
br i1 %282, label %283, label %286
283: ; preds = %276
%284 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%285 = call i32 @exit(i32 1)
unreachable
286: ; preds = %276
%287 = load i8*, i8** %8
%288 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %287)
ret i32 0
289: ; preds = %214, %162, %117, %91, %78
%290 = load i8*, i8** %18
%291 = load i32, i32* @stderr
%292 = call i32 @fputs(i8* %290, i32 %291)
%293 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [63 x i8] c"Usage: generate-ipv6-address [-p] [-s] {-r | prefix} [mac-48]\0A\00"
@.str.1 = [3 x i8] c"--\00"
@.str.2 = [3 x i8] c"-p\00"
@.str.3 = [3 x i8] c"-s\00"
@.str.4 = [3 x i8] c"-r\00"
@.str.5 = [13 x i8] c"/dev/urandom\00"
@O_RDONLY = global i32 0
@.str.6 = [13 x i8] c"open(random)\00"
@.str.7 = [13 x i8] c"read(random)\00"
@AF_INET6 = global i32 0
@stderr = global i32 0
@.str.8 = [33 x i8] c"Cannot use -s with this prefix.\0A\00"
@.str.9 = [36 x i8] c"%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx\00"
@.str.10 = [30 x i8] c"Warning: group bit is not 0.\0A\00"
@.str.11 = [10 x i8] c"inet_ntop\00"
@.str.12 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [6 x i8]
%4 = alloca [16 x i8]
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%9 = icmp sgt i32 %0, 1
br i1 %9, label %10, label %53
10: ; preds = %2
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %10, %39
%13 = phi i64 [ 1, %10 ], [ %43, %39 ]
%14 = phi i32 [ 0, %10 ], [ %42, %39 ]
%15 = phi i32 [ 0, %10 ], [ %41, %39 ]
%16 = phi i32 [ 0, %10 ], [ %40, %39 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 %13
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 45
br i1 %20, label %21, label %45
21: ; preds = %12
%22 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = trunc i64 %13 to i32
%26 = add nuw nsw i32 %25, 1
br label %47
27: ; preds = %21
%28 = load i8*, i8** %17
%29 = tail call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %39, label %31
31: ; preds = %27
%32 = load i8*, i8** %17
%33 = tail call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %39, label %35
35: ; preds = %31
%36 = load i8*, i8** %17
%37 = tail call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %188
39: ; preds = %35, %31, %27
%40 = phi i32 [ %16, %27 ], [ %16, %31 ], [ 1, %35 ]
%41 = phi i32 [ %15, %27 ], [ 1, %31 ], [ %15, %35 ]
%42 = phi i32 [ 1, %27 ], [ %14, %31 ], [ %14, %35 ]
%43 = add nuw nsw i64 %13, 1
%44 = icmp eq i64 %43, %11
br i1 %44, label %47, label %12
45: ; preds = %12
%46 = trunc i64 %13 to i32
br label %47
47: ; preds = %39, %45, %24
%48 = phi i32 [ %16, %24 ], [ %16, %45 ], [ %40, %39 ]
%49 = phi i32 [ %15, %24 ], [ %15, %45 ], [ %41, %39 ]
%50 = phi i32 [ %14, %24 ], [ %14, %45 ], [ %42, %39 ]
%51 = phi i32 [ %26, %24 ], [ %46, %45 ], [ %0, %39 ]
%52 = icmp eq i32 %48, 0
br i1 %52, label %53, label %63
53: ; preds = %2, %47
%54 = phi i32 [ %51, %47 ], [ 1, %2 ]
%55 = phi i32 [ %50, %47 ], [ 0, %2 ]
%56 = phi i32 [ %49, %47 ], [ 0, %2 ]
%57 = icmp slt i32 %54, %0
br i1 %57, label %58, label %188
58: ; preds = %53
%59 = sext i32 %54 to i64
%60 = getelementptr inbounds i8*, i8** %1, i64 %59
%61 = load i8*, i8** %60
%62 = add nsw i32 %54, 1
br label %63
63: ; preds = %58, %47
%64 = phi i1 [ true, %47 ], [ false, %58 ]
%65 = phi i32 [ %50, %47 ], [ %55, %58 ]
%66 = phi i32 [ %49, %47 ], [ %56, %58 ]
%67 = phi i32 [ %51, %47 ], [ %62, %58 ]
%68 = phi i8* [ null, %47 ], [ %61, %58 ]
%69 = icmp slt i32 %67, %0
br i1 %69, label %70, label %75
70: ; preds = %63
%71 = sext i32 %67 to i64
%72 = getelementptr inbounds i8*, i8** %1, i64 %71
%73 = load i8*, i8** %72
%74 = add nsw i32 %67, 1
br label %75
75: ; preds = %63, %70
%76 = phi i8* [ %73, %70 ], [ null, %63 ]
%77 = phi i32 [ %74, %70 ], [ %67, %63 ]
%78 = icmp slt i32 %77, %0
br i1 %78, label %188, label %79
79: ; preds = %75
%80 = icmp eq i8* %76, null
%81 = or i1 %80, %64
%82 = icmp ne i32 %66, 0
%83 = select i1 %81, i1 true, i1 %82
br i1 %83, label %84, label %91
84: ; preds = %79
%85 = load i32, i32* @O_RDONLY
%86 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %85)
%87 = icmp slt i32 %86, 0
br i1 %87, label %88, label %91
88: ; preds = %84
%89 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%90 = tail call i32 @exit(i32 1)
unreachable
91: ; preds = %79, %84
%92 = phi i32 [ %86, %84 ], [ -1, %79 ]
br i1 %64, label %93, label %103
93: ; preds = %91
store i8 -3, i8* %7
%94 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 1
%95 = call i32 @read(i32 %92, i8* %94, i32 5)
%96 = icmp eq i32 %95, 5
br i1 %96, label %100, label %97
97: ; preds = %93
%98 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%99 = tail call i32 @exit(i32 1)
unreachable
100: ; preds = %93
%101 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 6
%102 = call i32 @memset(i8* %101, i32 0, i32 2)
br label %107
103: ; preds = %91
%104 = load i32, i32* @AF_INET6
%105 = call i32 @inet_pton(i32 %104, i8* %68, i8* %7)
%106 = icmp eq i32 %105, 1
br i1 %106, label %107, label %188
107: ; preds = %103, %100
br i1 %82, label %108, label %126
108: ; preds = %107
%109 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 6
%110 = load i8, i8* %109
%111 = icmp ne i8 %110, 0
%112 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 7
%113 = load i8, i8* %112
%114 = icmp ne i8 %113, 0
%115 = select i1 %111, i1 true, i1 %114
br i1 %115, label %116, label %120
116: ; preds = %108
%117 = load i32, i32* @stderr
%118 = call i32 @fprintf(i32 %117, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
%119 = call i32 @exit(i32 1)
unreachable
120: ; preds = %108
%121 = call i32 @read(i32 %92, i8* %109, i32 2)
%122 = icmp eq i32 %121, 2
br i1 %122, label %126, label %123
123: ; preds = %120
%124 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%125 = call i32 @exit(i32 1)
unreachable
126: ; preds = %120, %107
%127 = icmp eq i32 %65, 0
br i1 %127, label %131, label %128
128: ; preds = %126
%129 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 8
%130 = call i32 @memset(i8* %129, i32 0, i32 8)
br label %175
131: ; preds = %126
br i1 %80, label %165, label %132
132: ; preds = %131
%133 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 1
%134 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 2
%135 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 3
%136 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 4
%137 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 5
%138 = call i32 @sscanf(i8* %76, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %6, i8* %133, i8* %134, i8* %135, i8* %136, i8* %137)
%139 = icmp eq i32 %138, 6
br i1 %139, label %140, label %188
140: ; preds = %132
%141 = load i8, i8* %6
%142 = and i8 %141, 1
%143 = icmp eq i8 %142, 0
br i1 %143, label %149, label %144
144: ; preds = %140
%145 = load i32, i32* @stderr
%146 = call i32 @fprintf(i32 %145, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
%147 = load i8, i8* %6
%148 = and i8 %147, -2
store i8 %148, i8* %6
br label %149
149: ; preds = %144, %140
%150 = phi i8 [ %148, %144 ], [ %141, %140 ]
%151 = xor i8 %150, 2
%152 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 8
store i8 %151, i8* %152
%153 = load i8, i8* %133
%154 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 9
store i8 %153, i8* %154
%155 = load i8, i8* %134
%156 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 10
store i8 %155, i8* %156
%157 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 11
store i8 -1, i8* %157
%158 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 12
store i8 -2, i8* %158
%159 = load i8, i8* %135
%160 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 13
store i8 %159, i8* %160
%161 = load i8, i8* %136
%162 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 14
store i8 %161, i8* %162
%163 = load i8, i8* %137
%164 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 15
store i8 %163, i8* %164
br label %175
165: ; preds = %131
%166 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 8
%167 = call i32 @read(i32 %92, i8* %166, i32 8)
%168 = icmp eq i32 %167, 8
br i1 %168, label %172, label %169
169: ; preds = %165
%170 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%171 = call i32 @exit(i32 1)
unreachable
172: ; preds = %165
%173 = load i8, i8* %166
%174 = and i8 %173, -4
store i8 %174, i8* %166
br label %175
175: ; preds = %149, %172, %128
%176 = icmp sgt i32 %92, -1
br i1 %176, label %177, label %179
177: ; preds = %175
%178 = call i32 @close(i32 %92)
br label %179
179: ; preds = %177, %175
%180 = load i32, i32* @AF_INET6
%181 = call i8* @inet_ntop(i32 %180, i8* %7, i8* %8, i32 100)
%182 = icmp eq i8* %181, null
br i1 %182, label %183, label %186
183: ; preds = %179
%184 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%185 = call i32 @exit(i32 1)
unreachable
186: ; preds = %179
%187 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %181)
ret i32 0
188: ; preds = %35, %132, %103, %75, %53
%189 = load i32, i32* @stderr
%190 = call i32 @fputs(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i32 %189)
%191 = call i32 @exit(i32 1)
unreachable
}