#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_strip(char *, char *);
void test_strip_empty_params() {
  char *ret_val;
  ret_val = pl_strip("", "a");
  assert_equal_str(NULL, ret_val, "test_strip_empty_params",
                   "Test 1: NULL not returned.");
  ret_val = pl_strip("   asd   ", "");
  assert_equal_str("asd", ret_val, "test_strip_empty_params",
                   "Test 2: Strings not equal.");
  free(ret_val);
  ret_val = pl_strip("   asd   ", NULL);
  assert_equal_str("asd", ret_val, "test_strip_empty_params",
                   "Test 3: Strings not equal.");
  free(ret_val);
  ret_val = pl_strip(NULL, NULL);
  assert_equal_str(NULL, ret_val, "test_strip_empty_params",
                   "Test 4: NULL not returned");
  ret_val = pl_strip(NULL, "asd");
  assert_equal_str(NULL, ret_val, "test_strip_empty_params",
                   "Test 5: NULL not returned.");
}


x86 assembly (clang, -O0):
<test_strip_empty_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeff(%rip),%rdi
lea    0xeba(%rip),%rsi
call   1050 <pl_strip@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    0xea4(%rip),%rdx
lea    0xeb5(%rip),%rcx
call   1040 <assert_equal_str@plt>
lea    0xec4(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1050 <pl_strip@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb3(%rip),%rdi
lea    0xe6f(%rip),%rdx
lea    0xea9(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
lea    0xe86(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <pl_strip@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe78(%rip),%rdi
lea    0xe34(%rip),%rdx
lea    0xe89(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1050 <pl_strip@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    0xe00(%rip),%rdx
lea    0xe70(%rip),%rcx
call   1040 <assert_equal_str@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe26(%rip),%rsi
call   1050 <pl_strip@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    0xdd1(%rip),%rdx
lea    0xe5b(%rip),%rcx
call   1040 <assert_equal_str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strip_empty_params>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeff(%rip),%r14
lea    0xeba(%rip),%rsi
mov    %r14,%rdi
call   1050 <pl_strip@plt>
lea    0xead(%rip),%r15
lea    0xebe(%rip),%rcx
xor    %edi,%edi
mov    %rax,%rsi
mov    %r15,%rdx
call   1040 <assert_equal_str@plt>
lea    0xec5(%rip),%r12
mov    %r12,%rdi
mov    %r14,%rsi
call   1050 <pl_strip@plt>
mov    %rax,%rbx
lea    0xeba(%rip),%r14
lea    0xeb7(%rip),%rcx
mov    %r14,%rdi
mov    %rax,%rsi
mov    %r15,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
xor    %esi,%esi
call   1050 <pl_strip@plt>
mov    %rax,%rbx
lea    0xea8(%rip),%rcx
mov    %r14,%rdi
mov    %rax,%rsi
mov    %r15,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <pl_strip@plt>
lea    0xe9d(%rip),%rcx
xor    %edi,%edi
mov    %rax,%rsi
mov    %r15,%rdx
call   1040 <assert_equal_str@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1050 <pl_strip@plt>
lea    0xe99(%rip),%rcx
xor    %edi,%edi
mov    %rax,%rsi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <assert_equal_str@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [24 x i8] c"test_strip_empty_params\00"
@.str.3 = [27 x i8] c"Test 1: NULL not returned.\00"
@.str.4 = [10 x i8] c" asd \00"
@.str.5 = [4 x i8] c"asd\00"
@.str.6 = [27 x i8] c"Test 2: Strings not equal.\00"
@.str.7 = [27 x i8] c"Test 3: Strings not equal.\00"
@.str.8 = [26 x i8] c"Test 4: NULL not returned\00"
@.str.9 = [27 x i8] c"Test 5: NULL not returned.\00"
define void @test_strip_empty_params() {
%1 = alloca i8*
%2 = call i8* @pl_strip(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @assert_equal_str(i8* null, i8* %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%5 = call i8* @pl_strip(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @assert_equal_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%8 = load i8*, i8** %1
%9 = call i32 @free(i8* %8)
%10 = call i8* @pl_strip(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* null)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @assert_equal_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
%13 = load i8*, i8** %1
%14 = call i32 @free(i8* %13)
%15 = call i8* @pl_strip(i8* null, i8* null)
store i8* %15, i8** %1
%16 = load i8*, i8** %1
%17 = call i32 @assert_equal_str(i8* null, i8* %16, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%18 = call i8* @pl_strip(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
store i8* %18, i8** %1
%19 = load i8*, i8** %1
%20 = call i32 @assert_equal_str(i8* null, i8* %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [24 x i8] c"test_strip_empty_params\00"
@.str.3 = [27 x i8] c"Test 1: NULL not returned.\00"
@.str.4 = [10 x i8] c" asd \00"
@.str.5 = [4 x i8] c"asd\00"
@.str.6 = [27 x i8] c"Test 2: Strings not equal.\00"
@.str.7 = [27 x i8] c"Test 3: Strings not equal.\00"
@.str.8 = [26 x i8] c"Test 4: NULL not returned\00"
@.str.9 = [27 x i8] c"Test 5: NULL not returned.\00"
define void @test_strip_empty_params() {
%1 = tail call i8* @pl_strip(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @assert_equal_str(i8* null, i8* %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i8* @pl_strip(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @assert_equal_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%5 = tail call i32 @free(i8* %3)
%6 = tail call i8* @pl_strip(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* null)
%7 = tail call i32 @assert_equal_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
%8 = tail call i32 @free(i8* %6)
%9 = tail call i8* @pl_strip(i8* null, i8* null)
%10 = tail call i32 @assert_equal_str(i8* null, i8* %9, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%11 = tail call i8* @pl_strip(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%12 = tail call i32 @assert_equal_str(i8* null, i8* %11, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
ret void
}