#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 */
size_t decodebase64(char *, int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ isspace(int);
int nyb(char);
char *rfc2047_search_quote(char const **);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
char *strrchr(char *, char);
int stub1(char const *, int, char const *, char const *, void *);
int stub2(char const *, int, char const *, char const *, void *);
int rfc2047_decode(const char *text,
                   int (*func)(const char *, int, const char *, const char *,
                               void *),
                   void *arg) {
  int rc;
  int had_last_word = 0;
  const char *p;
  char *chset, *lang;
  char *encoding;
  char *enctext;
  while (text && *text) {
    if (text[0] != '=' || text[1] != '?') {
      p = text;
      while (*text) {
        if (text[0] == '=' && text[1] == '?')
          break;
        if (!isspace((int)(unsigned char)*text))
          had_last_word = 0;
        ++text;
      }
      if (text > p && !had_last_word) {
        rc = (*func)(p, text - p, 0, 0, arg);
        if (rc)
          return (rc);
      }
      continue;
    }
    text += 2;
    if ((chset = rfc2047_search_quote(&text)) == 0)
      return (-1);
    if (*text)
      ++text;
    if ((encoding = rfc2047_search_quote(&text)) == 0) {
      free(chset);
      return (-1);
    }
    if (*text)
      ++text;
    if ((enctext = rfc2047_search_quote(&text)) == 0) {
      free(encoding);
      free(chset);
      return (-1);
    }
    if (*text == '?' && text[1] == '=')
      text += 2;
    if (strcmp(encoding, "Q") == 0 || strcmp(encoding, "q") == 0) {
      char *q, *r;
      for (q = r = enctext; *q;) {
        int c;
        if (*q == '=' && q[1] && q[2]) {
          *r++ = (char)(nyb(q[1]) * 16 + nyb(q[2]));
          q += 3;
          continue;
        }
        c = *q++;
        if (c == '_')
          c = ' ';
        *r++ = c;
      }
      *r = 0;
    } else if (strcmp(encoding, "B") == 0 || strcmp(encoding, "b") == 0) {
      enctext[decodebase64(enctext, strlen(enctext))] = 0;
    }
    lang = strrchr(chset, '*');
    if (lang)
      *lang++ = 0;
    rc = (*func)(enctext, strlen(enctext), chset, lang, arg);
    free(enctext);
    free(chset);
    free(encoding);
    if (rc)
      return (rc);
    had_last_word = 1;
  }
  return (0);
}


x86 assembly (clang, -O0):
<rfc2047_decode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x65(%rbp)
je     11be <rfc2047_decode+0x3e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x65(%rbp)
mov    -0x65(%rbp),%al
test   $0x1,%al
jne    11ce <rfc2047_decode+0x4e>
jmp    15ca <rfc2047_decode+0x44a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    11ef <rfc2047_decode+0x6f>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3f,%eax
je     12b1 <rfc2047_decode+0x131>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1257 <rfc2047_decode+0xd7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    122a <rfc2047_decode+0xaa>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3f,%eax
jne    122a <rfc2047_decode+0xaa>
jmp    1257 <rfc2047_decode+0xd7>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1080 <isspace@plt>
cmp    $0x0,%eax
jne    1246 <rfc2047_decode+0xc6>
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11f7 <rfc2047_decode+0x77>
mov    -0x10(%rbp),%rax
cmp    -0x30(%rbp),%rax
jbe    12ac <rfc2047_decode+0x12c>
cmpl   $0x0,-0x28(%rbp)
jne    12ac <rfc2047_decode+0x12c>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x30(%rbp),%rdx
sub    %rdx,%rcx
mov    %ecx,%esi
mov    -0x20(%rbp),%r8
xor    %ecx,%ecx
mov    %rcx,%rdx
call   *%rax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     12a7 <rfc2047_decode+0x127>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15d1 <rfc2047_decode+0x451>
jmp    12ac <rfc2047_decode+0x12c>
jmp    119e <rfc2047_decode+0x1e>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   10a0 <rfc2047_search_quote@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    12e0 <rfc2047_decode+0x160>
movl   $0xffffffff,-0x4(%rbp)
jmp    15d1 <rfc2047_decode+0x451>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     12f9 <rfc2047_decode+0x179>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   10a0 <rfc2047_search_quote@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1325 <rfc2047_decode+0x1a5>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15d1 <rfc2047_decode+0x451>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     133e <rfc2047_decode+0x1be>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   10a0 <rfc2047_search_quote@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    1373 <rfc2047_decode+0x1f3>
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15d1 <rfc2047_decode+0x451>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3f,%eax
jne    13a0 <rfc2047_decode+0x220>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3d,%eax
jne    13a0 <rfc2047_decode+0x220>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xc55(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     13d4 <rfc2047_decode+0x254>
mov    -0x48(%rbp),%rdi
lea    0xc3d(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    14b7 <rfc2047_decode+0x337>
mov    -0x50(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
cmpb   $0x0,(%rax)
je     14ab <rfc2047_decode+0x32b>
mov    -0x58(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    146a <rfc2047_decode+0x2ea>
mov    -0x58(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     146a <rfc2047_decode+0x2ea>
mov    -0x58(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x0,%eax
je     146a <rfc2047_decode+0x2ea>
mov    -0x58(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <nyb@plt>
shl    $0x4,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x58(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1030 <nyb@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
add    %ecx,%eax
mov    %al,%cl
mov    -0x60(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x60(%rbp)
mov    %cl,(%rax)
mov    -0x58(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x58(%rbp)
jmp    13e0 <rfc2047_decode+0x260>
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x58(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x64(%rbp)
cmpl   $0x5f,-0x64(%rbp)
jne    1490 <rfc2047_decode+0x310>
movl   $0x20,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    %al,%cl
mov    -0x60(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x60(%rbp)
mov    %cl,(%rax)
jmp    13e0 <rfc2047_decode+0x260>
mov    -0x60(%rbp),%rax
movb   $0x0,(%rax)
jmp    151f <rfc2047_decode+0x39f>
mov    -0x48(%rbp),%rdi
lea    0xb42(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     14eb <rfc2047_decode+0x36b>
mov    -0x48(%rbp),%rdi
lea    0xb2a(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    151a <rfc2047_decode+0x39a>
mov    -0x50(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x80(%rbp),%rdi
mov    %eax,%esi
call   1070 <decodebase64@plt>
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    151f <rfc2047_decode+0x39f>
mov    -0x38(%rbp),%rdi
mov    $0x2a,%esi
call   1060 <strrchr@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     154e <rfc2047_decode+0x3ce>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x90(%rbp),%rdi
mov    %eax,%esi
mov    -0x88(%rbp),%rax
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   *%rax
mov    %eax,-0x24(%rbp)
mov    -0x50(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
cmpl   $0x0,-0x24(%rbp)
je     15be <rfc2047_decode+0x43e>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15d1 <rfc2047_decode+0x451>
movl   $0x1,-0x28(%rbp)
jmp    119e <rfc2047_decode+0x1e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfc2047_decode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,0x20(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,0x8(%rsp)
test   %rdi,%rdi
je     1459 <rfc2047_decode+0x2d9>
mov    %rdi,%r15
mov    $0x20,%r14d
xor    %r12d,%r12d
jmp    1212 <rfc2047_decode+0x92>
mov    %rax,%rbx
add    $0x1,%rbx
movb   $0x0,(%rax)
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %eax,%esi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    0x20(%rsp),%r8
call   *0x18(%rsp)
mov    %eax,%r15d
mov    %r12,%rdi
call   1040 <free@plt>
mov    %rbp,%rdi
call   1040 <free@plt>
mov    %r13,%rdi
call   1040 <free@plt>
mov    $0x1,%r12d
test   %r15d,%r15d
jne    145c <rfc2047_decode+0x2dc>
mov    0x8(%rsp),%r15
test   %r15,%r15
je     1459 <rfc2047_decode+0x2d9>
mov    (%r15),%al
cmp    $0x3d,%al
je     1230 <rfc2047_decode+0xb0>
test   %al,%al
jne    1370 <rfc2047_decode+0x1f0>
jmp    1459 <rfc2047_decode+0x2d9>
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x3f,0x1(%r15)
jne    1370 <rfc2047_decode+0x1f0>
add    $0x2,%r15
mov    %r15,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   10a0 <rfc2047_search_quote@plt>
mov    $0xffffffff,%r15d
test   %rax,%rax
je     145c <rfc2047_decode+0x2dc>
mov    %rax,%rbp
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
je     1276 <rfc2047_decode+0xf6>
add    $0x1,%rax
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
call   10a0 <rfc2047_search_quote@plt>
test   %rax,%rax
je     147b <rfc2047_decode+0x2fb>
mov    %rax,%r13
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
je     129d <rfc2047_decode+0x11d>
add    $0x1,%rax
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
call   10a0 <rfc2047_search_quote@plt>
test   %rax,%rax
je     1473 <rfc2047_decode+0x2f3>
mov    %rax,%r12
mov    0x8(%rsp),%rax
cmpb   $0x3f,(%rax)
jne    12ca <rfc2047_decode+0x14a>
cmpb   $0x3d,0x1(%rax)
jne    12ca <rfc2047_decode+0x14a>
add    $0x2,%rax
mov    %rax,0x8(%rsp)
mov    %r13,%rdi
lea    0xd2c(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     13e4 <rfc2047_decode+0x264>
mov    %r13,%rdi
lea    0xd16(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     13e4 <rfc2047_decode+0x264>
mov    %r13,%rdi
lea    0xd00(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1322 <rfc2047_decode+0x1a2>
mov    %r13,%rdi
lea    0xcee(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1348 <rfc2047_decode+0x1c8>
mov    %rbp,0x10(%rsp)
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1070 <decodebase64@plt>
mov    %r12,%rbp
add    %rax,%rbp
movb   $0x0,0x0(%rbp)
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x2a,%esi
call   1060 <strrchr@plt>
test   %rax,%rax
jne    11b4 <rfc2047_decode+0x34>
xor    %ebx,%ebx
jmp    11be <rfc2047_decode+0x3e>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%r15),%rbp
xor    %ebx,%ebx
jmp    13a4 <rfc2047_decode+0x224>
nopl   0x0(%rax,%rax,1)
cmpb   $0x3f,0x0(%rbp)
je     13ac <rfc2047_decode+0x22c>
movzbl %al,%edi
call   1080 <isspace@plt>
test   %eax,%eax
cmove  %eax,%r12d
mov    %rbp,0x8(%rsp)
movzbl 0x0(%rbp),%eax
add    $0x1,%rbp
add    $0x1,%ebx
cmp    $0x3d,%al
je     1380 <rfc2047_decode+0x200>
test   %al,%al
jne    1386 <rfc2047_decode+0x206>
add    $0xffffffffffffffff,%rbp
cmp    %r15,%rbp
jbe    1204 <rfc2047_decode+0x84>
test   %r12d,%r12d
jne    1204 <rfc2047_decode+0x84>
xor    %r12d,%r12d
mov    %r15,%rdi
mov    %ebx,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    0x20(%rsp),%r8
call   *0x18(%rsp)
test   %eax,%eax
je     1204 <rfc2047_decode+0x84>
jmp    146e <rfc2047_decode+0x2ee>
mov    %rbp,0x10(%rsp)
mov    %r12,%rbx
mov    %r12,%rbp
jmp    141c <rfc2047_decode+0x29c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %al,%al
je     133f <rfc2047_decode+0x1bf>
add    $0x1,%rbx
cmp    $0x5f,%al
movzbl %al,%eax
cmove  %r14d,%eax
mov    %al,0x0(%rbp)
add    $0x1,%rbp
movzbl (%rbx),%eax
cmp    $0x3d,%al
jne    1400 <rfc2047_decode+0x280>
movzbl 0x1(%rbx),%ecx
test   %cl,%cl
je     1408 <rfc2047_decode+0x288>
cmpb   $0x0,0x2(%rbx)
je     1408 <rfc2047_decode+0x288>
movsbl %cl,%edi
call   1030 <nyb@plt>
mov    %eax,%r15d
shl    $0x4,%r15d
movsbl 0x2(%rbx),%edi
call   1030 <nyb@plt>
add    %r15d,%eax
mov    %al,0x0(%rbp)
add    $0x3,%rbx
add    $0x1,%rbp
jmp    141c <rfc2047_decode+0x29c>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r15d
jmp    145c <rfc2047_decode+0x2dc>
mov    %r13,%rdi
call   1040 <free@plt>
mov    %rbp,%rdi
call   1040 <free@plt>
jmp    145c <rfc2047_decode+0x2dc>

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

LLVM IR (-O2):
@.str = [2 x i8] c"Q\00"
@.str.1 = [2 x i8] c"q\00"
@.str.2 = [2 x i8] c"B\00"
@.str.3 = [2 x i8] c"b\00"
define i32 @rfc2047_decode(i8* %0, i32 (i8*, i32, i8*, i8*, i8*)* nocapture %1, i8* %2) {
%4 = alloca i8*
store i8* %0, i8** %4
%5 = icmp eq i8* %0, null
br i1 %5, label %140, label %10
6: ; preds = %34, %38, %130
%7 = phi i32 [ 1, %130 ], [ 0, %38 ], [ %22, %34 ]
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %140, label %10
10: ; preds = %3, %6
%11 = phi i32 [ %7, %6 ], [ 0, %3 ]
%12 = phi i8* [ %8, %6 ], [ %0, %3 ]
%13 = load i8, i8* %12
switch i8 %13, label %18 [
i8 0, label %140
i8 61, label %14
]
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %12, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 63
br i1 %17, label %45, label %18
18: ; preds = %10, %14
br label %19
19: ; preds = %18, %27
%20 = phi i8 [ %33, %27 ], [ %13, %18 ]
%21 = phi i8* [ %32, %27 ], [ %12, %18 ]
%22 = phi i32 [ %31, %27 ], [ %11, %18 ]
switch i8 %20, label %27 [
i8 0, label %34
i8 61, label %23
]
23: ; preds = %19
%24 = getelementptr inbounds i8, i8* %21, i64 1
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 63
br i1 %26, label %34, label %27
27: ; preds = %19, %23
%28 = zext i8 %20 to i32
%29 = call i32 @isspace(i32 %28)
%30 = icmp eq i32 %29, 0
%31 = select i1 %30, i32 0, i32 %22
%32 = getelementptr inbounds i8, i8* %21, i64 1
store i8* %32, i8** %4
%33 = load i8, i8* %32
br label %19
34: ; preds = %19, %23
%35 = icmp ule i8* %21, %12
%36 = icmp ne i32 %22, 0
%37 = select i1 %35, i1 true, i1 %36
br i1 %37, label %6, label %38
38: ; preds = %34
%39 = ptrtoint i8* %21 to i64
%40 = ptrtoint i8* %12 to i64
%41 = sub i64 %39, %40
%42 = trunc i64 %41 to i32
%43 = call i32 %1(i8* %12, i32 %42, i8* null, i8* null, i8* %2)
%44 = icmp eq i32 %43, 0
br i1 %44, label %6, label %140
45: ; preds = %14
%46 = getelementptr inbounds i8, i8* %12, i64 2
store i8* %46, i8** %4
%47 = call i8* @rfc2047_search_quote(i8** %4)
%48 = icmp eq i8* %47, null
br i1 %48, label %140, label %49
49: ; preds = %45
%50 = load i8*, i8** %4
%51 = load i8, i8* %50
%52 = icmp eq i8 %51, 0
br i1 %52, label %55, label %53
53: ; preds = %49
%54 = getelementptr inbounds i8, i8* %50, i64 1
store i8* %54, i8** %4
br label %55
55: ; preds = %53, %49
%56 = call i8* @rfc2047_search_quote(i8** %4)
%57 = icmp eq i8* %56, null
br i1 %57, label %138, label %58
58: ; preds = %55
%59 = load i8*, i8** %4
%60 = load i8, i8* %59
%61 = icmp eq i8 %60, 0
br i1 %61, label %64, label %62
62: ; preds = %58
%63 = getelementptr inbounds i8, i8* %59, i64 1
store i8* %63, i8** %4
br label %64
64: ; preds = %62, %58
%65 = call i8* @rfc2047_search_quote(i8** %4)
%66 = icmp eq i8* %65, null
br i1 %66, label %67, label %69
67: ; preds = %64
%68 = call i32 @free(i8* %56)
br label %138
69: ; preds = %64
%70 = load i8*, i8** %4
%71 = load i8, i8* %70
%72 = icmp eq i8 %71, 63
br i1 %72, label %73, label %79
73: ; preds = %69
%74 = getelementptr inbounds i8, i8* %70, i64 1
%75 = load i8, i8* %74
%76 = icmp eq i8 %75, 61
br i1 %76, label %77, label %79
77: ; preds = %73
%78 = getelementptr inbounds i8, i8* %70, i64 2
store i8* %78, i8** %4
br label %79
79: ; preds = %77, %73, %69
%80 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %85, label %82
82: ; preds = %79
%83 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %113
85: ; preds = %82, %79
br label %86
86: ; preds = %85, %110
%87 = phi i8* [ %111, %110 ], [ %65, %85 ]
%88 = phi i8* [ %112, %110 ], [ %65, %85 ]
%89 = load i8, i8* %87
switch i8 %89, label %106 [
i8 0, label %123
i8 61, label %90
]
90: ; preds = %86
%91 = getelementptr inbounds i8, i8* %87, i64 1
%92 = load i8, i8* %91
%93 = icmp eq i8 %92, 0
br i1 %93, label %106, label %94
94: ; preds = %90
%95 = getelementptr inbounds i8, i8* %87, i64 2
%96 = load i8, i8* %95
%97 = icmp eq i8 %96, 0
br i1 %97, label %106, label %98
98: ; preds = %94
%99 = call i32 @nyb(i8 signext %92)
%100 = shl nsw i32 %99, 4
%101 = load i8, i8* %95
%102 = call i32 @nyb(i8 signext %101)
%103 = add nsw i32 %102, %100
%104 = trunc i32 %103 to i8
store i8 %104, i8* %88
%105 = getelementptr inbounds i8, i8* %87, i64 3
br label %110
106: ; preds = %86, %94, %90
%107 = getelementptr inbounds i8, i8* %87, i64 1
%108 = icmp eq i8 %89, 95
%109 = select i1 %108, i8 32, i8 %89
store i8 %109, i8* %88
br label %110
110: ; preds = %106, %98
%111 = phi i8* [ %105, %98 ], [ %107, %106 ]
%112 = getelementptr inbounds i8, i8* %88, i64 1
br label %86
113: ; preds = %82
%114 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%115 = icmp eq i64 %114, 0
br i1 %115, label %119, label %116
116: ; preds = %113
%117 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %125
119: ; preds = %116, %113
%120 = call i32 @strlen(i8* %65)
%121 = call i64 @decodebase64(i8* %65, i32 %120)
%122 = getelementptr inbounds i8, i8* %65, i64 %121
br label %123
123: ; preds = %86, %119
%124 = phi i8* [ %122, %119 ], [ %88, %86 ]
store i8 0, i8* %124
br label %125
125: ; preds = %123, %116
%126 = call i8* @strrchr(i8* %47, i8 signext 42)
%127 = icmp eq i8* %126, null
br i1 %127, label %130, label %128
128: ; preds = %125
%129 = getelementptr inbounds i8, i8* %126, i64 1
store i8 0, i8* %126
br label %130
130: ; preds = %128, %125
%131 = phi i8* [ %129, %128 ], [ null, %125 ]
%132 = call i32 @strlen(i8* %65)
%133 = call i32 %1(i8* %65, i32 %132, i8* %47, i8* %131, i8* %2)
%134 = call i32 @free(i8* %65)
%135 = call i32 @free(i8* %47)
%136 = call i32 @free(i8* %56)
%137 = icmp eq i32 %133, 0
br i1 %137, label %6, label %140
138: ; preds = %55, %67
%139 = call i32 @free(i8* %47)
br label %140
140: ; preds = %38, %45, %130, %10, %6, %138, %3
%141 = phi i32 [ 0, %3 ], [ -1, %138 ], [ %43, %38 ], [ -1, %45 ], [ %133, %130 ], [ 0, %10 ], [ 0, %6 ]
ret i32 %141
}