#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 tolower(char);
int toupper(char);
int main() {
  char c[100];
  char ch;
  short i = 0;
  scanf("%s", c);
  while (c[i] != '\0') {
    printf("%c", toupper(c[i]));
    i++;
  }
  printf("\n");
  i = 0;
  while (c[i] != '\0') {
    printf("%c", tolower(c[i]));
    i++;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x0,-0x74(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1060 <scanf@plt>
movswq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11ab <main+0x6b>
movswq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1030 <toupper@plt>
mov    %eax,%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x74(%rbp)
jmp    1168 <main+0x28>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movw   $0x0,-0x74(%rbp)
movswq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1202 <main+0xc2>
movswq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1050 <tolower@plt>
mov    %eax,%esi
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x74(%rbp)
jmp    11bf <main+0x7f>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xeb4(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%al
test   %al,%al
je     117e <main+0x3e>
mov    $0x1,%bx
nop
movsbl %al,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
movswq %bx,%rax
movzbl (%rsp,%rax,1),%eax
add    $0x1,%ebx
test   %al,%al
jne    1160 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rsp),%al
test   %al,%al
je     11be <main+0x7e>
mov    $0x1,%bx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1050 <tolower@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
movswq %bx,%rax
movzbl (%rsp,%rax,1),%eax
add    $0x1,%ebx
test   %al,%al
jne    11a0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8
%4 = alloca i16
store i32 0, i32* %1
store i16 0, i16* %4
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %7
7: ; preds = %14, %0
%8 = load i16, i16* %4
%9 = sext i16 %8 to i64
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %7
%15 = load i16, i16* %4
%16 = sext i16 %15 to i64
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = call i32 @toupper(i8 signext %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = load i16, i16* %4
%22 = add i16 %21, 1
store i16 %22, i16* %4
br label %7
23: ; preds = %7
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i16 0, i16* %4
br label %25
25: ; preds = %32, %23
%26 = load i16, i16* %4
%27 = sext i16 %26 to i64
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %41
32: ; preds = %25
%33 = load i16, i16* %4
%34 = sext i16 %33 to i64
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = call i32 @tolower(i8 signext %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = load i16, i16* %4
%40 = add i16 %39, 1
store i16 %40, i16* %4
br label %25
41: ; preds = %25
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 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 = icmp eq i8 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %0, %6
%7 = phi i8 [ %14, %6 ], [ %4, %0 ]
%8 = phi i16 [ %11, %6 ], [ 0, %0 ]
%9 = call i32 @toupper(i8 signext %7)
%10 = call i32 @putchar(i32 %9)
%11 = add i16 %8, 1
%12 = sext i16 %11 to i64
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6, %0
%17 = call i32 @putchar(i32 10)
%18 = load i8, i8* %2
%19 = icmp eq i8 %18, 0
br i1 %19, label %30, label %20
20: ; preds = %16, %20
%21 = phi i8 [ %28, %20 ], [ %18, %16 ]
%22 = phi i16 [ %25, %20 ], [ 0, %16 ]
%23 = call i32 @tolower(i8 signext %21)
%24 = call i32 @putchar(i32 %23)
%25 = add i16 %22, 1
%26 = sext i16 %25 to i64
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %20
30: ; preds = %20, %16
%31 = call i32 @putchar(i32 10)
ret i32 0
}