#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_cpy(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ strcpy(char *, char *);
void test_strcpy_not_empty() {
  char the_string[] = "spam, eggs, and ham";
  char *ret_val, tmp[100];
  strcpy(tmp, "foobar");
  ret_val = pl_cpy(the_string, NULL);
  assert_equal_str("spam, eggs, and ham", ret_val, "test_strcpy_not_empty",
                   "The strings are not equal");
  free(ret_val);
}


x86 assembly (clang, -O0):
<test_strcpy_not_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0xeae(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeab(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea9(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <pl_cpy@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe82(%rip),%rdi
lea    0xe8f(%rip),%rdx
lea    0xe9e(%rip),%rcx
call   1050 <assert_equal_str@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strcpy_not_empty>:
push   %r14
push   %rbx
sub    $0x88,%rsp
movaps 0xeef(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x6d6168,0x10(%rsp)
lea    0xedc(%rip),%r14
lea    0xe95(%rip),%rsi
lea    0x20(%rsp),%rdi
call   1040 <strcpy@plt>
mov    %rsp,%rdi
xor    %esi,%esi
call   1060 <pl_cpy@plt>
mov    %rax,%rbx
lea    0xe7e(%rip),%rdx
lea    0xe8d(%rip),%rcx
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.test_strcpy_not_empty.the_string = [20 x i8] c"spam, eggs, and ham\00"
@.str = [7 x i8] c"foobar\00"
@.str.1 = [20 x i8] c"spam, eggs, and ham\00"
@.str.2 = [22 x i8] c"test_strcpy_not_empty\00"
@.str.3 = [26 x i8] c"The strings are not equal\00"
define void @test_strcpy_not_empty() {
%1 = alloca [20 x i8]
%2 = alloca i8*
%3 = alloca [100 x i8]
%4 = bitcast [20 x i8]* %1 to i8*
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%8 = call i8* @pl_cpy(i8* %7, i32* null)
store i8* %8, i8** %2
%9 = load i8*, i8** %2
%10 = call i32 @assert_equal_str(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%11 = load i8*, i8** %2
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"foobar\00"
@.str.1 = [20 x i8] c"spam, eggs, and ham\00"
@.str.2 = [22 x i8] c"test_strcpy_not_empty\00"
@.str.3 = [26 x i8] c"The strings are not equal\00"
define void @test_strcpy_not_empty() {
%1 = alloca [20 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = call i8* @pl_cpy(i8* %3, i32* null)
%7 = call i32 @assert_equal_str(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @free(i8* %6)
ret void
}