#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__ isalpha(char);
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ toupper(char);
int main() {
  char s[100];
  size_t i = 0;
  scanf("%s", s);
  while ((*s = s[i++]))
    if (isalpha(*s))
      putchar(toupper(*s));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x78(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x78(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x78(%rbp)
mov    -0x70(%rbp,%rax,1),%al
mov    %al,-0x70(%rbp)
cmp    $0x0,%al
je     11b0 <main+0x70>
movsbl -0x70(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
je     11ab <main+0x6b>
movsbl -0x70(%rbp),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    116a <main+0x2a>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xeb4(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%al
test   %al,%al
je     119d <main+0x5d>
lea    0x1(%rsp),%rbx
jmp    117e <main+0x3e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rbx),%eax
mov    %al,(%rsp)
add    $0x1,%rbx
test   %al,%al
je     119d <main+0x5d>
movsbl %al,%edi
call   1050 <isalpha@plt>
test   %rax,%rax
je     1170 <main+0x30>
movsbl (%rsp),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    1170 <main+0x30>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %3
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %6
6: ; preds = %23, %0
%7 = load i64, i64* %3
%8 = add i64 %7, 1
store i64 %8, i64* %3
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %7
%10 = load i8, i8* %9
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
store i8 %10, i8* %11
%12 = icmp ne i8 %10, 0
br i1 %12, label %13, label %24
13: ; preds = %6
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%15 = load i8, i8* %14
%16 = call i64 @isalpha(i8 signext %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %13
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%20 = load i8, i8* %19
%21 = call i32 @toupper(i8 signext %20)
%22 = call i32 @putchar(i32 %21)
br label %23
23: ; preds = %18, %13
br label %6
24: ; preds = %6
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %0, %15
%7 = phi i8 [ %18, %15 ], [ %4, %0 ]
%8 = phi i64 [ %16, %15 ], [ 1, %0 ]
%9 = call i64 @isalpha(i8 signext %7)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = load i8, i8* %2
%13 = call i32 @toupper(i8 signext %12)
%14 = call i32 @putchar(i32 %13)
br label %15
15: ; preds = %11, %6
%16 = add i64 %8, 1
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %8
%18 = load i8, i8* %17
store i8 %18, i8* %2
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %6
20: ; preds = %15, %0
ret i32 0
}