#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*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, ...);
int read_vtk(char *fn, int *pnV, double *vertex, int *pnF, int *face,
             int *facematerial, int nnV, int nnF) {
  FILE *f;
  char buf[1024];
  int i, r, nv, nf;
  if (!(f = fopen(fn, "r"))) {
    perror(fn);
    return 1;
  }
  do {
    fgets(buf, 1024, f);
  } while (sscanf(buf, "POINTS %d", &nv) < 1);
  if (nv > nnV) {
    printf("nV > max_nV!\n");
    return 2;
  }
  for (i = 0; i < nv; i++) {
    fgets(buf, 1024, f);
    r = sscanf(buf, "%lf %lf %lf", vertex + 3 * i + 0, vertex + 3 * i + 1,
               vertex + 3 * i + 2);
    if (r < 3) {
      printf("%s\nexpected \"x y z\"\n", buf);
    }
  }
  do {
    fgets(buf, 1024, f);
  } while (sscanf(buf, "POLYGONS %d", &nf) < 1);
  if (nf > nnF) {
    printf("nF > max_nF!\n");
    return 2;
  }
  for (i = 0; i < nf; i++) {
    fgets(buf, 1024, f);
    r = sscanf(buf, "3 %d %d %d", face + 3 * i + 0, face + 3 * i + 1,
               face + 3 * i + 2);
    if (r < 3) {
      printf("%s\nexpected \"3 i1 i2 i3\"\n", buf);
    }
    facematerial[i] = 1;
    face[3 * i + 0]++;
    face[3 * i + 1]++;
    face[3 * i + 2]++;
  }
  *pnV = nv;
  *pnF = nf;
  return 0;
}


