#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 EOF;
char getchar();
void faststring(char *arr) {
  register char c = getchar();
  register int i = 0;
  while (c < 33)
    c = getchar();
  while (c != '\n' && c != EOF) {
    arr[i] = c;
    c = getchar();
    i = i + 1;
  }
  arr[i] = '\0';
}


x86 assembly (clang, -O0):
<faststring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x21,%eax
jge    1149 <faststring+0x39>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x9(%rbp)
jmp    112d <faststring+0x1d>
jmp    114e <faststring+0x3e>
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x11(%rbp)
je     1176 <faststring+0x66>
movsbl -0x9(%rbp),%eax
mov    0x2e7d(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1186 <faststring+0x76>
jmp    11ac <faststring+0x9c>
mov    -0x9(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x9(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114e <faststring+0x3e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<faststring>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0x20,%al
jg     113b <faststring+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0x21,%al
jl     1130 <faststring+0x20>
mov    0x2ea6(%rip),%r14
cmp    (%r14),%al
jne    114b <faststring+0x3b>
xor    %eax,%eax
jmp    116a <faststring+0x5a>
xor    %ebx,%ebx
nopl   (%rax)
mov    %al,(%r15,%rbx,1)
xor    %eax,%eax
call   1030 <getchar@plt>
add    $0x1,%rbx
cmp    $0xa,%al
je     1168 <faststring+0x58>
cmp    (%r14),%al
jne    1150 <faststring+0x40>
mov    %ebx,%eax
movb   $0x0,(%r15,%rax,1)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i8 0
define void @faststring(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i32
store i8* %0, i8** %2
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %3
store i32 0, i32* %4
br label %6
6: ; preds = %10, %1
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = icmp slt i32 %8, 33
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call signext i8 (...) @getchar()
store i8 %11, i8* %3
br label %6
12: ; preds = %6
br label %13
13: ; preds = %25, %12
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 10
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = load i8, i8* @EOF
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %19, %21
br label %23
23: ; preds = %17, %13
%24 = phi i1 [ false, %13 ], [ %22, %17 ]
br i1 %24, label %25, label %34
25: ; preds = %23
%26 = load i8, i8* %3
%27 = load i8*, i8** %2
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 %26, i8* %30
%31 = call signext i8 (...) @getchar()
store i8 %31, i8* %3
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %13
34: ; preds = %23
%35 = load i8*, i8** %2
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
store i8 0, i8* %38
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
define void @faststring(i8* nocapture writeonly %0) {
%2 = tail call signext i8 (...) @getchar()
%3 = icmp slt i8 %2, 33
br i1 %3, label %8, label %4
4: ; preds = %8, %1
%5 = phi i8 [ %2, %1 ], [ %9, %8 ]
%6 = load i8, i8* @EOF
%7 = icmp eq i8 %5, %6
br i1 %7, label %23, label %11
8: ; preds = %1, %8
%9 = tail call signext i8 (...) @getchar()
%10 = icmp slt i8 %9, 33
br i1 %10, label %8, label %4
11: ; preds = %4, %11
%12 = phi i64 [ %16, %11 ], [ 0, %4 ]
%13 = phi i8 [ %15, %11 ], [ %5, %4 ]
%14 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 %13, i8* %14
%15 = tail call signext i8 (...) @getchar()
%16 = add nuw i64 %12, 1
%17 = icmp ne i8 %15, 10
%18 = load i8, i8* @EOF
%19 = icmp ne i8 %15, %18
%20 = select i1 %17, i1 %19, i1 false
br i1 %20, label %11, label %21
21: ; preds = %11
%22 = and i64 %16, 4294967295
br label %23
23: ; preds = %21, %4
%24 = phi i64 [ 0, %4 ], [ %22, %21 ]
%25 = getelementptr inbounds i8, i8* %0, i64 %24
store i8 0, i8* %25
ret void
}