#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__ isLower(char);
scalar_t__ isNum(char);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ toChinese(char);
int toUpper(char);
int main(void) {
  char c;
  do {
    scanf("%c", &c);
    if (isLower(c)) {
      printf("%c", toUpper(c));
    } else if (isNum(c)) {
      toChinese(c);
    } else {
      printf("%c", c);
    }
  } while (c != '\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1080 <scanf@plt>
movsbl -0x5(%rbp),%edi
call   1060 <isLower@plt>
cmp    $0x0,%rax
je     11af <main+0x4f>
movsbl -0x5(%rbp),%edi
call   1070 <toUpper@plt>
lea    0xe5e(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
jmp    11e5 <main+0x85>
movsbl -0x5(%rbp),%edi
call   1030 <isNum@plt>
cmp    $0x0,%rax
je     11d0 <main+0x70>
movsbl -0x5(%rbp),%edi
call   1050 <toChinese@plt>
jmp    11e0 <main+0x80>
lea    0xe29(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1040 <printf@plt>
jmp    11e5 <main+0x85>
jmp    11ea <main+0x8a>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    116f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe95(%rip),%rbx
lea    0x7(%rsp),%r14
jmp    1197 <main+0x37>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1070 <toUpper@plt>
movsbl %al,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
cmpb   $0xa,0x7(%rsp)
je     11de <main+0x7e>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <scanf@plt>
movsbl 0x7(%rsp),%edi
call   1060 <isLower@plt>
movzbl 0x7(%rsp),%ecx
movsbl %cl,%edi
test   %rax,%rax
jne    1180 <main+0x20>
call   1030 <isNum@plt>
movzbl 0x7(%rsp),%ecx
test   %rax,%rax
je     11d9 <main+0x79>
movsbl %cl,%edi
call   1050 <toChinese@plt>
cmpb   $0xa,0x7(%rsp)
jne    1197 <main+0x37>
jmp    11de <main+0x7e>
movsbl %cl,%esi
jmp    1188 <main+0x28>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %25, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = call i64 @isLower(i8 signext %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i8, i8* %2
%10 = call i32 @toUpper(i8 signext %9)
%11 = trunc i32 %10 to i8
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %11)
br label %24
13: ; preds = %3
%14 = load i8, i8* %2
%15 = call i64 @isNum(i8 signext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i8, i8* %2
%19 = call i32 @toChinese(i8 signext %18)
br label %23
20: ; preds = %13
%21 = load i8, i8* %2
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %21)
br label %23
23: ; preds = %20, %17
br label %24
24: ; preds = %23, %8
br label %25
25: ; preds = %24
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 10
br i1 %28, label %3, label %29
29: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i8
br label %2
2: ; preds = %20, %0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = call i64 @isLower(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = load i8, i8* %1
br i1 %6, label %12, label %8
8: ; preds = %2
%9 = call i32 @toUpper(i8 signext %7)
%10 = trunc i32 %9 to i8
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %10)
br label %20
12: ; preds = %2
%13 = call i64 @isNum(i8 signext %7)
%14 = icmp eq i64 %13, 0
%15 = load i8, i8* %1
br i1 %14, label %18, label %16
16: ; preds = %12
%17 = call i32 @toChinese(i8 signext %15)
br label %20
18: ; preds = %12
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %15)
br label %20
20: ; preds = %8, %18, %16
%21 = load i8, i8* %1
%22 = icmp eq i8 %21, 10
br i1 %22, label %23, label %2
23: ; preds = %20
ret i32 0
}