#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();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int i, anyconditions;
  char c, s[10];
  for (i = 0, anyconditions = 1; anyconditions == 1; i++) {
    c = getchar();
    if (i >= 10 - 1)
      anyconditions = 0;
    if (c == '\n')
      anyconditions = 0;
    if (c == EOF)
      anyconditions = 0;
    if (anyconditions == 1)
      s[i] = c;
  }
  printf("%s\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    11bb <main+0x9b>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0xd(%rbp)
cmpl   $0x9,-0x8(%rbp)
jl     1162 <main+0x42>
movl   $0x0,-0xc(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0xa,%eax
jne    1176 <main+0x56>
movl   $0x0,-0xc(%rbp)
movsbl -0xd(%rbp),%eax
mov    0x2e67(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1193 <main+0x73>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    11a8 <main+0x88>
mov    -0xd(%rbp),%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x17(%rbp,%rax,1)
jmp    11ad <main+0x8d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
lea    -0x17(%rbp),%rsi
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     1161 <main+0x41>
mov    0x2eaf(%rip),%r14
cmp    (%r14),%al
je     1161 <main+0x41>
xor    %ebx,%ebx
mov    %al,0xe(%rsp,%rbx,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     1161 <main+0x41>
cmp    (%r14),%al
je     1161 <main+0x41>
lea    0x1(%rbx),%rcx
cmp    $0x8,%rbx
mov    %rcx,%rbx
jb     1140 <main+0x20>
lea    0xe98(%rip),%rdi
lea    0xe(%rsp),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i8 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call signext i8 (...) @getchar()
%4 = icmp ne i8 %3, 10
%5 = load i8, i8* @EOF
%6 = icmp ne i8 %3, %5
%7 = and i1 %4, %6
br i1 %7, label %8, label %20
8: ; preds = %0, %8
%9 = phi i8 [ %13, %8 ], [ %3, %0 ]
%10 = phi i64 [ %12, %8 ], [ 0, %0 ]
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %10
store i8 %9, i8* %11
%12 = add nuw nsw i64 %10, 1
%13 = tail call signext i8 (...) @getchar()
%14 = icmp ult i64 %10, 8
%15 = icmp ne i8 %13, 10
%16 = load i8, i8* @EOF
%17 = icmp ne i8 %13, %16
%18 = and i1 %15, %17
%19 = select i1 %18, i1 %14, i1 false
br i1 %19, label %8, label %20
20: ; preds = %8, %0
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}