#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*/ LC_CTYPE;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ *setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main() {
  if (setlocale(LC_CTYPE, "") == NULL) {
    fprintf(stderr, "Can't set the specified locale! "
                    "Check LANG, LC_CTYPE, LC_ALL.\n");
    return 1;
  } else {
    printf("%ls\n", L"Ält önd dümm");
    printf("%ls\t(à â ç é è ë î ï ô ù û ü)\n", L"Vieux et bête");
    printf("%ls\t(Стар и тъпанар)\n", L"Стар и тъпанар");
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xf41(%rip),%rsi
call   1050 <setlocale@plt>
cmp    $0x0,%rax
jne    117f <main+0x4f>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bf <main+0x8f>
lea    0xeb9(%rip),%rdi
lea    0xf07(%rip),%rsi
call   1030 <printf@plt>
lea    0xeab(%rip),%rdi
lea    0xf28(%rip),%rsi
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    0xf4d(%rip),%rsi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xf4f(%rip),%rsi
call   1050 <setlocale@plt>
test   %rax,%rax
je     1188 <main+0x58>
lea    0xeed(%rip),%rdi
lea    0xf3b(%rip),%rsi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0xf5c(%rip),%rsi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
lea    0xf81(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@LC_CTYPE = global i32 0
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [63 x i8] c"Can't set the specified locale! Check LANG, LC_CTYPE, LC_ALL.\0A\00"
@.str.2 = [5 x i8] c"%ls\0A\00"
@.str.3 = [13 x i32] [i32 196, i32 108, i32 116, i32 32, i32 246, i32 110, i32 100, i32 32, i32 100, i32 252, i32 109, i32 109, i32 0]
@.str.4 = [43 x i8] c"%ls\09(\C3\A0 \C3\A2 \C3\A7 \C3\A9 \C3\A8 \C3\AB \C3\AE \C3\AF \C3\B4 \C3\B9 \C3\BB \C3\BC)\0A\00"
@.str.5 = [14 x i32] [i32 86, i32 105, i32 101, i32 117, i32 120, i32 32, i32 101, i32 116, i32 32, i32 98, i32 234, i32 116, i32 101, i32 0]
@.str.6 = [34 x i8] c"%ls\09(\D0\A1\D1\82\D0\B0\D1\80 \D0\B8 \D1\82\D1\8A\D0\BF\D0\B0\D0\BD\D0\B0\D1\80)\0A\00"
@.str.7 = [15 x i32] [i32 1057, i32 1090, i32 1072, i32 1088, i32 32, i32 1080, i32 32, i32 1090, i32 1098, i32 1087, i32 1072, i32 1085, i32 1072, i32 1088, i32 0]
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @LC_CTYPE
%3 = call i32* @setlocale(i32 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %12
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* bitcast ([13 x i32]* @.str.3 to i8*))
%10 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* bitcast ([14 x i32]* @.str.5 to i8*))
%11 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* bitcast ([15 x i32]* @.str.7 to i8*))
store i32 0, i32* %1
br label %12
12: ; preds = %8, %5
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@LC_CTYPE = global i32 0
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [63 x i8] c"Can't set the specified locale! Check LANG, LC_CTYPE, LC_ALL.\0A\00"
@.str.2 = [5 x i8] c"%ls\0A\00"
@.str.3 = [13 x i32] [i32 196, i32 108, i32 116, i32 32, i32 246, i32 110, i32 100, i32 32, i32 100, i32 252, i32 109, i32 109, i32 0]
@.str.4 = [43 x i8] c"%ls\09(\C3\A0 \C3\A2 \C3\A7 \C3\A9 \C3\A8 \C3\AB \C3\AE \C3\AF \C3\B4 \C3\B9 \C3\BB \C3\BC)\0A\00"
@.str.5 = [14 x i32] [i32 86, i32 105, i32 101, i32 117, i32 120, i32 32, i32 101, i32 116, i32 32, i32 98, i32 234, i32 116, i32 101, i32 0]
@.str.6 = [34 x i8] c"%ls\09(\D0\A1\D1\82\D0\B0\D1\80 \D0\B8 \D1\82\D1\8A\D0\BF\D0\B0\D0\BD\D0\B0\D1\80)\0A\00"
@.str.7 = [15 x i32] [i32 1057, i32 1090, i32 1072, i32 1088, i32 32, i32 1080, i32 32, i32 1090, i32 1098, i32 1087, i32 1072, i32 1085, i32 1072, i32 1088, i32 0]
define i32 @main() {
%1 = load i32, i32* @LC_CTYPE
%2 = tail call i32* @setlocale(i32 %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
br label %11
7: ; preds = %0
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* bitcast ([13 x i32]* @.str.3 to i8*))
%9 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* bitcast ([14 x i32]* @.str.5 to i8*))
%10 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* bitcast ([15 x i32]* @.str.7 to i8*))
br label %11
11: ; preds = %7, %4
%12 = phi i32 [ 1, %4 ], [ 0, %7 ]
ret i32 %12
}