#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 uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fread(unsigned char *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
size_t ftell(int /*<<< orphan*/ *);
void *getByte(int /*<<< orphan*/ *);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ sendBytes(unsigned char *, unsigned int,
                             int /*<<< orphan*/ *);
void unlz4(const char *ifn, const char *ofn, const char *dictionary) {
  FILE *inpFp = fopen(ifn, "rb");
  FILE *outFp = fopen(ofn, "wb");
  unsigned char signature1 = getByte(inpFp);
  unsigned char signature2 = getByte(inpFp);
  unsigned char signature3 = getByte(inpFp);
  unsigned char signature4 = getByte(inpFp);
  uint32_t signature =
      (signature4 << 24) | (signature3 << 16) | (signature2 << 8) | signature1;
  int isModern = (signature == 0x184D2204);
  int isLegacy = (signature == 0x184C2102);
  if (!isModern && !isLegacy)
    error("invalid signature");
  unsigned char hasBlockChecksum = 0;
  unsigned char hasContentSize = 0;
  unsigned char hasContentChecksum = 0;
  unsigned char hasDictionaryID = 0;
  if (isModern) {
    unsigned char flags = getByte(inpFp);
    hasBlockChecksum = flags & 16;
    hasContentSize = flags & 8;
    hasContentChecksum = flags & 4;
    hasDictionaryID = flags & 1;
    unsigned char version = flags >> 6;
    if (version != 1)
      error("only LZ4 file format version 1 supported");
    getByte(inpFp);
    if (hasContentSize) {
      getByte(inpFp);
      getByte(inpFp);
      getByte(inpFp);
      getByte(inpFp);
      getByte(inpFp);
      getByte(inpFp);
      getByte(inpFp);
      getByte(inpFp);
    }
    if (hasDictionaryID) {
      getByte(inpFp);
      getByte(inpFp);
      getByte(inpFp);
      getByte(inpFp);
    }
    getByte(inpFp);
  }
  unsigned char history[64 * 1024];
  unsigned int pos = 0;
  if (dictionary != NULL) {
    FILE *dict = fopen(dictionary, "rb");
    if (!dict)
      error("cannot open dictionary");
    fseek(dict, 0, SEEK_END);
    size_t dictSize = ftell(dict);
    size_t relevant = dictSize < 65536 ? 0 : dictSize - 65536;
    fseek(dict, (long)relevant, SEEK_SET);
    if (dictSize > 65536)
      dictSize = 65536;
    fread(history + 64 * 1024 - dictSize, 1, dictSize, dict);
    fclose(dict);
  }
  while (1) {
    uint32_t blockSize = getByte(inpFp);
    blockSize |= (uint32_t)getByte(inpFp) << 8;
    blockSize |= (uint32_t)getByte(inpFp) << 16;
    blockSize |= (uint32_t)getByte(inpFp) << 24;
    unsigned char isCompressed = isLegacy || (blockSize & 0x80000000) == 0;
    if (isModern)
      blockSize &= 0x7FFFFFFF;
    if (blockSize == 0)
      break;
    if (isCompressed) {
      uint32_t blockOffset = 0;
      while (blockOffset < blockSize) {
        unsigned char token = getByte(inpFp);
        blockOffset++;
        uint32_t numLiterals = (token >> 4) & 0x0F;
        if (numLiterals == 15) {
          unsigned char current;
          do {
            current = getByte(inpFp);
            numLiterals += current;
            blockOffset++;
          } while (current == 255);
        }
        blockOffset += numLiterals;
        while (numLiterals-- > 0) {
          history[pos++] = getByte(inpFp);
          if (pos == 64 * 1024) {
            sendBytes(history, 64 * 1024, outFp);
            pos = 0;
          }
        }
        if (blockOffset == blockSize)
          break;
        blockOffset += 2;
        uint32_t delta = getByte(inpFp);
        delta |= (uint32_t)getByte(inpFp) << 8;
        if (delta == 0)
          error("invalid offset");
        uint32_t matchLength = 4 + (token & 0x0F);
        if (matchLength == 4 + 0x0F) {
          unsigned char current;
          do {
            current = getByte(inpFp);
            matchLength += current;
            blockOffset++;
          } while (current == 255);
        }
        uint32_t reference =
            (pos >= delta) ? pos - delta : 64 * 1024 + pos - delta;
        if (pos + matchLength < 64 * 1024 &&
            reference + matchLength < 64 * 1024) {
          if (pos >= reference + matchLength ||
              reference >= pos + matchLength) {
            memcpy(history + pos, history + reference, matchLength);
            pos += matchLength;
          } else {
            while (matchLength-- > 0)
              history[pos++] = history[reference++];
          }
        } else {
          while (matchLength-- > 0) {
            history[pos++] = history[reference++];
            if (pos == 64 * 1024) {
              sendBytes(history, 64 * 1024, outFp);
              pos = 0;
            }
            if (reference == 64 * 1024)
              reference = 0;
          }
        }
      }
      if (isLegacy && blockSize < 8 * 1024 * 1024)
        break;
    } else {
      while (blockSize-- > 0) {
        history[pos++] = getByte(inpFp);
        if (pos == 64 * 1024) {
          sendBytes(history, 64 * 1024, outFp);
          pos = 0;
        }
      }
    }
    if (hasBlockChecksum) {
      getByte(inpFp);
      getByte(inpFp);
      getByte(inpFp);
      getByte(inpFp);
    }
  }
  if (hasContentChecksum) {
    getByte(inpFp);
    getByte(inpFp);
    getByte(inpFp);
    getByte(inpFp);
  }
  sendBytes(history, pos, outFp);
}


