#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_FAILURE;
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*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ welcome();
void main(int argc, char **argv) {
  FILE *fp;
  char maskfile[400];
  char junk[40];
  int i, j;
  int rows, cols;
  int void_nr;
  float xllcorner, yllcorner, resolution;
  float uplftlat, uplftlon;
  float lat, lon;
  float value;
  if (argc < 2) {
    welcome();
    printf("\nNot correct number of commandline arguments \n");
    printf("Usage:   latlong inputfile > newfile \n");
    exit(EXIT_FAILURE);
  }
  welcome();
  strcpy(maskfile, argv[1]);
  if ((fp = fopen(maskfile, "r")) == NULL) {
    printf("Cannot open file maskfile %s \n", maskfile);
    exit(0);
  }
  fscanf(fp, "%s", junk);
  fscanf(fp, "%d", &cols);
  fprintf(stderr, "%-15s %d\n", junk, cols);
  fscanf(fp, "%s", junk);
  fscanf(fp, "%d", &rows);
  fprintf(stderr, "%-15s %d\n", junk, rows);
  fscanf(fp, "%s", junk);
  fprintf(stderr, "%-15s", junk);
  fscanf(fp, "%f", &xllcorner);
  fprintf(stderr, "%.4f\n", xllcorner);
  fscanf(fp, "%s", junk);
  fprintf(stderr, "%-15s", junk);
  fscanf(fp, "%f", &yllcorner);
  fprintf(stderr, "%.4f\n", yllcorner);
  fscanf(fp, "%s", junk);
  fprintf(stderr, "%-15s", junk);
  fscanf(fp, "%f", &resolution);
  fprintf(stderr, "%.4f\n", resolution);
  fscanf(fp, "%s", junk);
  fscanf(fp, "%d", &void_nr);
  fprintf(stderr, "%-15s %d\n", junk, void_nr);
  lon = uplftlon = xllcorner + (resolution / 2);
  lat = uplftlat = yllcorner + (rows * resolution) - (resolution / 2);
  for (i = 0; i < rows; i++) {
    lon = uplftlon;
    for (j = 0; j < cols; j++) {
      fscanf(fp, "%f", &value);
      if (value > 0.0)
        printf("%.4f %.4f %.4f\n", lat, lon, value);
      lon = lon + resolution;
    }
    lat = lat - resolution;
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    11cd <main+0x4d>
mov    $0x0,%al
call   1080 <welcome@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    $0x0,%al
call   1080 <welcome@plt>
lea    -0x1b0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1225 <main+0xa5>
lea    -0x1b0(%rbp),%rsi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xe44(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe35(%rip),%rsi
lea    -0x1f0(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
mov    -0x1f0(%rbp),%ecx
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xdee(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xddf(%rip),%rsi
lea    -0x1ec(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
mov    -0x1ec(%rbp),%ecx
lea    0xdb7(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xd98(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    0x2cef(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
lea    0xd8a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xd7e(%rip),%rsi
lea    -0x1f8(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
movss  -0x1f8(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xd61(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xd25(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    0x2c7c(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
lea    0xd17(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xd0b(%rip),%rsi
lea    -0x1fc(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    0x2c45(%rip),%rax
mov    (%rax),%edi
movss  -0x1fc(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xcee(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xcb2(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    0x2c09(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
lea    0xca4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc98(%rip),%rsi
lea    -0x200(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    0x2bd2(%rip),%rax
mov    (%rax),%edi
movss  -0x200(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xc7b(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xc3f(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc30(%rip),%rsi
lea    -0x1f4(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    0x2b7d(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
mov    -0x1f4(%rbp),%ecx
lea    0xc08(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movss  -0x1f8(%rbp),%xmm0
ff
movss  -0x200(%rbp),%xmm1
ff
movss  0xb68(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x208(%rbp)
ff
movss  %xmm0,-0x210(%rbp)
ff
movss  -0x1fc(%rbp),%xmm1
ff
cvtsi2ssl -0x1ec(%rbp),%xmm0
ff
movss  -0x200(%rbp),%xmm2
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x200(%rbp),%xmm1
ff
movss  0xb20(%rip),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x204(%rbp)
ff
movss  %xmm0,-0x20c(%rbp)
ff
movl   $0x0,-0x1e4(%rbp)
mov    -0x1e4(%rbp),%eax
cmp    -0x1ec(%rbp),%eax
jge    15fc <main+0x47c>
movss  -0x208(%rbp),%xmm0
ff
movss  %xmm0,-0x210(%rbp)
ff
movl   $0x0,-0x1e8(%rbp)
mov    -0x1e8(%rbp),%eax
cmp    -0x1f0(%rbp),%eax
jge    15d0 <main+0x450>
mov    -0x18(%rbp),%rdi
lea    0xb46(%rip),%rsi
lea    -0x214(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
movss  -0x214(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    15a4 <main+0x424>
movss  -0x20c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x210(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0x214(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xaf7(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movss  -0x210(%rbp),%xmm0
ff
addss  -0x200(%rbp),%xmm0
ff
movss  %xmm0,-0x210(%rbp)
ff
mov    -0x1e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e8(%rbp)
jmp    152e <main+0x3ae>
movss  -0x20c(%rbp),%xmm0
ff
subss  -0x200(%rbp),%xmm0
ff
movss  %xmm0,-0x20c(%rbp)
ff
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    1502 <main+0x382>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1090 <welcome@plt>
cmp    $0x1,%ebp
jle    14dd <main+0x34d>
mov    0x8(%rbx),%rsi
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe3a(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1503 <main+0x373>
mov    %rax,%r12
lea    0xe40(%rip),%r13
lea    0x30(%rsp),%r14
mov    %rax,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
lea    0xe27(%rip),%rbp
lea    0x8(%rsp),%rdx
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x2dc2(%rip),%r15
mov    (%r15),%edi
mov    0x8(%rsp),%ecx
lea    0xe03(%rip),%rbx
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
lea    0xc(%rsp),%rdx
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    (%r15),%edi
mov    0xc(%rsp),%ecx
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r13,%rbx
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    (%r15),%edi
lea    0xdad(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xda2(%rip),%rbp
lea    0x14(%rsp),%rdx
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    (%r15),%edi
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd89(%rip),%r13
mov    %r13,%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    (%r15),%edi
lea    0xd52(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0x10(%rsp),%rdx
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    (%r15),%edi
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r13,%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    (%r15),%edi
lea    0xd05(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0x4(%rsp),%rdx
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    (%r15),%edi
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r13,%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
lea    0x24(%rsp),%rdx
mov    %r12,%rdi
lea    0xca6(%rip),%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    (%r15),%edi
mov    0x24(%rsp),%ecx
lea    0xc94(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    14c3 <main+0x333>
movss  0x4(%rsp),%xmm0
movss  0xc41(%rip),%xmm1
mulss  %xmm0,%xmm1
cvtsi2ss %eax,%xmm2
movss  0x14(%rsp),%xmm3
mulss  %xmm0,%xmm2
addss  0x10(%rsp),%xmm2
addss  %xmm1,%xmm3
movss  %xmm3,0x18(%rsp)
subss  %xmm1,%xmm2
mov    0x8(%rsp),%ecx
lea    0xc4f(%rip),%r13
lea    0x20(%rsp),%rbp
lea    0xc46(%rip),%r14
xor    %r15d,%r15d
jmp    142b <main+0x29b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%eax
movss  0x1c(%rsp),%xmm2
subss  %xmm0,%xmm2
add    $0x1,%r15d
cmp    %eax,%r15d
jge    14c3 <main+0x333>
test   %ecx,%ecx
jle    141a <main+0x28a>
movss  %xmm2,0x1c(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
movsd  %xmm0,0x28(%rsp)
xor    %ebx,%ebx
movss  0x18(%rsp),%xmm0
movss  %xmm0,(%rsp)
jmp    147f <main+0x2ef>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
add    $0x1,%ebx
mov    0x8(%rsp),%ecx
cmp    %ecx,%ebx
jge    1410 <main+0x280>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
movss  0x20(%rsp),%xmm0
ucomiss 0xb68(%rip),%xmm0
jbe    1460 <main+0x2d0>
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
movss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mov    %r14,%rdi
movsd  0x28(%rsp),%xmm0
mov    $0x3,%al
call   1060 <printf@plt>
jmp    1460 <main+0x2d0>
mov    %r12,%rdi
call   1050 <fclose@plt>
add    $0x1f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb6e(%rip),%rdi
call   1040 <puts@plt>
lea    0xb90(%rip),%rdi
call   1040 <puts@plt>
mov    0x2adc(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0xb00(%rip),%rdi
lea    0x60(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"\0ANot correct number of commandline arguments \0A\00"
@.str.1 = [39 x i8] c"Usage: latlong inputfile > newfile \0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [31 x i8] c"Cannot open file maskfile %s \0A\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.6 = [10 x i8] c"%-15s %d\0A\00"
@.str.7 = [6 x i8] c"%-15s\00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [6 x i8] c"%.4f\0A\00"
@.str.10 = [16 x i8] c"%.4f %.4f %.4f\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca [400 x i8]
%7 = alloca [40 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%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 float
%20 = alloca float
store i32 %0, i32* %3
store i8** %1, i8*** %4
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 2
br i1 %22, label %23, label %29
23: ; preds = %2
%24 = call i32 (...) @welcome()
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %2
%30 = call i32 (...) @welcome()
%31 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%32 = load i8**, i8*** %4
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @strcpy(i8* %31, i8* %34)
%36 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%37 = call i32* @fopen(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %37, i32** %5
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %43
39: ; preds = %29
%40 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %40)
%42 = call i32 @exit(i32 0)
unreachable
43: ; preds = %29
%44 = load i32*, i32** %5
%45 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%46 = call i32 (i32*, i8*, ...) @fscanf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %45)
%47 = load i32*, i32** %5
%48 = call i32 (i32*, i8*, ...) @fscanf(i32* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %11)
%49 = load i32, i32* @stderr
%50 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%51 = load i32, i32* %11
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %50, i32 %51)
%53 = load i32*, i32** %5
%54 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%55 = call i32 (i32*, i8*, ...) @fscanf(i32* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %54)
%56 = load i32*, i32** %5
%57 = call i32 (i32*, i8*, ...) @fscanf(i32* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %10)
%58 = load i32, i32* @stderr
%59 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%60 = load i32, i32* %10
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %59, i32 %60)
%62 = load i32*, i32** %5
%63 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%64 = call i32 (i32*, i8*, ...) @fscanf(i32* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %63)
%65 = load i32, i32* @stderr
%66 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %66)
%68 = load i32*, i32** %5
%69 = call i32 (i32*, i8*, ...) @fscanf(i32* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %13)
%70 = load i32, i32* @stderr
%71 = load float, float* %13
%72 = fpext float %71 to double
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %72)
%74 = load i32*, i32** %5
%75 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%76 = call i32 (i32*, i8*, ...) @fscanf(i32* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %75)
%77 = load i32, i32* @stderr
%78 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %78)
%80 = load i32*, i32** %5
%81 = call i32 (i32*, i8*, ...) @fscanf(i32* %80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %14)
%82 = load i32, i32* @stderr
%83 = load float, float* %14
%84 = fpext float %83 to double
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %84)
%86 = load i32*, i32** %5
%87 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%88 = call i32 (i32*, i8*, ...) @fscanf(i32* %86, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %87)
%89 = load i32, i32* @stderr
%90 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %90)
%92 = load i32*, i32** %5
%93 = call i32 (i32*, i8*, ...) @fscanf(i32* %92, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %15)
%94 = load i32, i32* @stderr
%95 = load float, float* %15
%96 = fpext float %95 to double
%97 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %96)
%98 = load i32*, i32** %5
%99 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%100 = call i32 (i32*, i8*, ...) @fscanf(i32* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %99)
%101 = load i32*, i32** %5
%102 = call i32 (i32*, i8*, ...) @fscanf(i32* %101, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %12)
%103 = load i32, i32* @stderr
%104 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%105 = load i32, i32* %12
%106 = call i32 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %104, i32 %105)
%107 = load float, float* %13
%108 = load float, float* %15
%109 = fdiv float %108, 2.000000e+00
%110 = fadd float %107, %109
store float %110, float* %17
store float %110, float* %19
%111 = load float, float* %14
%112 = load i32, i32* %10
%113 = sitofp i32 %112 to float
%114 = load float, float* %15
%115 = call float @llvm.fmuladd.f32(float %113, float %114, float %111)
%116 = load float, float* %15
%117 = fdiv float %116, 2.000000e+00
%118 = fsub float %115, %117
store float %118, float* %16
store float %118, float* %18
store i32 0, i32* %8
br label %119
119: ; preds = %154, %43
%120 = load i32, i32* %8
%121 = load i32, i32* %10
%122 = icmp slt i32 %120, %121
br i1 %122, label %123, label %157
123: ; preds = %119
%124 = load float, float* %17
store float %124, float* %19
store i32 0, i32* %9
br label %125
125: ; preds = %147, %123
%126 = load i32, i32* %9
%127 = load i32, i32* %11
%128 = icmp slt i32 %126, %127
br i1 %128, label %129, label %150
129: ; preds = %125
%130 = load i32*, i32** %5
%131 = call i32 (i32*, i8*, ...) @fscanf(i32* %130, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %20)
%132 = load float, float* %20
%133 = fpext float %132 to double
%134 = fcmp ogt double %133, 0.000000e+00
br i1 %134, label %135, label %143
135: ; preds = %129
%136 = load float, float* %18
%137 = fpext float %136 to double
%138 = load float, float* %19
%139 = fpext float %138 to double
%140 = load float, float* %20
%141 = fpext float %140 to double
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), double %137, double %139, double %141)
br label %143
143: ; preds = %135, %129
%144 = load float, float* %19
%145 = load float, float* %15
%146 = fadd float %144, %145
store float %146, float* %19
br label %147
147: ; preds = %143
%148 = load i32, i32* %9
%149 = add nsw i32 %148, 1
store i32 %149, i32* %9
br label %125
150: ; preds = %125
%151 = load float, float* %18
%152 = load float, float* %15
%153 = fsub float %151, %152
store float %153, float* %18
br label %154
154: ; preds = %150
%155 = load i32, i32* %8
%156 = add nsw i32 %155, 1
store i32 %156, i32* %8
br label %119
157: ; preds = %119
%158 = load i32*, i32** %5
%159 = call i32 @fclose(i32* %158)
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [31 x i8] c"Cannot open file maskfile %s \0A\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.6 = [10 x i8] c"%-15s %d\0A\00"
@.str.7 = [6 x i8] c"%-15s\00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [6 x i8] c"%.4f\0A\00"
@.str.10 = [16 x i8] c"%.4f %.4f %.4f\0A\00"
@str = [46 x i8] c"\0ANot correct number of commandline arguments \00"
@str.11 = [38 x i8] c"Usage: latlong inputfile > newfile \00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca [400 x i8]
%4 = alloca [40 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%14 = bitcast i32* %5 to i8*
%15 = bitcast i32* %6 to i8*
%16 = bitcast i32* %7 to i8*
%17 = bitcast float* %8 to i8*
%18 = bitcast float* %9 to i8*
%19 = bitcast float* %10 to i8*
%20 = bitcast float* %11 to i8*
%21 = icmp slt i32 %0, 2
%22 = tail call i32 (...) @welcome()
br i1 %21, label %23, label %28
23: ; preds = %2
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.11, i64 0, i64 0))
%26 = load i32, i32* @EXIT_FAILURE
%27 = tail call i32 @exit(i32 %26)
unreachable
28: ; preds = %2
%29 = getelementptr inbounds i8*, i8** %1, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @strcpy(i8* %12, i8* %30)
%32 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%36 = call i32 @exit(i32 0)
unreachable
37: ; preds = %28
%38 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%39 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %6)
%40 = load i32, i32* @stderr
%41 = load i32, i32* %6
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %13, i32 %41)
%43 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%44 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %5)
%45 = load i32, i32* @stderr
%46 = load i32, i32* %5
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %13, i32 %46)
%48 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %13)
%51 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %8)
%52 = load i32, i32* @stderr
%53 = load float, float* %8
%54 = fpext float %53 to double
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %54)
%56 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %13)
%59 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %9)
%60 = load i32, i32* @stderr
%61 = load float, float* %9
%62 = fpext float %61 to double
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %62)
%64 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%65 = load i32, i32* @stderr
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %13)
%67 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %10)
%68 = load i32, i32* @stderr
%69 = load float, float* %10
%70 = fpext float %69 to double
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %70)
%72 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%73 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %7)
%74 = load i32, i32* @stderr
%75 = load i32, i32* %7
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %13, i32 %75)
%77 = load float, float* %8
%78 = load float, float* %10
%79 = fmul float %78, 5.000000e-01
%80 = fadd float %77, %79
%81 = load i32, i32* %5
%82 = icmp sgt i32 %81, 0
br i1 %82, label %83, label %123
83: ; preds = %37
%84 = sitofp i32 %81 to float
%85 = load float, float* %9
%86 = call float @llvm.fmuladd.f32(float %84, float %78, float %85)
%87 = fsub float %86, %79
%88 = load i32, i32* %6
br label %89
89: ; preds = %83, %116
%90 = phi i32 [ %117, %116 ], [ %81, %83 ]
%91 = phi float [ %118, %116 ], [ %78, %83 ]
%92 = phi i32 [ %119, %116 ], [ %88, %83 ]
%93 = phi float [ %120, %116 ], [ %87, %83 ]
%94 = phi i32 [ %121, %116 ], [ 0, %83 ]
%95 = icmp sgt i32 %92, 0
br i1 %95, label %96, label %116
96: ; preds = %89
%97 = fpext float %93 to double
br label %98
98: ; preds = %96, %108
%99 = phi float [ %80, %96 ], [ %110, %108 ]
%100 = phi i32 [ 0, %96 ], [ %111, %108 ]
%101 = call i32 (i32*, i8*, ...) @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %11)
%102 = load float, float* %11
%103 = fcmp ogt float %102, 0.000000e+00
br i1 %103, label %104, label %108
104: ; preds = %98
%105 = fpext float %102 to double
%106 = fpext float %99 to double
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), double %97, double %106, double %105)
br label %108
108: ; preds = %104, %98
%109 = load float, float* %10
%110 = fadd float %99, %109
%111 = add nuw nsw i32 %100, 1
%112 = load i32, i32* %6
%113 = icmp slt i32 %111, %112
br i1 %113, label %98, label %114
114: ; preds = %108
%115 = load i32, i32* %5
br label %116
116: ; preds = %114, %89
%117 = phi i32 [ %115, %114 ], [ %90, %89 ]
%118 = phi float [ %109, %114 ], [ %91, %89 ]
%119 = phi i32 [ %112, %114 ], [ %92, %89 ]
%120 = fsub float %93, %118
%121 = add nuw nsw i32 %94, 1
%122 = icmp slt i32 %121, %117
br i1 %122, label %89, label %123
123: ; preds = %116, %37
%124 = call i32 @fclose(i32* %32)
ret void
}