#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 *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char str[500];
  int i;
  printf("Enter a sentence :\n");
  while (1) {
    scanf("%s", str);
    if (str[0] == 'S' && str[1] == 'T' && str[2] == 'O' && str[3] == 'P')
      break;
    for (i = 0; i < strlen(str); i++) {
      if (str[i] >= 'a' && str[i] <= 'z')
        str[i] = str[i] - 32;
    }
    printf("\n%s ", str);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x200(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1050 <scanf@plt>
movsbl -0x200(%rbp),%eax
cmp    $0x53,%eax
jne    11a8 <main+0x78>
movsbl -0x1ff(%rbp),%eax
cmp    $0x54,%eax
jne    11a8 <main+0x78>
movsbl -0x1fe(%rbp),%eax
cmp    $0x4f,%eax
jne    11a8 <main+0x78>
movsbl -0x1fd(%rbp),%eax
cmp    $0x50,%eax
jne    11a8 <main+0x78>
jmp    125f <main+0x12f>
movl   $0x0,-0x204(%rbp)
mov    -0x204(%rbp),%eax
mov    %eax,-0x208(%rbp)
lea    -0x200(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x208(%rbp),%eax
cmp    %ecx,%eax
jge    1245 <main+0x115>
movslq -0x204(%rbp),%rax
movsbl -0x200(%rbp,%rax,1),%eax
ff
cmp    $0x61,%eax
jl     122c <main+0xfc>
movslq -0x204(%rbp),%rax
movsbl -0x200(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     122c <main+0xfc>
movslq -0x204(%rbp),%rax
movsbl -0x200(%rbp,%rax,1),%eax
ff
sub    $0x20,%eax
mov    %al,%cl
movslq -0x204(%rbp),%rax
mov    %cl,-0x200(%rbp,%rax,1)
jmp    1231 <main+0x101>
mov    -0x204(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x204(%rbp)
jmp    11b2 <main+0x82>
lea    -0x200(%rbp),%rsi
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1150 <main+0x20>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1f8,%rsp
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
movdqa (%rsp),%xmm0
movd   %xmm0,%eax
cmp    $0x504f5453,%eax
jne    118a <main+0x4a>
xor    %eax,%eax
add    $0x1f8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %rsp,%r12
lea    0xe6f(%rip),%r14
lea    0xe65(%rip),%r15
jmp    11c8 <main+0x88>
nopl   (%rax)
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
movdqa (%rsp),%xmm0
movd   %xmm0,%eax
cmp    $0x504f5453,%eax
je     1179 <main+0x39>
mov    %r12,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11a0 <main+0x60>
xor    %ebx,%ebx
jmp    11f3 <main+0xb3>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11a0 <main+0x60>
movzbl (%rsp,%rbx,1),%eax
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     11e0 <main+0xa0>
add    $0xe0,%al
mov    %al,(%rsp,%rbx,1)
jmp    11e0 <main+0xa0>

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

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