#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_new(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int len;
  int len_tmp;
  int max_len;
  char first_line[10];
  char line_tmp[10];
  char longest_line[10];
  char end_line;
  max_len = 0;
  end_line = ' ';
  while ((len = getline_new(first_line, 10)) > 0) {
    if (len == (10 - 1))
      while (end_line == ' ' && (len_tmp = getline_new(line_tmp, 10)) > 0) {
        len += len_tmp;
        if (len_tmp < (10 - 1))
          end_line = 'X';
      }
    len_tmp = 0;
    end_line = ' ';
    if (max_len < len) {
      max_len = len;
      copy(longest_line, first_line);
    }
  }
  if (max_len > 0) {
    printf("----------------\n");
    printf("String: %s\nSize: %d\n", longest_line, max_len);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movb   $0x20,-0x2f(%rbp)
lea    -0x1a(%rbp),%rdi
mov    $0xa,%esi
call   1030 <getline_new@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11ff <main+0xcf>
cmpl   $0x9,-0x8(%rbp)
jne    11d0 <main+0xa0>
jmp    1173 <main+0x43>
movsbl -0x2f(%rbp),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x30(%rbp)
jne    119f <main+0x6f>
lea    -0x24(%rbp),%rdi
mov    $0xa,%esi
call   1030 <getline_new@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
setg   %al
mov    %al,-0x30(%rbp)
mov    -0x30(%rbp),%al
test   $0x1,%al
jne    11af <main+0x7f>
jmp    11cb <main+0x9b>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    11c6 <main+0x96>
movb   $0x58,-0x2f(%rbp)
jmp    1173 <main+0x43>
jmp    11d0 <main+0xa0>
movl   $0x0,-0xc(%rbp)
movb   $0x20,-0x2f(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fa <main+0xca>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    -0x2e(%rbp),%rdi
lea    -0x1a(%rbp),%rsi
call   1050 <copy@plt>
jmp    114a <main+0x1a>
cmpl   $0x0,-0x10(%rbp)
jle    122c <main+0xfc>
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x2e(%rbp),%rsi
mov    -0x10(%rbp),%edx
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xc(%rsp),%rdi
mov    $0xa,%esi
call   1040 <getline_new@plt>
test   %eax,%eax
jle    11f4 <main+0xb4>
mov    %eax,%ebp
xor    %r15d,%r15d
lea    0x16(%rsp),%rbx
lea    0x2(%rsp),%r14
lea    0xc(%rsp),%r12
jmp    1193 <main+0x53>
nopl   0x0(%rax)
mov    %r12,%rdi
mov    $0xa,%esi
call   1040 <getline_new@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    11cd <main+0x8d>
cmp    $0x9,%ebp
jne    11b8 <main+0x78>
mov    $0x9,%ebp
nopl   (%rax)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <getline_new@plt>
test   %eax,%eax
jle    11b8 <main+0x78>
add    %eax,%ebp
cmp    $0x8,%eax
ja     11a0 <main+0x60>
cmp    %ebp,%r15d
jge    1180 <main+0x40>
mov    %r14,%rdi
mov    %r12,%rsi
call   1060 <copy@plt>
mov    %ebp,%r15d
jmp    1180 <main+0x40>
test   %r15d,%r15d
jle    11f4 <main+0xb4>
lea    0xe3c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe1b(%rip),%rdi
lea    0x2(%rsp),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"----------------\0A\00"
@.str.1 = [21 x i8] c"String: %s\0ASize: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10 x i8]
%6 = alloca [10 x i8]
%7 = alloca [10 x i8]
%8 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %4
store i8 32, i8* %8
br label %9
9: ; preds = %45, %0
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%11 = call i32 @getline_new(i8* %10, i32 10)
store i32 %11, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %46
13: ; preds = %9
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 9
br i1 %15, label %16, label %36
16: ; preds = %13
br label %17
17: ; preds = %34, %16
%18 = load i8, i8* %8
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 32
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%23 = call i32 @getline_new(i8* %22, i32 10)
store i32 %23, i32* %3
%24 = icmp sgt i32 %23, 0
br label %25
25: ; preds = %21, %17
%26 = phi i1 [ false, %17 ], [ %24, %21 ]
br i1 %26, label %27, label %35
27: ; preds = %25
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = add nsw i32 %29, %28
store i32 %30, i32* %2
%31 = load i32, i32* %3
%32 = icmp slt i32 %31, 9
br i1 %32, label %33, label %34
33: ; preds = %27
store i8 88, i8* %8
br label %34
34: ; preds = %33, %27
br label %17
35: ; preds = %25
br label %36
36: ; preds = %35, %13
store i32 0, i32* %3
store i8 32, i8* %8
%37 = load i32, i32* %4
%38 = load i32, i32* %2
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %45
40: ; preds = %36
%41 = load i32, i32* %2
store i32 %41, i32* %4
%42 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%44 = call i32 @copy(i8* %42, i8* %43)
br label %45
45: ; preds = %40, %36
br label %9
46: ; preds = %9
%47 = load i32, i32* %4
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%51 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%52 = load i32, i32* %4
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %51, i32 %52)
br label %54
54: ; preds = %49, %46
ret i32 0
}

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