#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*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char const);
int /*<<< orphan*/ stdout;
void hprint(const char *begin, const char *end) {
  const char *p;
  for (p = begin; p != end; p++) {
    if (*p == '&')
      fputs("&amp;", stdout);
    else if (*p == '"')
      fputs("&quot;", stdout);
    else if (*p == '>')
      fputs("&gt;", stdout);
    else if (*p == '<')
      fputs("&lt;", stdout);
    else
      putchar(*p);
  }
}


x86 assembly (clang, -O0):
<hprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     121f <hprint+0xff>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x26,%eax
jne    1170 <hprint+0x50>
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
lea    0xe9a(%rip),%rdi
call   1040 <fputs@plt>
jmp    1209 <hprint+0xe9>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    119a <hprint+0x7a>
mov    0x2e59(%rip),%rax
mov    (%rax),%esi
lea    0xe76(%rip),%rdi
call   1040 <fputs@plt>
jmp    1204 <hprint+0xe4>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3e,%eax
jne    11c4 <hprint+0xa4>
mov    0x2e2f(%rip),%rax
mov    (%rax),%esi
lea    0xe53(%rip),%rdi
call   1040 <fputs@plt>
jmp    11ff <hprint+0xdf>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3c,%eax
jne    11ee <hprint+0xce>
mov    0x2e05(%rip),%rax
mov    (%rax),%esi
lea    0xe2e(%rip),%rdi
call   1040 <fputs@plt>
jmp    11fa <hprint+0xda>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    11ff <hprint+0xdf>
jmp    1204 <hprint+0xe4>
jmp    1209 <hprint+0xe9>
jmp    120e <hprint+0xee>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1138 <hprint+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hprint>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    %rsi,%rdi
je     11ee <hprint+0xce>
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebf(%rip),%r15
mov    0x2e98(%rip),%r12
lea    0xf37(%rip),%r13
lea    0xf2b(%rip),%rbp
jmp    1179 <hprint+0x59>
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %r14,%rbx
je     11ee <hprint+0xce>
movzbl (%rbx),%eax
lea    -0x22(%rax),%ecx
cmp    $0x1c,%cl
ja     1160 <hprint+0x40>
movzbl %cl,%ecx
movslq (%r15,%rcx,4),%rcx
add    %r15,%rcx
jmp    *%rcx
mov    (%r12),%esi
lea    0xedf(%rip),%rdi
call   1040 <fputs@plt>
jmp    1170 <hprint+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12),%esi
lea    0xeb9(%rip),%rdi
call   1040 <fputs@plt>
jmp    1170 <hprint+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12),%esi
mov    %r13,%rdi
call   1040 <fputs@plt>
jmp    1170 <hprint+0x50>
xchg   %ax,%ax
mov    (%r12),%esi
mov    %rbp,%rdi
call   1040 <fputs@plt>
jmp    1170 <hprint+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"&amp;\00"
@stdout = global i32 0
@.str.1 = [7 x i8] c"&quot;\00"
@.str.2 = [5 x i8] c"&gt;\00"
@.str.3 = [5 x i8] c"&lt;\00"
define void @hprint(i8* %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
br i1 %3, label %24, label %4
4: ; preds = %2, %21
%5 = phi i8* [ %22, %21 ], [ %0, %2 ]
%6 = load i8, i8* %5
switch i8 %6, label %19 [
i8 38, label %7
i8 34, label %10
i8 62, label %13
i8 60, label %16
]
7: ; preds = %4
%8 = load i32, i32* @stdout
%9 = tail call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %21
10: ; preds = %4
%11 = load i32, i32* @stdout
%12 = tail call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %21
13: ; preds = %4
%14 = load i32, i32* @stdout
%15 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %14)
br label %21
16: ; preds = %4
%17 = load i32, i32* @stdout
%18 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %21
19: ; preds = %4
%20 = tail call i32 @putchar(i8 signext %6)
br label %21
21: ; preds = %7, %13, %19, %16, %10
%22 = getelementptr inbounds i8, i8* %5, i64 1
%23 = icmp eq i8* %22, %1
br i1 %23, label %24, label %4
24: ; preds = %21, %2
ret void
}