#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 == '\"' || 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;");
      else if (c == '&')
        html("&amp;");
      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    1269 <html_attr+0x149>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x3c,-0x14(%rbp)
je     11a0 <html_attr+0x80>
cmpl   $0x3e,-0x14(%rbp)
je     11a0 <html_attr+0x80>
cmpl   $0x27,-0x14(%rbp)
je     11a0 <html_attr+0x80>
cmpl   $0x22,-0x14(%rbp)
je     11a0 <html_attr+0x80>
cmpl   $0x26,-0x14(%rbp)
jne    1258 <html_attr+0x138>
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    11d1 <html_attr+0xb1>
lea    0xe39(%rip),%rdi
call   1040 <html@plt>
jmp    124c <html_attr+0x12c>
cmpl   $0x3c,-0x14(%rbp)
jne    11ec <html_attr+0xcc>
lea    0xe23(%rip),%rdi
call   1040 <html@plt>
jmp    1247 <html_attr+0x127>
cmpl   $0x27,-0x14(%rbp)
jne    1207 <html_attr+0xe7>
lea    0xe0d(%rip),%rdi
call   1040 <html@plt>
jmp    1242 <html_attr+0x122>
cmpl   $0x22,-0x14(%rbp)
jne    1222 <html_attr+0x102>
lea    0xdf9(%rip),%rdi
call   1040 <html@plt>
jmp    123d <html_attr+0x11d>
cmpl   $0x26,-0x14(%rbp)
jne    1238 <html_attr+0x118>
lea    0xde5(%rip),%rdi
call   1040 <html@plt>
jmp    123d <html_attr+0x11d>
jmp    1242 <html_attr+0x122>
jmp    1247 <html_attr+0x127>
jmp    124c <html_attr+0x12c>
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     1280 <html_attr+0x160>
mov    -0x8(%rbp),%rdi
call   1040 <html@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_attr>:
test   %rdi,%rdi
je     11df <html_attr+0xbf>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movabs $0x500000c400000000,%r15
lea    0xf2f(%rip),%r14
lea    0xeb4(%rip),%rbx
mov    %edi,%r13d
mov    %rdi,%rbp
jmp    1171 <html_attr+0x51>
lea    0xf31(%rip),%rdi
nopl   0x0(%rax,%rax,1)
call   1040 <html@plt>
lea    0x1(%rbp),%rdi
add    $0x1,%rbp
add    $0x1,%r13d
movzbl 0x0(%rbp),%r12d
cmp    $0x3e,%r12
ja     1169 <html_attr+0x49>
bt     %r12,%r15
jae    11c1 <html_attr+0xa1>
mov    %r13d,%esi
sub    %edi,%esi
call   1030 <html_raw@plt>
add    $0xde,%r12b
cmp    $0x1c,%r12b
ja     1165 <html_attr+0x45>
movzbl %r12b,%eax
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
mov    %r14,%rdi
jmp    *%rax
lea    0xed8(%rip),%rdi
jmp    1160 <html_attr+0x40>
lea    0xec8(%rip),%rdi
jmp    1160 <html_attr+0x40>
lea    0xeba(%rip),%rdi
jmp    1160 <html_attr+0x40>
test   %r12,%r12
jne    1169 <html_attr+0x49>
cmp    %rdi,%rbp
lea    0x8(%rsp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
je     11df <html_attr+0xbf>
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"
@.str.4 = [6 x i8] c"&amp;\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 = %74, %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 %77
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 %34, label %22
22: ; preds = %16
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 62
br i1 %24, label %34, label %25
25: ; preds = %22
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 39
br i1 %27, label %34, label %28
28: ; preds = %25
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 34
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %4
%33 = icmp eq i32 %32, 38
br i1 %33, label %34, label %74
34: ; preds = %31, %28, %25, %22, %16
%35 = load i8*, i8** %2
%36 = load i8*, i8** %3
%37 = load i8*, i8** %2
%38 = ptrtoint i8* %36 to i64
%39 = ptrtoint i8* %37 to i64
%40 = sub i64 %38, %39
%41 = trunc i64 %40 to i32
%42 = call i32 @html_raw(i8* %35, i32 %41)
%43 = load i32, i32* %4
%44 = icmp eq i32 %43, 62
br i1 %44, label %45, label %47
45: ; preds = %34
%46 = call i32 @html(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %71
47: ; preds = %34
%48 = load i32, i32* %4
%49 = icmp eq i32 %48, 60
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 @html(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %70
52: ; preds = %47
%53 = load i32, i32* %4
%54 = icmp eq i32 %53, 39
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 @html(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %69
57: ; preds = %52
%58 = load i32, i32* %4
%59 = icmp eq i32 %58, 34
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = call i32 @html(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %68
62: ; preds = %57
%63 = load i32, i32* %4
%64 = icmp eq i32 %63, 38
br i1 %64, label %65, label %67
65: ; preds = %62
%66 = call i32 @html(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %67
67: ; preds = %65, %62
br label %68
68: ; preds = %67, %60
br label %69
69: ; preds = %68, %55
br label %70
70: ; preds = %69, %50
br label %71
71: ; preds = %70, %45
%72 = load i8*, i8** %3
%73 = getelementptr inbounds i8, i8* %72, i64 1
store i8* %73, i8** %2
br label %74
74: ; preds = %71, %31
%75 = load i8*, i8** %3
%76 = getelementptr inbounds i8, i8* %75, i32 1
store i8* %76, i8** %3
br label %6
77: ; preds = %14
%78 = load i8*, i8** %3
%79 = load i8*, i8** %2
%80 = icmp ne i8* %78, %79
br i1 %80, label %81, label %84
81: ; preds = %77
%82 = load i8*, i8** %2
%83 = call i32 @html(i8* %82)
br label %84
84: ; preds = %81, %77
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"
@.str.4 = [6 x i8] c"&amp;\00"
define void @html_attr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %29, label %3
3: ; preds = %1, %22
%4 = phi i8* [ %23, %22 ], [ %0, %1 ]
%5 = phi i8* [ %24, %22 ], [ %0, %1 ]
%6 = load i8, i8* %5
switch i8 %6, label %22 [
i8 0, label %25
i8 62, label %7
i8 60, label %7
i8 39, label %7
i8 38, label %7
i8 34, label %7
]
7: ; preds = %3, %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 %20 [
i8 62, label %17
i8 60, label %13
i8 39, label %14
i8 34, label %15
i8 38, label %16
]
13: ; preds = %7
br label %17
14: ; preds = %7
br label %17
15: ; preds = %7
br label %17
16: ; preds = %7
br label %17
17: ; preds = %7, %14, %16, %15, %13
%18 = 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 ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %16 ], [ 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 ]
%19 = tail call i32 @html(i8* %18)
br label %20
20: ; preds = %17, %7
%21 = getelementptr inbounds i8, i8* %5, i64 1
br label %22
22: ; preds = %3, %20
%23 = phi i8* [ %21, %20 ], [ %4, %3 ]
%24 = getelementptr inbounds i8, i8* %5, i64 1
br label %3
25: ; preds = %3
%26 = icmp eq i8* %5, %4
br i1 %26, label %29, label %27
27: ; preds = %25
%28 = tail call i32 @html(i8* %4)
br label %29
29: ; preds = %1, %27, %25
ret void
}