#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 */
struct sockaddr_in {
  scalar_t__ sin_port;
  int /*<<< orphan*/ sin_addr;
};
struct servent {
  char *s_name;
};
struct in_addr {
  int dummy;
};
struct hostent {
  char *h_name;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
struct hostent *gethostbyaddr(char *, int, int /*<<< orphan*/);
struct servent *getservbyport(int, char *);
char *inet_ntoa(int /*<<< orphan*/);
scalar_t__ ntohs(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, unsigned int);
char *AddrToAddrStr(char *const dst, size_t dsize,
                    struct sockaddr_in *const saddrp, int dns,
                    const char *fmt) {
  const char *addrNamePtr;
  struct hostent *hp;
  char str[128];
  char *dlim, *dp;
  const char *cp;
  struct servent *pp;
  if (dns == 0) {
    addrNamePtr = inet_ntoa(saddrp->sin_addr);
  } else {
    hp = gethostbyaddr((char *)&saddrp->sin_addr, (int)sizeof(struct in_addr),
                       AF_INET);
    if ((hp != NULL) && (hp->h_name != NULL) && (hp->h_name[0] != '\0')) {
      addrNamePtr = hp->h_name;
    } else {
      addrNamePtr = inet_ntoa(saddrp->sin_addr);
    }
  }
  if (fmt == NULL)
    fmt = "%h:%p";
  for (dp = dst, dlim = dp + dsize - 1;; fmt++) {
    if (*fmt == '\0') {
      break;
    } else if (*fmt == '%') {
      fmt++;
      if (*fmt == '%') {
        if (dp < dlim)
          *dp++ = '%';
      } else if (*fmt == 'p') {
        sprintf(str, "%u", (unsigned int)ntohs(saddrp->sin_port));
        for (cp = str; *cp != '\0'; cp++)
          if (dp < dlim)
            *dp++ = *cp;
        *dp = '\0';
      } else if (*fmt == 'h') {
        if (addrNamePtr != NULL) {
          cp = addrNamePtr;
        } else {
          cp = "unknown";
        }
        for (; *cp != '\0'; cp++)
          if (dp < dlim)
            *dp++ = *cp;
        *dp = '\0';
      } else if (*fmt == 's') {
        pp = getservbyport((int)(saddrp->sin_port), "tcp");
        if (pp == NULL)
          pp = getservbyport((int)(saddrp->sin_port), "udp");
        if (pp == NULL) {
          sprintf(str, "%u", (unsigned int)ntohs(saddrp->sin_port));
          cp = str;
        } else {
          cp = pp->s_name;
        }
        for (; *cp != '\0'; cp++)
          if (dp < dlim)
            *dp++ = *cp;
        *dp = '\0';
      } else if ((*fmt == 't') || (*fmt == 'u')) {
        pp = getservbyport((int)(saddrp->sin_port),
                           (*fmt == 'u') ? "udp" : "tcp");
        if (pp == NULL) {
          sprintf(str, "%u", (unsigned int)ntohs(saddrp->sin_port));
          cp = str;
        } else {
          cp = pp->s_name;
        }
        for (; *cp != '\0'; cp++)
          if (dp < dlim)
            *dp++ = *cp;
        *dp = '\0';
      } else if (*fmt == '\0') {
        break;
      } else {
        if (dp < dlim)
          *dp++ = *fmt;
      }
    } else if (dp < dlim) {
      *dp++ = *fmt;
    }
  }
  *dp = '\0';
  return (dst);
}


x86 assembly (clang, -O0):
<AddrToAddrStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    118d <AddrToAddrStr+0x3d>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,-0x30(%rbp)
jmp    11fd <AddrToAddrStr+0xad>
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
mov    0x2e4c(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%esi
call   1050 <gethostbyaddr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     11e8 <AddrToAddrStr+0x98>
mov    -0x38(%rbp),%rax
cmpq   $0x0,(%rax)
je     11e8 <AddrToAddrStr+0x98>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11e8 <AddrToAddrStr+0x98>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    11f8 <AddrToAddrStr+0xa8>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,-0x30(%rbp)
jmp    11fd <AddrToAddrStr+0xad>
cmpq   $0x0,-0x28(%rbp)
jne    1213 <AddrToAddrStr+0xc3>
lea    0xdf1(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    -0xd0(%rbp),%rax
add    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0xc8(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1249 <AddrToAddrStr+0xf9>
jmp    1726 <AddrToAddrStr+0x5d6>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    16d5 <AddrToAddrStr+0x585>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    12a6 <AddrToAddrStr+0x156>
mov    -0xd0(%rbp),%rax
cmp    -0xc8(%rbp),%rax
jae    12a1 <AddrToAddrStr+0x151>
mov    -0xd0(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0xd0(%rbp)
movb   $0x25,(%rax)
jmp    16d0 <AddrToAddrStr+0x580>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x70,%eax
jne    1365 <AddrToAddrStr+0x215>
lea    -0xc0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1040 <ntohs@plt>
mov    -0xe8(%rbp),%rdi
mov    %eax,%edx
lea    0xd26(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0xc0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1356 <AddrToAddrStr+0x206>
mov    -0xd0(%rbp),%rax
cmp    -0xc8(%rbp),%rax
jae    133a <AddrToAddrStr+0x1ea>
mov    -0xd8(%rbp),%rax
mov    (%rax),%cl
mov    -0xd0(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0xd0(%rbp)
mov    %cl,(%rax)
jmp    133f <AddrToAddrStr+0x1ef>
mov    -0xd8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xd8(%rbp)
jmp    12f3 <AddrToAddrStr+0x1a3>
mov    -0xd0(%rbp),%rax
movb   $0x0,(%rax)
jmp    16cb <AddrToAddrStr+0x57b>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x68,%eax
jne    1415 <AddrToAddrStr+0x2c5>
cmpq   $0x0,-0x30(%rbp)
je     1390 <AddrToAddrStr+0x240>
mov    -0x30(%rbp),%rax
mov    %rax,-0xd8(%rbp)
jmp    139e <AddrToAddrStr+0x24e>
lea    0xc72(%rip),%rax
mov    %rax,-0xd8(%rbp)
jmp    13a3 <AddrToAddrStr+0x253>
mov    -0xd8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1406 <AddrToAddrStr+0x2b6>
mov    -0xd0(%rbp),%rax
cmp    -0xc8(%rbp),%rax
jae    13ea <AddrToAddrStr+0x29a>
mov    -0xd8(%rbp),%rax
mov    (%rax),%cl
mov    -0xd0(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0xd0(%rbp)
mov    %cl,(%rax)
jmp    13ef <AddrToAddrStr+0x29f>
mov    -0xd8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xd8(%rbp)
jmp    13a3 <AddrToAddrStr+0x253>
mov    -0xd0(%rbp),%rax
movb   $0x0,(%rax)
jmp    16c6 <AddrToAddrStr+0x576>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    1543 <AddrToAddrStr+0x3f3>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%edi
lea    0xbdc(%rip),%rsi
call   1070 <getservbyport@plt>
mov    %rax,-0xe0(%rbp)
cmpq   $0x0,-0xe0(%rbp)
jne    146b <AddrToAddrStr+0x31b>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%edi
lea    0xbb6(%rip),%rsi
call   1070 <getservbyport@plt>
mov    %rax,-0xe0(%rbp)
cmpq   $0x0,-0xe0(%rbp)
jne    14bb <AddrToAddrStr+0x36b>
lea    -0xc0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1040 <ntohs@plt>
mov    -0xf0(%rbp),%rdi
mov    %eax,%edx
lea    0xb63(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0xc0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
jmp    14cc <AddrToAddrStr+0x37c>
mov    -0xe0(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xd8(%rbp)
jmp    14d1 <AddrToAddrStr+0x381>
mov    -0xd8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1534 <AddrToAddrStr+0x3e4>
mov    -0xd0(%rbp),%rax
cmp    -0xc8(%rbp),%rax
jae    1518 <AddrToAddrStr+0x3c8>
mov    -0xd8(%rbp),%rax
mov    (%rax),%cl
mov    -0xd0(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0xd0(%rbp)
mov    %cl,(%rax)
jmp    151d <AddrToAddrStr+0x3cd>
mov    -0xd8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xd8(%rbp)
jmp    14d1 <AddrToAddrStr+0x381>
mov    -0xd0(%rbp),%rax
movb   $0x0,(%rax)
jmp    16c1 <AddrToAddrStr+0x571>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x74,%eax
je     1563 <AddrToAddrStr+0x413>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x75,%eax
jne    166c <AddrToAddrStr+0x51c>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%edi
mov    -0x28(%rbp),%rax
movsbl (%rax),%ecx
lea    0xa97(%rip),%rsi
lea    0xa94(%rip),%rax
cmp    $0x75,%ecx
cmove  %rax,%rsi
call   1070 <getservbyport@plt>
mov    %rax,-0xe0(%rbp)
cmpq   $0x0,-0xe0(%rbp)
jne    15e4 <AddrToAddrStr+0x494>
lea    -0xc0(%rbp),%rax
mov    %rax,-0xf8(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1040 <ntohs@plt>
mov    -0xf8(%rbp),%rdi
mov    %eax,%edx
lea    0xa3a(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0xc0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
jmp    15f5 <AddrToAddrStr+0x4a5>
mov    -0xe0(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xd8(%rbp)
jmp    15fa <AddrToAddrStr+0x4aa>
mov    -0xd8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     165d <AddrToAddrStr+0x50d>
mov    -0xd0(%rbp),%rax
cmp    -0xc8(%rbp),%rax
jae    1641 <AddrToAddrStr+0x4f1>
mov    -0xd8(%rbp),%rax
mov    (%rax),%cl
mov    -0xd0(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0xd0(%rbp)
mov    %cl,(%rax)
jmp    1646 <AddrToAddrStr+0x4f6>
mov    -0xd8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xd8(%rbp)
jmp    15fa <AddrToAddrStr+0x4aa>
mov    -0xd0(%rbp),%rax
movb   $0x0,(%rax)
jmp    16bc <AddrToAddrStr+0x56c>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1681 <AddrToAddrStr+0x531>
jmp    1726 <AddrToAddrStr+0x5d6>
mov    -0xd0(%rbp),%rax
cmp    -0xc8(%rbp),%rax
jae    16b2 <AddrToAddrStr+0x562>
mov    -0x28(%rbp),%rax
mov    (%rax),%cl
mov    -0xd0(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0xd0(%rbp)
mov    %cl,(%rax)
jmp    16b7 <AddrToAddrStr+0x567>
jmp    16bc <AddrToAddrStr+0x56c>
jmp    16c1 <AddrToAddrStr+0x571>
jmp    16c6 <AddrToAddrStr+0x576>
jmp    16cb <AddrToAddrStr+0x57b>
jmp    16d0 <AddrToAddrStr+0x580>
jmp    170b <AddrToAddrStr+0x5bb>
mov    -0xd0(%rbp),%rax
cmp    -0xc8(%rbp),%rax
jae    1706 <AddrToAddrStr+0x5b6>
mov    -0x28(%rbp),%rax
mov    (%rax),%cl
mov    -0xd0(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0xd0(%rbp)
mov    %cl,(%rax)
jmp    170b <AddrToAddrStr+0x5bb>
jmp    1710 <AddrToAddrStr+0x5c0>
jmp    1715 <AddrToAddrStr+0x5c5>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1234 <AddrToAddrStr+0xe4>
mov    -0xd0(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AddrToAddrStr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %r8,%r12
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r13
lea    0x8(%rdx),%r14
test   %ecx,%ecx
je     119d <AddrToAddrStr+0x4d>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0x4,%esi
call   1050 <gethostbyaddr@plt>
test   %rax,%rax
je     119d <AddrToAddrStr+0x4d>
mov    (%rax),%rax
test   %rax,%rax
je     119d <AddrToAddrStr+0x4d>
cmpb   $0x0,(%rax)
jne    11a5 <AddrToAddrStr+0x55>
mov    (%r14),%edi
call   1030 <inet_ntoa@plt>
test   %r12,%r12
lea    0xe89(%rip),%r14
cmovne %r12,%r14
test   %rax,%rax
lea    0xe84(%rip),%rcx
cmovne %rax,%rcx
mov    %rcx,0x18(%rsp)
add    %r13,%r15
add    $0xffffffffffffffff,%r15
lea    0x1(%rcx),%rax
mov    %rax,0x10(%rsp)
lea    0xe23(%rip),%r12
lea    0xe65(%rip),%rbp
mov    %r13,0x8(%rsp)
jmp    11f9 <AddrToAddrStr+0xa9>
nopl   0x0(%rax,%rax,1)
movb   $0x0,0x0(%r13)
add    $0x1,%r14
mov    (%r14),%al
cmp    $0x25,%al
je     1220 <AddrToAddrStr+0xd0>
test   %al,%al
je     1426 <AddrToAddrStr+0x2d6>
cmp    %r15,%r13
jae    11f5 <AddrToAddrStr+0xa5>
mov    %al,0x0(%r13)
add    $0x1,%r13
add    $0x1,%r14
jmp    11f9 <AddrToAddrStr+0xa9>
nopl   0x0(%rax,%rax,1)
mov    0x1(%r14),%al
add    $0x1,%r14
lea    -0x68(%rax),%ecx
cmp    $0xd,%cl
ja     1264 <AddrToAddrStr+0x114>
movzbl %cl,%ecx
movslq (%r12,%rcx,4),%rcx
add    %r12,%rcx
jmp    *%rcx
mov    (%rbx),%edi
cmp    $0x75,%al
mov    %rbp,%rsi
lea    0xe03(%rip),%rax
cmove  %rax,%rsi
call   1070 <getservbyport@plt>
test   %rax,%rax
je     137e <AddrToAddrStr+0x22e>
mov    (%rax),%rax
jmp    13a6 <AddrToAddrStr+0x256>
cmp    $0x25,%al
je     13de <AddrToAddrStr+0x28e>
test   %al,%al
je     1426 <AddrToAddrStr+0x2d6>
cmp    %r15,%r13
jae    11f5 <AddrToAddrStr+0xa5>
mov    %al,0x0(%r13)
add    $0x1,%r13
add    $0x1,%r14
jmp    11f9 <AddrToAddrStr+0xa9>
mov    0x18(%rsp),%rax
mov    (%rax),%cl
test   %cl,%cl
je     11f0 <AddrToAddrStr+0xa0>
mov    0x10(%rsp),%rax
jmp    12bf <AddrToAddrStr+0x16f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     11f0 <AddrToAddrStr+0xa0>
cmp    %r15,%r13
jae    12b0 <AddrToAddrStr+0x160>
mov    %cl,0x0(%r13)
add    $0x1,%r13
jmp    12b0 <AddrToAddrStr+0x160>
mov    (%rbx),%rdi
call   1040 <ntohs@plt>
lea    0x20(%rsp),%rdi
lea    0xd5c(%rip),%rsi
mov    %eax,%edx
call   1060 <sprintf@plt>
mov    0x20(%rsp),%cl
test   %cl,%cl
je     11f0 <AddrToAddrStr+0xa0>
lea    0x21(%rsp),%rax
jmp    130f <AddrToAddrStr+0x1bf>
nopl   0x0(%rax)
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     11f0 <AddrToAddrStr+0xa0>
cmp    %r15,%r13
jae    1300 <AddrToAddrStr+0x1b0>
mov    %cl,0x0(%r13)
add    $0x1,%r13
jmp    1300 <AddrToAddrStr+0x1b0>
mov    (%rbx),%edi
mov    %rbp,%rsi
call   1070 <getservbyport@plt>
test   %rax,%rax
jne    1344 <AddrToAddrStr+0x1f4>
mov    (%rbx),%edi
lea    0xd17(%rip),%rsi
call   1070 <getservbyport@plt>
test   %rax,%rax
je     13f9 <AddrToAddrStr+0x2a9>
mov    (%rax),%rax
mov    (%rax),%cl
test   %cl,%cl
je     11f0 <AddrToAddrStr+0xa0>
add    $0x1,%rax
jmp    136f <AddrToAddrStr+0x21f>
nopw   0x0(%rax,%rax,1)
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     11f0 <AddrToAddrStr+0xa0>
cmp    %r15,%r13
jae    1360 <AddrToAddrStr+0x210>
mov    %cl,0x0(%r13)
add    $0x1,%r13
jmp    1360 <AddrToAddrStr+0x210>
mov    (%rbx),%rdi
call   1040 <ntohs@plt>
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
lea    0xca9(%rip),%rsi
mov    %eax,%edx
call   1060 <sprintf@plt>
mov    %rbp,%rax
lea    0xca3(%rip),%rbp
mov    (%rax),%cl
test   %cl,%cl
je     11f0 <AddrToAddrStr+0xa0>
add    $0x1,%rax
jmp    13cf <AddrToAddrStr+0x27f>
cs nopw 0x0(%rax,%rax,1)
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     11f0 <AddrToAddrStr+0xa0>
cmp    %r15,%r13
jae    13c0 <AddrToAddrStr+0x270>
mov    %cl,0x0(%r13)
add    $0x1,%r13
jmp    13c0 <AddrToAddrStr+0x270>
cmp    %r15,%r13
jae    11f5 <AddrToAddrStr+0xa5>
movb   $0x25,0x0(%r13)
add    $0x1,%r13
add    $0x1,%r14
jmp    11f9 <AddrToAddrStr+0xa9>
mov    (%rbx),%rdi
call   1040 <ntohs@plt>
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
lea    0xc2e(%rip),%rsi
mov    %eax,%edx
call   1060 <sprintf@plt>
mov    %rbp,%rax
lea    0xc28(%rip),%rbp
jmp    1347 <AddrToAddrStr+0x1f7>
movb   $0x0,0x0(%r13)
mov    0x8(%rsp),%rax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i64, i32 }
%struct.hostent = type { i8* }
%struct.servent = type { i8* }
@AF_INET = global i32 0
@.str = [6 x i8] c"%h:%p\00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [8 x i8] c"unknown\00"
@.str.3 = [4 x i8] c"tcp\00"
@.str.4 = [4 x i8] c"udp\00"
define i8* @AddrToAddrStr(i8* %0, i64 %1, %struct.sockaddr_in* %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca %struct.sockaddr_in*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca %struct.hostent*
%13 = alloca [128 x i8]
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca %struct.servent*
store i8* %0, i8** %6
store i64 %1, i64* %7
store %struct.sockaddr_in* %2, %struct.sockaddr_in** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%18 = load i32, i32* %9
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %5
%21 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %21, i32 0, i32 1
%23 = load i32, i32* %22
%24 = call i8* @inet_ntoa(i32 %23)
store i8* %24, i8** %11
br label %56
25: ; preds = %5
%26 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %26, i32 0, i32 1
%28 = bitcast i32* %27 to i8*
%29 = load i32, i32* @AF_INET
%30 = call %struct.hostent* @gethostbyaddr(i8* %28, i32 4, i32 %29)
store %struct.hostent* %30, %struct.hostent** %12
%31 = load %struct.hostent*, %struct.hostent** %12
%32 = icmp ne %struct.hostent* %31, null
br i1 %32, label %33, label %50
33: ; preds = %25
%34 = load %struct.hostent*, %struct.hostent** %12
%35 = getelementptr inbounds %struct.hostent, %struct.hostent* %34, i32 0, i32 0
%36 = load i8*, i8** %35
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %50
38: ; preds = %33
%39 = load %struct.hostent*, %struct.hostent** %12
%40 = getelementptr inbounds %struct.hostent, %struct.hostent* %39, i32 0, i32 0
%41 = load i8*, i8** %40
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %38
%47 = load %struct.hostent*, %struct.hostent** %12
%48 = getelementptr inbounds %struct.hostent, %struct.hostent* %47, i32 0, i32 0
%49 = load i8*, i8** %48
store i8* %49, i8** %11
br label %55
50: ; preds = %38, %33, %25
%51 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%52 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %51, i32 0, i32 1
%53 = load i32, i32* %52
%54 = call i8* @inet_ntoa(i32 %53)
store i8* %54, i8** %11
br label %55
55: ; preds = %50, %46
br label %56
56: ; preds = %55, %20
%57 = load i8*, i8** %10
%58 = icmp eq i8* %57, null
br i1 %58, label %59, label %60
59: ; preds = %56
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %10
br label %60
60: ; preds = %59, %56
%61 = load i8*, i8** %6
store i8* %61, i8** %15
%62 = load i8*, i8** %15
%63 = load i64, i64* %7
%64 = getelementptr inbounds i8, i8* %62, i64 %63
%65 = getelementptr inbounds i8, i8* %64, i64 -1
store i8* %65, i8** %14
br label %66
66: ; preds = %306, %60
%67 = load i8*, i8** %10
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %66
br label %309
72: ; preds = %66
%73 = load i8*, i8** %10
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 37
br i1 %76, label %77, label %294
77: ; preds = %72
%78 = load i8*, i8** %10
%79 = getelementptr inbounds i8, i8* %78, i32 1
store i8* %79, i8** %10
%80 = load i8*, i8** %10
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %82, 37
br i1 %83, label %84, label %92
84: ; preds = %77
%85 = load i8*, i8** %15
%86 = load i8*, i8** %14
%87 = icmp ult i8* %85, %86
br i1 %87, label %88, label %91
88: ; preds = %84
%89 = load i8*, i8** %15
%90 = getelementptr inbounds i8, i8* %89, i32 1
store i8* %90, i8** %15
store i8 37, i8* %89
br label %91
91: ; preds = %88, %84
br label %293
92: ; preds = %77
%93 = load i8*, i8** %10
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = icmp eq i32 %95, 112
br i1 %96, label %97, label %126
97: ; preds = %92
%98 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%99 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%100 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %99, i32 0, i32 0
%101 = load i64, i64* %100
%102 = call i64 @ntohs(i64 %101)
%103 = trunc i64 %102 to i32
%104 = call i32 @sprintf(i8* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %103)
%105 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
store i8* %105, i8** %16
br label %106
106: ; preds = %121, %97
%107 = load i8*, i8** %16
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %124
111: ; preds = %106
%112 = load i8*, i8** %15
%113 = load i8*, i8** %14
%114 = icmp ult i8* %112, %113
br i1 %114, label %115, label %120
115: ; preds = %111
%116 = load i8*, i8** %16
%117 = load i8, i8* %116
%118 = load i8*, i8** %15
%119 = getelementptr inbounds i8, i8* %118, i32 1
store i8* %119, i8** %15
store i8 %117, i8* %118
br label %120
120: ; preds = %115, %111
br label %121
121: ; preds = %120
%122 = load i8*, i8** %16
%123 = getelementptr inbounds i8, i8* %122, i32 1
store i8* %123, i8** %16
br label %106
124: ; preds = %106
%125 = load i8*, i8** %15
store i8 0, i8* %125
br label %292
126: ; preds = %92
%127 = load i8*, i8** %10
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = icmp eq i32 %129, 104
br i1 %130, label %131, label %158
131: ; preds = %126
%132 = load i8*, i8** %11
%133 = icmp ne i8* %132, null
br i1 %133, label %134, label %136
134: ; preds = %131
%135 = load i8*, i8** %11
store i8* %135, i8** %16
br label %137
136: ; preds = %131
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %16
br label %137
137: ; preds = %136, %134
br label %138
138: ; preds = %153, %137
%139 = load i8*, i8** %16
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = icmp ne i32 %141, 0
br i1 %142, label %143, label %156
143: ; preds = %138
%144 = load i8*, i8** %15
%145 = load i8*, i8** %14
%146 = icmp ult i8* %144, %145
br i1 %146, label %147, label %152
147: ; preds = %143
%148 = load i8*, i8** %16
%149 = load i8, i8* %148
%150 = load i8*, i8** %15
%151 = getelementptr inbounds i8, i8* %150, i32 1
store i8* %151, i8** %15
store i8 %149, i8* %150
br label %152
152: ; preds = %147, %143
br label %153
153: ; preds = %152
%154 = load i8*, i8** %16
%155 = getelementptr inbounds i8, i8* %154, i32 1
store i8* %155, i8** %16
br label %138
156: ; preds = %138
%157 = load i8*, i8** %15
store i8 0, i8* %157
br label %291
158: ; preds = %126
%159 = load i8*, i8** %10
%160 = load i8, i8* %159
%161 = sext i8 %160 to i32
%162 = icmp eq i32 %161, 115
br i1 %162, label %163, label %214
163: ; preds = %158
%164 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%165 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %164, i32 0, i32 0
%166 = load i64, i64* %165
%167 = trunc i64 %166 to i32
%168 = call %struct.servent* @getservbyport(i32 %167, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store %struct.servent* %168, %struct.servent** %17
%169 = load %struct.servent*, %struct.servent** %17
%170 = icmp eq %struct.servent* %169, null
br i1 %170, label %171, label %177
171: ; preds = %163
%172 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%173 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %172, i32 0, i32 0
%174 = load i64, i64* %173
%175 = trunc i64 %174 to i32
%176 = call %struct.servent* @getservbyport(i32 %175, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store %struct.servent* %176, %struct.servent** %17
br label %177
177: ; preds = %171, %163
%178 = load %struct.servent*, %struct.servent** %17
%179 = icmp eq %struct.servent* %178, null
br i1 %179, label %180, label %189
180: ; preds = %177
%181 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%182 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%183 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %182, i32 0, i32 0
%184 = load i64, i64* %183
%185 = call i64 @ntohs(i64 %184)
%186 = trunc i64 %185 to i32
%187 = call i32 @sprintf(i8* %181, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %186)
%188 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
store i8* %188, i8** %16
br label %193
189: ; preds = %177
%190 = load %struct.servent*, %struct.servent** %17
%191 = getelementptr inbounds %struct.servent, %struct.servent* %190, i32 0, i32 0
%192 = load i8*, i8** %191
store i8* %192, i8** %16
br label %193
193: ; preds = %189, %180
br label %194
194: ; preds = %209, %193
%195 = load i8*, i8** %16
%196 = load i8, i8* %195
%197 = sext i8 %196 to i32
%198 = icmp ne i32 %197, 0
br i1 %198, label %199, label %212
199: ; preds = %194
%200 = load i8*, i8** %15
%201 = load i8*, i8** %14
%202 = icmp ult i8* %200, %201
br i1 %202, label %203, label %208
203: ; preds = %199
%204 = load i8*, i8** %16
%205 = load i8, i8* %204
%206 = load i8*, i8** %15
%207 = getelementptr inbounds i8, i8* %206, i32 1
store i8* %207, i8** %15
store i8 %205, i8* %206
br label %208
208: ; preds = %203, %199
br label %209
209: ; preds = %208
%210 = load i8*, i8** %16
%211 = getelementptr inbounds i8, i8* %210, i32 1
store i8* %211, i8** %16
br label %194
212: ; preds = %194
%213 = load i8*, i8** %15
store i8 0, i8* %213
br label %290
214: ; preds = %158
%215 = load i8*, i8** %10
%216 = load i8, i8* %215
%217 = sext i8 %216 to i32
%218 = icmp eq i32 %217, 116
br i1 %218, label %224, label %219
219: ; preds = %214
%220 = load i8*, i8** %10
%221 = load i8, i8* %220
%222 = sext i8 %221 to i32
%223 = icmp eq i32 %222, 117
br i1 %223, label %224, label %272
224: ; preds = %219, %214
%225 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%226 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %225, i32 0, i32 0
%227 = load i64, i64* %226
%228 = trunc i64 %227 to i32
%229 = load i8*, i8** %10
%230 = load i8, i8* %229
%231 = sext i8 %230 to i32
%232 = icmp eq i32 %231, 117
%233 = zext i1 %232 to i64
%234 = select i1 %232, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%235 = call %struct.servent* @getservbyport(i32 %228, i8* %234)
store %struct.servent* %235, %struct.servent** %17
%236 = load %struct.servent*, %struct.servent** %17
%237 = icmp eq %struct.servent* %236, null
br i1 %237, label %238, label %247
238: ; preds = %224
%239 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%240 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%241 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %240, i32 0, i32 0
%242 = load i64, i64* %241
%243 = call i64 @ntohs(i64 %242)
%244 = trunc i64 %243 to i32
%245 = call i32 @sprintf(i8* %239, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %244)
%246 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
store i8* %246, i8** %16
br label %251
247: ; preds = %224
%248 = load %struct.servent*, %struct.servent** %17
%249 = getelementptr inbounds %struct.servent, %struct.servent* %248, i32 0, i32 0
%250 = load i8*, i8** %249
store i8* %250, i8** %16
br label %251
251: ; preds = %247, %238
br label %252
252: ; preds = %267, %251
%253 = load i8*, i8** %16
%254 = load i8, i8* %253
%255 = sext i8 %254 to i32
%256 = icmp ne i32 %255, 0
br i1 %256, label %257, label %270
257: ; preds = %252
%258 = load i8*, i8** %15
%259 = load i8*, i8** %14
%260 = icmp ult i8* %258, %259
br i1 %260, label %261, label %266
261: ; preds = %257
%262 = load i8*, i8** %16
%263 = load i8, i8* %262
%264 = load i8*, i8** %15
%265 = getelementptr inbounds i8, i8* %264, i32 1
store i8* %265, i8** %15
store i8 %263, i8* %264
br label %266
266: ; preds = %261, %257
br label %267
267: ; preds = %266
%268 = load i8*, i8** %16
%269 = getelementptr inbounds i8, i8* %268, i32 1
store i8* %269, i8** %16
br label %252
270: ; preds = %252
%271 = load i8*, i8** %15
store i8 0, i8* %271
br label %289
272: ; preds = %219
%273 = load i8*, i8** %10
%274 = load i8, i8* %273
%275 = sext i8 %274 to i32
%276 = icmp eq i32 %275, 0
br i1 %276, label %277, label %278
277: ; preds = %272
br label %309
278: ; preds = %272
%279 = load i8*, i8** %15
%280 = load i8*, i8** %14
%281 = icmp ult i8* %279, %280
br i1 %281, label %282, label %287
282: ; preds = %278
%283 = load i8*, i8** %10
%284 = load i8, i8* %283
%285 = load i8*, i8** %15
%286 = getelementptr inbounds i8, i8* %285, i32 1
store i8* %286, i8** %15
store i8 %284, i8* %285
br label %287
287: ; preds = %282, %278
br label %288
288: ; preds = %287
br label %289
289: ; preds = %288, %270
br label %290
290: ; preds = %289, %212
br label %291
291: ; preds = %290, %156
br label %292
292: ; preds = %291, %124
br label %293
293: ; preds = %292, %91
br label %304
294: ; preds = %72
%295 = load i8*, i8** %15
%296 = load i8*, i8** %14
%297 = icmp ult i8* %295, %296
br i1 %297, label %298, label %303
298: ; preds = %294
%299 = load i8*, i8** %10
%300 = load i8, i8* %299
%301 = load i8*, i8** %15
%302 = getelementptr inbounds i8, i8* %301, i32 1
store i8* %302, i8** %15
store i8 %300, i8* %301
br label %303
303: ; preds = %298, %294
br label %304
304: ; preds = %303, %293
br label %305
305: ; preds = %304
br label %306
306: ; preds = %305
%307 = load i8*, i8** %10
%308 = getelementptr inbounds i8, i8* %307, i32 1
store i8* %308, i8** %10
br label %66
309: ; preds = %277, %71
%310 = load i8*, i8** %15
store i8 0, i8* %310
%311 = load i8*, i8** %6
ret i8* %311
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i64, i32 }
%struct.hostent = type { i8* }
%struct.servent = type { i8* }
@AF_INET = global i32 0
@.str = [6 x i8] c"%h:%p\00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [8 x i8] c"unknown\00"
@.str.3 = [4 x i8] c"tcp\00"
@.str.4 = [4 x i8] c"udp\00"
define i8* @AddrToAddrStr(i8* returned writeonly %0, i64 %1, %struct.sockaddr_in* %2, i32 %3, i8* %4) {
%6 = alloca [128 x i8]
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%8 = icmp eq i32 %3, 0
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
br i1 %8, label %22, label %10
10: ; preds = %5
%11 = bitcast i32* %9 to i8*
%12 = load i32, i32* @AF_INET
%13 = tail call %struct.hostent* @gethostbyaddr(i8* %11, i32 4, i32 %12)
%14 = icmp eq %struct.hostent* %13, null
br i1 %14, label %22, label %15
15: ; preds = %10
%16 = getelementptr inbounds %struct.hostent, %struct.hostent* %13, i64 0, i32 0
%17 = load i8*, i8** %16
%18 = icmp eq i8* %17, null
br i1 %18, label %22, label %19
19: ; preds = %15
%20 = load i8, i8* %17
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %10, %15, %19, %5
%23 = load i32, i32* %9
%24 = tail call i8* @inet_ntoa(i32 %23)
br label %25
25: ; preds = %22, %19
%26 = phi i8* [ %17, %19 ], [ %24, %22 ]
%27 = icmp eq i8* %4, null
%28 = select i1 %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %4
%29 = getelementptr inbounds i8, i8* %0, i64 %1
%30 = getelementptr inbounds i8, i8* %29, i64 -1
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%32 = icmp eq i8* %26, null
%33 = select i1 %32, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %26
br label %34
34: ; preds = %161, %25
%35 = phi i8* [ %28, %25 ], [ %164, %161 ]
%36 = phi i8* [ %0, %25 ], [ %163, %161 ]
%37 = load i8, i8* %35
switch i8 %37, label %157 [
i8 0, label %165
i8 37, label %38
]
38: ; preds = %34
%39 = getelementptr inbounds i8, i8* %35, i64 1
%40 = load i8, i8* %39
switch i8 %40, label %153 [
i8 37, label %41
i8 112, label %45
i8 104, label %66
i8 115, label %83
i8 116, label %120
i8 117, label %120
i8 0, label %165
]
41: ; preds = %38
%42 = icmp ult i8* %36, %30
br i1 %42, label %43, label %161
43: ; preds = %41
%44 = getelementptr inbounds i8, i8* %36, i64 1
store i8 37, i8* %36
br label %161
45: ; preds = %38
%46 = load i64, i64* %31
%47 = tail call i64 @ntohs(i64 %46)
%48 = trunc i64 %47 to i32
%49 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = load i8, i8* %7
%51 = icmp eq i8 %50, 0
br i1 %51, label %64, label %52
52: ; preds = %45, %59
%53 = phi i8 [ %62, %59 ], [ %50, %45 ]
%54 = phi i8* [ %61, %59 ], [ %7, %45 ]
%55 = phi i8* [ %60, %59 ], [ %36, %45 ]
%56 = icmp ult i8* %55, %30
br i1 %56, label %57, label %59
57: ; preds = %52
%58 = getelementptr inbounds i8, i8* %55, i64 1
store i8 %53, i8* %55
br label %59
59: ; preds = %52, %57
%60 = phi i8* [ %58, %57 ], [ %55, %52 ]
%61 = getelementptr inbounds i8, i8* %54, i64 1
%62 = load i8, i8* %61
%63 = icmp eq i8 %62, 0
br i1 %63, label %64, label %52
64: ; preds = %59, %45
%65 = phi i8* [ %36, %45 ], [ %60, %59 ]
store i8 0, i8* %65
br label %161
66: ; preds = %38
%67 = load i8, i8* %33
%68 = icmp eq i8 %67, 0
br i1 %68, label %81, label %69
69: ; preds = %66, %76
%70 = phi i8 [ %79, %76 ], [ %67, %66 ]
%71 = phi i8* [ %78, %76 ], [ %33, %66 ]
%72 = phi i8* [ %77, %76 ], [ %36, %66 ]
%73 = icmp ult i8* %72, %30
br i1 %73, label %74, label %76
74: ; preds = %69
%75 = getelementptr inbounds i8, i8* %72, i64 1
store i8 %70, i8* %72
br label %76
76: ; preds = %69, %74
%77 = phi i8* [ %75, %74 ], [ %72, %69 ]
%78 = getelementptr inbounds i8, i8* %71, i64 1
%79 = load i8, i8* %78
%80 = icmp eq i8 %79, 0
br i1 %80, label %81, label %69
81: ; preds = %76, %66
%82 = phi i8* [ %36, %66 ], [ %77, %76 ]
store i8 0, i8* %82
br label %161
83: ; preds = %38
%84 = load i64, i64* %31
%85 = trunc i64 %84 to i32
%86 = tail call %struct.servent* @getservbyport(i32 %85, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%87 = icmp eq %struct.servent* %86, null
br i1 %87, label %88, label %98
88: ; preds = %83
%89 = load i64, i64* %31
%90 = trunc i64 %89 to i32
%91 = tail call %struct.servent* @getservbyport(i32 %90, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%92 = icmp eq %struct.servent* %91, null
br i1 %92, label %93, label %98
93: ; preds = %88
%94 = load i64, i64* %31
%95 = tail call i64 @ntohs(i64 %94)
%96 = trunc i64 %95 to i32
%97 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %96)
br label %102
98: ; preds = %83, %88
%99 = phi %struct.servent* [ %91, %88 ], [ %86, %83 ]
%100 = getelementptr inbounds %struct.servent, %struct.servent* %99, i64 0, i32 0
%101 = load i8*, i8** %100
br label %102
102: ; preds = %98, %93
%103 = phi i8* [ %7, %93 ], [ %101, %98 ]
%104 = load i8, i8* %103
%105 = icmp eq i8 %104, 0
br i1 %105, label %118, label %106
106: ; preds = %102, %113
%107 = phi i8 [ %116, %113 ], [ %104, %102 ]
%108 = phi i8* [ %115, %113 ], [ %103, %102 ]
%109 = phi i8* [ %114, %113 ], [ %36, %102 ]
%110 = icmp ult i8* %109, %30
br i1 %110, label %111, label %113
111: ; preds = %106
%112 = getelementptr inbounds i8, i8* %109, i64 1
store i8 %107, i8* %109
br label %113
113: ; preds = %106, %111
%114 = phi i8* [ %112, %111 ], [ %109, %106 ]
%115 = getelementptr inbounds i8, i8* %108, i64 1
%116 = load i8, i8* %115
%117 = icmp eq i8 %116, 0
br i1 %117, label %118, label %106
118: ; preds = %113, %102
%119 = phi i8* [ %36, %102 ], [ %114, %113 ]
store i8 0, i8* %119
br label %161
120: ; preds = %38, %38
%121 = load i64, i64* %31
%122 = trunc i64 %121 to i32
%123 = icmp eq i8 %40, 117
%124 = select i1 %123, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%125 = tail call %struct.servent* @getservbyport(i32 %122, i8* %124)
%126 = icmp eq %struct.servent* %125, null
br i1 %126, label %127, label %132
127: ; preds = %120
%128 = load i64, i64* %31
%129 = tail call i64 @ntohs(i64 %128)
%130 = trunc i64 %129 to i32
%131 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %130)
br label %135
132: ; preds = %120
%133 = getelementptr inbounds %struct.servent, %struct.servent* %125, i64 0, i32 0
%134 = load i8*, i8** %133
br label %135
135: ; preds = %132, %127
%136 = phi i8* [ %7, %127 ], [ %134, %132 ]
%137 = load i8, i8* %136
%138 = icmp eq i8 %137, 0
br i1 %138, label %151, label %139
139: ; preds = %135, %146
%140 = phi i8 [ %149, %146 ], [ %137, %135 ]
%141 = phi i8* [ %148, %146 ], [ %136, %135 ]
%142 = phi i8* [ %147, %146 ], [ %36, %135 ]
%143 = icmp ult i8* %142, %30
br i1 %143, label %144, label %146
144: ; preds = %139
%145 = getelementptr inbounds i8, i8* %142, i64 1
store i8 %140, i8* %142
br label %146
146: ; preds = %139, %144
%147 = phi i8* [ %145, %144 ], [ %142, %139 ]
%148 = getelementptr inbounds i8, i8* %141, i64 1
%149 = load i8, i8* %148
%150 = icmp eq i8 %149, 0
br i1 %150, label %151, label %139
151: ; preds = %146, %135
%152 = phi i8* [ %36, %135 ], [ %147, %146 ]
store i8 0, i8* %152
br label %161
153: ; preds = %38
%154 = icmp ult i8* %36, %30
br i1 %154, label %155, label %161
155: ; preds = %153
%156 = getelementptr inbounds i8, i8* %36, i64 1
store i8 %40, i8* %36
br label %161
157: ; preds = %34
%158 = icmp ult i8* %36, %30
br i1 %158, label %159, label %161
159: ; preds = %157
%160 = getelementptr inbounds i8, i8* %36, i64 1
store i8 %37, i8* %36
br label %161
161: ; preds = %157, %159, %43, %41, %81, %151, %153, %155, %118, %64
%162 = phi i8* [ %39, %43 ], [ %39, %41 ], [ %39, %64 ], [ %39, %81 ], [ %39, %118 ], [ %39, %151 ], [ %39, %155 ], [ %39, %153 ], [ %35, %159 ], [ %35, %157 ]
%163 = phi i8* [ %44, %43 ], [ %36, %41 ], [ %65, %64 ], [ %82, %81 ], [ %119, %118 ], [ %152, %151 ], [ %156, %155 ], [ %36, %153 ], [ %160, %159 ], [ %36, %157 ]
%164 = getelementptr inbounds i8, i8* %162, i64 1
br label %34
165: ; preds = %38, %34
store i8 0, i8* %36
ret i8* %0
}