#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
size_t strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int main() {
  char input[21];
  fgets(input, 21 - 1, stdin);
  size_t length = strlen(input);
  char star[21 - length];
  if (input[length - 1] == '\n') {
    input[length - 1] = '\0';
  }
  if (length < 21) {
    memset(star, '*', 20 - length);
    star[21 - 1] = '\0';
    strncat(input, star, 21);
  }
  printf("%s", input);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rdi
mov    %rdi,-0x48(%rbp)
mov    $0x14,%esi
call   1070 <fgets@plt>
mov    -0x48(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
mov    $0x15,%eax
sub    %rcx,%rax
mov    %rsp,%rdx
mov    %rdx,-0x30(%rbp)
mov    $0x24,%edx
sub    %rcx,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0xa,%eax
jne    11da <main+0x8a>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movb   $0x0,-0x20(%rbp,%rax,1)
cmpq   $0x15,-0x28(%rbp)
jae    1214 <main+0xc4>
mov    -0x40(%rbp),%rdi
mov    $0x14,%eax
sub    -0x28(%rbp),%rax
mov    %eax,%edx
mov    $0x2a,%esi
call   1050 <memset@plt>
mov    -0x40(%rbp),%rsi
movb   $0x0,0x14(%rsi)
lea    -0x20(%rbp),%rdi
mov    $0x15,%edx
call   1060 <strncat@plt>
lea    -0x20(%rbp),%rsi
lea    0xde1(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2e84(%rip),%rax
mov    (%rax),%edx
lea    -0x30(%rbp),%r14
mov    %r14,%rdi
mov    $0x14,%esi
call   1070 <fgets@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rsp,%r15
mov    $0x24,%ecx
sub    %rax,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rbx
sub    %rcx,%rbx
mov    %rbx,%rsp
cmpb   $0xa,-0x1(%rax,%r14,1)
jne    11a4 <main+0x54>
movb   $0x0,-0x31(%rbp,%rax,1)
cmp    $0x14,%rax
ja     11d3 <main+0x83>
mov    $0x14,%edx
sub    %eax,%edx
mov    %rbx,%rdi
mov    $0x2a,%esi
call   1050 <memset@plt>
movb   $0x0,0x14(%rbx)
lea    -0x30(%rbp),%rdi
mov    %rbx,%rsi
mov    $0x15,%edx
call   1060 <strncat@plt>
lea    0xe26(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <printf@plt>
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 20, i32 %3)
%5 = call i64 @strlen(i8* %2)
%6 = sub i64 21, %5
%7 = call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = add i64 %5, -1
%10 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 10
br i1 %12, label %13, label %14
13: ; preds = %0
store i8 0, i8* %10
br label %14
14: ; preds = %13, %0
%15 = icmp ult i64 %5, 21
br i1 %15, label %16, label %22
16: ; preds = %14
%17 = trunc i64 %5 to i32
%18 = sub nuw nsw i32 20, %17
%19 = call i32 @memset(i8* %8, i8 signext 42, i32 %18)
%20 = getelementptr inbounds i8, i8* %8, i64 20
store i8 0, i8* %20
%21 = call i32 @strncat(i8* %2, i8* %8, i32 21)
br label %22
22: ; preds = %16, %14
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}