#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fscanf(int /*<<< orphan*/ *, char *, float *, ...);
int /*<<< orphan*/ printf(char *, ...);
float *smalloc(int);
int input_geom(FILE *fingeom, char *geomname, int nvtxs, int *igeom, float **x,
               float **y, float **z) {
  extern int CHECK_INPUT;
  extern int DEBUG_INPUT;
  extern int DEBUG_TRACE;
  float xc, yc, zc;
  int nread;
  int flag;
  int line_num;
  int end_flag;
  int ndims;
  int i = 0;
  double read_val();
  if (DEBUG_TRACE > 0) {
    printf("<Entering input_geom>\n");
  }
  *x = *y = *z = NULL;
  line_num = 0;
  end_flag = 1;
  while (end_flag == 1) {
    xc = read_val(fingeom, &end_flag);
    ++line_num;
  }
  if (end_flag == -1) {
    printf("No values found in geometry file `%s'\n", geomname);
    fclose(fingeom);
    return (1);
  }
  ndims = 1;
  yc = read_val(fingeom, &end_flag);
  if (end_flag == 0) {
    ndims = 2;
    zc = read_val(fingeom, &end_flag);
    if (end_flag == 0) {
      ndims = 3;
      read_val(fingeom, &end_flag);
      if (!end_flag) {
        printf("Too many values on input line of geometry file `%s'\n",
               geomname);
        printf(" Maximum dimensionality is 3\n");
        fclose(fingeom);
        return (1);
      }
    }
  }
  *igeom = ndims;
  *x = smalloc(nvtxs * sizeof(float));
  (*x)[0] = xc;
  if (ndims > 1) {
    *y = smalloc(nvtxs * sizeof(float));
    (*y)[0] = yc;
  }
  if (ndims > 2) {
    *z = smalloc(nvtxs * sizeof(float));
    (*z)[0] = zc;
  }
  for (nread = 1; nread < nvtxs; nread++) {
    ++line_num;
    if (ndims == 1) {
      i = fscanf(fingeom, "%f", &((*x)[nread]));
    } else if (ndims == 2) {
      i = fscanf(fingeom, "%f%f", &((*x)[nread]), &((*y)[nread]));
    } else if (ndims == 3) {
      i = fscanf(fingeom, "%f%f%f", &((*x)[nread]), &((*y)[nread]),
                 &((*z)[nread]));
    }
    if (i == EOF) {
      printf("Too few lines of values in geometry file; nvtxs=%d, but only %d "
             "read\n",
             nvtxs, nread + 1);
      fclose(fingeom);
      return (1);
    }
    if (i != ndims) {
      printf("Wrong number of values in line %d of geometry file `%s'\n",
             line_num, geomname);
      fclose(fingeom);
      return (1);
    }
  }
  flag = 0;
  end_flag = 0;
  while (!flag && end_flag != -1) {
    read_val(fingeom, &end_flag);
    if (!end_flag) {
      flag = 1;
    }
  }
  if (flag && CHECK_INPUT) {
    printf("Warning: possible error in geometry file `%s'\n", geomname);
    printf(" Numerical data found after expected end of file\n");
  }
  fclose(fingeom);
  if (DEBUG_INPUT > 0) {
    printf("Finished reading geometry file `%s'; dimension = %d.\n", geomname,
           ndims);
  }
  return (0);
}


