#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__ gets(char *);
scalar_t__ isalpha(char);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char *);
char toupper(char);
int main() {
  int i, len;
  char line[101];
  while (gets(line)) {
    len = strlen(line);
    if (isalpha(line[0]))
      line[0] = toupper(line[0]);
    for (i = 1; i < len; i++) {
      if (line[i - 1] == ' ' || line[i - 1] == '\t' || line[i - 1] == '\r' ||
          line[i - 1] == '\n')
        line[i] = toupper(line[i]);
    }
    printf("%s\n", line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rdi
call   1060 <gets@plt>
cmp    $0x0,%rax
je     124b <main+0xfb>
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
movsbl -0x80(%rbp),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%rax
je     11a0 <main+0x50>
movsbl -0x80(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,-0x80(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1236 <main+0xe6>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x20,%eax
je     120b <main+0xbb>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x9,%eax
je     120b <main+0xbb>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0xd,%eax
je     120b <main+0xbb>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0xa,%eax
jne    1223 <main+0xd3>
movslq -0x8(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%edi
call   1030 <toupper@plt>
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
jmp    1228 <main+0xd8>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a7 <main+0x57>
lea    -0x80(%rbp),%rsi
lea    0xdbf(%rip),%rdi
call   1050 <printf@plt>
jmp    1162 <main+0x12>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     1208 <main+0xb8>
mov    %rsp,%r15
movabs $0x100002600,%r12
lea    0xe7f(%rip),%r14
jmp    11a8 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <printf@plt>
mov    %r15,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     1208 <main+0xb8>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
movsbl (%rsp),%edi
call   1070 <isalpha@plt>
test   %rax,%rax
je     11cc <main+0x7c>
movsbl (%rsp),%edi
call   1030 <toupper@plt>
mov    %al,(%rsp)
cmp    $0x2,%ebp
jl     1190 <main+0x40>
mov    %ebp,%ebp
mov    $0x1,%ebx
jmp    11e9 <main+0x99>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1190 <main+0x40>
movzbl -0x1(%rsp,%rbx,1),%eax
cmp    $0x20,%rax
ja     11e0 <main+0x90>
bt     %rax,%r12
jae    11e0 <main+0x90>
movsbl (%rsp,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %al,(%rsp,%rbx,1)
jmp    11e0 <main+0x90>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [101 x i8]
store i32 0, i32* %1
br label %5
5: ; preds = %71, %0
%6 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%7 = call i64 @gets(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %74
9: ; preds = %5
%10 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %3
%12 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%13 = load i8, i8* %12
%14 = call i64 @isalpha(i8 signext %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %9
%17 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%18 = load i8, i8* %17
%19 = call signext i8 @toupper(i8 signext %18)
%20 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
store i8 %19, i8* %20
br label %21
21: ; preds = %16, %9
store i32 1, i32* %2
br label %22
22: ; preds = %68, %21
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %71
26: ; preds = %22
%27 = load i32, i32* %2
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 32
br i1 %33, label %58, label %34
34: ; preds = %26
%35 = load i32, i32* %2
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 9
br i1 %41, label %58, label %42
42: ; preds = %34
%43 = load i32, i32* %2
%44 = sub nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 13
br i1 %49, label %58, label %50
50: ; preds = %42
%51 = load i32, i32* %2
%52 = sub nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 10
br i1 %57, label %58, label %67
58: ; preds = %50, %42, %34, %26
%59 = load i32, i32* %2
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %60
%62 = load i8, i8* %61
%63 = call signext i8 @toupper(i8 signext %62)
%64 = load i32, i32* %2
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %65
store i8 %63, i8* %66
br label %67
67: ; preds = %58, %50
br label %68
68: ; preds = %67
%69 = load i32, i32* %2
%70 = add nsw i32 %69, 1
store i32 %70, i32* %2
br label %22
71: ; preds = %22
%72 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%73 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %72)
br label %5
74: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [101 x i8]
%2 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
%3 = call i64 @gets(i8* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %33, label %5
5: ; preds = %0, %29
%6 = call i32 @strlen(i8* %2)
%7 = load i8, i8* %2
%8 = call i64 @isalpha(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = load i8, i8* %2
%12 = call signext i8 @toupper(i8 signext %11)
store i8 %12, i8* %2
br label %13
13: ; preds = %10, %5
%14 = icmp sgt i32 %6, 1
br i1 %14, label %15, label %29
15: ; preds = %13
%16 = zext i32 %6 to i64
br label %17
17: ; preds = %15, %26
%18 = phi i64 [ 1, %15 ], [ %27, %26 ]
%19 = add nsw i64 %18, -1
%20 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 %19
%21 = load i8, i8* %20
switch i8 %21, label %26 [
i8 32, label %22
i8 9, label %22
i8 13, label %22
i8 10, label %22
]
22: ; preds = %17, %17, %17, %17
%23 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 %18
%24 = load i8, i8* %23
%25 = call signext i8 @toupper(i8 signext %24)
store i8 %25, i8* %23
br label %26
26: ; preds = %17, %22
%27 = add nuw nsw i64 %18, 1
%28 = icmp eq i64 %27, %16
br i1 %28, label %29, label %17
29: ; preds = %26, %13
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%31 = call i64 @gets(i8* %2)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %5
33: ; preds = %29, %0
ret i32 0
}