#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 *);
void main(void) {
  char a[1000];
  printf("\nwrith something");
  printf("\nSTOP to end\n");
  scanf("%s", a);
  while (!(a[0] == 'S' && a[1] == 'T' && a[2] == 'O' && a[3] == 'P' &&
           a[4] == '\0')) {
    int b = 0;
    while (a[b] != '\0') {
      if (a[b] >= 'a' && a[b] <= 'z') {
        a[b] -= 32;
      }
      b = b + 1;
    }
    printf("%s\n", a);
    scanf("%s", a);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xeca(%rip),%rdi
call   1040 <scanf@plt>
movsbl -0x3f0(%rbp),%ecx
xor    %eax,%eax
cmp    $0x53,%ecx
mov    %al,-0x3f5(%rbp)
jne    11cd <main+0xad>
movsbl -0x3ef(%rbp),%ecx
xor    %eax,%eax
cmp    $0x54,%ecx
mov    %al,-0x3f5(%rbp)
jne    11cd <main+0xad>
movsbl -0x3ee(%rbp),%ecx
xor    %eax,%eax
cmp    $0x4f,%ecx
mov    %al,-0x3f5(%rbp)
jne    11cd <main+0xad>
movsbl -0x3ed(%rbp),%ecx
xor    %eax,%eax
cmp    $0x50,%ecx
mov    %al,-0x3f5(%rbp)
jne    11cd <main+0xad>
movsbl -0x3ec(%rbp),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x3f5(%rbp)
mov    -0x3f5(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    11e2 <main+0xc2>
jmp    128e <main+0x16e>
movl   $0x0,-0x3f4(%rbp)
movslq -0x3f4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     1261 <main+0x141>
movslq -0x3f4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x61,%eax
jl     124d <main+0x12d>
movslq -0x3f4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x7a,%eax
jg     124d <main+0x12d>
movslq -0x3f4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%ecx
ff
sub    $0x20,%ecx
mov    %cl,-0x3f0(%rbp,%rax,1)
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    11ec <main+0xcc>
lea    -0x3f0(%rbp),%rsi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xd9b(%rip),%rdi
call   1040 <scanf@plt>
jmp    115a <main+0x3a>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
movdqa 0x10(%rsp),%xmm0
movd   %xmm0,%eax
cmp    $0x504f5453,%eax
jne    117f <main+0x4f>
cmpb   $0x0,0x14(%rsp)
je     11f5 <main+0xc5>
lea    0x11(%rsp),%r15
lea    0x10(%rsp),%rbx
lea    0xe81(%rip),%r14
test   %al,%al
je     11c0 <main+0x90>
mov    %r15,%rcx
jmp    11ab <main+0x7b>
nopl   0x0(%rax)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
je     11c0 <main+0x90>
lea    -0x61(%rax),%edx
cmp    $0x19,%dl
ja     11a0 <main+0x70>
add    $0xe0,%al
mov    %al,-0x1(%rcx)
jmp    11a0 <main+0x70>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movdqa 0x10(%rsp),%xmm0
movd   %xmm0,%edx
mov    0x14(%rsp),%cl
movdqa %xmm0,(%rsp)
mov    (%rsp),%al
cmp    $0x504f5453,%edx
jne    1190 <main+0x60>
test   %cl,%cl
jne    1190 <main+0x60>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0Awrith something\00"
@.str.1 = [14 x i8] c"\0ASTOP to end\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [1000 x i8]
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
br label %7
7: ; preds = %68, %0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, 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 %32
12: ; preds = %7
%13 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, 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 %32
17: ; preds = %12
%18 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, 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 %32
22: ; preds = %17
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, 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 %32
27: ; preds = %22
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 4
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 0
br label %32
32: ; preds = %27, %22, %17, %12, %7
%33 = phi i1 [ false, %22 ], [ false, %17 ], [ false, %12 ], [ false, %7 ], [ %31, %27 ]
%34 = xor i1 %33, true
br i1 %34, label %35, label %73
35: ; preds = %32
store i32 0, i32* %2
br label %36
36: ; preds = %65, %35
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %68
43: ; preds = %36
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp sge i32 %48, 97
br i1 %49, label %50, label %65
50: ; preds = %43
%51 = load i32, i32* %2
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp sle i32 %55, 122
br i1 %56, label %57, label %65
57: ; preds = %50
%58 = load i32, i32* %2
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = sub nsw i32 %62, 32
%64 = trunc i32 %63 to i8
store i8 %64, i8* %60
br label %65
65: ; preds = %57, %50, %43
%66 = load i32, i32* %2
%67 = add nsw i32 %66, 1
store i32 %67, i32* %2
br label %36
68: ; preds = %36
%69 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %69)
%71 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%72 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %71)
br label %7
73: ; preds = %32
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0Awrith something\00"
@.str.2 = [3 x i8] c"%s\00"
@str = [13 x i8] c"\0ASTOP to end\00"
define void @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 4
%7 = bitcast [1000 x i8]* %1 to <4 x i8>*
%8 = load <4 x i8>, <4 x i8>* %7
%9 = freeze <4 x i8> %8
%10 = bitcast <4 x i8> %9 to i32
%11 = icmp eq i32 %10, 1347376211
%12 = load i8, i8* %6
%13 = icmp eq i8 %12, 0
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %45, label %15
15: ; preds = %0
%16 = extractelement <4 x i8> %9, i64 0
%17 = bitcast [1000 x i8]* %1 to <4 x i8>*
br label %18
18: ; preds = %15, %34
%19 = phi i8 [ %44, %34 ], [ %16, %15 ]
%20 = icmp eq i8 %19, 0
br i1 %20, label %34, label %21
21: ; preds = %18, %29
%22 = phi i64 [ %30, %29 ], [ 0, %18 ]
%23 = phi i8 [ %32, %29 ], [ %19, %18 ]
%24 = phi i8* [ %31, %29 ], [ %2, %18 ]
%25 = add i8 %23, -97
%26 = icmp ult i8 %25, 26
br i1 %26, label %27, label %29
27: ; preds = %21
%28 = add nsw i8 %23, -32
store i8 %28, i8* %24
br label %29
29: ; preds = %27, %21
%30 = add nuw i64 %22, 1
%31 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %21
34: ; preds = %29, %18
%35 = call i32 @puts(i8* %2)
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%37 = load <4 x i8>, <4 x i8>* %17
%38 = freeze <4 x i8> %37
%39 = bitcast <4 x i8> %38 to i32
%40 = icmp eq i32 %39, 1347376211
%41 = load i8, i8* %6
%42 = icmp eq i8 %41, 0
%43 = select i1 %40, i1 %42, i1 false
%44 = extractelement <4 x i8> %38, i64 0
br i1 %43, label %45, label %18
45: ; preds = %34, %0
ret void
}