#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 */
typedef int uint8_t;
typedef int /*<<< orphan*/ out;
typedef int /*<<< orphan*/ input;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ test(char *);
int websafe_base64_encode(char *, int, int *, int);
void test_simple_case() {
  test("test_simple_case");
  char out[6];
  memset(out, 0xaa, sizeof(out));
  uint8_t input[] = {0x12, 0x34, 0x56};
  assert(websafe_base64_encode(out, 5, input, sizeof(input)));
  assert(out[0] == 'E');
  assert(out[1] == 'j');
  assert(out[2] == 'R');
  assert(out[3] == 'W');
  assert(out[4] == 0x00);
  assert(out[5] == 0xaa);
}


x86 assembly (clang, -O0):
<test_simple_case>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
call   1060 <test@plt>
lea    -0x6(%rbp),%rdi
mov    $0xaa,%esi
mov    $0x6,%edx
call   1030 <memset@plt>
mov    0xea6(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    0xea4(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    -0x6(%rbp),%rdi
lea    -0x14(%rbp),%rdx
mov    $0x5,%esi
mov    $0xc,%ecx
call   1050 <websafe_base64_encode@plt>
mov    %eax,%edi
call   1040 <assert@plt>
movsbl -0x6(%rbp),%eax
cmp    $0x45,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x6a,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsbl -0x4(%rbp),%eax
cmp    $0x52,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsbl -0x3(%rbp),%eax
cmp    $0x57,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsbl -0x2(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsbl -0x1(%rbp),%eax
cmp    $0xaa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_simple_case>:
push   %rbx
sub    $0x20,%rsp
lea    0xeb4(%rip),%rdi
call   1060 <test@plt>
lea    0xa(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xaa,%esi
mov    $0x6,%edx
call   1030 <memset@plt>
mov    0xeae(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xe9b(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0xc,%ecx
call   1050 <websafe_base64_encode@plt>
mov    %eax,%edi
call   1040 <assert@plt>
xor    %edi,%edi
cmpb   $0x45,0xa(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmpb   $0x6a,0xb(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmpb   $0x52,0xc(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmpb   $0x57,0xd(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmpb   $0x0,0xe(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"test_simple_case\00"
@__const.test_simple_case.input = [3 x i32] [i32 18, i32 52, i32 86]
define void @test_simple_case() {
%1 = alloca [6 x i8]
%2 = alloca [3 x i32]
%3 = call i32 @test(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 170, i32 6)
%6 = bitcast [3 x i32]* %2 to i8*
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%9 = call i32 @websafe_base64_encode(i8* %7, i32 5, i32* %8, i32 12)
%10 = call i32 @assert(i32 %9)
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 69
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 1
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 106
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 2
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 82
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 3
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 87
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 4
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 0
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 5
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 170
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"test_simple_case\00"
@__const.test_simple_case.input = [3 x i32] [i32 18, i32 52, i32 86]
define void @test_simple_case() {
%1 = alloca [6 x i8]
%2 = alloca [3 x i32]
%3 = tail call i32 @test(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 170, i32 6)
%6 = bitcast [3 x i32]* %2 to i8*
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%8 = call i32 @websafe_base64_encode(i8* %4, i32 5, i32* %7, i32 12)
%9 = call i32 @assert(i32 %8)
%10 = load i8, i8* %4
%11 = icmp eq i8 %10, 69
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 106
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 2
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 82
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 3
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 87
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 4
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = call i32 @assert(i32 0)
ret void
}