#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*/ FATAL_MESSAGE(char *);
int /*<<< orphan*/ LC_ALL;
char *getenv(char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ *strstr(char *, char *);
void plazach_unicode_enable() {
  char *lang;
  lang = getenv("LANG");
  if (lang == NULL || strstr(lang, "UTF") == NULL)
    FATAL_MESSAGE("Current locale is not an UTF locale");
  setlocale(LC_ALL, lang);
}


x86 assembly (clang, -O0):
<plazach_unicode_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     117d <plazach_unicode_enable+0x3d>
mov    -0x8(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
jne    1189 <plazach_unicode_enable+0x49>
lea    0xe85(%rip),%rdi
call   1050 <FATAL_MESSAGE@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1040 <setlocale@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plazach_unicode_enable>:
push   %rbx
lea    0xeb8(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1169 <plazach_unicode_enable+0x29>
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
jne    1175 <plazach_unicode_enable+0x35>
lea    0xe99(%rip),%rdi
call   1050 <FATAL_MESSAGE@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <setlocale@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"LANG\00"
@.str.1 = [4 x i8] c"UTF\00"
@.str.2 = [36 x i8] c"Current locale is not an UTF locale\00"
@LC_ALL = global i32 0
define void @plazach_unicode_enable() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = call i32* @strstr(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %5, %0
%10 = call i32 @FATAL_MESSAGE(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
%12 = load i32, i32* @LC_ALL
%13 = load i8*, i8** %1
%14 = call i32 @setlocale(i32 %12, i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"LANG\00"
@.str.1 = [4 x i8] c"UTF\00"
@.str.2 = [36 x i8] c"Current locale is not an UTF locale\00"
@LC_ALL = global i32 0
define void @plazach_unicode_enable() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32* @strstr(i8* %1, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3, %0
%7 = tail call i32 @FATAL_MESSAGE(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
%9 = load i32, i32* @LC_ALL
%10 = tail call i32 @setlocale(i32 %9, i8* %1)
ret void
}