#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*/ free(char *);
scalar_t__ isalnum(unsigned char);
scalar_t__ isdigit(unsigned char);
scalar_t__ isxdigit(unsigned char);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
scalar_t__ strcasecmp(char *, char *);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int html_entities_decode_inplace(unsigned char *input, int input_len) {
  unsigned char *d = input;
  int i, count;
  char *x;
  x = (char *)malloc(input_len);
  if ((x == NULL) || (input == NULL) || (input_len <= 0))
    return 0;
  i = count = 0;
  while ((i < input_len) && (count < input_len)) {
    int z, copy = 1;
    if ((input[i] == '&') && (i + 1 < input_len)) {
      int k, j = i + 1;
      if (input[j] == '#') {
        copy++;
        if (!(j + 1 < input_len))
          goto HTML_ENT_OUT;
        j++;
        if ((input[j] == 'x') || (input[j] == 'X')) {
          copy++;
          if (!(j + 1 < input_len))
            goto HTML_ENT_OUT;
          j++;
          k = j;
          while ((j < input_len) && (isxdigit(input[j])))
            j++;
          if (j > k) {
            memcpy(x, (const char *)&input[k], j - k);
            x[j - k] = '\0';
            *d++ = (unsigned char)strtol(x, NULL, 16);
            count++;
            if ((j < input_len) && (input[j] == ';'))
              i = j + 1;
            else
              i = j;
            continue;
          } else {
            goto HTML_ENT_OUT;
          }
        } else {
          k = j;
          while ((j < input_len) && (isdigit(input[j])))
            j++;
          if (j > k) {
            memcpy(x, (const char *)&input[k], j - k);
            x[j - k] = '\0';
            *d++ = (unsigned char)strtol(x, NULL, 10);
            count++;
            if ((j < input_len) && (input[j] == ';'))
              i = j + 1;
            else
              i = j;
            continue;
          } else {
            goto HTML_ENT_OUT;
          }
        }
      } else {
        k = j;
        while ((j < input_len) && (isalnum(input[j])))
          j++;
        if (j > k) {
          memcpy(x, (const char *)&input[k], j - k);
          x[j - k] = '\0';
          if (strcasecmp(x, "quot") == 0)
            *d++ = '"';
          else if (strcasecmp(x, "amp") == 0)
            *d++ = '&';
          else if (strcasecmp(x, "lt") == 0)
            *d++ = '<';
          else if (strcasecmp(x, "gt") == 0)
            *d++ = '>';
          else if (strcasecmp(x, "nbsp") == 0)
            *d++ = 160;
          else {
            copy = j - k + 1;
            goto HTML_ENT_OUT;
          }
          count++;
          if ((j < input_len) && (input[j] == ';'))
            i = j + 1;
          else
            i = j;
          continue;
        }
      }
    }
  HTML_ENT_OUT:
    for (z = 0; ((z < copy) && (count < input_len)); z++) {
      *d++ = input[i++];
      count++;
    }
  }
  *d = '\0';
  free(x);
  return count;
}


