#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 EOF;
scalar_t__ feof(int /*<<< orphan*/ *);
int getc(int /*<<< orphan*/ *);
int dxfReadLine(FILE *infile, char line[]) {
  int ch = EOF;
  int pos = 0;
  while (!feof(infile)) {
    ch = getc(infile);
    if (ch == EOF)
      break;
    if ((ch == '\n') || (ch == '\r')) {
      if (pos == 0)
        continue;
      else
        break;
    } else {
      line[pos] = (char)ch;
      pos++;
    }
  }
  line[pos] = '\0';
  if (feof(infile) || ch == EOF)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<dxfReadLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2eb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1162 <dxfReadLine+0x42>
jmp    11cb <dxfReadLine+0xab>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%eax
jne    1185 <dxfReadLine+0x65>
jmp    11cb <dxfReadLine+0xab>
cmpl   $0xa,-0x1c(%rbp)
je     1199 <dxfReadLine+0x79>
cmpl   $0xd,-0x1c(%rbp)
jne    11ad <dxfReadLine+0x8d>
cmpl   $0x0,-0x20(%rbp)
jne    11a8 <dxfReadLine+0x88>
jmp    1143 <dxfReadLine+0x23>
jmp    11cb <dxfReadLine+0xab>
mov    -0x1c(%rbp),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1143 <dxfReadLine+0x23>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
call   1030 <feof@plt>
cmp    $0x0,%rax
jne    11fc <dxfReadLine+0xdc>
mov    -0x1c(%rbp),%eax
mov    0x2df4(%rip),%rcx
cmp    (%rcx),%eax
jne    1208 <dxfReadLine+0xe8>
movl   $0x0,-0x4(%rbp)
jmp    120f <dxfReadLine+0xef>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dxfReadLine>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
mov    0x2eb0(%rip),%r15
mov    (%r15),%ebp
call   1030 <feof@plt>
xor    %r13d,%r13d
test   %rax,%rax
jne    1192 <dxfReadLine+0x72>
xor    %ebx,%ebx
jmp    1167 <dxfReadLine+0x47>
nopl   0x0(%rax)
xor    %r13d,%r13d
test   %ebx,%ebx
jne    118f <dxfReadLine+0x6f>
mov    %r12,%rdi
call   1030 <feof@plt>
mov    %r13d,%ebx
test   %rax,%rax
jne    1192 <dxfReadLine+0x72>
mov    %r12,%rdi
call   1040 <getc@plt>
mov    %eax,%ebp
cmp    (%r15),%eax
je     118f <dxfReadLine+0x6f>
cmp    $0xd,%ebp
je     1150 <dxfReadLine+0x30>
cmp    $0xa,%ebp
je     1150 <dxfReadLine+0x30>
movslq %ebx,%rax
mov    %bpl,(%r14,%rax,1)
add    $0x1,%ebx
mov    %ebx,%r13d
jmp    1157 <dxfReadLine+0x37>
mov    %ebx,%r13d
movslq %r13d,%rax
movb   $0x0,(%r14,%rax,1)
mov    %r12,%rdi
call   1030 <feof@plt>
test   %rax,%rax
sete   %al
cmp    (%r15),%ebp
setne  %cl
and    %al,%cl
movzbl %cl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @dxfReadLine(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
%8 = load i32, i32* @EOF
store i32 %8, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %41, %30, %2
%10 = load i32*, i32** %4
%11 = call i64 @feof(i32* %10)
%12 = icmp ne i64 %11, 0
%13 = xor i1 %12, true
br i1 %13, label %14, label %42
14: ; preds = %9
%15 = load i32*, i32** %4
%16 = call i32 @getc(i32* %15)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %14
br label %42
21: ; preds = %14
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 10
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 13
br i1 %26, label %27, label %32
27: ; preds = %24, %21
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
br label %9
31: ; preds = %27
br label %42
32: ; preds = %24
%33 = load i32, i32* %6
%34 = trunc i32 %33 to i8
%35 = load i8*, i8** %5
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
store i8 %34, i8* %38
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %41
41: ; preds = %32
br label %9
42: ; preds = %31, %20, %9
%43 = load i8*, i8** %5
%44 = load i32, i32* %7
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
store i8 0, i8* %46
%47 = load i32*, i32** %4
%48 = call i64 @feof(i32* %47)
%49 = icmp ne i64 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %42
%51 = load i32, i32* %6
%52 = load i32, i32* @EOF
%53 = icmp eq i32 %51, %52
br i1 %53, label %54, label %55
54: ; preds = %50, %42
store i32 0, i32* %3
br label %56
55: ; preds = %50
store i32 1, i32* %3
br label %56
56: ; preds = %55, %54
%57 = load i32, i32* %3
ret i32 %57
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @dxfReadLine(i32* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i32, i32* @EOF
%4 = tail call i64 @feof(i32* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %23
6: ; preds = %2, %19
%7 = phi i32 [ %20, %19 ], [ 0, %2 ]
%8 = tail call i32 @getc(i32* %0)
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %10, label %23, label %11
11: ; preds = %6
switch i32 %8, label %14 [
i32 13, label %12
i32 10, label %12
]
12: ; preds = %11, %11
%13 = icmp eq i32 %7, 0
br i1 %13, label %19, label %23
14: ; preds = %11
%15 = trunc i32 %8 to i8
%16 = sext i32 %7 to i64
%17 = getelementptr inbounds i8, i8* %1, i64 %16
store i8 %15, i8* %17
%18 = add nsw i32 %7, 1
br label %19
19: ; preds = %14, %12
%20 = phi i32 [ 0, %12 ], [ %18, %14 ]
%21 = tail call i64 @feof(i32* %0)
%22 = icmp eq i64 %21, 0
br i1 %22, label %6, label %23
23: ; preds = %19, %6, %12, %2
%24 = phi i32 [ 0, %2 ], [ %7, %12 ], [ %7, %6 ], [ %20, %19 ]
%25 = phi i32 [ %3, %2 ], [ %8, %12 ], [ %8, %6 ], [ %8, %19 ]
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds i8, i8* %1, i64 %26
store i8 0, i8* %27
%28 = tail call i64 @feof(i32* %0)
%29 = icmp eq i64 %28, 0
%30 = load i32, i32* @EOF
%31 = icmp ne i32 %25, %30
%32 = select i1 %29, i1 %31, i1 false
%33 = zext i1 %32 to i32
ret i32 %33
}