#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 /*<<< orphan*/ out;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ test(char *);
int websafe_base64_encode(char *, int, int /*<<< orphan*/ *,
                          int /*<<< orphan*/);
void test_no_data_makes_empty_string() {
  test("test_no_data_makes_empty_string");
  char out[64];
  memset(out, 0xaa, sizeof(out));
  assert(websafe_base64_encode(out, sizeof(out), NULL, 0));
  assert(out[0] == '\0');
  assert(out[1] == 0xaa);
}


x86 assembly (clang, -O0):
<test_no_data_makes_empty_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xeb1(%rip),%rdi
call   1060 <test@plt>
lea    -0x40(%rbp),%rdi
mov    $0xaa,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
lea    -0x40(%rbp),%rdi
mov    $0x40,%esi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <websafe_base64_encode@plt>
mov    %eax,%edi
call   1040 <assert@plt>
movsbl -0x40(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsbl -0x3f(%rbp),%eax
cmp    $0xaa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_no_data_makes_empty_string>:
push   %rbx
sub    $0x40,%rsp
lea    0xeb4(%rip),%rdi
call   1060 <test@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xaa,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
mov    %rbx,%rdi
mov    $0x40,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <websafe_base64_encode@plt>
mov    %eax,%edi
call   1040 <assert@plt>
xor    %edi,%edi
cmpb   $0x0,(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
call   1040 <assert@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"test_no_data_makes_empty_string\00"
define void @test_no_data_makes_empty_string() {
%1 = alloca [64 x i8]
%2 = call i32 @test(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 170, i32 64)
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%6 = call i32 @websafe_base64_encode(i8* %5, i32 64, i32* null, i32 0)
%7 = call i32 @assert(i32 %6)
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 170
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"test_no_data_makes_empty_string\00"
define void @test_no_data_makes_empty_string() {
%1 = alloca [64 x i8]
%2 = tail call i32 @test(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 170, i32 64)
%5 = call i32 @websafe_base64_encode(i8* %3, i32 64, i32* null, i32 0)
%6 = call i32 @assert(i32 %5)
%7 = load i8, i8* %3
%8 = icmp eq i8 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 @assert(i32 0)
ret void
}