#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*/ xprintf(char *);
int getCorrectedEncodeSize(int pSize) {
  if (pSize % 4 == 0) {
    return pSize;
  } else if ((pSize + 1) % 4 == 0) {
    return pSize + 1;
  } else if ((pSize + 2) % 4 == 0) {
    return pSize + 2;
  } else {
    xprintf("Unrecoverable error....base64 values are incorrectly encoded\n");
    return pSize;
  }
}


x86 assembly (clang, -O0):
<getCorrectedEncodeSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    113a <getCorrectedEncodeSize+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1196 <getCorrectedEncodeSize+0x86>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115f <getCorrectedEncodeSize+0x4f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1196 <getCorrectedEncodeSize+0x86>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1184 <getCorrectedEncodeSize+0x74>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    1196 <getCorrectedEncodeSize+0x86>
lea    0xe75(%rip),%rdi
call   1030 <xprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCorrectedEncodeSize>:
push   %rbx
mov    %edi,%ebx
test   $0x3,%bl
je     1132 <getCorrectedEncodeSize+0x22>
lea    0x1(%rbx),%eax
test   $0x3,%al
je     1134 <getCorrectedEncodeSize+0x24>
lea    0x2(%rbx),%eax
test   $0x3,%al
je     1134 <getCorrectedEncodeSize+0x24>
lea    0xed3(%rip),%rdi
call   1030 <xprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [62 x i8] c"Unrecoverable error....base64 values are incorrectly encoded\0A\00"
define i32 @getCorrectedEncodeSize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = srem i32 %4, 4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* %3
store i32 %8, i32* %2
br label %28
9: ; preds = %1
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
%12 = srem i32 %11, 4
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %28
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 2
%20 = srem i32 %19, 4
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 2
store i32 %24, i32* %2
br label %28
25: ; preds = %17
%26 = call i32 @xprintf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%27 = load i32, i32* %3
store i32 %27, i32* %2
br label %28
28: ; preds = %25, %22, %14, %7
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@.str = [62 x i8] c"Unrecoverable error....base64 values are incorrectly encoded\0A\00"
define i32 @getCorrectedEncodeSize(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = add nsw i32 %0, 1
%6 = and i32 %5, 3
%7 = icmp eq i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %4
%9 = add nsw i32 %0, 2
%10 = and i32 %9, 3
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = tail call i32 @xprintf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %8, %4, %1, %12
%15 = phi i32 [ %0, %12 ], [ %0, %1 ], [ %5, %4 ], [ %9, %8 ]
ret i32 %15
}