#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*/ CODESET;
int /*<<< orphan*/ LC_CTYPE;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *nl_langinfo(int /*<<< orphan*/);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
void console_utf8_enable(void) {
  setlocale(LC_CTYPE, "");
  char *codepage = nl_langinfo(CODESET);
  if (codepage != NULL && strcmp(codepage, "UTF-8") != 0) {
    fprintf(stderr, "Warning: Detected you are using a non-UNICODE "
                    "terminal character encoding.\n");
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<console_utf8_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xee9(%rip),%rsi
call   1060 <setlocale@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1050 <nl_langinfo@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11c3 <console_utf8_enable+0x73>
mov    -0x8(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11c3 <console_utf8_enable+0x73>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    0xe52(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_utf8_enable>:
push   %rax
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
lea    0xef0(%rip),%rsi
call   1060 <setlocale@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
call   1050 <nl_langinfo@plt>
test   %rax,%rax
je     11ad <console_utf8_enable+0x5d>
lea    0xe80(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11ad <console_utf8_enable+0x5d>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
pop    %rax
jmp    1070 <sleep@plt>
pop    %rax
ret

LLVM IR (-O0):
@LC_CTYPE = global i32 0
@.str = [1 x i8] zeroinitializer
@CODESET = global i32 0
@.str.1 = [6 x i8] c"UTF-8\00"
@stderr = global i32 0
@.str.2 = [76 x i8] c"Warning: Detected you are using a non-UNICODE terminal character encoding.\0A\00"
define void @console_utf8_enable() {
%1 = alloca i8*
%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 = load i32, i32* @CODESET
%5 = call i8* @nl_langinfo(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %16
8: ; preds = %0
%9 = load i8*, i8** %1
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @sleep(i32 1)
br label %16
16: ; preds = %12, %8, %0
ret void
}

LLVM IR (-O2):
@LC_CTYPE = global i32 0
@.str = [1 x i8] zeroinitializer
@CODESET = global i32 0
@.str.1 = [6 x i8] c"UTF-8\00"
@stderr = global i32 0
@.str.2 = [76 x i8] c"Warning: Detected you are using a non-UNICODE terminal character encoding.\0A\00"
define void @console_utf8_enable() {
%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 = load i32, i32* @CODESET
%4 = tail call i8* @nl_langinfo(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %0
%7 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @sleep(i32 1)
br label %13
13: ; preds = %9, %6, %0
ret void
}