#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 fold(char *, int *);
int getline(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int len, y, x, numpos;
  char input[1000];
  char shortline[1000];
  int posic[1000];
  while ((len = getline(input, 1000)) > 0) {
    numpos = fold(input, posic);
    for (y = 0; y < numpos - 1; y += 2) {
      for (x = posic[y]; x <= posic[y + 1]; ++x)
        printf("%c", input[x]);
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1790,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <getline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11fd <main+0xcd>
lea    -0x400(%rbp),%rdi
lea    -0x1790(%rbp),%rsi
call   1040 <fold@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11f8 <main+0xc8>
movslq -0xc(%rbp),%rax
mov    -0x1790(%rbp,%rax,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x1790(%rbp,%rcx,4),%eax
jg     11dc <main+0xac>
movslq -0x10(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%esi
ff
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119b <main+0x6b>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    117c <main+0x4c>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x1790,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1398,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1050 <getline@plt>
test   %eax,%eax
jle    11ed <main+0xbd>
mov    %rsp,%r15
lea    0x3f0(%rsp),%r14
jmp    1181 <main+0x51>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    $0x3e8,%esi
call   1050 <getline@plt>
test   %eax,%eax
jle    11ed <main+0xbd>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <fold@plt>
cmp    $0x2,%eax
jl     1170 <main+0x40>
mov    %eax,%r12d
add    $0xffffffff,%r12d
xor    %r13d,%r13d
jmp    11b3 <main+0x83>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x2,%r13
cmp    %r13d,%r12d
jle    1170 <main+0x40>
movslq 0x3f0(%rsp,%r13,4),%rbp
mov    %r13,%rbx
or     $0x1,%rbx
cmp    0x3f0(%rsp,%rbx,4),%ebp
jg     11a0 <main+0x70>
add    $0xffffffffffffffff,%rbp
nop
movsbl 0x1(%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
movslq 0x3f0(%rsp,%rbx,4),%rax
add    $0x1,%rbp
cmp    %rax,%rbp
jl     11d0 <main+0xa0>
jmp    11a0 <main+0x70>
xor    %eax,%eax
add    $0x1398,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1000 x i8]
%7 = alloca [1000 x i8]
%8 = alloca [1000 x i32]
store i32 0, i32* %1
br label %9
9: ; preds = %50, %0
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%11 = call i32 @getline(i8* %10, i32 1000)
store i32 %11, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %51
13: ; preds = %9
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [1000 x i32], [1000 x i32]* %8, i64 0, i64 0
%16 = call i32 @fold(i8* %14, i32* %15)
store i32 %16, i32* %5
store i32 0, i32* %3
br label %17
17: ; preds = %47, %13
%18 = load i32, i32* %3
%19 = load i32, i32* %5
%20 = sub nsw i32 %19, 1
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %50
22: ; preds = %17
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [1000 x i32], [1000 x i32]* %8, i64 0, i64 %24
%26 = load i32, i32* %25
store i32 %26, i32* %4
br label %27
27: ; preds = %42, %22
%28 = load i32, i32* %4
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [1000 x i32], [1000 x i32]* %8, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = icmp sle i32 %28, %33
br i1 %34, label %35, label %45
35: ; preds = %27
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %35
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %27
45: ; preds = %27
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %47
47: ; preds = %45
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 2
store i32 %49, i32* %3
br label %17
50: ; preds = %17
br label %9
51: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i32]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = bitcast [1000 x i32]* %2 to i8*
%5 = call i32 @getline(i8* %3, i32 1000)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %41
7: ; preds = %0
%8 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
br label %12
9: ; preds = %36, %12
%10 = call i32 @getline(i8* %3, i32 1000)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %41
12: ; preds = %7, %9
%13 = call i32 @fold(i8* %3, i32* %8)
%14 = add nsw i32 %13, -1
%15 = icmp sgt i32 %13, 1
br i1 %15, label %16, label %9
16: ; preds = %12, %36
%17 = phi i64 [ %38, %36 ], [ 0, %12 ]
%18 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = or i64 %17, 1
%21 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = icmp sgt i32 %19, %22
br i1 %23, label %36, label %24
24: ; preds = %16
%25 = sext i32 %19 to i64
br label %26
26: ; preds = %24, %26
%27 = phi i64 [ %25, %24 ], [ %32, %26 ]
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = call i32 @putchar(i32 %30)
%32 = add nsw i64 %27, 1
%33 = load i32, i32* %21
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %27, %34
br i1 %35, label %26, label %36
36: ; preds = %26, %16
%37 = call i32 @putchar(i32 10)
%38 = add nuw i64 %17, 2
%39 = trunc i64 %38 to i32
%40 = icmp sgt i32 %14, %39
br i1 %40, label %16, label %9
41: ; preds = %9, %0
ret i32 0
}