#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 *strchr(char *, char);
void htmlreplace(char *bb, char what) {
  char *start, *end;
  while ((start = strchr(bb, '<')) != NULL)
    if ((end = strchr(start, '>')) != NULL) {
      char *tmp;
      for (tmp = start; tmp <= end; tmp++)
        *tmp = what;
    } else
      break;
  end = bb;
}


x86 assembly (clang, -O0):
<htmlreplace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3c,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1199 <htmlreplace+0x89>
mov    -0x18(%rbp),%rdi
mov    $0x3e,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     118f <htmlreplace+0x7f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
ja     118a <htmlreplace+0x7a>
mov    -0x9(%rbp),%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1162 <htmlreplace+0x52>
jmp    1194 <htmlreplace+0x84>
jmp    1199 <htmlreplace+0x89>
jmp    1122 <htmlreplace+0x12>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<htmlreplace>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
mov    $0x3c,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     119e <htmlreplace+0x7e>
mov    %rax,%rbp
movzbl %r14b,%r14d
jmp    1165 <htmlreplace+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x3c,%esi
call   1030 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
je     119e <htmlreplace+0x7e>
mov    %rbp,%rdi
mov    $0x3e,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     119e <htmlreplace+0x7e>
cmp    %rax,%rbp
ja     1150 <htmlreplace+0x30>
lea    0x1(%rbp),%rcx
add    $0x1,%rax
cmp    %rax,%rcx
cmova  %rcx,%rax
sub    %rbp,%rax
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %rax,%rdx
call   1040 <memset@plt>
jmp    1150 <htmlreplace+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @htmlreplace(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
store i8 %1, i8* %4
br label %8
8: ; preds = %30, %2
%9 = load i8*, i8** %3
%10 = call i8* @strchr(i8* %9, i8 signext 60)
store i8* %10, i8** %5
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %31
12: ; preds = %8
%13 = load i8*, i8** %5
%14 = call i8* @strchr(i8* %13, i8 signext 62)
store i8* %14, i8** %6
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %29
16: ; preds = %12
%17 = load i8*, i8** %5
store i8* %17, i8** %7
br label %18
18: ; preds = %25, %16
%19 = load i8*, i8** %7
%20 = load i8*, i8** %6
%21 = icmp ule i8* %19, %20
br i1 %21, label %22, label %28
22: ; preds = %18
%23 = load i8, i8* %4
%24 = load i8*, i8** %7
store i8 %23, i8* %24
br label %25
25: ; preds = %22
%26 = load i8*, i8** %7
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %7
br label %18
28: ; preds = %18
br label %30
29: ; preds = %12
br label %31
30: ; preds = %28
br label %8
31: ; preds = %29, %8
%32 = load i8*, i8** %3
store i8* %32, i8** %6
ret void
}

LLVM IR (-O2):
define void @htmlreplace(i8* %0, i8 signext %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 60)
%4 = icmp eq i8* %3, null
br i1 %4, label %21, label %8
5: ; preds = %16, %14
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 60)
%7 = icmp eq i8* %6, null
br i1 %7, label %21, label %8
8: ; preds = %2, %5
%9 = phi i8* [ %6, %5 ], [ %3, %2 ]
%10 = ptrtoint i8* %9 to i64
%11 = tail call i8* @strchr(i8* %9, i8 signext 62)
%12 = ptrtoint i8* %11 to i64
%13 = icmp eq i8* %11, null
br i1 %13, label %21, label %14
14: ; preds = %8
%15 = icmp ugt i8* %9, %11
br i1 %15, label %5, label %16
16: ; preds = %14
%17 = add i64 %10, 1
%18 = add nuw i64 %12, 1
%19 = call i64 @llvm.umax.i64(i64 %17, i64 %18)
%20 = sub i64 %19, %10
br label %5
21: ; preds = %5, %8, %2
ret void
}