#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*/ html(char const *);
int /*<<< orphan*/ html_raw(char const *, int);
void html_attr(const char *txt) {
  const char *t = txt;
  while (t && *t) {
    int c = *t;
    if (c == '<' || c == '>' || c == '\'' || c == '\"') {
      html_raw(txt, t - txt);
      if (c == '>')
        html("&gt;");
      else if (c == '<')
        html("&lt;");
      else if (c == '\'')
        html("&#x27;");
      else if (c == '"')
        html("&quot;");
      txt = t + 1;
    }
    t++;
  }
  if (t != txt)
    html(txt);
}


x86 assembly (clang, -O0):
<html_attr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x15(%rbp)
je     1154 <html_attr+0x34>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1164 <html_attr+0x44>
jmp    123f <html_attr+0x11f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x3c,-0x14(%rbp)
je     1196 <html_attr+0x76>
cmpl   $0x3e,-0x14(%rbp)
je     1196 <html_attr+0x76>
cmpl   $0x27,-0x14(%rbp)
je     1196 <html_attr+0x76>
cmpl   $0x22,-0x14(%rbp)
jne    122e <html_attr+0x10e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
call   1030 <html_raw@plt>
cmpl   $0x3e,-0x14(%rbp)
jne    11c7 <html_attr+0xa7>
lea    0xe43(%rip),%rdi
call   1040 <html@plt>
jmp    1222 <html_attr+0x102>
cmpl   $0x3c,-0x14(%rbp)
jne    11e2 <html_attr+0xc2>
lea    0xe2d(%rip),%rdi
call   1040 <html@plt>
jmp    121d <html_attr+0xfd>
cmpl   $0x27,-0x14(%rbp)
jne    11fd <html_attr+0xdd>
lea    0xe17(%rip),%rdi
call   1040 <html@plt>
jmp    1218 <html_attr+0xf8>
cmpl   $0x22,-0x14(%rbp)
jne    1213 <html_attr+0xf3>
lea    0xe03(%rip),%rdi
call   1040 <html@plt>
jmp    1218 <html_attr+0xf8>
jmp    121d <html_attr+0xfd>
jmp    1222 <html_attr+0x102>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <html_attr+0x14>
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     1256 <html_attr+0x136>
mov    -0x8(%rbp),%rdi
call   1040 <html@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_attr>:
test   %rdi,%rdi
je     11d1 <html_attr+0xb1>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movabs $0x5000008400000000,%r15
lea    0xf2f(%rip),%r14
lea    0xeb4(%rip),%rbx
mov    %edi,%r12d
mov    %rdi,%r13
jmp    116c <html_attr+0x4c>
lea    0xf2a(%rip),%rdi
call   1040 <html@plt>
lea    0x1(%r13),%rdi
add    $0x1,%r13
add    $0x1,%r12d
movzbl 0x0(%r13),%ebp
cmp    $0x3e,%rbp
ja     1164 <html_attr+0x44>
bt     %rbp,%r15
jae    11b3 <html_attr+0x93>
mov    %r12d,%esi
sub    %edi,%esi
call   1030 <html_raw@plt>
add    $0xde,%bpl
cmp    $0x1c,%bpl
ja     1160 <html_attr+0x40>
movzbl %bpl,%eax
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
mov    %r14,%rdi
jmp    *%rax
lea    0xed6(%rip),%rdi
jmp    115b <html_attr+0x3b>
lea    0xec8(%rip),%rdi
jmp    115b <html_attr+0x3b>
test   %rbp,%rbp
jne    1164 <html_attr+0x44>
cmp    %rdi,%r13
lea    0x8(%rsp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
je     11d1 <html_attr+0xb1>
jmp    1040 <html@plt>
ret

LLVM IR (-O0):
@.str = [5 x i8] c"&gt;\00"
@.str.1 = [5 x i8] c"&lt;\00"
@.str.2 = [7 x i8] c"&#x27;\00"
@.str.3 = [7 x i8] c"&quot;\00"
define void @html_attr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
br label %6
6: ; preds = %65, %1
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br label %14
14: ; preds = %9, %6
%15 = phi i1 [ false, %6 ], [ %13, %9 ]
br i1 %15, label %16, label %68
16: ; preds = %14
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 60
br i1 %21, label %31, label %22
22: ; preds = %16
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 62
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 39
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 34
br i1 %30, label %31, label %65
31: ; preds = %28, %25, %22, %16
%32 = load i8*, i8** %2
%33 = load i8*, i8** %3
%34 = load i8*, i8** %2
%35 = ptrtoint i8* %33 to i64
%36 = ptrtoint i8* %34 to i64
%37 = sub i64 %35, %36
%38 = trunc i64 %37 to i32
%39 = call i32 @html_raw(i8* %32, i32 %38)
%40 = load i32, i32* %4
%41 = icmp eq i32 %40, 62
br i1 %41, label %42, label %44
42: ; preds = %31
%43 = call i32 @html(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %62
44: ; preds = %31
%45 = load i32, i32* %4
%46 = icmp eq i32 %45, 60
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 @html(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %61
49: ; preds = %44
%50 = load i32, i32* %4
%51 = icmp eq i32 %50, 39
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 @html(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %60
54: ; preds = %49
%55 = load i32, i32* %4
%56 = icmp eq i32 %55, 34
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 @html(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %59
59: ; preds = %57, %54
br label %60
60: ; preds = %59, %52
br label %61
61: ; preds = %60, %47
br label %62
62: ; preds = %61, %42
%63 = load i8*, i8** %3
%64 = getelementptr inbounds i8, i8* %63, i64 1
store i8* %64, i8** %2
br label %65
65: ; preds = %62, %28
%66 = load i8*, i8** %3
%67 = getelementptr inbounds i8, i8* %66, i32 1
store i8* %67, i8** %3
br label %6
68: ; preds = %14
%69 = load i8*, i8** %3
%70 = load i8*, i8** %2
%71 = icmp ne i8* %69, %70
br i1 %71, label %72, label %75
72: ; preds = %68
%73 = load i8*, i8** %2
%74 = call i32 @html(i8* %73)
br label %75
75: ; preds = %72, %68
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"&gt;\00"
@.str.1 = [5 x i8] c"&lt;\00"
@.str.2 = [7 x i8] c"&#x27;\00"
@.str.3 = [7 x i8] c"&quot;\00"
define void @html_attr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %28, label %3
3: ; preds = %1, %21
%4 = phi i8* [ %22, %21 ], [ %0, %1 ]
%5 = phi i8* [ %23, %21 ], [ %0, %1 ]
%6 = load i8, i8* %5
switch i8 %6, label %21 [
i8 0, label %24
i8 62, label %7
i8 60, label %7
i8 39, label %7
i8 34, label %7
]
7: ; preds = %3, %3, %3, %3
%8 = ptrtoint i8* %5 to i64
%9 = ptrtoint i8* %4 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
%12 = tail call i32 @html_raw(i8* %4, i32 %11)
switch i8 %6, label %19 [
i8 62, label %16
i8 60, label %13
i8 39, label %14
i8 34, label %15
]
13: ; preds = %7
br label %16
14: ; preds = %7
br label %16
15: ; preds = %7
br label %16
16: ; preds = %7, %14, %15, %13
%17 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %13 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %15 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %14 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %7 ]
%18 = tail call i32 @html(i8* %17)
br label %19
19: ; preds = %16, %7
%20 = getelementptr inbounds i8, i8* %5, i64 1
br label %21
21: ; preds = %3, %19
%22 = phi i8* [ %20, %19 ], [ %4, %3 ]
%23 = getelementptr inbounds i8, i8* %5, i64 1
br label %3
24: ; preds = %3
%25 = icmp eq i8* %5, %4
br i1 %25, label %28, label %26
26: ; preds = %24
%27 = tail call i32 @html(i8* %4)
br label %28
28: ; preds = %1, %26, %24
ret void
}