#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ stderr;
float read_arcinfo_value(char *filename, float lat, float lng) {
  FILE *farc;
  int i, j;
  int ncols;
  int nrows;
  float ll_lat;
  float ll_lng;
  float cellsize;
  float NODATA;
  float value;
  float tmp_lat;
  float tmp_lng;
  float tmpvalue;
  char errstr[1024];
  if ((farc = fopen(filename, "r")) == NULL) {
    fprintf(stderr, "Unable to open ARC/INFO soil file %s", filename);
    exit(0);
  }
  fscanf(farc, "%*s %i", &ncols);
  fscanf(farc, "%*s %i", &nrows);
  fscanf(farc, "%*s %f", &ll_lng);
  fscanf(farc, "%*s %f", &ll_lat);
  fscanf(farc, "%*s %f", &cellsize);
  fscanf(farc, "%*s %f", &NODATA);
  if (lat < ll_lat || lat > ll_lat + cellsize * (float)nrows) {
    fprintf(stderr, "Given latitude %f does not fall within ARC file %s", lat,
            filename);
    exit(0);
  }
  if (lng < ll_lng || lng > ll_lng + cellsize * (float)ncols) {
    fprintf(stderr, "Given longitude %f does not fall within ARC file %s", lng,
            filename);
    exit(0);
  }
  for (j = 0; j < nrows; j++) {
    tmp_lat = ll_lat + (float)(nrows - j - 0.5) * cellsize;
    for (i = 0; i < ncols; i++) {
      tmp_lng = ll_lng + (float)(i + 0.5) * cellsize;
      fscanf(farc, "%f", &tmpvalue);
      if (((int)(tmp_lat * 1.e4 + 0.5) == (int)(lat * 1.e4 + 0.5)) &&
          ((int)(tmp_lng * 1.e4 + 0.5) == (int)(lng * 1.e4 + 0.5)))
        value = tmpvalue;
    }
  }
  fclose(farc);
  if (value == NODATA)
    value = -999.;
  return value;
}


