#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ answer;
struct TYPE_2__ {
  int /*<<< orphan*/ qdcount;
  int /*<<< orphan*/ ancount;
};
typedef TYPE_1__ HEADER;

/* Variables and functions */
unsigned char C_IN;
unsigned char T_TXT;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ memcpy(char *, unsigned char *, int);
int ntohs(int /*<<< orphan*/);
int res_querydomain(char *, char *, unsigned char, unsigned char,
                    unsigned char *, int);
char *rindex(char *, char);
unsigned char *skipName(unsigned char *);
unsigned char *skipQuestions(unsigned char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned long const);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strncpy(char *, char *, int const);
int GetASNName(const unsigned long asn, char *buffer, const int buffer_length) {
  int length, rrLength, labelLength;
  unsigned char answer[512];
  char value[512 + 1];
  HEADER *h;
  unsigned char *pRR;
  char *lastSlash;
  char asn_as_string[13];
  snprintf(asn_as_string, 12, "AS%ld", asn);
  length = res_querydomain(asn_as_string, "asn.cymru.com", C_IN, T_TXT, answer,
                           sizeof(answer));
  h = (HEADER *)answer;
  if (ntohs(h->ancount) == 0) {
    fprintf(stderr, "Received no valid answer from DNS server...\n");
    return -1;
  } else if (ntohs(h->ancount) != 1) {
    fprintf(stderr, "Received more than 1 answer from DNS server!!!\n");
  }
  pRR = answer + sizeof(HEADER);
  pRR = skipQuestions(pRR, ntohs(h->qdcount));
  pRR = skipName(pRR);
  if (pRR[0] * 256 + pRR[1] != T_TXT)
    fprintf(stderr,
            "Oups... cannot decode the DNS answer part, wrong RR type\n");
  pRR += 2;
  if (pRR[0] * 256 + pRR[1] != C_IN)
    fprintf(stderr,
            "Oups... cannot decode the DNS answer part, wrong RR class\n");
  pRR += 6;
  rrLength = pRR[0] * 256 + pRR[1];
  if (rrLength > 512)
    rrLength = 512;
  pRR += 2;
  labelLength = (unsigned char)*pRR;
  memcpy(value, pRR + 1, labelLength);
  value[labelLength] = 0;
  lastSlash = rindex(value, '|');
  if (lastSlash == NULL) {
    return -1;
  }
  lastSlash++;
  while ((lastSlash != 0) && (*lastSlash == ' '))
    lastSlash++;
  strncpy(buffer, lastSlash, buffer_length);
  buffer[buffer_length - 1] = 0;
  return 0;
}


