#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_with_chars() {
  char *ret_val;
  char str1[] = "aaabbbccc";
  char str2[] = "bbbcccaaa";
  char str3[] = "aaabbbcccaaa";
  char str4[] = "adadbbbcccadad";
  ret_val = pl_strip(str1, "a");
  assert_equal_str("bbbccc", ret_val, "test_strip_with_chars",
                   "Test 1: Strings are not equal.");
  free(ret_val);
  ret_val = pl_strip(str2, "a");
  assert_equal_str("bbbccc", ret_val, "test_strip_with_chars",
                   "Test 2: Strings are not equal.");
  free(ret_val);
  ret_val = pl_strip(str3, "a");
  assert_equal_str("bbbccc", ret_val, "test_strip_with_chars",
                   "Test 3: Strings are not equal.");
  free(ret_val);
  ret_val = pl_strip(str4, "ad");
  assert_equal_str("bbbccc", ret_val, "test_strip_with_chars",
                   "Test 4: Strings are not equal.");
  free(ret_val);
}


x86 assembly (clang, -O0):
<test_strip_with_chars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xebe(%rip),%ax
mov    %ax,-0xa(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xeb5(%rip),%ax
mov    %ax,-0x14(%rbp)
mov    0xe9f(%rip),%rax
mov    %rax,-0x29(%rbp)
mov    0xe9d(%rip),%eax
mov    %eax,-0x21(%rbp)
mov    0xe98(%rip),%al
mov    %al,-0x1d(%rbp)
mov    0xe8f(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe8d(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xe87(%rip),%ax
mov    %ax,-0x2c(%rbp)
mov    0xe7f(%rip),%al
mov    %al,-0x2a(%rbp)
lea    -0x12(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1050 <pl_strip@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe3b(%rip),%rdi
lea    0xe57(%rip),%rdx
lea    0xe66(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
lea    -0x1c(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1050 <pl_strip@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe00(%rip),%rdi
lea    0xe1c(%rip),%rdx
lea    0xe4a(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
lea    -0x29(%rbp),%rdi
lea    0xdeb(%rip),%rsi
call   1050 <pl_strip@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xdc5(%rip),%rdi
lea    0xde1(%rip),%rdx
lea    0xe2e(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
lea    -0x38(%rbp),%rdi
lea    0xdbe(%rip),%rsi
call   1050 <pl_strip@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xd8a(%rip),%rdi
lea    0xda6(%rip),%rdx
lea    0xe12(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strip_with_chars>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
movabs $0x6363626262616161,%rax
62 63 63
mov    %rax,0x18(%rsp)
movw   $0x63,0x20(%rsp)
movabs $0x6161636363626262,%rcx
63 61 61
mov    %rcx,0x8(%rsp)
movw   $0x61,0x10(%rsp)
movabs $0x61616163636362,%rcx
mov    %rcx,0x2d(%rsp)
mov    %rax,0x28(%rsp)
movabs $0x64616461636363,%rax
mov    %rax,0x3f(%rsp)
movabs $0x6362626264616461,%rax
62 62 63
mov    %rax,0x38(%rsp)
lea    0xe75(%rip),%r12
lea    0x18(%rsp),%rdi
mov    %r12,%rsi
call   1050 <pl_strip@plt>
mov    %rax,%rbx
lea    0xe4c(%rip),%r15
lea    0xe68(%rip),%r14
lea    0xe77(%rip),%rcx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0x8(%rsp),%rdi
mov    %r12,%rsi
call   1050 <pl_strip@plt>
mov    %rax,%rbx
lea    0xe69(%rip),%rcx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0x28(%rsp),%rdi
mov    %r12,%rsi
call   1050 <pl_strip@plt>
mov    %rax,%rbx
lea    0xe5b(%rip),%rcx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xde7(%rip),%rsi
lea    0x38(%rsp),%rdi
call   1050 <pl_strip@plt>
mov    %rax,%rbx
lea    0xe49(%rip),%rcx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.test_strip_with_chars.str1 = [10 x i8] c"aaabbbccc\00"
@__const.test_strip_with_chars.str2 = [10 x i8] c"bbbcccaaa\00"
@__const.test_strip_with_chars.str3 = [13 x i8] c"aaabbbcccaaa\00"
@__const.test_strip_with_chars.str4 = [15 x i8] c"adadbbbcccadad\00"
@.str = [2 x i8] c"a\00"
@.str.1 = [7 x i8] c"bbbccc\00"
@.str.2 = [22 x i8] c"test_strip_with_chars\00"
@.str.3 = [31 x i8] c"Test 1: Strings are not equal.\00"
@.str.4 = [31 x i8] c"Test 2: Strings are not equal.\00"
@.str.5 = [31 x i8] c"Test 3: Strings are not equal.\00"
@.str.6 = [3 x i8] c"ad\00"
@.str.7 = [31 x i8] c"Test 4: Strings are not equal.\00"
define void @test_strip_with_chars() {
%1 = alloca i8*
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = alloca [13 x i8]
%5 = alloca [15 x i8]
%6 = bitcast [10 x i8]* %2 to i8*
%7 = bitcast [10 x i8]* %3 to i8*
%8 = bitcast [13 x i8]* %4 to i8*
%9 = bitcast [15 x i8]* %5 to i8*
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%11 = call i8* @pl_strip(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %11, i8** %1
%12 = load i8*, i8** %1
%13 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%14 = load i8*, i8** %1
%15 = call i32 @free(i8* %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%17 = call i8* @pl_strip(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %17, i8** %1
%18 = load i8*, i8** %1
%19 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %18, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%20 = load i8*, i8** %1
%21 = call i32 @free(i8* %20)
%22 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 0
%23 = call i8* @pl_strip(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %23, i8** %1
%24 = load i8*, i8** %1
%25 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%26 = load i8*, i8** %1
%27 = call i32 @free(i8* %26)
%28 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%29 = call i8* @pl_strip(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i8* %29, i8** %1
%30 = load i8*, i8** %1
%31 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %30, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%32 = load i8*, i8** %1
%33 = call i32 @free(i8* %32)
ret void
}

LLVM IR (-O2):
@__const.test_strip_with_chars.str1 = [10 x i8] c"aaabbbccc\00"
@__const.test_strip_with_chars.str2 = [10 x i8] c"bbbcccaaa\00"
@__const.test_strip_with_chars.str3 = [13 x i8] c"aaabbbcccaaa\00"
@__const.test_strip_with_chars.str4 = [15 x i8] c"adadbbbcccadad\00"
@.str = [2 x i8] c"a\00"
@.str.1 = [7 x i8] c"bbbccc\00"
@.str.2 = [22 x i8] c"test_strip_with_chars\00"
@.str.3 = [31 x i8] c"Test 1: Strings are not equal.\00"
@.str.4 = [31 x i8] c"Test 2: Strings are not equal.\00"
@.str.5 = [31 x i8] c"Test 3: Strings are not equal.\00"
@.str.6 = [3 x i8] c"ad\00"
@.str.7 = [31 x i8] c"Test 4: Strings are not equal.\00"
define void @test_strip_with_chars() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = alloca [13 x i8]
%4 = alloca [15 x i8]
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%9 = call i8* @pl_strip(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 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 ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @free(i8* %9)
%12 = call i8* @pl_strip(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @free(i8* %12)
%15 = call i8* @pl_strip(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @free(i8* %15)
%18 = call i8* @pl_strip(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %18, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%20 = call i32 @free(i8* %18)
ret void
}