#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() {
  int i, n = 0;
  char a[100];
  printf("Insert text:\n");
  while (1) {
    scanf("%s", a);
    i = strlen(a);
    while (i != n) {
      if ((a[n] == 'S') && (a[n + 1] == 'T') && (a[n + 2] == 'O') &&
          (a[n + 3] == 'P')) {
        printf("\n");
        return 0;
      } else {
        if ((a[n] >= 'a') && (a[n] <= 'z')) {
          printf("%c", a[n] - 32);
        } else {
          printf("%c", a[n]);
        }
      }
      n++;
    }
    n = 0;
    printf(" ");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1253 <main+0x123>
movslq -0xc(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x53,%eax
jne    11e6 <main+0xb6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x54,%eax
jne    11e6 <main+0xb6>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
cltq
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x4f,%eax
jne    11e6 <main+0xb6>
mov    -0xc(%rbp),%eax
add    $0x3,%eax
cltq
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x50,%eax
jne    11e6 <main+0xb6>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret
movslq -0xc(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     1229 <main+0xf9>
movslq -0xc(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     1229 <main+0xf9>
movslq -0xc(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%esi
sub    $0x20,%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1240 <main+0x110>
movslq -0xc(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%esi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1245 <main+0x115>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1170 <main+0x40>
movl   $0x0,-0xc(%rbp)
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1154 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
lea    0xea2(%rip),%r14
mov    %rsp,%r15
jmp    117a <main+0x3a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    %r15,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
je     1170 <main+0x30>
mov    %eax,%r12d
xor    %ebx,%ebx
jmp    11ae <main+0x6e>
nopl   0x0(%rax,%rax,1)
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     1170 <main+0x30>
movsbl (%rsp,%rbx,1),%eax
cmp    $0x53,%eax
jne    11e0 <main+0xa0>
mov    $0x53,%edi
cmpb   $0x54,0x1(%rsp,%rbx,1)
jne    11a0 <main+0x60>
cmpb   $0x4f,0x2(%rsp,%rbx,1)
jne    11a0 <main+0x60>
cmpb   $0x50,0x3(%rsp,%rbx,1)
jne    11a0 <main+0x60>
jmp    11ee <main+0xae>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    -0x61(%rax),%ecx
lea    -0x20(%rax),%edi
cmp    $0x1a,%cl
cmovae %eax,%edi
jmp    11a0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [13 x i8] c"Insert text:\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %43, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 @strlen(i8* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %43, label %8
8: ; preds = %4
%9 = zext i32 %6 to i64
br label %10
10: ; preds = %8, %38
%11 = phi i64 [ 0, %8 ], [ %41, %38 ]
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 83
br i1 %14, label %15, label %32
15: ; preds = %10
%16 = add nuw nsw i64 %11, 1
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 84
br i1 %19, label %20, label %38
20: ; preds = %15
%21 = add nuw nsw i64 %11, 2
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 79
br i1 %24, label %25, label %38
25: ; preds = %20
%26 = add nuw nsw i64 %11, 3
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 80
br i1 %29, label %30, label %38
30: ; preds = %25
%31 = call i32 @putchar(i32 10)
ret i32 0
32: ; preds = %10
%33 = sext i8 %13 to i32
%34 = add i8 %13, -97
%35 = icmp ult i8 %34, 26
%36 = add nsw i32 %33, -32
%37 = select i1 %35, i32 %36, i32 %33
br label %38
38: ; preds = %32, %25, %20, %15
%39 = phi i32 [ 83, %25 ], [ 83, %20 ], [ 83, %15 ], [ %37, %32 ]
%40 = call i32 @putchar(i32 %39)
%41 = add nuw nsw i64 %11, 1
%42 = icmp eq i64 %41, %9
br i1 %42, label %43, label %10
43: ; preds = %38, %4
%44 = call i32 @putchar(i32 32)
br label %4
}