#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 */
int mstrlen(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char buffer[100];
  int i = 0;
  do {
    scanf("%s", buffer);
    if (buffer[0] == 'S' && buffer[1] == 'T' && buffer[2] == 'O' &&
        buffer[3] == 'P')
      break;
    for (i = 0; i <= mstrlen(buffer); i++) {
      if ((buffer[i] >= 97) && (buffer[i] <= 122))
        buffer[i] -= 32;
    }
    printf("%s ", buffer);
  } while (1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1040 <scanf@plt>
movsbl -0x70(%rbp),%eax
cmp    $0x53,%eax
jne    1192 <main+0x62>
movsbl -0x6f(%rbp),%eax
cmp    $0x54,%eax
jne    1192 <main+0x62>
movsbl -0x6e(%rbp),%eax
cmp    $0x4f,%eax
jne    1192 <main+0x62>
movsbl -0x6d(%rbp),%eax
cmp    $0x50,%eax
jne    1192 <main+0x62>
jmp    121b <main+0xeb>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    %eax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1050 <mstrlen@plt>
mov    %eax,%ecx
mov    -0x78(%rbp),%eax
cmp    %ecx,%eax
jg     11fc <main+0xcc>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     11e9 <main+0xb9>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     11e9 <main+0xb9>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%ecx
sub    $0x20,%ecx
mov    %cl,-0x70(%rbp,%rax,1)
jmp    11ee <main+0xbe>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1199 <main+0x69>
lea    -0x70(%rbp),%rsi
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%al
test   $0x1,%al
jne    1149 <main+0x19>
jmp    121b <main+0xeb>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xebe(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movdqa (%rsp),%xmm0
movd   %xmm0,%eax
cmp    $0x504f5453,%eax
jne    1168 <main+0x38>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %rsp,%r12
lea    0xe91(%rip),%r14
lea    0xe87(%rip),%r15
jmp    11a6 <main+0x76>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
movdqa (%rsp),%xmm0
movd   %xmm0,%eax
cmp    $0x504f5453,%eax
je     115a <main+0x2a>
mov    %r12,%rdi
call   1050 <mstrlen@plt>
test   %eax,%eax
js     1180 <main+0x50>
mov    $0xffffffffffffffff,%rbx
jmp    11d3 <main+0xa3>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1050 <mstrlen@plt>
cltq
add    $0x1,%rbx
cmp    %rax,%rbx
jge    1180 <main+0x50>
movzbl 0x1(%rsp,%rbx,1),%eax
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     11c0 <main+0x90>
add    $0xe0,%al
mov    %al,0x1(%rsp,%rbx,1)
jmp    11c0 <main+0x90>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%s \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %62, %0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 83
br i1 %10, label %11, label %27
11: ; preds = %4
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 1
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 84
br i1 %15, label %16, label %27
16: ; preds = %11
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 2
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 79
br i1 %20, label %21, label %27
21: ; preds = %16
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 80
br i1 %25, label %26, label %27
26: ; preds = %21
br label %63
27: ; preds = %21, %16, %11, %4
store i32 0, i32* %3
br label %28
28: ; preds = %56, %27
%29 = load i32, i32* %3
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%31 = call i32 @mstrlen(i8* %30)
%32 = icmp sle i32 %29, %31
br i1 %32, label %33, label %59
33: ; preds = %28
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp sge i32 %38, 97
br i1 %39, label %40, label %55
40: ; preds = %33
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp sle i32 %45, 122
br i1 %46, label %47, label %55
47: ; preds = %40
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = sub nsw i32 %52, 32
%54 = trunc i32 %53 to i8
store i8 %54, i8* %50
br label %55
55: ; preds = %47, %40, %33
br label %56
56: ; preds = %55
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %28
59: ; preds = %28
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %60)
br label %62
62: ; preds = %59
br i1 true, label %4, label %63
63: ; preds = %62, %26
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 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 = bitcast [100 x i8]* %1 to <4 x i8>*
%5 = load <4 x i8>, <4 x i8>* %4
%6 = freeze <4 x i8> %5
%7 = bitcast <4 x i8> %6 to i32
%8 = icmp eq i32 %7, 1347376211
br i1 %8, label %34, label %9
9: ; preds = %0
%10 = bitcast [100 x i8]* %1 to <4 x i8>*
br label %11
11: ; preds = %9, %27
%12 = call i32 @mstrlen(i8* %2)
%13 = icmp slt i32 %12, 0
br i1 %13, label %27, label %14
14: ; preds = %11, %22
%15 = phi i64 [ %23, %22 ], [ 0, %11 ]
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = add i8 %17, -97
%19 = icmp ult i8 %18, 26
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = add nsw i8 %17, -32
store i8 %21, i8* %16
br label %22
22: ; preds = %14, %20
%23 = add nuw nsw i64 %15, 1
%24 = call i32 @mstrlen(i8* %2)
%25 = sext i32 %24 to i64
%26 = icmp slt i64 %15, %25
br i1 %26, label %14, label %27
27: ; preds = %22, %11
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%30 = load <4 x i8>, <4 x i8>* %10
%31 = freeze <4 x i8> %30
%32 = bitcast <4 x i8> %31 to i32
%33 = icmp eq i32 %32, 1347376211
br i1 %33, label %34, label %11
34: ; preds = %27, %0
ret i32 0
}