#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 *, char *);
int main() {
  char username[15] = "chaudhary";
  char password[15] = "letmein";
  char input[15];
  char in;
  int i;
  for (i = 0; in = getch() && in != '\n'; i++) {
    input[i] = in;
  }
  printf("You entered: %s\n", input);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xec2(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xeba(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x22(%rbp)
mov    0xeaf(%rip),%eax
mov    %eax,-0x1a(%rbp)
mov    0xea9(%rip),%ax
mov    %ax,-0x16(%rbp)
mov    0xea1(%rip),%al
mov    %al,-0x14(%rbp)
movl   $0x0,-0x38(%rbp)
mov    $0x0,%al
call   1040 <getch@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x39(%rbp)
je     11ac <main+0x8c>
movsbl -0x32(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x32(%rbp)
cmp    $0x0,%al
je     11d8 <main+0xb8>
mov    -0x32(%rbp),%cl
movslq -0x38(%rbp),%rax
mov    %cl,-0x31(%rbp,%rax,1)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1186 <main+0x66>
lea    -0x31(%rbp),%rsi
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <getch@plt>
test   %rax,%rax
je     1153 <main+0x33>
lea    0x1(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
movb   $0x1,(%rbx)
xor    %eax,%eax
call   1040 <getch@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1140 <main+0x20>
lea    0xea6(%rip),%rdi
lea    0x1(%rsp),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.username = [15 x i8] c"chaudhary\00\00\00\00\00\00"
@__const.main.password = [15 x i8] c"letmein\00\00\00\00\00\00\00\00"
@.str = [17 x i8] c"You entered: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [15 x i8]
%4 = alloca [15 x i8]
%5 = alloca i8
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [15 x i8]* %2 to i8*
%8 = bitcast [15 x i8]* %3 to i8*
store i32 0, i32* %6
br label %9
9: ; preds = %26, %0
%10 = call i64 (...) @getch()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 10
br label %16
16: ; preds = %12, %9
%17 = phi i1 [ false, %9 ], [ %15, %12 ]
%18 = zext i1 %17 to i32
%19 = trunc i32 %18 to i8
store i8 %19, i8* %5
%20 = icmp ne i8 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %16
%22 = load i8, i8* %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 %24
store i8 %22, i8* %25
br label %26
26: ; preds = %21
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %9
29: ; preds = %16
%30 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%31 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [17 x i8] c"You entered: %s\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%3 = tail call i64 (...) @getch()
%4 = icmp eq i64 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %0, %5
%6 = phi i64 [ %8, %5 ], [ 0, %0 ]
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 %6
store i8 1, i8* %7
%8 = add nuw i64 %6, 1
%9 = tail call i64 (...) @getch()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %5
11: ; preds = %5, %0
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}