#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 int 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__ {
  int _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;
int ns_s_max;
int ns_s_qd;
int ns_skiprr(int, int, int, int);
int /*<<< orphan*/ setsection(TYPE_2__ *, int);
int ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
  int b;
  int tmp;
  tmp = section;
  if (tmp < 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    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     1188 <ns_parserr+0x38>
mov    -0x14(%rbp),%eax
mov    0x2e20(%rip),%rcx
cmp    (%rcx),%eax
jl     11ab <ns_parserr+0x5b>
jmp    118d <ns_parserr+0x3d>
mov    0x2e24(%rip),%rax
mov    (%rax),%ecx
mov    0x2e23(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    149b <ns_parserr+0x34b>
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
je     11c6 <ns_parserr+0x76>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <setsection@plt>
cmpl   $0xffffffff,-0x18(%rbp)
jne    11da <ns_parserr+0x8a>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     11fc <ns_parserr+0xac>
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jl     121f <ns_parserr+0xcf>
jmp    1201 <ns_parserr+0xb1>
mov    0x2db0(%rip),%rax
mov    (%rax),%ecx
mov    0x2daf(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    149b <ns_parserr+0x34b>
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    0x4(%rcx),%eax
jge    123b <ns_parserr+0xeb>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <setsection@plt>
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    0x4(%rcx),%eax
jle    129b <ns_parserr+0x14b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
sub    0x4(%rax),%ecx
call   1060 <ns_skiprr@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1284 <ns_parserr+0x134>
movl   $0xffffffff,-0x4(%rbp)
jmp    149b <ns_parserr+0x34b>
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    0x10(%rax),%ecx
mov    %ecx,0x10(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edx
mov    -0x20(%rbp),%rax
mov    0x20(%rax),%ecx
mov    0x2d22(%rip),%rax
mov    (%rax),%r8d
call   1070 <dn_expand@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    12df <ns_parserr+0x18f>
movl   $0xffffffff,-0x4(%rbp)
jmp    149b <ns_parserr+0x34b>
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    0x10(%rax),%ecx
mov    %ecx,0x10(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%eax
mov    0x2cb6(%rip),%rcx
add    (%rcx),%eax
mov    0x2cad(%rip),%rcx
add    (%rcx),%eax
mov    -0x10(%rbp),%rcx
cmp    0x14(%rcx),%eax
jle    1335 <ns_parserr+0x1e5>
jmp    1317 <ns_parserr+0x1c7>
mov    0x2cba(%rip),%rax
mov    (%rax),%ecx
mov    0x2c99(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    149b <ns_parserr+0x34b>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%esi
call   1050 <NS_GET16@plt>
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%esi
call   1050 <NS_GET16@plt>
mov    -0x14(%rbp),%eax
mov    0x2c6c(%rip),%rcx
cmp    (%rcx),%eax
jne    1394 <ns_parserr+0x244>
mov    -0x20(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,0x10(%rax)
jmp    1463 <ns_parserr+0x313>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%eax
mov    0x2c46(%rip),%rcx
add    (%rcx),%eax
mov    0x2c05(%rip),%rcx
add    (%rcx),%eax
mov    -0x10(%rbp),%rcx
cmp    0x14(%rcx),%eax
jle    13dd <ns_parserr+0x28d>
jmp    13bf <ns_parserr+0x26f>
mov    0x2c12(%rip),%rax
mov    (%rax),%ecx
mov    0x2bf1(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    149b <ns_parserr+0x34b>
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%esi
call   1030 <NS_GET32@plt>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%esi
call   1050 <NS_GET16@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%eax
mov    -0x20(%rbp),%rcx
add    0x8(%rcx),%eax
mov    -0x10(%rbp),%rcx
cmp    0x14(%rcx),%eax
jle    1442 <ns_parserr+0x2f2>
jmp    1424 <ns_parserr+0x2d4>
mov    0x2bad(%rip),%rax
mov    (%rax),%ecx
mov    0x2b8c(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    149b <ns_parserr+0x34b>
mov    -0x10(%rbp),%rax
movslq 0x10(%rax),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x10(%rbp),%rax
add    0x10(%rax),%ecx
mov    %ecx,0x10(%rax)
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%eax
add    $0x1,%eax
mov    %eax,0x4(%rcx)
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1494 <ns_parserr+0x344>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
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   %esi,%esi
js     1278 <ns_parserr+0x128>
mov    %esi,%ebx
mov    0x2e34(%rip),%rax
cmp    %esi,(%rax)
jle    1278 <ns_parserr+0x128>
mov    %rcx,%r15
mov    %edx,%ebp
mov    %rdi,%r14
cmp    %ebx,(%rdi)
jne    118e <ns_parserr+0x3e>
cmp    $0xffffffff,%ebp
je     119d <ns_parserr+0x4d>
test   %ebp,%ebp
jns    11a9 <ns_parserr+0x59>
jmp    1278 <ns_parserr+0x128>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <setsection@plt>
cmp    $0xffffffff,%ebp
jne    1185 <ns_parserr+0x35>
mov    0x4(%r14),%ebp
test   %ebp,%ebp
js     1278 <ns_parserr+0x128>
mov    0x8(%r14),%rax
mov    %ebx,%r12d
cmp    (%rax,%r12,4),%ebp
jge    1278 <ns_parserr+0x128>
mov    0x4(%r14),%eax
cmp    %eax,%ebp
jge    11d0 <ns_parserr+0x80>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <setsection@plt>
mov    0x4(%r14),%eax
mov    %ebp,%ecx
mov    0x10(%r14),%edx
sub    %eax,%ecx
jle    11fd <ns_parserr+0xad>
mov    0x14(%r14),%esi
mov    %edx,%edi
mov    %ebx,%edx
call   1060 <ns_skiprr@plt>
test   %eax,%eax
js     128a <ns_parserr+0x13a>
mov    %eax,%edx
add    0x10(%r14),%edx
mov    %edx,0x10(%r14)
mov    %ebp,0x4(%r14)
mov    0x14(%r14),%esi
mov    0x18(%r14),%edi
mov    0x20(%r15),%ecx
mov    0x2dd0(%rip),%rax
mov    (%rax),%r8d
call   1070 <dn_expand@plt>
mov    $0xffffffff,%ebp
test   %eax,%eax
js     128f <ns_parserr+0x13f>
add    0x10(%r14),%eax
mov    %eax,0x10(%r14)
mov    0x2d80(%rip),%r13
mov    0x0(%r13),%ecx
lea    (%rax,%rcx,2),%ecx
cmp    0x14(%r14),%ecx
jg     12df <ns_parserr+0x18f>
mov    (%r15),%edi
mov    %eax,%esi
call   1050 <NS_GET16@plt>
mov    0x4(%r15),%edi
mov    0x10(%r14),%esi
call   1050 <NS_GET16@plt>
mov    0x2d71(%rip),%rax
cmp    %ebx,(%rax)
jne    12a0 <ns_parserr+0x150>
movl   $0x0,0x8(%r15)
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%r15)
jmp    12fb <ns_parserr+0x1ab>
mov    0x2d39(%rip),%rax
mov    (%rax),%eax
mov    0x2d38(%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    0x10(%r14),%esi
mov    0x2d3d(%rip),%rax
mov    (%rax),%eax
add    %esi,%eax
add    0x0(%r13),%eax
cmp    0x14(%r14),%eax
jg     12df <ns_parserr+0x18f>
mov    0x18(%r15),%rdi
call   1030 <NS_GET32@plt>
mov    0x8(%r15),%edi
mov    0x10(%r14),%esi
call   1050 <NS_GET16@plt>
movslq 0x10(%r14),%rax
mov    0x8(%r15),%ecx
add    %eax,%ecx
cmp    0x14(%r14),%ecx
jle    12f3 <ns_parserr+0x1a3>
mov    0x2cf2(%rip),%rax
mov    (%rax),%eax
mov    0x2cd1(%rip),%rcx
mov    %eax,(%rcx)
jmp    128f <ns_parserr+0x13f>
mov    %rax,0x10(%r15)
mov    %ecx,0x10(%r14)
mov    0x4(%r14),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x4(%r14)
mov    0x8(%r14),%rcx
xor    %ebp,%ebp
cmp    (%rcx,%r12,4),%eax
jl     128f <ns_parserr+0x13f>
add    $0x1,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <setsection@plt>
jmp    128f <ns_parserr+0x13f>

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

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