#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*/ assert_equal_int(int /*<<< orphan*/, int, char *, char *);
int /*<<< orphan*/ assert_equal_str(int /*<<< orphan*/ *, char *, char *,
                                    char *);
char **pl_split(char *, char *, int *);
void test_split_empty_delim() {
  int size = 0;
  char the_string[] = "fooasdbarasdmagic";
  char **ret_val;
  ret_val = pl_split(the_string, "", &size);
  assert_equal_str(NULL, (char *)ret_val, "test_split_empty_delim",
                   "Test 1: NULL not returned.");
  assert_equal_int(0, size, "test_split_empty_delim",
                   "Test 2: Size is not right.");
}


x86 assembly (clang, -O0):
<test_split_empty_delim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb4(%rip),%ax
mov    %ax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xed8(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1040 <pl_split@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    0xe8b(%rip),%rdx
lea    0xe9b(%rip),%rcx
call   1030 <assert_equal_str@plt>
mov    -0x4(%rbp),%esi
xor    %edi,%edi
lea    0xe73(%rip),%rdx
lea    0xe9e(%rip),%rcx
call   1050 <assert_equal_int@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_split_empty_delim>:
push   %rbx
sub    $0x30,%rsp
movl   $0x0,0xc(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movw   $0x63,0x20(%rsp)
lea    0xeec(%rip),%rsi
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rdx
call   1040 <pl_split@plt>
lea    0xea5(%rip),%rbx
lea    0xeb5(%rip),%rcx
xor    %edi,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1030 <assert_equal_str@plt>
mov    0xc(%rsp),%esi
lea    0xeb8(%rip),%rcx
xor    %edi,%edi
mov    %rbx,%rdx
call   1050 <assert_equal_int@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_split_empty_delim.the_string = [18 x i8] c"fooasdbarasdmagic\00"
@.str = [1 x i8] zeroinitializer
@.str.1 = [23 x i8] c"test_split_empty_delim\00"
@.str.2 = [27 x i8] c"Test 1: NULL not returned.\00"
@.str.3 = [27 x i8] c"Test 2: Size is not right.\00"
define void @test_split_empty_delim() {
%1 = alloca i32
%2 = alloca [18 x i8]
%3 = alloca i8**
store i32 0, i32* %1
%4 = bitcast [18 x i8]* %2 to i8*
%5 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%6 = call i8** @pl_split(i8* %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32* %1)
store i8** %6, i8*** %3
%7 = load i8**, i8*** %3
%8 = bitcast i8** %7 to i8*
%9 = call i32 @assert_equal_str(i32* null, i8* %8, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %1
%11 = call i32 @assert_equal_int(i32 0, i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.test_split_empty_delim.the_string = [18 x i8] c"fooasdbarasdmagic\00"
@.str = [1 x i8] zeroinitializer
@.str.1 = [23 x i8] c"test_split_empty_delim\00"
@.str.2 = [27 x i8] c"Test 1: NULL not returned.\00"
@.str.3 = [27 x i8] c"Test 2: Size is not right.\00"
define void @test_split_empty_delim() {
%1 = alloca i32
%2 = alloca [18 x i8]
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%5 = call i8** @pl_split(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = bitcast i8** %5 to i8*
%7 = call i32 @assert_equal_str(i32* null, i8* %6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = call i32 @assert_equal_int(i32 0, i32 %8, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
ret void
}