#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();
int getlin();
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  int len;
  extern int max;
  extern char longest[];
  max = 0;
  while ((len = getlin()) > 0)
    if (len > max) {
      max = len;
      copy();
    }
  if (max > 0)
    printf("%s", longest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e93(%rip),%rax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1040 <getlin@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    1190 <main+0x60>
mov    -0x14(%rbp),%eax
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%eax
jle    118b <main+0x5b>
mov    -0x14(%rbp),%ecx
mov    0x2e5e(%rip),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1050 <copy@plt>
jmp    1153 <main+0x23>
mov    0x2e49(%rip),%rax
cmpl   $0x0,(%rax)
jle    11b3 <main+0x83>
lea    0xe59(%rip),%rdi
mov    0x2e2a(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea8(%rip),%rbx
movl   $0x0,(%rbx)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getlin@plt>
test   %eax,%eax
jle    115a <main+0x2a>
cmp    (%rbx),%eax
jle    1140 <main+0x10>
mov    %eax,(%rbx)
xor    %eax,%eax
call   1050 <copy@plt>
jmp    1140 <main+0x10>
cmpl   $0x0,(%rbx)
jle    1172 <main+0x42>
lea    0xe9a(%rip),%rdi
mov    0x2e6b(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

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