#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 *);
int stub1(char const *, int, char const *, void *);
int stub2(char const *, int, char const *, void *);
int rfc2047_decode(const char *text,
                   int (*func)(const char *, int, const char *, void *),
                   void *arg) {
  int rc;
  int had_last_word = 0;
  const char *p;
  char *chset;
  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, 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;
    }
    rc = (*func)(enctext, strlen(enctext), chset, 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,-0x5d(%rbp)
je     11ae <rfc2047_decode+0x3e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x5d(%rbp)
mov    -0x5d(%rbp),%al
test   $0x1,%al
jne    11be <rfc2047_decode+0x4e>
jmp    157e <rfc2047_decode+0x40e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    11df <rfc2047_decode+0x6f>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3f,%eax
je     129e <rfc2047_decode+0x12e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1247 <rfc2047_decode+0xd7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    121a <rfc2047_decode+0xaa>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3f,%eax
jne    121a <rfc2047_decode+0xaa>
jmp    1247 <rfc2047_decode+0xd7>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1070 <isspace@plt>
cmp    $0x0,%eax
jne    1236 <rfc2047_decode+0xc6>
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11e7 <rfc2047_decode+0x77>
mov    -0x10(%rbp),%rax
cmp    -0x30(%rbp),%rax
jbe    1299 <rfc2047_decode+0x129>
cmpl   $0x0,-0x28(%rbp)
jne    1299 <rfc2047_decode+0x129>
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),%rcx
xor    %edx,%edx
call   *%rax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1294 <rfc2047_decode+0x124>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1585 <rfc2047_decode+0x415>
jmp    1299 <rfc2047_decode+0x129>
jmp    118e <rfc2047_decode+0x1e>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1090 <rfc2047_search_quote@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    12cd <rfc2047_decode+0x15d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1585 <rfc2047_decode+0x415>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     12e6 <rfc2047_decode+0x176>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1090 <rfc2047_search_quote@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1312 <rfc2047_decode+0x1a2>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1585 <rfc2047_decode+0x415>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     132b <rfc2047_decode+0x1bb>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1090 <rfc2047_search_quote@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1360 <rfc2047_decode+0x1f0>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1585 <rfc2047_decode+0x415>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3f,%eax
jne    138d <rfc2047_decode+0x21d>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3d,%eax
jne    138d <rfc2047_decode+0x21d>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xc68(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     13c1 <rfc2047_decode+0x251>
mov    -0x40(%rbp),%rdi
lea    0xc50(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    14a4 <rfc2047_decode+0x334>
mov    -0x48(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmpb   $0x0,(%rax)
je     1498 <rfc2047_decode+0x328>
mov    -0x50(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    1457 <rfc2047_decode+0x2e7>
mov    -0x50(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     1457 <rfc2047_decode+0x2e7>
mov    -0x50(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x0,%eax
je     1457 <rfc2047_decode+0x2e7>
mov    -0x50(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <nyb@plt>
shl    $0x4,%eax
mov    %eax,-0x64(%rbp)
mov    -0x50(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1030 <nyb@plt>
mov    %eax,%ecx
mov    -0x64(%rbp),%eax
add    %ecx,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x58(%rbp)
mov    %cl,(%rax)
mov    -0x50(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x50(%rbp)
jmp    13cd <rfc2047_decode+0x25d>
mov    -0x50(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x50(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x5c(%rbp)
cmpl   $0x5f,-0x5c(%rbp)
jne    147d <rfc2047_decode+0x30d>
movl   $0x20,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x58(%rbp)
mov    %cl,(%rax)
jmp    13cd <rfc2047_decode+0x25d>
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
jmp    150c <rfc2047_decode+0x39c>
mov    -0x40(%rbp),%rdi
lea    0xb55(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     14d8 <rfc2047_decode+0x368>
mov    -0x40(%rbp),%rdi
lea    0xb3d(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1507 <rfc2047_decode+0x397>
mov    -0x48(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x48(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x78(%rbp),%rdi
mov    %eax,%esi
call   1060 <decodebase64@plt>
mov    %rax,%rcx
mov    -0x70(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    150c <rfc2047_decode+0x39c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x48(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x88(%rbp),%rdi
mov    %eax,%esi
mov    -0x80(%rbp),%rax
mov    -0x38(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   *%rax
mov    %eax,-0x24(%rbp)
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
cmpl   $0x0,-0x24(%rbp)
je     1572 <rfc2047_decode+0x402>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1585 <rfc2047_decode+0x415>
movl   $0x1,-0x28(%rbp)
jmp    118e <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     1409 <rfc2047_decode+0x299>
mov    %rdi,%r15
mov    $0x20,%r14d
xor    %r12d,%r12d
jmp    121b <rfc2047_decode+0xab>
mov    %rbp,0x10(%rsp)
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1060 <decodebase64@plt>
mov    %r12,%rbp
add    %rax,%rbp
movb   $0x0,0x0(%rbp)
mov    0x10(%rsp),%rbp
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %eax,%esi
mov    %rbp,%rdx
mov    0x20(%rsp),%rcx
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    140c <rfc2047_decode+0x29c>
mov    0x8(%rsp),%r15
test   %r15,%r15
je     1409 <rfc2047_decode+0x299>
mov    (%r15),%al
cmp    $0x3d,%al
je     1230 <rfc2047_decode+0xc0>
test   %al,%al
jne    1330 <rfc2047_decode+0x1c0>
jmp    1409 <rfc2047_decode+0x299>
nop
cmpb   $0x3f,0x1(%r15)
jne    1330 <rfc2047_decode+0x1c0>
add    $0x2,%r15
mov    %r15,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <rfc2047_search_quote@plt>
mov    $0xffffffff,%r15d
test   %rax,%rax
je     140c <rfc2047_decode+0x29c>
mov    %rax,%rbp
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
je     1276 <rfc2047_decode+0x106>
add    $0x1,%rax
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
call   1090 <rfc2047_search_quote@plt>
test   %rax,%rax
je     142b <rfc2047_decode+0x2bb>
mov    %rax,%r13
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
je     129d <rfc2047_decode+0x12d>
add    $0x1,%rax
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
call   1090 <rfc2047_search_quote@plt>
test   %rax,%rax
je     1423 <rfc2047_decode+0x2b3>
mov    %rax,%r12
mov    0x8(%rsp),%rax
cmpb   $0x3f,(%rax)
jne    12ca <rfc2047_decode+0x15a>
cmpb   $0x3d,0x1(%rax)
jne    12ca <rfc2047_decode+0x15a>
add    $0x2,%rax
mov    %rax,0x8(%rsp)
mov    %r13,%rdi
lea    0xd2c(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     139f <rfc2047_decode+0x22f>
mov    %r13,%rdi
lea    0xd16(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     139f <rfc2047_decode+0x22f>
mov    %r13,%rdi
lea    0xd00(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     11a4 <rfc2047_decode+0x34>
mov    %r13,%rdi
lea    0xcea(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    11ca <rfc2047_decode+0x5a>
jmp    11a4 <rfc2047_decode+0x34>
nop
lea    0x1(%r15),%rbp
xor    %ebx,%ebx
jmp    1364 <rfc2047_decode+0x1f4>
nopl   0x0(%rax,%rax,1)
cmpb   $0x3f,0x0(%rbp)
je     136c <rfc2047_decode+0x1fc>
movzbl %al,%edi
call   1070 <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     1340 <rfc2047_decode+0x1d0>
test   %al,%al
jne    1346 <rfc2047_decode+0x1d6>
add    $0xffffffffffffffff,%rbp
cmp    %r15,%rbp
jbe    120d <rfc2047_decode+0x9d>
test   %r12d,%r12d
jne    120d <rfc2047_decode+0x9d>
xor    %r12d,%r12d
mov    %r15,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    0x20(%rsp),%rcx
call   *0x18(%rsp)
test   %eax,%eax
je     120d <rfc2047_decode+0x9d>
jmp    141e <rfc2047_decode+0x2ae>
mov    %rbp,0x10(%rsp)
mov    %r12,%rbx
mov    %r12,%rbp
jmp    13cc <rfc2047_decode+0x25c>
nopl   0x0(%rax)
test   %al,%al
je     11c1 <rfc2047_decode+0x51>
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    13b0 <rfc2047_decode+0x240>
movzbl 0x1(%rbx),%ecx
test   %cl,%cl
je     13b8 <rfc2047_decode+0x248>
cmpb   $0x0,0x2(%rbx)
je     13b8 <rfc2047_decode+0x248>
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    13cc <rfc2047_decode+0x25c>
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    140c <rfc2047_decode+0x29c>
mov    %r13,%rdi
call   1040 <free@plt>
mov    %rbp,%rdi
call   1040 <free@plt>
jmp    140c <rfc2047_decode+0x29c>

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

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*)* nocapture %1, i8* %2) {
%4 = alloca i8*
store i8* %0, i8** %4
%5 = icmp eq i8* %0, null
br i1 %5, label %134, label %10
6: ; preds = %34, %38, %125
%7 = phi i32 [ 1, %125 ], [ 0, %38 ], [ %22, %34 ]
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %134, 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 %134
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* %2)
%44 = icmp eq i32 %43, 0
br i1 %44, label %6, label %134
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 %134, 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 %132, 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 %132
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 i32 @strlen(i8* %65)
%127 = call i32 %1(i8* %65, i32 %126, i8* %47, i8* %2)
%128 = call i32 @free(i8* %65)
%129 = call i32 @free(i8* %47)
%130 = call i32 @free(i8* %56)
%131 = icmp eq i32 %127, 0
br i1 %131, label %6, label %134
132: ; preds = %55, %67
%133 = call i32 @free(i8* %47)
br label %134
134: ; preds = %38, %45, %125, %10, %6, %132, %3
%135 = phi i32 [ 0, %3 ], [ -1, %132 ], [ %43, %38 ], [ -1, %45 ], [ %127, %125 ], [ 0, %10 ], [ 0, %6 ]
ret i32 %135
}