#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_ALL;
int check_ascii(int /*<<< orphan*/);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int utf8_test();
int main(void) {
  int result = 0;
  setlocale(LC_ALL, "C");
  result |= check_ascii(setlocale(LC_ALL, NULL));
  setlocale(LC_ALL, "de_DE.UTF-8");
  result |= check_ascii(setlocale(LC_ALL, NULL));
  result |= utf8_test();
  setlocale(LC_ALL, "ja_JP.EUC-JP");
  result |= check_ascii(setlocale(LC_ALL, NULL));
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
call   1040 <setlocale@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setlocale@plt>
mov    %eax,%edi
call   1030 <check_ascii@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
lea    0xe78(%rip),%rsi
call   1040 <setlocale@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setlocale@plt>
mov    %eax,%edi
call   1030 <check_ascii@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <utf8_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
lea    0xe43(%rip),%rsi
call   1040 <setlocale@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setlocale@plt>
mov    %eax,%edi
call   1030 <check_ascii@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ea5(%rip),%r14
mov    (%r14),%edi
lea    0xebb(%rip),%rsi
call   1040 <setlocale@plt>
mov    (%r14),%edi
xor    %esi,%esi
call   1040 <setlocale@plt>
mov    %eax,%edi
call   1030 <check_ascii@plt>
mov    %eax,%ebp
mov    (%r14),%edi
lea    0xe9b(%rip),%rsi
call   1040 <setlocale@plt>
mov    (%r14),%edi
xor    %esi,%esi
call   1040 <setlocale@plt>
mov    %eax,%edi
call   1030 <check_ascii@plt>
mov    %eax,%ebx
or     %ebp,%ebx
xor    %eax,%eax
call   1050 <utf8_test@plt>
mov    %eax,%ebp
mov    (%r14),%edi
lea    0xe7a(%rip),%rsi
call   1040 <setlocale@plt>
mov    (%r14),%edi
xor    %esi,%esi
call   1040 <setlocale@plt>
mov    %eax,%edi
call   1030 <check_ascii@plt>
or     %ebp,%eax
or     %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [2 x i8] c"C\00"
@.str.1 = [12 x i8] c"de_DE.UTF-8\00"
@.str.2 = [13 x i8] c"ja_JP.EUC-JP\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* @LC_ALL
%4 = call i32 @setlocale(i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @LC_ALL
%6 = call i32 @setlocale(i32 %5, i8* null)
%7 = call i32 @check_ascii(i32 %6)
%8 = load i32, i32* %2
%9 = or i32 %8, %7
store i32 %9, i32* %2
%10 = load i32, i32* @LC_ALL
%11 = call i32 @setlocale(i32 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @LC_ALL
%13 = call i32 @setlocale(i32 %12, i8* null)
%14 = call i32 @check_ascii(i32 %13)
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = call i32 (...) @utf8_test()
%18 = load i32, i32* %2
%19 = or i32 %18, %17
store i32 %19, i32* %2
%20 = load i32, i32* @LC_ALL
%21 = call i32 @setlocale(i32 %20, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32, i32* @LC_ALL
%23 = call i32 @setlocale(i32 %22, i8* null)
%24 = call i32 @check_ascii(i32 %23)
%25 = load i32, i32* %2
%26 = or i32 %25, %24
store i32 %26, i32* %2
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [2 x i8] c"C\00"
@.str.1 = [12 x i8] c"de_DE.UTF-8\00"
@.str.2 = [13 x i8] c"ja_JP.EUC-JP\00"
define i32 @main() {
%1 = load i32, i32* @LC_ALL
%2 = tail call i32 @setlocale(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @LC_ALL
%4 = tail call i32 @setlocale(i32 %3, i8* null)
%5 = tail call i32 @check_ascii(i32 %4)
%6 = load i32, i32* @LC_ALL
%7 = tail call i32 @setlocale(i32 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @LC_ALL
%9 = tail call i32 @setlocale(i32 %8, i8* null)
%10 = tail call i32 @check_ascii(i32 %9)
%11 = or i32 %10, %5
%12 = tail call i32 (...) @utf8_test()
%13 = or i32 %11, %12
%14 = load i32, i32* @LC_ALL
%15 = tail call i32 @setlocale(i32 %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32, i32* @LC_ALL
%17 = tail call i32 @setlocale(i32 %16, i8* null)
%18 = tail call i32 @check_ascii(i32 %17)
%19 = or i32 %13, %18
ret i32 %19
}