x86 assembly (clang, -O0):
<input_geom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    0x2e3f(%rip),%rax
cmpl   $0x0,(%rax)
jle    1198 <input_geom+0x48>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x38(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x30(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x0,-0x50(%rbp)
movl   $0x1,-0x54(%rbp)
cmpl   $0x1,-0x54(%rbp)
jne    11f7 <input_geom+0xa7>
mov    -0x10(%rbp),%rdi
lea    -0x54(%rbp),%rsi
mov    $0x0,%al
call   1060 <read_val@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    11c7 <input_geom+0x77>
cmpl   $0xffffffff,-0x54(%rbp)
jne    1228 <input_geom+0xd8>
mov    -0x18(%rbp),%rsi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    15bc <input_geom+0x46c>
movl   $0x1,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x54(%rbp),%rsi
mov    $0x0,%al
call   1060 <read_val@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    12d9 <input_geom+0x189>
movl   $0x2,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x54(%rbp),%rsi
mov    $0x0,%al
call   1060 <read_val@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    12d4 <input_geom+0x184>
movl   $0x3,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x54(%rbp),%rsi
mov    $0x0,%al
call   1060 <read_val@plt>
cmpl   $0x0,-0x54(%rbp)
jne    12cf <input_geom+0x17f>
mov    -0x18(%rbp),%rsi
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    15bc <input_geom+0x46c>
jmp    12d4 <input_geom+0x184>
jmp    12d9 <input_geom+0x189>
mov    -0x58(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <smalloc@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
movss  -0x3c(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movss  %xmm0,(%rax)
cmpl   $0x1,-0x58(%rbp)
jle    133e <input_geom+0x1ee>
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <smalloc@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
mov    %rcx,(%rax)
movss  -0x40(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
movss  %xmm0,(%rax)
cmpl   $0x2,-0x58(%rbp)
jle    1371 <input_geom+0x221>
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <smalloc@plt>
mov    %rax,%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
movss  -0x44(%rbp),%xmm0
mov    0x10(%rbp),%rax
mov    (%rax),%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    14f1 <input_geom+0x3a1>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
cmpl   $0x1,-0x58(%rbp)
jne    13c3 <input_geom+0x273>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rdx
movslq -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xce1(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    %eax,-0x5c(%rbp)
jmp    146a <input_geom+0x31a>
cmpl   $0x2,-0x58(%rbp)
jne    140b <input_geom+0x2bb>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rdx
movslq -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
mov    -0x38(%rbp),%rax
mov    (%rax),%rcx
movslq -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rcx
lea    0xc97(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    %eax,-0x5c(%rbp)
jmp    1465 <input_geom+0x315>
cmpl   $0x3,-0x58(%rbp)
jne    1460 <input_geom+0x310>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rdx
movslq -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
mov    -0x38(%rbp),%rax
mov    (%rax),%rcx
movslq -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rcx
mov    0x10(%rbp),%rax
mov    (%rax),%r8
movslq -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%r8
lea    0xc3b(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    %eax,-0x5c(%rbp)
jmp    1465 <input_geom+0x315>
jmp    146a <input_geom+0x31a>
mov    -0x5c(%rbp),%eax
mov    0x2b64(%rip),%rcx
cmp    (%rcx),%eax
jne    14a8 <input_geom+0x358>
mov    -0x1c(%rbp),%esi
mov    -0x48(%rbp),%edx
add    $0x1,%edx
lea    0xc0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    15bc <input_geom+0x46c>
mov    -0x5c(%rbp),%eax
cmp    -0x58(%rbp),%eax
je     14de <input_geom+0x38e>
mov    -0x50(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xc1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    15bc <input_geom+0x46c>
jmp    14e3 <input_geom+0x393>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1378 <input_geom+0x228>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x54(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4c(%rbp)
mov    %al,-0x5d(%rbp)
jne    1518 <input_geom+0x3c8>
cmpl   $0xffffffff,-0x54(%rbp)
setne  %al
mov    %al,-0x5d(%rbp)
mov    -0x5d(%rbp),%al
test   $0x1,%al
jne    1528 <input_geom+0x3d8>
jmp    154d <input_geom+0x3fd>
mov    -0x10(%rbp),%rdi
lea    -0x54(%rbp),%rsi
mov    $0x0,%al
call   1060 <read_val@plt>
cmpl   $0x0,-0x54(%rbp)
jne    1548 <input_geom+0x3f8>
movl   $0x1,-0x4c(%rbp)
jmp    14ff <input_geom+0x3af>
cmpl   $0x0,-0x4c(%rbp)
je     1587 <input_geom+0x437>
mov    0x2a8a(%rip),%rax
cmpl   $0x0,(%rax)
je     1587 <input_geom+0x437>
mov    -0x18(%rbp),%rsi
lea    0xba5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbc6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2a49(%rip),%rax
cmpl   $0x0,(%rax)
jle    15b5 <input_geom+0x465>
mov    -0x18(%rbp),%rsi
mov    -0x58(%rbp),%edx
lea    0xbca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_geom>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,0x30(%rsp)
mov    %r8,%r13
mov    %rcx,%r12
mov    %rdx,0x20(%rsp)
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x80(%rsp),%rbx
mov    0x2e2d(%rip),%rax
cmpl   $0x0,(%rax)
jle    11a4 <input_geom+0x44>
lea    0xff6(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,(%rbx)
mov    0x30(%rsp),%rax
movq   $0x0,(%rax)
movq   $0x0,0x0(%r13)
movl   $0x1,0xc(%rsp)
mov    $0x1,%ebp
lea    0xc(%rsp),%rbx
mov    $0x1,%eax
cmp    $0x1,%eax
jne    11fd <input_geom+0x9d>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <read_val@plt>
cvtsd2ss %xmm0,%xmm0
mov    0xc(%rsp),%eax
add    $0x1,%ebp
cmp    $0x1,%eax
je     11e0 <input_geom+0x80>
cmp    $0xffffffff,%eax
jne    1225 <input_geom+0xc5>
lea    0xdf7(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    $0x1,%ebx
jmp    14a0 <input_geom+0x340>
movss  %xmm0,0x14(%rsp)
mov    %r12,%rbx
xor    %r12d,%r12d
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <read_val@plt>
cmpl   $0x0,0xc(%rsp)
mov    %r14,0x28(%rsp)
movsd  %xmm0,0x40(%rsp)
je     126a <input_geom+0x10a>
mov    $0x1,%eax
mov    $0x1,%cl
mov    %ecx,0x1c(%rsp)
xor    %r14d,%r14d
movl   $0x0,0x18(%rsp)
jmp    12a7 <input_geom+0x147>
xor    %r14d,%r14d
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <read_val@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x3c(%rsp)
cmpl   $0x0,0xc(%rsp)
je     14e7 <input_geom+0x387>
mov    $0x2,%eax
mov    $0x1,%r12b
movl   $0x0,0x1c(%rsp)
mov    $0x1,%cl
mov    %ecx,0x18(%rsp)
mov    %eax,0x10(%rsp)
mov    %eax,(%rbx)
mov    0x20(%rsp),%rax
lea    0x0(,%rax,4),%ebx
mov    %ebx,%edi
call   1080 <smalloc@plt>
mov    %rax,0x0(%r13)
movss  0x14(%rsp),%xmm0
movss  %xmm0,(%rax)
test   %r12b,%r12b
jne    12e4 <input_geom+0x184>
test   %r14b,%r14b
jne    1312 <input_geom+0x1b2>
cmpl   $0x2,0x20(%rsp)
jge    1339 <input_geom+0x1d9>
jmp    13fd <input_geom+0x29d>
movsd  0x40(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x14(%rsp)
mov    %ebx,%edi
call   1080 <smalloc@plt>
mov    0x30(%rsp),%rcx
mov    %rax,(%rcx)
movss  0x14(%rsp),%xmm0
movss  %xmm0,(%rax)
test   %r14b,%r14b
je     12d8 <input_geom+0x178>
mov    %ebx,%edi
call   1080 <smalloc@plt>
mov    0x80(%rsp),%rcx
mov    %rax,(%rcx)
movss  0x3c(%rsp),%xmm0
movss  %xmm0,(%rax)
cmpl   $0x2,0x20(%rsp)
jl     13fd <input_geom+0x29d>
mov    0x20(%rsp),%r14d
shl    $0x2,%r14
mov    $0xfffffffe,%ebx
mov    $0x4,%r12d
nopl   (%rax)
mov    0x0(%r13),%rdx
add    %r12,%rdx
cmpb   $0x0,0x1c(%rsp)
je     1380 <input_geom+0x220>
mov    %r15,%rdi
lea    0xcf8(%rip),%rsi
xor    %eax,%eax
call   1060 <fscanf@plt>
jmp    13cf <input_geom+0x26f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x30(%rsp),%rax
mov    (%rax),%rcx
add    %r12,%rcx
cmpb   $0x0,0x18(%rsp)
je     13b0 <input_geom+0x250>
mov    %r15,%rdi
lea    0xcc2(%rip),%rsi
xor    %eax,%eax
call   1060 <fscanf@plt>
jmp    13cf <input_geom+0x26f>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x80(%rsp),%rax
mov    (%rax),%r8
add    %r12,%r8
mov    %r15,%rdi
lea    0xc94(%rip),%rsi
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    0x10(%rsp),%ecx
mov    0x2bfe(%rip),%rdx
cmp    (%rdx),%eax
je     14b1 <input_geom+0x351>
cmp    %ecx,%eax
jne    14cd <input_geom+0x36d>
add    $0xffffffff,%ebx
add    $0x4,%r12
add    $0x1,%ebp
cmp    %r12,%r14
jne    1350 <input_geom+0x1f0>
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%r14
mov    $0x1,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <read_val@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
cmove  %ebx,%ebp
test   %ebp,%ebp
jne    143f <input_geom+0x2df>
cmp    $0xffffffff,%eax
jne    1420 <input_geom+0x2c0>
test   %ebp,%ebp
mov    0x28(%rsp),%rbp
je     1471 <input_geom+0x311>
mov    0x2b99(%rip),%rax
cmpl   $0x0,(%rax)
je     1471 <input_geom+0x311>
lea    0xc87(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcdb(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    0x2b60(%rip),%rax
cmpl   $0x0,(%rax)
jle    149e <input_geom+0x33e>
lea    0xc85(%rip),%rdi
xor    %ebx,%ebx
mov    %rbp,%rsi
mov    0x10(%rsp),%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    14a0 <input_geom+0x340>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
neg    %ebx
lea    0xba9(%rip),%rdi
mov    0x20(%rsp),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1213 <input_geom+0xb3>
lea    0xbd5(%rip),%rdi
mov    %ebp,%esi
mov    0x28(%rsp),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1213 <input_geom+0xb3>
movl   $0x0,0x1c(%rsp)
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <read_val@plt>
cmpl   $0x0,0xc(%rsp)
je     1515 <input_geom+0x3b5>
mov    $0x3,%eax
mov    $0x1,%r12b
mov    $0x1,%r14b
jmp    1260 <input_geom+0x100>
lea    0xb0b(%rip),%rdi
mov    0x28(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc49(%rip),%rdi
call   1030 <puts@plt>
jmp    1213 <input_geom+0xb3>

LLVM IR (-O0):
@DEBUG_TRACE = external global i32
@.str = [23 x i8] c"<Entering input_geom>\0A\00"
@.str.1 = [39 x i8] c"No values found in geometry file `%s'\0A\00"
@.str.2 = [53 x i8] c"Too many values on input line of geometry file `%s'\0A\00"
@.str.3 = [30 x i8] c" Maximum dimensionality is 3\0A\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [5 x i8] c"%f%f\00"
@.str.6 = [7 x i8] c"%f%f%f\00"
@EOF = global i32 0
@.str.7 = [70 x i8] c"Too few lines of values in geometry file; nvtxs=%d, but only %d read\0A\00"
@.str.8 = [57 x i8] c"Wrong number of values in line %d of geometry file `%s'\0A\00"
@CHECK_INPUT = external global i32
@.str.9 = [47 x i8] c"Warning: possible error in geometry file `%s'\0A\00"
@.str.10 = [50 x i8] c" Numerical data found after expected end of file\0A\00"
@DEBUG_INPUT = external global i32
@.str.11 = [54 x i8] c"Finished reading geometry file `%s'; dimension = %d.\0A\00"
define i32 @input_geom(i32* %0, i8* %1, i32 %2, i32* %3, float** %4, float** %5, float** %6) {
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32*
%13 = alloca float**
%14 = alloca float**
%15 = alloca float**
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i32* %0, i32** %9
store i8* %1, i8** %10
store i32 %2, i32* %11
store i32* %3, i32** %12
store float** %4, float*** %13
store float** %5, float*** %14
store float** %6, float*** %15
store i32 0, i32* %24
%25 = load i32, i32* @DEBUG_TRACE
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %29
29: ; preds = %27, %7
%30 = load float**, float*** %15
store float* null, float** %30
%31 = load float**, float*** %14
store float* null, float** %31
%32 = load float**, float*** %13
store float* null, float** %32
store i32 0, i32* %21
store i32 1, i32* %22
br label %33
33: ; preds = %36, %29
%34 = load i32, i32* %22
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %42
36: ; preds = %33
%37 = load i32*, i32** %9
%38 = call double (i32*, i32*, ...) bitcast (double (...)* @read_val to double (i32*, i32*, ...)*)(i32* %37, i32* %22)
%39 = fptrunc double %38 to float
store float %39, float* %16
%40 = load i32, i32* %21
%41 = add nsw i32 %40, 1
store i32 %41, i32* %21
br label %33
42: ; preds = %33
%43 = load i32, i32* %22
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %50
45: ; preds = %42
%46 = load i8*, i8** %10
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %46)
%48 = load i32*, i32** %9
%49 = call i32 @fclose(i32* %48)
store i32 1, i32* %8
br label %233
50: ; preds = %42
store i32 1, i32* %23
%51 = load i32*, i32** %9
%52 = call double (i32*, i32*, ...) bitcast (double (...)* @read_val to double (i32*, i32*, ...)*)(i32* %51, i32* %22)
%53 = fptrunc double %52 to float
store float %53, float* %17
%54 = load i32, i32* %22
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %75
56: ; preds = %50
store i32 2, i32* %23
%57 = load i32*, i32** %9
%58 = call double (i32*, i32*, ...) bitcast (double (...)* @read_val to double (i32*, i32*, ...)*)(i32* %57, i32* %22)
%59 = fptrunc double %58 to float
store float %59, float* %18
%60 = load i32, i32* %22
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %74
62: ; preds = %56
store i32 3, i32* %23
%63 = load i32*, i32** %9
%64 = call double (i32*, i32*, ...) bitcast (double (...)* @read_val to double (i32*, i32*, ...)*)(i32* %63, i32* %22)
%65 = load i32, i32* %22
%66 = icmp ne i32 %65, 0
br i1 %66, label %73, label %67
67: ; preds = %62
%68 = load i8*, i8** %10
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8* %68)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%71 = load i32*, i32** %9
%72 = call i32 @fclose(i32* %71)
store i32 1, i32* %8
br label %233
73: ; preds = %62
br label %74
74: ; preds = %73, %56
br label %75
75: ; preds = %74, %50
%76 = load i32, i32* %23
%77 = load i32*, i32** %12
store i32 %76, i32* %77
%78 = load i32, i32* %11
%79 = sext i32 %78 to i64
%80 = mul i64 %79, 4
%81 = trunc i64 %80 to i32
%82 = call float* @smalloc(i32 %81)
%83 = load float**, float*** %13
store float* %82, float** %83
%84 = load float, float* %16
%85 = load float**, float*** %13
%86 = load float*, float** %85
%87 = getelementptr inbounds float, float* %86, i64 0
store float %84, float* %87
%88 = load i32, i32* %23
%89 = icmp sgt i32 %88, 1
br i1 %89, label %90, label %101
90: ; preds = %75
%91 = load i32, i32* %11
%92 = sext i32 %91 to i64
%93 = mul i64 %92, 4
%94 = trunc i64 %93 to i32
%95 = call float* @smalloc(i32 %94)
%96 = load float**, float*** %14
store float* %95, float** %96
%97 = load float, float* %17
%98 = load float**, float*** %14
%99 = load float*, float** %98
%100 = getelementptr inbounds float, float* %99, i64 0
store float %97, float* %100
br label %101
101: ; preds = %90, %75
%102 = load i32, i32* %23
%103 = icmp sgt i32 %102, 2
br i1 %103, label %104, label %115
104: ; preds = %101
%105 = load i32, i32* %11
%106 = sext i32 %105 to i64
%107 = mul i64 %106, 4
%108 = trunc i64 %107 to i32
%109 = call float* @smalloc(i32 %108)
%110 = load float**, float*** %15
store float* %109, float** %110
%111 = load float, float* %18
%112 = load float**, float*** %15
%113 = load float*, float** %112
%114 = getelementptr inbounds float, float* %113, i64 0
store float %111, float* %114
br label %115
115: ; preds = %104, %101
store i32 1, i32* %19
br label %116
116: ; preds = %194, %115
%117 = load i32, i32* %19
%118 = load i32, i32* %11
%119 = icmp slt i32 %117, %118
br i1 %119, label %120, label %197
120: ; preds = %116
%121 = load i32, i32* %21
%122 = add nsw i32 %121, 1
store i32 %122, i32* %21
%123 = load i32, i32* %23
%124 = icmp eq i32 %123, 1
br i1 %124, label %125, label %133
125: ; preds = %120
%126 = load i32*, i32** %9
%127 = load float**, float*** %13
%128 = load float*, float** %127
%129 = load i32, i32* %19
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds float, float* %128, i64 %130
%132 = call i32 (i32*, i8*, float*, ...) @fscanf(i32* %126, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %131)
store i32 %132, i32* %24
br label %172
133: ; preds = %120
%134 = load i32, i32* %23
%135 = icmp eq i32 %134, 2
br i1 %135, label %136, label %149
136: ; preds = %133
%137 = load i32*, i32** %9
%138 = load float**, float*** %13
%139 = load float*, float** %138
%140 = load i32, i32* %19
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds float, float* %139, i64 %141
%143 = load float**, float*** %14
%144 = load float*, float** %143
%145 = load i32, i32* %19
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds float, float* %144, i64 %146
%148 = call i32 (i32*, i8*, float*, ...) @fscanf(i32* %137, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), float* %142, float* %147)
store i32 %148, i32* %24
br label %171
149: ; preds = %133
%150 = load i32, i32* %23
%151 = icmp eq i32 %150, 3
br i1 %151, label %152, label %170
152: ; preds = %149
%153 = load i32*, i32** %9
%154 = load float**, float*** %13
%155 = load float*, float** %154
%156 = load i32, i32* %19
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds float, float* %155, i64 %157
%159 = load float**, float*** %14
%160 = load float*, float** %159
%161 = load i32, i32* %19
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds float, float* %160, i64 %162
%164 = load float**, float*** %15
%165 = load float*, float** %164
%166 = load i32, i32* %19
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds float, float* %165, i64 %167
%169 = call i32 (i32*, i8*, float*, ...) @fscanf(i32* %153, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), float* %158, float* %163, float* %168)
store i32 %169, i32* %24
br label %170
170: ; preds = %152, %149
br label %171
171: ; preds = %170, %136
br label %172
172: ; preds = %171, %125
%173 = load i32, i32* %24
%174 = load i32, i32* @EOF
%175 = icmp eq i32 %173, %174
br i1 %175, label %176, label %183
176: ; preds = %172
%177 = load i32, i32* %11
%178 = load i32, i32* %19
%179 = add nsw i32 %178, 1
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.7, i64 0, i64 0), i32 %177, i32 %179)
%181 = load i32*, i32** %9
%182 = call i32 @fclose(i32* %181)
store i32 1, i32* %8
br label %233
183: ; preds = %172
%184 = load i32, i32* %24
%185 = load i32, i32* %23
%186 = icmp ne i32 %184, %185
br i1 %186, label %187, label %193
187: ; preds = %183
%188 = load i32, i32* %21
%189 = load i8*, i8** %10
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), i32 %188, i8* %189)
%191 = load i32*, i32** %9
%192 = call i32 @fclose(i32* %191)
store i32 1, i32* %8
br label %233
193: ; preds = %183
br label %194
194: ; preds = %193
%195 = load i32, i32* %19
%196 = add nsw i32 %195, 1
store i32 %196, i32* %19
br label %116
197: ; preds = %116
store i32 0, i32* %20
store i32 0, i32* %22
br label %198
198: ; preds = %212, %197
%199 = load i32, i32* %20
%200 = icmp ne i32 %199, 0
br i1 %200, label %204, label %201
201: ; preds = %198
%202 = load i32, i32* %22
%203 = icmp ne i32 %202, -1
br label %204
204: ; preds = %201, %198
%205 = phi i1 [ false, %198 ], [ %203, %201 ]
br i1 %205, label %206, label %213
206: ; preds = %204
%207 = load i32*, i32** %9
%208 = call double (i32*, i32*, ...) bitcast (double (...)* @read_val to double (i32*, i32*, ...)*)(i32* %207, i32* %22)
%209 = load i32, i32* %22
%210 = icmp ne i32 %209, 0
br i1 %210, label %212, label %211
211: ; preds = %206
store i32 1, i32* %20
br label %212
212: ; preds = %211, %206
br label %198
213: ; preds = %204
%214 = load i32, i32* %20
%215 = icmp ne i32 %214, 0
br i1 %215, label %216, label %223
216: ; preds = %213
%217 = load i32, i32* @CHECK_INPUT
%218 = icmp ne i32 %217, 0
br i1 %218, label %219, label %223
219: ; preds = %216
%220 = load i8*, i8** %10
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i8* %220)
%222 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.10, i64 0, i64 0))
br label %223
223: ; preds = %219, %216, %213
%224 = load i32*, i32** %9
%225 = call i32 @fclose(i32* %224)
%226 = load i32, i32* @DEBUG_INPUT
%227 = icmp sgt i32 %226, 0
br i1 %227, label %228, label %232
228: ; preds = %223
%229 = load i8*, i8** %10
%230 = load i32, i32* %23
%231 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.11, i64 0, i64 0), i8* %229, i32 %230)
br label %232
232: ; preds = %228, %223
store i32 0, i32* %8
br label %233
233: ; preds = %232, %187, %176, %67, %45
%234 = load i32, i32* %8
ret i32 %234
}

LLVM IR (-O2):
@DEBUG_TRACE = external global i32
@.str.1 = [39 x i8] c"No values found in geometry file `%s'\0A\00"
@.str.2 = [53 x i8] c"Too many values on input line of geometry file `%s'\0A\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [5 x i8] c"%f%f\00"
@.str.6 = [7 x i8] c"%f%f%f\00"
@EOF = global i32 0
@.str.7 = [70 x i8] c"Too few lines of values in geometry file; nvtxs=%d, but only %d read\0A\00"
@.str.8 = [57 x i8] c"Wrong number of values in line %d of geometry file `%s'\0A\00"
@CHECK_INPUT = external global i32
@.str.9 = [47 x i8] c"Warning: possible error in geometry file `%s'\0A\00"
@DEBUG_INPUT = external global i32
@.str.11 = [54 x i8] c"Finished reading geometry file `%s'; dimension = %d.\0A\00"
@str = [49 x i8] c" Numerical data found after expected end of file\00"
@str.12 = [29 x i8] c" Maximum dimensionality is 3\00"
@str.13 = [22 x i8] c"<Entering input_geom>\00"
define i32 @input_geom(i32* %0, i8* %1, i32 %2, i32* nocapture writeonly %3, float** nocapture %4, float** nocapture %5, float** nocapture %6) {
%8 = alloca i32
%9 = bitcast i32* %8 to i8*
%10 = load i32, i32* @DEBUG_TRACE
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.13, i64 0, i64 0))
br label %14
14: ; preds = %12, %7
store float* null, float** %6
store float* null, float** %5
store float* null, float** %4
store i32 1, i32* %8
br label %15
15: ; preds = %19, %14
%16 = phi i32 [ %23, %19 ], [ 1, %14 ]
%17 = phi float [ %21, %19 ], [ undef, %14 ]
%18 = phi i32 [ %22, %19 ], [ 0, %14 ]
switch i32 %16, label %27 [
i32 1, label %19
i32 -1, label %24
]
19: ; preds = %15
%20 = call double (i32*, i32*, ...) bitcast (double (...)* @read_val to double (i32*, i32*, ...)*)(i32* %0, i32* %8)
%21 = fptrunc double %20 to float
%22 = add nuw nsw i32 %18, 1
%23 = load i32, i32* %8
br label %15
24: ; preds = %15
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%26 = call i32 @fclose(i32* %0)
br label %121
27: ; preds = %15
%28 = call double (i32*, i32*, ...) bitcast (double (...)* @read_val to double (i32*, i32*, ...)*)(i32* %0, i32* %8)
%29 = fptrunc double %28 to float
%30 = load i32, i32* %8
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %45
32: ; preds = %27
%33 = call double (i32*, i32*, ...) bitcast (double (...)* @read_val to double (i32*, i32*, ...)*)(i32* %0, i32* %8)
%34 = fptrunc double %33 to float
%35 = load i32, i32* %8
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %45
37: ; preds = %32
%38 = call double (i32*, i32*, ...) bitcast (double (...)* @read_val to double (i32*, i32*, ...)*)(i32* %0, i32* %8)
%39 = load i32, i32* %8
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.12, i64 0, i64 0))
%44 = call i32 @fclose(i32* %0)
br label %121
45: ; preds = %32, %37, %27
%46 = phi float [ %34, %37 ], [ %34, %32 ], [ undef, %27 ]
%47 = phi i1 [ true, %37 ], [ true, %32 ], [ false, %27 ]
%48 = phi i1 [ true, %37 ], [ false, %32 ], [ false, %27 ]
%49 = phi i1 [ false, %37 ], [ false, %32 ], [ true, %27 ]
%50 = phi i1 [ false, %37 ], [ true, %32 ], [ false, %27 ]
%51 = phi i32 [ 3, %37 ], [ 2, %32 ], [ 1, %27 ]
store i32 %51, i32* %3
%52 = shl i32 %2, 2
%53 = call float* @smalloc(i32 %52)
store float* %53, float** %4
store float %17, float* %53
br i1 %47, label %54, label %56
54: ; preds = %45
%55 = call float* @smalloc(i32 %52)
store float* %55, float** %5
store float %29, float* %55
br label %56
56: ; preds = %54, %45
br i1 %48, label %57, label %59
57: ; preds = %56
%58 = call float* @smalloc(i32 %52)
store float* %58, float** %6
store float %46, float* %58
br label %59
59: ; preds = %57, %56
%60 = icmp sgt i32 %2, 1
br i1 %60, label %61, label %97
61: ; preds = %59
%62 = zext i32 %2 to i64
br label %63
63: ; preds = %61, %94
%64 = phi i64 [ 1, %61 ], [ %95, %94 ]
%65 = phi i32 [ %18, %61 ], [ %66, %94 ]
%66 = add nuw nsw i32 %65, 1
%67 = load float*, float** %4
%68 = getelementptr inbounds float, float* %67, i64 %64
br i1 %49, label %69, label %71
69: ; preds = %63
%70 = call i32 (i32*, i8*, float*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %68)
br label %80
71: ; preds = %63
%72 = load float*, float** %5
%73 = getelementptr inbounds float, float* %72, i64 %64
br i1 %50, label %74, label %76
74: ; preds = %71
%75 = call i32 (i32*, i8*, float*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), float* %68, float* %73)
br label %80
76: ; preds = %71
%77 = load float*, float** %6
%78 = getelementptr inbounds float, float* %77, i64 %64
%79 = call i32 (i32*, i8*, float*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), float* %68, float* %73, float* %78)
br label %80
80: ; preds = %74, %76, %69
%81 = phi i32 [ %70, %69 ], [ %75, %74 ], [ %79, %76 ]
%82 = load i32, i32* @EOF
%83 = icmp eq i32 %81, %82
br i1 %83, label %84, label %89
84: ; preds = %80
%85 = trunc i64 %64 to i32
%86 = add nuw nsw i32 %85, 1
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.7, i64 0, i64 0), i32 %2, i32 %86)
%88 = call i32 @fclose(i32* %0)
br label %121
89: ; preds = %80
%90 = icmp eq i32 %81, %51
br i1 %90, label %94, label %91
91: ; preds = %89
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), i32 %66, i8* %1)
%93 = call i32 @fclose(i32* %0)
br label %121
94: ; preds = %89
%95 = add nuw nsw i64 %64, 1
%96 = icmp eq i64 %95, %62
br i1 %96, label %97, label %63
97: ; preds = %94, %59
store i32 0, i32* %8
br label %98
98: ; preds = %97, %98
%99 = phi i32 [ %103, %98 ], [ 0, %97 ]
%100 = call double (i32*, i32*, ...) bitcast (double (...)* @read_val to double (i32*, i32*, ...)*)(i32* %0, i32* %8)
%101 = load i32, i32* %8
%102 = icmp eq i32 %101, 0
%103 = select i1 %102, i32 1, i32 %99
%104 = icmp ne i32 %103, 0
%105 = icmp ne i32 %101, -1
%106 = xor i1 %104, true
%107 = select i1 %106, i1 %105, i1 false
br i1 %107, label %98, label %108
108: ; preds = %98
%109 = load i32, i32* @CHECK_INPUT
%110 = icmp ne i32 %109, 0
%111 = select i1 %104, i1 %110, i1 false
br i1 %111, label %112, label %115
112: ; preds = %108
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i8* %1)
%114 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
br label %115
115: ; preds = %112, %108
%116 = call i32 @fclose(i32* %0)
%117 = load i32, i32* @DEBUG_INPUT
%118 = icmp sgt i32 %117, 0
br i1 %118, label %119, label %121
119: ; preds = %115
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.11, i64 0, i64 0), i8* %1, i32 %51)
br label %121
121: ; preds = %115, %119, %91, %84, %41, %24
%122 = phi i32 [ 1, %24 ], [ 1, %84 ], [ 1, %91 ], [ 1, %41 ], [ 0, %119 ], [ 0, %115 ]
ret i32 %122
}