#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__ calloc(int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ stderr;
int read_arcinfo_grid(char *filename, float **lat, float **lng, int **cellnum,
                      int *ncols, int *nrows, float *ll_lng, float *ll_lat,
                      float *cellsize, int *NODATA) {
  FILE *farc;
  int i, j;
  float value;
  float tmp_lat;
  float tmp_lng;
  int cell;
  int Ncells;
  int tmpvalue;
  if ((farc = fopen(filename, "r")) == NULL) {
    fprintf(stderr, "ERROR: Unable to open LDAS file %s.\n", filename);
    exit(0);
  }
  fscanf(farc, "%*s %i", &ncols[0]);
  fscanf(farc, "%*s %i", &nrows[0]);
  fscanf(farc, "%*s %f", &ll_lng[0]);
  fscanf(farc, "%*s %f", &ll_lat[0]);
  fscanf(farc, "%*s %f", &cellsize[0]);
  fscanf(farc, "%*s %i", &NODATA[0]);
  Ncells = ncols[0] * nrows[0];
  lat[0] = (float *)calloc(Ncells, sizeof(float));
  lng[0] = (float *)calloc(Ncells, sizeof(float));
  cellnum[0] = (int *)calloc(Ncells, sizeof(int));
  cell = 0;
  for (j = 0; j < nrows[0]; j++) {
    tmp_lat = ll_lat[0] + (float)(nrows[0] - j - 0.5) * cellsize[0];
    for (i = 0; i < ncols[0]; i++) {
      tmp_lng = ll_lng[0] + (float)(i + 0.5) * cellsize[0];
      fscanf(farc, "%i", &tmpvalue);
      if (tmpvalue != NODATA[0]) {
        lat[0][cell] = tmp_lat;
        lng[0][cell] = tmp_lng;
        cellnum[0][cell] = tmpvalue;
        cell++;
      }
    }
  }
  fclose(farc);
  Ncells = cell;
  if (value == NODATA[0])
    value = -999.;
  return Ncells;
}


