#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__ EOF;
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, double *, double *, int *,
                  int *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int getNumPoints(FILE *file) {
  rewind(file);
  int count = 0;
  double x, y;
  int nCas, nCon;
  while (EOF != fscanf(file, "%lf,%lf,%d,%d\n", &x, &y, &nCas, &nCon)) {
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<getNumPoints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rewind@plt>
movl   $0x0,-0xc(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeab(%rip),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
lea    -0x28(%rbp),%r9
call   1040 <fscanf@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     1188 <getNumPoints+0x68>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113c <getNumPoints+0x1c>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNumPoints>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
call   1030 <rewind@plt>
mov    $0xffffffff,%ebp
lea    0x8(%rsp),%r12
lea    0x4(%rsp),%r13
mov    %rsp,%r14
nopl   0x0(%rax,%rax,1)
mov    0x2e91(%rip),%rax
mov    (%rax),%r15
mov    %rbx,%rdi
lea    0xe9c(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %r12,%rcx
mov    %r13,%r8
mov    %r14,%r9
call   1040 <fscanf@plt>
add    $0x1,%ebp
cmp    %rax,%r15
jne    1150 <getNumPoints+0x30>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i64 0
@.str = [15 x i8] c"%lf,%lf,%d,%d\0A\00"
define i32 @getNumPoints(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %2
%8 = load i32*, i32** %2
%9 = call i32 @rewind(i32* %8)
store i32 0, i32* %3
br label %10
10: ; preds = %15, %1
%11 = load i64, i64* @EOF
%12 = load i32*, i32** %2
%13 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), double* %4, double* %5, i32* %6, i32* %7)
%14 = icmp ne i64 %11, %13
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %10
18: ; preds = %10
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [15 x i8] c"%lf,%lf,%d,%d\0A\00"
define i32 @getNumPoints(i32* nocapture %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = tail call i32 @rewind(i32* %0)
%7 = bitcast double* %2 to i8*
%8 = bitcast double* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
br label %11
11: ; preds = %11, %1
%12 = phi i32 [ 0, %1 ], [ %16, %11 ]
%13 = load i64, i64* @EOF
%14 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), double* %2, double* %3, i32* %4, i32* %5)
%15 = icmp eq i64 %13, %14
%16 = add nuw nsw i32 %12, 1
br i1 %15, label %17, label %11
17: ; preds = %11
ret i32 %12
}