x86 assembly (clang, -O0):
<html_entities_decode_inplace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11c3 <html_entities_decode_inplace+0x43>
cmpq   $0x0,-0x10(%rbp)
je     11c3 <html_entities_decode_inplace+0x43>
cmpl   $0x0,-0x14(%rbp)
jg     11cf <html_entities_decode_inplace+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    1730 <html_entities_decode_inplace+0x5b0>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x41(%rbp)
jge    11fa <html_entities_decode_inplace+0x7a>
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
setl   %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    120a <html_entities_decode_inplace+0x8a>
jmp    171a <html_entities_decode_inplace+0x59a>
movl   $0x1,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x26,%eax
jne    169f <html_entities_decode_inplace+0x51f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cmp    -0x14(%rbp),%eax
jge    169f <html_entities_decode_inplace+0x51f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x23,%eax
jne    14b1 <html_entities_decode_inplace+0x331>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
cmp    -0x14(%rbp),%eax
jl     1270 <html_entities_decode_inplace+0xf0>
jmp    16a4 <html_entities_decode_inplace+0x524>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x78,%eax
je     12a3 <html_entities_decode_inplace+0x123>
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x58,%eax
jne    13bd <html_entities_decode_inplace+0x23d>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
cmp    -0x14(%rbp),%eax
jl     12c0 <html_entities_decode_inplace+0x140>
jmp    16a4 <html_entities_decode_inplace+0x524>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x40(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x42(%rbp)
jge    12fb <html_entities_decode_inplace+0x17b>
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   10a0 <isxdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x42(%rbp)
mov    -0x42(%rbp),%al
test   $0x1,%al
jne    130b <html_entities_decode_inplace+0x18b>
jmp    1319 <html_entities_decode_inplace+0x199>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12cf <html_entities_decode_inplace+0x14f>
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jle    13b8 <html_entities_decode_inplace+0x238>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x3c(%rbp),%rax
add    %rax,%rsi
mov    -0x40(%rbp),%edx
sub    -0x3c(%rbp),%edx
call   1080 <memcpy@plt>
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1070 <strtol@plt>
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13ad <html_entities_decode_inplace+0x22d>
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
jne    13ad <html_entities_decode_inplace+0x22d>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13b3 <html_entities_decode_inplace+0x233>
mov    -0x40(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11dd <html_entities_decode_inplace+0x5d>
jmp    16a4 <html_entities_decode_inplace+0x524>
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x40(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x43(%rbp)
jge    13ef <html_entities_decode_inplace+0x26f>
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1050 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x43(%rbp)
mov    -0x43(%rbp),%al
test   $0x1,%al
jne    13ff <html_entities_decode_inplace+0x27f>
jmp    140d <html_entities_decode_inplace+0x28d>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    13c3 <html_entities_decode_inplace+0x243>
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jle    14ac <html_entities_decode_inplace+0x32c>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x3c(%rbp),%rax
add    %rax,%rsi
mov    -0x40(%rbp),%edx
sub    -0x3c(%rbp),%edx
call   1080 <memcpy@plt>
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    14a1 <html_entities_decode_inplace+0x321>
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
jne    14a1 <html_entities_decode_inplace+0x321>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    14a7 <html_entities_decode_inplace+0x327>
mov    -0x40(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11dd <html_entities_decode_inplace+0x5d>
jmp    16a4 <html_entities_decode_inplace+0x524>
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x40(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x44(%rbp)
jge    14e3 <html_entities_decode_inplace+0x363>
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1060 <isalnum@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x44(%rbp)
mov    -0x44(%rbp),%al
test   $0x1,%al
jne    14f3 <html_entities_decode_inplace+0x373>
jmp    1501 <html_entities_decode_inplace+0x381>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    14b7 <html_entities_decode_inplace+0x337>
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jle    1695 <html_entities_decode_inplace+0x515>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x3c(%rbp),%rax
add    %rax,%rsi
mov    -0x40(%rbp),%edx
sub    -0x3c(%rbp),%edx
call   1080 <memcpy@plt>
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rdi
lea    0xabd(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1569 <html_entities_decode_inplace+0x3e9>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x22,(%rax)
jmp    1652 <html_entities_decode_inplace+0x4d2>
mov    -0x30(%rbp),%rdi
lea    0xa91(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    159a <html_entities_decode_inplace+0x41a>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x26,(%rax)
jmp    164d <html_entities_decode_inplace+0x4cd>
mov    -0x30(%rbp),%rdi
lea    0xa64(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    15cb <html_entities_decode_inplace+0x44b>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x3c,(%rax)
jmp    1648 <html_entities_decode_inplace+0x4c8>
mov    -0x30(%rbp),%rdi
lea    0xa36(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    15fc <html_entities_decode_inplace+0x47c>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x3e,(%rax)
jmp    1643 <html_entities_decode_inplace+0x4c3>
mov    -0x30(%rbp),%rdi
lea    0xa08(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    162d <html_entities_decode_inplace+0x4ad>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0xa0,(%rax)
jmp    163e <html_entities_decode_inplace+0x4be>
mov    -0x40(%rbp),%eax
sub    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    16a4 <html_entities_decode_inplace+0x524>
jmp    1643 <html_entities_decode_inplace+0x4c3>
jmp    1648 <html_entities_decode_inplace+0x4c8>
jmp    164d <html_entities_decode_inplace+0x4cd>
jmp    1652 <html_entities_decode_inplace+0x4d2>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    168a <html_entities_decode_inplace+0x50a>
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
jne    168a <html_entities_decode_inplace+0x50a>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1690 <html_entities_decode_inplace+0x510>
mov    -0x40(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11dd <html_entities_decode_inplace+0x5d>
jmp    169a <html_entities_decode_inplace+0x51a>
jmp    169f <html_entities_decode_inplace+0x51f>
jmp    16a4 <html_entities_decode_inplace+0x524>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
xor    %eax,%eax
cmp    -0x38(%rbp),%ecx
mov    %al,-0x45(%rbp)
jge    16c8 <html_entities_decode_inplace+0x548>
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
setl   %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    16d8 <html_entities_decode_inplace+0x558>
jmp    1715 <html_entities_decode_inplace+0x595>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    16ab <html_entities_decode_inplace+0x52b>
jmp    11dd <html_entities_decode_inplace+0x5d>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_entities_decode_inplace>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
call   1090 <malloc@plt>
mov    %ebx,%ebp
mov    %rax,0x18(%rsp)
xor    %ebx,%ebx
test   %ebp,%ebp
jle    1745 <html_entities_decode_inplace+0x5c5>
test   %r14,%r14
je     1745 <html_entities_decode_inplace+0x5c5>
cmpq   $0x0,0x18(%rsp)
je     1745 <html_entities_decode_inplace+0x5c5>
mov    %r14,%r9
mov    %ebp,%eax
mov    %rax,0x20(%rsp)
lea    0x1(%r14),%rax
mov    %rax,0x40(%rsp)
lea    0x70(%r14),%rax
mov    %rax,0x30(%rsp)
lea    0x10(%r14),%rax
mov    %rax,0x38(%rsp)
xor    %ebx,%ebx
xor    %edi,%edi
mov    %r14,0x8(%rsp)
mov    %ebp,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %edi,%r13
mov    $0x1,%r12d
cmpb   $0x26,(%r9,%r13,1)
jne    1560 <html_entities_decode_inplace+0x3e0>
movslq %edi,%r15
lea    0x1(%r15),%rcx
cmp    %ebp,%ecx
jge    1560 <html_entities_decode_inplace+0x3e0>
mov    (%r9,%rcx,1),%al
cmp    $0x23,%al
jne    12c0 <html_entities_decode_inplace+0x140>
lea    0x2(%r15),%rsi
mov    $0x2,%r12d
cmp    %ebp,%esi
jge    1560 <html_entities_decode_inplace+0x3e0>
mov    (%r9,%rsi,1),%al
mov    %eax,%ecx
or     $0x20,%cl
cmp    $0x78,%cl
jne    1409 <html_entities_decode_inplace+0x289>
add    $0x3,%r15
mov    $0x3,%r12d
cmp    %ebp,%r15d
jge    1560 <html_entities_decode_inplace+0x3e0>
mov    %edi,0x4(%rsp)
movzbl (%r9,%r15,1),%edi
call   10a0 <isxdigit@plt>
test   %rax,%rax
mov    %r15,0x10(%rsp)
je     1470 <html_entities_decode_inplace+0x2f0>
add    $0x1,%r15
mov    0x20(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
cmp    %r15,%rbp
je     1498 <html_entities_decode_inplace+0x318>
mov    0x8(%rsp),%rax
movzbl (%rax,%r15,1),%edi
call   10a0 <isxdigit@plt>
add    $0x1,%r15
test   %rax,%rax
jne    1290 <html_entities_decode_inplace+0x110>
add    $0xffffffffffffffff,%r15
cmp    %rbp,%r15
setl   %al
jmp    1472 <html_entities_decode_inplace+0x2f2>
mov    %rcx,0x10(%rsp)
mov    %edi,0x4(%rsp)
movzbl %al,%edi
call   1060 <isalnum@plt>
test   %rax,%rax
je     131e <html_entities_decode_inplace+0x19e>
mov    0x10(%rsp),%rsi
lea    0x1(%rsi),%r15
mov    0x20(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %r15,%rbp
je     1332 <html_entities_decode_inplace+0x1b2>
mov    0x8(%rsp),%rax
movzbl (%rax,%r15,1),%edi
call   1060 <isalnum@plt>
mov    0x10(%rsp),%rsi
add    $0x1,%r15
test   %rax,%rax
jne    12f0 <html_entities_decode_inplace+0x170>
add    $0xffffffffffffffff,%r15
cmp    %rbp,%r15
setl   %al
jmp    1328 <html_entities_decode_inplace+0x1a8>
mov    $0x1,%al
mov    0x10(%rsp),%rsi
mov    %rsi,%r15
mov    0x8(%rsp),%r9
mov    (%rsp),%ebp
jmp    1340 <html_entities_decode_inplace+0x1c0>
setg   %al
mov    (%rsp),%ebp
mov    %ebp,%r15d
mov    0x8(%rsp),%r9
mov    0x4(%rsp),%edi
mov    %r15d,%edx
sub    %esi,%edx
jle    1560 <html_entities_decode_inplace+0x3e0>
mov    %al,0x10(%rsp)
add    %r9,%rsi
mov    0x18(%rsp),%rbp
mov    %rbp,%rdi
mov    %edx,%r12d
call   1080 <memcpy@plt>
mov    %r12d,0x2c(%rsp)
movslq %r12d,%rax
movb   $0x0,0x0(%rbp,%rax,1)
mov    %rbp,%rdi
lea    0xc83(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     1402 <html_entities_decode_inplace+0x282>
mov    %rbp,%rdi
lea    0xc74(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     1462 <html_entities_decode_inplace+0x2e2>
mov    %rbp,%rdi
lea    0xc60(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     1469 <html_entities_decode_inplace+0x2e9>
mov    %rbp,%rdi
lea    0xc4b(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     16fd <html_entities_decode_inplace+0x57d>
mov    %rbp,%rdi
lea    0xc36(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     1701 <html_entities_decode_inplace+0x581>
mov    0x2c(%rsp),%eax
add    $0x1,%eax
mov    %eax,%r12d
mov    0x8(%rsp),%r9
mov    (%rsp),%ebp
mov    0x4(%rsp),%edi
jmp    1560 <html_entities_decode_inplace+0x3e0>
mov    $0x22,%al
jmp    1703 <html_entities_decode_inplace+0x583>
mov    %rsi,0x10(%rsp)
mov    %edi,0x4(%rsp)
movzbl %al,%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     1480 <html_entities_decode_inplace+0x300>
mov    0x10(%rsp),%rsi
lea    0x1(%rsi),%r15
mov    0x20(%rsp),%rbp
nopl   (%rax)
cmp    %r15,%rbp
je     14e6 <html_entities_decode_inplace+0x366>
mov    0x8(%rsp),%rax
movzbl (%rax,%r15,1),%edi
call   1050 <isdigit@plt>
mov    0x10(%rsp),%rsi
add    $0x1,%r15
test   %rax,%rax
jne    1430 <html_entities_decode_inplace+0x2b0>
add    $0xffffffffffffffff,%r15
cmp    %rbp,%r15
setl   %al
jmp    148a <html_entities_decode_inplace+0x30a>
mov    $0x26,%al
jmp    1703 <html_entities_decode_inplace+0x583>
mov    $0x3c,%al
jmp    1703 <html_entities_decode_inplace+0x583>
mov    $0x1,%al
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%r9
mov    (%rsp),%ebp
jmp    14aa <html_entities_decode_inplace+0x32a>
mov    $0x1,%al
mov    0x10(%rsp),%rsi
mov    %rsi,%r15
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%r9
mov    (%rsp),%ebp
jmp    14f8 <html_entities_decode_inplace+0x378>
setg   %al
mov    (%rsp),%ebp
mov    %ebp,%r15d
mov    0x8(%rsp),%r9
mov    0x4(%rsp),%edi
mov    %r15d,%ecx
mov    0x10(%rsp),%rsi
sub    %esi,%ecx
jle    1560 <html_entities_decode_inplace+0x3e0>
add    %r9,%rsi
mov    0x18(%rsp),%rbp
mov    %rbp,%rdi
mov    %ecx,%r12d
mov    %ecx,%edx
mov    %eax,%r13d
call   1080 <memcpy@plt>
movslq %r12d,%rax
movb   $0x0,0x0(%rbp,%rax,1)
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x10,%edx
jmp    1529 <html_entities_decode_inplace+0x3a9>
setg   %al
mov    (%rsp),%ebp
mov    %ebp,%r15d
mov    0x8(%rsp),%r9
mov    0x4(%rsp),%edi
mov    %r15d,%ecx
sub    %esi,%ecx
jle    1560 <html_entities_decode_inplace+0x3e0>
add    %r9,%rsi
mov    0x18(%rsp),%rbp
mov    %rbp,%rdi
mov    %ecx,%r12d
mov    %ecx,%edx
mov    %eax,%r13d
call   1080 <memcpy@plt>
movslq %r12d,%rax
movb   $0x0,0x0(%rbp,%rax,1)
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %al,(%r14)
add    $0x1,%r14
add    $0x1,%ebx
test   %r13b,%r13b
je     16f0 <html_entities_decode_inplace+0x570>
movslq %r15d,%rax
xor    %edi,%edi
mov    0x8(%rsp),%r9
cmpb   $0x3b,(%r9,%rax,1)
sete   %dil
add    %r15d,%edi
mov    (%rsp),%ebp
jmp    16e2 <html_entities_decode_inplace+0x562>
nop
test   %r12d,%r12d
jle    16e2 <html_entities_decode_inplace+0x562>
cmp    %ebp,%ebx
jge    16e2 <html_entities_decode_inplace+0x562>
lea    -0x1(%r12),%edx
mov    %ebx,%ecx
not    %ecx
add    %ebp,%ecx
cmp    %edx,%ecx
mov    %edx,%r8d
cmovb  %ecx,%r8d
test   %edx,%edx
cmove  %edx,%r8d
xor    %eax,%eax
cmp    $0x1f,%r8d
jb     16b0 <html_entities_decode_inplace+0x530>
cmp    %edx,%ecx
cmovae %edx,%ecx
test   %edx,%edx
cmove  %edx,%ecx
lea    (%rcx,%r13,1),%rdx
add    0x40(%rsp),%rdx
cmp    %rdx,%r14
jae    15c3 <html_entities_decode_inplace+0x443>
add    %r14,%rcx
add    $0x1,%rcx
lea    (%r9,%r13,1),%rdx
cmp    %rcx,%rdx
jb     16b0 <html_entities_decode_inplace+0x530>
add    $0x1,%r8
mov    %r8,%rax
and    $0xffffffffffffffe0,%rax
lea    -0x20(%rax),%rcx
mov    %rcx,%rdi
shr    $0x5,%rdi
add    $0x1,%rdi
mov    %edi,%edx
and    $0x3,%edx
cmp    $0x60,%rcx
jae    15ec <html_entities_decode_inplace+0x46c>
xor    %esi,%esi
jmp    1660 <html_entities_decode_inplace+0x4e0>
and    $0xfffffffffffffffc,%rdi
mov    0x30(%rsp),%rcx
add    %r13,%rcx
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
movups -0x70(%rcx,%rsi,1),%xmm0
movups -0x60(%rcx,%rsi,1),%xmm1
movups %xmm0,(%r14,%rsi,1)
movups %xmm1,0x10(%r14,%rsi,1)
movups -0x50(%rcx,%rsi,1),%xmm0
movups -0x40(%rcx,%rsi,1),%xmm1
movups %xmm0,0x20(%r14,%rsi,1)
movups %xmm1,0x30(%r14,%rsi,1)
movups -0x30(%rcx,%rsi,1),%xmm0
movups -0x20(%rcx,%rsi,1),%xmm1
movups %xmm0,0x40(%r14,%rsi,1)
movups %xmm1,0x50(%r14,%rsi,1)
movups -0x10(%rcx,%rsi,1),%xmm0
movups (%rcx,%rsi,1),%xmm1
movups %xmm0,0x60(%r14,%rsi,1)
movups %xmm1,0x70(%r14,%rsi,1)
sub    $0xffffffffffffff80,%rsi
add    $0xfffffffffffffffc,%rdi
jne    1600 <html_entities_decode_inplace+0x480>
test   %rdx,%rdx
je     169b <html_entities_decode_inplace+0x51b>
lea    (%r14,%rsi,1),%rcx
add    $0x10,%rcx
add    %r13,%rsi
add    0x38(%rsp),%rsi
shl    $0x5,%rdx
xor    %edi,%edi
nopl   0x0(%rax,%rax,1)
movups -0x10(%rsi,%rdi,1),%xmm0
movups (%rsi,%rdi,1),%xmm1
movups %xmm0,-0x10(%rcx,%rdi,1)
movups %xmm1,(%rcx,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rdx
jne    1680 <html_entities_decode_inplace+0x500>
add    %rax,%r13
add    %eax,%ebx
add    %rax,%r14
cmp    %rax,%r8
je     16df <html_entities_decode_inplace+0x55f>
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%r9,%r13,1),%ecx
add    $0x1,%r13
mov    %cl,(%r14)
add    $0x1,%r14
add    $0x1,%ebx
cmp    %r12d,%eax
jge    16df <html_entities_decode_inplace+0x55f>
add    $0x1,%eax
cmp    %ebp,%ebx
jl     16c0 <html_entities_decode_inplace+0x540>
mov    %r13d,%edi
cmp    %ebp,%edi
jge    1737 <html_entities_decode_inplace+0x5b7>
cmp    %ebp,%ebx
jl     1200 <html_entities_decode_inplace+0x80>
jmp    1737 <html_entities_decode_inplace+0x5b7>
mov    %r15d,%edi
mov    0x8(%rsp),%r9
mov    (%rsp),%ebp
jmp    16e2 <html_entities_decode_inplace+0x562>
mov    $0x3e,%al
jmp    1703 <html_entities_decode_inplace+0x583>
mov    $0xa0,%al
mov    0x8(%rsp),%r9
mov    (%rsp),%ebp
mov    0x10(%rsp),%r12b
mov    %al,(%r14)
add    $0x1,%r14
add    $0x1,%ebx
test   %r12b,%r12b
je     1732 <html_entities_decode_inplace+0x5b2>
movslq %r15d,%rax
xor    %edi,%edi
cmpb   $0x3b,(%r9,%rax,1)
sete   %dil
add    %r15d,%edi
jmp    16e2 <html_entities_decode_inplace+0x562>
mov    %r15d,%edi
jmp    16e2 <html_entities_decode_inplace+0x562>
movb   $0x0,(%r14)
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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