#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 Base64_DecodedLength(char const *src, size_t srcLength) {
  size_t length;
  ((void)0);
  length = srcLength / 4 * 3;
  if (length > 2) {
    if (src[srcLength - 1] == '=') {
      length--;
    }
    if (src[srcLength - 2] == '=') {
      length--;
    }
  }
  return length;
}


x86 assembly (clang, -O0):
<Base64_DecodedLength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x2,%rax
imul   $0x3,%rax,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x2,-0x18(%rbp)
jbe    1176 <Base64_DecodedLength+0x76>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
jne    114c <Base64_DecodedLength+0x4c>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x2,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
jne    1171 <Base64_DecodedLength+0x71>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1176 <Base64_DecodedLength+0x76>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Base64_DecodedLength>:
mov    %rsi,%rax
shr    $0x2,%rax
lea    (%rax,%rax,2),%rax
cmp    $0x3,%rax
jb     112b <Base64_DecodedLength+0x2b>
xor    %ecx,%ecx
cmpb   $0x3d,-0x1(%rsi,%rdi,1)
sete   %cl
sub    %rcx,%rax
xor    %ecx,%ecx
cmpb   $0x3d,-0x2(%rsi,%rdi,1)
sete   %cl
sub    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @Base64_DecodedLength(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = udiv i64 %6, 4
%8 = mul i64 %7, 3
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = icmp ugt i64 %9, 2
br i1 %10, label %11, label %34
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = load i64, i64* %4
%14 = sub i64 %13, 1
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 61
br i1 %18, label %19, label %22
19: ; preds = %11
%20 = load i64, i64* %5
%21 = add i64 %20, -1
store i64 %21, i64* %5
br label %22
22: ; preds = %19, %11
%23 = load i8*, i8** %3
%24 = load i64, i64* %4
%25 = sub i64 %24, 2
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 61
br i1 %29, label %30, label %33
30: ; preds = %22
%31 = load i64, i64* %5
%32 = add i64 %31, -1
store i64 %32, i64* %5
br label %33
33: ; preds = %30, %22
br label %34
34: ; preds = %33, %2
%35 = load i64, i64* %5
ret i64 %35
}

LLVM IR (-O2):
define i64 @Base64_DecodedLength(i8* nocapture %0, i64 %1) {
%3 = lshr i64 %1, 2
%4 = mul nuw i64 %3, 3
%5 = icmp ugt i64 %4, 2
br i1 %5, label %6, label %19
6: ; preds = %2
%7 = add i64 %1, -1
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 61
%11 = sext i1 %10 to i64
%12 = add i64 %4, %11
%13 = add i64 %1, -2
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 61
%17 = sext i1 %16 to i64
%18 = add i64 %12, %17
br label %19
19: ; preds = %6, %2
%20 = phi i64 [ %4, %2 ], [ %18, %6 ]
ret i64 %20
}