#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 stringOrLetter[20];
  int i;
  printf("Word Or Letter");
  scanf("%s", stringOrLetter);
  printf("The string is->%s", stringOrLetter);
  for (i = 0; i <= strlen(stringOrLetter); i++) {
    if (stringOrLetter[i] >= 97 && stringOrLetter[i] <= 122)
      stringOrLetter[i] = stringOrLetter[i] - 32;
  }
  printf("\nThe string in lower case is->%s\n", stringOrLetter);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x20(%rbp),%rsi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
jg     11df <main+0xaf>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     11cc <main+0x9c>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     11cc <main+0x9c>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
sub    $0x20,%eax
mov    %al,%cl
movslq -0x24(%rbp),%rax
mov    %cl,-0x20(%rbp,%rax,1)
jmp    11d1 <main+0xa1>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1176 <main+0x46>
lea    -0x20(%rbp),%rsi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
js     11a8 <main+0x78>
mov    $0xffffffffffffffff,%rbx
mov    %rsp,%r14
jmp    1193 <main+0x63>
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
add    $0x1,%rbx
cmp    %rax,%rbx
jge    11a8 <main+0x78>
movzbl 0x1(%rsp,%rbx,1),%eax
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1180 <main+0x50>
add    $0xe0,%al
mov    %al,0x1(%rsp,%rbx,1)
jmp    1180 <main+0x50>
lea    0xe72(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Word Or Letter\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [18 x i8] c"The string is->%s\00"
@.str.3 = [34 x i8] c"\0AThe string in lower case is->%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %7)
store i32 0, i32* %3
br label %9
9: ; preds = %40, %0
%10 = load i32, i32* %3
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = icmp sle i32 %10, %12
br i1 %13, label %14, label %43
14: ; preds = %9
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [20 x i8], [20 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 %39
21: ; preds = %14
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [20 x i8], [20 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 %39
28: ; preds = %21
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [20 x i8], [20 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 [20 x i8], [20 x i8]* %2, i64 0, i64 %37
store i8 %35, i8* %38
br label %39
39: ; preds = %28, %21, %14
br label %40
40: ; preds = %39
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %9
43: ; preds = %9
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Word Or Letter\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [18 x i8] c"The string is->%s\00"
@.str.3 = [34 x i8] c"\0AThe string in lower case is->%s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%6 = call i32 @strlen(i8* %2)
%7 = icmp slt i32 %6, 0
br i1 %7, label %21, label %8
8: ; preds = %0, %16
%9 = phi i64 [ %17, %16 ], [ 0, %0 ]
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = add i8 %11, -97
%13 = icmp ult i8 %12, 26
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = add nsw i8 %11, -32
store i8 %15, i8* %10
br label %16
16: ; preds = %8, %14
%17 = add nuw nsw i64 %9, 1
%18 = call i32 @strlen(i8* %2)
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %9, %19
br i1 %20, label %8, label %21
21: ; preds = %16, %0
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %2)
ret i32 0
}