#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 /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int main() {
  char s[80];
  int i = 0;
  do {
    i = 0;
    scanf("%s", s);
    while (s[i] != '\0') {
      if (s[i] >= 'a' && s[i] <= 'z') {
        s[i] = s[i] - ('a' - 'A');
        i++;
      }
    }
    printf("%s", s);
  } while (strcmp(s, "STOP") != 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x64(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1050 <scanf@plt>
movslq -0x64(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11b7 <main+0x87>
movslq -0x64(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     11b2 <main+0x82>
movslq -0x64(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     11b2 <main+0x82>
movslq -0x64(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
sub    $0x20,%eax
mov    %al,%cl
movslq -0x64(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    115d <main+0x2d>
lea    -0x60(%rbp),%rsi
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1146 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
lea    0xec0(%rip),%r14
mov    %rsp,%rbx
lea    0xeb9(%rip),%r15
jmp    116b <main+0x3b>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b2 <main+0x82>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%cl
test   %cl,%cl
je     1150 <main+0x20>
xor    %eax,%eax
mov    %rbx,%rdx
jmp    119f <main+0x6f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %eax,%rcx
lea    (%rsp,%rcx,1),%rdx
movzbl (%rsp,%rcx,1),%ecx
test   %cl,%cl
je     1150 <main+0x20>
lea    -0x61(%rcx),%esi
cmp    $0x19,%sil
ja     1190 <main+0x60>
add    $0xe0,%cl
mov    %cl,(%rdx)
add    $0x1,%eax
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"STOP\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %45, %0
store i32 0, i32* %3
%5 = getelementptr inbounds [80 x i8], [80 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)
br label %7
7: ; preds = %41, %4
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %42
14: ; preds = %7
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp sge i32 %19, 97
br i1 %20, label %21, label %41
21: ; preds = %14
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sle i32 %26, 122
br i1 %27, label %28, label %41
28: ; preds = %21
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 32
%35 = trunc i32 %34 to i8
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %37
store i8 %35, i8* %38
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %41
41: ; preds = %28, %21, %14
br label %7
42: ; preds = %7
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%44 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %42
%46 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %4, label %49
49: ; preds = %45
%50 = load i32, i32* %1
ret i32 %50
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"STOP\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %22, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %22, label %7
7: ; preds = %3, %16
%8 = phi i8 [ %20, %16 ], [ %5, %3 ]
%9 = phi i8* [ %19, %16 ], [ %2, %3 ]
%10 = phi i32 [ %17, %16 ], [ 0, %3 ]
%11 = add i8 %8, -97
%12 = icmp ult i8 %11, 26
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = add nsw i8 %8, -32
store i8 %14, i8* %9
%15 = add nsw i32 %10, 1
br label %16
16: ; preds = %13, %7
%17 = phi i32 [ %15, %13 ], [ %10, %7 ]
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %7
22: ; preds = %16, %3
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%24 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %3
26: ; preds = %22
ret i32 0
}