#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);
double fabs(float);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(float *);
int fscanf(int /*<<< orphan*/ *, char *, float *, float *, ...);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdout;
main(int argc, char **argv) {
  float *lat, *lon;
  float llt, lln, value[2], junk;
  char value3[20];
  int i, j, istart;
  FILE *fp, *fp2, *fp3, *fp4;
  char nomatch;
  nomatch = !0;
  int ctmatch;
  if (argc != 3) {
    printf("Wrong command line arguments: enter <inputfile> <outputfile>  .\n");
    exit(0);
  }
  lat = (float *)calloc(1961, sizeof(float));
  lon = (float *)calloc(1961, sizeof(float));
  if (lat == NULL || lon == NULL) {
    fprintf(stderr, "Error allocaing\n");
    exit(-1);
  }
  fp3 = fopen("zb_025.ll", "r");
  if (fp3 == NULL) {
    fprintf(stderr, "NULL   \n");
    exit(3);
  }
  for (j = 0; j < 1961; j++) {
    if (fscanf(fp3, "%f %f\n", &lat[j], &lon[j]) != 2) {
      fprintf(stderr, "error reading listcell\n");
      exit(-1);
    }
  }
  fclose(fp3);
  fp = fopen(argv[1], "r");
  fprintf(stderr, "opening inputfile\n");
  if (fp == NULL) {
    fprintf(stderr, "NULL  %s \n", argv[1]);
    exit(1);
  }
  fp2 = fopen(argv[2], "w");
  if (fp2 == NULL) {
    fprintf(stderr, "NULL   %s \n", argv[2]);
    exit(2);
  }
  fp4 = fopen("zb_box_latlon", "r");
  if (fp4 == NULL) {
    fprintf(stderr, "NULL   lonlat \n");
    exit(4);
  }
  ctmatch = 0;
  for (j = 0; j < 4480; j++) {
    if (fscanf(fp4, "%f %f\n", &lln, &llt) != 2) {
      fprintf(stderr, "Error readind zb_box_latlon\n");
      exit(-1);
    }
    if (fscanf(fp, "%f %f %[^\n]\n", &value[0], &value[1], &value3) != 3) {
      fprintf(stderr, "error reading %s at %d\n", argv[1], j);
      exit(3);
    }
    nomatch = !0;
    i = -1;
    while (i < 1961 && nomatch) {
      i++;
      if (fabs(llt - lat[i]) < 0.001 && fabs(lln - lon[i]) < 0.001) {
        fprintf(fp2, " %.4f %.4f \n", value[0], value[1]);
        nomatch = 0;
        ctmatch++;
      }
    }
  }
  fprintf(stdout, "%d cells clipped, was expecting %d cells\n", ctmatch, 1961);
  fclose(fp2);
  fclose(fp);
  fclose(fp4);
  free(lat);
  free(lon);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x1,-0x81(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11cd <main+0x3d>
lea    0xe47(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    $0x7a9,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x7a9,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1209 <main+0x79>
cmpq   $0x0,-0x20(%rbp)
jne    122b <main+0x9b>
mov    0x2dd0(%rip),%rax
movslq (%rax),%rdi
lea    0xe2f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
lea    0xe28(%rip),%rdi
lea    0xe2b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    126f <main+0xdf>
mov    0x2d8c(%rip),%rax
movslq (%rax),%rdi
lea    0xe08(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x3,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x58(%rbp)
cmpl   $0x7a9,-0x58(%rbp)
jge    12f1 <main+0x161>
mov    -0x78(%rbp),%rdi
mov    -0x18(%rbp),%rdx
movslq -0x58(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rcx
movslq -0x58(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rcx
lea    0xdc3(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
cmp    $0x2,%eax
je     12de <main+0x14e>
mov    0x2d1d(%rip),%rax
movslq (%rax),%rdi
lea    0xda9(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
jmp    12e3 <main+0x153>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1276 <main+0xe6>
mov    -0x78(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd5b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x68(%rbp)
mov    0x2cc7(%rip),%rax
movslq (%rax),%rdi
lea    0xd6b(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
cmpq   $0x0,-0x68(%rbp)
jne    135f <main+0x1cf>
mov    0x2ca4(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd53(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd3e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    13ac <main+0x21c>
mov    0x2c57(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd13(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
lea    0xd07(%rip),%rdi
lea    0xcaa(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    13f0 <main+0x260>
mov    0x2c0b(%rip),%rax
movslq (%rax),%rdi
lea    0xce9(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x4,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x88(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x1180,-0x58(%rbp)
jge    15a7 <main+0x417>
mov    -0x80(%rbp),%rdi
lea    0xc56(%rip),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x24(%rbp),%rcx
mov    $0x0,%al
call   1060 <fscanf@plt>
cmp    $0x2,%eax
je     1453 <main+0x2c3>
mov    0x2ba8(%rip),%rax
movslq (%rax),%rdi
lea    0xc96(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x68(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x30(%rbp),%rcx
add    $0x4,%rcx
lea    0xc8b(%rip),%rsi
lea    -0x50(%rbp),%r8
mov    $0x0,%al
call   1060 <fscanf@plt>
cmp    $0x3,%eax
je     14ab <main+0x31b>
mov    0x2b5b(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x58(%rbp),%ecx
lea    0xc68(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x3,%edi
call   10b0 <exit@plt>
movb   $0x1,-0x81(%rbp)
movl   $0xffffffff,-0x54(%rbp)
xor    %eax,%eax
cmpl   $0x7a9,-0x54(%rbp)
mov    %al,-0x89(%rbp)
jge    14e1 <main+0x351>
movsbl -0x81(%rbp),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x89(%rbp)
mov    -0x89(%rbp),%al
test   $0x1,%al
jne    14f4 <main+0x364>
jmp    1594 <main+0x404>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
movss  -0x24(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x54(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
call   1080 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xae1(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    158f <main+0x3ff>
movss  -0x28(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x54(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
call   1080 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xab5(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    158f <main+0x3ff>
mov    -0x70(%rbp),%rdi
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x2c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xba8(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
movb   $0x0,-0x81(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    14b9 <main+0x329>
jmp    1599 <main+0x409>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1401 <main+0x271>
mov    0x2a2a(%rip),%rax
mov    (%rax),%rdi
mov    -0x88(%rbp),%edx
lea    0xb69(%rip),%rsi
mov    $0x7a9,%ecx
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x70(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x68(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x80(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0x3,%edi
jne    14eb <main+0x34b>
mov    %rsi,%r13
mov    $0x7a9,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,%rbx
mov    $0x7a9,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
test   %rbx,%rbx
je     14fe <main+0x35e>
mov    %rax,%r14
test   %rax,%rax
je     14fe <main+0x35e>
lea    0xe22(%rip),%rdi
lea    0xe25(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1516 <main+0x376>
mov    %rax,%r12
lea    0xe18(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%rdx
lea    (%r14,%rbp,1),%rcx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <fscanf@plt>
cmp    $0x2,%eax
jne    147b <main+0x2db>
add    $0x4,%rbp
cmp    $0x1ea4,%rbp
jne    1220 <main+0x80>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    0x8(%r13),%rdi
lea    0xdc5(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbp
mov    0x2d73(%rip),%r15
movslq (%r15),%rcx
lea    0xdd6(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    %rbp,0x20(%rsp)
test   %rbp,%rbp
je     1540 <main+0x3a0>
mov    0x10(%r13),%rdi
lea    0xdcc(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
je     155f <main+0x3bf>
mov    %r13,0x28(%rsp)
lea    0xdbb(%rip),%rdi
lea    0xd5e(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     157e <main+0x3de>
mov    %rax,%rbp
xor    %r15d,%r15d
xor    %r13d,%r13d
jmp    131c <main+0x17c>
xchg   %ax,%ax
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mov    0x18(%rsp),%rdi
lea    0xdd9(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
add    $0x1,%r15d
add    $0x1,%r13d
cmp    $0x1180,%r13d
je     141e <main+0x27e>
mov    %rbp,%rdi
lea    0xd08(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
xor    %eax,%eax
call   1060 <fscanf@plt>
cmp    $0x2,%eax
jne    1493 <main+0x2f3>
mov    0x20(%rsp),%rdi
lea    0xd68(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x30(%rsp),%r8
xor    %eax,%eax
call   1060 <fscanf@plt>
cmp    $0x3,%eax
jne    14bd <main+0x31d>
mov    $0xfffffffffffffffe,%r12
jmp    1391 <main+0x1f1>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x2,%r12
cmp    $0x7a8,%r12
jae    130b <main+0x16b>
movss  0xc(%rsp),%xmm0
subss  0x8(%rbx,%r12,4),%xmm0
call   1080 <fabs@plt>
movsd  0xc55(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    13d5 <main+0x235>
movss  0x8(%rsp),%xmm0
subss  0x8(%r14,%r12,4),%xmm0
call   1080 <fabs@plt>
movsd  0xc35(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     12e0 <main+0x140>
movss  0xc(%rsp),%xmm0
subss  0xc(%rbx,%r12,4),%xmm0
call   1080 <fabs@plt>
movsd  0xc11(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1380 <main+0x1e0>
movss  0x8(%rsp),%xmm0
subss  0xc(%r14,%r12,4),%xmm0
call   1080 <fabs@plt>
movsd  0xbf1(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1380 <main+0x1e0>
jmp    12e0 <main+0x140>
mov    0x2bb3(%rip),%rax
mov    (%rax),%rdi
lea    0xcb7(%rip),%rsi
mov    %r15d,%edx
mov    $0x7a9,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x18(%rsp),%rdi
call   1050 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1050 <fclose@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b5e(%rip),%rax
movslq (%rax),%rcx
lea    0xba9(%rip),%rdi
mov    $0x17,%esi
jmp    14a9 <main+0x309>
mov    0x2b46(%rip),%rax
movslq (%rax),%rcx
lea    0xbf3(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x2b1c(%rip),%rax
movslq (%rax),%rdi
mov    0x28(%rsp),%rax
mov    0x8(%rax),%rdx
lea    0xbea(%rip),%rsi
mov    %r13d,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x3,%edi
call   10b0 <exit@plt>
lea    0xc1e(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    0x2adb(%rip),%rax
movslq (%rax),%rcx
lea    0xaf9(%rip),%rdi
mov    $0x10,%esi
jmp    14a9 <main+0x309>
mov    0x2ac3(%rip),%rax
movslq (%rax),%rcx
lea    0xafe(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    $0x3,%edi
call   10b0 <exit@plt>
movslq (%r15),%rdi
mov    0x8(%r13),%rdx
lea    0xb12(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movslq (%r15),%rdi
mov    0x10(%r13),%rdx
lea    0xb00(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    0x2a5b(%rip),%rax
movslq (%rax),%rcx
lea    0xaf8(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    $0x4,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [65 x i8] c"Wrong command line arguments: enter <inputfile> <outputfile> .\0A\00"
@stderr = global i32 0
@.str.1 = [17 x i8] c"Error allocaing\0A\00"
@.str.2 = [10 x i8] c"zb_025.ll\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [9 x i8] c"NULL \0A\00"
@.str.5 = [7 x i8] c"%f %f\0A\00"
@.str.6 = [24 x i8] c"error reading listcell\0A\00"
@.str.7 = [19 x i8] c"opening inputfile\0A\00"
@.str.8 = [11 x i8] c"NULL %s \0A\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [12 x i8] c"NULL %s \0A\00"
@.str.11 = [14 x i8] c"zb_box_latlon\00"
@.str.12 = [16 x i8] c"NULL lonlat \0A\00"
@.str.13 = [29 x i8] c"Error readind zb_box_latlon\0A\00"
@.str.14 = [13 x i8] c"%f %f %[^\0A]\0A\00"
@.str.15 = [24 x i8] c"error reading %s at %d\0A\00"
@.str.16 = [13 x i8] c" %.4f %.4f \0A\00"
@stdout = global i32* null
@.str.17 = [42 x i8] c"%d cells clipped, was expecting %d cells\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float*
%7 = alloca float*
%8 = alloca float
%9 = alloca float
%10 = alloca [2 x float]
%11 = alloca float
%12 = alloca [20 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i8
%21 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 1, i8* %20
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 3
br i1 %23, label %24, label %27
24: ; preds = %2
%25 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 0)
unreachable
27: ; preds = %2
%28 = call i64 @calloc(i32 1961, i32 4)
%29 = inttoptr i64 %28 to float*
store float* %29, float** %6
%30 = call i64 @calloc(i32 1961, i32 4)
%31 = inttoptr i64 %30 to float*
store float* %31, float** %7
%32 = load float*, float** %6
%33 = icmp eq float* %32, null
br i1 %33, label %37, label %34
34: ; preds = %27
%35 = load float*, float** %7
%36 = icmp eq float* %35, null
br i1 %36, label %37, label %43
37: ; preds = %34, %27
%38 = load i32, i32* @stderr
%39 = sext i32 %38 to i64
%40 = inttoptr i64 %39 to i32*
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%42 = call i32 @exit(i32 -1)
unreachable
43: ; preds = %34
%44 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %44, i32** %18
%45 = load i32*, i32** %18
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %53
47: ; preds = %43
%48 = load i32, i32* @stderr
%49 = sext i32 %48 to i64
%50 = inttoptr i64 %49 to i32*
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%52 = call i32 @exit(i32 3)
unreachable
53: ; preds = %43
store i32 0, i32* %14
br label %54
54: ; preds = %76, %53
%55 = load i32, i32* %14
%56 = icmp slt i32 %55, 1961
br i1 %56, label %57, label %79
57: ; preds = %54
%58 = load i32*, i32** %18
%59 = load float*, float** %6
%60 = load i32, i32* %14
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds float, float* %59, i64 %61
%63 = load float*, float** %7
%64 = load i32, i32* %14
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds float, float* %63, i64 %65
%67 = call i32 (i32*, i8*, float*, float*, ...) @fscanf(i32* %58, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), float* %62, float* %66)
%68 = icmp ne i32 %67, 2
br i1 %68, label %69, label %75
69: ; preds = %57
%70 = load i32, i32* @stderr
%71 = sext i32 %70 to i64
%72 = inttoptr i64 %71 to i32*
%73 = call i32 (i32*, i8*, ...) @fprintf(i32* %72, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%74 = call i32 @exit(i32 -1)
unreachable
75: ; preds = %57
br label %76
76: ; preds = %75
%77 = load i32, i32* %14
%78 = add nsw i32 %77, 1
store i32 %78, i32* %14
br label %54
79: ; preds = %54
%80 = load i32*, i32** %18
%81 = call i32 @fclose(i32* %80)
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 1
%84 = load i8*, i8** %83
%85 = call i32* @fopen(i8* %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %85, i32** %16
%86 = load i32, i32* @stderr
%87 = sext i32 %86 to i64
%88 = inttoptr i64 %87 to i32*
%89 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%90 = load i32*, i32** %16
%91 = icmp eq i32* %90, null
br i1 %91, label %92, label %101
92: ; preds = %79
%93 = load i32, i32* @stderr
%94 = sext i32 %93 to i64
%95 = inttoptr i64 %94 to i32*
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 1
%98 = load i8*, i8** %97
%99 = call i32 (i32*, i8*, ...) @fprintf(i32* %95, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %98)
%100 = call i32 @exit(i32 1)
unreachable
101: ; preds = %79
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 2
%104 = load i8*, i8** %103
%105 = call i32* @fopen(i8* %104, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %105, i32** %17
%106 = load i32*, i32** %17
%107 = icmp eq i32* %106, null
br i1 %107, label %108, label %117
108: ; preds = %101
%109 = load i32, i32* @stderr
%110 = sext i32 %109 to i64
%111 = inttoptr i64 %110 to i32*
%112 = load i8**, i8*** %5
%113 = getelementptr inbounds i8*, i8** %112, i64 2
%114 = load i8*, i8** %113
%115 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %114)
%116 = call i32 @exit(i32 2)
unreachable
117: ; preds = %101
%118 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %118, i32** %19
%119 = load i32*, i32** %19
%120 = icmp eq i32* %119, null
br i1 %120, label %121, label %127
121: ; preds = %117
%122 = load i32, i32* @stderr
%123 = sext i32 %122 to i64
%124 = inttoptr i64 %123 to i32*
%125 = call i32 (i32*, i8*, ...) @fprintf(i32* %124, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
%126 = call i32 @exit(i32 4)
unreachable
127: ; preds = %117
store i32 0, i32* %21
store i32 0, i32* %14
br label %128
128: ; preds = %202, %127
%129 = load i32, i32* %14
%130 = icmp slt i32 %129, 4480
br i1 %130, label %131, label %205
131: ; preds = %128
%132 = load i32*, i32** %19
%133 = call i32 (i32*, i8*, float*, float*, ...) @fscanf(i32* %132, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), float* %9, float* %8)
%134 = icmp ne i32 %133, 2
br i1 %134, label %135, label %141
135: ; preds = %131
%136 = load i32, i32* @stderr
%137 = sext i32 %136 to i64
%138 = inttoptr i64 %137 to i32*
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %138, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0))
%140 = call i32 @exit(i32 -1)
unreachable
141: ; preds = %131
%142 = load i32*, i32** %16
%143 = getelementptr inbounds [2 x float], [2 x float]* %10, i64 0, i64 0
%144 = getelementptr inbounds [2 x float], [2 x float]* %10, i64 0, i64 1
%145 = call i32 (i32*, i8*, float*, float*, ...) @fscanf(i32* %142, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), float* %143, float* %144, [20 x i8]* %12)
%146 = icmp ne i32 %145, 3
br i1 %146, label %147, label %157
147: ; preds = %141
%148 = load i32, i32* @stderr
%149 = sext i32 %148 to i64
%150 = inttoptr i64 %149 to i32*
%151 = load i8**, i8*** %5
%152 = getelementptr inbounds i8*, i8** %151, i64 1
%153 = load i8*, i8** %152
%154 = load i32, i32* %14
%155 = call i32 (i32*, i8*, ...) @fprintf(i32* %150, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), i8* %153, i32 %154)
%156 = call i32 @exit(i32 3)
unreachable
157: ; preds = %141
store i8 1, i8* %20
store i32 -1, i32* %13
br label %158
158: ; preds = %200, %157
%159 = load i32, i32* %13
%160 = icmp slt i32 %159, 1961
br i1 %160, label %161, label %165
161: ; preds = %158
%162 = load i8, i8* %20
%163 = sext i8 %162 to i32
%164 = icmp ne i32 %163, 0
br label %165
165: ; preds = %161, %158
%166 = phi i1 [ false, %158 ], [ %164, %161 ]
br i1 %166, label %167, label %201
167: ; preds = %165
%168 = load i32, i32* %13
%169 = add nsw i32 %168, 1
store i32 %169, i32* %13
%170 = load float, float* %8
%171 = load float*, float** %6
%172 = load i32, i32* %13
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds float, float* %171, i64 %173
%175 = load float, float* %174
%176 = fsub float %170, %175
%177 = call double @fabs(float %176)
%178 = fcmp olt double %177, 1.000000e-03
br i1 %178, label %179, label %200
179: ; preds = %167
%180 = load float, float* %9
%181 = load float*, float** %7
%182 = load i32, i32* %13
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds float, float* %181, i64 %183
%185 = load float, float* %184
%186 = fsub float %180, %185
%187 = call double @fabs(float %186)
%188 = fcmp olt double %187, 1.000000e-03
br i1 %188, label %189, label %200
189: ; preds = %179
%190 = load i32*, i32** %17
%191 = getelementptr inbounds [2 x float], [2 x float]* %10, i64 0, i64 0
%192 = load float, float* %191
%193 = fpext float %192 to double
%194 = getelementptr inbounds [2 x float], [2 x float]* %10, i64 0, i64 1
%195 = load float, float* %194
%196 = fpext float %195 to double
%197 = call i32 (i32*, i8*, ...) @fprintf(i32* %190, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), double %193, double %196)
store i8 0, i8* %20
%198 = load i32, i32* %21
%199 = add nsw i32 %198, 1
store i32 %199, i32* %21
br label %200
200: ; preds = %189, %179, %167
br label %158
201: ; preds = %165
br label %202
202: ; preds = %201
%203 = load i32, i32* %14
%204 = add nsw i32 %203, 1
store i32 %204, i32* %14
br label %128
205: ; preds = %128
%206 = load i32*, i32** @stdout
%207 = load i32, i32* %21
%208 = call i32 (i32*, i8*, ...) @fprintf(i32* %206, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.17, i64 0, i64 0), i32 %207, i32 1961)
%209 = load i32*, i32** %17
%210 = call i32 @fclose(i32* %209)
%211 = load i32*, i32** %16
%212 = call i32 @fclose(i32* %211)
%213 = load i32*, i32** %19
%214 = call i32 @fclose(i32* %213)
%215 = load float*, float** %6
%216 = call i32 @free(float* %215)
%217 = load float*, float** %7
%218 = call i32 @free(float* %217)
%219 = load i32, i32* %3
ret i32 %219
}

LLVM IR (-O2):
@stderr = global i32 0
@.str.1 = [17 x i8] c"Error allocaing\0A\00"
@.str.2 = [10 x i8] c"zb_025.ll\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [9 x i8] c"NULL \0A\00"
@.str.5 = [7 x i8] c"%f %f\0A\00"
@.str.6 = [24 x i8] c"error reading listcell\0A\00"
@.str.7 = [19 x i8] c"opening inputfile\0A\00"
@.str.8 = [11 x i8] c"NULL %s \0A\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [12 x i8] c"NULL %s \0A\00"
@.str.11 = [14 x i8] c"zb_box_latlon\00"
@.str.12 = [16 x i8] c"NULL lonlat \0A\00"
@.str.13 = [29 x i8] c"Error readind zb_box_latlon\0A\00"
@.str.14 = [13 x i8] c"%f %f %[^\0A]\0A\00"
@.str.15 = [24 x i8] c"error reading %s at %d\0A\00"
@.str.16 = [13 x i8] c" %.4f %.4f \0A\00"
@stdout = global i32* null
@.str.17 = [42 x i8] c"%d cells clipped, was expecting %d cells\0A\00"
@str = [64 x i8] c"Wrong command line arguments: enter <inputfile> <outputfile> .\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca [2 x float]
%6 = alloca [20 x i8]
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = bitcast [2 x float]* %5 to i8*
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%11 = icmp eq i32 %0, 3
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @exit(i32 0)
unreachable
15: ; preds = %2
%16 = tail call i64 @calloc(i32 1961, i32 4)
%17 = inttoptr i64 %16 to float*
%18 = tail call i64 @calloc(i32 1961, i32 4)
%19 = inttoptr i64 %18 to float*
%20 = icmp eq i64 %16, 0
%21 = icmp eq i64 %18, 0
%22 = select i1 %20, i1 true, i1 %21
br i1 %22, label %23, label %29
23: ; preds = %15
%24 = load i32, i32* @stderr
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to i32*
%27 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64 16, i64 1, i32* %26)
%28 = tail call i32 @exit(i32 -1)
unreachable
29: ; preds = %15
%30 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %41
32: ; preds = %29
%33 = load i32, i32* @stderr
%34 = sext i32 %33 to i64
%35 = inttoptr i64 %34 to i32*
%36 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i64 8, i64 1, i32* %35)
%37 = tail call i32 @exit(i32 3)
unreachable
38: ; preds = %41
%39 = add nuw nsw i64 %42, 1
%40 = icmp eq i64 %39, 1961
br i1 %40, label %53, label %41
41: ; preds = %29, %38
%42 = phi i64 [ %39, %38 ], [ 0, %29 ]
%43 = getelementptr inbounds float, float* %17, i64 %42
%44 = getelementptr inbounds float, float* %19, i64 %42
%45 = tail call i32 (i32*, i8*, float*, float*, ...) @fscanf(i32* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), float* %43, float* %44)
%46 = icmp eq i32 %45, 2
br i1 %46, label %38, label %47
47: ; preds = %41
%48 = load i32, i32* @stderr
%49 = sext i32 %48 to i64
%50 = inttoptr i64 %49 to i32*
%51 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i64 23, i64 1, i32* %50)
%52 = tail call i32 @exit(i32 -1)
unreachable
53: ; preds = %38
%54 = tail call i32 @fclose(i32* %30)
%55 = getelementptr inbounds i8*, i8** %1, i64 1
%56 = load i8*, i8** %55
%57 = tail call i32* @fopen(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%58 = load i32, i32* @stderr
%59 = sext i32 %58 to i64
%60 = inttoptr i64 %59 to i32*
%61 = tail call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i64 18, i64 1, i32* %60)
%62 = icmp eq i32* %57, null
br i1 %62, label %63, label %70
63: ; preds = %53
%64 = load i32, i32* @stderr
%65 = sext i32 %64 to i64
%66 = inttoptr i64 %65 to i32*
%67 = load i8*, i8** %55
%68 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %67)
%69 = tail call i32 @exit(i32 1)
unreachable
70: ; preds = %53
%71 = getelementptr inbounds i8*, i8** %1, i64 2
%72 = load i8*, i8** %71
%73 = tail call i32* @fopen(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%74 = icmp eq i32* %73, null
br i1 %74, label %75, label %82
75: ; preds = %70
%76 = load i32, i32* @stderr
%77 = sext i32 %76 to i64
%78 = inttoptr i64 %77 to i32*
%79 = load i8*, i8** %71
%80 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %78, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %79)
%81 = tail call i32 @exit(i32 2)
unreachable
82: ; preds = %70
%83 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%84 = icmp eq i32* %83, null
br i1 %84, label %88, label %85
85: ; preds = %82
%86 = getelementptr inbounds [2 x float], [2 x float]* %5, i64 0, i64 0
%87 = getelementptr inbounds [2 x float], [2 x float]* %5, i64 0, i64 1
br label %94
88: ; preds = %82
%89 = load i32, i32* @stderr
%90 = sext i32 %89 to i64
%91 = inttoptr i64 %90 to i32*
%92 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i64 15, i64 1, i32* %91)
%93 = tail call i32 @exit(i32 4)
unreachable
94: ; preds = %85, %155
%95 = phi i32 [ 0, %85 ], [ %156, %155 ]
%96 = phi i32 [ 0, %85 ], [ %157, %155 ]
%97 = call i32 (i32*, i8*, float*, float*, ...) @fscanf(i32* %83, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), float* %4, float* %3)
%98 = icmp eq i32 %97, 2
br i1 %98, label %105, label %99
99: ; preds = %94
%100 = load i32, i32* @stderr
%101 = sext i32 %100 to i64
%102 = inttoptr i64 %101 to i32*
%103 = call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i64 28, i64 1, i32* %102)
%104 = call i32 @exit(i32 -1)
unreachable
105: ; preds = %94
%106 = call i32 (i32*, i8*, float*, float*, ...) @fscanf(i32* %57, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), float* %86, float* %87, [20 x i8]* %6)
%107 = icmp eq i32 %106, 3
br i1 %107, label %115, label %108
108: ; preds = %105
%109 = load i32, i32* @stderr
%110 = sext i32 %109 to i64
%111 = inttoptr i64 %110 to i32*
%112 = load i8*, i8** %55
%113 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), i8* %112, i32 %96)
%114 = call i32 @exit(i32 3)
unreachable
115: ; preds = %105, %153
%116 = phi i64 [ %139, %153 ], [ -1, %105 ]
%117 = add nsw i64 %116, 1
%118 = load float, float* %3
%119 = getelementptr inbounds float, float* %17, i64 %117
%120 = load float, float* %119
%121 = fsub float %118, %120
%122 = call double @fabs(float %121)
%123 = fcmp olt double %122, 1.000000e-03
br i1 %123, label %124, label %138
124: ; preds = %115
%125 = load float, float* %4
%126 = getelementptr inbounds float, float* %19, i64 %117
%127 = load float, float* %126
%128 = fsub float %125, %127
%129 = call double @fabs(float %128)
%130 = fcmp olt double %129, 1.000000e-03
br i1 %130, label %131, label %138
131: ; preds = %146, %124
%132 = load float, float* %86
%133 = fpext float %132 to double
%134 = load float, float* %87
%135 = fpext float %134 to double
%136 = call i32 (i32*, i8*, ...) @fprintf(i32* %73, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), double %133, double %135)
%137 = add nsw i32 %95, 1
br label %155
138: ; preds = %124, %115
%139 = add nsw i64 %116, 2
%140 = load float, float* %3
%141 = getelementptr inbounds float, float* %17, i64 %139
%142 = load float, float* %141
%143 = fsub float %140, %142
%144 = call double @fabs(float %143)
%145 = fcmp olt double %144, 1.000000e-03
br i1 %145, label %146, label %153
146: ; preds = %138
%147 = load float, float* %4
%148 = getelementptr inbounds float, float* %19, i64 %139
%149 = load float, float* %148
%150 = fsub float %147, %149
%151 = call double @fabs(float %150)
%152 = fcmp olt double %151, 1.000000e-03
br i1 %152, label %131, label %153
153: ; preds = %146, %138
%154 = icmp ult i64 %117, 1960
br i1 %154, label %115, label %155
155: ; preds = %153, %131
%156 = phi i32 [ %137, %131 ], [ %95, %153 ]
%157 = add nuw nsw i32 %96, 1
%158 = icmp eq i32 %157, 4480
br i1 %158, label %159, label %94
159: ; preds = %155
%160 = load i32*, i32** @stdout
%161 = call i32 (i32*, i8*, ...) @fprintf(i32* %160, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.17, i64 0, i64 0), i32 %156, i32 1961)
%162 = call i32 @fclose(i32* %73)
%163 = call i32 @fclose(i32* %57)
%164 = call i32 @fclose(i32* %83)
%165 = call i32 @free(float* %17)
%166 = call i32 @free(float* %19)
ret i32 0
}