x86 assembly (clang, -O0):
<unlz4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100a0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe4e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %al,-0x29(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %al,-0x2a(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %al,-0x2b(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %al,-0x2c(%rbp)
movzbl -0x2c(%rbp),%eax
shl    $0x18,%eax
movzbl -0x2b(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x2a(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x29(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x184d2204,-0x30(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x184c2102,-0x30(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1265 <unlz4+0xd5>
cmpl   $0x0,-0x38(%rbp)
jne    1265 <unlz4+0xd5>
lea    0xda6(%rip),%rdi
call   1090 <error@plt>
movb   $0x0,-0x39(%rbp)
movb   $0x0,-0x3a(%rbp)
movb   $0x0,-0x3b(%rbp)
movb   $0x0,-0x3c(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1368 <unlz4+0x1d8>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %al,-0x3d(%rbp)
movzbl -0x3d(%rbp),%eax
and    $0x10,%eax
mov    %al,-0x39(%rbp)
movzbl -0x3d(%rbp),%eax
and    $0x8,%eax
mov    %al,-0x3a(%rbp)
movzbl -0x3d(%rbp),%eax
and    $0x4,%eax
mov    %al,-0x3b(%rbp)
movzbl -0x3d(%rbp),%eax
and    $0x1,%eax
mov    %al,-0x3c(%rbp)
movzbl -0x3d(%rbp),%eax
sar    $0x6,%eax
mov    %al,-0x3e(%rbp)
movzbl -0x3e(%rbp),%eax
cmp    $0x1,%eax
je     12d6 <unlz4+0x146>
lea    0xd47(%rip),%rdi
call   1090 <error@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
cmpb   $0x0,-0x3a(%rbp)
je     1331 <unlz4+0x1a1>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
cmpb   $0x0,-0x3c(%rbp)
je     135f <unlz4+0x1cf>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
movl   $0x0,-0x10044(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1491 <unlz4+0x301>
mov    -0x18(%rbp),%rdi
lea    0xc78(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10050(%rbp)
cmpq   $0x0,-0x10050(%rbp)
jne    13ae <unlz4+0x21e>
lea    0xc98(%rip),%rdi
call   1090 <error@plt>
mov    -0x10050(%rbp),%rdi
mov    0x2c2c(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1080 <fseek@plt>
mov    -0x10050(%rbp),%rdi
call   1060 <ftell@plt>
mov    %rax,-0x10058(%rbp)
cmpq   $0x10000,-0x10058(%rbp)
jae    13f9 <unlz4+0x269>
xor    %eax,%eax
mov    %rax,-0x10090(%rbp)
jmp    140d <unlz4+0x27d>
mov    -0x10058(%rbp),%rax
sub    $0x10000,%rax
mov    %rax,-0x10090(%rbp)
mov    -0x10090(%rbp),%rax
mov    %rax,-0x10060(%rbp)
mov    -0x10050(%rbp),%rdi
mov    -0x10060(%rbp),%rsi
mov    0x2ba8(%rip),%rax
mov    (%rax),%edx
call   1080 <fseek@plt>
cmpq   $0x10000,-0x10058(%rbp)
jbe    1453 <unlz4+0x2c3>
movq   $0x10000,-0x10058(%rbp)
lea    -0x10040(%rbp),%rdi
add    $0x10000,%rdi
xor    %eax,%eax
sub    -0x10058(%rbp),%rax
add    %rax,%rdi
mov    -0x10058(%rbp),%rdx
mov    -0x10050(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    -0x10050(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1496 <unlz4+0x306>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %eax,-0x10064(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
shl    $0x8,%eax
or     -0x10064(%rbp),%eax
mov    %eax,-0x10064(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
shl    $0x10,%eax
or     -0x10064(%rbp),%eax
mov    %eax,-0x10064(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
shl    $0x18,%eax
or     -0x10064(%rbp),%eax
mov    %eax,-0x10064(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x38(%rbp)
mov    %al,-0x10091(%rbp)
jne    1516 <unlz4+0x386>
mov    -0x10064(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x10091(%rbp)
mov    -0x10091(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x10065(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1542 <unlz4+0x3b2>
mov    -0x10064(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x10064(%rbp)
cmpl   $0x0,-0x10064(%rbp)
jne    1554 <unlz4+0x3c4>
jmp    1a32 <unlz4+0x8a2>
cmpb   $0x0,-0x10065(%rbp)
je     1982 <unlz4+0x7f2>
movl   $0x0,-0x1006c(%rbp)
mov    -0x1006c(%rbp),%eax
cmp    -0x10064(%rbp),%eax
jge    195e <unlz4+0x7ce>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %al,-0x1006d(%rbp)
mov    -0x1006c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1006c(%rbp)
movzbl -0x1006d(%rbp),%eax
sar    $0x4,%eax
and    $0xf,%eax
mov    %eax,-0x10074(%rbp)
cmpl   $0xf,-0x10074(%rbp)
jne    1608 <unlz4+0x478>
jmp    15c0 <unlz4+0x430>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %al,-0x10075(%rbp)
movzbl -0x10075(%rbp),%eax
add    -0x10074(%rbp),%eax
mov    %eax,-0x10074(%rbp)
mov    -0x1006c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1006c(%rbp)
movzbl -0x10075(%rbp),%eax
cmp    $0xff,%eax
je     15c0 <unlz4+0x430>
jmp    1608 <unlz4+0x478>
mov    -0x10074(%rbp),%eax
add    -0x1006c(%rbp),%eax
mov    %eax,-0x1006c(%rbp)
mov    -0x10074(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10074(%rbp)
cmp    $0x0,%eax
jle    168d <unlz4+0x4fd>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %al,%cl
mov    -0x10044(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10044(%rbp)
mov    %eax,%eax
mov    %cl,-0x10040(%rbp,%rax,1)
cmpl   $0x10000,-0x10044(%rbp)
jne    1688 <unlz4+0x4f8>
lea    -0x10040(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x10000,%esi
call   10b0 <sendBytes@plt>
movl   $0x0,-0x10044(%rbp)
jmp    161a <unlz4+0x48a>
mov    -0x1006c(%rbp),%eax
cmp    -0x10064(%rbp),%eax
jne    16a4 <unlz4+0x514>
jmp    195e <unlz4+0x7ce>
mov    -0x1006c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1006c(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %eax,-0x1007c(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
shl    $0x8,%eax
or     -0x1007c(%rbp),%eax
mov    %eax,-0x1007c(%rbp)
cmpl   $0x0,-0x1007c(%rbp)
jne    16f3 <unlz4+0x563>
lea    0x96a(%rip),%rdi
call   1090 <error@plt>
movzbl -0x1006d(%rbp),%eax
and    $0xf,%eax
add    $0x4,%eax
mov    %eax,-0x10080(%rbp)
cmpl   $0x13,-0x10080(%rbp)
jne    1760 <unlz4+0x5d0>
jmp    1718 <unlz4+0x588>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %al,-0x10081(%rbp)
movzbl -0x10081(%rbp),%eax
add    -0x10080(%rbp),%eax
mov    %eax,-0x10080(%rbp)
mov    -0x1006c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1006c(%rbp)
movzbl -0x10081(%rbp),%eax
cmp    $0xff,%eax
je     1718 <unlz4+0x588>
jmp    1760 <unlz4+0x5d0>
mov    -0x10044(%rbp),%eax
cmp    -0x1007c(%rbp),%eax
jb     1789 <unlz4+0x5f9>
mov    -0x10044(%rbp),%eax
sub    -0x1007c(%rbp),%eax
mov    %eax,-0x10098(%rbp)
jmp    17a0 <unlz4+0x610>
mov    -0x10044(%rbp),%eax
add    $0x10000,%eax
sub    -0x1007c(%rbp),%eax
mov    %eax,-0x10098(%rbp)
mov    -0x10098(%rbp),%eax
mov    %eax,-0x10088(%rbp)
mov    -0x10044(%rbp),%eax
add    -0x10080(%rbp),%eax
cmp    $0x10000,%eax
jae    18b3 <unlz4+0x723>
mov    -0x10088(%rbp),%eax
add    -0x10080(%rbp),%eax
cmp    $0x10000,%eax
jge    18b3 <unlz4+0x723>
mov    -0x10044(%rbp),%eax
mov    -0x10088(%rbp),%ecx
add    -0x10080(%rbp),%ecx
cmp    %ecx,%eax
jae    180e <unlz4+0x67e>
mov    -0x10088(%rbp),%eax
mov    -0x10044(%rbp),%ecx
add    -0x10080(%rbp),%ecx
cmp    %ecx,%eax
jb     1851 <unlz4+0x6c1>
lea    -0x10040(%rbp),%rdi
mov    -0x10044(%rbp),%eax
add    %rax,%rdi
lea    -0x10040(%rbp),%rsi
movslq -0x10088(%rbp),%rax
add    %rax,%rsi
mov    -0x10080(%rbp),%edx
call   1070 <memcpy@plt>
mov    -0x10080(%rbp),%eax
add    -0x10044(%rbp),%eax
mov    %eax,-0x10044(%rbp)
jmp    18ae <unlz4+0x71e>
jmp    1856 <unlz4+0x6c6>
mov    -0x10080(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10080(%rbp)
cmp    $0x0,%eax
jle    18a9 <unlz4+0x719>
mov    -0x10088(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10088(%rbp)
cltq
mov    -0x10040(%rbp,%rax,1),%cl
mov    -0x10044(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10044(%rbp)
mov    %eax,%eax
mov    %cl,-0x10040(%rbp,%rax,1)
jmp    1856 <unlz4+0x6c6>
jmp    18ae <unlz4+0x71e>
jmp    1959 <unlz4+0x7c9>
jmp    18b8 <unlz4+0x728>
mov    -0x10080(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10080(%rbp)
cmp    $0x0,%eax
jle    1954 <unlz4+0x7c4>
mov    -0x10088(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10088(%rbp)
cltq
mov    -0x10040(%rbp,%rax,1),%cl
mov    -0x10044(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10044(%rbp)
mov    %eax,%eax
mov    %cl,-0x10040(%rbp,%rax,1)
cmpl   $0x10000,-0x10044(%rbp)
jne    1935 <unlz4+0x7a5>
lea    -0x10040(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x10000,%esi
call   10b0 <sendBytes@plt>
movl   $0x0,-0x10044(%rbp)
cmpl   $0x10000,-0x10088(%rbp)
jne    194f <unlz4+0x7bf>
movl   $0x0,-0x10088(%rbp)
jmp    18b8 <unlz4+0x728>
jmp    1959 <unlz4+0x7c9>
jmp    156b <unlz4+0x3db>
cmpl   $0x0,-0x38(%rbp)
je     197d <unlz4+0x7ed>
cmpl   $0x800000,-0x10064(%rbp)
jge    197d <unlz4+0x7ed>
jmp    1a32 <unlz4+0x8a2>
jmp    19ff <unlz4+0x86f>
jmp    1987 <unlz4+0x7f7>
mov    -0x10064(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10064(%rbp)
cmp    $0x0,%eax
jle    19fa <unlz4+0x86a>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    %al,%cl
mov    -0x10044(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10044(%rbp)
mov    %eax,%eax
mov    %cl,-0x10040(%rbp,%rax,1)
cmpl   $0x10000,-0x10044(%rbp)
jne    19f5 <unlz4+0x865>
lea    -0x10040(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x10000,%esi
call   10b0 <sendBytes@plt>
movl   $0x0,-0x10044(%rbp)
jmp    1987 <unlz4+0x7f7>
jmp    19ff <unlz4+0x86f>
cmpb   $0x0,-0x39(%rbp)
je     1a2d <unlz4+0x89d>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
jmp    1496 <unlz4+0x306>
cmpb   $0x0,-0x3b(%rbp)
je     1a60 <unlz4+0x8d0>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getByte@plt>
lea    -0x10040(%rbp),%rdi
mov    -0x10044(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   10b0 <sendBytes@plt>
add    $0x100a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unlz4>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10038,%rsp
mov    %rdx,%r15
mov    %rsi,%rbp
lea    0xe52(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
lea    0xe46(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <fopen@plt>
mov    %rax,0x10(%rsp)
mov    %rbx,%rdi
call   1050 <getByte@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <getByte@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1050 <getByte@plt>
mov    %rax,%r13
mov    %rbx,(%rsp)
mov    %rbx,%rdi
call   1050 <getByte@plt>
shl    $0x18,%eax
movzbl %r13b,%ecx
shl    $0x10,%ecx
or     %eax,%ecx
shl    $0x8,%ebp
movzwl %bp,%eax
or     %ecx,%eax
movzbl %r14b,%r14d
or     %eax,%r14d
cmp    $0x184c2102,%r14d
je     1228 <unlz4+0x98>
cmp    $0x184d2204,%r14d
jne    12ef <unlz4+0x15f>
cmp    $0x184d2204,%r14d
jne    1308 <unlz4+0x178>
mov    (%rsp),%r13
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %rax,%rbx
and    $0xc0,%eax
cmp    $0x40,%eax
mov    0x10(%rsp),%rbp
je     125f <unlz4+0xcf>
lea    0xdbe(%rip),%rdi
call   1090 <error@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
test   $0x8,%bl
je     12ac <unlz4+0x11c>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
test   $0x1,%bl
je     12d1 <unlz4+0x141>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %ebx,%eax
and    $0x10,%al
mov    %rax,0x20(%rsp)
and    $0x4,%bl
mov    %r13,%rdi
call   1050 <getByte@plt>
test   %r15,%r15
jne    1323 <unlz4+0x193>
jmp    13b7 <unlz4+0x227>
lea    0xd10(%rip),%rdi
call   1090 <error@plt>
cmp    $0x184d2204,%r14d
je     1235 <unlz4+0xa5>
xor    %ebx,%ebx
xor    %eax,%eax
mov    %rax,0x20(%rsp)
mov    0x10(%rsp),%rbp
mov    (%rsp),%r13
test   %r15,%r15
je     13b7 <unlz4+0x227>
lea    0xcd6(%rip),%rsi
mov    %r15,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1346 <unlz4+0x1b6>
lea    0xd00(%rip),%rdi
call   1090 <error@plt>
mov    0x2c9b(%rip),%rax
mov    (%rax),%edx
xor    %ebp,%ebp
mov    %r15,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
mov    %r15,%rdi
call   1060 <ftell@plt>
mov    0x2c6e(%rip),%rcx
mov    (%rcx),%edx
mov    %rax,%rsi
sub    $0x10000,%rsi
cmovb  %rbp,%rsi
mov    $0x10000,%ebp
cmovb  %rax,%rbp
mov    %r15,%rdi
call   1080 <fseek@plt>
lea    0x30(%rsp),%rdi
sub    %rbp,%rdi
add    $0x10000,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    %r15,%rcx
call   1030 <fread@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    0x10(%rsp),%rbp
mov    %rbx,0x28(%rsp)
xor    %r12d,%r12d
mov    %r14d,0x1c(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %rax,%r15
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rbx
mov    %rax,%r13
shl    $0x8,%r13d
or     %r15d,%r13d
mov    %rbx,%rdi
call   1050 <getByte@plt>
mov    %rax,%r15
shl    $0x10,%r15d
mov    %rbx,%rdi
call   1050 <getByte@plt>
shl    $0x18,%eax
or     %r15d,%eax
or     %r13d,%eax
mov    %eax,%ebx
and    $0x7fffffff,%ebx
cmp    $0x184d2204,%r14d
cmovne %eax,%ebx
test   %ebx,%ebx
je     1856 <unlz4+0x6c6>
cmp    $0x184c2102,%r14d
je     1490 <unlz4+0x300>
test   %eax,%eax
jns    1490 <unlz4+0x300>
test   %ebx,%ebx
mov    (%rsp),%r13
jle    1826 <unlz4+0x696>
add    $0x1,%ebx
jmp    145c <unlz4+0x2cc>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
jbe    1826 <unlz4+0x696>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r12d,%ecx
add    $0x1,%r12d
mov    %al,0x30(%rsp,%rcx,1)
cmp    $0x10000,%r12d
jne    1450 <unlz4+0x2c0>
lea    0x30(%rsp),%rdi
mov    $0x10000,%esi
mov    %rbp,%rdx
call   10b0 <sendBytes@plt>
xor    %r12d,%r12d
jmp    1450 <unlz4+0x2c0>
nop
test   %ebx,%ebx
mov    (%rsp),%r13
jle    1810 <unlz4+0x680>
xor    %r14d,%r14d
mov    %ebx,0xc(%rsp)
jmp    14dd <unlz4+0x34d>
mov    %r12d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    (%rsp,%r10,1),%rsi
add    $0x30,%rsi
mov    %r15d,%edx
call   1070 <memcpy@plt>
mov    %r13d,%r12d
mov    (%rsp),%r13
nopw   0x0(%rax,%rax,1)
mov    0xc(%rsp),%ebx
cmp    %ebx,%r14d
jge    1810 <unlz4+0x680>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %rax,%r15
add    $0x1,%r14d
mov    %r15d,%ebx
shr    $0x4,%ebx
and    $0xf,%ebx
cmp    $0xf,%ebx
jne    1530 <unlz4+0x3a0>
mov    $0xf,%ebx
nop
mov    %ebx,%ebp
mov    %r13,%rdi
call   1050 <getByte@plt>
movzbl %al,%ecx
lea    (%rcx,%rbp,1),%ebx
add    $0x1,%r14d
cmp    $0xff,%ecx
je     1500 <unlz4+0x370>
movzbl %al,%eax
add    %eax,%ebp
add    %r14d,%ebp
mov    %ebp,%r14d
mov    0x10(%rsp),%rbp
jmp    1537 <unlz4+0x3a7>
xchg   %ax,%ax
add    %ebx,%r14d
test   %ebx,%ebx
je     1580 <unlz4+0x3f0>
add    $0x1,%ebx
jmp    1548 <unlz4+0x3b8>
nopl   0x0(%rax)
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
jle    1580 <unlz4+0x3f0>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r12d,%ecx
add    $0x1,%r12d
mov    %al,0x30(%rsp,%rcx,1)
cmp    $0x10000,%r12d
jne    1540 <unlz4+0x3b0>
lea    0x30(%rsp),%rdi
mov    $0x10000,%esi
mov    %rbp,%rdx
call   10b0 <sendBytes@plt>
xor    %r12d,%r12d
jmp    1540 <unlz4+0x3b0>
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%ebx
cmp    %ebx,%r14d
je     1810 <unlz4+0x680>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %rax,%rbx
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %rax,%r13
shl    $0x8,%r13d
or     %ebx,%r13d
jne    15b8 <unlz4+0x428>
lea    0xaa5(%rip),%rdi
call   1090 <error@plt>
add    $0x2,%r14d
and    $0xf,%r15d
add    $0x4,%r15d
cmp    $0x13,%r15d
jne    15f9 <unlz4+0x469>
mov    $0x13,%r15d
mov    (%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1050 <getByte@plt>
movzbl %al,%eax
add    %eax,%r15d
add    $0x1,%r14d
cmp    $0xff,%eax
je     15e0 <unlz4+0x450>
lea    0x10000(%r12),%ebx
cmp    %r13d,%r12d
cmovae %r12d,%ebx
sub    %r13d,%ebx
lea    (%r15,%r12,1),%r13d
cmp    $0x10000,%r13d
jae    1660 <unlz4+0x4d0>
lea    (%r15,%rbx,1),%eax
cmp    $0xffff,%eax
jg     1660 <unlz4+0x4d0>
movslq %ebx,%r10
cmp    %eax,%r12d
jae    14a5 <unlz4+0x315>
cmp    %r13d,%ebx
jae    14a5 <unlz4+0x315>
test   %r15d,%r15d
mov    $0x1,%eax
cmovle %r15d,%eax
mov    %r15d,%ecx
sub    %eax,%ecx
cmp    $0x1f,%ecx
jae    16bf <unlz4+0x52f>
mov    (%rsp),%r13
jmp    17cf <unlz4+0x63f>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15d
mov    (%rsp),%r13
xor    %edx,%edx
jmp    1687 <unlz4+0x4f7>
nopl   0x0(%rax)
cmp    $0x10000,%ebx
cmove  %edx,%ebx
add    $0xffffffff,%r15d
cmp    $0x1,%r15d
jle    14d0 <unlz4+0x340>
movslq %ebx,%rax
add    $0x1,%ebx
movzbl 0x30(%rsp,%rax,1),%eax
mov    %r12d,%ecx
add    $0x1,%r12d
mov    %al,0x30(%rsp,%rcx,1)
cmp    $0x10000,%r12d
jne    1670 <unlz4+0x4e0>
lea    0x30(%rsp),%rdi
mov    $0x10000,%esi
mov    %rbp,%rdx
call   10b0 <sendBytes@plt>
xor    %edx,%edx
xor    %r12d,%r12d
jmp    1670 <unlz4+0x4e0>
test   %r15d,%r15d
mov    $0x1,%eax
cmovle %r15d,%eax
mov    %r15d,%edx
sub    %eax,%edx
add    %r12d,%edx
mov    (%rsp),%r13
jb     17cf <unlz4+0x63f>
mov    %r12d,%esi
lea    (%rsp,%rsi,1),%rdx
add    $0x30,%rdx
test   %r15d,%r15d
mov    $0x1,%edi
cmovle %r15d,%edi
mov    %r15d,%eax
sub    %edi,%eax
lea    (%r10,%rax,1),%rdi
lea    0x31(%rsp),%rbx
add    %rbx,%rdi
cmp    %rdi,%rdx
jae    1721 <unlz4+0x591>
add    %rsi,%rax
add    %rbx,%rax
lea    (%rsp,%r10,1),%rdx
add    $0x30,%rdx
cmp    %rax,%rdx
jb     17cf <unlz4+0x63f>
add    $0x1,%rcx
mov    %rcx,%r8
and    $0xffffffffffffffe0,%r8
lea    -0x20(%r8),%rax
mov    %rax,%r9
shr    $0x5,%r9
add    $0x1,%r9
test   %rax,%rax
je     1801 <unlz4+0x671>
mov    %r9,%rdi
and    $0xfffffffffffffffe,%rdi
lea    0x60(%rsp),%rax
lea    (%rax,%r10,1),%rdx
lea    0x20(%r12),%eax
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%rsi,%rbx,1),%ebp
movups -0x30(%rdx,%rbx,1),%xmm0
movups -0x20(%rdx,%rbx,1),%xmm1
movups %xmm0,0x30(%rsp,%rbp,1)
movups %xmm1,0x40(%rsp,%rbp,1)
lea    (%rax,%rbx,1),%ebp
movups -0x10(%rdx,%rbx,1),%xmm0
movups (%rdx,%rbx,1),%xmm1
movups %xmm0,0x30(%rsp,%rbp,1)
movups %xmm1,0x40(%rsp,%rbp,1)
add    $0x40,%rbx
add    $0xfffffffffffffffe,%rdi
jne    1760 <unlz4+0x5d0>
test   $0x1,%r9b
je     17b8 <unlz4+0x628>
lea    (%rbx,%r10,1),%rax
add    %r12d,%ebx
movups 0x30(%rsp,%rax,1),%xmm0
movups 0x40(%rsp,%rax,1),%xmm1
movups %xmm0,0x30(%rsp,%rbx,1)
movups %xmm1,0x40(%rsp,%rbx,1)
add    %r8d,%r12d
cmp    %r8,%rcx
mov    0x10(%rsp),%rbp
je     14d0 <unlz4+0x340>
add    %r8,%r10
sub    %r8d,%r15d
lea    (%rsp,%r10,1),%rax
add    $0x30,%rax
add    $0x1,%r15d
nopl   0x0(%rax,%rax,1)
movzbl (%rax),%ecx
mov    %r12d,%edx
add    $0x1,%r12d
mov    %cl,0x30(%rsp,%rdx,1)
add    $0x1,%rax
add    $0xffffffff,%r15d
cmp    $0x1,%r15d
jg     17e0 <unlz4+0x650>
jmp    14d0 <unlz4+0x340>
xor    %ebx,%ebx
test   $0x1,%r9b
jne    179d <unlz4+0x60d>
jmp    17b8 <unlz4+0x628>
nopl   0x0(%rax,%rax,1)
mov    0x1c(%rsp),%r14d
cmp    $0x184c2102,%r14d
jne    1826 <unlz4+0x696>
cmp    $0x800000,%ebx
jl     185a <unlz4+0x6ca>
cmpb   $0x0,0x20(%rsp)
je     13d0 <unlz4+0x240>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
jmp    13d0 <unlz4+0x240>
mov    (%rsp),%r13
cmpb   $0x0,0x28(%rsp)
je     1881 <unlz4+0x6f1>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
mov    %r13,%rdi
call   1050 <getByte@plt>
lea    0x30(%rsp),%rdi
mov    %r12d,%esi
mov    %rbp,%rdx
call   10b0 <sendBytes@plt>
add    $0x10038,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [18 x i8] c"invalid signature\00"
@.str.3 = [41 x i8] c"only LZ4 file format version 1 supported\00"
@.str.4 = [23 x i8] c"cannot open dictionary\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.5 = [15 x i8] c"invalid offset\00"
define void @unlz4(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8
%17 = alloca i8
%18 = alloca i8
%19 = alloca i8
%20 = alloca i8
%21 = alloca i8
%22 = alloca [65536 x i8]
%23 = alloca i32
%24 = alloca i32*
%25 = alloca i64
%26 = alloca i64
%27 = alloca i32
%28 = alloca i8
%29 = alloca i32
%30 = alloca i8
%31 = alloca i32
%32 = alloca i8
%33 = alloca i32
%34 = alloca i32
%35 = alloca i8
%36 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%37 = load i8*, i8** %4
%38 = call i32* @fopen(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %38, i32** %7
%39 = load i8*, i8** %5
%40 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %40, i32** %8
%41 = load i32*, i32** %7
%42 = call i8* @getByte(i32* %41)
%43 = ptrtoint i8* %42 to i8
store i8 %43, i8* %9
%44 = load i32*, i32** %7
%45 = call i8* @getByte(i32* %44)
%46 = ptrtoint i8* %45 to i8
store i8 %46, i8* %10
%47 = load i32*, i32** %7
%48 = call i8* @getByte(i32* %47)
%49 = ptrtoint i8* %48 to i8
store i8 %49, i8* %11
%50 = load i32*, i32** %7
%51 = call i8* @getByte(i32* %50)
%52 = ptrtoint i8* %51 to i8
store i8 %52, i8* %12
%53 = load i8, i8* %12
%54 = zext i8 %53 to i32
%55 = shl i32 %54, 24
%56 = load i8, i8* %11
%57 = zext i8 %56 to i32
%58 = shl i32 %57, 16
%59 = or i32 %55, %58
%60 = load i8, i8* %10
%61 = zext i8 %60 to i32
%62 = shl i32 %61, 8
%63 = or i32 %59, %62
%64 = load i8, i8* %9
%65 = zext i8 %64 to i32
%66 = or i32 %63, %65
store i32 %66, i32* %13
%67 = load i32, i32* %13
%68 = icmp eq i32 %67, 407708164
%69 = zext i1 %68 to i32
store i32 %69, i32* %14
%70 = load i32, i32* %13
%71 = icmp eq i32 %70, 407642370
%72 = zext i1 %71 to i32
store i32 %72, i32* %15
%73 = load i32, i32* %14
%74 = icmp ne i32 %73, 0
br i1 %74, label %80, label %75
75: ; preds = %3
%76 = load i32, i32* %15
%77 = icmp ne i32 %76, 0
br i1 %77, label %80, label %78
78: ; preds = %75
%79 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %80
80: ; preds = %78, %75, %3
store i8 0, i8* %16
store i8 0, i8* %17
store i8 0, i8* %18
store i8 0, i8* %19
%81 = load i32, i32* %14
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %149
83: ; preds = %80
%84 = load i32*, i32** %7
%85 = call i8* @getByte(i32* %84)
%86 = ptrtoint i8* %85 to i8
store i8 %86, i8* %20
%87 = load i8, i8* %20
%88 = zext i8 %87 to i32
%89 = and i32 %88, 16
%90 = trunc i32 %89 to i8
store i8 %90, i8* %16
%91 = load i8, i8* %20
%92 = zext i8 %91 to i32
%93 = and i32 %92, 8
%94 = trunc i32 %93 to i8
store i8 %94, i8* %17
%95 = load i8, i8* %20
%96 = zext i8 %95 to i32
%97 = and i32 %96, 4
%98 = trunc i32 %97 to i8
store i8 %98, i8* %18
%99 = load i8, i8* %20
%100 = zext i8 %99 to i32
%101 = and i32 %100, 1
%102 = trunc i32 %101 to i8
store i8 %102, i8* %19
%103 = load i8, i8* %20
%104 = zext i8 %103 to i32
%105 = ashr i32 %104, 6
%106 = trunc i32 %105 to i8
store i8 %106, i8* %21
%107 = load i8, i8* %21
%108 = zext i8 %107 to i32
%109 = icmp ne i32 %108, 1
br i1 %109, label %110, label %112
110: ; preds = %83
%111 = call i32 @error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0))
br label %112
112: ; preds = %110, %83
%113 = load i32*, i32** %7
%114 = call i8* @getByte(i32* %113)
%115 = load i8, i8* %17
%116 = icmp ne i8 %115, 0
br i1 %116, label %117, label %134
117: ; preds = %112
%118 = load i32*, i32** %7
%119 = call i8* @getByte(i32* %118)
%120 = load i32*, i32** %7
%121 = call i8* @getByte(i32* %120)
%122 = load i32*, i32** %7
%123 = call i8* @getByte(i32* %122)
%124 = load i32*, i32** %7
%125 = call i8* @getByte(i32* %124)
%126 = load i32*, i32** %7
%127 = call i8* @getByte(i32* %126)
%128 = load i32*, i32** %7
%129 = call i8* @getByte(i32* %128)
%130 = load i32*, i32** %7
%131 = call i8* @getByte(i32* %130)
%132 = load i32*, i32** %7
%133 = call i8* @getByte(i32* %132)
br label %134
134: ; preds = %117, %112
%135 = load i8, i8* %19
%136 = icmp ne i8 %135, 0
br i1 %136, label %137, label %146
137: ; preds = %134
%138 = load i32*, i32** %7
%139 = call i8* @getByte(i32* %138)
%140 = load i32*, i32** %7
%141 = call i8* @getByte(i32* %140)
%142 = load i32*, i32** %7
%143 = call i8* @getByte(i32* %142)
%144 = load i32*, i32** %7
%145 = call i8* @getByte(i32* %144)
br label %146
146: ; preds = %137, %134
%147 = load i32*, i32** %7
%148 = call i8* @getByte(i32* %147)
br label %149
149: ; preds = %146, %80
store i32 0, i32* %23
%150 = load i8*, i8** %6
%151 = icmp ne i8* %150, null
br i1 %151, label %152, label %191
152: ; preds = %149
%153 = load i8*, i8** %6
%154 = call i32* @fopen(i8* %153, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %154, i32** %24
%155 = load i32*, i32** %24
%156 = icmp ne i32* %155, null
br i1 %156, label %159, label %157
157: ; preds = %152
%158 = call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %159
159: ; preds = %157, %152
%160 = load i32*, i32** %24
%161 = load i32, i32* @SEEK_END
%162 = call i32 @fseek(i32* %160, i64 0, i32 %161)
%163 = load i32*, i32** %24
%164 = call i64 @ftell(i32* %163)
store i64 %164, i64* %25
%165 = load i64, i64* %25
%166 = icmp ult i64 %165, 65536
br i1 %166, label %167, label %168
167: ; preds = %159
br label %171
168: ; preds = %159
%169 = load i64, i64* %25
%170 = sub i64 %169, 65536
br label %171
171: ; preds = %168, %167
%172 = phi i64 [ 0, %167 ], [ %170, %168 ]
store i64 %172, i64* %26
%173 = load i32*, i32** %24
%174 = load i64, i64* %26
%175 = load i32, i32* @SEEK_SET
%176 = call i32 @fseek(i32* %173, i64 %174, i32 %175)
%177 = load i64, i64* %25
%178 = icmp ugt i64 %177, 65536
br i1 %178, label %179, label %180
179: ; preds = %171
store i64 65536, i64* %25
br label %180
180: ; preds = %179, %171
%181 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 0
%182 = getelementptr inbounds i8, i8* %181, i64 65536
%183 = load i64, i64* %25
%184 = sub i64 0, %183
%185 = getelementptr inbounds i8, i8* %182, i64 %184
%186 = load i64, i64* %25
%187 = load i32*, i32** %24
%188 = call i32 @fread(i8* %185, i32 1, i64 %186, i32* %187)
%189 = load i32*, i32** %24
%190 = call i32 @fclose(i32* %189)
br label %191
191: ; preds = %180, %149
br label %192
192: ; preds = %191, %472
%193 = load i32*, i32** %7
%194 = call i8* @getByte(i32* %193)
%195 = ptrtoint i8* %194 to i32
store i32 %195, i32* %27
%196 = load i32*, i32** %7
%197 = call i8* @getByte(i32* %196)
%198 = ptrtoint i8* %197 to i32
%199 = shl i32 %198, 8
%200 = load i32, i32* %27
%201 = or i32 %200, %199
store i32 %201, i32* %27
%202 = load i32*, i32** %7
%203 = call i8* @getByte(i32* %202)
%204 = ptrtoint i8* %203 to i32
%205 = shl i32 %204, 16
%206 = load i32, i32* %27
%207 = or i32 %206, %205
store i32 %207, i32* %27
%208 = load i32*, i32** %7
%209 = call i8* @getByte(i32* %208)
%210 = ptrtoint i8* %209 to i32
%211 = shl i32 %210, 24
%212 = load i32, i32* %27
%213 = or i32 %212, %211
store i32 %213, i32* %27
%214 = load i32, i32* %15
%215 = icmp ne i32 %214, 0
br i1 %215, label %220, label %216
216: ; preds = %192
%217 = load i32, i32* %27
%218 = and i32 %217, -2147483648
%219 = icmp eq i32 %218, 0
br label %220
220: ; preds = %216, %192
%221 = phi i1 [ true, %192 ], [ %219, %216 ]
%222 = zext i1 %221 to i32
%223 = trunc i32 %222 to i8
store i8 %223, i8* %28
%224 = load i32, i32* %14
%225 = icmp ne i32 %224, 0
br i1 %225, label %226, label %229
226: ; preds = %220
%227 = load i32, i32* %27
%228 = and i32 %227, 2147483647
store i32 %228, i32* %27
br label %229
229: ; preds = %226, %220
%230 = load i32, i32* %27
%231 = icmp eq i32 %230, 0
br i1 %231, label %232, label %233
232: ; preds = %229
br label %473
233: ; preds = %229
%234 = load i8, i8* %28
%235 = icmp ne i8 %234, 0
br i1 %235, label %236, label %439
236: ; preds = %233
store i32 0, i32* %29
br label %237
237: ; preds = %430, %236
%238 = load i32, i32* %29
%239 = load i32, i32* %27
%240 = icmp slt i32 %238, %239
br i1 %240, label %241, label %431
241: ; preds = %237
%242 = load i32*, i32** %7
%243 = call i8* @getByte(i32* %242)
%244 = ptrtoint i8* %243 to i8
store i8 %244, i8* %30
%245 = load i32, i32* %29
%246 = add nsw i32 %245, 1
store i32 %246, i32* %29
%247 = load i8, i8* %30
%248 = zext i8 %247 to i32
%249 = ashr i32 %248, 4
%250 = and i32 %249, 15
store i32 %250, i32* %31
%251 = load i32, i32* %31
%252 = icmp eq i32 %251, 15
br i1 %252, label %253, label %269
253: ; preds = %241
br label %254
254: ; preds = %264, %253
%255 = load i32*, i32** %7
%256 = call i8* @getByte(i32* %255)
%257 = ptrtoint i8* %256 to i8
store i8 %257, i8* %32
%258 = load i8, i8* %32
%259 = zext i8 %258 to i32
%260 = load i32, i32* %31
%261 = add nsw i32 %260, %259
store i32 %261, i32* %31
%262 = load i32, i32* %29
%263 = add nsw i32 %262, 1
store i32 %263, i32* %29
br label %264
264: ; preds = %254
%265 = load i8, i8* %32
%266 = zext i8 %265 to i32
%267 = icmp eq i32 %266, 255
br i1 %267, label %254, label %268
268: ; preds = %264
br label %269
269: ; preds = %268, %241
%270 = load i32, i32* %31
%271 = load i32, i32* %29
%272 = add nsw i32 %271, %270
store i32 %272, i32* %29
br label %273
273: ; preds = %291, %269
%274 = load i32, i32* %31
%275 = add nsw i32 %274, -1
store i32 %275, i32* %31
%276 = icmp sgt i32 %274, 0
br i1 %276, label %277, label %292
277: ; preds = %273
%278 = load i32*, i32** %7
%279 = call i8* @getByte(i32* %278)
%280 = ptrtoint i8* %279 to i8
%281 = load i32, i32* %23
%282 = add i32 %281, 1
store i32 %282, i32* %23
%283 = zext i32 %281 to i64
%284 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 %283
store i8 %280, i8* %284
%285 = load i32, i32* %23
%286 = icmp eq i32 %285, 65536
br i1 %286, label %287, label %291
287: ; preds = %277
%288 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 0
%289 = load i32*, i32** %8
%290 = call i32 @sendBytes(i8* %288, i32 65536, i32* %289)
store i32 0, i32* %23
br label %291
291: ; preds = %287, %277
br label %273
292: ; preds = %273
%293 = load i32, i32* %29
%294 = load i32, i32* %27
%295 = icmp eq i32 %293, %294
br i1 %295, label %296, label %297
296: ; preds = %292
br label %431
297: ; preds = %292
%298 = load i32, i32* %29
%299 = add nsw i32 %298, 2
store i32 %299, i32* %29
%300 = load i32*, i32** %7
%301 = call i8* @getByte(i32* %300)
%302 = ptrtoint i8* %301 to i32
store i32 %302, i32* %33
%303 = load i32*, i32** %7
%304 = call i8* @getByte(i32* %303)
%305 = ptrtoint i8* %304 to i32
%306 = shl i32 %305, 8
%307 = load i32, i32* %33
%308 = or i32 %307, %306
store i32 %308, i32* %33
%309 = load i32, i32* %33
%310 = icmp eq i32 %309, 0
br i1 %310, label %311, label %313
311: ; preds = %297
%312 = call i32 @error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %313
313: ; preds = %311, %297
%314 = load i8, i8* %30
%315 = zext i8 %314 to i32
%316 = and i32 %315, 15
%317 = add nsw i32 4, %316
store i32 %317, i32* %34
%318 = load i32, i32* %34
%319 = icmp eq i32 %318, 19
br i1 %319, label %320, label %336
320: ; preds = %313
br label %321
321: ; preds = %331, %320
%322 = load i32*, i32** %7
%323 = call i8* @getByte(i32* %322)
%324 = ptrtoint i8* %323 to i8
store i8 %324, i8* %35
%325 = load i8, i8* %35
%326 = zext i8 %325 to i32
%327 = load i32, i32* %34
%328 = add nsw i32 %327, %326
store i32 %328, i32* %34
%329 = load i32, i32* %29
%330 = add nsw i32 %329, 1
store i32 %330, i32* %29
br label %331
331: ; preds = %321
%332 = load i8, i8* %35
%333 = zext i8 %332 to i32
%334 = icmp eq i32 %333, 255
br i1 %334, label %321, label %335
335: ; preds = %331
br label %336
336: ; preds = %335, %313
%337 = load i32, i32* %23
%338 = load i32, i32* %33
%339 = icmp uge i32 %337, %338
br i1 %339, label %340, label %344
340: ; preds = %336
%341 = load i32, i32* %23
%342 = load i32, i32* %33
%343 = sub i32 %341, %342
br label %349
344: ; preds = %336
%345 = load i32, i32* %23
%346 = add i32 65536, %345
%347 = load i32, i32* %33
%348 = sub i32 %346, %347
br label %349
349: ; preds = %344, %340
%350 = phi i32 [ %343, %340 ], [ %348, %344 ]
store i32 %350, i32* %36
%351 = load i32, i32* %23
%352 = load i32, i32* %34
%353 = add i32 %351, %352
%354 = icmp ult i32 %353, 65536
br i1 %354, label %355, label %403
355: ; preds = %349
%356 = load i32, i32* %36
%357 = load i32, i32* %34
%358 = add nsw i32 %356, %357
%359 = icmp slt i32 %358, 65536
br i1 %359, label %360, label %403
360: ; preds = %355
%361 = load i32, i32* %23
%362 = load i32, i32* %36
%363 = load i32, i32* %34
%364 = add nsw i32 %362, %363
%365 = icmp uge i32 %361, %364
br i1 %365, label %372, label %366
366: ; preds = %360
%367 = load i32, i32* %36
%368 = load i32, i32* %23
%369 = load i32, i32* %34
%370 = add i32 %368, %369
%371 = icmp uge i32 %367, %370
br i1 %371, label %372, label %386
372: ; preds = %366, %360
%373 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 0
%374 = load i32, i32* %23
%375 = zext i32 %374 to i64
%376 = getelementptr inbounds i8, i8* %373, i64 %375
%377 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 0
%378 = load i32, i32* %36
%379 = sext i32 %378 to i64
%380 = getelementptr inbounds i8, i8* %377, i64 %379
%381 = load i32, i32* %34
%382 = call i32 @memcpy(i8* %376, i8* %380, i32 %381)
%383 = load i32, i32* %34
%384 = load i32, i32* %23
%385 = add i32 %384, %383
store i32 %385, i32* %23
br label %402
386: ; preds = %366
br label %387
387: ; preds = %391, %386
%388 = load i32, i32* %34
%389 = add nsw i32 %388, -1
store i32 %389, i32* %34
%390 = icmp sgt i32 %388, 0
br i1 %390, label %391, label %401
391: ; preds = %387
%392 = load i32, i32* %36
%393 = add nsw i32 %392, 1
store i32 %393, i32* %36
%394 = sext i32 %392 to i64
%395 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 %394
%396 = load i8, i8* %395
%397 = load i32, i32* %23
%398 = add i32 %397, 1
store i32 %398, i32* %23
%399 = zext i32 %397 to i64
%400 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 %399
store i8 %396, i8* %400
br label %387
401: ; preds = %387
br label %402
402: ; preds = %401, %372
br label %430
403: ; preds = %355, %349
br label %404
404: ; preds = %428, %403
%405 = load i32, i32* %34
%406 = add nsw i32 %405, -1
store i32 %406, i32* %34
%407 = icmp sgt i32 %405, 0
br i1 %407, label %408, label %429
408: ; preds = %404
%409 = load i32, i32* %36
%410 = add nsw i32 %409, 1
store i32 %410, i32* %36
%411 = sext i32 %409 to i64
%412 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 %411
%413 = load i8, i8* %412
%414 = load i32, i32* %23
%415 = add i32 %414, 1
store i32 %415, i32* %23
%416 = zext i32 %414 to i64
%417 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 %416
store i8 %413, i8* %417
%418 = load i32, i32* %23
%419 = icmp eq i32 %418, 65536
br i1 %419, label %420, label %424
420: ; preds = %408
%421 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 0
%422 = load i32*, i32** %8
%423 = call i32 @sendBytes(i8* %421, i32 65536, i32* %422)
store i32 0, i32* %23
br label %424
424: ; preds = %420, %408
%425 = load i32, i32* %36
%426 = icmp eq i32 %425, 65536
br i1 %426, label %427, label %428
427: ; preds = %424
store i32 0, i32* %36
br label %428
428: ; preds = %427, %424
br label %404
429: ; preds = %404
br label %430
430: ; preds = %429, %402
br label %237
431: ; preds = %296, %237
%432 = load i32, i32* %15
%433 = icmp ne i32 %432, 0
br i1 %433, label %434, label %438
434: ; preds = %431
%435 = load i32, i32* %27
%436 = icmp slt i32 %435, 8388608
br i1 %436, label %437, label %438
437: ; preds = %434
br label %473
438: ; preds = %434, %431
br label %460
439: ; preds = %233
br label %440
440: ; preds = %458, %439
%441 = load i32, i32* %27
%442 = add nsw i32 %441, -1
store i32 %442, i32* %27
%443 = icmp sgt i32 %441, 0
br i1 %443, label %444, label %459
444: ; preds = %440
%445 = load i32*, i32** %7
%446 = call i8* @getByte(i32* %445)
%447 = ptrtoint i8* %446 to i8
%448 = load i32, i32* %23
%449 = add i32 %448, 1
store i32 %449, i32* %23
%450 = zext i32 %448 to i64
%451 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 %450
store i8 %447, i8* %451
%452 = load i32, i32* %23
%453 = icmp eq i32 %452, 65536
br i1 %453, label %454, label %458
454: ; preds = %444
%455 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 0
%456 = load i32*, i32** %8
%457 = call i32 @sendBytes(i8* %455, i32 65536, i32* %456)
store i32 0, i32* %23
br label %458
458: ; preds = %454, %444
br label %440
459: ; preds = %440
br label %460
460: ; preds = %459, %438
%461 = load i8, i8* %16
%462 = icmp ne i8 %461, 0
br i1 %462, label %463, label %472
463: ; preds = %460
%464 = load i32*, i32** %7
%465 = call i8* @getByte(i32* %464)
%466 = load i32*, i32** %7
%467 = call i8* @getByte(i32* %466)
%468 = load i32*, i32** %7
%469 = call i8* @getByte(i32* %468)
%470 = load i32*, i32** %7
%471 = call i8* @getByte(i32* %470)
br label %472
472: ; preds = %463, %460
br label %192
473: ; preds = %437, %232
%474 = load i8, i8* %18
%475 = icmp ne i8 %474, 0
br i1 %475, label %476, label %485
476: ; preds = %473
%477 = load i32*, i32** %7
%478 = call i8* @getByte(i32* %477)
%479 = load i32*, i32** %7
%480 = call i8* @getByte(i32* %479)
%481 = load i32*, i32** %7
%482 = call i8* @getByte(i32* %481)
%483 = load i32*, i32** %7
%484 = call i8* @getByte(i32* %483)
br label %485
485: ; preds = %476, %473
%486 = getelementptr inbounds [65536 x i8], [65536 x i8]* %22, i64 0, i64 0
%487 = load i32, i32* %23
%488 = load i32*, i32** %8
%489 = call i32 @sendBytes(i8* %486, i32 %487, i32* %488)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [18 x i8] c"invalid signature\00"
@.str.3 = [41 x i8] c"only LZ4 file format version 1 supported\00"
@.str.4 = [23 x i8] c"cannot open dictionary\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.5 = [15 x i8] c"invalid offset\00"
define void @unlz4(i8* nocapture %0, i8* nocapture %1, i8* %2) {
%4 = alloca [65536 x i8]
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i8* @getByte(i32* %5)
%8 = ptrtoint i8* %7 to i64
%9 = trunc i64 %8 to i32
%10 = tail call i8* @getByte(i32* %5)
%11 = ptrtoint i8* %10 to i64
%12 = trunc i64 %11 to i32
%13 = tail call i8* @getByte(i32* %5)
%14 = ptrtoint i8* %13 to i64
%15 = trunc i64 %14 to i32
%16 = tail call i8* @getByte(i32* %5)
%17 = ptrtoint i8* %16 to i64
%18 = trunc i64 %17 to i32
%19 = shl i32 %18, 24
%20 = shl i32 %15, 16
%21 = and i32 %20, 16711680
%22 = or i32 %19, %21
%23 = shl i32 %12, 8
%24 = and i32 %23, 65280
%25 = or i32 %22, %24
%26 = and i32 %9, 255
%27 = or i32 %25, %26
%28 = icmp eq i32 %27, 407708164
%29 = icmp eq i32 %27, 407642370
switch i32 %27, label %30 [
i32 407708164, label %32
i32 407642370, label %32
]
30: ; preds = %3
%31 = tail call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %3, %3, %30
br i1 %28, label %33, label %66
33: ; preds = %32
%34 = tail call i8* @getByte(i32* %5)
%35 = ptrtoint i8* %34 to i64
%36 = trunc i64 %35 to i8
%37 = and i8 %36, 16
%38 = and i8 %36, 4
%39 = and i64 %35, 192
%40 = icmp eq i64 %39, 64
br i1 %40, label %43, label %41
41: ; preds = %33
%42 = tail call i32 @error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41, %33
%44 = tail call i8* @getByte(i32* %5)
%45 = and i64 %35, 8
%46 = icmp eq i64 %45, 0
br i1 %46, label %56, label %47
47: ; preds = %43
%48 = tail call i8* @getByte(i32* %5)
%49 = tail call i8* @getByte(i32* %5)
%50 = tail call i8* @getByte(i32* %5)
%51 = tail call i8* @getByte(i32* %5)
%52 = tail call i8* @getByte(i32* %5)
%53 = tail call i8* @getByte(i32* %5)
%54 = tail call i8* @getByte(i32* %5)
%55 = tail call i8* @getByte(i32* %5)
br label %56
56: ; preds = %47, %43
%57 = and i64 %35, 1
%58 = icmp eq i64 %57, 0
br i1 %58, label %64, label %59
59: ; preds = %56
%60 = tail call i8* @getByte(i32* %5)
%61 = tail call i8* @getByte(i32* %5)
%62 = tail call i8* @getByte(i32* %5)
%63 = tail call i8* @getByte(i32* %5)
br label %64
64: ; preds = %59, %56
%65 = tail call i8* @getByte(i32* %5)
br label %66
66: ; preds = %64, %32
%67 = phi i8 [ %38, %64 ], [ 0, %32 ]
%68 = phi i8 [ %37, %64 ], [ 0, %32 ]
%69 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 0
%70 = icmp eq i8* %2, null
br i1 %70, label %90, label %71
71: ; preds = %66
%72 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%73 = icmp eq i32* %72, null
br i1 %73, label %74, label %76
74: ; preds = %71
%75 = tail call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %76
76: ; preds = %74, %71
%77 = load i32, i32* @SEEK_END
%78 = tail call i32 @fseek(i32* %72, i64 0, i32 %77)
%79 = tail call i64 @ftell(i32* %72)
%80 = tail call i64 @llvm.usub.sat.i64(i64 %79, i64 65536)
%81 = load i32, i32* @SEEK_SET
%82 = tail call i32 @fseek(i32* %72, i64 %80, i32 %81)
%83 = icmp ult i64 %79, 65536
%84 = select i1 %83, i64 %79, i64 65536
%85 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 65536
%86 = sub nsw i64 0, %84
%87 = getelementptr inbounds i8, i8* %85, i64 %86
%88 = call i32 @fread(i8* %87, i32 1, i64 %84, i32* %72)
%89 = tail call i32 @fclose(i32* %72)
br label %90
90: ; preds = %76, %66
%91 = icmp eq i8 %68, 0
%92 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 1
%93 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 1
br label %94
94: ; preds = %377, %90
%95 = phi i32 [ 0, %90 ], [ %376, %377 ]
%96 = call i8* @getByte(i32* %5)
%97 = ptrtoint i8* %96 to i64
%98 = trunc i64 %97 to i32
%99 = call i8* @getByte(i32* %5)
%100 = ptrtoint i8* %99 to i64
%101 = trunc i64 %100 to i32
%102 = shl i32 %101, 8
%103 = or i32 %102, %98
%104 = call i8* @getByte(i32* %5)
%105 = ptrtoint i8* %104 to i64
%106 = trunc i64 %105 to i32
%107 = shl i32 %106, 16
%108 = or i32 %103, %107
%109 = call i8* @getByte(i32* %5)
%110 = ptrtoint i8* %109 to i64
%111 = trunc i64 %110 to i32
%112 = shl i32 %111, 24
%113 = or i32 %108, %112
%114 = and i32 %113, 2147483647
%115 = select i1 %28, i32 %114, i32 %113
%116 = icmp eq i32 %115, 0
br i1 %116, label %383, label %117
117: ; preds = %94
%118 = icmp sgt i32 %113, -1
%119 = select i1 %29, i1 true, i1 %118
%120 = icmp sgt i32 %115, 0
br i1 %119, label %122, label %121
121: ; preds = %117
br i1 %120, label %359, label %375
122: ; preds = %117
br i1 %120, label %123, label %355
123: ; preds = %122, %352
%124 = phi i32 [ %199, %352 ], [ 0, %122 ]
%125 = phi i32 [ %353, %352 ], [ %95, %122 ]
%126 = call i8* @getByte(i32* %5)
%127 = ptrtoint i8* %126 to i64
%128 = trunc i64 %127 to i32
%129 = add nsw i32 %124, 1
%130 = lshr i32 %128, 4
%131 = and i32 %130, 15
%132 = icmp eq i32 %131, 15
br i1 %132, label %133, label %145
133: ; preds = %123, %133
%134 = phi i32 [ %141, %133 ], [ %129, %123 ]
%135 = phi i32 [ %140, %133 ], [ 15, %123 ]
%136 = call i8* @getByte(i32* %5)
%137 = ptrtoint i8* %136 to i64
%138 = trunc i64 %137 to i32
%139 = and i32 %138, 255
%140 = add nuw nsw i32 %139, %135
%141 = add nsw i32 %134, 1
%142 = icmp eq i32 %139, 255
br i1 %142, label %133, label %143
143: ; preds = %133
%144 = add nsw i32 %140, %141
br label %148
145: ; preds = %123
%146 = add nsw i32 %131, %129
%147 = icmp eq i32 %131, 0
br i1 %147, label %167, label %148
148: ; preds = %143, %145
%149 = phi i32 [ %144, %143 ], [ %146, %145 ]
%150 = phi i32 [ %140, %143 ], [ %131, %145 ]
br label %151
151: ; preds = %148, %164
%152 = phi i32 [ %154, %164 ], [ %150, %148 ]
%153 = phi i32 [ %165, %164 ], [ %125, %148 ]
%154 = add nsw i32 %152, -1
%155 = call i8* @getByte(i32* %5)
%156 = ptrtoint i8* %155 to i64
%157 = trunc i64 %156 to i8
%158 = add i32 %153, 1
%159 = zext i32 %153 to i64
%160 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %159
store i8 %157, i8* %160
%161 = icmp eq i32 %158, 65536
br i1 %161, label %162, label %164
162: ; preds = %151
%163 = call i32 @sendBytes(i8* %69, i32 65536, i32* %6)
br label %164
164: ; preds = %162, %151
%165 = phi i32 [ 0, %162 ], [ %158, %151 ]
%166 = icmp sgt i32 %152, 1
br i1 %166, label %151, label %167
167: ; preds = %164, %145
%168 = phi i32 [ %146, %145 ], [ %149, %164 ]
%169 = phi i32 [ %125, %145 ], [ %165, %164 ]
%170 = icmp eq i32 %168, %115
br i1 %170, label %355, label %171
171: ; preds = %167
%172 = add nsw i32 %168, 2
%173 = call i8* @getByte(i32* %5)
%174 = ptrtoint i8* %173 to i64
%175 = trunc i64 %174 to i32
%176 = call i8* @getByte(i32* %5)
%177 = ptrtoint i8* %176 to i64
%178 = trunc i64 %177 to i32
%179 = shl i32 %178, 8
%180 = or i32 %179, %175
%181 = icmp eq i32 %180, 0
br i1 %181, label %182, label %184
182: ; preds = %171
%183 = call i32 @error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %184
184: ; preds = %182, %171
%185 = and i32 %128, 15
%186 = add nuw nsw i32 %185, 4
%187 = icmp eq i32 %186, 19
br i1 %187, label %188, label %198
188: ; preds = %184, %188
%189 = phi i32 [ %196, %188 ], [ %172, %184 ]
%190 = phi i32 [ %195, %188 ], [ 19, %184 ]
%191 = call i8* @getByte(i32* %5)
%192 = ptrtoint i8* %191 to i64
%193 = trunc i64 %192 to i32
%194 = and i32 %193, 255
%195 = add nuw nsw i32 %194, %190
%196 = add nsw i32 %189, 1
%197 = icmp eq i32 %194, 255
br i1 %197, label %188, label %198
198: ; preds = %188, %184
%199 = phi i32 [ %172, %184 ], [ %196, %188 ]
%200 = phi i32 [ %186, %184 ], [ %195, %188 ]
%201 = icmp ult i32 %169, %180
%202 = add i32 %169, 65536
%203 = select i1 %201, i32 %202, i32 %169
%204 = sub i32 %203, %180
%205 = add i32 %200, %169
%206 = icmp ult i32 %205, 65536
br i1 %206, label %208, label %207
207: ; preds = %208, %198
br label %332
208: ; preds = %198
%209 = add nsw i32 %200, %204
%210 = icmp slt i32 %209, 65536
br i1 %210, label %211, label %207
211: ; preds = %208
%212 = icmp ult i32 %169, %209
%213 = icmp ult i32 %204, %205
%214 = and i1 %212, %213
br i1 %214, label %215, label %314
215: ; preds = %211
%216 = sext i32 %204 to i64
%217 = call i32 @llvm.smin.i32(i32 %200, i32 1)
%218 = sub i32 %200, %217
%219 = zext i32 %218 to i64
%220 = add nuw nsw i64 %219, 1
%221 = icmp ult i32 %218, 31
br i1 %221, label %310, label %222
222: ; preds = %215
%223 = call i32 @llvm.smin.i32(i32 %200, i32 1)
%224 = sub i32 %200, %223
%225 = xor i32 %169, -1
%226 = icmp ugt i32 %224, %225
br i1 %226, label %310, label %227
227: ; preds = %222
%228 = zext i32 %169 to i64
%229 = getelementptr [65536 x i8], [65536 x i8]* %4, i64 0, i64 %228
%230 = call i32 @llvm.smin.i32(i32 %200, i32 1)
%231 = sub i32 %200, %230
%232 = zext i32 %231 to i64
%233 = add nuw nsw i64 %228, %232
%234 = getelementptr i8, i8* %92, i64 %233
%235 = getelementptr [65536 x i8], [65536 x i8]* %4, i64 0, i64 %216
%236 = add nsw i64 %216, %232
%237 = getelementptr i8, i8* %93, i64 %236
%238 = icmp ult i8* %229, %237
%239 = icmp ult i8* %235, %234
%240 = and i1 %238, %239
br i1 %240, label %310, label %241
241: ; preds = %227
%242 = and i64 %220, 8589934560
%243 = add nsw i64 %242, %216
%244 = trunc i64 %242 to i32
%245 = sub i32 %200, %244
%246 = trunc i64 %242 to i32
%247 = add i32 %169, %246
%248 = add nsw i64 %242, -32
%249 = lshr exact i64 %248, 5
%250 = add nuw nsw i64 %249, 1
%251 = and i64 %250, 1
%252 = icmp eq i64 %248, 0
br i1 %252, label %290, label %253
253: ; preds = %241
%254 = and i64 %250, 1152921504606846974
br label %255
255: ; preds = %255, %253
%256 = phi i64 [ 0, %253 ], [ %287, %255 ]
%257 = phi i64 [ 0, %253 ], [ %288, %255 ]
%258 = add i64 %256, %216
%259 = trunc i64 %256 to i32
%260 = add i32 %169, %259
%261 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %258
%262 = bitcast i8* %261 to <16 x i8>*
%263 = load <16 x i8>, <16 x i8>* %262
%264 = getelementptr inbounds i8, i8* %261, i64 16
%265 = bitcast i8* %264 to <16 x i8>*
%266 = load <16 x i8>, <16 x i8>* %265
%267 = zext i32 %260 to i64
%268 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %267
%269 = bitcast i8* %268 to <16 x i8>*
store <16 x i8> %263, <16 x i8>* %269
%270 = getelementptr inbounds i8, i8* %268, i64 16
%271 = bitcast i8* %270 to <16 x i8>*
store <16 x i8> %266, <16 x i8>* %271
%272 = or i64 %256, 32
%273 = add i64 %272, %216
%274 = trunc i64 %272 to i32
%275 = add i32 %169, %274
%276 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %273
%277 = bitcast i8* %276 to <16 x i8>*
%278 = load <16 x i8>, <16 x i8>* %277
%279 = getelementptr inbounds i8, i8* %276, i64 16
%280 = bitcast i8* %279 to <16 x i8>*
%281 = load <16 x i8>, <16 x i8>* %280
%282 = zext i32 %275 to i64
%283 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %282
%284 = bitcast i8* %283 to <16 x i8>*
store <16 x i8> %278, <16 x i8>* %284
%285 = getelementptr inbounds i8, i8* %283, i64 16
%286 = bitcast i8* %285 to <16 x i8>*
store <16 x i8> %281, <16 x i8>* %286
%287 = add nuw i64 %256, 64
%288 = add i64 %257, 2
%289 = icmp eq i64 %288, %254
br i1 %289, label %290, label %255
290: ; preds = %255, %241
%291 = phi i64 [ 0, %241 ], [ %287, %255 ]
%292 = icmp eq i64 %251, 0
br i1 %292, label %308, label %293
293: ; preds = %290
%294 = add i64 %291, %216
%295 = trunc i64 %291 to i32
%296 = add i32 %169, %295
%297 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %294
%298 = bitcast i8* %297 to <16 x i8>*
%299 = load <16 x i8>, <16 x i8>* %298
%300 = getelementptr inbounds i8, i8* %297, i64 16
%301 = bitcast i8* %300 to <16 x i8>*
%302 = load <16 x i8>, <16 x i8>* %301
%303 = zext i32 %296 to i64
%304 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %303
%305 = bitcast i8* %304 to <16 x i8>*
store <16 x i8> %299, <16 x i8>* %305
%306 = getelementptr inbounds i8, i8* %304, i64 16
%307 = bitcast i8* %306 to <16 x i8>*
store <16 x i8> %302, <16 x i8>* %307
br label %308
308: ; preds = %290, %293
%309 = icmp eq i64 %220, %242
br i1 %309, label %352, label %310
310: ; preds = %227, %222, %215, %308
%311 = phi i64 [ %216, %227 ], [ %216, %222 ], [ %216, %215 ], [ %243, %308 ]
%312 = phi i32 [ %200, %227 ], [ %200, %222 ], [ %200, %215 ], [ %245, %308 ]
%313 = phi i32 [ %169, %227 ], [ %169, %222 ], [ %169, %215 ], [ %247, %308 ]
br label %320
314: ; preds = %211
%315 = zext i32 %169 to i64
%316 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %315
%317 = sext i32 %204 to i64
%318 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %317
%319 = call i32 @memcpy(i8* %316, i8* %318, i32 %200)
br label %352
320: ; preds = %310, %320
%321 = phi i64 [ %325, %320 ], [ %311, %310 ]
%322 = phi i32 [ %324, %320 ], [ %312, %310 ]
%323 = phi i32 [ %328, %320 ], [ %313, %310 ]
%324 = add nsw i32 %322, -1
%325 = add nsw i64 %321, 1
%326 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %321
%327 = load i8, i8* %326
%328 = add i32 %323, 1
%329 = zext i32 %323 to i64
%330 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %329
store i8 %327, i8* %330
%331 = icmp sgt i32 %322, 1
br i1 %331, label %320, label %352
332: ; preds = %207, %347
%333 = phi i32 [ %336, %347 ], [ %200, %207 ]
%334 = phi i32 [ %350, %347 ], [ %204, %207 ]
%335 = phi i32 [ %348, %347 ], [ %169, %207 ]
%336 = add nsw i32 %333, -1
%337 = add nsw i32 %334, 1
%338 = sext i32 %334 to i64
%339 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %338
%340 = load i8, i8* %339
%341 = add i32 %335, 1
%342 = zext i32 %335 to i64
%343 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %342
store i8 %340, i8* %343
%344 = icmp eq i32 %341, 65536
br i1 %344, label %345, label %347
345: ; preds = %332
%346 = call i32 @sendBytes(i8* %69, i32 65536, i32* %6)
br label %347
347: ; preds = %345, %332
%348 = phi i32 [ 0, %345 ], [ %341, %332 ]
%349 = icmp eq i32 %337, 65536
%350 = select i1 %349, i32 0, i32 %337
%351 = icmp sgt i32 %333, 1
br i1 %351, label %332, label %352
352: ; preds = %347, %320, %308, %314
%353 = phi i32 [ %205, %314 ], [ %247, %308 ], [ %328, %320 ], [ %348, %347 ]
%354 = icmp slt i32 %199, %115
br i1 %354, label %123, label %355
355: ; preds = %352, %167, %122
%356 = phi i32 [ %95, %122 ], [ %169, %167 ], [ %353, %352 ]
%357 = icmp slt i32 %115, 8388608
%358 = select i1 %29, i1 %357, i1 false
br i1 %358, label %383, label %375
359: ; preds = %121, %372
%360 = phi i32 [ %362, %372 ], [ %115, %121 ]
%361 = phi i32 [ %373, %372 ], [ %95, %121 ]
%362 = add nsw i32 %360, -1
%363 = call i8* @getByte(i32* %5)
%364 = ptrtoint i8* %363 to i64
%365 = trunc i64 %364 to i8
%366 = add i32 %361, 1
%367 = zext i32 %361 to i64
%368 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 %367
store i8 %365, i8* %368
%369 = icmp eq i32 %366, 65536
br i1 %369, label %370, label %372
370: ; preds = %359
%371 = call i32 @sendBytes(i8* %69, i32 65536, i32* %6)
br label %372
372: ; preds = %370, %359
%373 = phi i32 [ 0, %370 ], [ %366, %359 ]
%374 = icmp ugt i32 %360, 1
br i1 %374, label %359, label %375
375: ; preds = %372, %121, %355
%376 = phi i32 [ %356, %355 ], [ %95, %121 ], [ %373, %372 ]
br i1 %91, label %377, label %378
377: ; preds = %375, %378
br label %94
378: ; preds = %375
%379 = call i8* @getByte(i32* %5)
%380 = call i8* @getByte(i32* %5)
%381 = call i8* @getByte(i32* %5)
%382 = call i8* @getByte(i32* %5)
br label %377
383: ; preds = %355, %94
%384 = phi i32 [ %95, %94 ], [ %356, %355 ]
%385 = icmp eq i8 %67, 0
br i1 %385, label %391, label %386
386: ; preds = %383
%387 = call i8* @getByte(i32* %5)
%388 = call i8* @getByte(i32* %5)
%389 = call i8* @getByte(i32* %5)
%390 = call i8* @getByte(i32* %5)
br label %391
391: ; preds = %386, %383
%392 = call i32 @sendBytes(i8* %69, i32 %384, i32* %6)
ret void
}