#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 *strstr(char *, char *);
char *remove_html(char *receive) {
  if (receive == NULL)
    return NULL;
  char *end = strstr(receive, "<html>");
  unsigned int len = 0;
  char *p = receive;
  if (end) {
    while (p != end) {
      p++;
      len++;
    }
    receive[len] = '\0';
  }
  return receive;
}


x86 assembly (clang, -O0):
<remove_html>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <remove_html+0x24>
movq   $0x0,-0x8(%rbp)
jmp    11a2 <remove_html+0x92>
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     119a <remove_html+0x8a>
jmp    1167 <remove_html+0x57>
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     118f <remove_html+0x7f>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1167 <remove_html+0x57>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_html>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     113e <remove_html+0x2e>
lea    0xee0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strstr@plt>
test   %rax,%rax
je     113e <remove_html+0x2e>
mov    %eax,%ecx
sub    %ebx,%ecx
xor    %edx,%edx
cmp    %rbx,%rax
cmovne %rcx,%rdx
movb   $0x0,(%rbx,%rdx,1)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"<html>\00"
define i8* @remove_html(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i8* null, i8** %2
br label %33
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i8* @strstr(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %4
store i32 0, i32* %5
%13 = load i8*, i8** %3
store i8* %13, i8** %6
%14 = load i8*, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %31
16: ; preds = %10
br label %17
17: ; preds = %21, %16
%18 = load i8*, i8** %6
%19 = load i8*, i8** %4
%20 = icmp ne i8* %18, %19
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = load i8*, i8** %6
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %6
%24 = load i32, i32* %5
%25 = add i32 %24, 1
store i32 %25, i32* %5
br label %17
26: ; preds = %17
%27 = load i8*, i8** %3
%28 = load i32, i32* %5
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 0, i8* %30
br label %31
31: ; preds = %26, %10
%32 = load i8*, i8** %3
store i8* %32, i8** %2
br label %33
33: ; preds = %31, %9
%34 = load i8*, i8** %2
ret i8* %34
}

LLVM IR (-O2):
@.str = [7 x i8] c"<html>\00"
define i8* @remove_html(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = icmp eq i8* %0, null
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = tail call i8* @strstr(i8* %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = ptrtoint i8* %5 to i64
%9 = icmp eq i8* %5, %0
%10 = sub i64 %8, %2
%11 = and i64 %10, 4294967295
%12 = select i1 %9, i64 0, i64 %11
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 0, i8* %13
br label %14
14: ; preds = %4, %7, %1
ret i8* %0
}