x86 assembly (clang, -O0):
<read_vtk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe7c(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    11ac <read_vtk+0x5c>
mov    -0x10(%rbp),%rdi
call   1070 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    148c <read_vtk+0x33c>
jmp    11b1 <read_vtk+0x61>
lea    -0x440(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
lea    -0x440(%rbp),%rdi
lea    0xe2e(%rip),%rsi
lea    -0x44c(%rbp),%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jl     11b1 <read_vtk+0x61>
mov    -0x44c(%rbp),%eax
cmp    0x10(%rbp),%eax
jle    1214 <read_vtk+0xc4>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    148c <read_vtk+0x33c>
movl   $0x0,-0x444(%rbp)
mov    -0x444(%rbp),%eax
cmp    -0x44c(%rbp),%eax
jge    12df <read_vtk+0x18f>
lea    -0x440(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
lea    -0x440(%rbp),%rdi
mov    -0x20(%rbp),%rdx
imul   $0x3,-0x444(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rcx
imul   $0x3,-0x444(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
add    $0x8,%rcx
mov    -0x20(%rbp),%r8
imul   $0x3,-0x444(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r8
add    $0x10,%r8
lea    0xd83(%rip),%rsi
mov    $0x0,%al
call   1050 <sscanf@plt>
mov    %eax,-0x448(%rbp)
cmpl   $0x3,-0x448(%rbp)
jge    12c6 <read_vtk+0x176>
lea    -0x440(%rbp),%rsi
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12cb <read_vtk+0x17b>
mov    -0x444(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x444(%rbp)
jmp    121e <read_vtk+0xce>
jmp    12e4 <read_vtk+0x194>
lea    -0x440(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
lea    -0x440(%rbp),%rdi
lea    0xd34(%rip),%rsi
lea    -0x450(%rbp),%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jl     12e4 <read_vtk+0x194>
mov    -0x450(%rbp),%eax
cmp    0x18(%rbp),%eax
jle    1347 <read_vtk+0x1f7>
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    148c <read_vtk+0x33c>
movl   $0x0,-0x444(%rbp)
mov    -0x444(%rbp),%eax
cmp    -0x450(%rbp),%eax
jge    146d <read_vtk+0x31d>
lea    -0x440(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
lea    -0x440(%rbp),%rdi
mov    -0x30(%rbp),%rdx
imul   $0x3,-0x444(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdx
mov    -0x30(%rbp),%rcx
imul   $0x3,-0x444(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rcx
add    $0x4,%rcx
mov    -0x30(%rbp),%r8
imul   $0x3,-0x444(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%r8
add    $0x8,%r8
lea    0xc8b(%rip),%rsi
mov    $0x0,%al
call   1050 <sscanf@plt>
mov    %eax,-0x448(%rbp)
cmpl   $0x3,-0x448(%rbp)
jge    13f9 <read_vtk+0x2a9>
lea    -0x440(%rbp),%rsi
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
movslq -0x444(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
imul   $0x3,-0x444(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
imul   $0x3,-0x444(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
imul   $0x3,-0x444(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x444(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x444(%rbp)
jmp    1351 <read_vtk+0x201>
mov    -0x44c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x450(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_vtk>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %r9,0x18(%rsp)
mov    %r8,%r13
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%rbx
lea    0xe74(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     138f <read_vtk+0x22f>
mov    %rax,%r15
mov    %rbp,0x8(%rsp)
mov    %r14,0x10(%rsp)
lea    0x20(%rsp),%rbp
lea    0xe4f(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <sscanf@plt>
test   %eax,%eax
jle    11c0 <read_vtk+0x60>
mov    (%rsp),%eax
cmp    0x460(%rsp),%eax
jle    11fc <read_vtk+0x9c>
lea    0xe74(%rip),%rdi
jmp    12c8 <read_vtk+0x168>
test   %eax,%eax
jle    1270 <read_vtk+0x110>
lea    0x20(%rsp),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1221 <read_vtk+0xc1>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movslq (%rsp),%rax
add    $0x3,%rbp
cmp    %rax,%rbx
jge    1270 <read_vtk+0x110>
mov    %r14,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
mov    %ebp,%eax
lea    (%r12,%rax,8),%rdx
lea    (%r12,%rax,8),%rcx
add    $0x8,%rcx
lea    (%r12,%rax,8),%r8
add    $0x10,%r8
mov    %r14,%rdi
lea    0xdbb(%rip),%rsi
xor    %eax,%eax
call   1060 <sscanf@plt>
cmp    $0x2,%eax
jg     1210 <read_vtk+0xb0>
lea    0xdb4(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1210 <read_vtk+0xb0>
lea    0x20(%rsp),%rbp
lea    0xdb1(%rip),%r14
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <sscanf@plt>
test   %eax,%eax
jle    1290 <read_vtk+0x130>
mov    0x4(%rsp),%eax
cmp    0x468(%rsp),%eax
jle    12d7 <read_vtk+0x177>
lea    0xd96(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%eax
jmp    139c <read_vtk+0x23c>
test   %eax,%eax
jle    137a <read_vtk+0x21a>
lea    0x20(%rsp),%r12
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    1324 <read_vtk+0x1c4>
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%rax
movl   $0x1,(%rax,%r14,4)
addl   $0x1,0x0(%rbp)
lea    0x1(%rbx),%eax
addl   $0x1,0x0(%r13,%rax,4)
lea    0x2(%rbx),%eax
addl   $0x1,0x0(%r13,%rax,4)
add    $0x1,%r14
movslq 0x4(%rsp),%rax
add    $0x3,%ebx
cmp    %rax,%r14
jge    137a <read_vtk+0x21a>
mov    %r12,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
mov    %ebx,%eax
lea    0x0(,%rax,4),%rbp
add    %r13,%rbp
lea    0x4(%r13,%rax,4),%rcx
lea    0x8(%r13,%rax,4),%r8
mov    %r12,%rdi
lea    0xce4(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <sscanf@plt>
cmp    $0x2,%eax
jg     12f0 <read_vtk+0x190>
lea    0xcd9(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12f0 <read_vtk+0x190>
mov    (%rsp),%ecx
mov    0x8(%rsp),%rdx
mov    %ecx,(%rdx)
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
jmp    139c <read_vtk+0x23c>
mov    %rbx,%rdi
call   1080 <perror@plt>
mov    $0x1,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [10 x i8] c"POINTS %d\00"
@.str.2 = [14 x i8] c"nV > max_nV!\0A\00"
@.str.3 = [12 x i8] c"%lf %lf %lf\00"
@.str.4 = [21 x i8] c"%s\0Aexpected \22x y z\22\0A\00"
@.str.5 = [12 x i8] c"POLYGONS %d\00"
@.str.6 = [14 x i8] c"nF > max_nF!\0A\00"
@.str.7 = [11 x i8] c"3 %d %d %d\00"
@.str.8 = [26 x i8] c"%s\0Aexpected \223 i1 i2 i3\22\0A\00"
define i32 @read_vtk(i8* %0, i32* %1, double* %2, i32* %3, i32* %4, i32* %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca double*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32*
%19 = alloca [1024 x i8]
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
store i8* %0, i8** %10
store i32* %1, i32** %11
store double* %2, double** %12
store i32* %3, i32** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i32 %6, i32* %16
store i32 %7, i32* %17
%24 = load i8*, i8** %10
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %25, i32** %18
%26 = icmp ne i32* %25, null
br i1 %26, label %30, label %27
27: ; preds = %8
%28 = load i8*, i8** %10
%29 = call i32 @perror(i8* %28)
store i32 1, i32* %9
br label %169
30: ; preds = %8
br label %31
31: ; preds = %35, %30
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%33 = load i32*, i32** %18
%34 = call i32 @fgets(i8* %32, i32 1024, i32* %33)
br label %35
35: ; preds = %31
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%37 = call i32 (i8*, i8*, ...) @sscanf(i8* %36, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%38 = icmp slt i32 %37, 1
br i1 %38, label %31, label %39
39: ; preds = %35
%40 = load i32, i32* %22
%41 = load i32, i32* %16
%42 = icmp sgt i32 %40, %41
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 2, i32* %9
br label %169
45: ; preds = %39
store i32 0, i32* %20
br label %46
46: ; preds = %80, %45
%47 = load i32, i32* %20
%48 = load i32, i32* %22
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %83
50: ; preds = %46
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%52 = load i32*, i32** %18
%53 = call i32 @fgets(i8* %51, i32 1024, i32* %52)
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%55 = load double*, double** %12
%56 = load i32, i32* %20
%57 = mul nsw i32 3, %56
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %55, i64 %58
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double*, double** %12
%62 = load i32, i32* %20
%63 = mul nsw i32 3, %62
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %61, i64 %64
%66 = getelementptr inbounds double, double* %65, i64 1
%67 = load double*, double** %12
%68 = load i32, i32* %20
%69 = mul nsw i32 3, %68
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %67, i64 %70
%72 = getelementptr inbounds double, double* %71, i64 2
%73 = call i32 (i8*, i8*, ...) @sscanf(i8* %54, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), double* %60, double* %66, double* %72)
store i32 %73, i32* %21
%74 = load i32, i32* %21
%75 = icmp slt i32 %74, 3
br i1 %75, label %76, label %79
76: ; preds = %50
%77 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %77)
br label %79
79: ; preds = %76, %50
br label %80
80: ; preds = %79
%81 = load i32, i32* %20
%82 = add nsw i32 %81, 1
store i32 %82, i32* %20
br label %46
83: ; preds = %46
br label %84
84: ; preds = %88, %83
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%86 = load i32*, i32** %18
%87 = call i32 @fgets(i8* %85, i32 1024, i32* %86)
br label %88
88: ; preds = %84
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%90 = call i32 (i8*, i8*, ...) @sscanf(i8* %89, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32* %23)
%91 = icmp slt i32 %90, 1
br i1 %91, label %84, label %92
92: ; preds = %88
%93 = load i32, i32* %23
%94 = load i32, i32* %17
%95 = icmp sgt i32 %93, %94
br i1 %95, label %96, label %98
96: ; preds = %92
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
store i32 2, i32* %9
br label %169
98: ; preds = %92
store i32 0, i32* %20
br label %99
99: ; preds = %161, %98
%100 = load i32, i32* %20
%101 = load i32, i32* %23
%102 = icmp slt i32 %100, %101
br i1 %102, label %103, label %164
103: ; preds = %99
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%105 = load i32*, i32** %18
%106 = call i32 @fgets(i8* %104, i32 1024, i32* %105)
%107 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%108 = load i32*, i32** %14
%109 = load i32, i32* %20
%110 = mul nsw i32 3, %109
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i32, i32* %108, i64 %111
%113 = getelementptr inbounds i32, i32* %112, i64 0
%114 = load i32*, i32** %14
%115 = load i32, i32* %20
%116 = mul nsw i32 3, %115
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i32, i32* %114, i64 %117
%119 = getelementptr inbounds i32, i32* %118, i64 1
%120 = load i32*, i32** %14
%121 = load i32, i32* %20
%122 = mul nsw i32 3, %121
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i32, i32* %120, i64 %123
%125 = getelementptr inbounds i32, i32* %124, i64 2
%126 = call i32 (i8*, i8*, ...) @sscanf(i8* %107, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32* %113, i32* %119, i32* %125)
store i32 %126, i32* %21
%127 = load i32, i32* %21
%128 = icmp slt i32 %127, 3
br i1 %128, label %129, label %132
129: ; preds = %103
%130 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %130)
br label %132
132: ; preds = %129, %103
%133 = load i32*, i32** %15
%134 = load i32, i32* %20
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i32, i32* %133, i64 %135
store i32 1, i32* %136
%137 = load i32*, i32** %14
%138 = load i32, i32* %20
%139 = mul nsw i32 3, %138
%140 = add nsw i32 %139, 0
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i32, i32* %137, i64 %141
%143 = load i32, i32* %142
%144 = add nsw i32 %143, 1
store i32 %144, i32* %142
%145 = load i32*, i32** %14
%146 = load i32, i32* %20
%147 = mul nsw i32 3, %146
%148 = add nsw i32 %147, 1
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i32, i32* %145, i64 %149
%151 = load i32, i32* %150
%152 = add nsw i32 %151, 1
store i32 %152, i32* %150
%153 = load i32*, i32** %14
%154 = load i32, i32* %20
%155 = mul nsw i32 3, %154
%156 = add nsw i32 %155, 2
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i32, i32* %153, i64 %157
%159 = load i32, i32* %158
%160 = add nsw i32 %159, 1
store i32 %160, i32* %158
br label %161
161: ; preds = %132
%162 = load i32, i32* %20
%163 = add nsw i32 %162, 1
store i32 %163, i32* %20
br label %99
164: ; preds = %99
%165 = load i32, i32* %22
%166 = load i32*, i32** %11
store i32 %165, i32* %166
%167 = load i32, i32* %23
%168 = load i32*, i32** %13
store i32 %167, i32* %168
store i32 0, i32* %9
br label %169
169: ; preds = %164, %96, %43, %27
%170 = load i32, i32* %9
ret i32 %170
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [10 x i8] c"POINTS %d\00"
@.str.3 = [12 x i8] c"%lf %lf %lf\00"
@.str.4 = [21 x i8] c"%s\0Aexpected \22x y z\22\0A\00"
@.str.5 = [12 x i8] c"POLYGONS %d\00"
@.str.7 = [11 x i8] c"3 %d %d %d\00"
@.str.8 = [26 x i8] c"%s\0Aexpected \223 i1 i2 i3\22\0A\00"
@str = [13 x i8] c"nF > max_nF!\00"
@str.9 = [13 x i8] c"nV > max_nV!\00"
define i32 @read_vtk(i8* nocapture %0, i32* nocapture writeonly %1, double* %2, i32* nocapture writeonly %3, i32* %4, i32* nocapture writeonly %5, i32 %6, i32 %7) {
%9 = alloca [1024 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%13 = bitcast i32* %10 to i8*
%14 = bitcast i32* %11 to i8*
%15 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %19
17: ; preds = %8
%18 = tail call i32 @perror(i8* %0)
br label %93
19: ; preds = %8, %19
%20 = call i32 @fgets(i8* %12, i32 1024, i32* %15)
%21 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%22 = icmp slt i32 %21, 1
br i1 %22, label %19, label %23
23: ; preds = %19
%24 = load i32, i32* %10
%25 = icmp sgt i32 %24, %6
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = icmp sgt i32 %24, 0
br i1 %27, label %30, label %47
28: ; preds = %23
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.9, i64 0, i64 0))
br label %93
30: ; preds = %26, %42
%31 = phi i64 [ %43, %42 ], [ 0, %26 ]
%32 = call i32 @fgets(i8* %12, i32 1024, i32* %15)
%33 = mul i64 %31, 3
%34 = and i64 %33, 4294967295
%35 = getelementptr inbounds double, double* %2, i64 %34
%36 = getelementptr inbounds double, double* %35, i64 1
%37 = getelementptr inbounds double, double* %35, i64 2
%38 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), double* %35, double* %36, double* %37)
%39 = icmp slt i32 %38, 3
br i1 %39, label %40, label %42
40: ; preds = %30
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %12)
br label %42
42: ; preds = %30, %40
%43 = add nuw nsw i64 %31, 1
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = icmp slt i64 %43, %45
br i1 %46, label %30, label %47
47: ; preds = %42, %26
br label %48
48: ; preds = %47, %48
%49 = call i32 @fgets(i8* %12, i32 1024, i32* %15)
%50 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32* %11)
%51 = icmp slt i32 %50, 1
br i1 %51, label %48, label %52
52: ; preds = %48
%53 = load i32, i32* %11
%54 = icmp sgt i32 %53, %7
br i1 %54, label %57, label %55
55: ; preds = %52
%56 = icmp sgt i32 %53, 0
br i1 %56, label %59, label %90
57: ; preds = %52
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %93
59: ; preds = %55, %72
%60 = phi i64 [ %86, %72 ], [ 0, %55 ]
%61 = call i32 @fgets(i8* %12, i32 1024, i32* %15)
%62 = trunc i64 %60 to i32
%63 = mul nsw i32 %62, 3
%64 = zext i32 %63 to i64
%65 = getelementptr inbounds i32, i32* %4, i64 %64
%66 = getelementptr inbounds i32, i32* %65, i64 1
%67 = getelementptr inbounds i32, i32* %65, i64 2
%68 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32* %65, i32* %66, i32* %67)
%69 = icmp slt i32 %68, 3
br i1 %69, label %70, label %72
70: ; preds = %59
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %12)
br label %72
72: ; preds = %70, %59
%73 = getelementptr inbounds i32, i32* %5, i64 %60
store i32 1, i32* %73
%74 = load i32, i32* %65
%75 = add nsw i32 %74, 1
store i32 %75, i32* %65
%76 = add nuw nsw i32 %63, 1
%77 = zext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %4, i64 %77
%79 = load i32, i32* %78
%80 = add nsw i32 %79, 1
store i32 %80, i32* %78
%81 = add nuw nsw i32 %63, 2
%82 = zext i32 %81 to i64
%83 = getelementptr inbounds i32, i32* %4, i64 %82
%84 = load i32, i32* %83
%85 = add nsw i32 %84, 1
store i32 %85, i32* %83
%86 = add nuw nsw i64 %60, 1
%87 = load i32, i32* %11
%88 = sext i32 %87 to i64
%89 = icmp slt i64 %86, %88
br i1 %89, label %59, label %90
90: ; preds = %72, %55
%91 = phi i32 [ %53, %55 ], [ %87, %72 ]
%92 = load i32, i32* %10
store i32 %92, i32* %1
store i32 %91, i32* %3
br label %93
93: ; preds = %90, %57, %28, %17
%94 = phi i32 [ 2, %28 ], [ 2, %57 ], [ 0, %90 ], [ 1, %17 ]
ret i32 %94
}