#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 /*<<< orphan*/ sscanf(char *, char *, double *, double *, double *);
int lcreadline(FILE *in, double x[3]) {
  char datastr[128], ch;
  int i;
  double a, b, c;
  ch = 10;
  while (ch == 10 || ch == 13) {
    ch = fgetc(in);
    if (feof(in))
      return -1;
  }
  while (ch == '#') {
    while (ch != 10 && ch != 13) {
      ch = fgetc(in);
      if (feof(in))
        return -1;
    }
    while (ch == 10 || ch == 13) {
      ch = fgetc(in);
      if (feof(in))
        return -1;
    }
  }
  datastr[0] = ch;
  i = 0;
  while (ch != 10 && ch != 13) {
    ch = fgetc(in);
    i++;
    datastr[i] = ch;
    if (feof(in))
      return -1;
  }
  datastr[i] = 0;
  sscanf(datastr, "%lf %lf %lf", &a, &b, &c);
  x[0] = a;
  x[1] = b;
  x[2] = c;
  return 0;
}


x86 assembly (clang, -O0):
<lcreadline>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movb   $0xa,-0xa1(%rbp)
movsbl -0xa1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0xc1(%rbp)
je     1175 <lcreadline+0x45>
movsbl -0xa1(%rbp),%eax
cmp    $0xd,%eax
sete   %al
mov    %al,-0xc1(%rbp)
mov    -0xc1(%rbp),%al
test   $0x1,%al
jne    1188 <lcreadline+0x58>
jmp    11bb <lcreadline+0x8b>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0xa1(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     11b6 <lcreadline+0x86>
movl   $0xffffffff,-0x4(%rbp)
jmp    13db <lcreadline+0x2ab>
jmp    114a <lcreadline+0x1a>
jmp    11c0 <lcreadline+0x90>
movsbl -0xa1(%rbp),%eax
cmp    $0x23,%eax
jne    12c1 <lcreadline+0x191>
jmp    11d5 <lcreadline+0xa5>
movsbl -0xa1(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xc2(%rbp)
je     1200 <lcreadline+0xd0>
movsbl -0xa1(%rbp),%eax
cmp    $0xd,%eax
setne  %al
mov    %al,-0xc2(%rbp)
mov    -0xc2(%rbp),%al
test   $0x1,%al
jne    1213 <lcreadline+0xe3>
jmp    1246 <lcreadline+0x116>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0xa1(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     1241 <lcreadline+0x111>
movl   $0xffffffff,-0x4(%rbp)
jmp    13db <lcreadline+0x2ab>
jmp    11d5 <lcreadline+0xa5>
jmp    124b <lcreadline+0x11b>
movsbl -0xa1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0xc3(%rbp)
je     1276 <lcreadline+0x146>
movsbl -0xa1(%rbp),%eax
cmp    $0xd,%eax
sete   %al
mov    %al,-0xc3(%rbp)
mov    -0xc3(%rbp),%al
test   $0x1,%al
jne    1289 <lcreadline+0x159>
jmp    12bc <lcreadline+0x18c>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0xa1(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     12b7 <lcreadline+0x187>
movl   $0xffffffff,-0x4(%rbp)
jmp    13db <lcreadline+0x2ab>
jmp    124b <lcreadline+0x11b>
jmp    11c0 <lcreadline+0x90>
mov    -0xa1(%rbp),%al
mov    %al,-0xa0(%rbp)
movl   $0x0,-0xa8(%rbp)
movsbl -0xa1(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xc4(%rbp)
je     1302 <lcreadline+0x1d2>
movsbl -0xa1(%rbp),%eax
cmp    $0xd,%eax
setne  %al
mov    %al,-0xc4(%rbp)
mov    -0xc4(%rbp),%al
test   $0x1,%al
jne    1315 <lcreadline+0x1e5>
jmp    136b <lcreadline+0x23b>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0xa1(%rbp)
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
mov    -0xa1(%rbp),%cl
movslq -0xa8(%rbp),%rax
mov    %cl,-0xa0(%rbp,%rax,1)
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     1366 <lcreadline+0x236>
movl   $0xffffffff,-0x4(%rbp)
jmp    13db <lcreadline+0x2ab>
jmp    12d7 <lcreadline+0x1a7>
movslq -0xa8(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
lea    -0xa0(%rbp),%rdi
lea    0xc78(%rip),%rsi
lea    -0xb0(%rbp),%rdx
lea    -0xb8(%rbp),%rcx
lea    -0xc0(%rbp),%r8
call   1050 <sscanf@plt>
movsd  -0xb0(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0xb8(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0xc0(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcreadline>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0xa,%bl
jmp    116b <lcreadline+0x3b>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1040 <feof@plt>
test   %rax,%rax
jne    120a <lcreadline+0xda>
cmp    $0xa,%bl
je     1150 <lcreadline+0x20>
cmp    $0xd,%bl
je     1150 <lcreadline+0x20>
jmp    11d1 <lcreadline+0xa1>
nopw   0x0(%rax,%rax,1)
cmp    $0xd,%bl
je     11c7 <lcreadline+0x97>
cmp    $0xa,%bl
je     11c7 <lcreadline+0x97>
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1040 <feof@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
je     1180 <lcreadline+0x50>
jmp    125e <lcreadline+0x12e>
xchg   %ax,%ax
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1040 <feof@plt>
test   %rax,%rax
jne    120a <lcreadline+0xda>
cmp    $0xa,%bl
je     11b0 <lcreadline+0x80>
cmp    $0xd,%bl
je     11b0 <lcreadline+0x80>
cmp    $0x23,%bl
je     1180 <lcreadline+0x50>
mov    %bl,0x20(%rsp)
xor    %r12d,%r12d
nopl   (%rax)
cmp    $0xa,%bl
je     1211 <lcreadline+0xe1>
cmp    $0xd,%bl
je     1211 <lcreadline+0xe1>
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
mov    %al,0x21(%rsp,%r12,1)
add    $0x1,%r12
mov    %r15,%rdi
call   1040 <feof@plt>
test   %rax,%rax
je     11e0 <lcreadline+0xb0>
mov    $0xffffffff,%eax
jmp    125e <lcreadline+0x12e>
mov    %r12d,%eax
movb   $0x0,0x20(%rsp,%rax,1)
lea    0xde0(%rip),%rsi
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1050 <sscanf@plt>
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%r14)
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%r14)
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%lf %lf %lf\00"
define i32 @lcreadline(i32* %0, double* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca double*
%6 = alloca [128 x i8]
%7 = alloca i8
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32* %0, i32** %4
store double* %1, double** %5
store i8 10, i8* %7
br label %12
12: ; preds = %29, %2
%13 = load i8, i8* %7
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 10
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i8, i8* %7
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 13
br label %20
20: ; preds = %16, %12
%21 = phi i1 [ true, %12 ], [ %19, %16 ]
br i1 %21, label %22, label %30
22: ; preds = %20
%23 = load i32*, i32** %4
%24 = call signext i8 @fgetc(i32* %23)
store i8 %24, i8* %7
%25 = load i32*, i32** %4
%26 = call i64 @feof(i32* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %22
store i32 -1, i32* %3
br label %116
29: ; preds = %22
br label %12
30: ; preds = %20
br label %31
31: ; preds = %73, %30
%32 = load i8, i8* %7
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 35
br i1 %34, label %35, label %74
35: ; preds = %31
br label %36
36: ; preds = %53, %35
%37 = load i8, i8* %7
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 10
br i1 %39, label %40, label %44
40: ; preds = %36
%41 = load i8, i8* %7
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 13
br label %44
44: ; preds = %40, %36
%45 = phi i1 [ false, %36 ], [ %43, %40 ]
br i1 %45, label %46, label %54
46: ; preds = %44
%47 = load i32*, i32** %4
%48 = call signext i8 @fgetc(i32* %47)
store i8 %48, i8* %7
%49 = load i32*, i32** %4
%50 = call i64 @feof(i32* %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %46
store i32 -1, i32* %3
br label %116
53: ; preds = %46
br label %36
54: ; preds = %44
br label %55
55: ; preds = %72, %54
%56 = load i8, i8* %7
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 10
br i1 %58, label %63, label %59
59: ; preds = %55
%60 = load i8, i8* %7
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 13
br label %63
63: ; preds = %59, %55
%64 = phi i1 [ true, %55 ], [ %62, %59 ]
br i1 %64, label %65, label %73
65: ; preds = %63
%66 = load i32*, i32** %4
%67 = call signext i8 @fgetc(i32* %66)
store i8 %67, i8* %7
%68 = load i32*, i32** %4
%69 = call i64 @feof(i32* %68)
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %65
store i32 -1, i32* %3
br label %116
72: ; preds = %65
br label %55
73: ; preds = %63
br label %31
74: ; preds = %31
%75 = load i8, i8* %7
%76 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
store i8 %75, i8* %76
store i32 0, i32* %8
br label %77
77: ; preds = %100, %74
%78 = load i8, i8* %7
%79 = sext i8 %78 to i32
%80 = icmp ne i32 %79, 10
br i1 %80, label %81, label %85
81: ; preds = %77
%82 = load i8, i8* %7
%83 = sext i8 %82 to i32
%84 = icmp ne i32 %83, 13
br label %85
85: ; preds = %81, %77
%86 = phi i1 [ false, %77 ], [ %84, %81 ]
br i1 %86, label %87, label %101
87: ; preds = %85
%88 = load i32*, i32** %4
%89 = call signext i8 @fgetc(i32* %88)
store i8 %89, i8* %7
%90 = load i32, i32* %8
%91 = add nsw i32 %90, 1
store i32 %91, i32* %8
%92 = load i8, i8* %7
%93 = load i32, i32* %8
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 %94
store i8 %92, i8* %95
%96 = load i32*, i32** %4
%97 = call i64 @feof(i32* %96)
%98 = icmp ne i64 %97, 0
br i1 %98, label %99, label %100
99: ; preds = %87
store i32 -1, i32* %3
br label %116
100: ; preds = %87
br label %77
101: ; preds = %85
%102 = load i32, i32* %8
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 %103
store i8 0, i8* %104
%105 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%106 = call i32 @sscanf(i8* %105, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double* %9, double* %10, double* %11)
%107 = load double, double* %9
%108 = load double*, double** %5
%109 = getelementptr inbounds double, double* %108, i64 0
store double %107, double* %109
%110 = load double, double* %10
%111 = load double*, double** %5
%112 = getelementptr inbounds double, double* %111, i64 1
store double %110, double* %112
%113 = load double, double* %11
%114 = load double*, double** %5
%115 = getelementptr inbounds double, double* %114, i64 2
store double %113, double* %115
store i32 0, i32* %3
br label %116
116: ; preds = %101, %99, %71, %52, %28
%117 = load i32, i32* %3
ret i32 %117
}

LLVM IR (-O2):
@.str = [12 x i8] c"%lf %lf %lf\00"
define i32 @lcreadline(i32* nocapture %0, double* nocapture writeonly %1) {
%3 = alloca [128 x i8]
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%8 = bitcast double* %4 to i8*
%9 = bitcast double* %5 to i8*
%10 = bitcast double* %6 to i8*
br label %11
11: ; preds = %13, %2
%12 = phi i8 [ 10, %2 ], [ %14, %13 ]
switch i8 %12, label %32 [
i8 13, label %13
i8 10, label %13
i8 35, label %17
]
13: ; preds = %11, %11
%14 = tail call signext i8 @fgetc(i32* %0)
%15 = tail call i64 @feof(i32* %0)
%16 = icmp eq i64 %15, 0
br i1 %16, label %11, label %52
17: ; preds = %11, %24
%18 = phi i8 [ %25, %24 ], [ %12, %11 ]
switch i8 %18, label %20 [
i8 13, label %19
i8 10, label %19
]
19: ; preds = %17, %17
br label %26
20: ; preds = %17
%21 = tail call signext i8 @fgetc(i32* %0)
%22 = tail call i64 @feof(i32* %0)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %52
24: ; preds = %26, %20
%25 = phi i8 [ %21, %20 ], [ %27, %26 ]
br label %17
26: ; preds = %19, %28
%27 = phi i8 [ %29, %28 ], [ %18, %19 ]
switch i8 %27, label %32 [
i8 13, label %28
i8 10, label %28
i8 35, label %24
]
28: ; preds = %26, %26
%29 = tail call signext i8 @fgetc(i32* %0)
%30 = tail call i64 @feof(i32* %0)
%31 = icmp eq i64 %30, 0
br i1 %31, label %26, label %52
32: ; preds = %11, %26
%33 = phi i8 [ %27, %26 ], [ %12, %11 ]
store i8 %33, i8* %7
br label %34
34: ; preds = %37, %32
%35 = phi i64 [ %39, %37 ], [ 0, %32 ]
%36 = phi i8 [ %38, %37 ], [ %33, %32 ]
switch i8 %36, label %37 [
i8 13, label %43
i8 10, label %43
]
37: ; preds = %34
%38 = tail call signext i8 @fgetc(i32* %0)
%39 = add nuw i64 %35, 1
%40 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %39
store i8 %38, i8* %40
%41 = tail call i64 @feof(i32* %0)
%42 = icmp eq i64 %41, 0
br i1 %42, label %34, label %52
43: ; preds = %34, %34
%44 = and i64 %35, 4294967295
%45 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %44
store i8 0, i8* %45
%46 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double* %4, double* %5, double* %6)
%47 = load double, double* %4
store double %47, double* %1
%48 = load double, double* %5
%49 = getelementptr inbounds double, double* %1, i64 1
store double %48, double* %49
%50 = load double, double* %6
%51 = getelementptr inbounds double, double* %1, i64 2
store double %50, double* %51
br label %52
52: ; preds = %13, %20, %28, %37, %43
%53 = phi i32 [ 0, %43 ], [ -1, %37 ], [ -1, %28 ], [ -1, %20 ], [ -1, %13 ]
ret i32 %53
}