#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*/ printf(char *);
int /*<<< orphan*/ test_str_erase(char *, int, int);
int main(int argc, const char *argv[]) {
  printf("\nIGNORE\n");
  test_str_erase("string", 2, 3);
  printf("\nWorking\n");
  test_str_erase("string", 2, 3);
  printf("\nEnd > Length\n");
  test_str_erase("string", 1, 20);
  printf("\nStart = End\n");
  test_str_erase("string", 4, 4);
  printf("\nStart > End\n");
  test_str_erase("string", 4, 2);
  printf("\nEntire String\n");
  test_str_erase("string", 0, 6);
  printf("\nStart > Length\n");
  test_str_erase("string", 7, 8);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <test_str_erase@plt>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <test_str_erase@plt>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xe83(%rip),%rdi
mov    $0x1,%esi
mov    $0x14,%edx
call   1030 <test_str_erase@plt>
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe61(%rip),%rdi
mov    $0x4,%edx
mov    %edx,%esi
call   1030 <test_str_erase@plt>
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe42(%rip),%rdi
mov    $0x4,%esi
mov    $0x2,%edx
call   1030 <test_str_erase@plt>
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
lea    0xe20(%rip),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1030 <test_str_erase@plt>
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
lea    0xe01(%rip),%rdi
mov    $0x7,%esi
mov    $0x8,%edx
call   1030 <test_str_erase@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xedf(%rip),%rdi
call   1040 <puts@plt>
lea    0xecc(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <test_str_erase@plt>
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <test_str_erase@plt>
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x14,%edx
call   1030 <test_str_erase@plt>
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   1030 <test_str_erase@plt>
lea    0xe8c(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x2,%edx
call   1030 <test_str_erase@plt>
lea    0xe7b(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1030 <test_str_erase@plt>
lea    0xe6f(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x8,%edx
call   1030 <test_str_erase@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"\0AIGNORE\0A\00"
@.str.1 = [7 x i8] c"string\00"
@.str.2 = [10 x i8] c"\0AWorking\0A\00"
@.str.3 = [15 x i8] c"\0AEnd > Length\0A\00"
@.str.4 = [14 x i8] c"\0AStart = End\0A\00"
@.str.5 = [14 x i8] c"\0AStart > End\0A\00"
@.str.6 = [16 x i8] c"\0AEntire String\0A\00"
@.str.7 = [17 x i8] c"\0AStart > Length\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 3)
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 3)
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 20)
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 4)
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 2)
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 6)
%17 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"string\00"
@str = [8 x i8] c"\0AIGNORE\00"
@str.8 = [9 x i8] c"\0AWorking\00"
@str.9 = [14 x i8] c"\0AEnd > Length\00"
@str.10 = [13 x i8] c"\0AStart = End\00"
@str.11 = [13 x i8] c"\0AStart > End\00"
@str.12 = [15 x i8] c"\0AEntire String\00"
@str.13 = [16 x i8] c"\0AStart > Length\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.8, i64 0, i64 0))
%6 = tail call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 3)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.9, i64 0, i64 0))
%8 = tail call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 20)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
%10 = tail call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 4)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.11, i64 0, i64 0))
%12 = tail call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 2)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0))
%14 = tail call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 6)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.13, i64 0, i64 0))
%16 = tail call i32 @test_str_erase(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 8)
ret i32 0
}