#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
void RB_XMLDB_Generate_Char(FILE *dest_doc, int c) {
  switch (c) {
  case '\n':
    assert(0);
    break;
  case '\t':
    assert(0);
    break;
  case '<':
    fprintf(dest_doc, "&lt;");
    break;
  case '>':
    fprintf(dest_doc, "&gt;");
    break;
  case '&':
    fprintf(dest_doc, "&amp;");
    break;
  default:
    fputc(c, dest_doc);
  }
}


x86 assembly (clang, -O0):
<RB_XMLDB_Generate_Char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x9,%eax
je     11a3 <RB_XMLDB_Generate_Char+0x73>
jmp    1153 <RB_XMLDB_Generate_Char+0x23>
mov    -0x10(%rbp),%eax
sub    $0xa,%eax
je     1197 <RB_XMLDB_Generate_Char+0x67>
jmp    1164 <RB_XMLDB_Generate_Char+0x34>
mov    -0x10(%rbp),%eax
sub    $0x26,%eax
je     11d9 <RB_XMLDB_Generate_Char+0xa9>
jmp    1175 <RB_XMLDB_Generate_Char+0x45>
mov    -0x10(%rbp),%eax
sub    $0x3c,%eax
je     11af <RB_XMLDB_Generate_Char+0x7f>
jmp    1186 <RB_XMLDB_Generate_Char+0x56>
mov    -0x10(%rbp),%eax
sub    $0x3e,%eax
je     11c4 <RB_XMLDB_Generate_Char+0x94>
jmp    11ee <RB_XMLDB_Generate_Char+0xbe>
xor    %edi,%edi
call   1040 <assert@plt>
jmp    11fa <RB_XMLDB_Generate_Char+0xca>
xor    %edi,%edi
call   1040 <assert@plt>
jmp    11fa <RB_XMLDB_Generate_Char+0xca>
mov    -0x8(%rbp),%rdi
lea    0xe46(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11fa <RB_XMLDB_Generate_Char+0xca>
mov    -0x8(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11fa <RB_XMLDB_Generate_Char+0xca>
mov    -0x8(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11fa <RB_XMLDB_Generate_Char+0xca>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RB_XMLDB_Generate_Char>:
mov    %rdi,%rcx
cmp    $0x25,%esi
jle    1150 <RB_XMLDB_Generate_Char+0x20>
cmp    $0x26,%esi
je     1161 <RB_XMLDB_Generate_Char+0x31>
cmp    $0x3c,%esi
je     1177 <RB_XMLDB_Generate_Char+0x47>
cmp    $0x3e,%esi
jne    118d <RB_XMLDB_Generate_Char+0x5d>
lea    0xeb7(%rip),%rdi
jmp    117e <RB_XMLDB_Generate_Char+0x4e>
cmp    $0x9,%esi
je     115a <RB_XMLDB_Generate_Char+0x2a>
cmp    $0xa,%esi
jne    118d <RB_XMLDB_Generate_Char+0x5d>
xor    %edi,%edi
jmp    1040 <assert@plt>
lea    0xea2(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
jmp    1050 <fwrite@plt>
lea    0xe82(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
jmp    1050 <fwrite@plt>
mov    %esi,%edi
mov    %rcx,%rsi
jmp    1030 <fputc@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"
define void @RB_XMLDB_Generate_Char(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %19 [
i32 10, label %6
i32 9, label %8
i32 60, label %10
i32 62, label %13
i32 38, label %16
]
6: ; preds = %2
%7 = call i32 @assert(i32 0)
br label %23
8: ; preds = %2
%9 = call i32 @assert(i32 0)
br label %23
10: ; preds = %2
%11 = load i32*, i32** %3
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %23
13: ; preds = %2
%14 = load i32*, i32** %3
%15 = call i32 @fprintf(i32* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %23
16: ; preds = %2
%17 = load i32*, i32** %3
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %23
19: ; preds = %2
%20 = load i32, i32* %4
%21 = load i32*, i32** %3
%22 = call i32 @fputc(i32 %20, i32* %21)
br label %23
23: ; preds = %19, %16, %13, %10, %8, %6
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"
define void @RB_XMLDB_Generate_Char(i32* nocapture %0, i32 %1) {
switch i32 %1, label %13 [
i32 10, label %3
i32 9, label %5
i32 60, label %7
i32 62, label %9
i32 38, label %11
]
3: ; preds = %2
%4 = tail call i32 @assert(i32 0)
br label %15
5: ; preds = %2
%6 = tail call i32 @assert(i32 0)
br label %15
7: ; preds = %2
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 4, i64 1, i32* %0)
br label %15
9: ; preds = %2
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 4, i64 1, i32* %0)
br label %15
11: ; preds = %2
%12 = 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 %15
13: ; preds = %2
%14 = tail call i32 @fputc(i32 %1, i32* %0)
br label %15
15: ; preds = %13, %11, %9, %7, %5, %3
ret void
}