#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 getline(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int nn;
  int i = 0, j, k;
  char line[1000];
  char saveline[1000][1000];
  while ((nn = getline(line, 1000)) > 0) {
    if (nn >= 80) {
      if (i < 1000) {
        for (j = 0; j < 1000; j++) {
          saveline[i][j] = line[j];
        }
        i++;
      }
    }
  }
  printf("The line of lenth longer then 80 is:\n");
  for (k = 0; k < i; k++) {
    printf("%s", saveline[k]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4640,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   1040 <getline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11c9 <main+0xa9>
cmpl   $0x50,-0x8(%rbp)
jl     11c4 <main+0xa4>
cmpl   $0x3e8,-0xc(%rbp)
jge    11bf <main+0x9f>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3e8,-0x10(%rbp)
jge    11b6 <main+0x96>
movslq -0x10(%rbp),%rax
mov    -0x400(%rbp,%rax,1),%dl
movslq -0xc(%rbp),%rcx
lea    -0xf4640(%rbp),%rax
imul   $0x3e8,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1174 <main+0x54>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c4 <main+0xa4>
jmp    1139 <main+0x19>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121b <main+0xfb>
movslq -0x14(%rbp),%rax
lea    -0xf4640(%rbp),%rsi
imul   $0x3e8,%rax,%rax
add    %rax,%rsi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11de <main+0xbe>
xor    %eax,%eax
add    $0xf4640,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xf4630,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1060 <getline@plt>
test   %eax,%eax
jle    11fc <main+0xbc>
xor    %ebp,%ebp
mov    %rsp,%rbx
jmp    1181 <main+0x41>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1060 <getline@plt>
test   %eax,%eax
jle    11b5 <main+0x75>
cmp    $0x50,%eax
jb     1170 <main+0x30>
cmp    $0x3e7,%ebp
jg     1170 <main+0x30>
movslq %ebp,%rax
imul   $0x3e8,%rax,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x3f0,%rdi
mov    $0x3e8,%edx
mov    %rbx,%rsi
call   1050 <memcpy@plt>
add    $0x1,%ebp
jmp    1170 <main+0x30>
lea    0xe47(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1208 <main+0xc8>
mov    %ebp,%ebp
lea    0x3f0(%rsp),%rbx
lea    0xe2a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x3e8,%rbx
add    $0xffffffffffffffff,%rbp
jne    11e0 <main+0xa0>
jmp    1208 <main+0xc8>
lea    0xe00(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xf4630,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"The line of lenth longer then 80 is:\0A\00"
@.str.1 = [3 x i8] c"%s\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 [1000 x i8]]
store i32 0, i32* %1
store i32 0, i32* %3
br label %8
8: ; preds = %40, %0
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%10 = call i32 @getline(i8* %9, i32 1000)
store i32 %10, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %41
12: ; preds = %8
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 80
br i1 %14, label %15, label %40
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 1000
br i1 %17, label %18, label %39
18: ; preds = %15
store i32 0, i32* %4
br label %19
19: ; preds = %33, %18
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 1000
br i1 %21, label %22, label %36
22: ; preds = %19
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [1000 x [1000 x i8]], [1000 x [1000 x i8]]* %7, i64 0, i64 %28
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [1000 x i8], [1000 x i8]* %29, i64 0, i64 %31
store i8 %26, i8* %32
br label %33
33: ; preds = %22
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %19
36: ; preds = %19
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %39
39: ; preds = %36, %15
br label %40
40: ; preds = %39, %12
br label %8
41: ; preds = %8
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %43
43: ; preds = %53, %41
%44 = load i32, i32* %5
%45 = load i32, i32* %3
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %56
47: ; preds = %43
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [1000 x [1000 x i8]], [1000 x [1000 x i8]]* %7, i64 0, i64 %49
%51 = getelementptr inbounds [1000 x i8], [1000 x i8]* %50, i64 0, i64 0
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %51)
br label %53
53: ; preds = %47
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
store i32 %55, i32* %5
br label %43
56: ; preds = %43
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [37 x i8] c"The line of lenth longer then 80 is:\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = alloca [1000 x [1000 x i8]]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [1000 x [1000 x i8]], [1000 x [1000 x i8]]* %3, i64 0, i64 0, i64 0
%6 = call i32 @getline(i8* %4, i32 1000)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %35
10: ; preds = %0, %20
%11 = phi i32 [ %22, %20 ], [ %6, %0 ]
%12 = phi i32 [ %21, %20 ], [ 0, %0 ]
%13 = icmp ugt i32 %11, 79
%14 = icmp slt i32 %12, 1000
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %16, label %20
16: ; preds = %10
%17 = sext i32 %12 to i64
%18 = getelementptr [1000 x [1000 x i8]], [1000 x [1000 x i8]]* %3, i64 0, i64 %17, i64 0
%19 = add nsw i32 %12, 1
br label %20
20: ; preds = %16, %10
%21 = phi i32 [ %19, %16 ], [ %12, %10 ]
%22 = call i32 @getline(i8* %4, i32 1000)
%23 = icmp sgt i32 %22, 0
br i1 %23, label %10, label %24
24: ; preds = %20
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%26 = icmp sgt i32 %21, 0
br i1 %26, label %27, label %35
27: ; preds = %24
%28 = zext i32 %21 to i64
br label %29
29: ; preds = %27, %29
%30 = phi i64 [ 0, %27 ], [ %33, %29 ]
%31 = getelementptr inbounds [1000 x [1000 x i8]], [1000 x [1000 x i8]]* %3, i64 0, i64 %30, i64 0
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = add nuw nsw i64 %30, 1
%34 = icmp eq i64 %33, %28
br i1 %34, label %35, label %29
35: ; preds = %29, %8, %24
ret i32 0
}