x86 assembly (clang, -O0):
<read_arcinfo_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11a9 <read_arcinfo_value+0x59>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe7f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    0xe8b(%rip),%rsi
lea    -0x24(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe75(%rip),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe66(%rip),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe50(%rip),%rsi
lea    -0x2c(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe3a(%rip),%rsi
lea    -0x34(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe24(%rip),%rsi
lea    -0x38(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
movss  -0xc(%rbp),%xmm1
movss  -0x2c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
ja     1265 <read_arcinfo_value+0x115>
movss  -0xc(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm2
movss  -0x34(%rbp),%xmm1
cvtsi2ssl -0x28(%rbp),%xmm3
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
ucomiss %xmm1,%xmm0
jbe    1290 <read_arcinfo_value+0x140>
mov    0x2d74(%rip),%rax
mov    (%rax),%edi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x8(%rbp),%rdx
lea    0xdcb(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
movss  -0x10(%rbp),%xmm1
movss  -0x30(%rbp),%xmm0
ucomiss %xmm1,%xmm0
ja     12c8 <read_arcinfo_value+0x178>
movss  -0x10(%rbp),%xmm0
movss  -0x30(%rbp),%xmm2
movss  -0x34(%rbp),%xmm1
cvtsi2ssl -0x24(%rbp),%xmm3
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
ucomiss %xmm1,%xmm0
jbe    12f3 <read_arcinfo_value+0x1a3>
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x8(%rbp),%rdx
lea    0xd9b(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1460 <read_arcinfo_value+0x310>
movss  -0x2c(%rbp),%xmm1
mov    -0x28(%rbp),%eax
sub    -0x20(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xceb(%rip),%xmm2
subsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x34(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x40(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    144d <read_arcinfo_value+0x2fd>
movss  -0x30(%rbp),%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xcac(%rip),%xmm2
addsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x34(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xcc9(%rip),%rsi
lea    -0x48(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc73(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc5f(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc4e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc3a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
cmp    %ecx,%eax
jne    143a <read_arcinfo_value+0x2ea>
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc21(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc0d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xbfc(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xbe8(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
cmp    %ecx,%eax
jne    143a <read_arcinfo_value+0x2ea>
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
jmp    143f <read_arcinfo_value+0x2ef>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    133e <read_arcinfo_value+0x1ee>
jmp    1452 <read_arcinfo_value+0x302>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12fa <read_arcinfo_value+0x1aa>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movss  -0x3c(%rbp),%xmm0
ucomiss -0x38(%rbp),%xmm0
jne    148b <read_arcinfo_value+0x33b>
jp     148b <read_arcinfo_value+0x33b>
movss  0xb7a(%rip),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_arcinfo_value>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movss  %xmm1,0x4(%rsp)
movss  %xmm0,0x8(%rsp)
mov    %rdi,%r14
lea    0xea8(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     143a <read_arcinfo_value+0x2ea>
mov    %rax,%rbx
lea    0xeb7(%rip),%r15
lea    0x1c(%rsp),%rdx
mov    %rax,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fscanf@plt>
lea    0x18(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fscanf@plt>
lea    0xe93(%rip),%r15
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fscanf@plt>
lea    0x14(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fscanf@plt>
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fscanf@plt>
lea    0x2c(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fscanf@plt>
movss  0x14(%rsp),%xmm1
movss  0x8(%rsp),%xmm4
ucomiss %xmm4,%xmm1
ja     13f9 <read_arcinfo_value+0x2a9>
movss  0xc(%rsp),%xmm0
mov    0x18(%rsp),%eax
cvtsi2ss %eax,%xmm2
mulss  %xmm0,%xmm2
addss  %xmm1,%xmm2
ucomiss %xmm2,%xmm4
ja     13f9 <read_arcinfo_value+0x2a9>
movss  0x10(%rsp),%xmm1
movss  0x4(%rsp),%xmm3
ucomiss %xmm3,%xmm1
ja     1412 <read_arcinfo_value+0x2c2>
mov    0x1c(%rsp),%ecx
xorps  %xmm2,%xmm2
cvtsi2ss %ecx,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
ucomiss %xmm0,%xmm3
ja     1412 <read_arcinfo_value+0x2c2>
test   %eax,%eax
jle    13c1 <read_arcinfo_value+0x271>
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
movsd  0xd85(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd81(%rip),%xmm2
addsd  %xmm2,%xmm0
cvttsd2si %xmm0,%ebp
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edx
mov    %edx,0x24(%rsp)
lea    0xda1(%rip),%r14
lea    0x28(%rsp),%r15
xor    %edx,%edx
jmp    12d3 <read_arcinfo_value+0x183>
cs nopw 0x0(%rax,%rax,1)
mov    0x18(%rsp),%eax
mov    0x20(%rsp),%edx
add    $0x1,%edx
cmp    %edx,%eax
jle    13c1 <read_arcinfo_value+0x271>
test   %ecx,%ecx
jle    12c8 <read_arcinfo_value+0x178>
mov    %edx,0x20(%rsp)
sub    %edx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xd24(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
movss  %xmm1,0x4(%rsp)
mulss  %xmm1,%xmm0
addss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xcee(%rip),%xmm0
addsd  0xcee(%rip),%xmm0
cvttsd2si %xmm0,%r13d
mov    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
movss  0x10(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
cmp    %ebp,%r13d
jne    139f <read_arcinfo_value+0x24f>
lea    -0x1(%r12),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xca3(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mulss  0x4(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xc7b(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
cmp    0x24(%rsp),%eax
jne    139f <read_arcinfo_value+0x24f>
movss  0x28(%rsp),%xmm0
movapd %xmm0,0x30(%rsp)
mov    0x1c(%rsp),%ecx
cmp    %ecx,%r12d
jge    12c0 <read_arcinfo_value+0x170>
movss  0xc(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
add    $0x1,%r12d
jmp    1330 <read_arcinfo_value+0x1e0>
mov    %rbx,%rdi
call   1030 <fclose@plt>
movss  0x2c(%rsp),%xmm0
movaps 0x30(%rsp),%xmm2
cmpeqss %xmm2,%xmm0
movss  0xc37(%rip),%xmm1
andps  %xmm0,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2be0(%rip),%rax
mov    (%rax),%edi
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
lea    0xc41(%rip),%rsi
jmp    1429 <read_arcinfo_value+0x2d9>
mov    0x2bc7(%rip),%rax
mov    (%rax),%edi
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
lea    0xc5b(%rip),%rsi
mov    %r14,%rdx
mov    $0x1,%al
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    0x2b9f(%rip),%rax
mov    (%rax),%edi
lea    0xbd4(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"Unable to open ARC/INFO soil file %s\00"
@.str.2 = [7 x i8] c"%*s %i\00"
@.str.3 = [7 x i8] c"%*s %f\00"
@.str.4 = [51 x i8] c"Given latitude %f does not fall within ARC file %s\00"
@.str.5 = [52 x i8] c"Given longitude %f does not fall within ARC file %s\00"
@.str.6 = [3 x i8] c"%f\00"
define float @read_arcinfo_value(i8* %0, float %1, float %2) {
%4 = alloca i8*
%5 = alloca float
%6 = alloca float
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca [1024 x i8]
store i8* %0, i8** %4
store float %1, float* %5
store float %2, float* %6
%21 = load i8*, i8** %4
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %22, i32** %7
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %29
24: ; preds = %3
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %4
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = call i32 @exit(i32 0)
unreachable
29: ; preds = %3
%30 = load i32*, i32** %7
%31 = call i32 (i32*, i8*, ...) @fscanf(i32* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%32 = load i32*, i32** %7
%33 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %11)
%34 = load i32*, i32** %7
%35 = call i32 (i32*, i8*, ...) @fscanf(i32* %34, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %13)
%36 = load i32*, i32** %7
%37 = call i32 (i32*, i8*, ...) @fscanf(i32* %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %12)
%38 = load i32*, i32** %7
%39 = call i32 (i32*, i8*, ...) @fscanf(i32* %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %14)
%40 = load i32*, i32** %7
%41 = call i32 (i32*, i8*, ...) @fscanf(i32* %40, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %15)
%42 = load float, float* %5
%43 = load float, float* %12
%44 = fcmp olt float %42, %43
br i1 %44, label %53, label %45
45: ; preds = %29
%46 = load float, float* %5
%47 = load float, float* %12
%48 = load float, float* %14
%49 = load i32, i32* %11
%50 = sitofp i32 %49 to float
%51 = call float @llvm.fmuladd.f32(float %48, float %50, float %47)
%52 = fcmp ogt float %46, %51
br i1 %52, label %53, label %60
53: ; preds = %45, %29
%54 = load i32, i32* @stderr
%55 = load float, float* %5
%56 = fpext float %55 to double
%57 = load i8*, i8** %4
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), double %56, i8* %57)
%59 = call i32 @exit(i32 0)
unreachable
60: ; preds = %45
%61 = load float, float* %6
%62 = load float, float* %13
%63 = fcmp olt float %61, %62
br i1 %63, label %72, label %64
64: ; preds = %60
%65 = load float, float* %6
%66 = load float, float* %13
%67 = load float, float* %14
%68 = load i32, i32* %10
%69 = sitofp i32 %68 to float
%70 = call float @llvm.fmuladd.f32(float %67, float %69, float %66)
%71 = fcmp ogt float %65, %70
br i1 %71, label %72, label %79
72: ; preds = %64, %60
%73 = load i32, i32* @stderr
%74 = load float, float* %6
%75 = fpext float %74 to double
%76 = load i8*, i8** %4
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), double %75, i8* %76)
%78 = call i32 @exit(i32 0)
unreachable
79: ; preds = %64
store i32 0, i32* %9
br label %80
80: ; preds = %134, %79
%81 = load i32, i32* %9
%82 = load i32, i32* %11
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %137
84: ; preds = %80
%85 = load float, float* %12
%86 = load i32, i32* %11
%87 = load i32, i32* %9
%88 = sub nsw i32 %86, %87
%89 = sitofp i32 %88 to double
%90 = fsub double %89, 5.000000e-01
%91 = fptrunc double %90 to float
%92 = load float, float* %14
%93 = call float @llvm.fmuladd.f32(float %91, float %92, float %85)
store float %93, float* %17
store i32 0, i32* %8
br label %94
94: ; preds = %130, %84
%95 = load i32, i32* %8
%96 = load i32, i32* %10
%97 = icmp slt i32 %95, %96
br i1 %97, label %98, label %133
98: ; preds = %94
%99 = load float, float* %13
%100 = load i32, i32* %8
%101 = sitofp i32 %100 to double
%102 = fadd double %101, 5.000000e-01
%103 = fptrunc double %102 to float
%104 = load float, float* %14
%105 = call float @llvm.fmuladd.f32(float %103, float %104, float %99)
store float %105, float* %18
%106 = load i32*, i32** %7
%107 = call i32 (i32*, i8*, ...) @fscanf(i32* %106, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %19)
%108 = load float, float* %17
%109 = fpext float %108 to double
%110 = call double @llvm.fmuladd.f64(double %109, double 1.000000e+04, double 5.000000e-01)
%111 = fptosi double %110 to i32
%112 = load float, float* %5
%113 = fpext float %112 to double
%114 = call double @llvm.fmuladd.f64(double %113, double 1.000000e+04, double 5.000000e-01)
%115 = fptosi double %114 to i32
%116 = icmp eq i32 %111, %115
br i1 %116, label %117, label %129
117: ; preds = %98
%118 = load float, float* %18
%119 = fpext float %118 to double
%120 = call double @llvm.fmuladd.f64(double %119, double 1.000000e+04, double 5.000000e-01)
%121 = fptosi double %120 to i32
%122 = load float, float* %6
%123 = fpext float %122 to double
%124 = call double @llvm.fmuladd.f64(double %123, double 1.000000e+04, double 5.000000e-01)
%125 = fptosi double %124 to i32
%126 = icmp eq i32 %121, %125
br i1 %126, label %127, label %129
127: ; preds = %117
%128 = load float, float* %19
store float %128, float* %16
br label %129
129: ; preds = %127, %117, %98
br label %130
130: ; preds = %129
%131 = load i32, i32* %8
%132 = add nsw i32 %131, 1
store i32 %132, i32* %8
br label %94
133: ; preds = %94
br label %134
134: ; preds = %133
%135 = load i32, i32* %9
%136 = add nsw i32 %135, 1
store i32 %136, i32* %9
br label %80
137: ; preds = %80
%138 = load i32*, i32** %7
%139 = call i32 @fclose(i32* %138)
%140 = load float, float* %16
%141 = load float, float* %15
%142 = fcmp oeq float %140, %141
br i1 %142, label %143, label %144
143: ; preds = %137
store float -9.990000e+02, float* %16
br label %144
144: ; preds = %143, %137
%145 = load float, float* %16
ret float %145
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"Unable to open ARC/INFO soil file %s\00"
@.str.2 = [7 x i8] c"%*s %i\00"
@.str.3 = [7 x i8] c"%*s %f\00"
@.str.4 = [51 x i8] c"Given latitude %f does not fall within ARC file %s\00"
@.str.5 = [52 x i8] c"Given longitude %f does not fall within ARC file %s\00"
@.str.6 = [3 x i8] c"%f\00"
define float @read_arcinfo_value(i8* %0, float %1, float %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast float* %6 to i8*
%14 = bitcast float* %7 to i8*
%15 = bitcast float* %8 to i8*
%16 = bitcast float* %9 to i8*
%17 = bitcast float* %10 to i8*
%18 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %24
20: ; preds = %3
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%23 = tail call i32 @exit(i32 0)
unreachable
24: ; preds = %3
%25 = call i32 (i32*, i8*, ...) @fscanf(i32* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%26 = call i32 (i32*, i8*, ...) @fscanf(i32* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%27 = call i32 (i32*, i8*, ...) @fscanf(i32* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %7)
%28 = call i32 (i32*, i8*, ...) @fscanf(i32* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %6)
%29 = call i32 (i32*, i8*, ...) @fscanf(i32* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %8)
%30 = call i32 (i32*, i8*, ...) @fscanf(i32* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %9)
%31 = load float, float* %6
%32 = fcmp ogt float %31, %1
br i1 %32, label %39, label %33
33: ; preds = %24
%34 = load float, float* %8
%35 = load i32, i32* %5
%36 = sitofp i32 %35 to float
%37 = call float @llvm.fmuladd.f32(float %34, float %36, float %31)
%38 = fcmp olt float %37, %1
br i1 %38, label %39, label %44
39: ; preds = %33, %24
%40 = load i32, i32* @stderr
%41 = fpext float %1 to double
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), double %41, i8* %0)
%43 = call i32 @exit(i32 0)
unreachable
44: ; preds = %33
%45 = load float, float* %7
%46 = fcmp ogt float %45, %2
br i1 %46, label %61, label %47
47: ; preds = %44
%48 = load i32, i32* %4
%49 = sitofp i32 %48 to float
%50 = call float @llvm.fmuladd.f32(float %34, float %49, float %45)
%51 = fcmp olt float %50, %2
br i1 %51, label %61, label %52
52: ; preds = %47
%53 = icmp sgt i32 %35, 0
br i1 %53, label %54, label %116
54: ; preds = %52
%55 = fpext float %1 to double
%56 = call double @llvm.fmuladd.f64(double %55, double 1.000000e+04, double 5.000000e-01)
%57 = fptosi double %56 to i32
%58 = fpext float %2 to double
%59 = call double @llvm.fmuladd.f64(double %58, double 1.000000e+04, double 5.000000e-01)
%60 = fptosi double %59 to i32
br label %66
61: ; preds = %47, %44
%62 = load i32, i32* @stderr
%63 = fpext float %2 to double
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), double %63, i8* %0)
%65 = call i32 @exit(i32 0)
unreachable
66: ; preds = %54, %110
%67 = phi i32 [ %35, %54 ], [ %111, %110 ]
%68 = phi i32 [ %48, %54 ], [ %112, %110 ]
%69 = phi i32 [ 0, %54 ], [ %114, %110 ]
%70 = phi float [ undef, %54 ], [ %113, %110 ]
%71 = icmp sgt i32 %68, 0
br i1 %71, label %72, label %110
72: ; preds = %66
%73 = sub nsw i32 %67, %69
%74 = sitofp i32 %73 to double
%75 = fadd double %74, -5.000000e-01
%76 = fptrunc double %75 to float
%77 = load float, float* %8
%78 = load float, float* %6
%79 = call float @llvm.fmuladd.f32(float %76, float %77, float %78)
%80 = fpext float %79 to double
%81 = call double @llvm.fmuladd.f64(double %80, double 1.000000e+04, double 5.000000e-01)
%82 = fptosi double %81 to i32
%83 = icmp eq i32 %82, %57
br label %84
84: ; preds = %106, %72
%85 = phi float [ %77, %72 ], [ %107, %106 ]
%86 = phi i32 [ 0, %72 ], [ %103, %106 ]
%87 = phi float [ %70, %72 ], [ %102, %106 ]
%88 = load float, float* %7
%89 = call i32 (i32*, i8*, ...) @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %10)
br i1 %83, label %90, label %101
90: ; preds = %84
%91 = sitofp i32 %86 to double
%92 = fadd double %91, 5.000000e-01
%93 = fptrunc double %92 to float
%94 = call float @llvm.fmuladd.f32(float %93, float %85, float %88)
%95 = fpext float %94 to double
%96 = call double @llvm.fmuladd.f64(double %95, double 1.000000e+04, double 5.000000e-01)
%97 = fptosi double %96 to i32
%98 = icmp eq i32 %97, %60
%99 = load float, float* %10
%100 = select i1 %98, float %99, float %87
br label %101
101: ; preds = %90, %84
%102 = phi float [ %87, %84 ], [ %100, %90 ]
%103 = add nuw nsw i32 %86, 1
%104 = load i32, i32* %4
%105 = icmp slt i32 %103, %104
br i1 %105, label %106, label %108
106: ; preds = %101
%107 = load float, float* %8
br label %84
108: ; preds = %101
%109 = load i32, i32* %5
br label %110
110: ; preds = %108, %66
%111 = phi i32 [ %67, %66 ], [ %109, %108 ]
%112 = phi i32 [ %68, %66 ], [ %104, %108 ]
%113 = phi float [ %70, %66 ], [ %102, %108 ]
%114 = add nuw nsw i32 %69, 1
%115 = icmp sgt i32 %111, %114
br i1 %115, label %66, label %116
116: ; preds = %110, %52
%117 = phi float [ undef, %52 ], [ %113, %110 ]
%118 = call i32 @fclose(i32* %18)
%119 = load float, float* %9
%120 = fcmp oeq float %117, %119
%121 = select i1 %120, float -9.990000e+02, float %117
ret float %121
}