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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ test(char *);
int /*<<< orphan*/ websafe_base64_encode(char *, int, int *, int);
void test_buffer_cannot_hold_nul_returns_false() {
  test("test_buffer_cannot_hold_nul_returns_false");
  char out[5];
  memset(out, 0xaa, sizeof(out));
  uint8_t in[] = {0x12, 0x34, 0x56};
  websafe_base64_encode(out, 4, in, sizeof(in));
  assert(out[4] == 0xaa);
}


x86 assembly (clang, -O0):
<test_buffer_cannot_hold_nul_returns_false>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
call   1060 <test@plt>
lea    -0x5(%rbp),%rdi
mov    $0xaa,%esi
mov    $0x5,%edx
call   1030 <memset@plt>
mov    0xebe(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    0xebc(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    -0x5(%rbp),%rdi
lea    -0x14(%rbp),%rdx
mov    $0x4,%esi
mov    $0xc,%ecx
call   1050 <websafe_base64_encode@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_buffer_cannot_hold_nul_returns_false>:
push   %rbx
sub    $0x20,%rsp
lea    0xeb4(%rip),%rdi
call   1060 <test@plt>
lea    0x1b(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xaa,%esi
mov    $0x5,%edx
call   1030 <memset@plt>
mov    0xec6(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xeb3(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0xc,%ecx
call   1050 <websafe_base64_encode@plt>
xor    %edi,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"test_buffer_cannot_hold_nul_returns_false\00"
@__const.test_buffer_cannot_hold_nul_returns_false.in = [3 x i32] [i32 18, i32 52, i32 86]
define void @test_buffer_cannot_hold_nul_returns_false() {
%1 = alloca [5 x i8]
%2 = alloca [3 x i32]
%3 = call i32 @test(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 170, i32 5)
%6 = bitcast [3 x i32]* %2 to i8*
%7 = getelementptr inbounds [5 x i8], [5 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 4, i32* %8, i32 12)
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 4
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 170
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"test_buffer_cannot_hold_nul_returns_false\00"
@__const.test_buffer_cannot_hold_nul_returns_false.in = [3 x i32] [i32 18, i32 52, i32 86]
define void @test_buffer_cannot_hold_nul_returns_false() {
%1 = alloca [5 x i8]
%2 = alloca [3 x i32]
%3 = tail call i32 @test(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 170, i32 5)
%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 4, i32* %7, i32 12)
%9 = call i32 @assert(i32 0)
ret void
}