#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 *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(void) {
  char s[3025];
  int n;
  int j;
  int len;
  int l;
  char x;
  scanf("%s", s);
  n = 0;
  j = 0;
  x = s[n];
  if (strcmp(s, "STOP") == 0) {
    return 0;
  }
  l = 0;
  len = strlen(s);
  while (l < len) {
    if (x >= 48 && x <= 57) {
      printf("%c", x);
      j = 1;
    }
    if (x == ' ') {
      printf(" ");
    }
    if (j != 1) {
      x -= 32;
      printf("%c", x);
    }
    j = 0;
    n++;
    x = s[n];
    l++;
  }
  printf("\n");
  strcpy(s, " ");
  main();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc00,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xbe0(%rbp),%rsi
lea    0xe80(%rip),%rdi
call   1080 <scanf@plt>
movl   $0x0,-0xbe4(%rbp)
movl   $0x0,-0xbe8(%rbp)
movslq -0xbe4(%rbp),%rax
mov    -0xbe0(%rbp,%rax,1),%al
mov    %al,-0xbf1(%rbp)
lea    -0xbe0(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11d6 <main+0x76>
movl   $0x0,-0x4(%rbp)
jmp    1301 <main+0x1a1>
movl   $0x0,-0xbf0(%rbp)
lea    -0xbe0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xbec(%rbp)
mov    -0xbf0(%rbp),%eax
cmp    -0xbec(%rbp),%eax
jge    12d4 <main+0x174>
movsbl -0xbf1(%rbp),%eax
cmp    $0x30,%eax
jl     1243 <main+0xe3>
movsbl -0xbf1(%rbp),%eax
cmp    $0x39,%eax
jg     1243 <main+0xe3>
movsbl -0xbf1(%rbp),%esi
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0xbe8(%rbp)
movsbl -0xbf1(%rbp),%eax
cmp    $0x20,%eax
jne    1261 <main+0x101>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x1,-0xbe8(%rbp)
je     1293 <main+0x133>
movsbl -0xbf1(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0xbf1(%rbp)
movsbl -0xbf1(%rbp),%esi
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xbe8(%rbp)
mov    -0xbe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbe4(%rbp)
movslq -0xbe4(%rbp),%rax
mov    -0xbe0(%rbp,%rax,1),%al
mov    %al,-0xbf1(%rbp)
mov    -0xbf0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbf0(%rbp)
jmp    11f2 <main+0x92>
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xbe0(%rbp),%rdi
lea    0xd1b(%rip),%rsi
call   1030 <strcpy@plt>
call   1070 <main@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc00,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xbe0,%rsp
lea    0xe8d(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1080 <scanf@plt>
mov    (%rsp),%r15b
lea    0xe7a(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1210 <main+0xb0>
mov    %rsp,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    11f2 <main+0x92>
mov    %eax,%r14d
xor    %ebx,%ebx
jmp    11cc <main+0x6c>
nopl   0x0(%rax)
add    $0xe0,%r15b
movsbl %r15b,%edi
call   1030 <putchar@plt>
movzbl 0x1(%rsp,%rbx,1),%r15d
add    $0x1,%rbx
cmp    %rbx,%r14
je     11f2 <main+0x92>
lea    -0x30(%r15),%eax
cmp    $0xa,%al
jae    11e0 <main+0x80>
movzbl %r15b,%edi
jmp    11b8 <main+0x58>
nopw   0x0(%rax,%rax,1)
cmp    $0x20,%r15b
jne    11b0 <main+0x50>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    11b0 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe05(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcpy@plt>
call   1070 <main@plt>
xor    %eax,%eax
add    $0xbe0,%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"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3025 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %1
%8 = getelementptr inbounds [3025 x i8], [3025 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
store i32 0, i32* %3
store i32 0, i32* %4
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [3025 x i8], [3025 x i8]* %2, i64 0, i64 %11
%13 = load i8, i8* %12
store i8 %13, i8* %7
%14 = getelementptr inbounds [3025 x i8], [3025 x i8]* %2, i64 0, i64 0
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %0
store i32 0, i32* %1
br label %68
18: ; preds = %0
store i32 0, i32* %6
%19 = getelementptr inbounds [3025 x i8], [3025 x i8]* %2, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
store i32 %20, i32* %5
br label %21
21: ; preds = %54, %18
%22 = load i32, i32* %6
%23 = load i32, i32* %5
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %63
25: ; preds = %21
%26 = load i8, i8* %7
%27 = sext i8 %26 to i32
%28 = icmp sge i32 %27, 48
br i1 %28, label %29, label %37
29: ; preds = %25
%30 = load i8, i8* %7
%31 = sext i8 %30 to i32
%32 = icmp sle i32 %31, 57
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i8, i8* %7
%35 = sext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %35)
store i32 1, i32* %4
br label %37
37: ; preds = %33, %29, %25
%38 = load i8, i8* %7
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 32
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41, %37
%44 = load i32, i32* %4
%45 = icmp ne i32 %44, 1
br i1 %45, label %46, label %54
46: ; preds = %43
%47 = load i8, i8* %7
%48 = sext i8 %47 to i32
%49 = sub nsw i32 %48, 32
%50 = trunc i32 %49 to i8
store i8 %50, i8* %7
%51 = load i8, i8* %7
%52 = sext i8 %51 to i32
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %46, %43
store i32 0, i32* %4
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
%57 = load i32, i32* %3
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [3025 x i8], [3025 x i8]* %2, i64 0, i64 %58
%60 = load i8, i8* %59
store i8 %60, i8* %7
%61 = load i32, i32* %6
%62 = add nsw i32 %61, 1
store i32 %62, i32* %6
br label %21
63: ; preds = %21
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%65 = getelementptr inbounds [3025 x i8], [3025 x i8]* %2, i64 0, i64 0
%66 = call i32 @strcpy(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%67 = call i32 @main()
store i32 0, i32* %1
br label %68
68: ; preds = %63, %17
%69 = load i32, i32* %1
ret i32 %69
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"STOP\00"
@.str.3 = [2 x i8] c" \00"
define i32 @main() {
%1 = alloca [3025 x i8]
%2 = getelementptr inbounds [3025 x i8], [3025 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 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %37, label %7
7: ; preds = %0
%8 = call i32 @strlen(i8* %2)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %33
10: ; preds = %7
%11 = zext i32 %8 to i64
br label %12
12: ; preds = %10, %26
%13 = phi i64 [ 0, %10 ], [ %29, %26 ]
%14 = phi i8 [ %4, %10 ], [ %31, %26 ]
%15 = add i8 %14, -48
%16 = icmp ult i8 %15, 10
br i1 %16, label %21, label %17
17: ; preds = %12
%18 = icmp eq i8 %14, 32
br i1 %18, label %19, label %23
19: ; preds = %17
%20 = call i32 @putchar(i32 32)
br label %23
21: ; preds = %12
%22 = zext i8 %14 to i32
br label %26
23: ; preds = %19, %17
%24 = add i8 %14, -32
%25 = sext i8 %24 to i32
br label %26
26: ; preds = %21, %23
%27 = phi i32 [ %22, %21 ], [ %25, %23 ]
%28 = call i32 @putchar(i32 %27)
%29 = add nuw nsw i64 %13, 1
%30 = getelementptr inbounds [3025 x i8], [3025 x i8]* %1, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = icmp eq i64 %29, %11
br i1 %32, label %33, label %12
33: ; preds = %26, %7
%34 = call i32 @putchar(i32 10)
%35 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%36 = call i32 @main()
br label %37
37: ; preds = %0, %33
ret i32 0
}