#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, char *);
void KanjiIn(FILE *out, int outcode) {
  switch (outcode) {
  case 1:
    fprintf(out, "%c%s", 27, "$B");
    break;
  case 2:
    fprintf(out, "%c%s", 27, "$@");
    break;
  case 3:
    fprintf(out, "%c%s", 27, "K");
    break;
  }
}


x86 assembly (clang, -O0):
<KanjiIn>:
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    $0x1,%eax
je     1155 <KanjiIn+0x45>
jmp    1133 <KanjiIn+0x23>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1176 <KanjiIn+0x66>
jmp    1144 <KanjiIn+0x34>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     1197 <KanjiIn+0x87>
jmp    11b3 <KanjiIn+0xa3>
mov    -0x8(%rbp),%rdi
lea    0xea0(%rip),%rsi
mov    $0x1b,%edx
lea    0xe99(%rip),%rcx
call   1030 <fprintf@plt>
jmp    11b3 <KanjiIn+0xa3>
mov    -0x8(%rbp),%rdi
lea    0xe7f(%rip),%rsi
mov    $0x1b,%edx
lea    0xe7b(%rip),%rcx
call   1030 <fprintf@plt>
jmp    11b3 <KanjiIn+0xa3>
mov    -0x8(%rbp),%rdi
lea    0xe5e(%rip),%rsi
mov    $0x1b,%edx
lea    0xe5d(%rip),%rcx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KanjiIn>:
add    $0xffffffff,%esi
cmp    $0x2,%esi
ja     113a <KanjiIn+0x2a>
movslq %esi,%rax
lea    0xeee(%rip),%rdx
movslq (%rdx,%rax,4),%rcx
add    %rdx,%rcx
lea    0xed0(%rip),%rsi
mov    $0x1b,%edx
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%c%s\00"
@.str.1 = [3 x i8] c"$B\00"
@.str.2 = [3 x i8] c"$@\00"
@.str.3 = [2 x i8] c"K\00"
define void @KanjiIn(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 %15 [
i32 1, label %6
i32 2, label %9
i32 3, label %12
]
6: ; preds = %2
%7 = load i32*, i32** %3
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %15
9: ; preds = %2
%10 = load i32*, i32** %3
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %15
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %2, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%c%s\00"
@.str.1 = [3 x i8] c"$B\00"
@.str.2 = [3 x i8] c"$@\00"
@.str.3 = [2 x i8] c"K\00"
@reltable.KanjiIn = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.KanjiIn to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.KanjiIn to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.3 to i64), i64 ptrtoint ([3 x i32]* @reltable.KanjiIn to i64)) to i32)]
define void @KanjiIn(i32* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp ult i32 %3, 3
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.KanjiIn to i8*), i64 %7)
%9 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 27, i8* %8)
br label %10
10: ; preds = %2, %5
ret void
}