#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 */
scalar_t__ EOF;
scalar_t__ scanf(char *, unsigned char *);
int getf_char() {
  unsigned char firstchar, secondchar;
  if (scanf(" %c", &firstchar) == EOF)
    return EOF;
  else if ((firstchar & 0xE0) == 0xC0) {
    scanf("%c", &secondchar);
    return ((int)(firstchar & 0x1F)) << 6 | (secondchar & 0x3F);
  } else
    return firstchar;
}


x86 assembly (clang, -O0):
<getf_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1030 <scanf@plt>
mov    0x2eb9(%rip),%rcx
cmp    (%rcx),%rax
jne    114a <getf_char+0x3a>
mov    0x2ea9(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
jmp    1190 <getf_char+0x80>
movzbl -0x5(%rbp),%eax
and    $0xe0,%eax
cmp    $0xc0,%eax
jne    1189 <getf_char+0x79>
lea    0xe9c(%rip),%rdi
lea    -0x6(%rbp),%rsi
call   1030 <scanf@plt>
movzbl -0x5(%rbp),%eax
and    $0x1f,%eax
shl    $0x6,%eax
movzbl -0x6(%rbp),%ecx
and    $0x3f,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1190 <getf_char+0x80>
movzbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getf_char>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x2ebf(%rip),%rcx
cmp    (%rcx),%rax
je     1166 <getf_char+0x56>
movzbl 0x6(%rsp),%eax
mov    %eax,%ecx
and    $0xffffffe0,%ecx
cmp    $0xc0,%ecx
jne    1166 <getf_char+0x56>
lea    0xeba(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1030 <scanf@plt>
movzbl 0x6(%rsp),%ecx
and    $0x1f,%ecx
shl    $0x6,%ecx
movzbl 0x7(%rsp),%eax
and    $0x3f,%eax
or     %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %c\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"%c\00"
define i32 @getf_char() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = load i64, i64* @EOF
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i64, i64* @EOF
%9 = trunc i64 %8 to i32
store i32 %9, i32* %1
br label %28
10: ; preds = %0
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = and i32 %12, 224
%14 = icmp eq i32 %13, 192
br i1 %14, label %15, label %25
15: ; preds = %10
%16 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%17 = load i8, i8* %2
%18 = zext i8 %17 to i32
%19 = and i32 %18, 31
%20 = shl i32 %19, 6
%21 = load i8, i8* %3
%22 = zext i8 %21 to i32
%23 = and i32 %22, 63
%24 = or i32 %20, %23
store i32 %24, i32* %1
br label %28
25: ; preds = %10
%26 = load i8, i8* %2
%27 = zext i8 %26 to i32
store i32 %27, i32* %1
br label %28
28: ; preds = %25, %15, %7
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str = [4 x i8] c" %c\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"%c\00"
define i32 @getf_char() {
%1 = alloca i8
%2 = alloca i8
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = trunc i64 %3 to i32
br label %23
8: ; preds = %0
%9 = load i8, i8* %1
%10 = zext i8 %9 to i32
%11 = and i32 %10, 224
%12 = icmp eq i32 %11, 192
br i1 %12, label %13, label %23
13: ; preds = %8
%14 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%15 = load i8, i8* %1
%16 = and i8 %15, 31
%17 = zext i8 %16 to i32
%18 = shl nuw nsw i32 %17, 6
%19 = load i8, i8* %2
%20 = and i8 %19, 63
%21 = zext i8 %20 to i32
%22 = or i32 %18, %21
br label %23
23: ; preds = %8, %13, %6
%24 = phi i32 [ %7, %6 ], [ %22, %13 ], [ %10, %8 ]
ret i32 %24
}