#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 fscanf(int /*<<< orphan*/ *, char *, double *, double *);
int readpoints(FILE *stream, double **gridx, double **gridy, int xsize,
               int ysize) {
  int ix, iy;
  for (iy = 0; iy <= ysize; iy++) {
    for (ix = 0; ix <= xsize; ix++) {
      if (fscanf(stream, "%lf %lf\n", &gridx[ix][iy], &gridy[ix][iy]) < 2) {
        return 1;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<readpoints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x28(%rbp),%eax
jg     11ca <readpoints+0xba>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     11b7 <readpoints+0xa7>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
movslq -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
lea    0xe76(%rip),%rsi
call   1030 <fscanf@plt>
cmp    $0x2,%eax
jge    11a4 <readpoints+0x94>
movl   $0x1,-0x4(%rbp)
jmp    11d1 <readpoints+0xc1>
jmp    11a9 <readpoints+0x99>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1145 <readpoints+0x35>
jmp    11bc <readpoints+0xac>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1132 <readpoints+0x22>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readpoints>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %r8d,%r8d
js     11aa <readpoints+0x9a>
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
lea    0x1(%rcx),%r14d
add    $0x1,%r8d
xor    %r15d,%r15d
mov    %r8,0x10(%rsp)
mov    %rcx,0x8(%rsp)
jmp    1163 <readpoints+0x53>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15
mov    0x10(%rsp),%r8
cmp    %r8,%r15
mov    0x8(%rsp),%rcx
je     11aa <readpoints+0x9a>
test   %ecx,%ecx
js     1150 <readpoints+0x40>
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    0x0(,%r15,8),%rcx
mov    0x0(%r13,%rbp,8),%rdx
add    %rcx,%rdx
add    (%r12,%rbp,8),%rcx
mov    %rbx,%rdi
lea    0xe72(%rip),%rsi
call   1030 <fscanf@plt>
cmp    $0x2,%eax
jl     11a3 <readpoints+0x93>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1170 <readpoints+0x60>
jmp    1150 <readpoints+0x40>
mov    $0x1,%eax
jmp    11ac <readpoints+0x9c>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%lf %lf\0A\00"
define i32 @readpoints(i32* %0, double** %1, double** %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca double**
%9 = alloca double**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32* %0, i32** %7
store double** %1, double*** %8
store double** %2, double*** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 0, i32* %13
br label %14
14: ; preds = %49, %5
%15 = load i32, i32* %13
%16 = load i32, i32* %11
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %52
18: ; preds = %14
store i32 0, i32* %12
br label %19
19: ; preds = %45, %18
%20 = load i32, i32* %12
%21 = load i32, i32* %10
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %48
23: ; preds = %19
%24 = load i32*, i32** %7
%25 = load double**, double*** %8
%26 = load i32, i32* %12
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double*, double** %25, i64 %27
%29 = load double*, double** %28
%30 = load i32, i32* %13
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double**, double*** %9
%34 = load i32, i32* %12
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double*, double** %33, i64 %35
%37 = load double*, double** %36
%38 = load i32, i32* %13
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = call i32 @fscanf(i32* %24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %32, double* %40)
%42 = icmp slt i32 %41, 2
br i1 %42, label %43, label %44
43: ; preds = %23
store i32 1, i32* %6
br label %53
44: ; preds = %23
br label %45
45: ; preds = %44
%46 = load i32, i32* %12
%47 = add nsw i32 %46, 1
store i32 %47, i32* %12
br label %19
48: ; preds = %19
br label %49
49: ; preds = %48
%50 = load i32, i32* %13
%51 = add nsw i32 %50, 1
store i32 %51, i32* %13
br label %14
52: ; preds = %14
store i32 0, i32* %6
br label %53
53: ; preds = %52, %43
%54 = load i32, i32* %6
ret i32 %54
}

LLVM IR (-O2):
@.str = [9 x i8] c"%lf %lf\0A\00"
define i32 @readpoints(i32* nocapture %0, double** nocapture %1, double** nocapture %2, i32 %3, i32 %4) {
%6 = icmp slt i32 %4, 0
br i1 %6, label %31, label %7
7: ; preds = %5
%8 = icmp slt i32 %3, 0
%9 = add i32 %3, 1
%10 = add nuw i32 %4, 1
%11 = zext i32 %10 to i64
%12 = zext i32 %9 to i64
br label %13
13: ; preds = %7, %28
%14 = phi i64 [ 0, %7 ], [ %29, %28 ]
br i1 %8, label %28, label %18
15: ; preds = %18
%16 = add nuw nsw i64 %19, 1
%17 = icmp eq i64 %16, %12
br i1 %17, label %28, label %18
18: ; preds = %13, %15
%19 = phi i64 [ %16, %15 ], [ 0, %13 ]
%20 = getelementptr inbounds double*, double** %1, i64 %19
%21 = load double*, double** %20
%22 = getelementptr inbounds double, double* %21, i64 %14
%23 = getelementptr inbounds double*, double** %2, i64 %19
%24 = load double*, double** %23
%25 = getelementptr inbounds double, double* %24, i64 %14
%26 = tail call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %22, double* %25)
%27 = icmp slt i32 %26, 2
br i1 %27, label %31, label %15
28: ; preds = %15, %13
%29 = add nuw nsw i64 %14, 1
%30 = icmp eq i64 %29, %11
br i1 %30, label %31, label %13
31: ; preds = %28, %18, %5
%32 = phi i32 [ 0, %5 ], [ 1, %18 ], [ 0, %28 ]
ret i32 %32
}