#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 */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ split(char **, char *, size_t);
int parse_line(char *parts[64], FILE *fp, size_t parts_count) {
  char line[65536];
  if (fgets(line, sizeof line, fp) == NULL) {
    return 1;
  }
  if (split(parts, line, parts_count) != 0) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<parse_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10020,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    -0x10020(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x10000,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    1162 <parse_line+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1193 <parse_line+0x73>
mov    -0x10(%rbp),%rdi
lea    -0x10020(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <split@plt>
cmp    $0x0,%rax
je     118c <parse_line+0x6c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1193 <parse_line+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_line>:
push   %r14
push   %rbx
sub    $0x10008,%rsp
mov    %rdx,%r14
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    $0x10000,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     115a <parse_line+0x3a>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1030 <split@plt>
neg    %rax
sbb    %eax,%eax
jmp    115f <parse_line+0x3f>
mov    $0x1,%eax
add    $0x10008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @parse_line(i8** %0, i32* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i64
%8 = alloca [65536 x i8]
store i8** %0, i8*** %5
store i32* %1, i32** %6
store i64 %2, i64* %7
%9 = getelementptr inbounds [65536 x i8], [65536 x i8]* %8, i64 0, i64 0
%10 = load i32*, i32** %6
%11 = call i32* @fgets(i8* %9, i32 65536, i32* %10)
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 1, i32* %4
br label %22
14: ; preds = %3
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds [65536 x i8], [65536 x i8]* %8, i64 0, i64 0
%17 = load i64, i64* %7
%18 = call i64 @split(i8** %15, i8* %16, i64 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 -1, i32* %4
br label %22
21: ; preds = %14
store i32 0, i32* %4
br label %22
22: ; preds = %21, %20, %13
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
define i32 @parse_line(i8** %0, i32* nocapture %1, i64 %2) {
%4 = alloca [65536 x i8]
%5 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 0
%6 = call i32* @fgets(i8* %5, i32 65536, i32* %1)
%7 = icmp eq i32* %6, null
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = call i64 @split(i8** %0, i8* %5, i64 %2)
%10 = icmp ne i64 %9, 0
%11 = sext i1 %10 to i32
br label %12
12: ; preds = %8, %3
%13 = phi i32 [ 1, %3 ], [ %11, %8 ]
ret i32 %13
}