#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 */
typedef int wchar_t;

/* Variables and functions */
int /*<<< orphan*/ LC_ALL;
int WEOF;
int getwchar();
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int main() {
  wchar_t c;
  int counta = 0;
  int counte = 0;
  setlocale(LC_ALL, "");
  if (strcmp(setlocale(LC_ALL, NULL), "C") == 0) {
    setlocale(LC_ALL, "UTF-8");
  }
  if (strcmp(setlocale(LC_ALL, NULL), "C") == 0) {
    setlocale(LC_ALL, "en_US.UTF-8");
  }
  if (strcmp(setlocale(LC_ALL, NULL), "C") == 0) {
    setlocale(LC_ALL, "fr_FR.UTF-8");
  }
  while ((c = getwchar()) != WEOF) {
    if (c == L'\x00e0') {
      counta += 1;
    } else if (c == L'\x00e9') {
      counte += 1;
    }
  }
  printf("%d à %d é\n", counta, counte);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
call   1060 <setlocale@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <setlocale@plt>
mov    %eax,%edi
lea    0xe73(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11b1 <main+0x71>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
call   1060 <setlocale@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <setlocale@plt>
mov    %eax,%edi
lea    0xe34(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11f0 <main+0xb0>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xe17(%rip),%rsi
call   1060 <setlocale@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <setlocale@plt>
mov    %eax,%edi
lea    0xdf5(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    122f <main+0xef>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
lea    0xde4(%rip),%rsi
call   1060 <setlocale@plt>
jmp    1234 <main+0xf4>
mov    $0x0,%al
call   1030 <getwchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2d9b(%rip),%rcx
cmp    (%rcx),%eax
je     1288 <main+0x148>
cmpl   $0xe0,-0x8(%rbp)
jne    1268 <main+0x128>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1283 <main+0x143>
cmpl   $0xe9,-0x8(%rbp)
jne    127e <main+0x13e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1283 <main+0x143>
jmp    1234 <main+0xf4>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xd85(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x2e8d(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xed1(%rip),%rsi
call   1060 <setlocale@plt>
mov    0x0(%rbp),%edi
xor    %esi,%esi
call   1060 <setlocale@plt>
lea    0xe95(%rip),%rsi
mov    %eax,%edi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1186 <main+0x46>
mov    0x0(%rbp),%edi
lea    0xe93(%rip),%rsi
call   1060 <setlocale@plt>
mov    0x0(%rbp),%edi
xor    %esi,%esi
call   1060 <setlocale@plt>
lea    0xe69(%rip),%rsi
mov    %eax,%edi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11b2 <main+0x72>
mov    0x0(%rbp),%edi
lea    0xe55(%rip),%rsi
call   1060 <setlocale@plt>
mov    0x0(%rbp),%edi
xor    %ebx,%ebx
xor    %esi,%esi
call   1060 <setlocale@plt>
lea    0xe3b(%rip),%rsi
mov    %eax,%edi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11e0 <main+0xa0>
mov    0x0(%rbp),%edi
lea    0xe33(%rip),%rsi
call   1060 <setlocale@plt>
xor    %eax,%eax
call   1030 <getwchar@plt>
mov    0x2df2(%rip),%r14
mov    $0x0,%ebp
cmp    (%r14),%eax
jne    120f <main+0xcf>
lea    0xe1b(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    122f <main+0xef>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
xor    %eax,%eax
call   1030 <getwchar@plt>
cmp    (%r14),%eax
je     11f8 <main+0xb8>
cmp    $0xe9,%eax
je     1220 <main+0xe0>
cmp    $0xe0,%eax
jne    1223 <main+0xe3>
add    $0x1,%ebx
jmp    1223 <main+0xe3>

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"C\00"
@.str.2 = [6 x i8] c"UTF-8\00"
@.str.3 = [12 x i8] c"en_US.UTF-8\00"
@.str.4 = [12 x i8] c"fr_FR.UTF-8\00"
@WEOF = global i32 0
@.str.5 = [13 x i8] c"%d \C3\A0 %d \C3\A9\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* @LC_ALL
%6 = call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @LC_ALL
%8 = call i32 @setlocale(i32 %7, i8* null)
%9 = call i64 @strcmp(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = load i32, i32* @LC_ALL
%13 = call i32 @setlocale(i32 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %11, %0
%15 = load i32, i32* @LC_ALL
%16 = call i32 @setlocale(i32 %15, i8* null)
%17 = call i64 @strcmp(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32, i32* @LC_ALL
%21 = call i32 @setlocale(i32 %20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %19, %14
%23 = load i32, i32* @LC_ALL
%24 = call i32 @setlocale(i32 %23, i8* null)
%25 = call i64 @strcmp(i32 %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i32, i32* @LC_ALL
%29 = call i32 @setlocale(i32 %28, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %27, %22
br label %31
31: ; preds = %48, %30
%32 = call i32 (...) @getwchar()
store i32 %32, i32* %2
%33 = load i32, i32* @WEOF
%34 = icmp ne i32 %32, %33
br i1 %34, label %35, label %49
35: ; preds = %31
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, 224
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %48
41: ; preds = %35
%42 = load i32, i32* %2
%43 = icmp eq i32 %42, 233
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i32, i32* %4
%46 = add nsw i32 %45, 1
store i32 %46, i32* %4
br label %47
47: ; preds = %44, %41
br label %48
48: ; preds = %47, %38
br label %31
49: ; preds = %31
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %50, i32 %51)
ret i32 0
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"C\00"
@.str.2 = [6 x i8] c"UTF-8\00"
@.str.3 = [12 x i8] c"en_US.UTF-8\00"
@.str.4 = [12 x i8] c"fr_FR.UTF-8\00"
@WEOF = global i32 0
@.str.5 = [13 x i8] c"%d \C3\A0 %d \C3\A9\0A\00"
define i32 @main() {
%1 = load i32, i32* @LC_ALL
%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* @LC_ALL
%4 = tail call i32 @setlocale(i32 %3, i8* null)
%5 = tail call i64 @strcmp(i32 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* @LC_ALL
%9 = tail call i32 @setlocale(i32 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %7, %0
%11 = load i32, i32* @LC_ALL
%12 = tail call i32 @setlocale(i32 %11, i8* null)
%13 = tail call i64 @strcmp(i32 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* @LC_ALL
%17 = tail call i32 @setlocale(i32 %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %15, %10
%19 = load i32, i32* @LC_ALL
%20 = tail call i32 @setlocale(i32 %19, i8* null)
%21 = tail call i64 @strcmp(i32 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i32, i32* @LC_ALL
%25 = tail call i32 @setlocale(i32 %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %23, %18
%27 = tail call i32 (...) @getwchar()
%28 = load i32, i32* @WEOF
%29 = icmp eq i32 %27, %28
br i1 %29, label %44, label %30
30: ; preds = %26, %38
%31 = phi i32 [ %41, %38 ], [ %27, %26 ]
%32 = phi i32 [ %40, %38 ], [ 0, %26 ]
%33 = phi i32 [ %39, %38 ], [ 0, %26 ]
switch i32 %31, label %38 [
i32 224, label %34
i32 233, label %36
]
34: ; preds = %30
%35 = add nsw i32 %33, 1
br label %38
36: ; preds = %30
%37 = add nsw i32 %32, 1
br label %38
38: ; preds = %30, %36, %34
%39 = phi i32 [ %35, %34 ], [ %33, %36 ], [ %33, %30 ]
%40 = phi i32 [ %32, %34 ], [ %37, %36 ], [ %32, %30 ]
%41 = tail call i32 (...) @getwchar()
%42 = load i32, i32* @WEOF
%43 = icmp eq i32 %41, %42
br i1 %43, label %44, label %30
44: ; preds = %38, %26
%45 = phi i32 [ 0, %26 ], [ %39, %38 ]
%46 = phi i32 [ 0, %26 ], [ %40, %38 ]
%47 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %45, i32 %46)
ret i32 0
}