#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 */
unsigned long strlen(char const *);
char *strstr(char *, char const *);
void deleteStrInString(char *str, const char *delStr) {
  if (str == NULL || delStr == NULL) {
    return;
  }
  char *pstr = strstr(str, delStr);
  if (pstr != NULL) {
    unsigned long delStrLength = strlen(delStr);
    while ((*pstr = *(pstr + delStrLength))) {
      pstr++;
    }
  }
}


x86 assembly (clang, -O0):
<deleteStrInString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1146 <deleteStrInString+0x26>
cmpq   $0x0,-0x10(%rbp)
jne    114b <deleteStrInString+0x2b>
jmp    11a3 <deleteStrInString+0x83>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11a3 <deleteStrInString+0x83>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x18(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     119e <deleteStrInString+0x7e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1174 <deleteStrInString+0x54>
jmp    11a3 <deleteStrInString+0x83>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deleteStrInString>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115e <deleteStrInString+0x3e>
mov    %rsi,%r14
test   %rsi,%rsi
je     115e <deleteStrInString+0x3e>
mov    %r14,%rsi
call   1040 <strstr@plt>
test   %rax,%rax
je     115e <deleteStrInString+0x3e>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
nopl   0x0(%rax)
movzbl (%rbx,%rax,1),%ecx
mov    %cl,(%rbx)
add    $0x1,%rbx
test   %cl,%cl
jne    1150 <deleteStrInString+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @deleteStrInString(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %17, label %6
6: ; preds = %2
%7 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%8 = icmp eq i8* %7, null
br i1 %8, label %17, label %9
9: ; preds = %6
%10 = tail call i64 @strlen(i8* dereferenceable(1) %1)
br label %11
11: ; preds = %11, %9
%12 = phi i8* [ %7, %9 ], [ %16, %11 ]
%13 = getelementptr inbounds i8, i8* %12, i64 %10
%14 = load i8, i8* %13
store i8 %14, i8* %12
%15 = icmp eq i8 %14, 0
%16 = getelementptr inbounds i8, i8* %12, i64 1
br i1 %15, label %17, label %11
17: ; preds = %11, %6, %2
ret void
}