#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ qtype_strings;
typedef int /*<<< orphan*/ qtype_codes;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcasecmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
unsigned int strlen(char *);
char *strtok(char *, char *);
int parse_query(char *input, char *qname, unsigned int qnlen, int *qtype) {
  static char *qtype_strings[] = {
      "A",     "NS",         "MD",       "MF",     "CNAME", "SOA",    "MB",
      "MG",    "MR",         "NULL",     "WKS",    "PTR",   "HINFO",  "MINFO",
      "MX",    "TXT",        "RP",       "AFSDB",  "X25",   "ISDN",   "RT",
      "NSAP",  "NSAP-PTR",   "SIG",      "KEY",    "PX",    "GPOS",   "AAAA",
      "LOC",   "NXT",        "EID",      "NIMLOC", "SRV",   "ATMA",   "NAPTR",
      "KX",    "CERT",       "A6",       "DNAME",  "SINK",  "OPT",    "APL",
      "DS",    "SSHFP",      "IPSECKEY", "RRSIG",  "NSEC",  "DNSKEY", "DHCID",
      "NSEC3", "NSEC3PARAM", "TLSA",     "HIP",    "NINFO", "RKEY",   "TALINK",
      "CDS",   "SPF",        "UINFO",    "UID",    "GID",   "UNSPEC", "NID",
      "L32",   "L64",        "LP",       "TKEY",   "TSIG",  "IXFR",   "AXFR",
      "MAILB", "MAILA",      "URI",      "CAA",    "*",     "ANY",    "TA",
      "DLV"};
  static int qtype_codes[] = {
      1,   2,   3,   4,   5,   6,   7,   8,   9,   10,  11,  12,    13,
      14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,    26,
      27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,    39,
      40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,    52,
      55,  56,  57,  58,  59,  99,  100, 101, 102, 103, 104, 105,   106,
      107, 249, 250, 251, 252, 253, 254, 255, 255, 256, 257, 32768, 32769};
  unsigned int num_types, index;
  int found = 0;
  char incopy[512 + 1];
  char *domain_str, *type_str;
  num_types = sizeof(qtype_strings) / sizeof(qtype_strings[0]);
  if (num_types > (sizeof(qtype_codes) / sizeof(int)))
    num_types = sizeof(qtype_codes) / sizeof(int);
  strcpy(incopy, input);
  domain_str = strtok(incopy, " \t\n");
  type_str = strtok(NULL, " \t\n");
  if ((domain_str == NULL) || (type_str == NULL)) {
    fprintf(stderr, "Invalid query input format: %s\n", input);
    return (-1);
  }
  if (strlen(domain_str) > qnlen) {
    fprintf(stderr, "Query domain too long: %s\n", domain_str);
    return (-1);
  }
  for (index = 0; (index < num_types) && (found == 0); index++) {
    if (strcasecmp(type_str, qtype_strings[index]) == 0) {
      *qtype = qtype_codes[index];
      found = 1;
    }
  }
  if (found == 0) {
    fprintf(stderr, "Query type not understood: %s\n", type_str);
    return (-1);
  }
  strcpy(qname, domain_str);
  return (0);
}


