#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 */
scalar_t__ getch();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int main(void) {
  char c[20];
  char *p = c, *w = c;
  for (; p < w + 19; p++) {
    printf("\nPlease Enter a Char for %d: ", (int)(p - w));
    *p = (char)getch();
    printf("\nYou Entered %d number.\n", *p);
  }
  *p = '\0';
  printf("Enter over: You Entered:\n");
  puts(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
add    $0x13,%rcx
cmp    %rcx,%rax
jae    11b4 <main+0x84>
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
mov    -0x28(%rbp),%rax
movsbl (%rax),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    114f <main+0x1f>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x13(%rsp),%r12
lea    0xeb9(%rip),%r14
lea    0xed0(%rip),%r15
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
mov    %al,(%rsp,%rbx,1)
movsbl %al,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%rbx,1),%rax
add    $0x1,%rax
add    $0x1,%rbx
cmp    %r12,%rax
jb     1150 <main+0x20>
movb   $0x0,(%rsp,%rbx,1)
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"\0APlease Enter a Char for %d: \00"
@.str.1 = [25 x i8] c"\0AYou Entered %d number.\0A\00"
@.str.2 = [26 x i8] c"Enter over: You Entered:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
store i8* %5, i8** %3
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
store i8* %6, i8** %4
br label %7
7: ; preds = %27, %0
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 19
%11 = icmp ult i8* %8, %10
br i1 %11, label %12, label %30
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
%18 = trunc i64 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = call i64 (...) @getch()
%21 = trunc i64 %20 to i8
%22 = load i8*, i8** %3
store i8 %21, i8* %22
%23 = load i8*, i8** %3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %12
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %3
br label %7
30: ; preds = %7
%31 = load i8*, i8** %3
store i8 0, i8* %31
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%34 = call i32 @puts(i8* %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"\0APlease Enter a Char for %d: \00"
@.str.1 = [25 x i8] c"\0AYou Entered %d number.\0A\00"
@str = [25 x i8] c"Enter over: You Entered:\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 19
%4 = ptrtoint [20 x i8]* %1 to i64
br label %5
5: ; preds = %0, %5
%6 = phi i8* [ %2, %0 ], [ %15, %5 ]
%7 = ptrtoint i8* %6 to i64
%8 = sub i64 %7, %4
%9 = trunc i64 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i64 (...) @getch()
%12 = trunc i64 %11 to i8
store i8 %12, i8* %6
%13 = sext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds i8, i8* %6, i64 1
%16 = icmp ult i8* %15, %3
br i1 %16, label %5, label %17
17: ; preds = %5
store i8 0, i8* %15
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%19 = call i32 @puts(i8* %2)
ret i32 0
}