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

/* Variables and functions */
scalar_t__ feof(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int rowMax(FILE *f) {
  char c;
  int tempMax = 0, currentRowCount = 0, currentRowPos = 0, tempMaxPos = 0;
  while (!feof(f)) {
    c = fgetc(f);
    if (c == '\n' || feof(f)) {
      ++currentRowPos;
      if (currentRowCount > tempMax) {
        tempMax = currentRowCount;
        tempMaxPos = currentRowPos;
      }
      currentRowCount = 0;
    } else {
      ++currentRowCount;
    }
  }
  return tempMaxPos;
}


x86 assembly (clang, -O0):
<rowMax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1167 <rowMax+0x47>
jmp    11ce <rowMax+0xae>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
je     1193 <rowMax+0x73>
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     11c0 <rowMax+0xa0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11b4 <rowMax+0x94>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    11c9 <rowMax+0xa9>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1148 <rowMax+0x28>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rowMax>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r15
call   1040 <feof@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     1144 <rowMax+0x24>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r14d,%r14d
xor    %r12d,%r12d
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    116c <rowMax+0x4c>
add    $0x1,%r12d
cmp    %ebx,%ebp
cmovg  %ebp,%ebx
cmovg  %r12d,%r14d
xor    %ebp,%ebp
mov    %r15,%rdi
call   1040 <feof@plt>
test   %rax,%rax
jne    1138 <rowMax+0x18>
mov    %r15,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%al
je     1150 <rowMax+0x30>
mov    %r15,%rdi
call   1040 <feof@plt>
test   %rax,%rax
jne    1150 <rowMax+0x30>
add    $0x1,%ebp
jmp    115f <rowMax+0x3f>

LLVM IR (-O0):
define i32 @rowMax(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %36, %1
%9 = load i32*, i32** %2
%10 = call i64 @feof(i32* %9)
%11 = icmp ne i64 %10, 0
%12 = xor i1 %11, true
br i1 %12, label %13, label %37
13: ; preds = %8
%14 = load i32*, i32** %2
%15 = call signext i8 @fgetc(i32* %14)
store i8 %15, i8* %3
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 10
br i1 %18, label %23, label %19
19: ; preds = %13
%20 = load i32*, i32** %2
%21 = call i64 @feof(i32* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %33
23: ; preds = %19, %13
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
%26 = load i32, i32* %5
%27 = load i32, i32* %4
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %32
29: ; preds = %23
%30 = load i32, i32* %5
store i32 %30, i32* %4
%31 = load i32, i32* %6
store i32 %31, i32* %7
br label %32
32: ; preds = %29, %23
store i32 0, i32* %5
br label %36
33: ; preds = %19
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %36
36: ; preds = %33, %32
br label %8
37: ; preds = %8
%38 = load i32, i32* %7
ret i32 %38
}

LLVM IR (-O2):
define i32 @rowMax(i32* nocapture %0) {
%2 = tail call i64 @feof(i32* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %28
4: ; preds = %1, %21
%5 = phi i32 [ %25, %21 ], [ 0, %1 ]
%6 = phi i32 [ %24, %21 ], [ 0, %1 ]
%7 = phi i32 [ %23, %21 ], [ 0, %1 ]
%8 = phi i32 [ %22, %21 ], [ 0, %1 ]
%9 = tail call signext i8 @fgetc(i32* %0)
%10 = icmp eq i8 %9, 10
br i1 %10, label %14, label %11
11: ; preds = %4
%12 = tail call i64 @feof(i32* %0)
%13 = icmp eq i64 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %11, %4
%15 = add nsw i32 %6, 1
%16 = icmp sgt i32 %7, %8
%17 = select i1 %16, i32 %7, i32 %8
%18 = select i1 %16, i32 %15, i32 %5
br label %21
19: ; preds = %11
%20 = add nsw i32 %7, 1
br label %21
21: ; preds = %19, %14
%22 = phi i32 [ %17, %14 ], [ %8, %19 ]
%23 = phi i32 [ 0, %14 ], [ %20, %19 ]
%24 = phi i32 [ %15, %14 ], [ %6, %19 ]
%25 = phi i32 [ %18, %14 ], [ %5, %19 ]
%26 = tail call i64 @feof(i32* %0)
%27 = icmp eq i64 %26, 0
br i1 %27, label %4, label %28
28: ; preds = %21, %1
%29 = phi i32 [ 0, %1 ], [ %25, %21 ]
ret i32 %29
}