x86 assembly (clang, -O0):
<parse_query>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x4e,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    $0x4e,%rax
jbe    118c <parse_query+0x3c>
movl   $0x4e,-0x2c(%rbp)
lea    -0x240(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x240(%rbp),%rdi
lea    0xfab(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x248(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xf94(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x250(%rbp)
cmpq   $0x0,-0x248(%rbp)
je     11e9 <parse_query+0x99>
cmpq   $0x0,-0x250(%rbp)
jne    120e <parse_query+0xbe>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xf5c(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1324 <parse_query+0x1d4>
mov    -0x248(%rbp),%rdi
call   1050 <strlen@plt>
cmp    -0x1c(%rbp),%eax
jbe    124b <parse_query+0xfb>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
mov    -0x248(%rbp),%rdx
lea    0xf3f(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1324 <parse_query+0x1d4>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%ecx
xor    %eax,%eax
cmp    -0x2c(%rbp),%ecx
mov    %al,-0x251(%rbp)
jae    1273 <parse_query+0x123>
cmpl   $0x0,-0x34(%rbp)
sete   %al
mov    %al,-0x251(%rbp)
mov    -0x251(%rbp),%al
test   $0x1,%al
jne    1286 <parse_query+0x136>
jmp    12db <parse_query+0x18b>
mov    -0x250(%rbp),%rdi
mov    -0x30(%rbp),%eax
mov    %eax,%ecx
lea    0x2db7(%rip),%rax
mov    (%rax,%rcx,8),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    12c8 <parse_query+0x178>
mov    -0x30(%rbp),%eax
mov    %eax,%ecx
lea    0x3008(%rip),%rax
mov    (%rax,%rcx,4),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x34(%rbp)
jmp    12cd <parse_query+0x17d>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1252 <parse_query+0x102>
cmpl   $0x0,-0x34(%rbp)
jne    130d <parse_query+0x1bd>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
mov    -0x250(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1324 <parse_query+0x1d4>
mov    -0x18(%rbp),%rdi
mov    -0x248(%rbp),%rsi
call   1040 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_query>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rcx,0x8(%rsp)
mov    %edx,%r13d
mov    %rsi,%r15
mov    %rdi,%rbp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
lea    0x1247(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strtok@plt>
mov    %rax,%r12
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <strtok@plt>
test   %r12,%r12
je     11cd <parse_query+0x7d>
mov    %rax,%r14
test   %rax,%rax
je     11cd <parse_query+0x7d>
mov    %r12,%rdi
call   1050 <strlen@plt>
cmp    %r13d,%eax
jbe    11e2 <parse_query+0x92>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
lea    0x1229(%rip),%rsi
mov    %r12,%rdx
jmp    122b <parse_query+0xdb>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
lea    0x11f4(%rip),%rsi
mov    %rbp,%rdx
jmp    122b <parse_query+0xdb>
xor    %ebp,%ebp
lea    0xe15(%rip),%r13
xor    %ebx,%ebx
nopl   (%rax)
movslq 0x0(%rbp,%r13,1),%rsi
add    %r13,%rsi
mov    %r14,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1247 <parse_query+0xf7>
je     1218 <parse_query+0xc8>
lea    0x1(%rbx),%rax
add    $0x4,%rbp
cmp    $0x4d,%rbx
mov    %rax,%rbx
jb     11f0 <parse_query+0xa0>
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
lea    0x11e4(%rip),%rsi
mov    %r14,%rdx
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xef2(%rip),%rax
mov    0x0(%rbp,%rax,1),%eax
mov    0x8(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
xor    %eax,%eax
jmp    1235 <parse_query+0xe5>

LLVM IR (-O0):
@parse_query.qtype_strings = internal global [78 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.31, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.32, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.33, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.34, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.35, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.36, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.38, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.39, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.40, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.41, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.42, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.43, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.44, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.45, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.46, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.47, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.48, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.49, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.50, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.51, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.52, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.53, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.54, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.55, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.56, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.57, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.58, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.59, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.60, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.61, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.62, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.63, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.64, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.65, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.66, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.67, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.68, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.69, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.70, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.71, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.72, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.73, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.74, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.75, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.76, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.77, i32 0, i32 0)]
@.str = [2 x i8] c"A\00"
@.str.1 = [3 x i8] c"NS\00"
@.str.2 = [3 x i8] c"MD\00"
@.str.3 = [3 x i8] c"MF\00"
@.str.4 = [6 x i8] c"CNAME\00"
@.str.5 = [4 x i8] c"SOA\00"
@.str.6 = [3 x i8] c"MB\00"
@.str.7 = [3 x i8] c"MG\00"
@.str.8 = [3 x i8] c"MR\00"
@.str.9 = [5 x i8] c"NULL\00"
@.str.10 = [4 x i8] c"WKS\00"
@.str.11 = [4 x i8] c"PTR\00"
@.str.12 = [6 x i8] c"HINFO\00"
@.str.13 = [6 x i8] c"MINFO\00"
@.str.14 = [3 x i8] c"MX\00"
@.str.15 = [4 x i8] c"TXT\00"
@.str.16 = [3 x i8] c"RP\00"
@.str.17 = [6 x i8] c"AFSDB\00"
@.str.18 = [4 x i8] c"X25\00"
@.str.19 = [5 x i8] c"ISDN\00"
@.str.20 = [3 x i8] c"RT\00"
@.str.21 = [5 x i8] c"NSAP\00"
@.str.22 = [9 x i8] c"NSAP-PTR\00"
@.str.23 = [4 x i8] c"SIG\00"
@.str.24 = [4 x i8] c"KEY\00"
@.str.25 = [3 x i8] c"PX\00"
@.str.26 = [5 x i8] c"GPOS\00"
@.str.27 = [5 x i8] c"AAAA\00"
@.str.28 = [4 x i8] c"LOC\00"
@.str.29 = [4 x i8] c"NXT\00"
@.str.30 = [4 x i8] c"EID\00"
@.str.31 = [7 x i8] c"NIMLOC\00"
@.str.32 = [4 x i8] c"SRV\00"
@.str.33 = [5 x i8] c"ATMA\00"
@.str.34 = [6 x i8] c"NAPTR\00"
@.str.35 = [3 x i8] c"KX\00"
@.str.36 = [5 x i8] c"CERT\00"
@.str.37 = [3 x i8] c"A6\00"
@.str.38 = [6 x i8] c"DNAME\00"
@.str.39 = [5 x i8] c"SINK\00"
@.str.40 = [4 x i8] c"OPT\00"
@.str.41 = [4 x i8] c"APL\00"
@.str.42 = [3 x i8] c"DS\00"
@.str.43 = [6 x i8] c"SSHFP\00"
@.str.44 = [9 x i8] c"IPSECKEY\00"
@.str.45 = [6 x i8] c"RRSIG\00"
@.str.46 = [5 x i8] c"NSEC\00"
@.str.47 = [7 x i8] c"DNSKEY\00"
@.str.48 = [6 x i8] c"DHCID\00"
@.str.49 = [6 x i8] c"NSEC3\00"
@.str.50 = [11 x i8] c"NSEC3PARAM\00"
@.str.51 = [5 x i8] c"TLSA\00"
@.str.52 = [4 x i8] c"HIP\00"
@.str.53 = [6 x i8] c"NINFO\00"
@.str.54 = [5 x i8] c"RKEY\00"
@.str.55 = [7 x i8] c"TALINK\00"
@.str.56 = [4 x i8] c"CDS\00"
@.str.57 = [4 x i8] c"SPF\00"
@.str.58 = [6 x i8] c"UINFO\00"
@.str.59 = [4 x i8] c"UID\00"
@.str.60 = [4 x i8] c"GID\00"
@.str.61 = [7 x i8] c"UNSPEC\00"
@.str.62 = [4 x i8] c"NID\00"
@.str.63 = [4 x i8] c"L32\00"
@.str.64 = [4 x i8] c"L64\00"
@.str.65 = [3 x i8] c"LP\00"
@.str.66 = [5 x i8] c"TKEY\00"
@.str.67 = [5 x i8] c"TSIG\00"
@.str.68 = [5 x i8] c"IXFR\00"
@.str.69 = [5 x i8] c"AXFR\00"
@.str.70 = [6 x i8] c"MAILB\00"
@.str.71 = [6 x i8] c"MAILA\00"
@.str.72 = [4 x i8] c"URI\00"
@.str.73 = [4 x i8] c"CAA\00"
@.str.74 = [2 x i8] c"*\00"
@.str.75 = [4 x i8] c"ANY\00"
@.str.76 = [3 x i8] c"TA\00"
@.str.77 = [4 x i8] c"DLV\00"
@parse_query.qtype_codes = internal global [78 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 55, i32 56, i32 57, i32 58, i32 59, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 107, i32 249, i32 250, i32 251, i32 252, i32 253, i32 254, i32 255, i32 255, i32 256, i32 257, i32 32768, i32 32769]
@.str.78 = [4 x i8] c" \09\0A\00"
@stderr = global i32 0
@.str.79 = [32 x i8] c"Invalid query input format: %s\0A\00"
@.str.80 = [27 x i8] c"Query domain too long: %s\0A\00"
@.str.81 = [31 x i8] c"Query type not understood: %s\0A\00"
define i32 @parse_query(i8* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [513 x i8]
%14 = alloca i8*
%15 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i32 0, i32* %12
store i32 78, i32* %10
%16 = load i32, i32* %10
%17 = zext i32 %16 to i64
%18 = icmp ugt i64 %17, 78
br i1 %18, label %19, label %20
19: ; preds = %4
store i32 78, i32* %10
br label %20
20: ; preds = %19, %4
%21 = getelementptr inbounds [513 x i8], [513 x i8]* %13, i64 0, i64 0
%22 = load i8*, i8** %6
%23 = call i32 @strcpy(i8* %21, i8* %22)
%24 = getelementptr inbounds [513 x i8], [513 x i8]* %13, i64 0, i64 0
%25 = call i8* @strtok(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.78, i64 0, i64 0))
store i8* %25, i8** %14
%26 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.78, i64 0, i64 0))
store i8* %26, i8** %15
%27 = load i8*, i8** %14
%28 = icmp eq i8* %27, null
br i1 %28, label %32, label %29
29: ; preds = %20
%30 = load i8*, i8** %15
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %36
32: ; preds = %29, %20
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %6
%35 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.79, i64 0, i64 0), i8* %34)
store i32 -1, i32* %5
br label %84
36: ; preds = %29
%37 = load i8*, i8** %14
%38 = call i32 @strlen(i8* %37)
%39 = load i32, i32* %8
%40 = icmp ugt i32 %38, %39
br i1 %40, label %41, label %45
41: ; preds = %36
%42 = load i32, i32* @stderr
%43 = load i8*, i8** %14
%44 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.80, i64 0, i64 0), i8* %43)
store i32 -1, i32* %5
br label %84
45: ; preds = %36
store i32 0, i32* %11
br label %46
46: ; preds = %70, %45
%47 = load i32, i32* %11
%48 = load i32, i32* %10
%49 = icmp ult i32 %47, %48
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = load i32, i32* %12
%52 = icmp eq i32 %51, 0
br label %53
53: ; preds = %50, %46
%54 = phi i1 [ false, %46 ], [ %52, %50 ]
br i1 %54, label %55, label %73
55: ; preds = %53
%56 = load i8*, i8** %15
%57 = load i32, i32* %11
%58 = zext i32 %57 to i64
%59 = getelementptr inbounds [78 x i8*], [78 x i8*]* @parse_query.qtype_strings, i64 0, i64 %58
%60 = load i8*, i8** %59
%61 = call i64 @strcasecmp(i8* %56, i8* %60)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %69
63: ; preds = %55
%64 = load i32, i32* %11
%65 = zext i32 %64 to i64
%66 = getelementptr inbounds [78 x i32], [78 x i32]* @parse_query.qtype_codes, i64 0, i64 %65
%67 = load i32, i32* %66
%68 = load i32*, i32** %9
store i32 %67, i32* %68
store i32 1, i32* %12
br label %69
69: ; preds = %63, %55
br label %70
70: ; preds = %69
%71 = load i32, i32* %11
%72 = add i32 %71, 1
store i32 %72, i32* %11
br label %46
73: ; preds = %53
%74 = load i32, i32* %12
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %73
%77 = load i32, i32* @stderr
%78 = load i8*, i8** %15
%79 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.81, i64 0, i64 0), i8* %78)
store i32 -1, i32* %5
br label %84
80: ; preds = %73
%81 = load i8*, i8** %7
%82 = load i8*, i8** %14
%83 = call i32 @strcpy(i8* %81, i8* %82)
store i32 0, i32* %5
br label %84
84: ; preds = %80, %76, %41, %32
%85 = load i32, i32* %5
ret i32 %85
}

