#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 */

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int *calloc(int /*<<< orphan*/, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ isalpha(char);
scalar_t__ isupper(char);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int read(int, unsigned char *, int);
int *realloc(int *, int);
int strlen(char const *);
int *relSearch16Bit(char *filePath, char *strToSearch, bool bigEndian) {
  int *result = calloc(0, sizeof(int));
  int *temp;
  int fd, fo, so, co, cid;
  int value;
  unsigned char *lastByte = NULL;
  int strLength = strlen(strToSearch);
  int lastCLen, newCLen;
  int *cLen = NULL;
  int upperA, lowerA;
  int *a = NULL;
  int nbOfResults = 0;
  unsigned char lastChunk[1024], newChunk[1024];
  unsigned char *chunk = NULL;
  unsigned char charIndex[strLength];
  for (unsigned char x = 0; x < strLength; x++) {
    if (!isalpha(strToSearch[x])) {
      charIndex[x] = 0xFF;
    } else {
      if (isupper(strToSearch[x])) {
        charIndex[x] = strToSearch[x] - 65;
      } else {
        charIndex[x] = strToSearch[x] - 97;
      }
    }
  }
  fd = open(filePath, O_RDONLY);
  cid = 0;
  fo = 1;
  co = 1;
  so = 0;
  upperA = -1;
  lowerA = -1;
  while (true) {
    if (cid == 0) {
      newCLen = read(fd, &newChunk[1], 1024 - 1);
      if (newCLen == 0)
        break;
      if (lastByte != NULL) {
        newChunk[0] = *lastByte;
        lastByte = NULL;
      }
      newCLen += 1;
      cLen = &newCLen;
      chunk = newChunk;
    }
    while (co < *cLen - 1) {
      if (charIndex[so] != 0xFF) {
        if (bigEndian) {
          value = (*(chunk + co) << 8) | (*(chunk + co + 1) & 0xff);
        } else {
          value = (*(chunk + co + 1) << 8) | (*(chunk + co) & 0xff);
        }
        if (isupper(strToSearch[so])) {
          if (upperA == -1) {
            upperA = value - charIndex[so];
          }
          a = &upperA;
        } else {
          if (lowerA == -1) {
            lowerA = value - charIndex[so];
          }
          a = &lowerA;
        }
      }
      if (charIndex[so] == 0xFF || ((*a >= 0) && value - *a == charIndex[so])) {
        so += 1;
        if (so == strLength) {
          nbOfResults += 1;
          temp = realloc(result, (nbOfResults * 3 + 1) * sizeof(int));
          if (temp == NULL) {
            printf("Failed to allocate memory for search results.\n");
            exit(0);
          }
          result[(nbOfResults - 1) * 3 + 1] = fo - (so * 2 - 1);
          result[(nbOfResults - 1) * 3 + 2] = upperA;
          result[(nbOfResults - 1) * 3 + 3] = lowerA;
          so = 0;
          upperA = -1;
          lowerA = -1;
        }
      } else {
        co -= so * 2 + 1;
        fo -= so * 2 + 1;
        so = 0;
        upperA = -1;
        lowerA = -1;
        if (co < -2) {
          fo += 2;
          co += 1024 + 1;
          cid = -1;
          chunk = lastChunk;
          cLen = &lastCLen;
          break;
        }
      }
      fo += 2;
      co += 2;
    }
    if (cid == -1) {
      cid = 1;
    } else if (cid == 0) {
      memcpy(lastChunk, newChunk, strlen((const char *)newChunk));
      lastCLen = newCLen;
      lastByte = &chunk[1024 - 1];
      co -= 1024 - 1;
    } else if (cid == 1) {
      cid = 2;
      co -= 1024 - 1;
      chunk = newChunk;
      cLen = &newCLen;
    } else if (cid == 2) {
      cid = 0;
      co -= 1024 - 1;
    }
  }
  result[0] = nbOfResults;
  return result;
}


x86 assembly (clang, -O0):
<relSearch16Bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %edi,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4c(%rbp)
movq   $0x0,-0x60(%rbp)
movq   $0x0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
movq   $0x0,-0x888(%rbp)
mov    -0x4c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x890(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x8a8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x898(%rbp)
movb   $0x0,-0x899(%rbp)
movzbl -0x899(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    1300 <relSearch16Bit+0x160>
mov    -0x10(%rbp),%rax
movzbl -0x899(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1090 <isalpha@plt>
cmp    $0x0,%eax
jne    1276 <relSearch16Bit+0xd6>
mov    -0x8a8(%rbp),%rax
movzbl -0x899(%rbp),%ecx
movb   $0xff,(%rax,%rcx,1)
jmp    12e8 <relSearch16Bit+0x148>
mov    -0x10(%rbp),%rax
movzbl -0x899(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   10a0 <isupper@plt>
cmp    $0x0,%rax
je     12be <relSearch16Bit+0x11e>
mov    -0x8a8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movzbl -0x899(%rbp),%edx
movsbl (%rcx,%rdx,1),%ecx
sub    $0x41,%ecx
mov    %cl,%dl
movzbl -0x899(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
jmp    12e3 <relSearch16Bit+0x143>
mov    -0x8a8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movzbl -0x899(%rbp),%edx
movsbl (%rcx,%rdx,1),%ecx
sub    $0x61,%ecx
mov    %cl,%dl
movzbl -0x899(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
jmp    12e8 <relSearch16Bit+0x148>
jmp    12ed <relSearch16Bit+0x14d>
mov    -0x899(%rbp),%al
add    $0x1,%al
mov    %al,-0x899(%rbp)
jmp    1232 <relSearch16Bit+0x92>
mov    -0x8(%rbp),%rdi
mov    0x2cdd(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x1,-0x30(%rbp)
movl   $0x1,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0xffffffff,-0x64(%rbp)
movl   $0xffffffff,-0x68(%rbp)
jmp    1344 <relSearch16Bit+0x1a4>
cmpl   $0x0,-0x3c(%rbp)
jne    13b6 <relSearch16Bit+0x216>
mov    -0x2c(%rbp),%edi
lea    -0x880(%rbp),%rsi
add    $0x1,%rsi
mov    $0x3ff,%edx
call   1050 <read@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    1378 <relSearch16Bit+0x1d8>
jmp    1756 <relSearch16Bit+0x5b6>
cmpq   $0x0,-0x48(%rbp)
je     1397 <relSearch16Bit+0x1f7>
mov    -0x48(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x880(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
lea    -0x54(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x880(%rbp),%rax
mov    %rax,-0x888(%rbp)
jmp    13bb <relSearch16Bit+0x21b>
mov    -0x38(%rbp),%eax
mov    -0x60(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    166b <relSearch16Bit+0x4cb>
mov    -0x8a8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0xff,%eax
je     14c9 <relSearch16Bit+0x329>
cmpl   $0x0,-0x14(%rbp)
je     1425 <relSearch16Bit+0x285>
mov    -0x888(%rbp),%rax
movslq -0x38(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
shl    $0x8,%eax
mov    -0x888(%rbp),%rcx
movslq -0x38(%rbp),%rdx
movzbl 0x1(%rcx,%rdx,1),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %eax,-0x40(%rbp)
jmp    1452 <relSearch16Bit+0x2b2>
mov    -0x888(%rbp),%rax
movslq -0x38(%rbp),%rcx
movzbl 0x1(%rax,%rcx,1),%eax
shl    $0x8,%eax
mov    -0x888(%rbp),%rcx
movslq -0x38(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   10a0 <isupper@plt>
cmp    $0x0,%rax
je     149b <relSearch16Bit+0x2fb>
cmpl   $0xffffffff,-0x64(%rbp)
jne    148e <relSearch16Bit+0x2ee>
mov    -0x8a8(%rbp),%rcx
mov    -0x40(%rbp),%eax
movslq -0x34(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
sub    %ecx,%eax
mov    %eax,-0x64(%rbp)
lea    -0x64(%rbp),%rax
mov    %rax,-0x70(%rbp)
jmp    14c4 <relSearch16Bit+0x324>
cmpl   $0xffffffff,-0x68(%rbp)
jne    14bc <relSearch16Bit+0x31c>
mov    -0x8a8(%rbp),%rcx
mov    -0x40(%rbp),%eax
movslq -0x34(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
sub    %ecx,%eax
mov    %eax,-0x68(%rbp)
lea    -0x68(%rbp),%rax
mov    %rax,-0x70(%rbp)
jmp    14c9 <relSearch16Bit+0x329>
mov    -0x8a8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0xff,%eax
je     1510 <relSearch16Bit+0x370>
mov    -0x70(%rbp),%rax
cmpl   $0x0,(%rax)
jl     15d8 <relSearch16Bit+0x438>
mov    -0x8a8(%rbp),%rcx
mov    -0x40(%rbp),%eax
mov    -0x70(%rbp),%rdx
sub    (%rdx),%eax
movslq -0x34(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    15d8 <relSearch16Bit+0x438>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jne    15d3 <relSearch16Bit+0x433>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
mov    -0x20(%rbp),%rdi
imul   $0x3,-0x74(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%esi
call   1080 <realloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1568 <relSearch16Bit+0x3c8>
lea    0xaa4(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
mov    -0x30(%rbp),%edx
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
sub    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    $0x1,%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x64(%rbp),%edx
mov    -0x20(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    $0x1,%ecx
imul   $0x3,%ecx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x68(%rbp),%edx
mov    -0x20(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    $0x1,%ecx
imul   $0x3,%ecx,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0x34(%rbp)
movl   $0xffffffff,-0x64(%rbp)
movl   $0xffffffff,-0x68(%rbp)
jmp    1654 <relSearch16Bit+0x4b4>
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
mov    -0x38(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
mov    -0x30(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0xffffffff,-0x64(%rbp)
movl   $0xffffffff,-0x68(%rbp)
cmpl   $0xfffffffe,-0x38(%rbp)
jge    164f <relSearch16Bit+0x4af>
mov    -0x30(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x30(%rbp)
mov    -0x38(%rbp),%eax
add    $0x401,%eax
mov    %eax,-0x38(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
lea    -0x480(%rbp),%rax
mov    %rax,-0x888(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    166b <relSearch16Bit+0x4cb>
jmp    1654 <relSearch16Bit+0x4b4>
mov    -0x30(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x30(%rbp)
mov    -0x38(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x38(%rbp)
jmp    13bb <relSearch16Bit+0x21b>
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1681 <relSearch16Bit+0x4e1>
movl   $0x1,-0x3c(%rbp)
jmp    1751 <relSearch16Bit+0x5b1>
cmpl   $0x0,-0x3c(%rbp)
jne    16ef <relSearch16Bit+0x54f>
lea    -0x480(%rbp),%rax
mov    %rax,-0x8b8(%rbp)
lea    -0x880(%rbp),%rax
mov    %rax,-0x8b0(%rbp)
lea    -0x880(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x8b8(%rbp),%rdi
mov    -0x8b0(%rbp),%rsi
mov    %eax,%edx
call   1070 <memcpy@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x888(%rbp),%rax
add    $0x3ff,%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%eax
sub    $0x3ff,%eax
mov    %eax,-0x38(%rbp)
jmp    174c <relSearch16Bit+0x5ac>
cmpl   $0x1,-0x3c(%rbp)
jne    1726 <relSearch16Bit+0x586>
movl   $0x2,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
sub    $0x3ff,%eax
mov    %eax,-0x38(%rbp)
lea    -0x880(%rbp),%rax
mov    %rax,-0x888(%rbp)
lea    -0x54(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    1747 <relSearch16Bit+0x5a7>
cmpl   $0x2,-0x3c(%rbp)
jne    1742 <relSearch16Bit+0x5a2>
movl   $0x0,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
sub    $0x3ff,%eax
mov    %eax,-0x38(%rbp)
jmp    1747 <relSearch16Bit+0x5a7>
jmp    174c <relSearch16Bit+0x5ac>
jmp    1751 <relSearch16Bit+0x5b1>
jmp    133f <relSearch16Bit+0x19f>
mov    -0x74(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x890(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relSearch16Bit>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x888,%rsp
mov    %edx,-0x68(%rbp)
mov    %rsi,%r14
mov    %rdi,%r12
xor    %edi,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rsp,-0x90(%rbp)
mov    %eax,%ecx
mov    %rsp,%rdx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rdx
mov    %rdx,-0x88(%rbp)
mov    %rdx,%rsp
mov    %rax,%rcx
mov    %rax,-0x60(%rbp)
test   %eax,%eax
jle    1265 <relSearch16Bit+0xc5>
xor    %eax,%eax
jmp    1227 <relSearch16Bit+0x87>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xff,%cl
mov    -0x88(%rbp),%rax
mov    %cl,(%rax,%rbx,1)
lea    0x1(%rbx),%eax
movzbl %al,%ecx
cmp    %ecx,-0x60(%rbp)
jle    1265 <relSearch16Bit+0xc5>
movzbl %al,%ebx
movsbl (%r14,%rbx,1),%edi
call   1090 <isalpha@plt>
test   %eax,%eax
je     1210 <relSearch16Bit+0x70>
movsbl (%r14,%rbx,1),%edi
call   10a0 <isupper@plt>
movzbl (%r14,%rbx,1),%ecx
test   %rax,%rax
je     1260 <relSearch16Bit+0xc0>
add    $0xbf,%cl
jmp    1212 <relSearch16Bit+0x72>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x9f,%cl
jmp    1212 <relSearch16Bit+0x72>
mov    %r15,-0x80(%rbp)
mov    %r14,-0xa8(%rbp)
mov    0x2d71(%rip),%rax
mov    (%rax),%esi
mov    %r12,%rdi
call   10b0 <open@plt>
mov    %eax,-0x64(%rbp)
movl   $0xffffffff,-0x30(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
mov    -0x60(%rbp),%rax
add    %eax,%eax
neg    %eax
mov    %rax,-0xa0(%rbp)
mov    $0x1,%r14d
xor    %ebx,%ebx
movl   $0xffffffff,-0x34(%rbp)
movl   $0xffffffff,-0x38(%rbp)
xor    %r12d,%r12d
xor    %eax,%eax
mov    %rax,-0x58(%rbp)
xor    %r13d,%r13d
xor    %eax,%eax
mov    %rax,-0x50(%rbp)
xor    %edx,%edx
mov    $0x1,%r15d
jmp    1310 <relSearch16Bit+0x170>
add    $0x2,%r15d
add    $0x401,%r14d
xor    %edx,%edx
mov    $0x1,%ebx
movl   $0xffffffff,-0x34(%rbp)
movl   $0xffffffff,-0x38(%rbp)
lea    -0x6c(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    %r12d,%r13d
lea    -0x8b0(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x78(%rbp),%r12
nopl   (%rax)
test   %ebx,%ebx
je     1320 <relSearch16Bit+0x180>
mov    -0x58(%rbp),%rax
mov    (%rax),%eax
jmp    1372 <relSearch16Bit+0x1d2>
nopl   0x0(%rax)
mov    %rdx,-0x48(%rbp)
mov    -0x64(%rbp),%edi
lea    -0x4af(%rbp),%rsi
mov    $0x3ff,%edx
call   1050 <read@plt>
mov    %eax,-0x3c(%rbp)
test   %eax,%eax
je     1596 <relSearch16Bit+0x3f6>
test   %r12,%r12
je     1352 <relSearch16Bit+0x1b2>
mov    (%r12),%cl
mov    %cl,-0x4b0(%rbp)
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
xor    %r12d,%r12d
lea    -0x3c(%rbp),%rcx
mov    %rcx,-0x58(%rbp)
lea    -0x4b0(%rbp),%rcx
mov    %rcx,-0x50(%rbp)
mov    -0x48(%rbp),%rdx
mov    %r12,-0x78(%rbp)
mov    %rbx,-0x98(%rbp)
add    $0xffffffff,%eax
cmp    %eax,%r14d
jge    1510 <relSearch16Bit+0x370>
mov    %r13d,%r12d
jmp    13e4 <relSearch16Bit+0x244>
xchg   %ax,%ax
lea    (%rdx,%rdx,1),%eax
add    $0x1,%eax
sub    %eax,%r14d
sub    %eax,%r15d
movl   $0xffffffff,-0x30(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
cmp    $0xfffffffd,%r14d
jle    12d3 <relSearch16Bit+0x133>
xor    %edx,%edx
movl   $0xffffffff,-0x34(%rbp)
movl   $0xffffffff,-0x38(%rbp)
mov    %r12d,%r13d
add    $0x2,%r15d
add    $0x2,%r14d
mov    -0x58(%rbp),%rax
mov    (%rax),%eax
add    $0xffffffff,%eax
mov    %r13d,%r12d
cmp    %eax,%r14d
jge    1510 <relSearch16Bit+0x370>
movslq %edx,%rax
mov    -0x88(%rbp),%rcx
movzbl (%rcx,%rax,1),%ebx
cmp    $0xff,%ebx
je     148f <relSearch16Bit+0x2ef>
mov    %rdx,-0x48(%rbp)
movslq %r14d,%rcx
mov    -0x50(%rbp),%rsi
lea    (%rsi,%rcx,1),%rdx
cmpl   $0x0,-0x68(%rbp)
lea    0x1(%rsi,%rcx,1),%rcx
mov    %rcx,%rsi
cmove  %rdx,%rsi
cmovne %rdx,%rcx
movzbl (%rcx),%ecx
shl    $0x8,%ecx
movzbl (%rsi),%r13d
or     %ecx,%r13d
mov    -0xa8(%rbp),%rcx
movsbl (%rcx,%rax,1),%edi
call   10a0 <isupper@plt>
test   %rax,%rax
je     1460 <relSearch16Bit+0x2c0>
cmpl   $0xffffffff,-0x38(%rbp)
jne    1454 <relSearch16Bit+0x2b4>
mov    %r13d,%eax
sub    %ebx,%eax
mov    %eax,-0x38(%rbp)
mov    %eax,-0x30(%rbp)
lea    -0x30(%rbp),%rax
jmp    1475 <relSearch16Bit+0x2d5>
nopw   0x0(%rax,%rax,1)
cmpl   $0xffffffff,-0x34(%rbp)
jne    1471 <relSearch16Bit+0x2d1>
mov    %r13d,%eax
sub    %ebx,%eax
mov    %eax,-0x34(%rbp)
mov    %eax,-0x2c(%rbp)
lea    -0x2c(%rbp),%rax
mov    -0x48(%rbp),%rdx
mov    (%rax),%eax
test   %eax,%eax
js     1390 <relSearch16Bit+0x1f0>
sub    %eax,%r13d
cmp    %ebx,%r13d
jne    1390 <relSearch16Bit+0x1f0>
add    $0x1,%edx
cmp    -0x60(%rbp),%edx
jne    13c4 <relSearch16Bit+0x224>
lea    0x1(%r12),%r13d
lea    0x0(%r13,%r13,2),%eax
lea    0x4(,%rax,4),%esi
mov    -0x80(%rbp),%rbx
mov    %rbx,%rdi
call   1080 <realloc@plt>
test   %rax,%rax
je     15b3 <relSearch16Bit+0x413>
mov    -0xa0(%rbp),%rax
add    %r15d,%eax
add    $0x1,%eax
lea    (%r12,%r12,2),%ecx
movslq %ecx,%rcx
mov    %eax,0x4(%rbx,%rcx,4)
mov    -0x30(%rbp),%eax
mov    %eax,0x8(%rbx,%rcx,4)
mov    -0x2c(%rbp),%eax
mov    %eax,0xc(%rbx,%rcx,4)
movl   $0xffffffff,-0x30(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
xor    %edx,%edx
movl   $0xffffffff,-0x34(%rbp)
movl   $0xffffffff,-0x38(%rbp)
jmp    13c7 <relSearch16Bit+0x227>
nopw   0x0(%rax,%rax,1)
mov    -0x98(%rbp),%rbx
cmp    $0x2,%ebx
mov    -0x78(%rbp),%r12
je     1564 <relSearch16Bit+0x3c4>
cmp    $0x1,%ebx
je     1572 <relSearch16Bit+0x3d2>
test   %ebx,%ebx
jne    1310 <relSearch16Bit+0x170>
lea    -0x4b0(%rbp),%r12
mov    %r12,%rdi
mov    %rdx,%rbx
call   1040 <strlen@plt>
lea    -0x8b0(%rbp),%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1070 <memcpy@plt>
mov    %rbx,%rdx
mov    -0x3c(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x50(%rbp),%rax
lea    0x3ff(%rax),%r12
add    $0xfffffc01,%r14d
xor    %ebx,%ebx
jmp    1310 <relSearch16Bit+0x170>
add    $0xfffffc01,%r14d
mov    $0x2,%ebx
lea    -0x3c(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x4b0(%rbp),%rax
mov    %rax,-0x50(%rbp)
jmp    1310 <relSearch16Bit+0x170>
mov    -0x80(%rbp),%rax
mov    %r13d,(%rax)
mov    -0x90(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa46(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [47 x i8] c"Failed to allocate memory for search results.\0A\00"
define i32* @relSearch16Bit(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32*
%23 = alloca i32
%24 = alloca [1024 x i8]
%25 = alloca [1024 x i8]
%26 = alloca i8*
%27 = alloca i8*
%28 = alloca i64
%29 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%30 = call i32* @calloc(i32 0, i32 4)
store i32* %30, i32** %7
store i8* null, i8** %15
%31 = load i8*, i8** %5
%32 = call i32 @strlen(i8* %31)
store i32 %32, i32* %16
store i32* null, i32** %19
store i32* null, i32** %22
store i32 0, i32* %23
store i8* null, i8** %26
%33 = load i32, i32* %16
%34 = zext i32 %33 to i64
%35 = call i8* @llvm.stacksave()
store i8* %35, i8** %27
%36 = alloca i8, i64 %34
store i64 %34, i64* %28
store i8 0, i8* %29
br label %37
37: ; preds = %88, %3
%38 = load i8, i8* %29
%39 = zext i8 %38 to i32
%40 = load i32, i32* %16
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %91
42: ; preds = %37
%43 = load i8*, i8** %5
%44 = load i8, i8* %29
%45 = zext i8 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = call i32 @isalpha(i8 signext %47)
%49 = icmp ne i32 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %42
%51 = load i8, i8* %29
%52 = zext i8 %51 to i64
%53 = getelementptr inbounds i8, i8* %36, i64 %52
store i8 -1, i8* %53
br label %87
54: ; preds = %42
%55 = load i8*, i8** %5
%56 = load i8, i8* %29
%57 = zext i8 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = call i64 @isupper(i8 signext %59)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %74
62: ; preds = %54
%63 = load i8*, i8** %5
%64 = load i8, i8* %29
%65 = zext i8 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = sub nsw i32 %68, 65
%70 = trunc i32 %69 to i8
%71 = load i8, i8* %29
%72 = zext i8 %71 to i64
%73 = getelementptr inbounds i8, i8* %36, i64 %72
store i8 %70, i8* %73
br label %86
74: ; preds = %54
%75 = load i8*, i8** %5
%76 = load i8, i8* %29
%77 = zext i8 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = sub nsw i32 %80, 97
%82 = trunc i32 %81 to i8
%83 = load i8, i8* %29
%84 = zext i8 %83 to i64
%85 = getelementptr inbounds i8, i8* %36, i64 %84
store i8 %82, i8* %85
br label %86
86: ; preds = %74, %62
br label %87
87: ; preds = %86, %50
br label %88
88: ; preds = %87
%89 = load i8, i8* %29
%90 = add i8 %89, 1
store i8 %90, i8* %29
br label %37
91: ; preds = %37
%92 = load i8*, i8** %4
%93 = load i32, i32* @O_RDONLY
%94 = call i32 @open(i8* %92, i32 %93)
store i32 %94, i32* %9
store i32 0, i32* %13
store i32 1, i32* %10
store i32 1, i32* %12
store i32 0, i32* %11
store i32 -1, i32* %20
store i32 -1, i32* %21
br label %95
95: ; preds = %334, %91
br label %96
96: ; preds = %95
%97 = load i32, i32* %13
%98 = icmp eq i32 %97, 0
br i1 %98, label %99, label %117
99: ; preds = %96
%100 = load i32, i32* %9
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* %25, i64 0, i64 1
%102 = call i32 @read(i32 %100, i8* %101, i32 1023)
store i32 %102, i32* %18
%103 = load i32, i32* %18
%104 = icmp eq i32 %103, 0
br i1 %104, label %105, label %106
105: ; preds = %99
br label %335
106: ; preds = %99
%107 = load i8*, i8** %15
%108 = icmp ne i8* %107, null
br i1 %108, label %109, label %113
109: ; preds = %106
%110 = load i8*, i8** %15
%111 = load i8, i8* %110
%112 = getelementptr inbounds [1024 x i8], [1024 x i8]* %25, i64 0, i64 0
store i8 %111, i8* %112
store i8* null, i8** %15
br label %113
113: ; preds = %109, %106
%114 = load i32, i32* %18
%115 = add nsw i32 %114, 1
store i32 %115, i32* %18
store i32* %18, i32** %19
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %25, i64 0, i64 0
store i8* %116, i8** %26
br label %117
117: ; preds = %113, %96
br label %118
118: ; preds = %295, %117
%119 = load i32, i32* %12
%120 = load i32*, i32** %19
%121 = load i32, i32* %120
%122 = sub nsw i32 %121, 1
%123 = icmp slt i32 %119, %122
br i1 %123, label %124, label %300
124: ; preds = %118
%125 = load i32, i32* %11
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8, i8* %36, i64 %126
%128 = load i8, i8* %127
%129 = zext i8 %128 to i32
%130 = icmp ne i32 %129, 255
br i1 %130, label %131, label %201
131: ; preds = %124
%132 = load i32, i32* %6
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %151
134: ; preds = %131
%135 = load i8*, i8** %26
%136 = load i32, i32* %12
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i8, i8* %135, i64 %137
%139 = load i8, i8* %138
%140 = zext i8 %139 to i32
%141 = shl i32 %140, 8
%142 = load i8*, i8** %26
%143 = load i32, i32* %12
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i8, i8* %142, i64 %144
%146 = getelementptr inbounds i8, i8* %145, i64 1
%147 = load i8, i8* %146
%148 = zext i8 %147 to i32
%149 = and i32 %148, 255
%150 = or i32 %141, %149
store i32 %150, i32* %14
br label %168
151: ; preds = %131
%152 = load i8*, i8** %26
%153 = load i32, i32* %12
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds i8, i8* %152, i64 %154
%156 = getelementptr inbounds i8, i8* %155, i64 1
%157 = load i8, i8* %156
%158 = zext i8 %157 to i32
%159 = shl i32 %158, 8
%160 = load i8*, i8** %26
%161 = load i32, i32* %12
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds i8, i8* %160, i64 %162
%164 = load i8, i8* %163
%165 = zext i8 %164 to i32
%166 = and i32 %165, 255
%167 = or i32 %159, %166
store i32 %167, i32* %14
br label %168
168: ; preds = %151, %134
%169 = load i8*, i8** %5
%170 = load i32, i32* %11
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i8, i8* %169, i64 %171
%173 = load i8, i8* %172
%174 = call i64 @isupper(i8 signext %173)
%175 = icmp ne i64 %174, 0
br i1 %175, label %176, label %188
176: ; preds = %168
%177 = load i32, i32* %20
%178 = icmp eq i32 %177, -1
br i1 %178, label %179, label %187
179: ; preds = %176
%180 = load i32, i32* %14
%181 = load i32, i32* %11
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds i8, i8* %36, i64 %182
%184 = load i8, i8* %183
%185 = zext i8 %184 to i32
%186 = sub nsw i32 %180, %185
store i32 %186, i32* %20
br label %187
187: ; preds = %179, %176
store i32* %20, i32** %22
br label %200
188: ; preds = %168
%189 = load i32, i32* %21
%190 = icmp eq i32 %189, -1
br i1 %190, label %191, label %199
191: ; preds = %188
%192 = load i32, i32* %14
%193 = load i32, i32* %11
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds i8, i8* %36, i64 %194
%196 = load i8, i8* %195
%197 = zext i8 %196 to i32
%198 = sub nsw i32 %192, %197
store i32 %198, i32* %21
br label %199
199: ; preds = %191, %188
store i32* %21, i32** %22
br label %200
200: ; preds = %199, %187
br label %201
201: ; preds = %200, %124
%202 = load i32, i32* %11
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds i8, i8* %36, i64 %203
%205 = load i8, i8* %204
%206 = zext i8 %205 to i32
%207 = icmp eq i32 %206, 255
br i1 %207, label %223, label %208
208: ; preds = %201
%209 = load i32*, i32** %22
%210 = load i32, i32* %209
%211 = icmp sge i32 %210, 0
br i1 %211, label %212, label %275
212: ; preds = %208
%213 = load i32, i32* %14
%214 = load i32*, i32** %22
%215 = load i32, i32* %214
%216 = sub nsw i32 %213, %215
%217 = load i32, i32* %11
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds i8, i8* %36, i64 %218
%220 = load i8, i8* %219
%221 = zext i8 %220 to i32
%222 = icmp eq i32 %216, %221
br i1 %222, label %223, label %275
223: ; preds = %212, %201
%224 = load i32, i32* %11
%225 = add nsw i32 %224, 1
store i32 %225, i32* %11
%226 = load i32, i32* %11
%227 = load i32, i32* %16
%228 = icmp eq i32 %226, %227
br i1 %228, label %229, label %274
229: ; preds = %223
%230 = load i32, i32* %23
%231 = add nsw i32 %230, 1
store i32 %231, i32* %23
%232 = load i32*, i32** %7
%233 = load i32, i32* %23
%234 = mul nsw i32 %233, 3
%235 = add nsw i32 %234, 1
%236 = sext i32 %235 to i64
%237 = mul i64 %236, 4
%238 = trunc i64 %237 to i32
%239 = call i32* @realloc(i32* %232, i32 %238)
store i32* %239, i32** %8
%240 = load i32*, i32** %8
%241 = icmp eq i32* %240, null
br i1 %241, label %242, label %245
242: ; preds = %229
%243 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%244 = call i32 @exit(i32 0)
unreachable
245: ; preds = %229
%246 = load i32, i32* %10
%247 = load i32, i32* %11
%248 = mul nsw i32 %247, 2
%249 = sub nsw i32 %248, 1
%250 = sub nsw i32 %246, %249
%251 = load i32*, i32** %7
%252 = load i32, i32* %23
%253 = sub nsw i32 %252, 1
%254 = mul nsw i32 %253, 3
%255 = add nsw i32 %254, 1
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds i32, i32* %251, i64 %256
store i32 %250, i32* %257
%258 = load i32, i32* %20
%259 = load i32*, i32** %7
%260 = load i32, i32* %23
%261 = sub nsw i32 %260, 1
%262 = mul nsw i32 %261, 3
%263 = add nsw i32 %262, 2
%264 = sext i32 %263 to i64
%265 = getelementptr inbounds i32, i32* %259, i64 %264
store i32 %258, i32* %265
%266 = load i32, i32* %21
%267 = load i32*, i32** %7
%268 = load i32, i32* %23
%269 = sub nsw i32 %268, 1
%270 = mul nsw i32 %269, 3
%271 = add nsw i32 %270, 3
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds i32, i32* %267, i64 %272
store i32 %266, i32* %273
store i32 0, i32* %11
store i32 -1, i32* %20
store i32 -1, i32* %21
br label %274
274: ; preds = %245, %223
br label %295
275: ; preds = %212, %208
%276 = load i32, i32* %11
%277 = mul nsw i32 %276, 2
%278 = add nsw i32 %277, 1
%279 = load i32, i32* %12
%280 = sub nsw i32 %279, %278
store i32 %280, i32* %12
%281 = load i32, i32* %11
%282 = mul nsw i32 %281, 2
%283 = add nsw i32 %282, 1
%284 = load i32, i32* %10
%285 = sub nsw i32 %284, %283
store i32 %285, i32* %10
store i32 0, i32* %11
store i32 -1, i32* %20
store i32 -1, i32* %21
%286 = load i32, i32* %12
%287 = icmp slt i32 %286, -2
br i1 %287, label %288, label %294
288: ; preds = %275
%289 = load i32, i32* %10
%290 = add nsw i32 %289, 2
store i32 %290, i32* %10
%291 = load i32, i32* %12
%292 = add nsw i32 %291, 1025
store i32 %292, i32* %12
store i32 -1, i32* %13
%293 = getelementptr inbounds [1024 x i8], [1024 x i8]* %24, i64 0, i64 0
store i8* %293, i8** %26
store i32* %17, i32** %19
br label %300
294: ; preds = %275
br label %295
295: ; preds = %294, %274
%296 = load i32, i32* %10
%297 = add nsw i32 %296, 2
store i32 %297, i32* %10
%298 = load i32, i32* %12
%299 = add nsw i32 %298, 2
store i32 %299, i32* %12
br label %118
300: ; preds = %288, %118
%301 = load i32, i32* %13
%302 = icmp eq i32 %301, -1
br i1 %302, label %303, label %304
303: ; preds = %300
store i32 1, i32* %13
br label %334
304: ; preds = %300
%305 = load i32, i32* %13
%306 = icmp eq i32 %305, 0
br i1 %306, label %307, label %318
307: ; preds = %304
%308 = getelementptr inbounds [1024 x i8], [1024 x i8]* %24, i64 0, i64 0
%309 = getelementptr inbounds [1024 x i8], [1024 x i8]* %25, i64 0, i64 0
%310 = getelementptr inbounds [1024 x i8], [1024 x i8]* %25, i64 0, i64 0
%311 = call i32 @strlen(i8* %310)
%312 = call i32 @memcpy(i8* %308, i8* %309, i32 %311)
%313 = load i32, i32* %18
store i32 %313, i32* %17
%314 = load i8*, i8** %26
%315 = getelementptr inbounds i8, i8* %314, i64 1023
store i8* %315, i8** %15
%316 = load i32, i32* %12
%317 = sub nsw i32 %316, 1023
store i32 %317, i32* %12
br label %333
318: ; preds = %304
%319 = load i32, i32* %13
%320 = icmp eq i32 %319, 1
br i1 %320, label %321, label %325
321: ; preds = %318
store i32 2, i32* %13
%322 = load i32, i32* %12
%323 = sub nsw i32 %322, 1023
store i32 %323, i32* %12
%324 = getelementptr inbounds [1024 x i8], [1024 x i8]* %25, i64 0, i64 0
store i8* %324, i8** %26
store i32* %18, i32** %19
br label %332
325: ; preds = %318
%326 = load i32, i32* %13
%327 = icmp eq i32 %326, 2
br i1 %327, label %328, label %331
328: ; preds = %325
store i32 0, i32* %13
%329 = load i32, i32* %12
%330 = sub nsw i32 %329, 1023
store i32 %330, i32* %12
br label %331
331: ; preds = %328, %325
br label %332
332: ; preds = %331, %321
br label %333
333: ; preds = %332, %307
br label %334
334: ; preds = %333, %303
br label %95
335: ; preds = %105
%336 = load i32, i32* %23
%337 = load i32*, i32** %7
%338 = getelementptr inbounds i32, i32* %337, i64 0
store i32 %336, i32* %338
%339 = load i32*, i32** %7
%340 = load i8*, i8** %27
ret i32* %339
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@str = [46 x i8] c"Failed to allocate memory for search results.\00"
define i32* @relSearch16Bit(i8* nocapture %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
%10 = tail call i32* @calloc(i32 0, i32 4)
%11 = tail call i32 @strlen(i8* %1)
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%18 = zext i32 %11 to i64
%19 = tail call i8* @llvm.stacksave()
%20 = alloca i8, i64 %18
%21 = icmp sgt i32 %11, 0
br i1 %21, label %28, label %22
22: ; preds = %44, %3
%23 = load i32, i32* @O_RDONLY
%24 = tail call i32 @open(i8* %0, i32 %23)
store i32 -1, i32* %6
store i32 -1, i32* %7
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 1
%26 = icmp eq i32 %2, 0
%27 = mul i32 %11, -2
br label %199
28: ; preds = %3, %44
%29 = phi i8 [ %47, %44 ], [ 0, %3 ]
%30 = zext i8 %29 to i64
%31 = getelementptr inbounds i8, i8* %1, i64 %30
%32 = load i8, i8* %31
%33 = tail call i32 @isalpha(i8 signext %32)
%34 = icmp eq i32 %33, 0
br i1 %34, label %44, label %35
35: ; preds = %28
%36 = load i8, i8* %31
%37 = tail call i64 @isupper(i8 signext %36)
%38 = icmp eq i64 %37, 0
%39 = load i8, i8* %31
br i1 %38, label %42, label %40
40: ; preds = %35
%41 = add i8 %39, -65
br label %44
42: ; preds = %35
%43 = add i8 %39, -97
br label %44
44: ; preds = %28, %42, %40
%45 = phi i8 [ %43, %42 ], [ %41, %40 ], [ -1, %28 ]
%46 = getelementptr inbounds i8, i8* %20, i64 %30
store i8 %45, i8* %46
%47 = add i8 %29, 1
%48 = zext i8 %47 to i32
%49 = icmp sgt i32 %11, %48
br i1 %49, label %28, label %22
50: ; preds = %199, %175
%51 = phi i32 [ %176, %175 ], [ %200, %199 ]
%52 = phi i32 [ %177, %175 ], [ %201, %199 ]
%53 = phi i8* [ %73, %175 ], [ %203, %199 ]
%54 = phi i32 [ %178, %175 ], [ %204, %199 ]
%55 = phi i32* [ %74, %175 ], [ %205, %199 ]
%56 = phi i32 [ %179, %175 ], [ %206, %199 ]
%57 = phi i8* [ %75, %175 ], [ %207, %199 ]
%58 = phi i32 [ %180, %175 ], [ %208, %199 ]
%59 = phi i32 [ %181, %175 ], [ %209, %199 ]
br i1 %210, label %62, label %60
60: ; preds = %50
%61 = load i32, i32* %55
br label %71
62: ; preds = %50
%63 = call i32 @read(i32 %24, i8* %25, i32 1023)
store i32 %63, i32* %5
%64 = icmp eq i32 %63, 0
br i1 %64, label %215, label %65
65: ; preds = %62
%66 = icmp eq i8* %53, null
br i1 %66, label %69, label %67
67: ; preds = %65
%68 = load i8, i8* %53
store i8 %68, i8* %17
br label %69
69: ; preds = %67, %65
%70 = add nsw i32 %63, 1
store i32 %70, i32* %5
br label %71
71: ; preds = %60, %69
%72 = phi i32 [ %70, %69 ], [ %61, %60 ]
%73 = phi i8* [ null, %69 ], [ %53, %60 ]
%74 = phi i32* [ %5, %69 ], [ %55, %60 ]
%75 = phi i8* [ %17, %69 ], [ %57, %60 ]
%76 = add nsw i32 %72, -1
%77 = icmp slt i32 %54, %76
br i1 %77, label %78, label %175
78: ; preds = %71, %163
%79 = phi i32 [ %164, %163 ], [ %51, %71 ]
%80 = phi i32 [ %165, %163 ], [ %52, %71 ]
%81 = phi i32 [ %170, %163 ], [ %59, %71 ]
%82 = phi i32 [ %168, %163 ], [ %58, %71 ]
%83 = phi i32 [ %167, %163 ], [ %56, %71 ]
%84 = phi i32 [ %171, %163 ], [ %54, %71 ]
%85 = sext i32 %82 to i64
%86 = getelementptr inbounds i8, i8* %20, i64 %85
%87 = load i8, i8* %86
%88 = icmp eq i8 %87, -1
br i1 %88, label %125, label %89
89: ; preds = %78
%90 = sext i32 %84 to i64
%91 = getelementptr inbounds i8, i8* %75, i64 %90
%92 = getelementptr inbounds i8, i8* %91, i64 1
%93 = select i1 %26, i8* %91, i8* %92
%94 = select i1 %26, i8* %92, i8* %91
%95 = load i8, i8* %94
%96 = zext i8 %95 to i32
%97 = shl nuw nsw i32 %96, 8
%98 = load i8, i8* %93
%99 = zext i8 %98 to i32
%100 = or i32 %97, %99
%101 = getelementptr inbounds i8, i8* %1, i64 %85
%102 = load i8, i8* %101
%103 = call i64 @isupper(i8 signext %102)
%104 = icmp eq i64 %103, 0
br i1 %104, label %110, label %105
105: ; preds = %89
%106 = icmp eq i32 %80, -1
br i1 %106, label %107, label %115
107: ; preds = %105
%108 = zext i8 %87 to i32
%109 = sub nsw i32 %100, %108
store i32 %109, i32* %6
br label %115
110: ; preds = %89
%111 = icmp eq i32 %79, -1
br i1 %111, label %112, label %115
112: ; preds = %110
%113 = zext i8 %87 to i32
%114 = sub nsw i32 %100, %113
store i32 %114, i32* %7
br label %115
115: ; preds = %110, %112, %105, %107
%116 = phi i32 [ %79, %110 ], [ %114, %112 ], [ %79, %105 ], [ %79, %107 ]
%117 = phi i32 [ %80, %110 ], [ %80, %112 ], [ %80, %105 ], [ %109, %107 ]
%118 = phi i32* [ %7, %110 ], [ %7, %112 ], [ %6, %105 ], [ %6, %107 ]
%119 = zext i8 %87 to i32
%120 = load i32, i32* %118
%121 = icmp sgt i32 %120, -1
%122 = sub nsw i32 %100, %120
%123 = icmp eq i32 %122, %119
%124 = select i1 %121, i1 %123, i1 false
br i1 %124, label %125, label %154
125: ; preds = %78, %115
%126 = phi i32 [ %116, %115 ], [ %79, %78 ]
%127 = phi i32 [ %117, %115 ], [ %80, %78 ]
%128 = add nsw i32 %82, 1
%129 = icmp eq i32 %128, %11
br i1 %129, label %130, label %163
130: ; preds = %125
%131 = add nsw i32 %83, 1
%132 = mul i32 %131, 12
%133 = add i32 %132, 4
%134 = call i32* @realloc(i32* %10, i32 %133)
%135 = icmp eq i32* %134, null
br i1 %135, label %136, label %139
136: ; preds = %130
%137 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%138 = call i32 @exit(i32 0)
unreachable
139: ; preds = %130
%140 = add i32 %81, 1
%141 = add i32 %140, %27
%142 = mul nsw i32 %83, 3
%143 = add nsw i32 %142, 1
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i32, i32* %10, i64 %144
store i32 %141, i32* %145
%146 = load i32, i32* %6
%147 = add nsw i32 %142, 2
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds i32, i32* %10, i64 %148
store i32 %146, i32* %149
%150 = load i32, i32* %7
%151 = add nsw i32 %142, 3
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i32, i32* %10, i64 %152
store i32 %150, i32* %153
store i32 -1, i32* %6
store i32 -1, i32* %7
br label %163
154: ; preds = %115
%155 = shl nsw i32 %82, 1
%156 = or i32 %155, 1
%157 = sub nsw i32 %84, %156
%158 = sub nsw i32 %81, %156
store i32 -1, i32* %6
store i32 -1, i32* %7
%159 = icmp slt i32 %157, -2
br i1 %159, label %160, label %163
160: ; preds = %154
%161 = add nsw i32 %158, 2
%162 = add nsw i32 %157, 1025
br label %188
163: ; preds = %154, %125, %139
%164 = phi i32 [ -1, %139 ], [ %126, %125 ], [ -1, %154 ]
%165 = phi i32 [ -1, %139 ], [ %127, %125 ], [ -1, %154 ]
%166 = phi i32 [ %84, %139 ], [ %84, %125 ], [ %157, %154 ]
%167 = phi i32 [ %131, %139 ], [ %83, %125 ], [ %83, %154 ]
%168 = phi i32 [ 0, %139 ], [ %128, %125 ], [ 0, %154 ]
%169 = phi i32 [ %81, %139 ], [ %81, %125 ], [ %158, %154 ]
%170 = add nsw i32 %169, 2
%171 = add nsw i32 %166, 2
%172 = load i32, i32* %74
%173 = add nsw i32 %172, -1
%174 = icmp slt i32 %171, %173
br i1 %174, label %78, label %175
175: ; preds = %163, %71
%176 = phi i32 [ %51, %71 ], [ %164, %163 ]
%177 = phi i32 [ %52, %71 ], [ %165, %163 ]
%178 = phi i32 [ %54, %71 ], [ %171, %163 ]
%179 = phi i32 [ %56, %71 ], [ %167, %163 ]
%180 = phi i32 [ %58, %71 ], [ %168, %163 ]
%181 = phi i32 [ %59, %71 ], [ %170, %163 ]
switch i32 %202, label %50 [
i32 2, label %213
i32 0, label %182
i32 1, label %211
]
182: ; preds = %175
%183 = call i32 @strlen(i8* %17)
%184 = call i32 @memcpy(i8* %16, i8* %17, i32 %183)
%185 = load i32, i32* %5
store i32 %185, i32* %4
%186 = getelementptr inbounds i8, i8* %75, i64 1023
%187 = add nsw i32 %178, -1023
br label %188
188: ; preds = %182, %211, %213, %160
%189 = phi i32 [ -1, %160 ], [ %176, %213 ], [ %176, %211 ], [ %176, %182 ]
%190 = phi i32 [ -1, %160 ], [ %177, %213 ], [ %177, %211 ], [ %177, %182 ]
%191 = phi i32 [ 1, %160 ], [ 0, %213 ], [ 2, %211 ], [ 0, %182 ]
%192 = phi i8* [ %73, %160 ], [ %73, %213 ], [ %73, %211 ], [ %186, %182 ]
%193 = phi i32 [ %162, %160 ], [ %214, %213 ], [ %212, %211 ], [ %187, %182 ]
%194 = phi i32* [ %4, %160 ], [ %74, %213 ], [ %5, %211 ], [ %74, %182 ]
%195 = phi i32 [ %83, %160 ], [ %179, %213 ], [ %179, %211 ], [ %179, %182 ]
%196 = phi i8* [ %16, %160 ], [ %75, %213 ], [ %17, %211 ], [ %75, %182 ]
%197 = phi i32 [ 0, %160 ], [ %180, %213 ], [ %180, %211 ], [ %180, %182 ]
%198 = phi i32 [ %161, %160 ], [ %181, %213 ], [ %181, %211 ], [ %181, %182 ]
br label %199
199: ; preds = %188, %22
%200 = phi i32 [ -1, %22 ], [ %189, %188 ]
%201 = phi i32 [ -1, %22 ], [ %190, %188 ]
%202 = phi i32 [ 0, %22 ], [ %191, %188 ]
%203 = phi i8* [ null, %22 ], [ %192, %188 ]
%204 = phi i32 [ 1, %22 ], [ %193, %188 ]
%205 = phi i32* [ null, %22 ], [ %194, %188 ]
%206 = phi i32 [ 0, %22 ], [ %195, %188 ]
%207 = phi i8* [ null, %22 ], [ %196, %188 ]
%208 = phi i32 [ 0, %22 ], [ %197, %188 ]
%209 = phi i32 [ 1, %22 ], [ %198, %188 ]
%210 = icmp eq i32 %202, 0
br label %50
211: ; preds = %175
%212 = add nsw i32 %178, -1023
br label %188
213: ; preds = %175
%214 = add nsw i32 %178, -1023
br label %188
215: ; preds = %62
store i32 %56, i32* %10
ret i32* %10
}