#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 in_addr {
  int /*<<< orphan*/ s_addr;
};

/* Variables and functions */
int asprintf(char **, char *, unsigned int, ...);
int ntohl(int /*<<< orphan*/);
char *calc_reverse_dns4(struct in_addr ip, unsigned prefix,
                        struct in_addr network, struct in_addr broadcast) {
  char *str = NULL;
  int ret = -1;
  unsigned byte1 = (ntohl(ip.s_addr) >> 24) & 0xff;
  unsigned byte2 = (ntohl(ip.s_addr) >> 16) & 0xff;
  unsigned byte3 = (ntohl(ip.s_addr) >> 8) & 0xff;
  unsigned byte4 = (ntohl(ip.s_addr)) & 0xff;
  if (prefix == 32) {
    ret =
        asprintf(&str, "%u.%u.%u.%u.in-addr.arpa.", byte4, byte3, byte2, byte1);
  } else if (prefix == 24) {
    ret = asprintf(&str, "%u.%u.%u.in-addr.arpa.", byte3, byte2, byte1);
  } else if (prefix == 16) {
    ret = asprintf(&str, "%u.%u.in-addr.arpa.", byte2, byte1);
  } else if (prefix == 8) {
    ret = asprintf(&str, "%u.in-addr.arpa.", byte1);
  } else if (prefix > 24) {
    unsigned min = (ntohl(network.s_addr)) & 0xff;
    unsigned max = (ntohl(broadcast.s_addr)) & 0xff;
    ret = asprintf(&str, "%u-%u.%u.%u.%u.in-addr.arpa.", min, max, byte3, byte2,
                   byte1);
  } else if (prefix > 16) {
    unsigned min = (ntohl(network.s_addr) >> 8) & 0xff;
    unsigned max = (ntohl(broadcast.s_addr) >> 8) & 0xff;
    ret = asprintf(&str, "%u-%u.%u.%u.in-addr.arpa.", min, max, byte2, byte1);
  } else if (prefix > 8) {
    unsigned min = (ntohl(network.s_addr) >> 16) & 0xff;
    unsigned max = (ntohl(broadcast.s_addr) >> 16) & 0xff;
    ret = asprintf(&str, "%u-%u.%u.in-addr.arpa.", min, max, byte1);
  }
  if (ret == -1)
    return NULL;
  return str;
}