LLVM IR (-O2):
@reltable.parse_query = internal unnamed_addr constant [78 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.4 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.6 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.7 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.8 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.9 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.12 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.13 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.14 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.15 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.16 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.17 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.18 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.19 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.20 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.21 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.22 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.23 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.24 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.25 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.26 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.27 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.28 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.29 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.30 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.31 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.32 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.33 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.34 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.35 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.36 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.37 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.38 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.39 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.40 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.41 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.42 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.43 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.44 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.45 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.46 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.47 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.48 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.49 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.50 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.51 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.52 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.53 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.54 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.55 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.56 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.57 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.58 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.59 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.60 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.61 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.62 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.63 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.64 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.65 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.66 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.67 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.68 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.69 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.70 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.71 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.72 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.73 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.74 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.75 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.76 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.77 to i64), i64 ptrtoint ([78 x i32]* @reltable.parse_query to i64)) to i32)]
@.str = [2 x i8] c"A\00"
@.str.1 = [3 x i8] c"NS\00"
@.str.2 = [3 x i8] c"MD\00"
@.str.3 = [3 x i8] c"MF\00"
@.str.4 = [6 x i8] c"CNAME\00"
@.str.5 = [4 x i8] c"SOA\00"
@.str.6 = [3 x i8] c"MB\00"
@.str.7 = [3 x i8] c"MG\00"
@.str.8 = [3 x i8] c"MR\00"
@.str.9 = [5 x i8] c"NULL\00"
@.str.10 = [4 x i8] c"WKS\00"
@.str.11 = [4 x i8] c"PTR\00"
@.str.12 = [6 x i8] c"HINFO\00"
@.str.13 = [6 x i8] c"MINFO\00"
@.str.14 = [3 x i8] c"MX\00"
@.str.15 = [4 x i8] c"TXT\00"
@.str.16 = [3 x i8] c"RP\00"
@.str.17 = [6 x i8] c"AFSDB\00"
@.str.18 = [4 x i8] c"X25\00"
@.str.19 = [5 x i8] c"ISDN\00"
@.str.20 = [3 x i8] c"RT\00"
@.str.21 = [5 x i8] c"NSAP\00"
@.str.22 = [9 x i8] c"NSAP-PTR\00"
@.str.23 = [4 x i8] c"SIG\00"
@.str.24 = [4 x i8] c"KEY\00"
@.str.25 = [3 x i8] c"PX\00"
@.str.26 = [5 x i8] c"GPOS\00"
@.str.27 = [5 x i8] c"AAAA\00"
@.str.28 = [4 x i8] c"LOC\00"
@.str.29 = [4 x i8] c"NXT\00"
@.str.30 = [4 x i8] c"EID\00"
@.str.31 = [7 x i8] c"NIMLOC\00"
@.str.32 = [4 x i8] c"SRV\00"
@.str.33 = [5 x i8] c"ATMA\00"
@.str.34 = [6 x i8] c"NAPTR\00"
@.str.35 = [3 x i8] c"KX\00"
@.str.36 = [5 x i8] c"CERT\00"
@.str.37 = [3 x i8] c"A6\00"
@.str.38 = [6 x i8] c"DNAME\00"
@.str.39 = [5 x i8] c"SINK\00"
@.str.40 = [4 x i8] c"OPT\00"
@.str.41 = [4 x i8] c"APL\00"
@.str.42 = [3 x i8] c"DS\00"
@.str.43 = [6 x i8] c"SSHFP\00"
@.str.44 = [9 x i8] c"IPSECKEY\00"
@.str.45 = [6 x i8] c"RRSIG\00"
@.str.46 = [5 x i8] c"NSEC\00"
@.str.47 = [7 x i8] c"DNSKEY\00"
@.str.48 = [6 x i8] c"DHCID\00"
@.str.49 = [6 x i8] c"NSEC3\00"
@.str.50 = [11 x i8] c"NSEC3PARAM\00"
@.str.51 = [5 x i8] c"TLSA\00"
@.str.52 = [4 x i8] c"HIP\00"
@.str.53 = [6 x i8] c"NINFO\00"
@.str.54 = [5 x i8] c"RKEY\00"
@.str.55 = [7 x i8] c"TALINK\00"
@.str.56 = [4 x i8] c"CDS\00"
@.str.57 = [4 x i8] c"SPF\00"
@.str.58 = [6 x i8] c"UINFO\00"
@.str.59 = [4 x i8] c"UID\00"
@.str.60 = [4 x i8] c"GID\00"
@.str.61 = [7 x i8] c"UNSPEC\00"
@.str.62 = [4 x i8] c"NID\00"
@.str.63 = [4 x i8] c"L32\00"
@.str.64 = [4 x i8] c"L64\00"
@.str.65 = [3 x i8] c"LP\00"
@.str.66 = [5 x i8] c"TKEY\00"
@.str.67 = [5 x i8] c"TSIG\00"
@.str.68 = [5 x i8] c"IXFR\00"
@.str.69 = [5 x i8] c"AXFR\00"
@.str.70 = [6 x i8] c"MAILB\00"
@.str.71 = [6 x i8] c"MAILA\00"
@.str.72 = [4 x i8] c"URI\00"
@.str.73 = [4 x i8] c"CAA\00"
@.str.74 = [2 x i8] c"*\00"
@.str.75 = [4 x i8] c"ANY\00"
@.str.76 = [3 x i8] c"TA\00"
@.str.77 = [4 x i8] c"DLV\00"
@parse_query.qtype_codes = internal unnamed_addr constant [78 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 55, i32 56, i32 57, i32 58, i32 59, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 107, i32 249, i32 250, i32 251, i32 252, i32 253, i32 254, i32 255, i32 255, i32 256, i32 257, i32 32768, i32 32769]
@.str.78 = [4 x i8] c" \09\0A\00"
@stderr = global i32 0
@.str.79 = [32 x i8] c"Invalid query input format: %s\0A\00"
@.str.80 = [27 x i8] c"Query domain too long: %s\0A\00"
@.str.81 = [31 x i8] c"Query type not understood: %s\0A\00"
define i32 @parse_query(i8* %0, i8* %1, i32 %2, i32* nocapture writeonly %3) {
%5 = alloca [513 x i8]
%6 = getelementptr inbounds [513 x i8], [513 x i8]* %5, i64 0, i64 0
%7 = call i32 @strcpy(i8* %6, i8* %0)
%8 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.78, i64 0, i64 0))
%9 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.78, i64 0, i64 0))
%10 = icmp eq i8* %8, null
%11 = icmp eq i8* %9, null
%12 = select i1 %10, i1 true, i1 %11
br i1 %12, label %13, label %16
13: ; preds = %4
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.79, i64 0, i64 0), i8* %0)
br label %39
16: ; preds = %4
%17 = call i32 @strlen(i8* %8)
%18 = icmp ugt i32 %17, %2
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.80, i64 0, i64 0), i8* %8)
br label %39
22: ; preds = %16, %28
%23 = phi i64 [ %29, %28 ], [ 0, %16 ]
%24 = shl i64 %23, 2
%25 = call i8* @llvm.load.relative.i64(i8* bitcast ([78 x i32]* @reltable.parse_query to i8*), i64 %24)
%26 = call i64 @strcasecmp(i8* %9, i8* %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %35, label %28
28: ; preds = %22
%29 = add nuw nsw i64 %23, 1
%30 = icmp ugt i64 %23, 76
%31 = or i1 %27, %30
br i1 %31, label %32, label %22
32: ; preds = %28
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.81, i64 0, i64 0), i8* %9)
br label %39
35: ; preds = %22
%36 = getelementptr inbounds [78 x i32], [78 x i32]* @parse_query.qtype_codes, i64 0, i64 %23
%37 = load i32, i32* %36
store i32 %37, i32* %3
%38 = call i32 @strcpy(i8* %1, i8* %8)
br label %39
39: ; preds = %35, %32, %19, %13
%40 = phi i32 [ -1, %13 ], [ -1, %19 ], [ -1, %32 ], [ 0, %35 ]
ret i32 %40
}