#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 fputc(int, int /*<<< orphan*/ *);
int fputs(char *, int /*<<< orphan*/ *);
int sgml_fputc(int c, FILE *out) {
  switch (c) {
  case '<':
    return fputs("&lt;", out);
  case '>':
    return fputs("&gt;", out);
  case '&':
    return fputs("&amp;", out);
  default:
    return fputc(c, out);
  }
}


x86 assembly (clang, -O0):
<sgml_fputc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x26,%eax
je     1195 <sgml_fputc+0x75>
jmp    1143 <sgml_fputc+0x23>
mov    -0x14(%rbp),%eax
sub    $0x3c,%eax
je     1165 <sgml_fputc+0x45>
jmp    1154 <sgml_fputc+0x34>
mov    -0x14(%rbp),%eax
sub    $0x3e,%eax
je     117d <sgml_fputc+0x5d>
jmp    11ad <sgml_fputc+0x8d>
mov    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1030 <fputs@plt>
mov    %eax,-0x4(%rbp)
jmp    11bc <sgml_fputc+0x9c>
mov    -0x10(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1030 <fputs@plt>
mov    %eax,-0x4(%rbp)
jmp    11bc <sgml_fputc+0x9c>
mov    -0x10(%rbp),%rsi
lea    0xe6a(%rip),%rdi
call   1030 <fputs@plt>
mov    %eax,-0x4(%rbp)
jmp    11bc <sgml_fputc+0x9c>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <fputc@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgml_fputc>:
cmp    $0x26,%edi
je     113b <sgml_fputc+0x1b>
cmp    $0x3e,%edi
je     1147 <sgml_fputc+0x27>
cmp    $0x3c,%edi
jne    1153 <sgml_fputc+0x33>
lea    0xeca(%rip),%rdi
jmp    1030 <fputs@plt>
lea    0xec8(%rip),%rdi
jmp    1030 <fputs@plt>
lea    0xeb7(%rip),%rdi
jmp    1030 <fputs@plt>
jmp    1040 <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 i32 @sgml_fputc(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
%6 = load i32, i32* %4
switch i32 %6, label %16 [
i32 60, label %7
i32 62, label %10
i32 38, label %13
]
7: ; preds = %2
%8 = load i32*, i32** %5
%9 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %8)
store i32 %9, i32* %3
br label %20
10: ; preds = %2
%11 = load i32*, i32** %5
%12 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %11)
store i32 %12, i32* %3
br label %20
13: ; preds = %2
%14 = load i32*, i32** %5
%15 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %14)
store i32 %15, i32* %3
br label %20
16: ; preds = %2
%17 = load i32, i32* %4
%18 = load i32*, i32** %5
%19 = call i32 @fputc(i32 %17, i32* %18)
store i32 %19, i32* %3
br label %20
20: ; preds = %16, %13, %10, %7
%21 = load i32, i32* %3
ret i32 %21
}

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 i32 @sgml_fputc(i32 %0, i32* nocapture %1) {
switch i32 %0, label %9 [
i32 60, label %3
i32 62, label %5
i32 38, label %7
]
3: ; preds = %2
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %11
5: ; preds = %2
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %11
7: ; preds = %2
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %1)
br label %11
9: ; preds = %2
%10 = tail call i32 @fputc(i32 %0, i32* %1)
br label %11
11: ; preds = %9, %7, %5, %3
%12 = phi i32 [ %10, %9 ], [ %8, %7 ], [ %6, %5 ], [ %4, %3 ]
ret i32 %12
}