#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 */
typedef size_t ssize_t;

/* Variables and functions */
int /*<<< orphan*/ __strAppend(char **, char *);
int /*<<< orphan*/ __strCopySub(char **, char *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ assert(int);
char *strCreate();
int /*<<< orphan*/ strFree(char *);
size_t strlen(char *);
void __strDelete(char **stringPtr, size_t pos, ssize_t len) {
  char *ns;
  assert(stringPtr != NULL);
  assert(*stringPtr != NULL);
  assert(pos >= 0 && pos < strlen(*stringPtr));
  assert(len >= 0);
  if (len == 0)
    return;
  ns = strCreate();
  __strCopySub(&ns, *stringPtr, 0, pos);
  if ((len >= 0) && ((pos + len) <= strlen(*stringPtr)))
    __strAppend(&ns, &(*stringPtr)[pos + len]);
  strFree(*stringPtr);
  *stringPtr = ns;
}


x86 assembly (clang, -O0):
<__strDelete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
jb     11cf <__strDelete+0x6f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
setb   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
jne    11fe <__strDelete+0x9e>
jmp    1284 <__strDelete+0x124>
mov    $0x0,%al
call   1040 <strCreate@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rcx
lea    -0x20(%rbp),%rdi
xor    %edx,%edx
call   1060 <__strCopySub@plt>
cmpq   $0x0,-0x18(%rbp)
jb     126d <__strDelete+0x10d>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
ja     126d <__strDelete+0x10d>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
add    %rax,%rsi
lea    -0x20(%rbp),%rdi
call   1070 <__strAppend@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1080 <strFree@plt>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__strDelete>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %edi,%edi
test   %r12,%r12
setne  %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,(%r12)
setne  %dil
call   1050 <assert@plt>
mov    (%r12),%rdi
call   1030 <strlen@plt>
xor    %edi,%edi
cmp    %r15,%rax
seta   %dil
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
test   %r14,%r14
je     1207 <__strDelete+0xa7>
xor    %eax,%eax
call   1040 <strCreate@plt>
mov    %rax,(%rsp)
mov    (%r12),%rsi
mov    %rsp,%rdi
xor    %edx,%edx
mov    %r15,%rcx
call   1060 <__strCopySub@plt>
add    %r15,%r14
mov    (%r12),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    %rax,%r14
ja     11f7 <__strDelete+0x97>
add    %r14,%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1070 <__strAppend@plt>
mov    (%r12),%rbx
mov    %rbx,%rdi
call   1080 <strFree@plt>
mov    (%rsp),%rax
mov    %rax,(%r12)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @__strDelete(i8** %0, i64 %1, i64 %2) {
%4 = alloca i8**
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
store i8** %0, i8*** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i8**, i8*** %4
%9 = icmp ne i8** %8, null
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i8**, i8*** %4
%13 = load i8*, i8** %12
%14 = icmp ne i8* %13, null
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i64, i64* %5
%18 = icmp uge i64 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %3
%20 = load i64, i64* %5
%21 = load i8**, i8*** %4
%22 = load i8*, i8** %21
%23 = call i64 @strlen(i8* %22)
%24 = icmp ult i64 %20, %23
br label %25
25: ; preds = %19, %3
%26 = phi i1 [ false, %3 ], [ %24, %19 ]
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = load i64, i64* %6
%30 = icmp uge i64 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = load i64, i64* %6
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %25
br label %66
36: ; preds = %25
%37 = call i8* (...) @strCreate()
store i8* %37, i8** %7
%38 = load i8**, i8*** %4
%39 = load i8*, i8** %38
%40 = load i64, i64* %5
%41 = call i32 @__strCopySub(i8** %7, i8* %39, i32 0, i64 %40)
%42 = load i64, i64* %6
%43 = icmp uge i64 %42, 0
br i1 %43, label %44, label %60
44: ; preds = %36
%45 = load i64, i64* %5
%46 = load i64, i64* %6
%47 = add i64 %45, %46
%48 = load i8**, i8*** %4
%49 = load i8*, i8** %48
%50 = call i64 @strlen(i8* %49)
%51 = icmp ule i64 %47, %50
br i1 %51, label %52, label %60
52: ; preds = %44
%53 = load i8**, i8*** %4
%54 = load i8*, i8** %53
%55 = load i64, i64* %5
%56 = load i64, i64* %6
%57 = add i64 %55, %56
%58 = getelementptr inbounds i8, i8* %54, i64 %57
%59 = call i32 @__strAppend(i8** %7, i8* %58)
br label %60
60: ; preds = %52, %44, %36
%61 = load i8**, i8*** %4
%62 = load i8*, i8** %61
%63 = call i32 @strFree(i8* %62)
%64 = load i8*, i8** %7
%65 = load i8**, i8*** %4
store i8* %64, i8** %65
br label %66
66: ; preds = %60, %35
ret void
}

LLVM IR (-O2):
define void @__strDelete(i8** %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = icmp ne i8** %0, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = load i8*, i8** %0
%10 = icmp ne i8* %9, null
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = load i8*, i8** %0
%14 = tail call i64 @strlen(i8* dereferenceable(1) %13)
%15 = icmp ugt i64 %14, %1
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = tail call i32 @assert(i32 1)
%19 = icmp eq i64 %2, 0
br i1 %19, label %36, label %20
20: ; preds = %3
%21 = tail call i8* (...) @strCreate()
store i8* %21, i8** %4
%22 = load i8*, i8** %0
%23 = call i32 @__strCopySub(i8** %4, i8* %22, i32 0, i64 %1)
%24 = add i64 %2, %1
%25 = load i8*, i8** %0
%26 = call i64 @strlen(i8* dereferenceable(1) %25)
%27 = icmp ugt i64 %24, %26
br i1 %27, label %32, label %28
28: ; preds = %20
%29 = getelementptr inbounds i8, i8* %25, i64 %24
%30 = call i32 @__strAppend(i8** %4, i8* %29)
%31 = load i8*, i8** %0
br label %32
32: ; preds = %28, %20
%33 = phi i8* [ %31, %28 ], [ %25, %20 ]
%34 = call i32 @strFree(i8* %33)
%35 = load i8*, i8** %4
store i8* %35, i8** %0
br label %36
36: ; preds = %3, %32
ret void
}