#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_7__ TYPE_2__;
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
typedef scalar_t__ ns_sect;
struct TYPE_6__ {
  int type;
  int rr_class;
  int rdlength;
  int /*<<< orphan*/ *rdata;
  scalar_t__ ttl;
  int /*<<< orphan*/ name;
};
typedef TYPE_1__ ns_rr;
struct TYPE_7__ {
  scalar_t__ _sect;
  int _rrnum;
  int *_counts;
  int _msg_ptr;
  int _eom;
  int /*<<< orphan*/ _msg;
};
typedef TYPE_2__ ns_msg;

/* Variables and functions */
int /*<<< orphan*/ EMSGSIZE;
int /*<<< orphan*/ ENODEV;
int /*<<< orphan*/ NS_GET16(int, int);
int /*<<< orphan*/ NS_GET32(scalar_t__, int);
int NS_INT16SZ;
int NS_INT32SZ;
int /*<<< orphan*/ NS_MAXDNAME;
int dn_expand(int /*<<< orphan*/, int, int, int /*<<< orphan*/,
              int /*<<< orphan*/);
int /*<<< orphan*/ errno;
scalar_t__ ns_s_max;
scalar_t__ ns_s_qd;
int ns_skiprr(int, int, scalar_t__, int);
int /*<<< orphan*/ setsection(TYPE_2__ *, scalar_t__);
int ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
  int b;
  if (section < 0 || section >= ns_s_max)
    do {
      errno = (ENODEV);
      return (-1);
    } while (0);
  if (section != handle->_sect)
    setsection(handle, section);
  if (rrnum == -1)
    rrnum = handle->_rrnum;
  if (rrnum < 0 || rrnum >= handle->_counts[(int)section])
    do {
      errno = (ENODEV);
      return (-1);
    } while (0);
  if (rrnum < handle->_rrnum)
    setsection(handle, section);
  if (rrnum > handle->_rrnum) {
    b = ns_skiprr(handle->_msg_ptr, handle->_eom, section,
                  rrnum - handle->_rrnum);
    if (b < 0)
      return (-1);
    handle->_msg_ptr += b;
    handle->_rrnum = rrnum;
  }
  b = dn_expand(handle->_msg, handle->_eom, handle->_msg_ptr, rr->name,
                NS_MAXDNAME);
  if (b < 0)
    return (-1);
  handle->_msg_ptr += b;
  if (handle->_msg_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
    do {
      errno = (EMSGSIZE);
      return (-1);
    } while (0);
  NS_GET16(rr->type, handle->_msg_ptr);
  NS_GET16(rr->rr_class, handle->_msg_ptr);
  if (section == ns_s_qd) {
    rr->ttl = 0;
    rr->rdlength = 0;
    rr->rdata = NULL;
  } else {
    if (handle->_msg_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
      do {
        errno = (EMSGSIZE);
        return (-1);
      } while (0);
    NS_GET32(rr->ttl, handle->_msg_ptr);
    NS_GET16(rr->rdlength, handle->_msg_ptr);
    if (handle->_msg_ptr + rr->rdlength > handle->_eom)
      do {
        errno = (EMSGSIZE);
        return (-1);
      } while (0);
    rr->rdata = handle->_msg_ptr;
    handle->_msg_ptr += rr->rdlength;
  }
  if (++handle->_rrnum > handle->_counts[(int)section])
    setsection(handle, (ns_sect)((int)section + 1));
  return (0);
}


x86 assembly (clang, -O0):
<ns_parserr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
jl     1186 <ns_parserr+0x36>
mov    -0x18(%rbp),%rax
mov    0x2e23(%rip),%rcx
cmp    (%rcx),%rax
jl     11a9 <ns_parserr+0x59>
jmp    118b <ns_parserr+0x3b>
mov    0x2e26(%rip),%rax
mov    (%rax),%ecx
mov    0x2e25(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    14aa <ns_parserr+0x35a>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
je     11c7 <ns_parserr+0x77>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <setsection@plt>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    11db <ns_parserr+0x8b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     1200 <ns_parserr+0xb0>
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
mov    -0x18(%rbp),%rdx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jl     1223 <ns_parserr+0xd3>
jmp    1205 <ns_parserr+0xb5>
mov    0x2dac(%rip),%rax
mov    (%rax),%ecx
mov    0x2dab(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    14aa <ns_parserr+0x35a>
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%eax
jge    1240 <ns_parserr+0xf0>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <setsection@plt>
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%eax
jle    12a1 <ns_parserr+0x151>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
sub    0x8(%rax),%ecx
call   1060 <ns_skiprr@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    128a <ns_parserr+0x13a>
movl   $0xffffffff,-0x4(%rbp)
jmp    14aa <ns_parserr+0x35a>
mov    -0x2c(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%edx
mov    -0x28(%rbp),%rax
mov    0x20(%rax),%ecx
mov    0x2d1c(%rip),%rax
mov    (%rax),%r8d
call   1070 <dn_expand@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    12e5 <ns_parserr+0x195>
movl   $0xffffffff,-0x4(%rbp)
jmp    14aa <ns_parserr+0x35a>
mov    -0x2c(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%eax
mov    0x2cb0(%rip),%rcx
add    (%rcx),%eax
mov    0x2ca7(%rip),%rcx
add    (%rcx),%eax
mov    -0x10(%rbp),%rcx
cmp    0x1c(%rcx),%eax
jle    133b <ns_parserr+0x1eb>
jmp    131d <ns_parserr+0x1cd>
mov    0x2cb4(%rip),%rax
mov    (%rax),%ecx
mov    0x2c93(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    14aa <ns_parserr+0x35a>
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%esi
call   1050 <NS_GET16@plt>
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%esi
call   1050 <NS_GET16@plt>
mov    -0x18(%rbp),%rax
mov    0x2c65(%rip),%rcx
cmp    (%rcx),%rax
jne    139c <ns_parserr+0x24c>
mov    -0x28(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    -0x28(%rbp),%rax
movq   $0x0,0x10(%rax)
jmp    146b <ns_parserr+0x31b>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%eax
mov    0x2c3e(%rip),%rcx
add    (%rcx),%eax
mov    0x2bfd(%rip),%rcx
add    (%rcx),%eax
mov    -0x10(%rbp),%rcx
cmp    0x1c(%rcx),%eax
jle    13e5 <ns_parserr+0x295>
jmp    13c7 <ns_parserr+0x277>
mov    0x2c0a(%rip),%rax
mov    (%rax),%ecx
mov    0x2be9(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    14aa <ns_parserr+0x35a>
mov    -0x28(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%esi
call   1030 <NS_GET32@plt>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%esi
call   1050 <NS_GET16@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%eax
mov    -0x28(%rbp),%rcx
add    0x8(%rcx),%eax
mov    -0x10(%rbp),%rcx
cmp    0x1c(%rcx),%eax
jle    144a <ns_parserr+0x2fa>
jmp    142c <ns_parserr+0x2dc>
mov    0x2ba5(%rip),%rax
mov    (%rax),%ecx
mov    0x2b84(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    14aa <ns_parserr+0x35a>
mov    -0x10(%rbp),%rax
movslq 0x18(%rax),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x10(%rbp),%rax
add    0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%eax
add    $0x1,%eax
mov    %eax,0x8(%rcx)
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
mov    -0x18(%rbp),%rdx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    14a3 <ns_parserr+0x353>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
add    $0x1,%eax
movslq %eax,%rsi
call   1040 <setsection@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ns_parserr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
js     128a <ns_parserr+0x13a>
mov    %rsi,%rbx
mov    0x2e32(%rip),%rax
cmp    %rsi,(%rax)
jle    128a <ns_parserr+0x13a>
mov    %rcx,%r15
mov    %edx,%ebp
mov    %rdi,%r14
cmp    %rbx,(%rdi)
jne    1192 <ns_parserr+0x42>
cmp    $0xffffffff,%ebp
je     11a2 <ns_parserr+0x52>
test   %ebp,%ebp
jns    11ae <ns_parserr+0x5e>
jmp    128a <ns_parserr+0x13a>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <setsection@plt>
cmp    $0xffffffff,%ebp
jne    1189 <ns_parserr+0x39>
mov    0x8(%r14),%ebp
test   %ebp,%ebp
js     128a <ns_parserr+0x13a>
mov    0x10(%r14),%rax
mov    %rbx,%r12
shl    $0x20,%r12
mov    %r12,%rcx
sar    $0x1e,%rcx
cmp    (%rax,%rcx,1),%ebp
jge    128a <ns_parserr+0x13a>
mov    0x8(%r14),%eax
cmp    %eax,%ebp
jge    11e0 <ns_parserr+0x90>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <setsection@plt>
mov    0x8(%r14),%eax
mov    %ebp,%ecx
mov    0x18(%r14),%edx
sub    %eax,%ecx
jle    120e <ns_parserr+0xbe>
mov    0x1c(%r14),%esi
mov    %edx,%edi
mov    %rbx,%rdx
call   1060 <ns_skiprr@plt>
test   %eax,%eax
js     129c <ns_parserr+0x14c>
mov    %eax,%edx
add    0x18(%r14),%edx
mov    %edx,0x18(%r14)
mov    %ebp,0x8(%r14)
mov    0x1c(%r14),%esi
mov    0x20(%r14),%edi
mov    0x20(%r15),%ecx
mov    0x2dbf(%rip),%rax
mov    (%rax),%r8d
call   1070 <dn_expand@plt>
mov    $0xffffffff,%ebp
test   %eax,%eax
js     12a1 <ns_parserr+0x151>
add    0x18(%r14),%eax
mov    %eax,0x18(%r14)
mov    0x2d6f(%rip),%r13
mov    0x0(%r13),%ecx
lea    (%rax,%rcx,2),%ecx
cmp    0x1c(%r14),%ecx
jg     12f1 <ns_parserr+0x1a1>
mov    (%r15),%edi
mov    %eax,%esi
call   1050 <NS_GET16@plt>
mov    0x4(%r15),%edi
mov    0x18(%r14),%esi
call   1050 <NS_GET16@plt>
mov    0x2d60(%rip),%rax
cmp    %rbx,(%rax)
jne    12b2 <ns_parserr+0x162>
movl   $0x0,0x8(%r15)
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%r15)
jmp    130d <ns_parserr+0x1bd>
mov    0x2d27(%rip),%rax
mov    (%rax),%eax
mov    0x2d26(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x18(%r14),%esi
mov    0x2d2b(%rip),%rax
mov    (%rax),%eax
add    %esi,%eax
add    0x0(%r13),%eax
cmp    0x1c(%r14),%eax
jg     12f1 <ns_parserr+0x1a1>
mov    0x18(%r15),%rdi
call   1030 <NS_GET32@plt>
mov    0x8(%r15),%edi
mov    0x18(%r14),%esi
call   1050 <NS_GET16@plt>
movslq 0x18(%r14),%rax
mov    0x8(%r15),%ecx
add    %eax,%ecx
cmp    0x1c(%r14),%ecx
jle    1305 <ns_parserr+0x1b5>
mov    0x2ce0(%rip),%rax
mov    (%rax),%eax
mov    0x2cbf(%rip),%rcx
mov    %eax,(%rcx)
jmp    12a1 <ns_parserr+0x151>
mov    %rax,0x10(%r15)
mov    %ecx,0x18(%r14)
movslq %ebx,%rax
mov    0x8(%r14),%ecx
lea    0x1(%rcx),%edx
mov    %edx,0x8(%r14)
mov    0x10(%r14),%rdx
xor    %ebp,%ebp
cmp    (%rdx,%rax,4),%ecx
jl     12a1 <ns_parserr+0x151>
movabs $0x100000000,%rax
add    %rax,%r12
sar    $0x20,%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <setsection@plt>
jmp    12a1 <ns_parserr+0x151>

LLVM IR (-O0):
%struct.TYPE_7__ = type { i64, i32, i32*, i32, i32, i32 }
%struct.TYPE_6__ = type { i32, i32, i32, i32*, i64, i32 }
@ns_s_max = global i64 0
@ENODEV = global i32 0
@errno = global i32 0
@NS_MAXDNAME = global i32 0
@NS_INT16SZ = global i32 0
@EMSGSIZE = global i32 0
@ns_s_qd = global i64 0
@NS_INT32SZ = global i32 0
define i32 @ns_parserr(%struct.TYPE_7__* %0, i64 %1, i32 %2, %struct.TYPE_6__* %3) {
%5 = alloca i32
%6 = alloca %struct.TYPE_7__*
%7 = alloca i64
%8 = alloca i32
%9 = alloca %struct.TYPE_6__*
%10 = alloca i32
store %struct.TYPE_7__* %0, %struct.TYPE_7__** %6
store i64 %1, i64* %7
store i32 %2, i32* %8
store %struct.TYPE_6__* %3, %struct.TYPE_6__** %9
%11 = load i64, i64* %7
%12 = icmp slt i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %4
%14 = load i64, i64* %7
%15 = load i64, i64* @ns_s_max
%16 = icmp sge i64 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %13, %4
br label %18
18: ; preds = %17
%19 = load i32, i32* @ENODEV
store i32 %19, i32* @errno
store i32 -1, i32* %5
br label %245
20: ; No predecessors!
br label %21
21: ; preds = %20, %13
%22 = load i64, i64* %7
%23 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%24 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %23, i32 0, i32 0
%25 = load i64, i64* %24
%26 = icmp ne i64 %22, %25
br i1 %26, label %27, label %31
27: ; preds = %21
%28 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%29 = load i64, i64* %7
%30 = call i32 @setsection(%struct.TYPE_7__* %28, i64 %29)
br label %31
31: ; preds = %27, %21
%32 = load i32, i32* %8
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%36 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %35, i32 0, i32 1
%37 = load i32, i32* %36
store i32 %37, i32* %8
br label %38
38: ; preds = %34, %31
%39 = load i32, i32* %8
%40 = icmp slt i32 %39, 0
br i1 %40, label %52, label %41
41: ; preds = %38
%42 = load i32, i32* %8
%43 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%44 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %43, i32 0, i32 2
%45 = load i32*, i32** %44
%46 = load i64, i64* %7
%47 = trunc i64 %46 to i32
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %45, i64 %48
%50 = load i32, i32* %49
%51 = icmp sge i32 %42, %50
br i1 %51, label %52, label %56
52: ; preds = %41, %38
br label %53
53: ; preds = %52
%54 = load i32, i32* @ENODEV
store i32 %54, i32* @errno
store i32 -1, i32* %5
br label %245
55: ; No predecessors!
br label %56
56: ; preds = %55, %41
%57 = load i32, i32* %8
%58 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%59 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %58, i32 0, i32 1
%60 = load i32, i32* %59
%61 = icmp slt i32 %57, %60
br i1 %61, label %62, label %66
62: ; preds = %56
%63 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%64 = load i64, i64* %7
%65 = call i32 @setsection(%struct.TYPE_7__* %63, i64 %64)
br label %66
66: ; preds = %62, %56
%67 = load i32, i32* %8
%68 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%69 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %68, i32 0, i32 1
%70 = load i32, i32* %69
%71 = icmp sgt i32 %67, %70
br i1 %71, label %72, label %98
72: ; preds = %66
%73 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%74 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %73, i32 0, i32 3
%75 = load i32, i32* %74
%76 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%77 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %76, i32 0, i32 4
%78 = load i32, i32* %77
%79 = load i64, i64* %7
%80 = load i32, i32* %8
%81 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%82 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %81, i32 0, i32 1
%83 = load i32, i32* %82
%84 = sub nsw i32 %80, %83
%85 = call i32 @ns_skiprr(i32 %75, i32 %78, i64 %79, i32 %84)
store i32 %85, i32* %10
%86 = load i32, i32* %10
%87 = icmp slt i32 %86, 0
br i1 %87, label %88, label %89
88: ; preds = %72
store i32 -1, i32* %5
br label %245
89: ; preds = %72
%90 = load i32, i32* %10
%91 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%92 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %91, i32 0, i32 3
%93 = load i32, i32* %92
%94 = add nsw i32 %93, %90
store i32 %94, i32* %92
%95 = load i32, i32* %8
%96 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%97 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %96, i32 0, i32 1
store i32 %95, i32* %97
br label %98
98: ; preds = %89, %66
%99 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%100 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %99, i32 0, i32 5
%101 = load i32, i32* %100
%102 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%103 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %102, i32 0, i32 4
%104 = load i32, i32* %103
%105 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%106 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %105, i32 0, i32 3
%107 = load i32, i32* %106
%108 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%109 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %108, i32 0, i32 5
%110 = load i32, i32* %109
%111 = load i32, i32* @NS_MAXDNAME
%112 = call i32 @dn_expand(i32 %101, i32 %104, i32 %107, i32 %110, i32 %111)
store i32 %112, i32* %10
%113 = load i32, i32* %10
%114 = icmp slt i32 %113, 0
br i1 %114, label %115, label %116
115: ; preds = %98
store i32 -1, i32* %5
br label %245
116: ; preds = %98
%117 = load i32, i32* %10
%118 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%119 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %118, i32 0, i32 3
%120 = load i32, i32* %119
%121 = add nsw i32 %120, %117
store i32 %121, i32* %119
%122 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%123 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %122, i32 0, i32 3
%124 = load i32, i32* %123
%125 = load i32, i32* @NS_INT16SZ
%126 = add nsw i32 %124, %125
%127 = load i32, i32* @NS_INT16SZ
%128 = add nsw i32 %126, %127
%129 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%130 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %129, i32 0, i32 4
%131 = load i32, i32* %130
%132 = icmp sgt i32 %128, %131
br i1 %132, label %133, label %137
133: ; preds = %116
br label %134
134: ; preds = %133
%135 = load i32, i32* @EMSGSIZE
store i32 %135, i32* @errno
store i32 -1, i32* %5
br label %245
136: ; No predecessors!
br label %137
137: ; preds = %136, %116
%138 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%139 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %138, i32 0, i32 0
%140 = load i32, i32* %139
%141 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%142 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %141, i32 0, i32 3
%143 = load i32, i32* %142
%144 = call i32 @NS_GET16(i32 %140, i32 %143)
%145 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%146 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %145, i32 0, i32 1
%147 = load i32, i32* %146
%148 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%149 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %148, i32 0, i32 3
%150 = load i32, i32* %149
%151 = call i32 @NS_GET16(i32 %147, i32 %150)
%152 = load i64, i64* %7
%153 = load i64, i64* @ns_s_qd
%154 = icmp eq i64 %152, %153
br i1 %154, label %155, label %162
155: ; preds = %137
%156 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%157 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %156, i32 0, i32 4
store i64 0, i64* %157
%158 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%159 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %158, i32 0, i32 2
store i32 0, i32* %159
%160 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%161 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %160, i32 0, i32 3
store i32* null, i32** %161
br label %223
162: ; preds = %137
%163 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%164 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %163, i32 0, i32 3
%165 = load i32, i32* %164
%166 = load i32, i32* @NS_INT32SZ
%167 = add nsw i32 %165, %166
%168 = load i32, i32* @NS_INT16SZ
%169 = add nsw i32 %167, %168
%170 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%171 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %170, i32 0, i32 4
%172 = load i32, i32* %171
%173 = icmp sgt i32 %169, %172
br i1 %173, label %174, label %178
174: ; preds = %162
br label %175
175: ; preds = %174
%176 = load i32, i32* @EMSGSIZE
store i32 %176, i32* @errno
store i32 -1, i32* %5
br label %245
177: ; No predecessors!
br label %178
178: ; preds = %177, %162
%179 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%180 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %179, i32 0, i32 4
%181 = load i64, i64* %180
%182 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%183 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %182, i32 0, i32 3
%184 = load i32, i32* %183
%185 = call i32 @NS_GET32(i64 %181, i32 %184)
%186 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%187 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %186, i32 0, i32 2
%188 = load i32, i32* %187
%189 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%190 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %189, i32 0, i32 3
%191 = load i32, i32* %190
%192 = call i32 @NS_GET16(i32 %188, i32 %191)
%193 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%194 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %193, i32 0, i32 3
%195 = load i32, i32* %194
%196 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%197 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %196, i32 0, i32 2
%198 = load i32, i32* %197
%199 = add nsw i32 %195, %198
%200 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%201 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %200, i32 0, i32 4
%202 = load i32, i32* %201
%203 = icmp sgt i32 %199, %202
br i1 %203, label %204, label %208
204: ; preds = %178
br label %205
205: ; preds = %204
%206 = load i32, i32* @EMSGSIZE
store i32 %206, i32* @errno
store i32 -1, i32* %5
br label %245
207: ; No predecessors!
br label %208
208: ; preds = %207, %178
%209 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%210 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %209, i32 0, i32 3
%211 = load i32, i32* %210
%212 = sext i32 %211 to i64
%213 = inttoptr i64 %212 to i32*
%214 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%215 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %214, i32 0, i32 3
store i32* %213, i32** %215
%216 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%217 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %216, i32 0, i32 2
%218 = load i32, i32* %217
%219 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%220 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %219, i32 0, i32 3
%221 = load i32, i32* %220
%222 = add nsw i32 %221, %218
store i32 %222, i32* %220
br label %223
223: ; preds = %208, %155
%224 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%225 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %224, i32 0, i32 1
%226 = load i32, i32* %225
%227 = add nsw i32 %226, 1
store i32 %227, i32* %225
%228 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%229 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %228, i32 0, i32 2
%230 = load i32*, i32** %229
%231 = load i64, i64* %7
%232 = trunc i64 %231 to i32
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds i32, i32* %230, i64 %233
%235 = load i32, i32* %234
%236 = icmp sgt i32 %227, %235
br i1 %236, label %237, label %244
237: ; preds = %223
%238 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%239 = load i64, i64* %7
%240 = trunc i64 %239 to i32
%241 = add nsw i32 %240, 1
%242 = sext i32 %241 to i64
%243 = call i32 @setsection(%struct.TYPE_7__* %238, i64 %242)
br label %244
244: ; preds = %237, %223
store i32 0, i32* %5
br label %245
245: ; preds = %244, %205, %175, %134, %115, %88, %53, %18
%246 = load i32, i32* %5
ret i32 %246
}

LLVM IR (-O2):
%struct.TYPE_7__ = type { i64, i32, i32*, i32, i32, i32 }
%struct.TYPE_6__ = type { i32, i32, i32, i32*, i64, i32 }
@ns_s_max = global i64 0
@ENODEV = global i32 0
@errno = global i32 0
@NS_MAXDNAME = global i32 0
@NS_INT16SZ = global i32 0
@EMSGSIZE = global i32 0
@ns_s_qd = global i64 0
@NS_INT32SZ = global i32 0
define i32 @ns_parserr(%struct.TYPE_7__* %0, i64 %1, i32 %2, %struct.TYPE_6__* nocapture %3) {
%5 = icmp sgt i64 %1, -1
%6 = load i64, i64* @ns_s_max
%7 = icmp sgt i64 %6, %1
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = load i32, i32* @ENODEV
store i32 %10, i32* @errno
br label %132
11: ; preds = %4
%12 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 0
%13 = load i64, i64* %12
%14 = icmp eq i64 %13, %1
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = tail call i32 @setsection(%struct.TYPE_7__* %0, i64 %1)
br label %17
17: ; preds = %15, %11
%18 = icmp eq i32 %2, -1
br i1 %18, label %19, label %22
19: ; preds = %17
%20 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 1
%21 = load i32, i32* %20
br label %22
22: ; preds = %19, %17
%23 = phi i32 [ %21, %19 ], [ %2, %17 ]
%24 = icmp slt i32 %23, 0
br i1 %24, label %33, label %25
25: ; preds = %22
%26 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 2
%27 = load i32*, i32** %26
%28 = shl i64 %1, 32
%29 = ashr exact i64 %28, 32
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = icmp slt i32 %23, %31
br i1 %32, label %35, label %33
33: ; preds = %22, %25
%34 = load i32, i32* @ENODEV
store i32 %34, i32* @errno
br label %132
35: ; preds = %25
%36 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 1
%37 = load i32, i32* %36
%38 = icmp slt i32 %23, %37
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = tail call i32 @setsection(%struct.TYPE_7__* %0, i64 %1)
%41 = load i32, i32* %36
br label %42
42: ; preds = %39, %35
%43 = phi i32 [ %41, %39 ], [ %37, %35 ]
%44 = icmp sgt i32 %23, %43
%45 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 3
%46 = load i32, i32* %45
br i1 %44, label %47, label %56
47: ; preds = %42
%48 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 4
%49 = load i32, i32* %48
%50 = sub nsw i32 %23, %43
%51 = tail call i32 @ns_skiprr(i32 %46, i32 %49, i64 %1, i32 %50)
%52 = icmp slt i32 %51, 0
br i1 %52, label %132, label %53
53: ; preds = %47
%54 = load i32, i32* %45
%55 = add nsw i32 %54, %51
store i32 %55, i32* %45
store i32 %23, i32* %36
br label %56
56: ; preds = %42, %53
%57 = phi i32 [ %55, %53 ], [ %46, %42 ]
%58 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 5
%59 = load i32, i32* %58
%60 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 4
%61 = load i32, i32* %60
%62 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 3
%63 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 5
%64 = load i32, i32* %63
%65 = load i32, i32* @NS_MAXDNAME
%66 = tail call i32 @dn_expand(i32 %59, i32 %61, i32 %57, i32 %64, i32 %65)
%67 = icmp slt i32 %66, 0
br i1 %67, label %132, label %68
68: ; preds = %56
%69 = load i32, i32* %62
%70 = add nsw i32 %69, %66
store i32 %70, i32* %62
%71 = load i32, i32* @NS_INT16SZ
%72 = shl i32 %71, 1
%73 = add i32 %72, %70
%74 = load i32, i32* %60
%75 = icmp sgt i32 %73, %74
br i1 %75, label %76, label %78
76: ; preds = %68
%77 = load i32, i32* @EMSGSIZE
store i32 %77, i32* @errno
br label %132
78: ; preds = %68
%79 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 0
%80 = load i32, i32* %79
%81 = tail call i32 @NS_GET16(i32 %80, i32 %70)
%82 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 1
%83 = load i32, i32* %82
%84 = load i32, i32* %62
%85 = tail call i32 @NS_GET16(i32 %83, i32 %84)
%86 = load i64, i64* @ns_s_qd
%87 = icmp eq i64 %86, %1
br i1 %87, label %88, label %92
88: ; preds = %78
%89 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 2
store i32 0, i32* %89
%90 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 3
%91 = bitcast i32** %90 to i8*
br label %121
92: ; preds = %78
%93 = load i32, i32* %62
%94 = load i32, i32* @NS_INT32SZ
%95 = add nsw i32 %94, %93
%96 = load i32, i32* @NS_INT16SZ
%97 = add nsw i32 %95, %96
%98 = load i32, i32* %60
%99 = icmp sgt i32 %97, %98
br i1 %99, label %100, label %102
100: ; preds = %92
%101 = load i32, i32* @EMSGSIZE
store i32 %101, i32* @errno
br label %132
102: ; preds = %92
%103 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 4
%104 = load i64, i64* %103
%105 = tail call i32 @NS_GET32(i64 %104, i32 %93)
%106 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 2
%107 = load i32, i32* %106
%108 = load i32, i32* %62
%109 = tail call i32 @NS_GET16(i32 %107, i32 %108)
%110 = load i32, i32* %62
%111 = load i32, i32* %106
%112 = add nsw i32 %111, %110
%113 = load i32, i32* %60
%114 = icmp sgt i32 %112, %113
br i1 %114, label %115, label %117
115: ; preds = %102
%116 = load i32, i32* @EMSGSIZE
store i32 %116, i32* @errno
br label %132
117: ; preds = %102
%118 = sext i32 %110 to i64
%119 = inttoptr i64 %118 to i32*
%120 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 3
store i32* %119, i32** %120
store i32 %112, i32* %62
br label %121
121: ; preds = %117, %88
%122 = load i32, i32* %36
%123 = add nsw i32 %122, 1
store i32 %123, i32* %36
%124 = load i32*, i32** %26
%125 = getelementptr inbounds i32, i32* %124, i64 %29
%126 = load i32, i32* %125
%127 = icmp slt i32 %122, %126
br i1 %127, label %132, label %128
128: ; preds = %121
%129 = add i64 %28, 4294967296
%130 = ashr exact i64 %129, 32
%131 = tail call i32 @setsection(%struct.TYPE_7__* %0, i64 %130)
br label %132
132: ; preds = %121, %128, %56, %47, %115, %100, %76, %33, %9
%133 = phi i32 [ -1, %9 ], [ -1, %33 ], [ -1, %76 ], [ -1, %100 ], [ -1, %115 ], [ -1, %47 ], [ -1, %56 ], [ 0, %128 ], [ 0, %121 ]
ret i32 %133
}