#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void om_html_entities_abbr(FILE *fp, char *s, int maxlen) {
  while (*s) {
    if (maxlen-- == 0) {
      fprintf(fp, "...");
      break;
    }
    switch (*s) {
    case '\'':
      fprintf(fp, "&#39;");
      break;
    case '"':
      fprintf(fp, "&#34;");
      break;
    case '&':
      fprintf(fp, "&amp;");
      break;
    case '<':
      fprintf(fp, "&lt;");
      break;
    case '>':
      fprintf(fp, "&gt;");
      break;
    default:
      fputc(*s, fp);
      break;
    }
    s++;
  }
}


x86 assembly (clang, -O0):
<om_html_entities_abbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1222 <om_html_entities_abbr+0x102>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jne    1169 <om_html_entities_abbr+0x49>
mov    -0x8(%rbp),%rdi
lea    0xf15(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1222 <om_html_entities_abbr+0x102>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffde,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x1c,%eax
ja     11ff <om_html_entities_abbr+0xdf>
mov    -0x20(%rbp),%rax
lea    0xe73(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0xed7(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1211 <om_html_entities_abbr+0xf1>
mov    -0x8(%rbp),%rdi
lea    0xec8(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1211 <om_html_entities_abbr+0xf1>
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1211 <om_html_entities_abbr+0xf1>
mov    -0x8(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1211 <om_html_entities_abbr+0xf1>
mov    -0x8(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1211 <om_html_entities_abbr+0xf1>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1133 <om_html_entities_abbr+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<om_html_entities_abbr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    (%rsi),%al
test   %al,%al
je     11f5 <om_html_entities_abbr+0xd5>
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %edx,%r12d
xor    %r13d,%r13d
lea    0xeb8(%rip),%rbp
lea    0xf40(%rip),%r15
jmp    1186 <om_html_entities_abbr+0x66>
mov    $0x5,%esi
mov    $0x1,%edx
lea    0xf16(%rip),%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rcx
call   1040 <fwrite@plt>
movzbl 0x1(%rbx,%r13,1),%eax
add    $0x1,%r13
test   %al,%al
je     11f5 <om_html_entities_abbr+0xd5>
cmp    %r13d,%r12d
je     1204 <om_html_entities_abbr+0xe4>
movsbl %al,%edi
lea    -0x22(%rdi),%eax
cmp    $0x1c,%eax
ja     11b3 <om_html_entities_abbr+0x93>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
mov    $0x5,%esi
mov    $0x1,%edx
lea    0xecd(%rip),%rdi
jmp    1170 <om_html_entities_abbr+0x50>
mov    %r14,%rsi
call   1030 <fputc@plt>
jmp    1178 <om_html_entities_abbr+0x58>
mov    $0x5,%esi
mov    $0x1,%edx
lea    0xeb6(%rip),%rdi
jmp    1170 <om_html_entities_abbr+0x50>
mov    $0x4,%esi
mov    $0x1,%edx
lea    0xea9(%rip),%rdi
jmp    1170 <om_html_entities_abbr+0x50>
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r15,%rdi
jmp    1170 <om_html_entities_abbr+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe69(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fwrite@plt>

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

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