#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 /*<<< orphan*/ api_end();
int api_getlang();
int /*<<< orphan*/ api_putstr0(char *);
void HariMain(void) {
  int langmode = api_getlang();
  static char s1[23] = {0x93, 0xfa, 0x96, 0x7b, 0x8c, 0xea, 0x83, 0x56,
                        0x83, 0x74, 0x83, 0x67, 0x4a, 0x49, 0x53, 0x83,
                        0x82, 0x81, 0x5b, 0x83, 0x68, 0x0a, 0x00};
  static char s2[17] = {0xc6, 0xfc, 0xcb, 0xdc, 0xb8, 0xec, 0x45, 0x55, 0x43,
                        0xa5, 0xe2, 0xa1, 0xbc, 0xa5, 0xc9, 0x0a, 0x00};
  if (langmode == 0) {
    api_putstr0("English ASCII mode\n");
  }
  if (langmode == 1) {
    api_putstr0(s1);
  }
  if (langmode == 2) {
    api_putstr0(s2);
  }
  api_end();
}


x86 assembly (clang, -O0):
<HariMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <api_getlang@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1158 <HariMain+0x28>
lea    0xead(%rip),%rdi
call   1050 <api_putstr0@plt>
cmpl   $0x1,-0x4(%rbp)
jne    116e <HariMain+0x3e>
lea    0x2ed7(%rip),%rdi
call   1050 <api_putstr0@plt>
cmpl   $0x2,-0x4(%rbp)
jne    1184 <HariMain+0x54>
lea    0x2ee1(%rip),%rdi
call   1050 <api_putstr0@plt>
mov    $0x0,%al
call   1030 <api_end@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HariMain>:
push   %rax
xor    %eax,%eax
call   1040 <api_getlang@plt>
cmp    $0x2,%eax
ja     114f <HariMain+0x1f>
cltq
lea    0x2cc2(%rip),%rcx
mov    (%rcx,%rax,8),%rdi
call   1050 <api_putstr0@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <api_end@plt>

LLVM IR (-O0):
@HariMain.s1 = internal global [23 x i8] c"\93\FA\96{\8C\EA\83V\83t\83gJIS\83\82\81[\83h\0A\00"
@HariMain.s2 = internal global [17 x i8] c"\C6\FC\CB\DC\B8\ECEUC\A5\E2\A1\BC\A5\C9\0A\00"
@.str = [20 x i8] c"English ASCII mode\0A\00"
define void @HariMain() {
%1 = alloca i32
%2 = call i32 (...) @api_getlang()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @api_putstr0(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @api_putstr0(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @HariMain.s1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @api_putstr0(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @HariMain.s2, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = call i32 (...) @api_end()
ret void
}

LLVM IR (-O2):
@HariMain.s1 = internal global [23 x i8] c"\93\FA\96{\8C\EA\83V\83t\83gJIS\83\82\81[\83h\0A\00"
@HariMain.s2 = internal global [17 x i8] c"\C6\FC\CB\DC\B8\ECEUC\A5\E2\A1\BC\A5\C9\0A\00"
@.str = [20 x i8] c"English ASCII mode\0A\00"
@switch.table.HariMain = [3 x i8*] [i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @HariMain.s1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @HariMain.s2, i64 0, i64 0)]
define void @HariMain() {
%1 = tail call i32 (...) @api_getlang()
%2 = icmp ult i32 %1, 3
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds [3 x i8*], [3 x i8*]* @switch.table.HariMain, i64 0, i64 %4
%6 = load i8*, i8** %5
%7 = tail call i32 @api_putstr0(i8* %6)
br label %8
8: ; preds = %0, %3
%9 = tail call i32 (...) @api_end()
ret void
}