#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int atoi(char *);
char *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ iscntrl(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdin;
int main() {
  char buf[100], *p;
  int i, len;
  while (1) {
    p = fgets(buf, sizeof(buf), stdin);
    if (p == NULL)
      return 0;
    len = atoi(p);
    p = fgets(buf, sizeof(buf), stdin);
    if (p == NULL)
      return 0;
    for (i = 0; i < len; i++) {
      if (!iscntrl(buf[i]))
        putchar(buf[i]);
      else
        putchar('.');
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
mov    0x2e7b(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1060 <fgets@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    1194 <main+0x44>
movl   $0x0,-0x4(%rbp)
jmp    1238 <main+0xe8>
mov    -0x78(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x80(%rbp)
lea    -0x70(%rbp),%rdi
mov    0x2e3d(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1060 <fgets@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    11d2 <main+0x82>
movl   $0x0,-0x4(%rbp)
jmp    1238 <main+0xe8>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    1233 <main+0xe3>
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1040 <iscntrl@plt>
cmp    $0x0,%eax
jne    120f <main+0xbf>
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
jmp    1219 <main+0xc9>
mov    $0x2e,%edi
call   1030 <putchar@plt>
lea    0xde0(%rip),%rdi
call   1050 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    11d9 <main+0x89>
jmp    1162 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    0x2e97(%rip),%r14
mov    (%r14),%edx
mov    %rsp,%rdi
mov    $0x64,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11e0 <main+0xa0>
mov    %rsp,%r15
jmp    1185 <main+0x45>
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edx
mov    %r15,%rdi
mov    $0x64,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11e0 <main+0xa0>
mov    %rax,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    (%r14),%edx
mov    %r15,%rdi
mov    $0x64,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11e0 <main+0xa0>
test   %ebp,%ebp
jle    1170 <main+0x30>
mov    %ebp,%ebp
xor    %ebx,%ebx
jmp    11cb <main+0x8b>
xchg   %ax,%ax
movsbl %cl,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1170 <main+0x30>
movsbl (%rsp,%rbx,1),%edi
call   1040 <iscntrl@plt>
mov    $0x2e,%cl
test   %eax,%eax
jne    11b0 <main+0x70>
movzbl (%rsp,%rbx,1),%ecx
jmp    11b0 <main+0x70>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %0, %47
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i8* @fgets(i8* %7, i32 100, i32 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %6
store i32 0, i32* %1
br label %48
13: ; preds = %6
%14 = load i8*, i8** %3
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %5
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%17 = load i32, i32* @stdin
%18 = call i8* @fgets(i8* %16, i32 100, i32 %17)
store i8* %18, i8** %3
%19 = load i8*, i8** %3
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %22
21: ; preds = %13
store i32 0, i32* %1
br label %48
22: ; preds = %13
store i32 0, i32* %4
br label %23
23: ; preds = %44, %22
%24 = load i32, i32* %4
%25 = load i32, i32* %5
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %47
27: ; preds = %23
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = call i32 @iscntrl(i8 signext %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %40, label %34
34: ; preds = %27
%35 = load i32, i32* %4
%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 %42
40: ; preds = %27
%41 = call i32 @putchar(i8 signext 46)
br label %42
42: ; preds = %40, %34
%43 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %44
44: ; preds = %42
%45 = load i32, i32* %4
%46 = add nsw i32 %45, 1
store i32 %46, i32* %4
br label %23
47: ; preds = %23
br label %6
48: ; preds = %21, %12
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i8* @fgets(i8* %2, i32 100, i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %34, label %10
6: ; preds = %28, %16
%7 = load i32, i32* @stdin
%8 = call i8* @fgets(i8* %2, i32 100, i32 %7)
%9 = icmp eq i8* %8, null
br i1 %9, label %34, label %10
10: ; preds = %0, %6
%11 = phi i8* [ %8, %6 ], [ %4, %0 ]
%12 = call i32 @atoi(i8* %11)
%13 = load i32, i32* @stdin
%14 = call i8* @fgets(i8* %2, i32 100, i32 %13)
%15 = icmp eq i8* %14, null
br i1 %15, label %34, label %16
16: ; preds = %10
%17 = icmp sgt i32 %12, 0
br i1 %17, label %18, label %6
18: ; preds = %16
%19 = zext i32 %12 to i64
br label %20
20: ; preds = %18, %28
%21 = phi i64 [ 0, %18 ], [ %32, %28 ]
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = call i32 @iscntrl(i8 signext %23)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = load i8, i8* %22
br label %28
28: ; preds = %20, %26
%29 = phi i8 [ %27, %26 ], [ 46, %20 ]
%30 = call i32 @putchar(i8 signext %29)
%31 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
%32 = add nuw nsw i64 %21, 1
%33 = icmp eq i64 %32, %19
br i1 %33, label %6, label %20
34: ; preds = %6, %10, %0
ret i32 0
}