x86 assembly (clang, -O0):
<GetASNName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
lea    -0x465(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0xc,%esi
lea    0xe43(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x465(%rbp),%rdi
mov    0x2e18(%rip),%rax
mov    (%rax),%cl
mov    0x2df7(%rip),%rax
mov    (%rax),%al
lea    -0x230(%rbp),%r8
lea    0xe1d(%rip),%rsi
mov    $0x200,%r9d
movzbl %cl,%edx
movzbl %al,%ecx
call   1060 <res_querydomain@plt>
mov    %eax,-0x20(%rbp)
lea    -0x230(%rbp),%rax
mov    %rax,-0x448(%rbp)
mov    -0x448(%rbp),%rax
mov    0x4(%rax),%edi
call   1090 <ntohs@plt>
cmp    $0x0,%eax
jne    1244 <GetASNName+0xb4>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
lea    0xde1(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ad <GetASNName+0x31d>
mov    -0x448(%rbp),%rax
mov    0x4(%rax),%edi
call   1090 <ntohs@plt>
cmp    $0x1,%eax
je     1271 <GetASNName+0xe1>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
lea    0xdd5(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1276 <GetASNName+0xe6>
lea    -0x230(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x450(%rbp)
mov    -0x450(%rbp),%rax
mov    %rax,-0x470(%rbp)
mov    -0x448(%rbp),%rax
mov    (%rax),%edi
call   1090 <ntohs@plt>
mov    -0x470(%rbp),%rdi
mov    %eax,%esi
call   10b0 <skipQuestions@plt>
mov    %rax,-0x450(%rbp)
mov    -0x450(%rbp),%rdi
call   1040 <skipName@plt>
mov    %rax,-0x450(%rbp)
mov    -0x450(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x450(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    0x2ce3(%rip),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
je     130d <GetASNName+0x17d>
mov    0x2cd9(%rip),%rax
mov    (%rax),%edi
lea    0xd69(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x450(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x450(%rbp)
mov    -0x450(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x450(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    0x2ca8(%rip),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
je     1360 <GetASNName+0x1d0>
mov    0x2c86(%rip),%rax
mov    (%rax),%edi
lea    0xd50(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x450(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x450(%rbp)
mov    -0x450(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x450(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x200,-0x24(%rbp)
jle    13a3 <GetASNName+0x213>
movl   $0x200,-0x24(%rbp)
mov    -0x450(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x450(%rbp)
mov    -0x450(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x28(%rbp)
lea    -0x440(%rbp),%rdi
mov    -0x450(%rbp),%rsi
add    $0x1,%rsi
mov    -0x28(%rbp),%edx
call   1080 <memcpy@plt>
movslq -0x28(%rbp),%rax
movb   $0x0,-0x440(%rbp,%rax,1)
lea    -0x440(%rbp),%rdi
mov    $0x7c,%esi
call   10a0 <rindex@plt>
mov    %rax,-0x458(%rbp)
cmpq   $0x0,-0x458(%rbp)
jne    141a <GetASNName+0x28a>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ad <GetASNName+0x31d>
mov    -0x458(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x458(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x458(%rbp)
mov    %al,-0x471(%rbp)
je     1458 <GetASNName+0x2c8>
mov    -0x458(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x471(%rbp)
mov    -0x471(%rbp),%al
test   $0x1,%al
jne    146b <GetASNName+0x2db>
jmp    1482 <GetASNName+0x2f2>
mov    -0x458(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x458(%rbp)
jmp    142c <GetASNName+0x29c>
mov    -0x18(%rbp),%rdi
mov    -0x458(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetASNName>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x420,%rsp
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rcx
lea    0xe51(%rip),%rdx
lea    0x3(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1050 <snprintf@plt>
mov    0x2e20(%rip),%r12
movzbl (%r12),%edx
mov    0x2dfc(%rip),%rbp
movzbl 0x0(%rbp),%ecx
lea    0xe27(%rip),%rsi
lea    0x10(%rsp),%r8
mov    %rbx,%rdi
mov    $0x200,%r9d
call   1060 <res_querydomain@plt>
mov    0x14(%rsp),%edi
call   1090 <ntohs@plt>
test   %eax,%eax
je     12f5 <GetASNName+0x165>
mov    0x14(%rsp),%edi
call   1090 <ntohs@plt>
cmp    $0x1,%eax
je     1226 <GetASNName+0x96>
mov    0x2dc0(%rip),%rax
mov    (%rax),%edi
lea    0xe20(%rip),%rsi
call   1070 <fprintf@plt>
lea    0x18(%rsp),%rbx
mov    0x10(%rsp),%edi
call   1090 <ntohs@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   10b0 <skipQuestions@plt>
mov    %rax,%rdi
call   1040 <skipName@plt>
mov    %rax,%rbx
movzwl (%rax),%eax
shl    $0x10,%eax
bswap  %eax
movzbl 0x0(%rbp),%ecx
cmp    %ecx,%eax
je     126e <GetASNName+0xde>
mov    0x2d78(%rip),%rax
mov    (%rax),%edi
lea    0xe08(%rip),%rsi
call   1070 <fprintf@plt>
movzwl 0x2(%rbx),%eax
shl    $0x10,%eax
bswap  %eax
movzbl (%r12),%ecx
cmp    %ecx,%eax
je     1295 <GetASNName+0x105>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
lea    0xe1b(%rip),%rsi
call   1070 <fprintf@plt>
movzbl 0xa(%rbx),%ebp
add    $0xb,%rbx
lea    0x210(%rsp),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1080 <memcpy@plt>
movb   $0x0,0x210(%rsp,%rbp,1)
mov    %r12,%rdi
mov    $0x7c,%esi
call   10a0 <rindex@plt>
test   %rax,%rax
je     130a <GetASNName+0x17a>
nopl   0x0(%rax)
cmpb   $0x20,0x1(%rax)
lea    0x1(%rax),%rax
je     12d0 <GetASNName+0x140>
mov    %r14,%rdi
mov    %rax,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movslq %r15d,%rax
movb   $0x0,-0x1(%rax,%r14,1)
xor    %eax,%eax
jmp    130f <GetASNName+0x17f>
mov    0x2cdc(%rip),%rax
mov    (%rax),%edi
lea    0xd0f(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x420,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32, i32 }
@.str = [6 x i8] c"AS%ld\00"
@.str.1 = [14 x i8] c"asn.cymru.com\00"
@C_IN = global i8 0
@T_TXT = global i8 0
@stderr = global i32 0
@.str.2 = [45 x i8] c"Received no valid answer from DNS server...\0A\00"
@.str.3 = [48 x i8] c"Received more than 1 answer from DNS server!!!\0A\00"
@.str.4 = [58 x i8] c"Oups... cannot decode the DNS answer part, wrong RR type\0A\00"
@.str.5 = [59 x i8] c"Oups... cannot decode the DNS answer part, wrong RR class\0A\00"
define i32 @GetASNName(i64 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [512 x i8]
%12 = alloca [513 x i8]
%13 = alloca %struct.TYPE_2__*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca [13 x i8]
store i64 %0, i64* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%17 = getelementptr inbounds [13 x i8], [13 x i8]* %16, i64 0, i64 0
%18 = load i64, i64* %5
%19 = call i32 @snprintf(i8* %17, i32 12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %18)
%20 = getelementptr inbounds [13 x i8], [13 x i8]* %16, i64 0, i64 0
%21 = load i8, i8* @C_IN
%22 = load i8, i8* @T_TXT
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%24 = call i32 @res_querydomain(i8* %20, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %21, i8 zeroext %22, i8* %23, i32 512)
store i32 %24, i32* %8
%25 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%26 = bitcast i8* %25 to %struct.TYPE_2__*
store %struct.TYPE_2__* %26, %struct.TYPE_2__** %13
%27 = load %struct.TYPE_2__*, %struct.TYPE_2__** %13
%28 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %27, i32 0, i32 1
%29 = load i32, i32* %28
%30 = call i32 @ntohs(i32 %29)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %3
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %4
br label %152
35: ; preds = %3
%36 = load %struct.TYPE_2__*, %struct.TYPE_2__** %13
%37 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %36, i32 0, i32 1
%38 = load i32, i32* %37
%39 = call i32 @ntohs(i32 %38)
%40 = icmp ne i32 %39, 1
br i1 %40, label %41, label %44
41: ; preds = %35
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
br label %44
44: ; preds = %41, %35
br label %45
45: ; preds = %44
%46 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%47 = getelementptr inbounds i8, i8* %46, i64 8
store i8* %47, i8** %14
%48 = load i8*, i8** %14
%49 = load %struct.TYPE_2__*, %struct.TYPE_2__** %13
%50 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %49, i32 0, i32 0
%51 = load i32, i32* %50
%52 = call i32 @ntohs(i32 %51)
%53 = call i8* @skipQuestions(i8* %48, i32 %52)
store i8* %53, i8** %14
%54 = load i8*, i8** %14
%55 = call i8* @skipName(i8* %54)
store i8* %55, i8** %14
%56 = load i8*, i8** %14
%57 = getelementptr inbounds i8, i8* %56, i64 0
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = mul nsw i32 %59, 256
%61 = load i8*, i8** %14
%62 = getelementptr inbounds i8, i8* %61, i64 1
%63 = load i8, i8* %62
%64 = zext i8 %63 to i32
%65 = add nsw i32 %60, %64
%66 = load i8, i8* @T_TXT
%67 = zext i8 %66 to i32
%68 = icmp ne i32 %65, %67
br i1 %68, label %69, label %72
69: ; preds = %45
%70 = load i32, i32* @stderr
%71 = call i32 @fprintf(i32 %70, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
br label %72
72: ; preds = %69, %45
%73 = load i8*, i8** %14
%74 = getelementptr inbounds i8, i8* %73, i64 2
store i8* %74, i8** %14
%75 = load i8*, i8** %14
%76 = getelementptr inbounds i8, i8* %75, i64 0
%77 = load i8, i8* %76
%78 = zext i8 %77 to i32
%79 = mul nsw i32 %78, 256
%80 = load i8*, i8** %14
%81 = getelementptr inbounds i8, i8* %80, i64 1
%82 = load i8, i8* %81
%83 = zext i8 %82 to i32
%84 = add nsw i32 %79, %83
%85 = load i8, i8* @C_IN
%86 = zext i8 %85 to i32
%87 = icmp ne i32 %84, %86
br i1 %87, label %88, label %91
88: ; preds = %72
%89 = load i32, i32* @stderr
%90 = call i32 @fprintf(i32 %89, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0))
br label %91
91: ; preds = %88, %72
%92 = load i8*, i8** %14
%93 = getelementptr inbounds i8, i8* %92, i64 6
store i8* %93, i8** %14
%94 = load i8*, i8** %14
%95 = getelementptr inbounds i8, i8* %94, i64 0
%96 = load i8, i8* %95
%97 = zext i8 %96 to i32
%98 = mul nsw i32 %97, 256
%99 = load i8*, i8** %14
%100 = getelementptr inbounds i8, i8* %99, i64 1
%101 = load i8, i8* %100
%102 = zext i8 %101 to i32
%103 = add nsw i32 %98, %102
store i32 %103, i32* %9
%104 = load i32, i32* %9
%105 = icmp sgt i32 %104, 512
br i1 %105, label %106, label %107
106: ; preds = %91
store i32 512, i32* %9
br label %107
107: ; preds = %106, %91
%108 = load i8*, i8** %14
%109 = getelementptr inbounds i8, i8* %108, i64 2
store i8* %109, i8** %14
%110 = load i8*, i8** %14
%111 = load i8, i8* %110
%112 = zext i8 %111 to i32
store i32 %112, i32* %10
%113 = getelementptr inbounds [513 x i8], [513 x i8]* %12, i64 0, i64 0
%114 = load i8*, i8** %14
%115 = getelementptr inbounds i8, i8* %114, i64 1
%116 = load i32, i32* %10
%117 = call i32 @memcpy(i8* %113, i8* %115, i32 %116)
%118 = load i32, i32* %10
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [513 x i8], [513 x i8]* %12, i64 0, i64 %119
store i8 0, i8* %120
%121 = getelementptr inbounds [513 x i8], [513 x i8]* %12, i64 0, i64 0
%122 = call i8* @rindex(i8* %121, i8 signext 124)
store i8* %122, i8** %15
%123 = load i8*, i8** %15
%124 = icmp eq i8* %123, null
br i1 %124, label %125, label %126
125: ; preds = %107
store i32 -1, i32* %4
br label %152
126: ; preds = %107
%127 = load i8*, i8** %15
%128 = getelementptr inbounds i8, i8* %127, i32 1
store i8* %128, i8** %15
br label %129
129: ; preds = %139, %126
%130 = load i8*, i8** %15
%131 = icmp ne i8* %130, null
br i1 %131, label %132, label %137
132: ; preds = %129
%133 = load i8*, i8** %15
%134 = load i8, i8* %133
%135 = sext i8 %134 to i32
%136 = icmp eq i32 %135, 32
br label %137
137: ; preds = %132, %129
%138 = phi i1 [ false, %129 ], [ %136, %132 ]
br i1 %138, label %139, label %142
139: ; preds = %137
%140 = load i8*, i8** %15
%141 = getelementptr inbounds i8, i8* %140, i32 1
store i8* %141, i8** %15
br label %129
142: ; preds = %137
%143 = load i8*, i8** %6
%144 = load i8*, i8** %15
%145 = load i32, i32* %7
%146 = call i32 @strncpy(i8* %143, i8* %144, i32 %145)
%147 = load i8*, i8** %6
%148 = load i32, i32* %7
%149 = sub nsw i32 %148, 1
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i8, i8* %147, i64 %150
store i8 0, i8* %151
store i32 0, i32* %4
br label %152
152: ; preds = %142, %125, %32
%153 = load i32, i32* %4
ret i32 %153
}

LLVM IR (-O2):
@.str = [6 x i8] c"AS%ld\00"
@.str.1 = [14 x i8] c"asn.cymru.com\00"
@C_IN = global i8 0
@T_TXT = global i8 0
@stderr = global i32 0
@.str.2 = [45 x i8] c"Received no valid answer from DNS server...\0A\00"
@.str.3 = [48 x i8] c"Received more than 1 answer from DNS server!!!\0A\00"
@.str.4 = [58 x i8] c"Oups... cannot decode the DNS answer part, wrong RR type\0A\00"
@.str.5 = [59 x i8] c"Oups... cannot decode the DNS answer part, wrong RR class\0A\00"
define i32 @GetASNName(i64 %0, i8* %1, i32 %2) {
%4 = alloca [512 x i8]
%5 = alloca [513 x i8]
%6 = alloca [13 x i8]
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [513 x i8], [513 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%10 = call i32 @snprintf(i8* %9, i32 12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %0)
%11 = load i8, i8* @C_IN
%12 = load i8, i8* @T_TXT
%13 = call i32 @res_querydomain(i8* %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %11, i8 zeroext %12, i8* %7, i32 512)
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 4
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = call i32 @ntohs(i32 %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %3
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
br label %84
22: ; preds = %3
%23 = load i32, i32* %15
%24 = call i32 @ntohs(i32 %23)
%25 = icmp eq i32 %24, 1
br i1 %25, label %29, label %26
26: ; preds = %22
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %22, %26
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 8
%31 = bitcast [512 x i8]* %4 to i32*
%32 = load i32, i32* %31
%33 = call i32 @ntohs(i32 %32)
%34 = call i8* @skipQuestions(i8* %30, i32 %33)
%35 = call i8* @skipName(i8* %34)
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = shl nuw nsw i32 %37, 8
%39 = getelementptr inbounds i8, i8* %35, i64 1
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = or i32 %38, %41
%43 = load i8, i8* @T_TXT
%44 = zext i8 %43 to i32
%45 = icmp eq i32 %42, %44
br i1 %45, label %49, label %46
46: ; preds = %29
%47 = load i32, i32* @stderr
%48 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
br label %49
49: ; preds = %46, %29
%50 = getelementptr inbounds i8, i8* %35, i64 2
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = shl nuw nsw i32 %52, 8
%54 = getelementptr inbounds i8, i8* %35, i64 3
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = or i32 %53, %56
%58 = load i8, i8* @C_IN
%59 = zext i8 %58 to i32
%60 = icmp eq i32 %57, %59
br i1 %60, label %64, label %61
61: ; preds = %49
%62 = load i32, i32* @stderr
%63 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0))
br label %64
64: ; preds = %61, %49
%65 = getelementptr inbounds i8, i8* %35, i64 10
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = getelementptr inbounds i8, i8* %35, i64 11
%69 = call i32 @memcpy(i8* %8, i8* %68, i32 %67)
%70 = zext i8 %66 to i64
%71 = getelementptr inbounds [513 x i8], [513 x i8]* %5, i64 0, i64 %70
store i8 0, i8* %71
%72 = call i8* @rindex(i8* %8, i8 signext 124)
%73 = icmp eq i8* %72, null
br i1 %73, label %84, label %74
74: ; preds = %64, %74
%75 = phi i8* [ %76, %74 ], [ %72, %64 ]
%76 = getelementptr inbounds i8, i8* %75, i64 1
%77 = load i8, i8* %76
%78 = icmp eq i8 %77, 32
br i1 %78, label %74, label %79
79: ; preds = %74
%80 = call i32 @strncpy(i8* %1, i8* %76, i32 %2)
%81 = add nsw i32 %2, -1
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %1, i64 %82
store i8 0, i8* %83
br label %84
84: ; preds = %64, %79, %19
%85 = phi i32 [ -1, %19 ], [ 0, %79 ], [ -1, %64 ]
ret i32 %85
}