#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(char *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
char *pl_cat(char *, char *);
void test_strcat_empty_source() {
  char empty[5] = {0};
  char bar[] = "bar";
  char *ret_val;
  ret_val = pl_cat(empty, bar);
  assert_equal_str("bar", ret_val, "test_strcat_empty_source",
                   "The strings are not equal.");
  free(ret_val);
}


x86 assembly (clang, -O0):
<test_strcat_empty_source>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x5(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1060 <memset@plt>
mov    0xea2(%rip),%eax
mov    %eax,-0x9(%rbp)
lea    -0x5(%rbp),%rdi
lea    -0x9(%rbp),%rsi
call   1050 <pl_cat@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe83(%rip),%rdi
lea    0xe80(%rip),%rdx
lea    0xe92(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strcat_empty_source>:
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x726162,0xc(%rsp)
lea    0x4(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1050 <pl_cat@plt>
mov    %rax,%rbx
lea    0xe9d(%rip),%rdi
lea    0xe9a(%rip),%rdx
lea    0xeac(%rip),%rcx
mov    %rax,%rsi
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_strcat_empty_source.bar = [4 x i8] c"bar\00"
@.str = [4 x i8] c"bar\00"
@.str.1 = [25 x i8] c"test_strcat_empty_source\00"
@.str.2 = [27 x i8] c"The strings are not equal.\00"
define void @test_strcat_empty_source() {
%1 = alloca [5 x i8]
%2 = alloca [4 x i8]
%3 = alloca i8*
%4 = bitcast [5 x i8]* %1 to i8*
%5 = bitcast [4 x i8]* %2 to i8*
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%8 = call i8* @pl_cat(i8* %6, i8* %7)
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @assert_equal_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), 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.2, i64 0, i64 0))
%11 = load i8*, i8** %3
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"bar\00"
@.str.1 = [25 x i8] c"test_strcat_empty_source\00"
@.str.2 = [27 x i8] c"The strings are not equal.\00"
define void @test_strcat_empty_source() {
%1 = alloca [5 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 7496034, i32* %2
%5 = call i8* @pl_cat(i8* %3, i8* %4)
%6 = call i32 @assert_equal_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), 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.2, i64 0, i64 0))
%7 = call i32 @free(i8* %5)
ret void
}