#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 */
char *strip_empty_chars(char *);
char *strip_with_chars(char *, char *);
scalar_t__ strlen(char *);
char *pl_strip(char *string, char *chars) {
  if (string == NULL || strlen(string) == 0) {
    return NULL;
  }
  if (chars == NULL || strlen(chars) == 0) {
    return strip_empty_chars(string);
  }
  return strip_with_chars(string, chars);
}


x86 assembly (clang, -O0):
<pl_strip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115e <pl_strip+0x2e>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    116b <pl_strip+0x3b>
movq   $0x0,-0x8(%rbp)
jmp    11ac <pl_strip+0x7c>
cmpq   $0x0,-0x18(%rbp)
je     1189 <pl_strip+0x59>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    119b <pl_strip+0x6b>
mov    -0x10(%rbp),%rdi
call   1050 <strip_empty_chars@plt>
mov    %rax,-0x8(%rbp)
jmp    11ac <pl_strip+0x7c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strip_with_chars@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pl_strip>:
test   %rdi,%rdi
je     1139 <pl_strip+0x19>
cmpb   $0x0,(%rdi)
je     1139 <pl_strip+0x19>
test   %rsi,%rsi
je     113c <pl_strip+0x1c>
cmpb   $0x0,(%rsi)
je     113c <pl_strip+0x1c>
jmp    1030 <strip_with_chars@plt>
xor    %eax,%eax
ret
jmp    1040 <strip_empty_chars@plt>

LLVM IR (-O0):
define i8* @pl_strip(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i64 @strlen(i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8, %2
store i8* null, i8** %3
br label %27
13: ; preds = %8
%14 = load i8*, i8** %5
%15 = icmp eq i8* %14, null
br i1 %15, label %20, label %16
16: ; preds = %13
%17 = load i8*, i8** %5
%18 = call i64 @strlen(i8* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %16, %13
%21 = load i8*, i8** %4
%22 = call i8* @strip_empty_chars(i8* %21)
store i8* %22, i8** %3
br label %27
23: ; preds = %16
%24 = load i8*, i8** %4
%25 = load i8*, i8** %5
%26 = call i8* @strip_with_chars(i8* %24, i8* %25)
store i8* %26, i8** %3
br label %27
27: ; preds = %23, %20, %12
%28 = load i8*, i8** %3
ret i8* %28
}

LLVM IR (-O2):
define i8* @pl_strip(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %16, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %4
%8 = icmp eq i8* %1, null
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = load i8, i8* %1
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9, %7
%13 = tail call i8* @strip_empty_chars(i8* %0)
br label %16
14: ; preds = %9
%15 = tail call i8* @strip_with_chars(i8* %0, i8* %1)
br label %16
16: ; preds = %2, %4, %14, %12
%17 = phi i8* [ %13, %12 ], [ %15, %14 ], [ null, %4 ], [ null, %2 ]
ret i8* %17
}