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

/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
int /*<<< orphan*/ EAFNOSUPPORT;
int /*<<< orphan*/ ENOSPC;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ memcmp(unsigned char const *, char *, int);
int /*<<< orphan*/ memmove(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned char const,
                            unsigned char const, unsigned char const,
                            unsigned char const, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
int strspn(char *, char *);
const char *inet_ntop(int af, const void *restrict a0, char *restrict s,
                      socklen_t l) {
  const unsigned char *a = a0;
  int i, j, max, best;
  char buf[100];
  switch (af) {
  case AF_INET:
    if (snprintf(s, l, "%d.%d.%d.%d", a[0], a[1], a[2], a[3]) < l)
      return s;
    break;
  case AF_INET6:
    if (memcmp(a, "\0\0\0\0\0\0\0\0\0\0\377\377", 12))
      snprintf(buf, sizeof buf, "%x:%x:%x:%x:%x:%x:%x:%x", 256 * a[0] + a[1],
               256 * a[2] + a[3], 256 * a[4] + a[5], 256 * a[6] + a[7],
               256 * a[8] + a[9], 256 * a[10] + a[11], 256 * a[12] + a[13],
               256 * a[14] + a[15]);
    else
      snprintf(buf, sizeof buf, "%x:%x:%x:%x:%x:%x:%d.%d.%d.%d",
               256 * a[0] + a[1], 256 * a[2] + a[3], 256 * a[4] + a[5],
               256 * a[6] + a[7], 256 * a[8] + a[9], 256 * a[10] + a[11], a[12],
               a[13], a[14], a[15]);
    for (i = best = 0, max = 2; buf[i]; i++) {
      if (i && buf[i] != ':')
        continue;
      j = strspn(buf + i, ":0");
      if (j > max)
        best = i, max = j;
    }
    if (max > 3) {
      buf[best] = buf[best + 1] = ':';
      memmove(buf + best + 2, buf + best + max, i - best - max + 1);
    }
    if (strlen(buf) < l) {
      strcpy(s, buf);
      return s;
    }
    break;
  default:
    errno = EAFNOSUPPORT;
    return 0;
  }
  errno = ENOSPC;
  return 0;
}


x86 assembly (clang, -O0):
<inet_ntop>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xf0,%rsp
mov    %edi,-0x2c(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %ecx,-0x44(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0xd4(%rbp)
sub    $0x80,%eax
je     1213 <inet_ntop+0xb3>
jmp    11a1 <inet_ntop+0x41>
mov    -0xd4(%rbp),%eax
sub    $0x81,%eax
jne    1552 <inet_ntop+0x3f2>
jmp    11b7 <inet_ntop+0x57>
mov    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x50(%rbp),%rax
mov    (%rax),%cl
mov    -0x50(%rbp),%rax
mov    0x1(%rax),%r8b
mov    -0x50(%rbp),%rax
mov    0x2(%rax),%r9b
mov    -0x50(%rbp),%rax
lea    0xe4b(%rip),%rdx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl 0x3(%rax),%eax
mov    %eax,(%rsp)
mov    $0x0,%al
call   1050 <snprintf@plt>
cmp    -0x44(%rbp),%eax
jge    120e <inet_ntop+0xae>
mov    -0x40(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    158b <inet_ntop+0x42b>
jmp    1571 <inet_ntop+0x411>
mov    -0x50(%rbp),%rdi
lea    0xe1b(%rip),%rsi
mov    $0xc,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%eax
je     132d <inet_ntop+0x1cd>
lea    -0xd0(%rbp),%rdi
mov    -0x50(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x50(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    %al,%cl
mov    -0x50(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x8,%eax
mov    -0x50(%rbp),%rdx
movzbl 0x3(%rdx),%edx
add    %edx,%eax
mov    %al,%r8b
mov    -0x50(%rbp),%rax
movzbl 0x4(%rax),%eax
shl    $0x8,%eax
mov    -0x50(%rbp),%rdx
movzbl 0x5(%rdx),%edx
add    %edx,%eax
mov    %al,%r9b
mov    -0x50(%rbp),%rax
movzbl 0x6(%rax),%eax
shl    $0x8,%eax
mov    -0x50(%rbp),%rdx
movzbl 0x7(%rdx),%edx
add    %edx,%eax
mov    %al,%r14b
mov    -0x50(%rbp),%rax
movzbl 0x8(%rax),%ebx
shl    $0x8,%ebx
mov    -0x50(%rbp),%rax
movzbl 0x9(%rax),%eax
add    %eax,%ebx
mov    -0x50(%rbp),%rax
movzbl 0xa(%rax),%r11d
shl    $0x8,%r11d
mov    -0x50(%rbp),%rax
movzbl 0xb(%rax),%eax
add    %eax,%r11d
mov    -0x50(%rbp),%rax
movzbl 0xc(%rax),%r10d
shl    $0x8,%r10d
mov    -0x50(%rbp),%rax
movzbl 0xd(%rax),%eax
add    %eax,%r10d
mov    -0x50(%rbp),%rax
movzbl 0xe(%rax),%eax
shl    $0x8,%eax
mov    -0x50(%rbp),%rdx
movzbl 0xf(%rdx),%edx
add    %edx,%eax
mov    $0x64,%esi
lea    0xd04(%rip),%rdx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl %r14b,%r14d
mov    %r14d,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    $0x0,%al
call   1050 <snprintf@plt>
jmp    1426 <inet_ntop+0x2c6>
lea    -0xd0(%rbp),%rdi
mov    -0x50(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x50(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    %al,%cl
mov    -0x50(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x8,%eax
mov    -0x50(%rbp),%rdx
movzbl 0x3(%rdx),%edx
add    %edx,%eax
mov    %al,%r8b
mov    -0x50(%rbp),%rax
movzbl 0x4(%rax),%eax
shl    $0x8,%eax
mov    -0x50(%rbp),%rdx
movzbl 0x5(%rdx),%edx
add    %edx,%eax
mov    %al,%r9b
mov    -0x50(%rbp),%rax
movzbl 0x6(%rax),%eax
shl    $0x8,%eax
mov    -0x50(%rbp),%rdx
movzbl 0x7(%rdx),%edx
add    %edx,%eax
mov    %al,%r12b
mov    -0x50(%rbp),%rax
movzbl 0x8(%rax),%r15d
shl    $0x8,%r15d
mov    -0x50(%rbp),%rax
movzbl 0x9(%rax),%eax
add    %eax,%r15d
mov    -0x50(%rbp),%rax
movzbl 0xa(%rax),%r14d
shl    $0x8,%r14d
mov    -0x50(%rbp),%rax
movzbl 0xb(%rax),%eax
add    %eax,%r14d
mov    -0x50(%rbp),%rax
movzbl 0xc(%rax),%ebx
mov    -0x50(%rbp),%rax
movzbl 0xd(%rax),%r11d
mov    -0x50(%rbp),%rax
movzbl 0xe(%rax),%r10d
mov    -0x50(%rbp),%rax
movzbl 0xf(%rax),%eax
mov    $0x64,%esi
lea    0xc28(%rip),%rdx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl %r12b,%r12d
mov    %r12d,(%rsp)
mov    %r15d,0x8(%rsp)
mov    %r14d,0x10(%rsp)
mov    %ebx,0x18(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10d,0x28(%rsp)
mov    %eax,0x30(%rsp)
mov    $0x0,%al
call   1050 <snprintf@plt>
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x2,-0x5c(%rbp)
movslq -0x54(%rbp),%rax
cmpb   $0x0,-0xd0(%rbp,%rax,1)
je     14b9 <inet_ntop+0x359>
cmpl   $0x0,-0x54(%rbp)
je     1471 <inet_ntop+0x311>
movslq -0x54(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%eax
ff
cmp    $0x3a,%eax
je     1471 <inet_ntop+0x311>
jmp    14ab <inet_ntop+0x34b>
lea    -0xd0(%rbp),%rdi
movslq -0x54(%rbp),%rax
add    %rax,%rdi
lea    0xbb0(%rip),%rsi
call   1060 <strspn@plt>
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jle    14a6 <inet_ntop+0x346>
mov    -0x54(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x5c(%rbp)
jmp    14ab <inet_ntop+0x34b>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    143b <inet_ntop+0x2db>
cmpl   $0x3,-0x5c(%rbp)
jle    151b <inet_ntop+0x3bb>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x3a,-0xd0(%rbp,%rax,1)
3a
movslq -0x60(%rbp),%rax
movb   $0x3a,-0xd0(%rbp,%rax,1)
3a
lea    -0xd0(%rbp),%rax
movslq -0x60(%rbp),%rcx
add    %rcx,%rax
add    $0x2,%rax
mov    %eax,%edi
lea    -0xd0(%rbp),%rax
movslq -0x60(%rbp),%rcx
add    %rcx,%rax
movslq -0x5c(%rbp),%rcx
add    %rcx,%rax
mov    %eax,%esi
mov    -0x54(%rbp),%edx
sub    -0x60(%rbp),%edx
sub    -0x5c(%rbp),%edx
add    $0x1,%edx
call   1080 <memmove@plt>
lea    -0xd0(%rbp),%rdi
call   1040 <strlen@plt>
cmp    -0x44(%rbp),%eax
jge    154d <inet_ntop+0x3ed>
mov    -0x40(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    158b <inet_ntop+0x42b>
jmp    1571 <inet_ntop+0x411>
mov    0x2a77(%rip),%rax
mov    (%rax),%ecx
mov    0x2a7e(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x28(%rbp)
jmp    158b <inet_ntop+0x42b>
mov    0x2a60(%rip),%rax
mov    (%rax),%ecx
mov    0x2a5f(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0xf0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_ntop>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
cmp    $0x80,%edi
je     11c8 <inet_ntop+0x68>
cmp    $0x81,%edi
jne    1256 <inet_ntop+0xf6>
movzbl 0x0(%rbp),%ecx
movzbl 0x1(%rbp),%r8d
movzbl 0x2(%rbp),%r9d
movzbl 0x3(%rbp),%ebp
sub    $0x8,%rsp
lea    0xe82(%rip),%rdx
mov    %r15,%rdi
mov    %r14d,%esi
xor    %eax,%eax
push   %rbp
call   1050 <snprintf@plt>
add    $0x10,%rsp
cmp    %r14d,%eax
jge    1349 <inet_ntop+0x1e9>
jmp    135e <inet_ntop+0x1fe>
lea    0xe6a(%rip),%rsi
mov    %rbp,%rdi
mov    $0xc,%edx
call   1070 <memcmp@plt>
movzwl 0x8(%rbp),%r10d
shl    $0x10,%r10d
movzwl 0xa(%rbp),%ebx
shl    $0x10,%ebx
mov    0x1(%rbp),%cl
mov    0x3(%rbp),%dil
mov    0x5(%rbp),%sil
mov    0x7(%rbp),%dl
bswap  %r10d
bswap  %ebx
movzbl 0xc(%rbp),%r11d
test   %eax,%eax
je     1262 <inet_ntop+0x102>
shl    $0x8,%r11d
movzbl 0xd(%rbp),%r12d
or     %r11d,%r12d
movzwl 0xe(%rbp),%ebp
shl    $0x10,%ebp
bswap  %ebp
sub    $0x8,%rsp
movzbl %dl,%r11d
movzbl %cl,%ecx
movzbl %dil,%r8d
movzbl %sil,%r9d
lea    0xdc9(%rip),%rdx
lea    0x18(%rsp),%rdi
mov    $0x64,%esi
xor    %eax,%eax
push   %rbp
push   %r12
push   %rbx
push   %r10
push   %r11
call   1050 <snprintf@plt>
add    $0x30,%rsp
jmp    12b1 <inet_ntop+0x151>
mov    0x2d73(%rip),%rax
jmp    1350 <inet_ntop+0x1f0>
movzbl 0xd(%rbp),%r12d
movzbl 0xe(%rbp),%r13d
movzbl 0xf(%rbp),%ebp
sub    $0x8,%rsp
movzbl %dl,%eax
mov    %rax,0x10(%rsp)
movzbl %cl,%ecx
movzbl %dil,%r8d
movzbl %sil,%r9d
lea    0xd8a(%rip),%rdx
lea    0x18(%rsp),%rdi
mov    $0x64,%esi
xor    %eax,%eax
push   %rbp
push   %r13
push   %r12
push   %r11
push   %rbx
push   %r10
push   0x40(%rsp)
call   1050 <snprintf@plt>
add    $0x40,%rsp
mov    0x10(%rsp),%al
test   %al,%al
je     132b <inet_ntop+0x1cb>
mov    $0x2,%ebx
xor    %ebp,%ebp
lea    0xd6f(%rip),%r12
xor    %r13d,%r13d
jmp    12f6 <inet_ntop+0x196>
nopl   0x0(%rax)
lea    (%rsp,%rbp,1),%rdi
add    $0x10,%rdi
mov    %r12,%rsi
call   1060 <strspn@plt>
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %ebp,%r13d
movzbl 0x11(%rsp,%rbp,1),%eax
add    $0x1,%rbp
test   %al,%al
je     1301 <inet_ntop+0x1a1>
test   %rbp,%rbp
je     12d0 <inet_ntop+0x170>
cmp    $0x3a,%al
jne    12e9 <inet_ntop+0x189>
jmp    12d0 <inet_ntop+0x170>
cmp    $0x4,%ebx
jl     132b <inet_ntop+0x1cb>
movslq %r13d,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x10,%rsi
movw   $0x3a3a,0x10(%rsp,%rax,1)
lea    0x2(%rsi),%edi
add    %ebx,%esi
add    %ebx,%eax
sub    %eax,%ebp
add    $0x1,%ebp
mov    %ebp,%edx
call   1080 <memmove@plt>
lea    0x10(%rsp),%rdi
call   1040 <strlen@plt>
cmp    %r14d,%eax
jge    1349 <inet_ntop+0x1e9>
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1030 <strcpy@plt>
jmp    135e <inet_ntop+0x1fe>
mov    0x2c88(%rip),%rax
mov    (%rax),%eax
mov    0x2c87(%rip),%rcx
mov    %eax,(%rcx)
xor    %r15d,%r15d
mov    %r15,%rax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
@.str.1 = [13 x i8] c"\00\00\00\00\00\00\00\00\00\00\FF\FF\00"
@.str.2 = [24 x i8] c"%x:%x:%x:%x:%x:%x:%x:%x\00"
@.str.3 = [30 x i8] c"%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\00"
@.str.4 = [3 x i8] c":0\00"
@EAFNOSUPPORT = global i32 0
@errno = global i32 0
@ENOSPC = global i32 0
define i8* @inet_ntop(i32 %0, i8* noalias %1, i8* noalias %2, i32 %3) {
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
switch i32 %0, label %123 [
i32 129, label %7
i32 128, label %17
]
7: ; preds = %4
%8 = load i8, i8* %1
%9 = getelementptr inbounds i8, i8* %1, i64 1
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %1, i64 2
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 3
%14 = load i8, i8* %13
%15 = tail call i32 (i8*, i32, i8*, i8, i8, i8, i8, ...) @snprintf(i8* %2, i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %8, i8 zeroext %10, i8 zeroext %12, i8 zeroext %14)
%16 = icmp slt i32 %15, %3
br i1 %16, label %127, label %125
17: ; preds = %4
%18 = tail call i32 @memcmp(i8* %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 12)
%19 = icmp eq i32 %18, 0
%20 = getelementptr inbounds i8, i8* %1, i64 1
%21 = load i8, i8* %20
%22 = getelementptr inbounds i8, i8* %1, i64 3
%23 = load i8, i8* %22
%24 = getelementptr inbounds i8, i8* %1, i64 5
%25 = load i8, i8* %24
%26 = getelementptr inbounds i8, i8* %1, i64 7
%27 = load i8, i8* %26
%28 = getelementptr inbounds i8, i8* %1, i64 8
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = shl nuw nsw i32 %30, 8
%32 = getelementptr inbounds i8, i8* %1, i64 9
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = or i32 %31, %34
%36 = getelementptr inbounds i8, i8* %1, i64 10
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = shl nuw nsw i32 %38, 8
%40 = getelementptr inbounds i8, i8* %1, i64 11
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = or i32 %39, %42
%44 = getelementptr inbounds i8, i8* %1, i64 12
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
br i1 %19, label %62, label %47
47: ; preds = %17
%48 = shl nuw nsw i32 %46, 8
%49 = getelementptr inbounds i8, i8* %1, i64 13
%50 = load i8, i8* %49
%51 = zext i8 %50 to i32
%52 = or i32 %48, %51
%53 = getelementptr inbounds i8, i8* %1, i64 14
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
%56 = shl nuw nsw i32 %55, 8
%57 = getelementptr inbounds i8, i8* %1, i64 15
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = or i32 %56, %59
%61 = call i32 (i8*, i32, i8*, i8, i8, i8, i8, ...) @snprintf(i8* %6, i32 100, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %21, i8 zeroext %23, i8 zeroext %25, i8 zeroext %27, i32 %35, i32 %43, i32 %52, i32 %60)
br label %73
62: ; preds = %17
%63 = getelementptr inbounds i8, i8* %1, i64 13
%64 = load i8, i8* %63
%65 = zext i8 %64 to i32
%66 = getelementptr inbounds i8, i8* %1, i64 14
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = getelementptr inbounds i8, i8* %1, i64 15
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = call i32 (i8*, i32, i8*, i8, i8, i8, i8, ...) @snprintf(i8* %6, i32 100, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %21, i8 zeroext %23, i8 zeroext %25, i8 zeroext %27, i32 %35, i32 %43, i32 %46, i32 %65, i32 %68, i32 %71)
br label %73
73: ; preds = %62, %47
%74 = load i8, i8* %6
%75 = icmp eq i8 %74, 0
br i1 %75, label %118, label %76
76: ; preds = %73, %91
%77 = phi i64 [ %94, %91 ], [ 0, %73 ]
%78 = phi i8 [ %96, %91 ], [ %74, %73 ]
%79 = phi i8* [ %95, %91 ], [ %6, %73 ]
%80 = phi i32 [ %93, %91 ], [ 0, %73 ]
%81 = phi i32 [ %92, %91 ], [ 2, %73 ]
%82 = icmp eq i64 %77, 0
%83 = icmp eq i8 %78, 58
%84 = select i1 %82, i1 true, i1 %83
br i1 %84, label %85, label %91
85: ; preds = %76
%86 = call i32 @strspn(i8* %79, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%87 = icmp sgt i32 %86, %81
%88 = select i1 %87, i32 %86, i32 %81
%89 = trunc i64 %77 to i32
%90 = select i1 %87, i32 %89, i32 %80
br label %91
91: ; preds = %85, %76
%92 = phi i32 [ %81, %76 ], [ %88, %85 ]
%93 = phi i32 [ %80, %76 ], [ %90, %85 ]
%94 = add nuw i64 %77, 1
%95 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %94
%96 = load i8, i8* %95
%97 = icmp eq i8 %96, 0
br i1 %97, label %98, label %76
98: ; preds = %91
%99 = icmp sgt i32 %92, 3
br i1 %99, label %100, label %118
100: ; preds = %98
%101 = trunc i64 %94 to i32
%102 = add i32 %101, 1
%103 = add nsw i32 %93, 1
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %104
store i8 58, i8* %105
%106 = sext i32 %93 to i64
%107 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %106
store i8 58, i8* %107
%108 = getelementptr inbounds i8, i8* %107, i64 2
%109 = ptrtoint i8* %108 to i64
%110 = trunc i64 %109 to i32
%111 = zext i32 %92 to i64
%112 = getelementptr inbounds i8, i8* %107, i64 %111
%113 = ptrtoint i8* %112 to i64
%114 = trunc i64 %113 to i32
%115 = add i32 %92, %93
%116 = sub i32 %102, %115
%117 = call i32 @memmove(i32 %110, i32 %114, i32 %116)
br label %118
118: ; preds = %73, %100, %98
%119 = call i32 @strlen(i8* %6)
%120 = icmp slt i32 %119, %3
br i1 %120, label %121, label %125
121: ; preds = %118
%122 = call i32 @strcpy(i8* %2, i8* %6)
br label %127
123: ; preds = %4
%124 = load i32, i32* @EAFNOSUPPORT
store i32 %124, i32* @errno
br label %127
125: ; preds = %118, %7
%126 = load i32, i32* @ENOSPC
store i32 %126, i32* @errno
br label %127
127: ; preds = %7, %125, %123, %121
%128 = phi i8* [ null, %123 ], [ %2, %121 ], [ null, %125 ], [ %2, %7 ]
ret i8* %128
}