x86 assembly (clang, -O0):
<read_arcinfo_grid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    11ce <read_arcinfo_grid+0x6e>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe50(%rip),%rsi
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe5a(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe44(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%rdx
lea    0xe35(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x38(%rbp),%rdi
mov    0x18(%rbp),%rdx
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x38(%rbp),%rdi
mov    0x20(%rbp),%rdx
lea    0xe09(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x38(%rbp),%rdi
mov    0x28(%rbp),%rdx
lea    0xdec(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x30(%rbp),%rcx
imul   (%rcx),%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x54(%rbp),%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x54(%rbp),%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    -0x30(%rbp),%rcx
cmp    (%rcx),%eax
jge    13d5 <read_arcinfo_grid+0x275>
mov    0x18(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
sub    -0x40(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xd27(%rip),%xmm2
subsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0x20(%rbp),%rax
movss  (%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    13c2 <read_arcinfo_grid+0x262>
mov    0x10(%rbp),%rax
movss  (%rax),%xmm1
cvtsi2sdl -0x3c(%rbp),%xmm0
movsd  0xcdf(%rip),%xmm2
addsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0x20(%rbp),%rax
movss  (%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xcea(%rip),%rsi
lea    -0x58(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x58(%rbp),%eax
mov    0x28(%rbp),%rcx
cmp    (%rcx),%eax
je     13af <read_arcinfo_grid+0x24f>
movss  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x50(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x4c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x50(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x58(%rbp),%edx
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movslq -0x50(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    13b4 <read_arcinfo_grid+0x254>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1305 <read_arcinfo_grid+0x1a5>
jmp    13c7 <read_arcinfo_grid+0x267>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12b5 <read_arcinfo_grid+0x155>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x50(%rbp),%eax
mov    %eax,-0x54(%rbp)
movss  -0x44(%rbp),%xmm0
mov    0x28(%rbp),%rax
cvtsi2ssl (%rax),%xmm1
ucomiss %xmm1,%xmm0
jne    140d <read_arcinfo_grid+0x2ad>
jp     140d <read_arcinfo_grid+0x2ad>
movss  0xbf8(%rip),%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x54(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_arcinfo_grid>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,%r12
mov    %r8,%rbx
mov    %rcx,0x8(%rsp)
mov    %rdx,0x28(%rsp)
mov    %rsi,0x20(%rsp)
mov    %rdi,%r14
lea    0xe83(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     13d7 <read_arcinfo_grid+0x277>
mov    %rax,%rbp
mov    0x70(%rsp),%r14
lea    0xe8d(%rip),%r15
xor    %r13d,%r13d
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
lea    0xe6a(%rip),%r15
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    0x78(%rsp),%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    0x80(%rsp),%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    %rbp,%rdi
lea    0xe22(%rip),%rsi
mov    0x88(%rsp),%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    (%r12),%r14d
imul   (%rbx),%r14d
mov    %r14d,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    0x20(%rsp),%rcx
mov    %rax,(%rcx)
mov    %r14d,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    0x28(%rsp),%rcx
mov    %rax,(%rcx)
mov    %r14d,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    0x8(%rsp),%rsi
mov    %rax,(%rsi)
mov    (%r12),%eax
test   %eax,%eax
jle    13bd <read_arcinfo_grid+0x25d>
mov    (%rbx),%ecx
lea    0x1c(%rsp),%r15
xor    %r13d,%r13d
xor    %edi,%edi
mov    %r12,0x30(%rsp)
jmp    12a8 <read_arcinfo_grid+0x148>
nopw   0x0(%rax,%rax,1)
mov    0x30(%rsp),%r12
mov    (%r12),%eax
mov    0x10(%rsp),%edi
add    $0x1,%edi
cmp    %edi,%eax
jle    13bd <read_arcinfo_grid+0x25d>
mov    %eax,%edx
sub    %edi,%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
addsd  0xd45(%rip),%xmm0
test   %ecx,%ecx
jle    129d <read_arcinfo_grid+0x13d>
mov    %edi,0x10(%rsp)
mov    %rsi,%r14
cvtsd2ss %xmm0,%xmm0
mov    0x80(%rsp),%rax
movss  (%rax),%xmm1
movss  %xmm1,0x8(%rsp)
mulss  %xmm1,%xmm0
mov    0x78(%rsp),%rax
addss  (%rax),%xmm0
movss  %xmm0,0x14(%rsp)
mov    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x70(%rsp),%rax
movss  (%rax),%xmm0
movss  %xmm0,0x18(%rsp)
mov    %rbp,%rdi
lea    0xd22(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    0x1c(%rsp),%eax
mov    0x88(%rsp),%rcx
cmp    (%rcx),%eax
jne    1340 <read_arcinfo_grid+0x1e0>
mov    %r14,%rsi
jmp    1397 <read_arcinfo_grid+0x237>
nopl   0x0(%rax,%rax,1)
lea    -0x1(%r12),%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
addsd  0xcb4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mulss  0x8(%rsp),%xmm0
addss  0x18(%rsp),%xmm0
mov    0x20(%rsp),%rcx
mov    (%rcx),%rcx
movslq %r13d,%r13
movss  0x14(%rsp),%xmm1
movss  %xmm1,(%rcx,%r13,4)
mov    0x28(%rsp),%rcx
mov    (%rcx),%rcx
movss  %xmm0,(%rcx,%r13,4)
mov    %r14,%rsi
mov    (%r14),%rcx
mov    %eax,(%rcx,%r13,4)
add    $0x1,%r13d
mov    (%rbx),%ecx
cmp    %ecx,%r12d
jge    1290 <read_arcinfo_grid+0x130>
mov    0x80(%rsp),%rax
movss  (%rax),%xmm0
movss  %xmm0,0x8(%rsp)
add    $0x1,%r12d
jmp    1300 <read_arcinfo_grid+0x1a0>
mov    %rbp,%rdi
call   1030 <fclose@plt>
mov    %r13d,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c02(%rip),%rax
mov    (%rax),%edi
lea    0xc2b(%rip),%rsi
mov    %r14,%rdx
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"ERROR: Unable to open LDAS file %s.\0A\00"
@.str.2 = [7 x i8] c"%*s %i\00"
@.str.3 = [7 x i8] c"%*s %f\00"
@.str.4 = [3 x i8] c"%i\00"
define i32 @read_arcinfo_grid(i8* %0, float** %1, float** %2, i32** %3, i32* %4, i32* %5, float* %6, float* %7, float* %8, i32* %9) {
%11 = alloca i8*
%12 = alloca float**
%13 = alloca float**
%14 = alloca i32**
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca float*
%18 = alloca float*
%19 = alloca float*
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32
%23 = alloca i32
%24 = alloca float
%25 = alloca float
%26 = alloca float
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
store i8* %0, i8** %11
store float** %1, float*** %12
store float** %2, float*** %13
store i32** %3, i32*** %14
store i32* %4, i32** %15
store i32* %5, i32** %16
store float* %6, float** %17
store float* %7, float** %18
store float* %8, float** %19
store i32* %9, i32** %20
%30 = load i8*, i8** %11
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %31, i32** %21
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %38
33: ; preds = %10
%34 = load i32, i32* @stderr
%35 = load i8*, i8** %11
%36 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 0)
unreachable
38: ; preds = %10
%39 = load i32*, i32** %21
%40 = load i32*, i32** %15
%41 = getelementptr inbounds i32, i32* %40, i64 0
%42 = call i32 (i32*, i8*, ...) @fscanf(i32* %39, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %41)
%43 = load i32*, i32** %21
%44 = load i32*, i32** %16
%45 = getelementptr inbounds i32, i32* %44, i64 0
%46 = call i32 (i32*, i8*, ...) @fscanf(i32* %43, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %45)
%47 = load i32*, i32** %21
%48 = load float*, float** %17
%49 = getelementptr inbounds float, float* %48, i64 0
%50 = call i32 (i32*, i8*, ...) @fscanf(i32* %47, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %49)
%51 = load i32*, i32** %21
%52 = load float*, float** %18
%53 = getelementptr inbounds float, float* %52, i64 0
%54 = call i32 (i32*, i8*, ...) @fscanf(i32* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %53)
%55 = load i32*, i32** %21
%56 = load float*, float** %19
%57 = getelementptr inbounds float, float* %56, i64 0
%58 = call i32 (i32*, i8*, ...) @fscanf(i32* %55, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %57)
%59 = load i32*, i32** %21
%60 = load i32*, i32** %20
%61 = getelementptr inbounds i32, i32* %60, i64 0
%62 = call i32 (i32*, i8*, ...) @fscanf(i32* %59, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %61)
%63 = load i32*, i32** %15
%64 = getelementptr inbounds i32, i32* %63, i64 0
%65 = load i32, i32* %64
%66 = load i32*, i32** %16
%67 = getelementptr inbounds i32, i32* %66, i64 0
%68 = load i32, i32* %67
%69 = mul nsw i32 %65, %68
store i32 %69, i32* %28
%70 = load i32, i32* %28
%71 = call i64 @calloc(i32 %70, i32 4)
%72 = inttoptr i64 %71 to float*
%73 = load float**, float*** %12
%74 = getelementptr inbounds float*, float** %73, i64 0
store float* %72, float** %74
%75 = load i32, i32* %28
%76 = call i64 @calloc(i32 %75, i32 4)
%77 = inttoptr i64 %76 to float*
%78 = load float**, float*** %13
%79 = getelementptr inbounds float*, float** %78, i64 0
store float* %77, float** %79
%80 = load i32, i32* %28
%81 = call i64 @calloc(i32 %80, i32 4)
%82 = inttoptr i64 %81 to i32*
%83 = load i32**, i32*** %14
%84 = getelementptr inbounds i32*, i32** %83, i64 0
store i32* %82, i32** %84
store i32 0, i32* %27
store i32 0, i32* %23
br label %85
85: ; preds = %161, %38
%86 = load i32, i32* %23
%87 = load i32*, i32** %16
%88 = getelementptr inbounds i32, i32* %87, i64 0
%89 = load i32, i32* %88
%90 = icmp slt i32 %86, %89
br i1 %90, label %91, label %164
91: ; preds = %85
%92 = load float*, float** %18
%93 = getelementptr inbounds float, float* %92, i64 0
%94 = load float, float* %93
%95 = load i32*, i32** %16
%96 = getelementptr inbounds i32, i32* %95, i64 0
%97 = load i32, i32* %96
%98 = load i32, i32* %23
%99 = sub nsw i32 %97, %98
%100 = sitofp i32 %99 to double
%101 = fsub double %100, 5.000000e-01
%102 = fptrunc double %101 to float
%103 = load float*, float** %19
%104 = getelementptr inbounds float, float* %103, i64 0
%105 = load float, float* %104
%106 = call float @llvm.fmuladd.f32(float %102, float %105, float %94)
store float %106, float* %25
store i32 0, i32* %22
br label %107
107: ; preds = %157, %91
%108 = load i32, i32* %22
%109 = load i32*, i32** %15
%110 = getelementptr inbounds i32, i32* %109, i64 0
%111 = load i32, i32* %110
%112 = icmp slt i32 %108, %111
br i1 %112, label %113, label %160
113: ; preds = %107
%114 = load float*, float** %17
%115 = getelementptr inbounds float, float* %114, i64 0
%116 = load float, float* %115
%117 = load i32, i32* %22
%118 = sitofp i32 %117 to double
%119 = fadd double %118, 5.000000e-01
%120 = fptrunc double %119 to float
%121 = load float*, float** %19
%122 = getelementptr inbounds float, float* %121, i64 0
%123 = load float, float* %122
%124 = call float @llvm.fmuladd.f32(float %120, float %123, float %116)
store float %124, float* %26
%125 = load i32*, i32** %21
%126 = call i32 (i32*, i8*, ...) @fscanf(i32* %125, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %29)
%127 = load i32, i32* %29
%128 = load i32*, i32** %20
%129 = getelementptr inbounds i32, i32* %128, i64 0
%130 = load i32, i32* %129
%131 = icmp ne i32 %127, %130
br i1 %131, label %132, label %156
132: ; preds = %113
%133 = load float, float* %25
%134 = load float**, float*** %12
%135 = getelementptr inbounds float*, float** %134, i64 0
%136 = load float*, float** %135
%137 = load i32, i32* %27
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds float, float* %136, i64 %138
store float %133, float* %139
%140 = load float, float* %26
%141 = load float**, float*** %13
%142 = getelementptr inbounds float*, float** %141, i64 0
%143 = load float*, float** %142
%144 = load i32, i32* %27
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds float, float* %143, i64 %145
store float %140, float* %146
%147 = load i32, i32* %29
%148 = load i32**, i32*** %14
%149 = getelementptr inbounds i32*, i32** %148, i64 0
%150 = load i32*, i32** %149
%151 = load i32, i32* %27
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i32, i32* %150, i64 %152
store i32 %147, i32* %153
%154 = load i32, i32* %27
%155 = add nsw i32 %154, 1
store i32 %155, i32* %27
br label %156
156: ; preds = %132, %113
br label %157
157: ; preds = %156
%158 = load i32, i32* %22
%159 = add nsw i32 %158, 1
store i32 %159, i32* %22
br label %107
160: ; preds = %107
br label %161
161: ; preds = %160
%162 = load i32, i32* %23
%163 = add nsw i32 %162, 1
store i32 %163, i32* %23
br label %85
164: ; preds = %85
%165 = load i32*, i32** %21
%166 = call i32 @fclose(i32* %165)
%167 = load i32, i32* %27
store i32 %167, i32* %28
%168 = load float, float* %24
%169 = load i32*, i32** %20
%170 = getelementptr inbounds i32, i32* %169, i64 0
%171 = load i32, i32* %170
%172 = sitofp i32 %171 to float
%173 = fcmp oeq float %168, %172
br i1 %173, label %174, label %175
174: ; preds = %164
store float -9.990000e+02, float* %24
br label %175
175: ; preds = %174, %164
%176 = load i32, i32* %28
ret i32 %176
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"ERROR: Unable to open LDAS file %s.\0A\00"
@.str.2 = [7 x i8] c"%*s %i\00"
@.str.3 = [7 x i8] c"%*s %f\00"
@.str.4 = [3 x i8] c"%i\00"
define i32 @read_arcinfo_grid(i8* %0, float** nocapture %1, float** nocapture %2, i32** nocapture %3, i32* %4, i32* %5, float* %6, float* %7, float* %8, i32* %9) {
%11 = alloca i32
%12 = bitcast i32* %11 to i8*
%13 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %19
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%18 = tail call i32 @exit(i32 0)
unreachable
19: ; preds = %10
%20 = tail call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%21 = tail call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%22 = tail call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %6)
%23 = tail call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %7)
%24 = tail call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %8)
%25 = tail call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %9)
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = mul nsw i32 %27, %26
%29 = tail call i64 @calloc(i32 %28, i32 4)
%30 = inttoptr i64 %29 to float*
store float* %30, float** %1
%31 = tail call i64 @calloc(i32 %28, i32 4)
%32 = inttoptr i64 %31 to float*
store float* %32, float** %2
%33 = tail call i64 @calloc(i32 %28, i32 4)
%34 = inttoptr i64 %33 to i32*
store i32* %34, i32** %3
%35 = load i32, i32* %5
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %89
37: ; preds = %19
%38 = load i32, i32* %4
br label %39
39: ; preds = %37, %83
%40 = phi i32 [ %84, %83 ], [ %35, %37 ]
%41 = phi i32 [ %85, %83 ], [ %38, %37 ]
%42 = phi i32 [ %86, %83 ], [ 0, %37 ]
%43 = phi i32 [ %87, %83 ], [ 0, %37 ]
%44 = load float, float* %7
%45 = sub nsw i32 %40, %43
%46 = sitofp i32 %45 to double
%47 = fadd double %46, -5.000000e-01
%48 = fptrunc double %47 to float
%49 = load float, float* %8
%50 = call float @llvm.fmuladd.f32(float %48, float %49, float %44)
%51 = icmp sgt i32 %41, 0
br i1 %51, label %52, label %83
52: ; preds = %39, %79
%53 = phi float [ %80, %79 ], [ %49, %39 ]
%54 = phi i32 [ %75, %79 ], [ %42, %39 ]
%55 = phi i32 [ %76, %79 ], [ 0, %39 ]
%56 = load float, float* %6
%57 = call i32 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %11)
%58 = load i32, i32* %11
%59 = load i32, i32* %9
%60 = icmp eq i32 %58, %59
br i1 %60, label %74, label %61
61: ; preds = %52
%62 = sitofp i32 %55 to double
%63 = fadd double %62, 5.000000e-01
%64 = fptrunc double %63 to float
%65 = call float @llvm.fmuladd.f32(float %64, float %53, float %56)
%66 = load float*, float** %1
%67 = sext i32 %54 to i64
%68 = getelementptr inbounds float, float* %66, i64 %67
store float %50, float* %68
%69 = load float*, float** %2
%70 = getelementptr inbounds float, float* %69, i64 %67
store float %65, float* %70
%71 = load i32*, i32** %3
%72 = getelementptr inbounds i32, i32* %71, i64 %67
store i32 %58, i32* %72
%73 = add nsw i32 %54, 1
br label %74
74: ; preds = %52, %61
%75 = phi i32 [ %73, %61 ], [ %54, %52 ]
%76 = add nuw nsw i32 %55, 1
%77 = load i32, i32* %4
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = load float, float* %8
br label %52
81: ; preds = %74
%82 = load i32, i32* %5
br label %83
83: ; preds = %81, %39
%84 = phi i32 [ %40, %39 ], [ %82, %81 ]
%85 = phi i32 [ %41, %39 ], [ %77, %81 ]
%86 = phi i32 [ %42, %39 ], [ %75, %81 ]
%87 = add nuw nsw i32 %43, 1
%88 = icmp sgt i32 %84, %87
br i1 %88, label %39, label %89
89: ; preds = %83, %19
%90 = phi i32 [ 0, %19 ], [ %86, %83 ]
%91 = call i32 @fclose(i32* %13)
ret i32 %90
}