#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 EOF;
int /*<<< orphan*/ done(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ stdout;
char *geta() {
  static char line[128];
  register char *cp;
  register int c;
  fflush(stdout);
  cp = line;
  while ((c = getchar()) != EOF) {
    if (c == '\n') {
      *cp = 0;
      return (line);
    }
    if (cp < &line[128])
      *cp++ = c;
  }
  done(1);
}


x86 assembly (clang, -O0):
<geta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0x2f03(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e86(%rip),%rcx
cmp    (%rcx),%eax
je     11bd <geta+0x8d>
cmpl   $0xa,-0x14(%rbp)
jne    118b <geta+0x5b>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2ece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11c7 <geta+0x97>
lea    0x2ebe(%rip),%rax
add    $0x80,%rax
cmp    %rax,-0x10(%rbp)
jae    11b8 <geta+0x88>
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1151 <geta+0x21>
mov    $0x1,%edi
call   1030 <done@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geta>:
push   %r15
push   %r14
push   %rbx
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e97(%rip),%r14
cmp    (%r14),%eax
jne    1162 <geta+0x32>
mov    $0x1,%edi
call   1030 <done@plt>
jmp    11a1 <geta+0x71>
lea    0x2ee7(%rip),%rbx
lea    0x2f60(%rip),%r15
jmp    118c <geta+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     1156 <geta+0x26>
cmp    $0xa,%eax
je     119e <geta+0x6e>
cmp    %r15,%rbx
jae    1180 <geta+0x50>
mov    %al,(%rbx)
add    $0x1,%rbx
jmp    1180 <geta+0x50>
movb   $0x0,(%rbx)
lea    0x2ea8(%rip),%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@geta.line = internal global [128 x i8] zeroinitializer
@stdout = global i32 0
@EOF = global i32 0
define i8* @geta() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = load i32, i32* @stdout
%5 = call i32 @fflush(i32 %4)
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @geta.line, i64 0, i64 0), i8** %2
br label %6
6: ; preds = %23, %0
%7 = call i32 (...) @getchar()
store i32 %7, i32* %3
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %24
10: ; preds = %6
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 10
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i8*, i8** %2
store i8 0, i8* %14
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @geta.line, i64 0, i64 0), i8** %1
br label %26
15: ; preds = %10
%16 = load i8*, i8** %2
%17 = icmp ult i8* %16, getelementptr inbounds ([128 x i8], [128 x i8]* @geta.line, i64 1, i64 0)
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i32, i32* %3
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %2
store i8 %20, i8* %21
br label %23
23: ; preds = %18, %15
br label %6
24: ; preds = %6
%25 = call i32 @done(i32 1)
br label %26
26: ; preds = %24, %13
%27 = load i8*, i8** %1
ret i8* %27
}

LLVM IR (-O2):
@geta.line = internal global [128 x i8] zeroinitializer
@stdout = global i32 0
@EOF = global i32 0
define i8* @geta() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %21, label %6
6: ; preds = %0, %16
%7 = phi i32 [ %18, %16 ], [ %3, %0 ]
%8 = phi i8* [ %17, %16 ], [ getelementptr inbounds ([128 x i8], [128 x i8]* @geta.line, i64 0, i64 0), %0 ]
%9 = icmp eq i32 %7, 10
br i1 %9, label %10, label %11
10: ; preds = %6
store i8 0, i8* %8
br label %23
11: ; preds = %6
%12 = icmp ult i8* %8, getelementptr inbounds ([128 x i8], [128 x i8]* @geta.line, i64 1, i64 0)
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = trunc i32 %7 to i8
%15 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %14, i8* %8
br label %16
16: ; preds = %13, %11
%17 = phi i8* [ %15, %13 ], [ %8, %11 ]
%18 = tail call i32 (...) @getchar()
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %6
21: ; preds = %16, %0
%22 = tail call i32 @done(i32 1)
br label %23
23: ; preds = %21, %10
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @geta.line, i64 0, i64 0)
}