#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 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));
  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    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
call   1040 <setlocale@plt>
mov    0x2e8e(%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    0x2e6f(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
call   1040 <setlocale@plt>
mov    0x2e5a(%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    0x2e3b(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
call   1040 <setlocale@plt>
mov    0x2e26(%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    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
lea    0xecc(%rip),%rsi
call   1040 <setlocale@plt>
mov    (%rbx),%edi
xor    %esi,%esi
call   1040 <setlocale@plt>
mov    %eax,%edi
call   1030 <check_ascii@plt>
mov    %eax,%r14d
mov    (%rbx),%edi
lea    0xead(%rip),%rsi
call   1040 <setlocale@plt>
mov    (%rbx),%edi
xor    %esi,%esi
call   1040 <setlocale@plt>
mov    %eax,%edi
call   1030 <check_ascii@plt>
mov    %eax,%ebp
or     %r14d,%ebp
mov    (%rbx),%edi
lea    0xe96(%rip),%rsi
call   1040 <setlocale@plt>
mov    (%rbx),%edi
xor    %esi,%esi
call   1040 <setlocale@plt>
mov    %eax,%edi
call   1030 <check_ascii@plt>
or     %ebp,%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 = load i32, i32* @LC_ALL
%18 = call i32 @setlocale(i32 %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* @LC_ALL
%20 = call i32 @setlocale(i32 %19, i8* null)
%21 = call i32 @check_ascii(i32 %20)
%22 = load i32, i32* %2
%23 = or i32 %22, %21
store i32 %23, i32* %2
%24 = load i32, i32* %2
ret i32 %24
}

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 = load i32, i32* @LC_ALL
%13 = tail call i32 @setlocale(i32 %12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* @LC_ALL
%15 = tail call i32 @setlocale(i32 %14, i8* null)
%16 = tail call i32 @check_ascii(i32 %15)
%17 = or i32 %11, %16
ret i32 %17
}