#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 getLine(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("Test...\n");
  int len;
  int max;
  char line[100];
  char longest[100];
  max = 0;
  while ((len = getLine(line, 100)) > 1) {
    if (len > max) {
      max = len;
    }
    copy(longest, line);
  }
  if (max > 0) {
    printf("%s\n", longest);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
call   1050 <getLine@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x1,%eax
jle    1198 <main+0x68>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1183 <main+0x53>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    -0xe0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <copy@plt>
jmp    1157 <main+0x27>
cmpl   $0x0,-0xc(%rbp)
jle    11b7 <main+0x87>
lea    -0xe0(%rbp),%rsi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
lea    0x70(%rsp),%rdi
mov    $0x64,%esi
call   1050 <getLine@plt>
cmp    $0x2,%eax
jl     1195 <main+0x65>
mov    %rsp,%r14
lea    0x70(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <copy@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <getLine@plt>
cmp    $0x1,%eax
jg     1170 <main+0x40>
mov    %rsp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@str = [8 x i8] c"Test...\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @getLine(i8* %4, i32 100)
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %14
8: ; preds = %0, %8
%9 = call i32 @copy(i8* %5, i8* %4)
%10 = call i32 @getLine(i8* %4, i32 100)
%11 = icmp sgt i32 %10, 1
br i1 %11, label %8, label %12
12: ; preds = %8
%13 = call i32 @puts(i8* %5)
br label %14
14: ; preds = %0, %12
ret i32 0
}