x86 assembly (clang, -O0):
<calc_reverse_dns4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x10(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0xffffffff,-0x34(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <ntohl@plt>
sar    $0x18,%eax
and    $0xff,%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <ntohl@plt>
sar    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <ntohl@plt>
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <ntohl@plt>
and    $0xff,%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x20,-0x24(%rbp)
jne    11be <calc_reverse_dns4+0x9e>
mov    -0x44(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x3c(%rbp),%r8d
mov    -0x38(%rbp),%r9d
lea    -0x30(%rbp),%rdi
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1030 <asprintf@plt>
mov    %eax,-0x34(%rbp)
jmp    135a <calc_reverse_dns4+0x23a>
cmpl   $0x18,-0x24(%rbp)
jne    11ec <calc_reverse_dns4+0xcc>
mov    -0x40(%rbp),%edx
mov    -0x3c(%rbp),%ecx
mov    -0x38(%rbp),%r8d
lea    -0x30(%rbp),%rdi
lea    0xe43(%rip),%rsi
mov    $0x0,%al
call   1030 <asprintf@plt>
mov    %eax,-0x34(%rbp)
jmp    1355 <calc_reverse_dns4+0x235>
cmpl   $0x10,-0x24(%rbp)
jne    1216 <calc_reverse_dns4+0xf6>
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%ecx
lea    -0x30(%rbp),%rdi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1030 <asprintf@plt>
mov    %eax,-0x34(%rbp)
jmp    1350 <calc_reverse_dns4+0x230>
cmpl   $0x8,-0x24(%rbp)
jne    123d <calc_reverse_dns4+0x11d>
mov    -0x38(%rbp),%edx
lea    -0x30(%rbp),%rdi
lea    0xe0f(%rip),%rsi
mov    $0x0,%al
call   1030 <asprintf@plt>
mov    %eax,-0x34(%rbp)
jmp    134b <calc_reverse_dns4+0x22b>
cmpl   $0x18,-0x24(%rbp)
jbe    1295 <calc_reverse_dns4+0x175>
mov    -0x18(%rbp),%edi
call   1040 <ntohl@plt>
and    $0xff,%eax
mov    %eax,-0x48(%rbp)
mov    -0x20(%rbp),%edi
call   1040 <ntohl@plt>
and    $0xff,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
mov    -0x40(%rbp),%r8d
mov    -0x3c(%rbp),%r9d
mov    -0x38(%rbp),%eax
lea    -0x30(%rbp),%rdi
lea    0xd7d(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <asprintf@plt>
mov    %eax,-0x34(%rbp)
jmp    1346 <calc_reverse_dns4+0x226>
cmpl   $0x10,-0x24(%rbp)
jbe    12ed <calc_reverse_dns4+0x1cd>
mov    -0x18(%rbp),%edi
call   1040 <ntohl@plt>
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%edi
call   1040 <ntohl@plt>
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x54(%rbp)
mov    -0x50(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    -0x3c(%rbp),%r8d
mov    -0x38(%rbp),%r9d
lea    -0x30(%rbp),%rdi
lea    0xd3f(%rip),%rsi
mov    $0x0,%al
call   1030 <asprintf@plt>
mov    %eax,-0x34(%rbp)
jmp    1341 <calc_reverse_dns4+0x221>
cmpl   $0x8,-0x24(%rbp)
jbe    133c <calc_reverse_dns4+0x21c>
mov    -0x18(%rbp),%edi
call   1040 <ntohl@plt>
sar    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x58(%rbp)
mov    -0x20(%rbp),%edi
call   1040 <ntohl@plt>
sar    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%edx
mov    -0x5c(%rbp),%ecx
mov    -0x38(%rbp),%r8d
lea    -0x30(%rbp),%rdi
lea    0xd05(%rip),%rsi
mov    $0x0,%al
call   1030 <asprintf@plt>
mov    %eax,-0x34(%rbp)
jmp    1341 <calc_reverse_dns4+0x221>
jmp    1346 <calc_reverse_dns4+0x226>
jmp    134b <calc_reverse_dns4+0x22b>
jmp    1350 <calc_reverse_dns4+0x230>
jmp    1355 <calc_reverse_dns4+0x235>
jmp    135a <calc_reverse_dns4+0x23a>
cmpl   $0xffffffff,-0x34(%rbp)
jne    1371 <calc_reverse_dns4+0x251>
movq   $0x0,-0x8(%rbp)
jmp    1379 <calc_reverse_dns4+0x259>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_reverse_dns4>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
movq   $0x0,0x8(%rsp)
call   1040 <ntohl@plt>
mov    %eax,%ebx
shr    $0x18,%ebx
mov    %eax,%ecx
shr    $0x10,%ecx
movzbl %cl,%r14d
movzbl %ah,%esi
lea    -0x8(%rbp),%ecx
rol    $0x1d,%ecx
cmp    $0x3,%ecx
ja     11f9 <calc_reverse_dns4+0xd9>
lea    0xe97(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xed4(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    123a <calc_reverse_dns4+0x11a>
jmp    12a3 <calc_reverse_dns4+0x183>
lea    0xeae(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %r14d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    123a <calc_reverse_dns4+0x11a>
jmp    12a3 <calc_reverse_dns4+0x183>
mov    %esi,%edx
lea    0xe6c(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %ebx,%r8d
mov    %r14d,%ecx
xor    %eax,%eax
call   1030 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    123a <calc_reverse_dns4+0x11a>
jmp    12a3 <calc_reverse_dns4+0x183>
movzbl %al,%edx
mov    %esi,%ecx
lea    0xe27(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %ebx,%r9d
mov    %r14d,%r8d
jmp    122e <calc_reverse_dns4+0x10e>
cmp    $0x19,%ebp
jb     1241 <calc_reverse_dns4+0x121>
mov    %r12d,%edi
mov    %esi,%r12d
call   1040 <ntohl@plt>
movzbl %al,%ebp
mov    %r15d,%edi
call   1040 <ntohl@plt>
movzbl %al,%ecx
mov    %ebx,(%rsp)
lea    0xdef(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %ebp,%edx
mov    %r12d,%r8d
mov    %r14d,%r9d
xor    %eax,%eax
call   1030 <asprintf@plt>
cmp    $0xffffffff,%eax
je     12a3 <calc_reverse_dns4+0x183>
mov    0x8(%rsp),%rax
jmp    12a5 <calc_reverse_dns4+0x185>
cmp    $0x11,%ebp
jb     126c <calc_reverse_dns4+0x14c>
mov    %r12d,%edi
call   1040 <ntohl@plt>
movzbl %ah,%ebp
mov    %r15d,%edi
call   1040 <ntohl@plt>
movzbl %ah,%ecx
lea    0xdca(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %ebp,%edx
jmp    11f1 <calc_reverse_dns4+0xd1>
cmp    $0x9,%ebp
jb     12a3 <calc_reverse_dns4+0x183>
mov    %r12d,%edi
call   1040 <ntohl@plt>
shr    $0x10,%eax
movzbl %al,%ebp
mov    %r15d,%edi
call   1040 <ntohl@plt>
shr    $0x10,%eax
movzbl %al,%ecx
lea    0xdb3(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %ebp,%edx
mov    %ebx,%r8d
jmp    11cf <calc_reverse_dns4+0xaf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [26 x i8] c"%u.%u.%u.%u.in-addr.arpa.\00"
@.str.1 = [23 x i8] c"%u.%u.%u.in-addr.arpa.\00"
@.str.2 = [20 x i8] c"%u.%u.in-addr.arpa.\00"
@.str.3 = [17 x i8] c"%u.in-addr.arpa.\00"
@.str.4 = [29 x i8] c"%u-%u.%u.%u.%u.in-addr.arpa.\00"
@.str.5 = [26 x i8] c"%u-%u.%u.%u.in-addr.arpa.\00"
@.str.6 = [23 x i8] c"%u-%u.%u.in-addr.arpa.\00"
define i8* @calc_reverse_dns4(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca %struct.in_addr
%7 = alloca %struct.in_addr
%8 = alloca %struct.in_addr
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
store i32 %0, i32* %22
%23 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %7, i32 0, i32 0
store i32 %2, i32* %23
%24 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %8, i32 0, i32 0
store i32 %3, i32* %24
store i32 %1, i32* %9
store i8* null, i8** %10
store i32 -1, i32* %11
%25 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i32 @ntohl(i32 %26)
%28 = ashr i32 %27, 24
%29 = and i32 %28, 255
store i32 %29, i32* %12
%30 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
%31 = load i32, i32* %30
%32 = call i32 @ntohl(i32 %31)
%33 = ashr i32 %32, 16
%34 = and i32 %33, 255
store i32 %34, i32* %13
%35 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
%36 = load i32, i32* %35
%37 = call i32 @ntohl(i32 %36)
%38 = ashr i32 %37, 8
%39 = and i32 %38, 255
store i32 %39, i32* %14
%40 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
%41 = load i32, i32* %40
%42 = call i32 @ntohl(i32 %41)
%43 = and i32 %42, 255
store i32 %43, i32* %15
%44 = load i32, i32* %9
%45 = icmp eq i32 %44, 32
br i1 %45, label %46, label %52
46: ; preds = %4
%47 = load i32, i32* %15
%48 = load i32, i32* %14
%49 = load i32, i32* %13
%50 = load i32, i32* %12
%51 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %10, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %47, i32 %48, i32 %49, i32 %50)
store i32 %51, i32* %11
br label %134
52: ; preds = %4
%53 = load i32, i32* %9
%54 = icmp eq i32 %53, 24
br i1 %54, label %55, label %60
55: ; preds = %52
%56 = load i32, i32* %14
%57 = load i32, i32* %13
%58 = load i32, i32* %12
%59 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %56, i32 %57, i32 %58)
store i32 %59, i32* %11
br label %133
60: ; preds = %52
%61 = load i32, i32* %9
%62 = icmp eq i32 %61, 16
br i1 %62, label %63, label %67
63: ; preds = %60
%64 = load i32, i32* %13
%65 = load i32, i32* %12
%66 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %64, i32 %65)
store i32 %66, i32* %11
br label %132
67: ; preds = %60
%68 = load i32, i32* %9
%69 = icmp eq i32 %68, 8
br i1 %69, label %70, label %73
70: ; preds = %67
%71 = load i32, i32* %12
%72 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %71)
store i32 %72, i32* %11
br label %131
73: ; preds = %67
%74 = load i32, i32* %9
%75 = icmp ugt i32 %74, 24
br i1 %75, label %76, label %91
76: ; preds = %73
%77 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %7, i32 0, i32 0
%78 = load i32, i32* %77
%79 = call i32 @ntohl(i32 %78)
%80 = and i32 %79, 255
store i32 %80, i32* %16
%81 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %8, i32 0, i32 0
%82 = load i32, i32* %81
%83 = call i32 @ntohl(i32 %82)
%84 = and i32 %83, 255
store i32 %84, i32* %17
%85 = load i32, i32* %16
%86 = load i32, i32* %17
%87 = load i32, i32* %14
%88 = load i32, i32* %13
%89 = load i32, i32* %12
%90 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %10, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %85, i32 %86, i32 %87, i32 %88, i32 %89)
store i32 %90, i32* %11
br label %130
91: ; preds = %73
%92 = load i32, i32* %9
%93 = icmp ugt i32 %92, 16
br i1 %93, label %94, label %110
94: ; preds = %91
%95 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %7, i32 0, i32 0
%96 = load i32, i32* %95
%97 = call i32 @ntohl(i32 %96)
%98 = ashr i32 %97, 8
%99 = and i32 %98, 255
store i32 %99, i32* %18
%100 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %8, i32 0, i32 0
%101 = load i32, i32* %100
%102 = call i32 @ntohl(i32 %101)
%103 = ashr i32 %102, 8
%104 = and i32 %103, 255
store i32 %104, i32* %19
%105 = load i32, i32* %18
%106 = load i32, i32* %19
%107 = load i32, i32* %13
%108 = load i32, i32* %12
%109 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %10, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %105, i32 %106, i32 %107, i32 %108)
store i32 %109, i32* %11
br label %129
110: ; preds = %91
%111 = load i32, i32* %9
%112 = icmp ugt i32 %111, 8
br i1 %112, label %113, label %128
113: ; preds = %110
%114 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %7, i32 0, i32 0
%115 = load i32, i32* %114
%116 = call i32 @ntohl(i32 %115)
%117 = ashr i32 %116, 16
%118 = and i32 %117, 255
store i32 %118, i32* %20
%119 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %8, i32 0, i32 0
%120 = load i32, i32* %119
%121 = call i32 @ntohl(i32 %120)
%122 = ashr i32 %121, 16
%123 = and i32 %122, 255
store i32 %123, i32* %21
%124 = load i32, i32* %20
%125 = load i32, i32* %21
%126 = load i32, i32* %12
%127 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %124, i32 %125, i32 %126)
store i32 %127, i32* %11
br label %128
128: ; preds = %113, %110
br label %129
129: ; preds = %128, %94
br label %130
130: ; preds = %129, %76
br label %131
131: ; preds = %130, %70
br label %132
132: ; preds = %131, %63
br label %133
133: ; preds = %132, %55
br label %134
134: ; preds = %133, %46
%135 = load i32, i32* %11
%136 = icmp eq i32 %135, -1
br i1 %136, label %137, label %138
137: ; preds = %134
store i8* null, i8** %5
br label %140
138: ; preds = %134
%139 = load i8*, i8** %10
store i8* %139, i8** %5
br label %140
140: ; preds = %138, %137
%141 = load i8*, i8** %5
ret i8* %141
}

LLVM IR (-O2):
@.str = [26 x i8] c"%u.%u.%u.%u.in-addr.arpa.\00"
@.str.1 = [23 x i8] c"%u.%u.%u.in-addr.arpa.\00"
@.str.2 = [20 x i8] c"%u.%u.in-addr.arpa.\00"
@.str.3 = [17 x i8] c"%u.in-addr.arpa.\00"
@.str.4 = [29 x i8] c"%u-%u.%u.%u.%u.in-addr.arpa.\00"
@.str.5 = [26 x i8] c"%u-%u.%u.%u.in-addr.arpa.\00"
@.str.6 = [23 x i8] c"%u-%u.%u.in-addr.arpa.\00"
define i8* @calc_reverse_dns4(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%7 = tail call i32 @ntohl(i32 %0)
%8 = lshr i32 %7, 24
%9 = lshr i32 %7, 16
%10 = and i32 %9, 255
%11 = lshr i32 %7, 8
%12 = and i32 %11, 255
%13 = add i32 %1, -8
%14 = tail call i32 @llvm.fshl.i32(i32 %13, i32 %13, i32 29)
switch i32 %14, label %24 [
i32 3, label %15
i32 2, label %18
i32 1, label %20
i32 0, label %22
]
15: ; preds = %4
%16 = and i32 %7, 255
%17 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %5, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %12, i32 %10, i32 %8)
br label %52
18: ; preds = %4
%19 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %10, i32 %8)
br label %52
20: ; preds = %4
%21 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %8)
br label %52
22: ; preds = %4
%23 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %8)
br label %52
24: ; preds = %4
%25 = icmp ugt i32 %1, 24
br i1 %25, label %26, label %32
26: ; preds = %24
%27 = tail call i32 @ntohl(i32 %2)
%28 = and i32 %27, 255
%29 = tail call i32 @ntohl(i32 %3)
%30 = and i32 %29, 255
%31 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %5, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %28, i32 %30, i32 %12, i32 %10, i32 %8)
br label %52
32: ; preds = %24
%33 = icmp ugt i32 %1, 16
br i1 %33, label %34, label %42
34: ; preds = %32
%35 = tail call i32 @ntohl(i32 %2)
%36 = lshr i32 %35, 8
%37 = and i32 %36, 255
%38 = tail call i32 @ntohl(i32 %3)
%39 = lshr i32 %38, 8
%40 = and i32 %39, 255
%41 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %5, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %37, i32 %40, i32 %10, i32 %8)
br label %52
42: ; preds = %32
%43 = icmp ugt i32 %1, 8
br i1 %43, label %44, label %56
44: ; preds = %42
%45 = tail call i32 @ntohl(i32 %2)
%46 = lshr i32 %45, 16
%47 = and i32 %46, 255
%48 = tail call i32 @ntohl(i32 %3)
%49 = lshr i32 %48, 16
%50 = and i32 %49, 255
%51 = call i32 (i8**, i8*, i32, ...) @asprintf(i8** %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %47, i32 %50, i32 %8)
br label %52
52: ; preds = %18, %22, %34, %44, %26, %20, %15
%53 = phi i32 [ %17, %15 ], [ %19, %18 ], [ %21, %20 ], [ %23, %22 ], [ %31, %26 ], [ %41, %34 ], [ %51, %44 ]
%54 = icmp eq i32 %53, -1
%55 = load i8*, i8** %5
br i1 %54, label %56, label %57
56: ; preds = %42, %52
br label %57
57: ; preds = %52, %56
%58 = phi i8* [ null, %56 ], [ %55, %52 ]
ret i8* %58
}