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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e82(%rip),%rax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1030 <obtenlinea@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1199 <main+0x59>
mov    -0x8(%rbp),%eax
mov    0x2e5f(%rip),%rcx
cmp    (%rcx),%eax
jle    1194 <main+0x54>
mov    -0x8(%rbp),%ecx
mov    0x2e4d(%rip),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <copia@plt>
jmp    115c <main+0x1c>
mov    0x2e38(%rip),%rax
cmpl   $0x0,(%rax)
jle    11b9 <main+0x79>
mov    0x2e30(%rip),%rdi
call   1060 <voltea@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe3c(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2e90(%rip),%rbx
movl   $0x0,(%rbx)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <obtenlinea@plt>
test   %eax,%eax
jle    116a <main+0x2a>
cmp    (%rbx),%eax
jle    1150 <main+0x10>
mov    %eax,(%rbx)
xor    %eax,%eax
call   1040 <copia@plt>
jmp    1150 <main+0x10>
mov    0x2e6f(%rip),%rdi
call   1060 <voltea@plt>
lea    0xe83(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@max = external global i32
@linea_max = external global [1000 x i8]
@.str = [3 x i8] c"%s\00"
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 %12
3: ; preds = %0, %9
%4 = phi i32 [ %10, %9 ], [ %1, %0 ]
%5 = load i32, i32* @max
%6 = icmp sgt i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
store i32 %4, i32* @max
%8 = tail call i32 (...) @copia()
br label %9
9: ; preds = %7, %3
%10 = tail call i32 (...) @obtenlinea()
%11 = icmp sgt i32 %10, 0
br i1 %11, label %3, label %12
12: ; preds = %9, %0
%13 = load i32, i32* @max
%14 = icmp sgt i32 %13, 0
tail call void @llvm.assume(i1 %14)
%15 = tail call i8* @voltea(i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @linea_max, i64 0, i64 0))
%16 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %15)
ret i32 0
}