#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*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
void print_html(int html, char *s) {
  if (html) {
    while (*s) {
      switch (*s) {
      case '<':
        printf("&lt;");
        break;
      case '>':
        printf("&gt;");
        break;
      case '&':
        printf("&amp;");
        break;
      case '{':
        if (s[1] == '{')
          printf("{");
        if (s[1])
          s++;
        break;
      default:
        putchar(*s);
        break;
      }
      s++;
    }
  } else
    printf("%s", s);
}


x86 assembly (clang, -O0):
<print_html>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     122f <print_html+0x10f>
jmp    113e <print_html+0x1e>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     122a <print_html+0x10a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x26,%eax
je     11bc <print_html+0x9c>
jmp    1163 <print_html+0x43>
mov    -0x14(%rbp),%eax
sub    $0x3c,%eax
je     1196 <print_html+0x76>
jmp    1174 <print_html+0x54>
mov    -0x14(%rbp),%eax
sub    $0x3e,%eax
je     11a9 <print_html+0x89>
jmp    1185 <print_html+0x65>
mov    -0x14(%rbp),%eax
sub    $0x7b,%eax
je     11cf <print_html+0xaf>
jmp    120d <print_html+0xed>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1219 <print_html+0xf9>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1219 <print_html+0xf9>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1219 <print_html+0xf9>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x7b,%eax
jne    11ee <print_html+0xce>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,0x1(%rax)
je     1208 <print_html+0xe8>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1219 <print_html+0xf9>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113e <print_html+0x1e>
jmp    1241 <print_html+0x121>
mov    -0x10(%rbp),%rsi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_html>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%rbx
test   %edi,%edi
je     11e1 <print_html+0xc1>
mov    (%rbx),%al
test   %al,%al
je     11d7 <print_html+0xb7>
lea    0xec5(%rip),%r14
lea    0xeb4(%rip),%r15
lea    0xeb2(%rip),%r12
jmp    1176 <print_html+0x56>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11d7 <print_html+0xb7>
movsbl %al,%edi
cmp    $0x3d,%edi
jg     1190 <print_html+0x70>
cmp    $0x26,%edi
je     1160 <print_html+0x40>
cmp    $0x3c,%edi
jne    11d0 <print_html+0xb0>
mov    %r15,%rdi
jmp    1163 <print_html+0x43>
nopl   (%rax)
cmp    $0x3e,%edi
je     11c0 <print_html+0xa0>
cmp    $0x7b,%edi
jne    11d0 <print_html+0xb0>
lea    0x1(%rbx),%r13
movzbl 0x1(%rbx),%eax
cmp    $0x7b,%al
jne    11b5 <print_html+0x95>
mov    $0x7b,%edi
call   1030 <putchar@plt>
movzbl 0x0(%r13),%eax
test   %al,%al
je     116a <print_html+0x4a>
mov    %r13,%rbx
jmp    116a <print_html+0x4a>
xchg   %ax,%ax
mov    %r12,%rdi
jmp    1163 <print_html+0x43>
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <putchar@plt>
jmp    116a <print_html+0x4a>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe28(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"&lt;\00"
@.str.1 = [5 x i8] c"&gt;\00"
@.str.2 = [6 x i8] c"&amp;\00"
@.str.3 = [2 x i8] c"{\00"
@.str.4 = [3 x i8] c"%s\00"
define void @print_html(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %47
7: ; preds = %2
br label %8
8: ; preds = %43, %7
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %46
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
switch i32 %15, label %39 [
i32 60, label %16
i32 62, label %18
i32 38, label %20
i32 123, label %22
]
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %43
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %43
20: ; preds = %12
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %43
22: ; preds = %12
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 123
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28, %22
%31 = load i8*, i8** %4
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i8, i8* %32
%34 = icmp ne i8 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %30
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %4
br label %38
38: ; preds = %35, %30
br label %43
39: ; preds = %12
%40 = load i8*, i8** %4
%41 = load i8, i8* %40
%42 = call i32 @putchar(i8 signext %41)
br label %43
43: ; preds = %39, %38, %20, %18, %16
%44 = load i8*, i8** %4
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %4
br label %8
46: ; preds = %8
br label %50
47: ; preds = %2
%48 = load i8*, i8** %4
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %47, %46
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"&lt;\00"
@.str.1 = [5 x i8] c"&gt;\00"
@.str.2 = [6 x i8] c"&amp;\00"
@.str.4 = [3 x i8] c"%s\00"
define void @print_html(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %35, label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 0
br i1 %6, label %37, label %7
7: ; preds = %4, %30
%8 = phi i8 [ %33, %30 ], [ %5, %4 ]
%9 = phi i8* [ %32, %30 ], [ %1, %4 ]
%10 = sext i8 %8 to i32
switch i32 %10, label %28 [
i32 60, label %11
i32 62, label %13
i32 38, label %15
i32 123, label %17
]
11: ; preds = %7
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %30
13: ; preds = %7
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %30
15: ; preds = %7
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %30
17: ; preds = %7
%18 = getelementptr inbounds i8, i8* %9, i64 1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 123
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 123)
%23 = load i8, i8* %18
br label %24
24: ; preds = %21, %17
%25 = phi i8 [ %23, %21 ], [ %19, %17 ]
%26 = icmp eq i8 %25, 0
%27 = select i1 %26, i8* %9, i8* %18
br label %30
28: ; preds = %7
%29 = tail call i32 @putchar(i8 signext %8)
br label %30
30: ; preds = %24, %28, %15, %13, %11
%31 = phi i8* [ %9, %28 ], [ %9, %15 ], [ %9, %13 ], [ %9, %11 ], [ %27, %24 ]
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
br i1 %34, label %37, label %7
35: ; preds = %2
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %1)
br label %37
37: ; preds = %30, %4, %35
ret void
}