#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 getchar();
scalar_t__ islower(char);
int /*<<< orphan*/ printf(char *, ...);
int toupper(char);
int main(void) {
  char s;
  int ch;
  while (1) {
    s = getchar();
    if (s == '\n')
      break;
    if (islower(s) != 0) {
      ch = toupper(s);
      printf("%c", ch);
    } else {
      printf("%c", s);
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    116b <main+0x2b>
jmp    11b7 <main+0x77>
movsbl -0x5(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     11a0 <main+0x60>
movsbl -0x5(%rbp),%edi
call   1040 <toupper@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11b2 <main+0x72>
movsbl -0x5(%rbp),%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    114f <main+0xf>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
jmp    1157 <main+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
je     117c <main+0x3c>
movsbl %al,%ebx
mov    %ebx,%edi
call   1040 <islower@plt>
test   %rax,%rax
je     1150 <main+0x10>
mov    %ebx,%edi
call   1050 <toupper@plt>
mov    %eax,%ebx
jmp    1150 <main+0x10>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %0, %23
%5 = call signext i8 (...) @getchar()
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 %10
9: ; preds = %4
br label %24
10: ; preds = %4
%11 = load i8, i8* %2
%12 = call i64 @islower(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i8, i8* %2
%16 = call i32 @toupper(i8 signext %15)
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %23
19: ; preds = %10
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %19, %14
br label %4
24: ; preds = %9
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = icmp eq i8 %1, 10
br i1 %2, label %16, label %3
3: ; preds = %0, %11
%4 = phi i8 [ %14, %11 ], [ %1, %0 ]
%5 = tail call i64 @islower(i8 signext %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @toupper(i8 signext %4)
br label %11
9: ; preds = %3
%10 = sext i8 %4 to i32
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ %10, %9 ], [ %8, %7 ]
%13 = tail call i32 @putchar(i32 %12)
%14 = tail call signext i8 (...) @getchar()
%15 = icmp eq i8 %14, 10
br i1 %15, label %16, label %3
16: ; preds = %11, %0
%17 = tail call i32 @putchar(i32 10)
ret i32 0
}