#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;
int countNDoubles(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
scalar_t__ feof(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int readNDoubles(int /*<<< orphan*/ *, double *, int);
double sqrt(double);
int /*<<< orphan*/ stderr;
int strlen(char *);
void stub1(double *, int, double *, int);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
void readCameraParams(FILE *fp, int cnp,
                      void (*infilter)(double *pin, int nin, double *pout,
                                       int nout),
                      int filecnp, double *params, double *initrot) {
  int lineno, n, ch;
  double *tofilter;
  if (filecnp > 0 && infilter) {
    if ((tofilter = (double *)malloc(filecnp * sizeof(double))) == NULL) {
      ;
      fprintf(stderr, "memory allocation failed in readCameraParams()\n");
      exit(1);
    }
  } else {
    infilter = NULL;
    tofilter = NULL;
    filecnp = cnp;
  }
  if ((n = countNDoubles(fp)) != filecnp) {
    fprintf(stderr,
            "readCameraParams(): expected %d camera parameters, first line "
            "contains %d!\n",
            filecnp, n);
    exit(1);
  }
  lineno = 0;
  while (!feof(fp)) {
    if ((ch = fgetc(fp)) == '#') {
      {
        char buf[2048];
        while (!feof(fp))
          if (!fgets(buf, 2048 - 1, fp) || buf[strlen(buf) - 1] == '\n')
            break;
      };
      ++lineno;
      continue;
    }
    if (feof(fp))
      break;
    ungetc(ch, fp);
    ++lineno;
    if (infilter) {
      n = readNDoubles(fp, tofilter, filecnp);
      (*infilter)(tofilter, filecnp, params, cnp);
    } else
      n = readNDoubles(fp, params, cnp);
    if (n == EOF)
      break;
    if (n != filecnp) {
      fprintf(
          stderr,
          "readCameraParams(): line %d contains %d parameters, expected %d!\n",
          lineno, n, filecnp);
      exit(1);
    }
    if (ferror(fp)) {
      fprintf(stderr, "findNcameras(): error reading input file, line %d\n",
              lineno);
      exit(1);
    }
    initrot[1] = params[cnp - 6];
    initrot[2] = params[cnp - 5];
    initrot[3] = params[cnp - 4];
    initrot[0] = sqrt(1.0 - initrot[1] * initrot[1] - initrot[2] * initrot[2] -
                      initrot[3] * initrot[3]);
    params += cnp;
    initrot += 4;
  }
  if (tofilter)
    free(tofilter);
}


x86 assembly (clang, -O0):
<readCameraParams>:
push   %rbp
mov    %rsp,%rbp
sub    $0x850,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    1249 <readCameraParams+0x79>
cmpq   $0x0,-0x18(%rbp)
je     1249 <readCameraParams+0x79>
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1244 <readCameraParams+0x74>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
lea    0xdd5(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    125f <readCameraParams+0x8f>
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <countNDoubles@plt>
mov    %eax,-0x38(%rbp)
cmp    -0x1c(%rbp),%eax
je     129b <readCameraParams+0xcb>
mov    0x2d5d(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
mov    -0x38(%rbp),%ecx
lea    0xdae(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12c1 <readCameraParams+0xf1>
jmp    156d <readCameraParams+0x39d>
mov    -0x8(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x23,%eax
jne    1352 <readCameraParams+0x182>
jmp    12db <readCameraParams+0x10b>
mov    -0x8(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12fa <readCameraParams+0x12a>
jmp    1344 <readCameraParams+0x174>
lea    -0x850(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x7ff,%esi
call   1080 <fgets@plt>
cmp    $0x0,%eax
je     133a <readCameraParams+0x16a>
lea    -0x850(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x850(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    133f <readCameraParams+0x16f>
jmp    1344 <readCameraParams+0x174>
jmp    12db <readCameraParams+0x10b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12a2 <readCameraParams+0xd2>
mov    -0x8(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%rax
je     136a <readCameraParams+0x19a>
jmp    156d <readCameraParams+0x39d>
mov    -0x3c(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   10d0 <ungetc@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     13b6 <readCameraParams+0x1e6>
mov    -0x8(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <readNDoubles@plt>
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x48(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0xc(%rbp),%ecx
call   *%rax
jmp    13c9 <readCameraParams+0x1f9>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <readNDoubles@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    0x2c15(%rip),%rcx
cmp    (%rcx),%eax
jne    13e0 <readCameraParams+0x210>
jmp    156d <readCameraParams+0x39d>
mov    -0x38(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     1417 <readCameraParams+0x247>
mov    0x2be5(%rip),%rax
mov    (%rax),%edi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xc7e(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x8(%rbp),%rdi
call   1050 <ferror@plt>
cmp    $0x0,%rax
je     144e <readCameraParams+0x27e>
mov    0x2ba7(%rip),%rax
mov    (%rax),%edi
mov    -0x34(%rbp),%edx
lea    0xc89(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x28(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x6,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x28(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x5,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x28(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x4,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xb2c(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x30(%rbp),%rax
movsd  0x10(%rax),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x30(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  0x18(%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   10e0 <sqrt@plt>
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x30(%rbp)
jmp    12a2 <readCameraParams+0xd2>
cmpq   $0x0,-0x48(%rbp)
je     1581 <readCameraParams+0x3b1>
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
add    $0x850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readCameraParams>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x868,%rsp
mov    %r9,%r12
mov    %r8,%r14
mov    %ecx,%r13d
mov    %rdi,%rbp
xor    %eax,%eax
mov    $0x0,%ecx
test   %rdx,%rdx
mov    %rsi,0x10(%rsp)
mov    %esi,%ebx
je     1224 <readCameraParams+0x54>
test   %r13d,%r13d
jle    1224 <readCameraParams+0x54>
mov    %rdx,%r15
lea    0x0(,%r13,8),%edi
call   10c0 <malloc@plt>
mov    %r13d,%ebx
mov    %r15,%rcx
test   %rax,%rax
je     1458 <readCameraParams+0x288>
mov    %rcx,0x58(%rsp)
mov    %rax,0x28(%rsp)
mov    %r12,0x20(%rsp)
mov    %rbp,%rdi
call   1090 <countNDoubles@plt>
mov    %ebx,0xc(%rsp)
cmp    %ebx,%eax
jne    1431 <readCameraParams+0x261>
mov    %rbp,%rdi
call   10b0 <feof@plt>
test   %rax,%rax
je     1275 <readCameraParams+0xa5>
mov    0x28(%rsp),%rdi
test   %rdi,%rdi
je     1263 <readCameraParams+0x93>
call   1040 <free@plt>
add    $0x868,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rsp),%rcx
lea    -0x6(%rcx),%eax
movslq %eax,%r13
lea    -0x5(%rcx),%eax
cltq
mov    %rax,0x50(%rsp)
lea    -0x4(%rcx),%eax
cltq
mov    %rax,0x48(%rsp)
movslq %ecx,%rax
mov    %rax,0x40(%rsp)
xor    %r15d,%r15d
lea    0x60(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   1070 <fgetc@plt>
cmp    $0x23,%eax
jne    1309 <readCameraParams+0x139>
nopl   (%rax)
mov    %rbp,%rdi
call   10b0 <feof@plt>
test   %rax,%rax
jne    12f3 <readCameraParams+0x123>
mov    %r12,%rdi
mov    $0x7ff,%esi
mov    %rbp,%rdx
call   1080 <fgets@plt>
test   %eax,%eax
je     12f3 <readCameraParams+0x123>
mov    %r12,%rdi
call   1060 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%r12,1)
jne    12c0 <readCameraParams+0xf0>
add    $0x1,%r15d
mov    %rbp,%rdi
call   10b0 <feof@plt>
test   %rax,%rax
je     12b0 <readCameraParams+0xe0>
jmp    1254 <readCameraParams+0x84>
mov    %eax,%ebx
mov    %rbp,%rdi
call   10b0 <feof@plt>
test   %rax,%rax
jne    1254 <readCameraParams+0x84>
mov    %r13,0x38(%rsp)
mov    %ebx,%edi
mov    %rbp,%rsi
call   10d0 <ungetc@plt>
mov    0x58(%rsp),%r13
mov    %rbp,%rdi
test   %r13,%r13
je     136f <readCameraParams+0x19f>
mov    %r14,0x30(%rsp)
mov    0x28(%rsp),%r14
mov    %r14,%rsi
mov    0xc(%rsp),%ebx
mov    %ebx,%edx
call   1030 <readNDoubles@plt>
mov    %eax,0x1c(%rsp)
mov    %r14,%rdi
mov    0x30(%rsp),%r14
mov    %ebx,%esi
mov    %r14,%rdx
mov    0x10(%rsp),%rcx
call   *%r13
mov    0x1c(%rsp),%ecx
jmp    137e <readCameraParams+0x1ae>
mov    %r14,%rsi
mov    0x10(%rsp),%rdx
call   1030 <readNDoubles@plt>
mov    %eax,%ecx
mov    0x2c63(%rip),%rax
cmp    (%rax),%ecx
mov    0x38(%rsp),%r13
je     1254 <readCameraParams+0x84>
add    $0x1,%r15d
cmp    0xc(%rsp),%ecx
jne    1479 <readCameraParams+0x2a9>
mov    %rbp,%rdi
call   1050 <ferror@plt>
test   %rax,%rax
jne    14a2 <readCameraParams+0x2d2>
movsd  (%r14,%r13,8),%xmm1
mov    0x20(%rsp),%rbx
movsd  %xmm1,0x8(%rbx)
mov    0x50(%rsp),%rax
movsd  (%r14,%rax,8),%xmm2
movsd  %xmm2,0x10(%rbx)
mov    0x48(%rsp),%rax
movsd  (%r14,%rax,8),%xmm3
movsd  %xmm3,0x18(%rbx)
mulsd  %xmm1,%xmm1
movsd  0xc13(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm2
subsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm3
subsd  %xmm3,%xmm0
ucomisd 0xbff(%rip),%xmm0
jb     1411 <readCameraParams+0x241>
sqrtsd %xmm0,%xmm0
jmp    1416 <readCameraParams+0x246>
call   10e0 <sqrt@plt>
movsd  %xmm0,(%rbx)
mov    0x40(%rsp),%rax
lea    (%r14,%rax,8),%r14
add    $0x20,%rbx
mov    %rbx,0x20(%rsp)
jmp    12f7 <readCameraParams+0x127>
mov    0x2ba0(%rip),%rcx
mov    (%rcx),%edi
lea    0xbff(%rip),%rsi
mov    0xc(%rsp),%edx
mov    %eax,%ecx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2b79(%rip),%rax
mov    (%rax),%edi
lea    0xba8(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2b58(%rip),%rax
mov    (%rax),%edi
lea    0xc03(%rip),%rsi
mov    %r15d,%edx
mov    0xc(%rsp),%r8d
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2b2f(%rip),%rax
mov    (%rax),%edi
lea    0xc1c(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [48 x i8] c"memory allocation failed in readCameraParams()\0A\00"
@.str.1 = [76 x i8] c"readCameraParams(): expected %d camera parameters, first line contains %d!\0A\00"
@EOF = global i32 0
@.str.2 = [66 x i8] c"readCameraParams(): line %d contains %d parameters, expected %d!\0A\00"
@.str.3 = [51 x i8] c"findNcameras(): error reading input file, line %d\0A\00"
define void @readCameraParams(i32* %0, i32 %1, void (double*, i32, double*, i32)* %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca void (double*, i32, double*, i32)*
%10 = alloca i32
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double*
%17 = alloca [2048 x i8]
store i32* %0, i32** %7
store i32 %1, i32* %8
store void (double*, i32, double*, i32)* %2, void (double*, i32, double*, i32)** %9
store i32 %3, i32* %10
store double* %4, double** %11
store double* %5, double** %12
%18 = load i32, i32* %10
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %36
20: ; preds = %6
%21 = load void (double*, i32, double*, i32)*, void (double*, i32, double*, i32)** %9
%22 = icmp ne void (double*, i32, double*, i32)* %21, null
br i1 %22, label %23, label %36
23: ; preds = %20
%24 = load i32, i32* %10
%25 = sext i32 %24 to i64
%26 = mul i64 %25, 8
%27 = trunc i64 %26 to i32
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to double*
store double* %29, double** %16
%30 = icmp eq double* %29, null
br i1 %30, label %31, label %35
31: ; preds = %23
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %23
br label %38
36: ; preds = %20, %6
store void (double*, i32, double*, i32)* null, void (double*, i32, double*, i32)** %9
store double* null, double** %16
%37 = load i32, i32* %8
store i32 %37, i32* %10
br label %38
38: ; preds = %36, %35
%39 = load i32*, i32** %7
%40 = call i32 @countNDoubles(i32* %39)
store i32 %40, i32* %14
%41 = load i32, i32* %10
%42 = icmp ne i32 %40, %41
br i1 %42, label %43, label %49
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = load i32, i32* %10
%46 = load i32, i32* %14
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0), i32 %45, i32 %46)
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %38
store i32 0, i32* %13
br label %50
50: ; preds = %137, %81, %49
%51 = load i32*, i32** %7
%52 = call i64 @feof(i32* %51)
%53 = icmp ne i64 %52, 0
%54 = xor i1 %53, true
br i1 %54, label %55, label %195
55: ; preds = %50
%56 = load i32*, i32** %7
%57 = call i32 @fgetc(i32* %56)
store i32 %57, i32* %15
%58 = icmp eq i32 %57, 35
br i1 %58, label %59, label %84
59: ; preds = %55
br label %60
60: ; preds = %80, %59
%61 = load i32*, i32** %7
%62 = call i64 @feof(i32* %61)
%63 = icmp ne i64 %62, 0
%64 = xor i1 %63, true
br i1 %64, label %65, label %81
65: ; preds = %60
%66 = getelementptr inbounds [2048 x i8], [2048 x i8]* %17, i64 0, i64 0
%67 = load i32*, i32** %7
%68 = call i32 @fgets(i8* %66, i32 2047, i32* %67)
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %79
70: ; preds = %65
%71 = getelementptr inbounds [2048 x i8], [2048 x i8]* %17, i64 0, i64 0
%72 = call i32 @strlen(i8* %71)
%73 = sub nsw i32 %72, 1
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [2048 x i8], [2048 x i8]* %17, i64 0, i64 %74
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = icmp eq i32 %77, 10
br i1 %78, label %79, label %80
79: ; preds = %70, %65
br label %81
80: ; preds = %70
br label %60
81: ; preds = %79, %60
%82 = load i32, i32* %13
%83 = add nsw i32 %82, 1
store i32 %83, i32* %13
br label %50
84: ; preds = %55
%85 = load i32*, i32** %7
%86 = call i64 @feof(i32* %85)
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %89
88: ; preds = %84
br label %195
89: ; preds = %84
%90 = load i32, i32* %15
%91 = load i32*, i32** %7
%92 = call i32 @ungetc(i32 %90, i32* %91)
%93 = load i32, i32* %13
%94 = add nsw i32 %93, 1
store i32 %94, i32* %13
%95 = load void (double*, i32, double*, i32)*, void (double*, i32, double*, i32)** %9
%96 = icmp ne void (double*, i32, double*, i32)* %95, null
br i1 %96, label %97, label %107
97: ; preds = %89
%98 = load i32*, i32** %7
%99 = load double*, double** %16
%100 = load i32, i32* %10
%101 = call i32 @readNDoubles(i32* %98, double* %99, i32 %100)
store i32 %101, i32* %14
%102 = load void (double*, i32, double*, i32)*, void (double*, i32, double*, i32)** %9
%103 = load double*, double** %16
%104 = load i32, i32* %10
%105 = load double*, double** %11
%106 = load i32, i32* %8
br label %112
107: ; preds = %89
%108 = load i32*, i32** %7
%109 = load double*, double** %11
%110 = load i32, i32* %8
%111 = call i32 @readNDoubles(i32* %108, double* %109, i32 %110)
store i32 %111, i32* %14
br label %112
112: ; preds = %107, %97
%113 = load i32, i32* %14
%114 = load i32, i32* @EOF
%115 = icmp eq i32 %113, %114
br i1 %115, label %116, label %117
116: ; preds = %112
br label %195
117: ; preds = %112
%118 = load i32, i32* %14
%119 = load i32, i32* %10
%120 = icmp ne i32 %118, %119
br i1 %120, label %121, label %128
121: ; preds = %117
%122 = load i32, i32* @stderr
%123 = load i32, i32* %13
%124 = load i32, i32* %14
%125 = load i32, i32* %10
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %122, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.2, i64 0, i64 0), i32 %123, i32 %124, i32 %125)
%127 = call i32 @exit(i32 1)
unreachable
128: ; preds = %117
%129 = load i32*, i32** %7
%130 = call i64 @ferror(i32* %129)
%131 = icmp ne i64 %130, 0
br i1 %131, label %132, label %137
132: ; preds = %128
%133 = load i32, i32* @stderr
%134 = load i32, i32* %13
%135 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %134)
%136 = call i32 @exit(i32 1)
unreachable
137: ; preds = %128
%138 = load double*, double** %11
%139 = load i32, i32* %8
%140 = sub nsw i32 %139, 6
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds double, double* %138, i64 %141
%143 = load double, double* %142
%144 = load double*, double** %12
%145 = getelementptr inbounds double, double* %144, i64 1
store double %143, double* %145
%146 = load double*, double** %11
%147 = load i32, i32* %8
%148 = sub nsw i32 %147, 5
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds double, double* %146, i64 %149
%151 = load double, double* %150
%152 = load double*, double** %12
%153 = getelementptr inbounds double, double* %152, i64 2
store double %151, double* %153
%154 = load double*, double** %11
%155 = load i32, i32* %8
%156 = sub nsw i32 %155, 4
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds double, double* %154, i64 %157
%159 = load double, double* %158
%160 = load double*, double** %12
%161 = getelementptr inbounds double, double* %160, i64 3
store double %159, double* %161
%162 = load double*, double** %12
%163 = getelementptr inbounds double, double* %162, i64 1
%164 = load double, double* %163
%165 = load double*, double** %12
%166 = getelementptr inbounds double, double* %165, i64 1
%167 = load double, double* %166
%168 = fneg double %164
%169 = call double @llvm.fmuladd.f64(double %168, double %167, double 1.000000e+00)
%170 = load double*, double** %12
%171 = getelementptr inbounds double, double* %170, i64 2
%172 = load double, double* %171
%173 = load double*, double** %12
%174 = getelementptr inbounds double, double* %173, i64 2
%175 = load double, double* %174
%176 = fneg double %172
%177 = call double @llvm.fmuladd.f64(double %176, double %175, double %169)
%178 = load double*, double** %12
%179 = getelementptr inbounds double, double* %178, i64 3
%180 = load double, double* %179
%181 = load double*, double** %12
%182 = getelementptr inbounds double, double* %181, i64 3
%183 = load double, double* %182
%184 = fneg double %180
%185 = call double @llvm.fmuladd.f64(double %184, double %183, double %177)
%186 = call double @sqrt(double %185)
%187 = load double*, double** %12
%188 = getelementptr inbounds double, double* %187, i64 0
store double %186, double* %188
%189 = load i32, i32* %8
%190 = load double*, double** %11
%191 = sext i32 %189 to i64
%192 = getelementptr inbounds double, double* %190, i64 %191
store double* %192, double** %11
%193 = load double*, double** %12
%194 = getelementptr inbounds double, double* %193, i64 4
store double* %194, double** %12
br label %50
195: ; preds = %116, %88, %50
%196 = load double*, double** %16
%197 = icmp ne double* %196, null
br i1 %197, label %198, label %201
198: ; preds = %195
%199 = load double*, double** %16
%200 = call i32 @free(double* %199)
br label %201
201: ; preds = %198, %195
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [48 x i8] c"memory allocation failed in readCameraParams()\0A\00"
@.str.1 = [76 x i8] c"readCameraParams(): expected %d camera parameters, first line contains %d!\0A\00"
@EOF = global i32 0
@.str.2 = [66 x i8] c"readCameraParams(): line %d contains %d parameters, expected %d!\0A\00"
@.str.3 = [51 x i8] c"findNcameras(): error reading input file, line %d\0A\00"
define void @readCameraParams(i32* %0, i32 %1, void (double*, i32, double*, i32)* %2, i32 %3, double* %4, double* nocapture %5) {
%7 = alloca [2048 x i8]
%8 = icmp sgt i32 %3, 0
%9 = icmp ne void (double*, i32, double*, i32)* %2, null
%10 = and i1 %9, %8
br i1 %10, label %11, label %20
11: ; preds = %6
%12 = shl i32 %3, 3
%13 = tail call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to double*
%15 = icmp eq i64 %13, 0
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %6, %11
%21 = phi i32 [ %3, %11 ], [ %1, %6 ]
%22 = phi void (double*, i32, double*, i32)* [ %2, %11 ], [ null, %6 ]
%23 = phi double* [ %14, %11 ], [ null, %6 ]
%24 = tail call i32 @countNDoubles(i32* %0)
%25 = icmp eq i32 %24, %21
br i1 %25, label %26, label %39
26: ; preds = %20
%27 = call i64 @feof(i32* %0)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %117
29: ; preds = %26
%30 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%31 = icmp eq void (double*, i32, double*, i32)* %22, null
%32 = add nsw i32 %1, -6
%33 = sext i32 %32 to i64
%34 = add nsw i32 %1, -5
%35 = sext i32 %34 to i64
%36 = add nsw i32 %1, -4
%37 = sext i32 %36 to i64
%38 = sext i32 %1 to i64
br label %113
39: ; preds = %20
%40 = load i32, i32* @stderr
%41 = tail call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %24)
%42 = tail call i32 @exit(i32 1)
unreachable
43: ; preds = %113, %61
%44 = phi i32 [ %114, %113 ], [ %62, %61 ]
%45 = call i32 @fgetc(i32* %0)
%46 = icmp eq i32 %45, 35
br i1 %46, label %47, label %65
47: ; preds = %43
br label %48
48: ; preds = %54, %47
%49 = call i64 @feof(i32* %0)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %61
51: ; preds = %48
%52 = call i32 @fgets(i8* %30, i32 2047, i32* %0)
%53 = icmp eq i32 %52, 0
br i1 %53, label %61, label %54
54: ; preds = %51
%55 = call i32 @strlen(i8* %30)
%56 = add nsw i32 %55, -1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 %57
%59 = load i8, i8* %58
%60 = icmp eq i8 %59, 10
br i1 %60, label %61, label %48
61: ; preds = %51, %54, %48
%62 = add nsw i32 %44, 1
%63 = call i64 @feof(i32* %0)
%64 = icmp eq i64 %63, 0
br i1 %64, label %43, label %117
65: ; preds = %43
%66 = call i64 @feof(i32* %0)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %117
68: ; preds = %65
%69 = call i32 @ungetc(i32 %45, i32* %0)
%70 = add nsw i32 %44, 1
br i1 %31, label %73, label %71
71: ; preds = %68
%72 = call i32 @readNDoubles(i32* %0, double* %23, i32 %21)
br label %75
73: ; preds = %68
%74 = call i32 @readNDoubles(i32* %0, double* %116, i32 %1)
br label %75
75: ; preds = %73, %71
%76 = phi i32 [ %72, %71 ], [ %74, %73 ]
%77 = load i32, i32* @EOF
%78 = icmp eq i32 %76, %77
br i1 %78, label %117, label %79
79: ; preds = %75
%80 = icmp eq i32 %76, %21
br i1 %80, label %85, label %81
81: ; preds = %79
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.2, i64 0, i64 0), i32 %70, i32 %76, i32 %21)
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %79
%86 = call i64 @ferror(i32* %0)
%87 = icmp eq i64 %86, 0
br i1 %87, label %92, label %88
88: ; preds = %85
%89 = load i32, i32* @stderr
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %70)
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %85
%93 = getelementptr inbounds double, double* %116, i64 %33
%94 = load double, double* %93
%95 = getelementptr inbounds double, double* %115, i64 1
store double %94, double* %95
%96 = getelementptr inbounds double, double* %116, i64 %35
%97 = load double, double* %96
%98 = getelementptr inbounds double, double* %115, i64 2
store double %97, double* %98
%99 = getelementptr inbounds double, double* %116, i64 %37
%100 = load double, double* %99
%101 = getelementptr inbounds double, double* %115, i64 3
store double %100, double* %101
%102 = fneg double %94
%103 = call double @llvm.fmuladd.f64(double %102, double %94, double 1.000000e+00)
%104 = fneg double %97
%105 = call double @llvm.fmuladd.f64(double %104, double %97, double %103)
%106 = fneg double %100
%107 = call double @llvm.fmuladd.f64(double %106, double %100, double %105)
%108 = call double @sqrt(double %107)
store double %108, double* %115
%109 = getelementptr inbounds double, double* %116, i64 %38
%110 = getelementptr inbounds double, double* %115, i64 4
%111 = call i64 @feof(i32* %0)
%112 = icmp eq i64 %111, 0
br i1 %112, label %113, label %117
113: ; preds = %29, %92
%114 = phi i32 [ 0, %29 ], [ %70, %92 ]
%115 = phi double* [ %5, %29 ], [ %110, %92 ]
%116 = phi double* [ %4, %29 ], [ %109, %92 ]
br label %43
117: ; preds = %75, %65, %92, %61, %26
%118 = icmp eq double* %23, null
br i1 %118, label %121, label %119
119: ; preds = %117
%120 = call i32 @free(double* %23)
br label %121
121: ; preds = %119, %117
ret void
}