#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *malloc(int);
int /*<<< orphan*/ stderr;
int strlen(char const *);
char *remove_word(const char *remove, const char *line) {
  char *holder;
  int i;
  holder = malloc(strlen(line) - strlen(remove) + 1);
  if (holder == NULL) {
    fprintf(stderr, "Not enough memory\n");
    exit(EXIT_FAILURE);
  }
  for (i = strlen(remove); i < strlen(line); i++)
    holder[i - strlen(remove)] = line[i];
  holder[i - strlen(remove)] = '\0';
  return holder;
}


x86 assembly (clang, -O0):
<remove_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%edi
sub    %eax,%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a4 <remove_word+0x64>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    1213 <remove_word+0xd3>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x31(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%ecx
mov    -0x31(%rbp),%dl
mov    %eax,%esi
mov    -0x30(%rbp),%rax
sub    %esi,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b0 <remove_word+0x70>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x44(%rbp),%ecx
mov    %eax,%edx
mov    -0x40(%rbp),%rax
sub    %edx,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_word>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
sub    %eax,%ebx
add    $0x1,%ebx
mov    %ebx,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     11da <remove_word+0x9a>
mov    %rax,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebx
jge    11bc <remove_word+0x7c>
movslq %ebx,%rbx
nopl   (%rax)
movzbl (%r12,%rbx,1),%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
mov    %r15,%rcx
sub    %rax,%rcx
mov    %bpl,(%rcx,%rbx,1)
add    $0x1,%rbx
mov    %r12,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1190 <remove_word+0x50>
mov    %r14,%rdi
call   1030 <strlen@plt>
sub    %eax,%ebx
movslq %ebx,%rax
movb   $0x0,(%r15,%rax,1)
mov    %r15,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
lea    0xe16(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Not enough memory\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @remove_word(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = sub nsw i32 %8, %10
%12 = add nsw i32 %11, 1
%13 = call i8* @malloc(i32 %12)
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i8*, i8** %3
%23 = call i32 @strlen(i8* %22)
store i32 %23, i32* %6
br label %24
24: ; preds = %42, %21
%25 = load i32, i32* %6
%26 = load i8*, i8** %4
%27 = call i32 @strlen(i8* %26)
%28 = icmp slt i32 %25, %27
br i1 %28, label %29, label %45
29: ; preds = %24
%30 = load i8*, i8** %4
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = load i8*, i8** %5
%36 = load i32, i32* %6
%37 = load i8*, i8** %3
%38 = call i32 @strlen(i8* %37)
%39 = sub nsw i32 %36, %38
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %35, i64 %40
store i8 %34, i8* %41
br label %42
42: ; preds = %29
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %24
45: ; preds = %24
%46 = load i8*, i8** %5
%47 = load i32, i32* %6
%48 = load i8*, i8** %3
%49 = call i32 @strlen(i8* %48)
%50 = sub nsw i32 %47, %49
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %46, i64 %51
store i8 0, i8* %52
%53 = load i8*, i8** %5
ret i8* %53
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Not enough memory\0A\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @remove_word(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @strlen(i8* %0)
%5 = add i32 %3, 1
%6 = sub i32 %5, %4
%7 = tail call i8* @malloc(i32 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = tail call i32 @strlen(i8* %0)
%16 = tail call i32 @strlen(i8* %1)
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %34
18: ; preds = %14
%19 = sext i32 %15 to i64
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ %19, %18 ], [ %28, %20 ]
%22 = getelementptr inbounds i8, i8* %1, i64 %21
%23 = load i8, i8* %22
%24 = tail call i32 @strlen(i8* %0)
%25 = sext i32 %24 to i64
%26 = sub nsw i64 %21, %25
%27 = getelementptr inbounds i8, i8* %7, i64 %26
store i8 %23, i8* %27
%28 = add nsw i64 %21, 1
%29 = tail call i32 @strlen(i8* %1)
%30 = sext i32 %29 to i64
%31 = icmp slt i64 %28, %30
br i1 %31, label %20, label %32
32: ; preds = %20
%33 = trunc i64 %28 to i32
br label %34
34: ; preds = %32, %14
%35 = phi i32 [ %15, %14 ], [ %33, %32 ]
%36 = tail call i32 @strlen(i8* %0)
%37 = sub nsw i32 %35, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %7, i64 %38
store i8 0, i8* %39
ret i8* %7
}