#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 */
typedef scalar_t__ uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int strlen(char *);
int collectOneInputStats(FILE *inputFP, uint32_t *maxNumberOfLines,
                         unsigned char *maxLinelength) {
  uint32_t numLines = 0;
  unsigned char maxLine = 0;
  char current_line[10000];
  while (fgets(current_line, 10000 - 10, inputFP) != NULL) {
    int lineLength = strlen(current_line);
    if (lineLength > maxLine)
      maxLine = lineLength;
    numLines++;
  }
  *maxNumberOfLines = numLines;
  *maxLinelength = maxLine;
  return 0;
}


x86 assembly (clang, -O0):
<collectOneInputStats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2750,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movb   $0x0,-0x21(%rbp)
lea    -0x2740(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x2706,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11a0 <collectOneInputStats+0x80>
lea    -0x2740(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x2744(%rbp)
mov    -0x2744(%rbp),%eax
movzbl -0x21(%rbp),%ecx
cmp    %ecx,%eax
jle    118f <collectOneInputStats+0x6f>
mov    -0x2744(%rbp),%eax
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1143 <collectOneInputStats+0x23>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x21(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
xor    %eax,%eax
add    $0x2750,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<collectOneInputStats>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2718,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rsp,%rdi
mov    $0x2706,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     118c <collectOneInputStats+0x6c>
xor    %ebx,%ebx
mov    %rsp,%r13
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1030 <strlen@plt>
movzbl %bpl,%ebp
cmp    %ebp,%eax
cmovg  %eax,%ebp
add    $0x1,%rbx
mov    %r13,%rdi
mov    $0x2706,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    1160 <collectOneInputStats+0x40>
jmp    1190 <collectOneInputStats+0x70>
xor    %ebp,%ebp
xor    %ebx,%ebx
mov    %rbx,(%r15)
mov    %bpl,(%r14)
xor    %eax,%eax
add    $0x2718,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @collectOneInputStats(i32* %0, i64* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i64*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8
%9 = alloca [10000 x i8]
%10 = alloca i32
store i32* %0, i32** %4
store i64* %1, i64** %5
store i8* %2, i8** %6
store i64 0, i64* %7
store i8 0, i8* %8
br label %11
11: ; preds = %26, %3
%12 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%13 = load i32*, i32** %4
%14 = call i32* @fgets(i8* %12, i32 9990, i32* %13)
%15 = icmp ne i32* %14, null
br i1 %15, label %16, label %29
16: ; preds = %11
%17 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %10
%19 = load i32, i32* %10
%20 = load i8, i8* %8
%21 = zext i8 %20 to i32
%22 = icmp sgt i32 %19, %21
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = load i32, i32* %10
%25 = trunc i32 %24 to i8
store i8 %25, i8* %8
br label %26
26: ; preds = %23, %16
%27 = load i64, i64* %7
%28 = add nsw i64 %27, 1
store i64 %28, i64* %7
br label %11
29: ; preds = %11
%30 = load i64, i64* %7
%31 = load i64*, i64** %5
store i64 %30, i64* %31
%32 = load i8, i8* %8
%33 = load i8*, i8** %6
store i8 %32, i8* %33
ret i32 0
}

LLVM IR (-O2):
define i32 @collectOneInputStats(i32* nocapture %0, i64* nocapture writeonly %1, i8* nocapture writeonly %2) {
%4 = alloca [10000 x i8]
%5 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%6 = call i32* @fgets(i8* %5, i32 9990, i32* %0)
%7 = icmp eq i32* %6, null
br i1 %7, label %19, label %8
8: ; preds = %3, %8
%9 = phi i64 [ %16, %8 ], [ 0, %3 ]
%10 = phi i8 [ %15, %8 ], [ 0, %3 ]
%11 = call i32 @strlen(i8* %5)
%12 = zext i8 %10 to i32
%13 = icmp sgt i32 %11, %12
%14 = trunc i32 %11 to i8
%15 = select i1 %13, i8 %14, i8 %10
%16 = add nuw nsw i64 %9, 1
%17 = call i32* @fgets(i8* %5, i32 9990, i32* %0)
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %8
19: ; preds = %8, %3
%20 = phi i8 [ 0, %3 ], [ %15, %8 ]
%21 = phi i64 [ 0, %3 ], [ %16, %8 ]
store i64 %21, i64* %1
store i8 %20, i8* %2
ret i32 0
}