#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*/ fputc(char const, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
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
      fputc(*p, stdout);
  }
}


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     122a <hprint+0x10a>
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   1030 <fputs@plt>
jmp    1214 <hprint+0xf4>
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   1030 <fputs@plt>
jmp    120f <hprint+0xef>
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   1030 <fputs@plt>
jmp    120a <hprint+0xea>
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   1030 <fputs@plt>
jmp    1205 <hprint+0xe5>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    0x2de5(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1040 <fputc@plt>
jmp    120a <hprint+0xea>
jmp    120f <hprint+0xef>
jmp    1214 <hprint+0xf4>
jmp    1219 <hprint+0xf9>
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     11ed <hprint+0xcd>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e9f(%rip),%r15
lea    0xeb8(%rip),%r12
lea    0xf37(%rip),%r13
lea    0xf2b(%rip),%rbp
jmp    1179 <hprint+0x59>
nopl   0x0(%rax,%rax,1)
mov    (%r15),%esi
movsbl %al,%edi
call   1040 <fputc@plt>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %r14,%rbx
je     11ed <hprint+0xcd>
movzbl (%rbx),%eax
lea    -0x22(%rax),%ecx
cmp    $0x1c,%cl
ja     1160 <hprint+0x40>
movzbl %cl,%ecx
movslq (%r12,%rcx,4),%rcx
add    %r12,%rcx
jmp    *%rcx
mov    (%r15),%esi
lea    0xee0(%rip),%rdi
call   1030 <fputs@plt>
jmp    1170 <hprint+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15),%esi
lea    0xeba(%rip),%rdi
call   1030 <fputs@plt>
jmp    1170 <hprint+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15),%esi
mov    %r13,%rdi
call   1030 <fputs@plt>
jmp    1170 <hprint+0x50>
nopl   (%rax)
mov    (%r15),%esi
mov    %rbp,%rdi
call   1030 <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 = %52, %2
%8 = load i8*, i8** %5
%9 = load i8*, i8** %4
%10 = icmp ne i8* %8, %9
br i1 %10, label %11, label %55
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 %51
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 %50
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 %49
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 %48
43: ; preds = %35
%44 = load i8*, i8** %5
%45 = load i8, i8* %44
%46 = load i32, i32* @stdout
%47 = call i32 @fputc(i8 signext %45, i32 %46)
br label %48
48: ; preds = %43, %40
br label %49
49: ; preds = %48, %32
br label %50
50: ; preds = %49, %24
br label %51
51: ; preds = %50, %16
br label %52
52: ; preds = %51
%53 = load i8*, i8** %5
%54 = getelementptr inbounds i8, i8* %53, i32 1
store i8* %54, i8** %5
br label %7
55: ; 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 %25, label %4
4: ; preds = %2, %22
%5 = phi i8* [ %23, %22 ], [ %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 %22
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 %22
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 %22
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 %22
19: ; preds = %4
%20 = load i32, i32* @stdout
%21 = tail call i32 @fputc(i8 signext %6, i32 %20)
br label %22
22: ; preds = %7, %13, %19, %16, %10
%23 = getelementptr inbounds i8, i8* %5, i64 1
%24 = icmp eq i8* %23, %1
br i1 %24, label %25, label %4
25: ; preds = %22, %2
ret void
}