#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 */
char fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ stdin;
char getOneChar() {
  char Ans, tmp;
  Ans = fgetc(stdin);
  if (Ans == '\n')
    return Ans;
  for (;;) {
    tmp = fgetc(stdin);
    if (tmp == '\n')
      break;
  }
  if (Ans < 'Z' && Ans > 'A')
    Ans = Ans + ('a' - 'A');
  if (0)
    printf("DEBUG: Answer is %c\n", Ans);
  return Ans;
}


x86 assembly (clang, -O0):
<getOneChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0xa,%eax
jne    1141 <getOneChar+0x31>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    1198 <getOneChar+0x88>
jmp    1146 <getOneChar+0x36>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %al,-0x3(%rbp)
movsbl -0x3(%rbp),%eax
cmp    $0xa,%eax
jne    1169 <getOneChar+0x59>
jmp    116e <getOneChar+0x5e>
jmp    1146 <getOneChar+0x36>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jge    1192 <getOneChar+0x82>
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jle    1192 <getOneChar+0x82>
movsbl -0x2(%rbp),%eax
add    $0x20,%eax
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getOneChar>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fgetc@plt>
mov    %eax,%r14d
mov    $0xa,%al
cmp    $0xa,%r14b
je     114f <getOneChar+0x3f>
nopl   (%rax)
mov    (%rbx),%edi
call   1030 <fgetc@plt>
cmp    $0xa,%al
jne    1130 <getOneChar+0x20>
lea    -0x42(%r14),%eax
lea    0x20(%r14),%ecx
cmp    $0x18,%al
movzbl %r14b,%edx
movzbl %cl,%eax
cmovae %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
define signext i8 @getOneChar() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = load i32, i32* @stdin
%5 = call signext i8 @fgetc(i32 %4)
store i8 %5, i8* %2
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 10
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = load i8, i8* %2
store i8 %10, i8* %1
br label %35
11: ; preds = %0
br label %12
12: ; preds = %19, %11
%13 = load i32, i32* @stdin
%14 = call signext i8 @fgetc(i32 %13)
store i8 %14, i8* %3
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 10
br i1 %17, label %18, label %19
18: ; preds = %12
br label %20
19: ; preds = %12
br label %12
20: ; preds = %18
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp slt i32 %22, 90
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp sgt i32 %26, 65
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = add nsw i32 %30, 32
%32 = trunc i32 %31 to i8
store i8 %32, i8* %2
br label %33
33: ; preds = %28, %24, %20
%34 = load i8, i8* %2
store i8 %34, i8* %1
br label %35
35: ; preds = %33, %9
%36 = load i8, i8* %1
ret i8 %36
}

LLVM IR (-O2):
@stdin = global i32 0
define signext i8 @getOneChar() {
%1 = load i32, i32* @stdin
%2 = tail call signext i8 @fgetc(i32 %1)
%3 = icmp eq i8 %2, 10
br i1 %3, label %13, label %4
4: ; preds = %0, %4
%5 = load i32, i32* @stdin
%6 = tail call signext i8 @fgetc(i32 %5)
%7 = icmp eq i8 %6, 10
br i1 %7, label %8, label %4
8: ; preds = %4
%9 = add i8 %2, -66
%10 = icmp ult i8 %9, 24
%11 = add i8 %2, 32
%12 = select i1 %10, i8 %11, i8 %2
br label %13
13: ; preds = %0, %8
%14 = phi i8 [ %12, %8 ], [ 10, %0 ]
ret i8 %14
}