#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*/ copia();
int obtenlinea();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int longitud;
  extern int max;
  extern char linea_max[1000];
  max = 0;
  while ((longitud = obtenlinea()) > 0) {
    if (longitud > 1) {
      max = longitud;
      copia();
    }
    if (max > 0)
      printf("%s", linea_max);
    max = 0;
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1030 <obtenlinea@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11b3 <main+0x83>
cmpl   $0x1,-0x8(%rbp)
jle    117c <main+0x4c>
mov    -0x8(%rbp),%ecx
mov    0x2e65(%rip),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <copia@plt>
mov    0x2e55(%rip),%rax
cmpl   $0x0,(%rax)
jle    11a1 <main+0x71>
lea    0xe6d(%rip),%rdi
mov    0x2e46(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e30(%rip),%rax
movl   $0x0,(%rax)
jmp    114c <main+0x1c>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x2e8c(%rip),%rbx
movl   $0x0,(%rbx)
xor    %eax,%eax
call   1040 <obtenlinea@plt>
test   %eax,%eax
jle    11a3 <main+0x63>
lea    0xe9c(%rip),%r14
mov    0x2e75(%rip),%r15
jmp    1181 <main+0x41>
nopl   (%rax)
movl   $0x0,(%rbx)
xor    %eax,%eax
call   1040 <obtenlinea@plt>
test   %eax,%eax
jle    11a3 <main+0x63>
cmp    $0x1,%eax
je     118f <main+0x4f>
mov    %eax,(%rbx)
xor    %eax,%eax
call   1050 <copia@plt>
cmpl   $0x0,(%rbx)
jle    1170 <main+0x30>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1170 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@max = external global i32
@.str = [3 x i8] c"%s\00"
@linea_max = external global [1000 x i8]
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* @max
br label %3
3: ; preds = %17, %0
%4 = call i32 (...) @obtenlinea()
store i32 %4, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %18
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %2
store i32 %10, i32* @max
%11 = call i32 (...) @copia()
br label %12
12: ; preds = %9, %6
%13 = load i32, i32* @max
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @linea_max, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
store i32 0, i32* @max
br label %3
18: ; preds = %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@max = external global i32
@.str = [3 x i8] c"%s\00"
@linea_max = external global [1000 x i8]
define i32 @main() {
store i32 0, i32* @max
%1 = tail call i32 (...) @obtenlinea()
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %16
3: ; preds = %0, %13
%4 = phi i32 [ %14, %13 ], [ %1, %0 ]
%5 = icmp eq i32 %4, 1
br i1 %5, label %8, label %6
6: ; preds = %3
store i32 %4, i32* @max
%7 = tail call i32 (...) @copia()
br label %8
8: ; preds = %6, %3
%9 = load i32, i32* @max
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @linea_max, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
store i32 0, i32* @max
%14 = tail call i32 (...) @obtenlinea()
%15 = icmp sgt i32 %14, 0
br i1 %15, label %3, label %16
16: ; preds = %13, %0
%17 = tail call i32 @putchar(i32 10)
ret i32 0
}