#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 getchar();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int c;
  char str[0x10000];
  int len = 0;
  int is_long = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\n') {
      if (is_long) {
        str[len] = 0;
        printf("line is %s\n", str);
      }
      len = 0;
      is_long = 0;
    } else {
      str[len] = c;
      len++;
    }
    is_long = len >= 12;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10014(%rbp)
movl   $0x0,-0x10018(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e91(%rip),%rcx
cmp    (%rcx),%eax
je     11ed <main+0xcd>
cmpl   $0xa,-0x8(%rbp)
jne    11b1 <main+0x91>
cmpl   $0x0,-0x10018(%rbp)
je     1198 <main+0x78>
movslq -0x10014(%rbp),%rax
movb   $0x0,-0x10010(%rbp,%rax,1)
lea    -0x10010(%rbp),%rsi
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10014(%rbp)
movl   $0x0,-0x10018(%rbp)
jmp    11d3 <main+0xb3>
mov    -0x8(%rbp),%eax
mov    %al,%cl
movslq -0x10014(%rbp),%rax
mov    %cl,-0x10010(%rbp,%rax,1)
mov    -0x10014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10014(%rbp)
cmpl   $0xc,-0x10014(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10018(%rbp)
jmp    1146 <main+0x26>
mov    -0x4(%rbp),%eax
add    $0x10020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10000,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eab(%rip),%r12
cmp    (%r12),%eax
jne    1155 <main+0x35>
xor    %eax,%eax
add    $0x10000,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea4(%rip),%r14
mov    %rsp,%r15
xor    %ebp,%ebp
xor    %ecx,%ecx
jmp    1191 <main+0x71>
cs nopw 0x0(%rax,%rax,1)
nop
movslq %ecx,%rbx
mov    %al,(%rsp,%rbx,1)
add    $0x1,%ebx
xor    %ebp,%ebp
cmp    $0xc,%ebx
setge  %bpl
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebx,%ecx
cmp    (%r12),%eax
je     1143 <main+0x23>
cmp    $0xa,%eax
jne    1170 <main+0x50>
xor    %ebx,%ebx
test   %ebp,%ebp
je     1179 <main+0x59>
movslq %ecx,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
jmp    1179 <main+0x59>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [12 x i8] c"line is %s\0A\00"
define i32 @main() {
%1 = alloca [65536 x i8]
%2 = getelementptr inbounds [65536 x i8], [65536 x i8]* %1, i64 0, i64 0
%3 = call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %29, label %6
6: ; preds = %0, %22
%7 = phi i32 [ %26, %22 ], [ %3, %0 ]
%8 = phi i32 [ %25, %22 ], [ 0, %0 ]
%9 = phi i32 [ %23, %22 ], [ 0, %0 ]
%10 = icmp eq i32 %7, 10
br i1 %10, label %11, label %17
11: ; preds = %6
%12 = icmp eq i32 %8, 0
br i1 %12, label %22, label %13
13: ; preds = %11
%14 = sext i32 %9 to i64
%15 = getelementptr inbounds [65536 x i8], [65536 x i8]* %1, i64 0, i64 %14
store i8 0, i8* %15
%16 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %22
17: ; preds = %6
%18 = trunc i32 %7 to i8
%19 = sext i32 %9 to i64
%20 = getelementptr inbounds [65536 x i8], [65536 x i8]* %1, i64 0, i64 %19
store i8 %18, i8* %20
%21 = add nsw i32 %9, 1
br label %22
22: ; preds = %11, %13, %17
%23 = phi i32 [ %21, %17 ], [ 0, %13 ], [ 0, %11 ]
%24 = icmp sgt i32 %23, 11
%25 = zext i1 %24 to i32
%26 = call i32 (...) @getchar()
%27 = load i32, i32* @EOF
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %6
29: ; preds = %22, %0
ret i32 0
}