#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_str(int /*<<< orphan*/ *, char *, char *,
                                    char *);
char *pl_cat(char *, char *);
void test_strcat_empty_params() {
  char *ret_val;
  ret_val = pl_cat(NULL, "asd");
  assert_equal_str(NULL, ret_val, "test_strcat_empty_params",
                   "Test 1: NULL not returned.");
  ret_val = pl_cat("asd", NULL);
  assert_equal_str(NULL, ret_val, "test_strcat_empty_params",
                   "Test 2: NULL not returned.");
  ret_val = pl_cat(NULL, NULL);
  assert_equal_str(NULL, ret_val, "test_strcat_empty_params",
                   "Test 3: NULL not returned.");
}


x86 assembly (clang, -O0):
<test_strcat_empty_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
lea    0xecd(%rip),%rsi
call   1040 <pl_cat@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    0xeb9(%rip),%rdx
lea    0xecb(%rip),%rcx
call   1030 <assert_equal_str@plt>
lea    0xea2(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <pl_cat@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    0xe8a(%rip),%rdx
lea    0xeb7(%rip),%rcx
call   1030 <assert_equal_str@plt>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1040 <pl_cat@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    0xe5f(%rip),%rdx
lea    0xea7(%rip),%rcx
call   1030 <assert_equal_str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strcat_empty_params>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <pl_cat@plt>
lea    0xec8(%rip),%rbx
lea    0xeda(%rip),%rcx
xor    %edi,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1030 <assert_equal_str@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <pl_cat@plt>
lea    0xed7(%rip),%rcx
xor    %edi,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1030 <assert_equal_str@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <pl_cat@plt>
lea    0xed5(%rip),%rcx
xor    %edi,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <assert_equal_str@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"asd\00"
@.str.1 = [25 x i8] c"test_strcat_empty_params\00"
@.str.2 = [27 x i8] c"Test 1: NULL not returned.\00"
@.str.3 = [27 x i8] c"Test 2: NULL not returned.\00"
@.str.4 = [27 x i8] c"Test 3: NULL not returned.\00"
define void @test_strcat_empty_params() {
%1 = alloca i8*
%2 = call i8* @pl_cat(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @assert_equal_str(i32* null, i8* %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%5 = call i8* @pl_cat(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* null)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @assert_equal_str(i32* null, i8* %6, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%8 = call i8* @pl_cat(i8* null, i8* null)
store i8* %8, i8** %1
%9 = load i8*, i8** %1
%10 = call i32 @assert_equal_str(i32* null, i8* %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"asd\00"
@.str.1 = [25 x i8] c"test_strcat_empty_params\00"
@.str.2 = [27 x i8] c"Test 1: NULL not returned.\00"
@.str.3 = [27 x i8] c"Test 2: NULL not returned.\00"
@.str.4 = [27 x i8] c"Test 3: NULL not returned.\00"
define void @test_strcat_empty_params() {
%1 = tail call i8* @pl_cat(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @assert_equal_str(i32* null, i8* %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i8* @pl_cat(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* null)
%4 = tail call i32 @assert_equal_str(i32* null, i8* %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i8* @pl_cat(i8* null, i8* null)
%6 = tail call i32 @assert_equal_str(i32* null, i8* %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
ret void
}