#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_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ u_int16_t;
typedef int /*<<< orphan*/ u_char;
struct TYPE_4__ {
  int options;
  int id;
};
struct TYPE_3__ {
  int opcode;
  int rd;
  void *ancount;
  void *arcount;
  void *qdcount;
  int /*<<< orphan*/ rcode;
  void *id;
};
typedef TYPE_1__ HEADER;

/* Variables and functions */
int HFIXEDSZ;
int /*<<< orphan*/ INT16SZ;
int /*<<< orphan*/ INT32SZ;
#define IQUERY 130
int /*<<< orphan*/ NETDB_INTERNAL;
int /*<<< orphan*/ NOERROR;
#define NS_NOTIFY_OP 129
int QFIXEDSZ;
#define QUERY 128
int RES_DEBUG;
int RES_INIT;
int RES_RECURSE;
int RRFIXEDSZ;
int /*<<< orphan*/ T_NULL;
int /*<<< orphan*/ __putlong(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ __putshort(int /*<<< orphan*/, int /*<<< orphan*/ *);
TYPE_2__ _res;
int dn_comp(char const *, int /*<<< orphan*/ *, int, int /*<<< orphan*/ **,
            int /*<<< orphan*/ **);
int /*<<< orphan*/ h_errno;
void *htons(int);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                          int);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int, char const *, int, int);
int res_init();
int res_mkquery(int op, const char *dname, int class, int type,
                const u_char *data, int datalen, const u_char *newrr_in,
                u_char *buf, int buflen) {
  register HEADER *hp;
  register u_char *cp;
  register int n;
  u_char *dnptrs[20], **dpp, **lastdnptr;
  if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
    h_errno = NETDB_INTERNAL;
    return (-1);
  }
  if (_res.options & RES_DEBUG)
    printf(";; res_mkquery(%d, %s, %d, %d)\n", op, dname, class, type);
  if ((buf == NULL) || (buflen < HFIXEDSZ))
    return (-1);
  memset(buf, 0, HFIXEDSZ);
  hp = (HEADER *)buf;
  hp->id = htons(++_res.id);
  hp->opcode = op;
  hp->rd = (_res.options & RES_RECURSE) != 0;
  hp->rcode = NOERROR;
  cp = buf + HFIXEDSZ;
  buflen -= HFIXEDSZ;
  dpp = dnptrs;
  *dpp++ = buf;
  *dpp++ = NULL;
  lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
  switch (op) {
  case QUERY:
  case NS_NOTIFY_OP:
    if ((buflen -= QFIXEDSZ) < 0)
      return (-1);
    if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
      return (-1);
    cp += n;
    buflen -= n;
    __putshort((u_int16_t)type, cp);
    cp += INT16SZ;
    __putshort((u_int16_t) class, cp);
    cp += INT16SZ;
    hp->qdcount = htons(1);
    if (op == QUERY || data == NULL)
      break;
    buflen -= RRFIXEDSZ;
    n = dn_comp((char *)data, cp, buflen, dnptrs, lastdnptr);
    if (n < 0)
      return (-1);
    cp += n;
    buflen -= n;
    __putshort(T_NULL, cp);
    cp += INT16SZ;
    __putshort((u_int16_t) class, cp);
    cp += INT16SZ;
    __putlong(0, cp);
    cp += INT32SZ;
    __putshort(0, cp);
    cp += INT16SZ;
    hp->arcount = htons(1);
    break;
  case IQUERY:
    if (buflen < 1 + RRFIXEDSZ + datalen)
      return (-1);
    *cp++ = '\0';
    __putshort((u_int16_t)type, cp);
    cp += INT16SZ;
    __putshort((u_int16_t) class, cp);
    cp += INT16SZ;
    __putlong(0, cp);
    cp += INT32SZ;
    __putshort((u_int16_t)datalen, cp);
    cp += INT16SZ;
    if (datalen) {
      memcpy(cp, data, datalen);
      cp += datalen;
    }
    hp->ancount = htons(1);
    break;
  default:
    return (-1);
  }
  return ((int)(cp - buf));
}


