#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*/ printf(char *, ...);
int base64integrity(const char *ascii, int len) {
  int i;
  for (i = 0; i < len - 2; i++) {
    if (!(('0' <= ascii[i] && ascii[i] <= '9') ||
          ('A' <= ascii[i] && ascii[i] <= 'Z') ||
          ('a' <= ascii[i] && ascii[i] <= 'z') || ascii[i] == '+' ||
          ascii[i] == '/')) {
      printf(
          "ERROR in base64integrity at chr %d. String is NOT valid base64.\n",
          i);
      return 0;
    }
  }
  if (ascii[i] == '=') {
    if (ascii[i + 1] != '=') {
      printf("ERROR in base64integrity at chr %d.\n"
             "If the 2nd last chr is '=' then the last chr must be '=' too.\n "
             "String is NOT valid base64.",
             i);
      return 0;
    }
  } else if (!(('0' <= ascii[i] && ascii[i] <= '9') ||
               ('A' <= ascii[i] && ascii[i] <= 'Z') ||
               ('a' <= ascii[i] && ascii[i] <= 'z') || ascii[i] == '+' ||
               ascii[i] == '/')) {
    printf("ERROR in base64integrity at chr %d (2nd last chr). String is NOT "
           "valid base64.\n",
           i);
    return 0;
  }
  i++;
  if (ascii[i] != '=' && !(('0' <= ascii[i] && ascii[i] <= '9') ||
                           ('A' <= ascii[i] && ascii[i] <= 'Z') ||
                           ('a' <= ascii[i] && ascii[i] <= 'z') ||
                           ascii[i] == '+' || ascii[i] == '/')) {
    printf("ERROR in base64integrity at chr %d (last chr). String is NOT valid "
           "base64.\n",
           i);
    printf("%s, %c\n\n", ascii, ascii[i]);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<base64integrity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    121b <base64integrity+0x10b>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     1165 <base64integrity+0x55>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    1208 <base64integrity+0xf8>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     1193 <base64integrity+0x83>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
jle    1208 <base64integrity+0xf8>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     11c1 <base64integrity+0xb1>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jle    1208 <base64integrity+0xf8>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2b,%eax
je     1208 <base64integrity+0xf8>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
je     1208 <base64integrity+0xf8>
mov    -0x18(%rbp),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1456 <base64integrity+0x346>
jmp    120d <base64integrity+0xfd>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1126 <base64integrity+0x16>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
jne    126c <base64integrity+0x15c>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
je     1267 <base64integrity+0x157>
mov    -0x18(%rbp),%esi
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1456 <base64integrity+0x346>
jmp    1342 <base64integrity+0x232>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     129a <base64integrity+0x18a>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    133d <base64integrity+0x22d>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     12c8 <base64integrity+0x1b8>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
jle    133d <base64integrity+0x22d>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     12f6 <base64integrity+0x1e6>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jle    133d <base64integrity+0x22d>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2b,%eax
je     133d <base64integrity+0x22d>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
je     133d <base64integrity+0x22d>
mov    -0x18(%rbp),%esi
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1456 <base64integrity+0x346>
jmp    1342 <base64integrity+0x232>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
je     144f <base64integrity+0x33f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     138e <base64integrity+0x27e>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    144f <base64integrity+0x33f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     13bc <base64integrity+0x2ac>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
jle    144f <base64integrity+0x33f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     13ea <base64integrity+0x2da>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jle    144f <base64integrity+0x33f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2b,%eax
je     144f <base64integrity+0x33f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
je     144f <base64integrity+0x33f>
mov    -0x18(%rbp),%esi
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1456 <base64integrity+0x346>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64integrity>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%eax
mov    %rdi,%rbx
xor    %esi,%esi
cmp    $0x3,%eax
jl     116d <base64integrity+0x5d>
add    $0xfffffffe,%eax
xor    %esi,%esi
jmp    1139 <base64integrity+0x29>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rsi
cmp    %rsi,%rax
je     116b <base64integrity+0x5b>
movzbl (%rbx,%rsi,1),%ecx
lea    -0x30(%rcx),%edx
cmp    $0xa,%dl
jb     1130 <base64integrity+0x20>
lea    -0x41(%rcx),%edx
cmp    $0x1a,%dl
jb     1130 <base64integrity+0x20>
lea    -0x61(%rcx),%edx
cmp    $0x1a,%dl
jb     1130 <base64integrity+0x20>
or     $0x4,%cl
cmp    $0x2f,%cl
je     1130 <base64integrity+0x20>
lea    0xe9c(%rip),%rdi
xor    %ebp,%ebp
jmp    120e <base64integrity+0xfe>
mov    %eax,%esi
mov    %esi,%r14d
mov    (%rbx,%r14,1),%al
cmp    $0x3d,%al
jne    118c <base64integrity+0x7c>
cmpb   $0x3d,0x1(%r14,%rbx,1)
je     11aa <base64integrity+0x9a>
lea    0xeba(%rip),%rdi
jmp    120c <base64integrity+0xfc>
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     11aa <base64integrity+0x9a>
lea    -0x41(%rax),%ecx
cmp    $0x1a,%cl
jb     11aa <base64integrity+0x9a>
lea    -0x61(%rax),%ecx
cmp    $0x1a,%cl
jb     11aa <base64integrity+0x9a>
or     $0x4,%al
cmp    $0x2f,%al
jne    1205 <base64integrity+0xf5>
mov    0x1(%rbx,%r14,1),%al
lea    -0x41(%rax),%ecx
mov    $0x1,%ebp
cmp    $0x1a,%cl
jb     1215 <base64integrity+0x105>
cmp    $0x3d,%al
je     1215 <base64integrity+0x105>
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     1215 <base64integrity+0x105>
lea    -0x61(%rax),%ecx
cmp    $0x1a,%cl
jb     1215 <base64integrity+0x105>
or     $0x4,%al
cmp    $0x2f,%al
je     1215 <base64integrity+0x105>
add    $0x1,%r14
lea    0xf2f(%rip),%rdi
xor    %ebp,%ebp
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl (%rbx,%r14,1),%edx
lea    0xf63(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1215 <base64integrity+0x105>
lea    0xeb4(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [65 x i8] c"ERROR in base64integrity at chr %d. String is NOT valid base64.\0A\00"
@.str.1 = [127 x i8] c"ERROR in base64integrity at chr %d.\0AIf the 2nd last chr is '=' then the last chr must be '=' too.\0A String is NOT valid base64.\00"
@.str.2 = [80 x i8] c"ERROR in base64integrity at chr %d (2nd last chr). String is NOT valid base64.\0A\00"
@.str.3 = [76 x i8] c"ERROR in base64integrity at chr %d (last chr). String is NOT valid base64.\0A\00"
@.str.4 = [9 x i8] c"%s, %c\0A\0A\00"
define i32 @base64integrity(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 2
br i1 %3, label %4, label %27
4: ; preds = %2
%5 = add nsw i32 %1, -2
%6 = add nsw i32 %1, -2
%7 = zext i32 %5 to i64
br label %8
8: ; preds = %4, %24
%9 = phi i64 [ 0, %4 ], [ %25, %24 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = add i8 %11, -48
%13 = icmp ult i8 %12, 10
%14 = add i8 %11, -65
%15 = icmp ult i8 %14, 26
%16 = or i1 %13, %15
%17 = add i8 %11, -97
%18 = icmp ult i8 %17, 26
%19 = select i1 %16, i1 true, i1 %18
br i1 %19, label %24, label %20
20: ; preds = %8
switch i8 %11, label %21 [
i8 43, label %24
i8 47, label %24
]
21: ; preds = %20
%22 = trunc i64 %9 to i32
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %74
24: ; preds = %20, %20, %8
%25 = add nuw nsw i64 %9, 1
%26 = icmp eq i64 %25, %7
br i1 %26, label %27, label %8
27: ; preds = %24, %2
%28 = phi i32 [ 0, %2 ], [ %6, %24 ]
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %0, i64 %29
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 61
br i1 %32, label %33, label %41
33: ; preds = %27
%34 = add nuw nsw i32 %28, 1
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %0, i64 %35
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 61
br i1 %38, label %53, label %39
39: ; preds = %33
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([127 x i8], [127 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %74
41: ; preds = %27
%42 = add i8 %31, -48
%43 = icmp ult i8 %42, 10
%44 = add i8 %31, -65
%45 = icmp ult i8 %44, 26
%46 = or i1 %43, %45
%47 = add i8 %31, -97
%48 = icmp ult i8 %47, 26
%49 = select i1 %46, i1 true, i1 %48
br i1 %49, label %53, label %50
50: ; preds = %41
switch i8 %31, label %51 [
i8 43, label %53
i8 47, label %53
]
51: ; preds = %50
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str.2, i64 0, i64 0), i32 %28)
br label %74
53: ; preds = %50, %50, %41, %33
%54 = add nuw nsw i32 %28, 1
%55 = zext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %0, i64 %55
%57 = load i8, i8* %56
%58 = icmp eq i8 %57, 61
%59 = add i8 %57, -48
%60 = icmp ult i8 %59, 10
%61 = or i1 %58, %60
%62 = add i8 %57, -65
%63 = icmp ult i8 %62, 26
%64 = or i1 %63, %61
%65 = add i8 %57, -97
%66 = icmp ult i8 %65, 26
%67 = select i1 %64, i1 true, i1 %66
br i1 %67, label %74, label %68
68: ; preds = %53
switch i8 %57, label %69 [
i8 43, label %74
i8 47, label %74
]
69: ; preds = %68
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0), i32 %54)
%71 = load i8, i8* %56
%72 = sext i8 %71 to i32
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %0, i32 %72)
br label %74
74: ; preds = %53, %68, %68, %69, %51, %39, %21
%75 = phi i32 [ 0, %21 ], [ 0, %39 ], [ 0, %69 ], [ 0, %51 ], [ 1, %68 ], [ 1, %68 ], [ 1, %53 ]
ret i32 %75
}