#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() {
  char foo[] = "foo";
  char bar[] = "bar";
  char *ret_val;
  ret_val = pl_cat(foo, bar);
  assert_equal_str("foobar", ret_val, "test_strcat",
                   "The strings are not equal.");
  free(ret_val);
}


x86 assembly (clang, -O0):
<test_strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec2(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xec0(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <pl_cat@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe9e(%rip),%rdi
lea    0xe9e(%rip),%rdx
lea    0xea3(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strcat>:
push   %rbx
sub    $0x10,%rsp
movl   $0x6f6f66,0xc(%rsp)
movl   $0x726162,0x8(%rsp)
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1050 <pl_cat@plt>
mov    %rax,%rbx
lea    0xea2(%rip),%rdi
lea    0xea2(%rip),%rdx
lea    0xea7(%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.foo = [4 x i8] c"foo\00"
@__const.test_strcat.bar = [4 x i8] c"bar\00"
@.str = [7 x i8] c"foobar\00"
@.str.1 = [12 x i8] c"test_strcat\00"
@.str.2 = [27 x i8] c"The strings are not equal.\00"
define void @test_strcat() {
%1 = alloca [4 x i8]
%2 = alloca [4 x i8]
%3 = alloca i8*
%4 = bitcast [4 x i8]* %1 to i8*
%5 = bitcast [4 x i8]* %2 to i8*
%6 = getelementptr inbounds [4 x i8], [4 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 ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([12 x i8], [12 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 = [7 x i8] c"foobar\00"
@.str.1 = [12 x i8] c"test_strcat\00"
@.str.2 = [27 x i8] c"The strings are not equal.\00"
define void @test_strcat() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 7303014, i32* %1
%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 ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %5, i8* getelementptr inbounds ([12 x i8], [12 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
}