#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 fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ iscntrl(int);
int putchar(char);
int /*<<< orphan*/ stdout;
int h_putc(int c) {
  int rc;
  switch (c) {
  case '<':
    rc = fputs("&lt;", stdout);
    break;
  case '>':
    rc = fputs("&gt;", stdout);
    break;
  case '&':
    rc = fputs("&amp;", stdout);
    break;
  case '"':
    rc = fputs("&quot;", stdout);
    break;
  default:
    if (!iscntrl(c) || c == '\t' || c == '\r' || c == '\n')
      rc = putchar(c);
    else
      rc = putchar('?');
  }
  return rc;
}


x86 assembly (clang, -O0):
<h_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffde,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x1c,%eax
ja     11d8 <h_putc+0xa8>
mov    -0x10(%rbp),%rax
lea    0xea5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e75(%rip),%rax
mov    (%rax),%esi
lea    0xf00(%rip),%rdi
call   1050 <fputs@plt>
mov    %eax,-0x8(%rbp)
jmp    122c <h_putc+0xfc>
mov    0x2e58(%rip),%rax
mov    (%rax),%esi
lea    0xee8(%rip),%rdi
call   1050 <fputs@plt>
mov    %eax,-0x8(%rbp)
jmp    122c <h_putc+0xfc>
mov    0x2e3b(%rip),%rax
mov    (%rax),%esi
lea    0xed0(%rip),%rdi
call   1050 <fputs@plt>
mov    %eax,-0x8(%rbp)
jmp    122c <h_putc+0xfc>
mov    0x2e1e(%rip),%rax
mov    (%rax),%esi
lea    0xeb9(%rip),%rdi
call   1050 <fputs@plt>
mov    %eax,-0x8(%rbp)
jmp    122c <h_putc+0xfc>
mov    -0x4(%rbp),%edi
call   1040 <iscntrl@plt>
cmp    $0x0,%eax
je     1207 <h_putc+0xd7>
cmpl   $0x9,-0x4(%rbp)
je     1207 <h_putc+0xd7>
cmpl   $0xd,-0x4(%rbp)
je     1207 <h_putc+0xd7>
cmpl   $0xa,-0x4(%rbp)
jne    121a <h_putc+0xea>
mov    -0x4(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %eax,-0x8(%rbp)
jmp    1227 <h_putc+0xf7>
mov    $0x3f,%edi
call   1030 <putchar@plt>
mov    %eax,-0x8(%rbp)
jmp    122c <h_putc+0xfc>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h_putc>:
push   %rbx
mov    %edi,%ebx
lea    -0x22(%rbx),%eax
cmp    $0x1c,%eax
ja     1161 <h_putc+0x31>
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
lea    0xf29(%rip),%rdi
pop    %rbx
jmp    1050 <fputs@plt>
mov    %ebx,%edi
call   1040 <iscntrl@plt>
test   %eax,%eax
je     117b <h_putc+0x4b>
cmp    $0xd,%ebx
ja     11c6 <h_putc+0x96>
mov    $0x2600,%eax
bt     %ebx,%eax
jae    11c6 <h_putc+0x96>
movsbl %bl,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%esi
lea    0xeea(%rip),%rdi
pop    %rbx
jmp    1050 <fputs@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%esi
lea    0xeca(%rip),%rdi
pop    %rbx
jmp    1050 <fputs@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%esi
lea    0xeb9(%rip),%rdi
pop    %rbx
jmp    1050 <fputs@plt>
mov    $0x3f,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"&lt;\00"
@stdout = global i32 0
@.str.1 = [5 x i8] c"&gt;\00"
@.str.2 = [6 x i8] c"&amp;\00"
@.str.3 = [7 x i8] c"&quot;\00"
define i32 @h_putc(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %17 [
i32 60, label %5
i32 62, label %8
i32 38, label %11
i32 34, label %14
]
5: ; preds = %1
%6 = load i32, i32* @stdout
%7 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 %7, i32* %3
br label %37
8: ; preds = %1
%9 = load i32, i32* @stdout
%10 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %9)
store i32 %10, i32* %3
br label %37
11: ; preds = %1
%12 = load i32, i32* @stdout
%13 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %12)
store i32 %13, i32* %3
br label %37
14: ; preds = %1
%15 = load i32, i32* @stdout
%16 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %15)
store i32 %16, i32* %3
br label %37
17: ; preds = %1
%18 = load i32, i32* %2
%19 = call i32 @iscntrl(i32 %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 9
br i1 %23, label %30, label %24
24: ; preds = %21
%25 = load i32, i32* %2
%26 = icmp eq i32 %25, 13
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp eq i32 %28, 10
br i1 %29, label %30, label %34
30: ; preds = %27, %24, %21, %17
%31 = load i32, i32* %2
%32 = trunc i32 %31 to i8
%33 = call i32 @putchar(i8 signext %32)
store i32 %33, i32* %3
br label %36
34: ; preds = %27
%35 = call i32 @putchar(i8 signext 63)
store i32 %35, i32* %3
br label %36
36: ; preds = %34, %30
br label %37
37: ; preds = %36, %14, %11, %8, %5
%38 = load i32, i32* %3
ret i32 %38
}

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