#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 /*<<< orphan*/ copy(char *, char *);
int getmyline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int len;
  int flag;
  char line[1000];
  char longest[1000][1000];
  flag = 80;
  int offset = 0;
  while ((len = getmyline(line, 1000)) > 0) {
    if (len >= flag) {
      copy(longest[offset], line);
      offset++;
    }
  }
  for (int i = 0; i <= offset; i++) {
    printf("%s\n", longest[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4650,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x50,-0xc(%rbp)
movl   $0x0,-0xf4644(%rbp)
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   1030 <getmyline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11b4 <main+0x84>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11af <main+0x7f>
movslq -0xf4644(%rbp),%rax
lea    -0xf4640(%rbp),%rdi
imul   $0x3e8,%rax,%rax
add    %rax,%rdi
lea    -0x400(%rbp),%rsi
call   1050 <copy@plt>
mov    -0xf4644(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4644(%rbp)
jmp    1153 <main+0x23>
movl   $0x0,-0xf4648(%rbp)
mov    -0xf4648(%rbp),%eax
cmp    -0xf4644(%rbp),%eax
jg     1208 <main+0xd8>
movslq -0xf4648(%rbp),%rax
lea    -0xf4640(%rbp),%rsi
imul   $0x3e8,%rax,%rax
add    %rax,%rsi
lea    0xe11(%rip),%rdi
call   1040 <printf@plt>
mov    -0xf4648(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4648(%rbp)
jmp    11be <main+0x8e>
xor    %eax,%eax
add    $0xf4650,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xf4630,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1030 <getmyline@plt>
xor    %r15d,%r15d
test   %eax,%eax
jle    119e <main+0x6e>
mov    %rsp,%rbx
jmp    1171 <main+0x41>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <getmyline@plt>
test   %eax,%eax
jle    1199 <main+0x69>
cmp    $0x50,%eax
jb     1160 <main+0x30>
movslq %r15d,%r15
imul   $0x3e8,%r15,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x3f0,%rdi
mov    %rbx,%rsi
call   1050 <copy@plt>
add    $0x1,%r15d
jmp    1160 <main+0x30>
test   %r15d,%r15d
js     11d8 <main+0xa8>
add    $0x1,%r15d
lea    0x3f0(%rsp),%rbx
lea    0xe4f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x3e8,%rbx
add    $0xffffffffffffffff,%r15
jne    11c0 <main+0x90>
xor    %eax,%eax
add    $0xf4630,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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