#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 */
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
void main() {
  char ch, f[100];
  int i, a;
  printf("Input\n");
  for (i = 0; (f[i] = getchar()) != '\n'; i++) {
    f[i] = f[i] - 'a' + 'A';
  }
  a = i;
  for (i = 0; i <= a; i++) {
    putchar(f[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x74(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
movslq -0x74(%rbp),%rcx
mov    %al,-0x70(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     1190 <main+0x60>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %al,%cl
movslq -0x74(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    114e <main+0x1e>
mov    -0x74(%rbp),%eax
mov    %eax,-0x78(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x78(%rbp),%eax
jg     11c5 <main+0x95>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    119d <main+0x6d>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,(%rsp)
mov    $0x1,%r14d
cmp    $0xa,%al
je     117b <main+0x4b>
mov    $0x1,%ebx
nopl   0x0(%rax)
add    $0xe0,%al
mov    %al,-0x1(%rsp,%rbx,1)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1160 <main+0x30>
mov    %ebx,%r14d
xor    %ebx,%ebx
nopl   (%rax)
movsbl (%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1180 <main+0x50>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@str = [6 x i8] c"Input\00"
define void @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 ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%4 = tail call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = icmp eq i8 %4, 10
br i1 %5, label %9, label %11
6: ; preds = %11
%7 = add i64 %12, 2
%8 = and i64 %7, 4294967295
br label %9
9: ; preds = %6, %0
%10 = phi i64 [ 1, %0 ], [ %8, %6 ]
br label %20
11: ; preds = %0, %11
%12 = phi i64 [ %16, %11 ], [ 0, %0 ]
%13 = phi i8* [ %18, %11 ], [ %2, %0 ]
%14 = phi i8 [ %17, %11 ], [ %4, %0 ]
%15 = add i8 %14, -32
store i8 %15, i8* %13
%16 = add nuw i64 %12, 1
%17 = tail call signext i8 (...) @getchar()
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %16
store i8 %17, i8* %18
%19 = icmp eq i8 %17, 10
br i1 %19, label %6, label %11
20: ; preds = %9, %20
%21 = phi i64 [ 0, %9 ], [ %25, %20 ]
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = tail call i32 @putchar(i8 signext %23)
%25 = add nuw nsw i64 %21, 1
%26 = icmp eq i64 %25, %10
br i1 %26, label %27, label %20
27: ; preds = %20
ret void
}