#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 atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int nr_timesteps(char *);
int /*<<< orphan*/ one_mnth(int /*<<< orphan*/ *, int, int, float *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
void main(int argc, char **argv) {
  FILE *fpin, *fpout;
  char infile[400], startyear[6], outfile[400];
  int syear, run_years;
  int steps, month;
  float mnth_prcp[600], mnth_tmax[600], mnth_tmin[600];
  float mnth[30];
  int i, j;
  if (argc < 4) {
    printf("Not correct number of commandline arguments \n");
    printf("filter \"inputfile\" \"startyear\" \"outputfile\"  \n");
    exit(EXIT_FAILURE);
  }
  strcpy(infile, argv[1]);
  printf("%s \n", infile);
  strcpy(startyear, argv[2]);
  printf("%s \n", startyear);
  syear = atoi(startyear);
  strcpy(outfile, argv[3]);
  printf("%s \n", outfile);
  steps = nr_timesteps(infile);
  printf("steps = %d\n", steps);
  if ((fpin = fopen(infile, "r")) == NULL) {
    printf("Cannot open file %s \n", infile);
    exit(0);
  }
  if ((fpout = fopen(outfile, "w")) == NULL) {
    printf("Cannot open file %s \n", outfile);
    exit(0);
  }
  run_years = (int)(steps / 365);
  printf("run_years %d\n", run_years);
  fprintf(fpout, "    sump   avgtmax   avgtmin minprcp   mintmax   mintmin   "
                 "maxtprcp   maxtmax   maxtmin SDprcp   SDtmax  SDtmin \n");
  for (j = syear; j < (syear + run_years); j++) {
    for (i = 0; i < 12; i++) {
      one_mnth(fpin, j, i, mnth);
      fprintf(fpout, "%8.2f  %8.2f  %8.2f", mnth[0], mnth[1], mnth[2]);
      fprintf(fpout, "%8.2f  %8.2f  %8.2f", mnth[3], mnth[4], mnth[5]);
      fprintf(fpout, "%8.2f  %8.2f  %8.2f", mnth[6], mnth[7], mnth[8]);
      fprintf(fpout, "%8.2f  %8.2f  %8.2f\n", mnth[9], mnth[10], mnth[11]);
    }
  }
  fclose(fpin);
  fclose(fpout);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2010,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    11d6 <main+0x46>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
lea    -0x1b0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x1b0(%rbp),%rsi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1b6(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x1b6(%rbp),%rsi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1b6(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x354(%rbp)
lea    -0x350(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x350(%rbp),%rsi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1b0(%rbp),%rdi
call   1060 <nr_timesteps@plt>
mov    %eax,-0x35c(%rbp)
mov    -0x35c(%rbp),%esi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    12c6 <main+0x136>
lea    -0x1b0(%rbp),%rsi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
lea    -0x350(%rbp),%rdi
lea    0xdad(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1303 <main+0x173>
lea    -0x350(%rbp),%rsi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x35c(%rbp),%eax
mov    $0x16d,%ecx
cltd
idiv   %ecx
mov    %eax,-0x358(%rbp)
mov    -0x358(%rbp),%esi
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    0xd5b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x354(%rbp),%eax
mov    %eax,-0x2008(%rbp)
mov    -0x2008(%rbp),%eax
mov    -0x354(%rbp),%ecx
add    -0x358(%rbp),%ecx
cmp    %ecx,%eax
jge    149b <main+0x30b>
movl   $0x0,-0x2004(%rbp)
cmpl   $0xc,-0x2004(%rbp)
jge    1482 <main+0x2f2>
mov    -0x18(%rbp),%rdi
mov    -0x2008(%rbp),%esi
mov    -0x2004(%rbp),%edx
lea    -0x2000(%rbp),%rcx
call   10b0 <one_mnth@plt>
mov    -0x20(%rbp),%rdi
movss  -0x2000(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x1ffc(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0x1ff8(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xd3e(%rip),%rsi
mov    $0x3,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
movss  -0x1ff4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x1ff0(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0x1fec(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xd08(%rip),%rsi
mov    $0x3,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
movss  -0x1fe8(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x1fe4(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0x1fe0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xcd2(%rip),%rsi
mov    $0x3,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
movss  -0x1fdc(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x1fd8(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0x1fd4(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xcb0(%rip),%rsi
mov    $0x3,%al
call   1070 <fprintf@plt>
mov    -0x2004(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2004(%rbp)
jmp    136d <main+0x1dd>
jmp    1487 <main+0x2f7>
mov    -0x2008(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2008(%rbp)
jmp    1349 <main+0x1b9>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x2010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3b8,%rsp
cmp    $0x3,%edi
jle    140f <main+0x25f>
mov    %rsi,%rbp
mov    0x8(%rsi),%rsi
lea    0x220(%rsp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xe37(%rip),%r15
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rbp),%rsi
lea    0xa(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   10a0 <atoi@plt>
mov    %eax,%r13d
mov    0x18(%rbp),%rsi
lea    0x90(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
call   1070 <nr_timesteps@plt>
mov    %eax,%ebp
lea    0xdb0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdac(%rip),%rsi
mov    %r14,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1435 <main+0x285>
mov    %rax,%r14
lea    0xda9(%rip),%rsi
lea    0x90(%rsp),%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1446 <main+0x296>
mov    %rax,%rbx
movslq %ebp,%rax
imul   $0xffffffffb38cf9b1,%rax,%rsi
shr    $0x20,%rsi
add    %ebp,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x8,%esi
add    %eax,%esi
lea    0xd71(%rip),%rdi
mov    %rsi,(%rsp)
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd6d(%rip),%rdi
mov    $0x71,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
cmp    $0x16d,%ebp
jl     13ed <main+0x23d>
mov    (%rsp),%rax
add    %r13d,%eax
mov    %rax,(%rsp)
lea    0x10(%rsp),%r15
lea    0xdaa(%rip),%rbp
nopl   0x0(%rax)
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %r15,%rcx
call   10d0 <one_mnth@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x18(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x3,%al
call   1080 <fprintf@plt>
movss  0x1c(%rsp),%xmm0
movss  0x20(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x24(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x3,%al
call   1080 <fprintf@plt>
movss  0x28(%rsp),%xmm0
movss  0x2c(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x30(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x3,%al
call   1080 <fprintf@plt>
movss  0x34(%rsp),%xmm0
movss  0x38(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x3c(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %rbx,%rdi
lea    0xcf0(%rip),%rsi
mov    $0x3,%al
call   1080 <fprintf@plt>
add    $0x1,%r12d
cmp    $0xc,%r12d
jne    1310 <main+0x160>
add    $0x1,%r13d
cmp    (%rsp),%r13d
jl     1300 <main+0x150>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
add    $0x3b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcb9(%rip),%rdi
call   1040 <puts@plt>
lea    0xcda(%rip),%rdi
call   1040 <puts@plt>
mov    0x2bb2(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0xbd2(%rip),%rdi
lea    0x220(%rsp),%rsi
jmp    1455 <main+0x2a5>
lea    0xbc1(%rip),%rdi
lea    0x90(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"Not correct number of commandline arguments \0A\00"
@.str.1 = [47 x i8] c"filter \22inputfile\22 \22startyear\22 \22outputfile\22 \0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [5 x i8] c"%s \0A\00"
@.str.3 = [12 x i8] c"steps = %d\0A\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [22 x i8] c"Cannot open file %s \0A\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [14 x i8] c"run_years %d\0A\00"
@.str.8 = [114 x i8] c" sump avgtmax avgtmin minprcp mintmax mintmin maxtprcp maxtmax maxtmin SDprcp SDtmax SDtmin \0A\00"
@.str.9 = [20 x i8] c"%8.2f %8.2f %8.2f\00"
@.str.10 = [21 x i8] c"%8.2f %8.2f %8.2f\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca [400 x i8]
%8 = alloca [6 x i8]
%9 = alloca [400 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [600 x float]
%15 = alloca [600 x float]
%16 = alloca [600 x float]
%17 = alloca [30 x float]
%18 = alloca i32
%19 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 4
br i1 %21, label %22, label %27
22: ; preds = %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %2
%28 = getelementptr inbounds [400 x i8], [400 x i8]* %7, i64 0, i64 0
%29 = load i8**, i8*** %4
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @strcpy(i8* %28, i8* %31)
%33 = getelementptr inbounds [400 x i8], [400 x i8]* %7, i64 0, i64 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%36 = load i8**, i8*** %4
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @strcpy(i8* %35, i8* %38)
%40 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%43 = call i32 @atoi(i8* %42)
store i32 %43, i32* %10
%44 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%45 = load i8**, i8*** %4
%46 = getelementptr inbounds i8*, i8** %45, i64 3
%47 = load i8*, i8** %46
%48 = call i32 @strcpy(i8* %44, i8* %47)
%49 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %49)
%51 = getelementptr inbounds [400 x i8], [400 x i8]* %7, i64 0, i64 0
%52 = call i32 @nr_timesteps(i8* %51)
store i32 %52, i32* %12
%53 = load i32, i32* %12
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %53)
%55 = getelementptr inbounds [400 x i8], [400 x i8]* %7, i64 0, i64 0
%56 = call i32* @fopen(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %56, i32** %5
%57 = icmp eq i32* %56, null
br i1 %57, label %58, label %62
58: ; preds = %27
%59 = getelementptr inbounds [400 x i8], [400 x i8]* %7, i64 0, i64 0
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %59)
%61 = call i32 @exit(i32 0)
unreachable
62: ; preds = %27
%63 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%64 = call i32* @fopen(i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %64, i32** %6
%65 = icmp eq i32* %64, null
br i1 %65, label %66, label %70
66: ; preds = %62
%67 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %67)
%69 = call i32 @exit(i32 0)
unreachable
70: ; preds = %62
%71 = load i32, i32* %12
%72 = sdiv i32 %71, 365
store i32 %72, i32* %11
%73 = load i32, i32* %11
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %73)
%75 = load i32*, i32** %6
%76 = call i32 (i32*, i8*, ...) @fprintf(i32* %75, i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.8, i64 0, i64 0))
%77 = load i32, i32* %10
store i32 %77, i32* %19
br label %78
78: ; preds = %142, %70
%79 = load i32, i32* %19
%80 = load i32, i32* %10
%81 = load i32, i32* %11
%82 = add nsw i32 %80, %81
%83 = icmp slt i32 %79, %82
br i1 %83, label %84, label %145
84: ; preds = %78
store i32 0, i32* %18
br label %85
85: ; preds = %138, %84
%86 = load i32, i32* %18
%87 = icmp slt i32 %86, 12
br i1 %87, label %88, label %141
88: ; preds = %85
%89 = load i32*, i32** %5
%90 = load i32, i32* %19
%91 = load i32, i32* %18
%92 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 0
%93 = call i32 @one_mnth(i32* %89, i32 %90, i32 %91, float* %92)
%94 = load i32*, i32** %6
%95 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 0
%96 = load float, float* %95
%97 = fpext float %96 to double
%98 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 1
%99 = load float, float* %98
%100 = fpext float %99 to double
%101 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 2
%102 = load float, float* %101
%103 = fpext float %102 to double
%104 = call i32 (i32*, i8*, ...) @fprintf(i32* %94, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), double %97, double %100, double %103)
%105 = load i32*, i32** %6
%106 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 3
%107 = load float, float* %106
%108 = fpext float %107 to double
%109 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 4
%110 = load float, float* %109
%111 = fpext float %110 to double
%112 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 5
%113 = load float, float* %112
%114 = fpext float %113 to double
%115 = call i32 (i32*, i8*, ...) @fprintf(i32* %105, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), double %108, double %111, double %114)
%116 = load i32*, i32** %6
%117 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 6
%118 = load float, float* %117
%119 = fpext float %118 to double
%120 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 7
%121 = load float, float* %120
%122 = fpext float %121 to double
%123 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 8
%124 = load float, float* %123
%125 = fpext float %124 to double
%126 = call i32 (i32*, i8*, ...) @fprintf(i32* %116, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), double %119, double %122, double %125)
%127 = load i32*, i32** %6
%128 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 9
%129 = load float, float* %128
%130 = fpext float %129 to double
%131 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 10
%132 = load float, float* %131
%133 = fpext float %132 to double
%134 = getelementptr inbounds [30 x float], [30 x float]* %17, i64 0, i64 11
%135 = load float, float* %134
%136 = fpext float %135 to double
%137 = call i32 (i32*, i8*, ...) @fprintf(i32* %127, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), double %130, double %133, double %136)
br label %138
138: ; preds = %88
%139 = load i32, i32* %18
%140 = add nsw i32 %139, 1
store i32 %140, i32* %18
br label %85
141: ; preds = %85
br label %142
142: ; preds = %141
%143 = load i32, i32* %19
%144 = add nsw i32 %143, 1
store i32 %144, i32* %19
br label %78
145: ; preds = %78
%146 = load i32*, i32** %5
%147 = call i32 @fclose(i32* %146)
%148 = load i32*, i32** %6
%149 = call i32 @fclose(i32* %148)
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.2 = [5 x i8] c"%s \0A\00"
@.str.3 = [12 x i8] c"steps = %d\0A\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [22 x i8] c"Cannot open file %s \0A\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [14 x i8] c"run_years %d\0A\00"
@.str.8 = [114 x i8] c" sump avgtmax avgtmin minprcp mintmax mintmin maxtprcp maxtmax maxtmin SDprcp SDtmax SDtmin \0A\00"
@.str.9 = [20 x i8] c"%8.2f %8.2f %8.2f\00"
@.str.10 = [21 x i8] c"%8.2f %8.2f %8.2f\0A\00"
@str = [45 x i8] c"Not correct number of commandline arguments \00"
@str.11 = [46 x i8] c"filter \22inputfile\22 \22startyear\22 \22outputfile\22 \00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca [400 x i8]
%4 = alloca [6 x i8]
%5 = alloca [400 x i8]
%6 = alloca [30 x float]
%7 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [400 x i8], [400 x i8]* %5, i64 0, i64 0
%10 = bitcast [30 x float]* %6 to i8*
%11 = icmp slt i32 %0, 4
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.11, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strcpy(i8* %7, i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @strcpy(i8* %8, i8* %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%26 = call i32 @atoi(i8* %8)
%27 = getelementptr inbounds i8*, i8** %1, i64 3
%28 = load i8*, i8** %27
%29 = call i32 @strcpy(i8* %9, i8* %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%31 = call i32 @nr_timesteps(i8* %7)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %38
35: ; preds = %17
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%37 = call i32 @exit(i32 0)
unreachable
38: ; preds = %17
%39 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp eq i32* %39, null
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%43 = call i32 @exit(i32 0)
unreachable
44: ; preds = %38
%45 = sdiv i32 %31, 365
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %45)
%47 = call i64 @fwrite(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.8, i64 0, i64 0), i64 113, i64 1, i32* %39)
%48 = add nsw i32 %45, %26
%49 = icmp sgt i32 %31, 364
br i1 %49, label %50, label %101
50: ; preds = %44
%51 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 0
%52 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 1
%53 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 2
%54 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 3
%55 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 4
%56 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 5
%57 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 6
%58 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 7
%59 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 8
%60 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 9
%61 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 10
%62 = getelementptr inbounds [30 x float], [30 x float]* %6, i64 0, i64 11
br label %63
63: ; preds = %50, %98
%64 = phi i32 [ %26, %50 ], [ %99, %98 ]
br label %65
65: ; preds = %63, %65
%66 = phi i32 [ 0, %63 ], [ %96, %65 ]
%67 = call i32 @one_mnth(i32* %33, i32 %64, i32 %66, float* %51)
%68 = load float, float* %51
%69 = fpext float %68 to double
%70 = load float, float* %52
%71 = fpext float %70 to double
%72 = load float, float* %53
%73 = fpext float %72 to double
%74 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), double %69, double %71, double %73)
%75 = load float, float* %54
%76 = fpext float %75 to double
%77 = load float, float* %55
%78 = fpext float %77 to double
%79 = load float, float* %56
%80 = fpext float %79 to double
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), double %76, double %78, double %80)
%82 = load float, float* %57
%83 = fpext float %82 to double
%84 = load float, float* %58
%85 = fpext float %84 to double
%86 = load float, float* %59
%87 = fpext float %86 to double
%88 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), double %83, double %85, double %87)
%89 = load float, float* %60
%90 = fpext float %89 to double
%91 = load float, float* %61
%92 = fpext float %91 to double
%93 = load float, float* %62
%94 = fpext float %93 to double
%95 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), double %90, double %92, double %94)
%96 = add nuw nsw i32 %66, 1
%97 = icmp eq i32 %96, 12
br i1 %97, label %98, label %65
98: ; preds = %65
%99 = add nsw i32 %64, 1
%100 = icmp slt i32 %99, %48
br i1 %100, label %63, label %101
101: ; preds = %98, %44
%102 = call i32 @fclose(i32* %33)
%103 = call i32 @fclose(i32* %39)
ret void
}