#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 *calloc(size_t, int);
size_t strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, size_t);
int /*<<< orphan*/ strncpy(char *, char *, size_t);
char *strutil_remove(char *original, size_t start, size_t end) {
  size_t len = end - start;
  size_t length = strlen(original);
  char *condensed = calloc(length - len + 1, sizeof(char));
  strncpy(condensed, original, start);
  strncat(condensed, original + end, length - end);
  return condensed;
}


x86 assembly (clang, -O0):
<strutil_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
sub    -0x20(%rbp),%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
sub    -0x18(%rbp),%rdx
call   1050 <strncat@plt>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strutil_remove>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rax,%r12
mov    %r14,%rax
sub    %r15,%rax
lea    (%rax,%r12,1),%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <strncpy@plt>
add    %r15,%rbx
sub    %r15,%r12
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <strncat@plt>
mov    %r13,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strutil_remove(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%10 = load i64, i64* %6
%11 = load i64, i64* %5
%12 = sub i64 %10, %11
store i64 %12, i64* %7
%13 = load i8*, i8** %4
%14 = call i64 @strlen(i8* %13)
store i64 %14, i64* %8
%15 = load i64, i64* %8
%16 = load i64, i64* %7
%17 = sub i64 %15, %16
%18 = add i64 %17, 1
%19 = call i8* @calloc(i64 %18, i32 1)
store i8* %19, i8** %9
%20 = load i8*, i8** %9
%21 = load i8*, i8** %4
%22 = load i64, i64* %5
%23 = call i32 @strncpy(i8* %20, i8* %21, i64 %22)
%24 = load i8*, i8** %9
%25 = load i8*, i8** %4
%26 = load i64, i64* %6
%27 = getelementptr inbounds i8, i8* %25, i64 %26
%28 = load i64, i64* %8
%29 = load i64, i64* %6
%30 = sub i64 %28, %29
%31 = call i32 @strncat(i8* %24, i8* %27, i64 %30)
%32 = load i8*, i8** %9
ret i8* %32
}

LLVM IR (-O2):
define i8* @strutil_remove(i8* %0, i64 %1, i64 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = add i64 %1, 1
%6 = sub i64 %5, %2
%7 = add i64 %6, %4
%8 = tail call i8* @calloc(i64 %7, i32 1)
%9 = tail call i32 @strncpy(i8* %8, i8* %0, i64 %1)
%10 = getelementptr inbounds i8, i8* %0, i64 %2
%11 = sub i64 %4, %2
%12 = tail call i32 @strncat(i8* %8, i8* %10, i64 %11)
ret i8* %8
}