x86 assembly (clang, -O0):
<res_mkquery>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
mov    0x2dc5(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    11f4 <res_mkquery+0x74>
mov    $0x0,%al
call   1080 <res_init@plt>
cmp    $0xffffffff,%eax
jne    11f4 <res_mkquery+0x74>
mov    0x2dd3(%rip),%rax
mov    (%rax),%ecx
mov    0x2de2(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    16d4 <res_mkquery+0x554>
mov    0x2de5(%rip),%rax
mov    (%rax),%eax
mov    0x2dd4(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1229 <res_mkquery+0xa9>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xddc(%rip),%rdi
call   1040 <printf@plt>
cmpq   $0x0,0x18(%rbp)
je     1246 <res_mkquery+0xc6>
mov    0x20(%rbp),%eax
mov    0x2d62(%rip),%rcx
cmp    (%rcx),%eax
jge    1252 <res_mkquery+0xd2>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d4 <res_mkquery+0x554>
mov    0x18(%rbp),%rdi
mov    0x2d43(%rip),%rax
mov    %rax,-0x100(%rbp)
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    0x2d64(%rip),%rax
mov    %rax,-0x108(%rbp)
mov    0x4(%rax),%edi
add    $0x1,%edi
mov    %edi,0x4(%rax)
call   1030 <htons@plt>
mov    -0x108(%rbp),%rcx
mov    %rax,%rsi
mov    -0x100(%rbp),%rax
mov    -0x30(%rbp),%rdx
mov    %rsi,0x28(%rdx)
mov    -0x8(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    %esi,(%rdx)
mov    (%rcx),%ecx
mov    0x2d04(%rip),%rdx
mov    (%rdx),%edx
and    %edx,%ecx
test   %ecx,%ecx
setne  %cl
movzbl %cl,%edx
mov    -0x30(%rbp),%rcx
mov    %edx,0x4(%rcx)
mov    0x2ce2(%rip),%rcx
mov    (%rcx),%edx
mov    -0x30(%rbp),%rcx
mov    %edx,0x20(%rcx)
mov    0x18(%rbp),%rcx
movslq (%rax),%rdx
lea    (%rcx,%rdx,4),%rcx
mov    %rcx,-0x38(%rbp)
mov    (%rax),%ecx
mov    0x20(%rbp),%eax
sub    %ecx,%eax
mov    %eax,0x20(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    0x18(%rbp),%rcx
mov    -0xe8(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0xe8(%rbp)
mov    %rcx,(%rax)
mov    -0xe8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0xe8(%rbp)
movq   $0x0,(%rax)
lea    -0x40(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xf4(%rbp)
add    $0xffffff80,%eax
sub    $0x2,%eax
jb     1379 <res_mkquery+0x1f9>
jmp    1363 <res_mkquery+0x1e3>
mov    -0xf4(%rbp),%eax
sub    $0x82,%eax
je     1597 <res_mkquery+0x417>
jmp    16b6 <res_mkquery+0x536>
mov    0x2c10(%rip),%rax
mov    (%rax),%ecx
mov    0x20(%rbp),%eax
sub    %ecx,%eax
mov    %eax,0x20(%rbp)
cmp    $0x0,%eax
jge    139f <res_mkquery+0x21f>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d4 <res_mkquery+0x554>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    0x20(%rbp),%edx
lea    -0xe0(%rbp),%rcx
mov    -0xf0(%rbp),%r8
call   10a0 <dn_comp@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
jge    13d5 <res_mkquery+0x255>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d4 <res_mkquery+0x554>
mov    -0x3c(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x3c(%rbp),%ecx
mov    0x20(%rbp),%eax
sub    %ecx,%eax
mov    %eax,0x20(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   1060 <__putshort@plt>
mov    0x2b80(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   1060 <__putshort@plt>
mov    0x2b59(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    $0x1,%edi
call   1030 <htons@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,0x18(%rax)
cmpl   $0x80,-0x8(%rbp)
je     1470 <res_mkquery+0x2f0>
cmpq   $0x0,-0x20(%rbp)
jne    1475 <res_mkquery+0x2f5>
jmp    16c2 <res_mkquery+0x542>
mov    0x2b2c(%rip),%rax
mov    (%rax),%ecx
mov    0x20(%rbp),%eax
sub    %ecx,%eax
mov    %eax,0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    0x20(%rbp),%edx
lea    -0xe0(%rbp),%rcx
mov    -0xf0(%rbp),%r8
call   10a0 <dn_comp@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jge    14bd <res_mkquery+0x33d>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d4 <res_mkquery+0x554>
mov    -0x3c(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x3c(%rbp),%ecx
mov    0x20(%rbp),%eax
sub    %ecx,%eax
mov    %eax,0x20(%rbp)
mov    0x2b14(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rsi
call   1060 <__putshort@plt>
mov    0x2a92(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   1060 <__putshort@plt>
mov    0x2a6b(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
xor    %edi,%edi
call   1050 <__putlong@plt>
mov    0x2a8d(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
xor    %edi,%edi
call   1060 <__putshort@plt>
mov    0x2a1f(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    $0x1,%edi
call   1030 <htons@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,0x10(%rax)
jmp    16c2 <res_mkquery+0x542>
mov    0x20(%rbp),%eax
mov    0x2a07(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
add    -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    15bd <res_mkquery+0x43d>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d4 <res_mkquery+0x554>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x38(%rbp)
movl   $0x0,(%rax)
mov    -0x18(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   1060 <__putshort@plt>
mov    0x29a3(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   1060 <__putshort@plt>
mov    0x297c(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
xor    %edi,%edi
call   1050 <__putlong@plt>
mov    0x299e(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   1060 <__putshort@plt>
mov    0x292f(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     169c <res_mkquery+0x51c>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1090 <memcpy@plt>
mov    -0x24(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    $0x1,%edi
call   1030 <htons@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,0x8(%rax)
jmp    16c2 <res_mkquery+0x542>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d4 <res_mkquery+0x554>
mov    -0x38(%rbp),%rax
mov    0x18(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<res_mkquery>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %r9d,%r14d
mov    %r8,%r12
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %rsi,0x20(%rsp)
mov    %edi,%ebp
mov    0x2e36(%rip),%r13
mov    0x0(%r13),%eax
mov    0x2dcb(%rip),%rcx
test   %eax,(%rcx)
jne    11cd <res_mkquery+0x4d>
xor    %eax,%eax
call   1080 <res_init@plt>
cmp    $0xffffffff,%eax
je     13e9 <res_mkquery+0x269>
mov    0x0(%r13),%eax
mov    0x2e04(%rip),%rcx
test   %eax,(%rcx)
je     11f1 <res_mkquery+0x71>
lea    0xe21(%rip),%rdi
mov    %ebp,%esi
mov    0x20(%rsp),%rdx
mov    %r15d,%ecx
mov    %ebx,%r8d
call   1040 <printf@plt>
mov    $0xffffffff,%ecx
cmpq   $0x0,0x118(%rsp)
je     14ef <res_mkquery+0x36f>
mov    %rbp,0x18(%rsp)
mov    %ebx,0xc(%rsp)
mov    0x120(%rsp),%ebp
mov    0x2d84(%rip),%rbx
mov    (%rbx),%edx
cmp    %ebp,%edx
jg     14ef <res_mkquery+0x36f>
mov    %r14,0x28(%rsp)
mov    %r15d,0x8(%rsp)
mov    %r12,0x10(%rsp)
mov    0x118(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
mov    0x4(%r13),%edi
add    $0x1,%edi
mov    %edi,0x4(%r13)
call   1030 <htons@plt>
mov    %rax,0x28(%r14)
mov    0x18(%rsp),%rdx
mov    %edx,(%r14)
mov    0x2d56(%rip),%rax
mov    (%rax),%eax
xor    %ecx,%ecx
and    0x0(%r13),%eax
setne  %cl
mov    %ecx,0x4(%r14)
mov    0x2d38(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%r14)
movslq (%rbx),%rax
lea    (%r14,%rax,4),%rbx
sub    %eax,%ebp
mov    %r14,0x30(%rsp)
movq   $0x0,0x38(%rsp)
lea    -0x80(%rdx),%eax
cmp    $0x2,%eax
jae    1405 <res_mkquery+0x285>
mov    0x2ce0(%rip),%rax
sub    (%rax),%ebp
js     14d6 <res_mkquery+0x356>
lea    0xd0(%rsp),%r12
lea    0x30(%rsp),%rcx
mov    0x20(%rsp),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r12,%r8
call   10a0 <dn_comp@plt>
test   %eax,%eax
js     14d6 <res_mkquery+0x356>
mov    %eax,%r13d
mov    %eax,%eax
lea    (%rbx,%rax,4),%rbx
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1060 <__putshort@plt>
mov    0x2c8d(%rip),%r15
movslq (%r15),%rax
lea    (%rbx,%rax,4),%r14
mov    0x8(%rsp),%edi
mov    %r14,%rsi
call   1060 <__putshort@plt>
movslq (%r15),%rax
lea    (%r14,%rax,4),%r14
mov    $0x1,%edi
call   1030 <htons@plt>
mov    0x118(%rsp),%rcx
mov    %rax,0x18(%rcx)
cmpl   $0x80,0x18(%rsp)
je     14dd <res_mkquery+0x35d>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     14dd <res_mkquery+0x35d>
mov    0x2c5a(%rip),%rax
add    (%rax),%r13d
sub    %r13d,%ebp
lea    0x30(%rsp),%rcx
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r12,%r8
call   10a0 <dn_comp@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
js     14ef <res_mkquery+0x36f>
mov    %eax,%eax
lea    (%r14,%rax,4),%rbx
mov    0x2c78(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1060 <__putshort@plt>
movslq (%r15),%rax
lea    (%rbx,%rax,4),%rbx
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
call   1060 <__putshort@plt>
movslq (%r15),%rax
lea    (%rbx,%rax,4),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <__putlong@plt>
mov    0x2c1b(%rip),%rax
movslq (%rax),%rax
lea    (%rbx,%rax,4),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1060 <__putshort@plt>
movslq (%r15),%rax
lea    (%rbx,%rax,4),%r14
mov    $0x1,%edi
call   1030 <htons@plt>
mov    $0x4,%ecx
mov    0x118(%rsp),%rbx
jmp    14d0 <res_mkquery+0x350>
mov    0x2bc0(%rip),%rax
mov    (%rax),%eax
mov    0x2bcf(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%ecx
jmp    14ef <res_mkquery+0x36f>
cmp    $0x82,%edx
mov    $0xffffffff,%ecx
jne    14ef <res_mkquery+0x36f>
mov    0x2b8b(%rip),%rax
mov    (%rax),%eax
mov    0x28(%rsp),%r15
add    %r15d,%eax
add    $0x1,%eax
cmp    %eax,%ebp
jl     14ef <res_mkquery+0x36f>
lea    0x4(%rbx),%rsi
movl   $0x0,(%rbx)
mov    0xc(%rsp),%edi
call   1060 <__putshort@plt>
mov    0x2b3c(%rip),%r14
movslq (%r14),%rax
lea    (%rbx,%rax,4),%rbp
add    $0x4,%rbp
mov    0x8(%rsp),%edi
mov    %rbp,%rsi
call   1060 <__putshort@plt>
movslq (%r14),%rax
lea    0x0(%rbp,%rax,4),%rbp
xor    %edi,%edi
mov    %rbp,%rsi
call   1050 <__putlong@plt>
mov    0x2b54(%rip),%rax
movslq (%rax),%rax
lea    0x0(%rbp,%rax,4),%rbp
mov    %r15d,%edi
mov    %rbp,%rsi
call   1060 <__putshort@plt>
movslq (%r14),%rax
lea    0x0(,%rax,4),%r14
add    %rbp,%r14
test   %r15d,%r15d
je     14b9 <res_mkquery+0x339>
mov    %r14,%rdi
mov    0x10(%rsp),%rsi
mov    %r15d,%edx
call   1090 <memcpy@plt>
movslq %r15d,%rax
lea    (%r14,%rax,4),%r14
mov    0x118(%rsp),%rbx
mov    $0x1,%edi
call   1030 <htons@plt>
mov    $0x2,%ecx
mov    %rax,(%rbx,%rcx,4)
jmp    14e5 <res_mkquery+0x365>
mov    $0xffffffff,%ecx
jmp    14ef <res_mkquery+0x36f>
mov    0x118(%rsp),%rbx
sub    %rbx,%r14
shr    $0x2,%r14
mov    %r14d,%ecx
mov    %ecx,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, i32 }
%struct.TYPE_3__ = type { i32, i32, i8*, i8*, i8*, i32, i8* }
@_res = global %struct.TYPE_4__ zeroinitializer
@RES_INIT = global i32 0
@NETDB_INTERNAL = global i32 0
@h_errno = global i32 0
@RES_DEBUG = global i32 0
@.str = [32 x i8] c";; res_mkquery(%d, %s, %d, %d)\0A\00"
@HFIXEDSZ = global i32 0
@RES_RECURSE = global i32 0
@NOERROR = global i32 0
@QFIXEDSZ = global i32 0
@INT16SZ = global i32 0
@RRFIXEDSZ = global i32 0
@T_NULL = global i32 0
@INT32SZ = global i32 0
define i32 @res_mkquery(i32 %0, i8* %1, i32 %2, i32 %3, i32* %4, i32 %5, i32* %6, i32* %7, i32 %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32
%20 = alloca %struct.TYPE_3__*
%21 = alloca i32*
%22 = alloca i32
%23 = alloca [20 x i32*]
%24 = alloca i32**
%25 = alloca i32**
store i32 %0, i32* %11
store i8* %1, i8** %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store i32* %4, i32** %15
store i32 %5, i32* %16
store i32* %6, i32** %17
store i32* %7, i32** %18
store i32 %8, i32* %19
%26 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @_res, i32 0, i32 0)
%27 = load i32, i32* @RES_INIT
%28 = and i32 %26, %27
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %9
%31 = call i32 (...) @res_init()
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = load i32, i32* @NETDB_INTERNAL
store i32 %34, i32* @h_errno
store i32 -1, i32* %10
br label %253
35: ; preds = %30, %9
%36 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @_res, i32 0, i32 0)
%37 = load i32, i32* @RES_DEBUG
%38 = and i32 %36, %37
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %35
%41 = load i32, i32* %11
%42 = load i8*, i8** %12
%43 = load i32, i32* %13
%44 = load i32, i32* %14
%45 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %41, i8* %42, i32 %43, i32 %44)
br label %46
46: ; preds = %40, %35
%47 = load i32*, i32** %18
%48 = icmp eq i32* %47, null
br i1 %48, label %53, label %49
49: ; preds = %46
%50 = load i32, i32* %19
%51 = load i32, i32* @HFIXEDSZ
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %54
53: ; preds = %49, %46
store i32 -1, i32* %10
br label %253
54: ; preds = %49
%55 = load i32*, i32** %18
%56 = load i32, i32* @HFIXEDSZ
%57 = call i32 @memset(i32* %55, i32 0, i32 %56)
%58 = load i32*, i32** %18
%59 = bitcast i32* %58 to %struct.TYPE_3__*
store %struct.TYPE_3__* %59, %struct.TYPE_3__** %20
%60 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @_res, i32 0, i32 1)
%61 = add nsw i32 %60, 1
store i32 %61, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @_res, i32 0, i32 1)
%62 = call i8* @htons(i32 %61)
%63 = load %struct.TYPE_3__*, %struct.TYPE_3__** %20
%64 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %63, i32 0, i32 6
store i8* %62, i8** %64
%65 = load i32, i32* %11
%66 = load %struct.TYPE_3__*, %struct.TYPE_3__** %20
%67 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %66, i32 0, i32 0
store i32 %65, i32* %67
%68 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @_res, i32 0, i32 0)
%69 = load i32, i32* @RES_RECURSE
%70 = and i32 %68, %69
%71 = icmp ne i32 %70, 0
%72 = zext i1 %71 to i32
%73 = load %struct.TYPE_3__*, %struct.TYPE_3__** %20
%74 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %73, i32 0, i32 1
store i32 %72, i32* %74
%75 = load i32, i32* @NOERROR
%76 = load %struct.TYPE_3__*, %struct.TYPE_3__** %20
%77 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %76, i32 0, i32 5
store i32 %75, i32* %77
%78 = load i32*, i32** %18
%79 = load i32, i32* @HFIXEDSZ
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i32, i32* %78, i64 %80
store i32* %81, i32** %21
%82 = load i32, i32* @HFIXEDSZ
%83 = load i32, i32* %19
%84 = sub nsw i32 %83, %82
store i32 %84, i32* %19
%85 = getelementptr inbounds [20 x i32*], [20 x i32*]* %23, i64 0, i64 0
store i32** %85, i32*** %24
%86 = load i32*, i32** %18
%87 = load i32**, i32*** %24
%88 = getelementptr inbounds i32*, i32** %87, i32 1
store i32** %88, i32*** %24
store i32* %86, i32** %87
%89 = load i32**, i32*** %24
%90 = getelementptr inbounds i32*, i32** %89, i32 1
store i32** %90, i32*** %24
store i32* null, i32** %89
%91 = getelementptr inbounds [20 x i32*], [20 x i32*]* %23, i64 0, i64 0
%92 = getelementptr inbounds i32*, i32** %91, i64 20
store i32** %92, i32*** %25
%93 = load i32, i32* %11
switch i32 %93, label %244 [
i32 128, label %94
i32 129, label %94
i32 130, label %191
]
94: ; preds = %54, %54
%95 = load i32, i32* @QFIXEDSZ
%96 = load i32, i32* %19
%97 = sub nsw i32 %96, %95
store i32 %97, i32* %19
%98 = icmp slt i32 %97, 0
br i1 %98, label %99, label %100
99: ; preds = %94
store i32 -1, i32* %10
br label %253
100: ; preds = %94
%101 = load i8*, i8** %12
%102 = load i32*, i32** %21
%103 = load i32, i32* %19
%104 = getelementptr inbounds [20 x i32*], [20 x i32*]* %23, i64 0, i64 0
%105 = load i32**, i32*** %25
%106 = call i32 @dn_comp(i8* %101, i32* %102, i32 %103, i32** %104, i32** %105)
store i32 %106, i32* %22
%107 = icmp slt i32 %106, 0
br i1 %107, label %108, label %109
108: ; preds = %100
store i32 -1, i32* %10
br label %253
109: ; preds = %100
%110 = load i32, i32* %22
%111 = load i32*, i32** %21
%112 = sext i32 %110 to i64
%113 = getelementptr inbounds i32, i32* %111, i64 %112
store i32* %113, i32** %21
%114 = load i32, i32* %22
%115 = load i32, i32* %19
%116 = sub nsw i32 %115, %114
store i32 %116, i32* %19
%117 = load i32, i32* %14
%118 = load i32*, i32** %21
%119 = call i32 @__putshort(i32 %117, i32* %118)
%120 = load i32, i32* @INT16SZ
%121 = load i32*, i32** %21
%122 = sext i32 %120 to i64
%123 = getelementptr inbounds i32, i32* %121, i64 %122
store i32* %123, i32** %21
%124 = load i32, i32* %13
%125 = load i32*, i32** %21
%126 = call i32 @__putshort(i32 %124, i32* %125)
%127 = load i32, i32* @INT16SZ
%128 = load i32*, i32** %21
%129 = sext i32 %127 to i64
%130 = getelementptr inbounds i32, i32* %128, i64 %129
store i32* %130, i32** %21
%131 = call i8* @htons(i32 1)
%132 = load %struct.TYPE_3__*, %struct.TYPE_3__** %20
%133 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %132, i32 0, i32 4
store i8* %131, i8** %133
%134 = load i32, i32* %11
%135 = icmp eq i32 %134, 128
br i1 %135, label %139, label %136
136: ; preds = %109
%137 = load i32*, i32** %15
%138 = icmp eq i32* %137, null
br i1 %138, label %139, label %140
139: ; preds = %136, %109
br label %245
140: ; preds = %136
%141 = load i32, i32* @RRFIXEDSZ
%142 = load i32, i32* %19
%143 = sub nsw i32 %142, %141
store i32 %143, i32* %19
%144 = load i32*, i32** %15
%145 = bitcast i32* %144 to i8*
%146 = load i32*, i32** %21
%147 = load i32, i32* %19
%148 = getelementptr inbounds [20 x i32*], [20 x i32*]* %23, i64 0, i64 0
%149 = load i32**, i32*** %25
%150 = call i32 @dn_comp(i8* %145, i32* %146, i32 %147, i32** %148, i32** %149)
store i32 %150, i32* %22
%151 = load i32, i32* %22
%152 = icmp slt i32 %151, 0
br i1 %152, label %153, label %154
153: ; preds = %140
store i32 -1, i32* %10
br label %253
154: ; preds = %140
%155 = load i32, i32* %22
%156 = load i32*, i32** %21
%157 = sext i32 %155 to i64
%158 = getelementptr inbounds i32, i32* %156, i64 %157
store i32* %158, i32** %21
%159 = load i32, i32* %22
%160 = load i32, i32* %19
%161 = sub nsw i32 %160, %159
store i32 %161, i32* %19
%162 = load i32, i32* @T_NULL
%163 = load i32*, i32** %21
%164 = call i32 @__putshort(i32 %162, i32* %163)
%165 = load i32, i32* @INT16SZ
%166 = load i32*, i32** %21
%167 = sext i32 %165 to i64
%168 = getelementptr inbounds i32, i32* %166, i64 %167
store i32* %168, i32** %21
%169 = load i32, i32* %13
%170 = load i32*, i32** %21
%171 = call i32 @__putshort(i32 %169, i32* %170)
%172 = load i32, i32* @INT16SZ
%173 = load i32*, i32** %21
%174 = sext i32 %172 to i64
%175 = getelementptr inbounds i32, i32* %173, i64 %174
store i32* %175, i32** %21
%176 = load i32*, i32** %21
%177 = call i32 @__putlong(i32 0, i32* %176)
%178 = load i32, i32* @INT32SZ
%179 = load i32*, i32** %21
%180 = sext i32 %178 to i64
%181 = getelementptr inbounds i32, i32* %179, i64 %180
store i32* %181, i32** %21
%182 = load i32*, i32** %21
%183 = call i32 @__putshort(i32 0, i32* %182)
%184 = load i32, i32* @INT16SZ
%185 = load i32*, i32** %21
%186 = sext i32 %184 to i64
%187 = getelementptr inbounds i32, i32* %185, i64 %186
store i32* %187, i32** %21
%188 = call i8* @htons(i32 1)
%189 = load %struct.TYPE_3__*, %struct.TYPE_3__** %20
%190 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %189, i32 0, i32 3
store i8* %188, i8** %190
br label %245
191: ; preds = %54
%192 = load i32, i32* %19
%193 = load i32, i32* @RRFIXEDSZ
%194 = add nsw i32 1, %193
%195 = load i32, i32* %16
%196 = add nsw i32 %194, %195
%197 = icmp slt i32 %192, %196
br i1 %197, label %198, label %199
198: ; preds = %191
store i32 -1, i32* %10
br label %253
199: ; preds = %191
%200 = load i32*, i32** %21
%201 = getelementptr inbounds i32, i32* %200, i32 1
store i32* %201, i32** %21
store i32 0, i32* %200
%202 = load i32, i32* %14
%203 = load i32*, i32** %21
%204 = call i32 @__putshort(i32 %202, i32* %203)
%205 = load i32, i32* @INT16SZ
%206 = load i32*, i32** %21
%207 = sext i32 %205 to i64
%208 = getelementptr inbounds i32, i32* %206, i64 %207
store i32* %208, i32** %21
%209 = load i32, i32* %13
%210 = load i32*, i32** %21
%211 = call i32 @__putshort(i32 %209, i32* %210)
%212 = load i32, i32* @INT16SZ
%213 = load i32*, i32** %21
%214 = sext i32 %212 to i64
%215 = getelementptr inbounds i32, i32* %213, i64 %214
store i32* %215, i32** %21
%216 = load i32*, i32** %21
%217 = call i32 @__putlong(i32 0, i32* %216)
%218 = load i32, i32* @INT32SZ
%219 = load i32*, i32** %21
%220 = sext i32 %218 to i64
%221 = getelementptr inbounds i32, i32* %219, i64 %220
store i32* %221, i32** %21
%222 = load i32, i32* %16
%223 = load i32*, i32** %21
%224 = call i32 @__putshort(i32 %222, i32* %223)
%225 = load i32, i32* @INT16SZ
%226 = load i32*, i32** %21
%227 = sext i32 %225 to i64
%228 = getelementptr inbounds i32, i32* %226, i64 %227
store i32* %228, i32** %21
%229 = load i32, i32* %16
%230 = icmp ne i32 %229, 0
br i1 %230, label %231, label %240
231: ; preds = %199
%232 = load i32*, i32** %21
%233 = load i32*, i32** %15
%234 = load i32, i32* %16
%235 = call i32 @memcpy(i32* %232, i32* %233, i32 %234)
%236 = load i32, i32* %16
%237 = load i32*, i32** %21
%238 = sext i32 %236 to i64
%239 = getelementptr inbounds i32, i32* %237, i64 %238
store i32* %239, i32** %21
br label %240
240: ; preds = %231, %199
%241 = call i8* @htons(i32 1)
%242 = load %struct.TYPE_3__*, %struct.TYPE_3__** %20
%243 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %242, i32 0, i32 2
store i8* %241, i8** %243
br label %245
244: ; preds = %54
store i32 -1, i32* %10
br label %253
245: ; preds = %240, %154, %139
%246 = load i32*, i32** %21
%247 = load i32*, i32** %18
%248 = ptrtoint i32* %246 to i64
%249 = ptrtoint i32* %247 to i64
%250 = sub i64 %248, %249
%251 = sdiv exact i64 %250, 4
%252 = trunc i64 %251 to i32
store i32 %252, i32* %10
br label %253
253: ; preds = %245, %244, %198, %153, %108, %99, %53, %33
%254 = load i32, i32* %10
ret i32 %254
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32, i32 }
@_res = global %struct.TYPE_4__ zeroinitializer
@RES_INIT = global i32 0
@NETDB_INTERNAL = global i32 0
@h_errno = global i32 0
@RES_DEBUG = global i32 0
@.str = [32 x i8] c";; res_mkquery(%d, %s, %d, %d)\0A\00"
@HFIXEDSZ = global i32 0
@RES_RECURSE = global i32 0
@NOERROR = global i32 0
@QFIXEDSZ = global i32 0
@INT16SZ = global i32 0
@RRFIXEDSZ = global i32 0
@T_NULL = global i32 0
@INT32SZ = global i32 0
define i32 @res_mkquery(i32 %0, i8* %1, i32 %2, i32 %3, i32* %4, i32 %5, i32* nocapture readnone %6, i32* %7, i32 %8) {
%10 = alloca [20 x i32*]
%11 = bitcast [20 x i32*]* %10 to i8*
%12 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @_res, i64 0, i32 0)
%13 = load i32, i32* @RES_INIT
%14 = and i32 %13, %12
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %9
%17 = tail call i32 (...) @res_init()
%18 = icmp eq i32 %17, -1
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @_res, i64 0, i32 0)
br label %23
21: ; preds = %16
%22 = load i32, i32* @NETDB_INTERNAL
store i32 %22, i32* @h_errno
br label %153
23: ; preds = %19, %9
%24 = phi i32 [ %20, %19 ], [ %12, %9 ]
%25 = load i32, i32* @RES_DEBUG
%26 = and i32 %25, %24
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %23
%29 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1, i32 %2, i32 %3)
br label %30
30: ; preds = %28, %23
%31 = icmp eq i32* %7, null
br i1 %31, label %153, label %32
32: ; preds = %30
%33 = load i32, i32* @HFIXEDSZ
%34 = icmp sgt i32 %33, %8
br i1 %34, label %153, label %35
35: ; preds = %32
%36 = tail call i32 @memset(i32* %7, i32 0, i32 %33)
%37 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @_res, i64 0, i32 1)
%38 = add nsw i32 %37, 1
store i32 %38, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @_res, i64 0, i32 1)
%39 = tail call i8* @htons(i32 %38)
%40 = getelementptr inbounds i32, i32* %7, i64 10
%41 = bitcast i32* %40 to i8**
store i8* %39, i8** %41
store i32 %0, i32* %7
%42 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @_res, i64 0, i32 0)
%43 = load i32, i32* @RES_RECURSE
%44 = and i32 %43, %42
%45 = icmp ne i32 %44, 0
%46 = zext i1 %45 to i32
%47 = getelementptr inbounds i32, i32* %7, i64 1
store i32 %46, i32* %47
%48 = load i32, i32* @NOERROR
%49 = getelementptr inbounds i32, i32* %7, i64 8
store i32 %48, i32* %49
%50 = load i32, i32* @HFIXEDSZ
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %7, i64 %51
%53 = sub nsw i32 %8, %50
%54 = getelementptr inbounds [20 x i32*], [20 x i32*]* %10, i64 0, i64 0
%55 = getelementptr inbounds [20 x i32*], [20 x i32*]* %10, i64 0, i64 1
store i32* %7, i32** %54
store i32* null, i32** %55
%56 = getelementptr inbounds [20 x i32*], [20 x i32*]* %10, i64 0, i64 20
switch i32 %0, label %153 [
i32 128, label %57
i32 129, label %57
i32 130, label %109
]
57: ; preds = %35, %35
%58 = load i32, i32* @QFIXEDSZ
%59 = sub nsw i32 %53, %58
%60 = icmp slt i32 %59, 0
br i1 %60, label %153, label %61
61: ; preds = %57
%62 = call i32 @dn_comp(i8* %1, i32* %52, i32 %59, i32** %54, i32** %56)
%63 = icmp slt i32 %62, 0
br i1 %63, label %153, label %64
64: ; preds = %61
%65 = zext i32 %62 to i64
%66 = getelementptr inbounds i32, i32* %52, i64 %65
%67 = call i32 @__putshort(i32 %3, i32* %66)
%68 = load i32, i32* @INT16SZ
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %66, i64 %69
%71 = call i32 @__putshort(i32 %2, i32* %70)
%72 = load i32, i32* @INT16SZ
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i32, i32* %70, i64 %73
%75 = call i8* @htons(i32 1)
%76 = getelementptr inbounds i32, i32* %7, i64 6
%77 = bitcast i32* %76 to i8**
store i8* %75, i8** %77
%78 = icmp eq i32 %0, 128
%79 = icmp eq i32* %4, null
%80 = or i1 %78, %79
br i1 %80, label %146, label %81
81: ; preds = %64
%82 = load i32, i32* @RRFIXEDSZ
%83 = add i32 %62, %82
%84 = sub i32 %59, %83
%85 = bitcast i32* %4 to i8*
%86 = call i32 @dn_comp(i8* %85, i32* %74, i32 %84, i32** %54, i32** %56)
%87 = icmp slt i32 %86, 0
br i1 %87, label %153, label %88
88: ; preds = %81
%89 = zext i32 %86 to i64
%90 = getelementptr inbounds i32, i32* %74, i64 %89
%91 = load i32, i32* @T_NULL
%92 = call i32 @__putshort(i32 %91, i32* %90)
%93 = load i32, i32* @INT16SZ
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i32, i32* %90, i64 %94
%96 = call i32 @__putshort(i32 %2, i32* %95)
%97 = load i32, i32* @INT16SZ
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i32, i32* %95, i64 %98
%100 = call i32 @__putlong(i32 0, i32* %99)
%101 = load i32, i32* @INT32SZ
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i32, i32* %99, i64 %102
%104 = call i32 @__putshort(i32 0, i32* %103)
%105 = load i32, i32* @INT16SZ
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i32, i32* %103, i64 %106
%108 = call i8* @htons(i32 1)
br label %140
109: ; preds = %35
%110 = load i32, i32* @RRFIXEDSZ
%111 = add i32 %5, 1
%112 = add i32 %111, %110
%113 = icmp slt i32 %53, %112
br i1 %113, label %153, label %114
114: ; preds = %109
%115 = getelementptr inbounds i32, i32* %52, i64 1
store i32 0, i32* %52
%116 = tail call i32 @__putshort(i32 %3, i32* %115)
%117 = load i32, i32* @INT16SZ
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i32, i32* %115, i64 %118
%120 = tail call i32 @__putshort(i32 %2, i32* %119)
%121 = load i32, i32* @INT16SZ
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i32, i32* %119, i64 %122
%124 = tail call i32 @__putlong(i32 0, i32* %123)
%125 = load i32, i32* @INT32SZ
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i32, i32* %123, i64 %126
%128 = tail call i32 @__putshort(i32 %5, i32* %127)
%129 = load i32, i32* @INT16SZ
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i32, i32* %127, i64 %130
%132 = icmp eq i32 %5, 0
br i1 %132, label %137, label %133
133: ; preds = %114
%134 = tail call i32 @memcpy(i32* %131, i32* %4, i32 %5)
%135 = sext i32 %5 to i64
%136 = getelementptr inbounds i32, i32* %131, i64 %135
br label %137
137: ; preds = %133, %114
%138 = phi i32* [ %136, %133 ], [ %131, %114 ]
%139 = tail call i8* @htons(i32 1)
br label %140
140: ; preds = %88, %137
%141 = phi i64 [ 2, %137 ], [ 4, %88 ]
%142 = phi i8* [ %139, %137 ], [ %108, %88 ]
%143 = phi i32* [ %138, %137 ], [ %107, %88 ]
%144 = getelementptr inbounds i32, i32* %7, i64 %141
%145 = bitcast i32* %144 to i8**
store i8* %142, i8** %145
br label %146
146: ; preds = %140, %64
%147 = phi i32* [ %74, %64 ], [ %143, %140 ]
%148 = ptrtoint i32* %147 to i64
%149 = ptrtoint i32* %7 to i64
%150 = sub i64 %148, %149
%151 = lshr exact i64 %150, 2
%152 = trunc i64 %151 to i32
br label %153
153: ; preds = %35, %109, %81, %61, %57, %30, %32, %146, %21
%154 = phi i32 [ -1, %21 ], [ %152, %146 ], [ -1, %32 ], [ -1, %30 ], [ -1, %57 ], [ -1, %61 ], [ -1, %81 ], [ -1, %109 ], [ -1, %35 ]
ret i32 %154
}