#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__ EOF;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, float *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int main(int argc, char *argv[]) {
  FILE *obsqfile, *outfile1;
  float qcfs, sum;
  int i, j, year, month, startyear, endyear, days_per_period[52];
  int timeincpyr, days;
  char str[200], junk[100];
  if (argc != 5) {
    printf("Wrong command line arguments: enter <split-month file> <start "
           "year> <end year> <periods per year>,\n");
    exit(0);
  }
  obsqfile = fopen(argv[1], "r");
  sscanf(argv[2], "%d", &startyear);
  sscanf(argv[3], "%d", &endyear);
  sscanf(argv[4], "%d", &timeincpyr);
  if (timeincpyr == 14) {
    days_per_period[0] = 31;
    days_per_period[1] = 15;
    days_per_period[2] = 16;
    days_per_period[3] = 30;
    days_per_period[4] = 31;
    days_per_period[5] = 30;
    days_per_period[6] = 31;
    days_per_period[7] = 31;
    days_per_period[8] = 28;
    days_per_period[9] = 31;
    days_per_period[10] = 15;
    days_per_period[11] = 15;
    days_per_period[12] = 31;
    days_per_period[13] = 30;
  }
  if (timeincpyr == 12) {
    days_per_period[0] = 31;
    days_per_period[1] = 30;
    days_per_period[2] = 31;
    days_per_period[3] = 31;
    days_per_period[4] = 28;
    days_per_period[5] = 31;
    days_per_period[6] = 30;
    days_per_period[7] = 31;
    days_per_period[8] = 30;
    days_per_period[9] = 31;
    days_per_period[10] = 31;
    days_per_period[11] = 30;
  }
  sum = 0;
  days = 0;
  for (year = startyear; year <= endyear; year++) {
    if (year % 4 == 0 && year % 400 != 400) {
      if (timeincpyr == 14)
        days_per_period[8] = 29;
      else
        days_per_period[8] = 28;
      if (timeincpyr == 12)
        days_per_period[4] = 29;
      else
        days_per_period[4] = 28;
    }
    for (month = 0; month < timeincpyr; month++) {
      if (fscanf(obsqfile, "%f", &qcfs) == EOF)
        printf("end of file reached prematurely check beginning and ending "
               "dates and number of periods per year are correct\n");
      ;
      sum += qcfs * days_per_period[month];
      days += days_per_period[month];
      if (month == (timeincpyr - 1)) {
        printf("%8.0f\n", sum / days);
        sum = 0;
        days = 0;
      }
    }
  }
  fclose(obsqfile);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     1198 <main+0x38>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xebd(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xea7(%rip),%rsi
lea    -0x3c(%rbp),%rdx
call   1060 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe8f(%rip),%rsi
lea    -0x40(%rbp),%rdx
call   1060 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xe77(%rip),%rsi
lea    -0x114(%rbp),%rdx
call   1060 <sscanf@plt>
cmpl   $0xe,-0x114(%rbp)
jne    1294 <main+0x134>
movl   $0x1f,-0x110(%rbp)
movl   $0xf,-0x10c(%rbp)
movl   $0x10,-0x108(%rbp)
movl   $0x1e,-0x104(%rbp)
movl   $0x1f,-0x100(%rbp)
movl   $0x1e,-0xfc(%rbp)
movl   $0x1f,-0xf8(%rbp)
movl   $0x1f,-0xf4(%rbp)
movl   $0x1c,-0xf0(%rbp)
movl   $0x1f,-0xec(%rbp)
movl   $0xf,-0xe8(%rbp)
movl   $0xf,-0xe4(%rbp)
movl   $0x1f,-0xe0(%rbp)
movl   $0x1e,-0xdc(%rbp)
cmpl   $0xc,-0x114(%rbp)
jne    1319 <main+0x1b9>
movl   $0x1f,-0x110(%rbp)
movl   $0x1e,-0x10c(%rbp)
movl   $0x1f,-0x108(%rbp)
movl   $0x1f,-0x104(%rbp)
movl   $0x1c,-0x100(%rbp)
movl   $0x1f,-0xfc(%rbp)
movl   $0x1e,-0xf8(%rbp)
movl   $0x1f,-0xf4(%rbp)
movl   $0x1e,-0xf0(%rbp)
movl   $0x1f,-0xec(%rbp)
movl   $0x1f,-0xe8(%rbp)
movl   $0x1e,-0xe4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movl   $0x0,-0x118(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x40(%rbp),%eax
jg     14ab <main+0x34b>
mov    -0x34(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    13b9 <main+0x259>
mov    -0x34(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x190,%edx
je     13b9 <main+0x259>
cmpl   $0xe,-0x114(%rbp)
jne    1384 <main+0x224>
movl   $0x1d,-0xf0(%rbp)
jmp    138e <main+0x22e>
movl   $0x1c,-0xf0(%rbp)
cmpl   $0xc,-0x114(%rbp)
jne    13aa <main+0x24a>
movl   $0x1d,-0x100(%rbp)
jmp    13b4 <main+0x254>
movl   $0x1c,-0x100(%rbp)
jmp    13b9 <main+0x259>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x114(%rbp),%eax
jge    1498 <main+0x338>
mov    -0x18(%rbp),%rdi
lea    0xc8f(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1050 <fscanf@plt>
mov    0x2bfe(%rip),%rcx
cmp    (%rcx),%rax
jne    1401 <main+0x2a1>
lea    0xc72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0x24(%rbp),%xmm0
movslq -0x38(%rbp),%rax
cvtsi2ssl -0x110(%rbp,%rax,4),%xmm2
ff ff
movss  -0x28(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movslq -0x38(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%eax
add    -0x118(%rbp),%eax
mov    %eax,-0x118(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x114(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1485 <main+0x325>
movss  -0x28(%rbp),%xmm0
cvtsi2ssl -0x118(%rbp),%xmm1
ff
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc6d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movl   $0x0,-0x118(%rbp)
jmp    148a <main+0x32a>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    13c0 <main+0x260>
jmp    149d <main+0x33d>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1331 <main+0x1d1>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
cmp    $0x5,%edi
jne    138c <main+0x21c>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xea8(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
mov    0x10(%r14),%rdi
lea    0xe97(%rip),%r15
lea    0x10(%rsp),%rdx
mov    %r15,%rsi
call   1070 <sscanf@plt>
mov    0x18(%r14),%rdi
lea    0x8(%rsp),%rdx
mov    %r15,%rsi
call   1070 <sscanf@plt>
mov    0x20(%r14),%rdi
lea    0x4(%rsp),%rdx
mov    %r15,%rsi
call   1070 <sscanf@plt>
mov    0x4(%rsp),%eax
cmp    $0xc,%eax
je     121b <main+0xab>
cmp    $0xe,%eax
jne    1257 <main+0xe7>
movaps 0xe31(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe05(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe29(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movl   $0x1f,0x50(%rsp)
mov    $0xd,%ecx
jmp    124f <main+0xdf>
movaps 0xdde(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xde2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movabs $0x1f0000001e,%rcx
mov    %rcx,0x40(%rsp)
movl   $0x1f,0x48(%rsp)
mov    $0xb,%ecx
movl   $0x1e,0x20(%rsp,%rcx,4)
mov    0x10(%rsp),%esi
mov    0x8(%rsp),%ecx
cmp    %ecx,%esi
jle    127f <main+0x10f>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r13d,%r13d
xorps  %xmm1,%xmm1
lea    0xdb9(%rip),%r14
lea    0x14(%rsp),%r15
mov    0x2d50(%rip),%r12
jmp    12b2 <main+0x142>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%ecx
mov    0x18(%rsp),%rsi
lea    0x1(%rsi),%edx
cmp    %ecx,%esi
mov    %edx,%esi
jge    1263 <main+0xf3>
test   $0x3,%sil
jne    12e8 <main+0x178>
cmp    $0xe,%eax
jne    12c7 <main+0x157>
movl   $0x1d,0x40(%rsp)
jmp    12e0 <main+0x170>
movl   $0x1c,0x40(%rsp)
cmp    $0xc,%eax
jne    12e0 <main+0x170>
movl   $0x1d,0x30(%rsp)
jmp    12ec <main+0x17c>
xchg   %ax,%ax
movl   $0x1c,0x30(%rsp)
test   %eax,%eax
jle    12a9 <main+0x139>
mov    %rsi,0x18(%rsp)
xor    %ebp,%ebp
jmp    130c <main+0x19c>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbp
movslq %eax,%rcx
cmp    %rcx,%rbp
jge    12a0 <main+0x130>
movss  %xmm1,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1060 <fscanf@plt>
cmp    (%r12),%rax
jne    1332 <main+0x1c2>
lea    0xd22(%rip),%rdi
call   1030 <puts@plt>
mov    0x20(%rsp,%rbp,4),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x14(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
add    %eax,%r13d
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    %rcx,%rbp
jne    1300 <main+0x190>
xorps  %xmm0,%xmm0
cvtsi2ss %r13d,%xmm0
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xcd2(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xorps  %xmm1,%xmm1
xor    %r13d,%r13d
mov    0x4(%rsp),%eax
jmp    1300 <main+0x190>
lea    0xd28(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [100 x i8] c"Wrong command line arguments: enter <split-month file> <start year> <end year> <periods per year>,\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%f\00"
@EOF = global i64 0
@.str.4 = [109 x i8] c"end of file reached prematurely check beginning and ending dates and number of periods per year are correct\0A\00"
@.str.5 = [7 x i8] c"%8.0f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [52 x i32]
%17 = alloca i32
%18 = alloca i32
%19 = alloca [200 x i8]
%20 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 5
br i1 %22, label %23, label %26
23: ; preds = %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %30, i32** %6
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call i32 @sscanf(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %14)
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
%38 = call i32 @sscanf(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %15)
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 4
%41 = load i8*, i8** %40
%42 = call i32 @sscanf(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %17)
%43 = load i32, i32* %17
%44 = icmp eq i32 %43, 14
br i1 %44, label %45, label %60
45: ; preds = %26
%46 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 0
store i32 31, i32* %46
%47 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 1
store i32 15, i32* %47
%48 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 2
store i32 16, i32* %48
%49 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 3
store i32 30, i32* %49
%50 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 4
store i32 31, i32* %50
%51 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 5
store i32 30, i32* %51
%52 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 6
store i32 31, i32* %52
%53 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 7
store i32 31, i32* %53
%54 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 8
store i32 28, i32* %54
%55 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 9
store i32 31, i32* %55
%56 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 10
store i32 15, i32* %56
%57 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 11
store i32 15, i32* %57
%58 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 12
store i32 31, i32* %58
%59 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 13
store i32 30, i32* %59
br label %60
60: ; preds = %45, %26
%61 = load i32, i32* %17
%62 = icmp eq i32 %61, 12
br i1 %62, label %63, label %76
63: ; preds = %60
%64 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 0
store i32 31, i32* %64
%65 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 1
store i32 30, i32* %65
%66 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 2
store i32 31, i32* %66
%67 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 3
store i32 31, i32* %67
%68 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 4
store i32 28, i32* %68
%69 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 5
store i32 31, i32* %69
%70 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 6
store i32 30, i32* %70
%71 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 7
store i32 31, i32* %71
%72 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 8
store i32 30, i32* %72
%73 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 9
store i32 31, i32* %73
%74 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 10
store i32 31, i32* %74
%75 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 11
store i32 30, i32* %75
br label %76
76: ; preds = %63, %60
store float 0.000000e+00, float* %9
store i32 0, i32* %18
%77 = load i32, i32* %14
store i32 %77, i32* %12
br label %78
78: ; preds = %148, %76
%79 = load i32, i32* %12
%80 = load i32, i32* %15
%81 = icmp sle i32 %79, %80
br i1 %81, label %82, label %151
82: ; preds = %78
%83 = load i32, i32* %12
%84 = srem i32 %83, 4
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %105
86: ; preds = %82
%87 = load i32, i32* %12
%88 = srem i32 %87, 400
%89 = icmp ne i32 %88, 400
br i1 %89, label %90, label %105
90: ; preds = %86
%91 = load i32, i32* %17
%92 = icmp eq i32 %91, 14
br i1 %92, label %93, label %95
93: ; preds = %90
%94 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 8
store i32 29, i32* %94
br label %97
95: ; preds = %90
%96 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 8
store i32 28, i32* %96
br label %97
97: ; preds = %95, %93
%98 = load i32, i32* %17
%99 = icmp eq i32 %98, 12
br i1 %99, label %100, label %102
100: ; preds = %97
%101 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 4
store i32 29, i32* %101
br label %104
102: ; preds = %97
%103 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 4
store i32 28, i32* %103
br label %104
104: ; preds = %102, %100
br label %105
105: ; preds = %104, %86, %82
store i32 0, i32* %13
br label %106
106: ; preds = %144, %105
%107 = load i32, i32* %13
%108 = load i32, i32* %17
%109 = icmp slt i32 %107, %108
br i1 %109, label %110, label %147
110: ; preds = %106
%111 = load i32*, i32** %6
%112 = call i64 @fscanf(i32* %111, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %8)
%113 = load i64, i64* @EOF
%114 = icmp eq i64 %112, %113
br i1 %114, label %115, label %117
115: ; preds = %110
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str.4, i64 0, i64 0))
br label %117
117: ; preds = %115, %110
%118 = load float, float* %8
%119 = load i32, i32* %13
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 %120
%122 = load i32, i32* %121
%123 = sitofp i32 %122 to float
%124 = load float, float* %9
%125 = call float @llvm.fmuladd.f32(float %118, float %123, float %124)
store float %125, float* %9
%126 = load i32, i32* %13
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [52 x i32], [52 x i32]* %16, i64 0, i64 %127
%129 = load i32, i32* %128
%130 = load i32, i32* %18
%131 = add nsw i32 %130, %129
store i32 %131, i32* %18
%132 = load i32, i32* %13
%133 = load i32, i32* %17
%134 = sub nsw i32 %133, 1
%135 = icmp eq i32 %132, %134
br i1 %135, label %136, label %143
136: ; preds = %117
%137 = load float, float* %9
%138 = load i32, i32* %18
%139 = sitofp i32 %138 to float
%140 = fdiv float %137, %139
%141 = fpext float %140 to double
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %141)
store float 0.000000e+00, float* %9
store i32 0, i32* %18
br label %143
143: ; preds = %136, %117
br label %144
144: ; preds = %143
%145 = load i32, i32* %13
%146 = add nsw i32 %145, 1
store i32 %146, i32* %13
br label %106
147: ; preds = %106
br label %148
148: ; preds = %147
%149 = load i32, i32* %12
%150 = add nsw i32 %149, 1
store i32 %150, i32* %12
br label %78
151: ; preds = %78
%152 = load i32*, i32** %6
%153 = call i32 @fclose(i32* %152)
%154 = load i32, i32* %3
ret i32 %154
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%f\00"
@EOF = global i64 0
@.str.5 = [7 x i8] c"%8.0f\0A\00"
@str = [108 x i8] c"end of file reached prematurely check beginning and ending dates and number of periods per year are correct\00"
@str.6 = [99 x i8] c"Wrong command line arguments: enter <split-month file> <start year> <end year> <periods per year>,\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca [52 x i32]
%7 = alloca i32
%8 = bitcast float* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast [52 x i32]* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = icmp eq i32 %0, 5
br i1 %13, label %17, label %14
14: ; preds = %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @str.6, i64 0, i64 0))
%16 = tail call i32 @exit(i32 0)
unreachable
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = tail call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @sscanf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%24 = getelementptr inbounds i8*, i8** %1, i64 3
%25 = load i8*, i8** %24
%26 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%27 = getelementptr inbounds i8*, i8** %1, i64 4
%28 = load i8*, i8** %27
%29 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%30 = load i32, i32* %7
switch i32 %30, label %48 [
i32 14, label %31
i32 12, label %38
]
31: ; preds = %17
%32 = bitcast [52 x i32]* %6 to <4 x i32>*
store <4 x i32> <i32 31, i32 15, i32 16, i32 30>, <4 x i32>* %32
%33 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 4
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> <i32 31, i32 30, i32 31, i32 31>, <4 x i32>* %34
%35 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 8
%36 = bitcast i32* %35 to <4 x i32>*
store <4 x i32> <i32 28, i32 31, i32 15, i32 15>, <4 x i32>* %36
%37 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 12
store i32 31, i32* %37
br label %45
38: ; preds = %17
%39 = bitcast [52 x i32]* %6 to <4 x i32>*
store <4 x i32> <i32 31, i32 30, i32 31, i32 31>, <4 x i32>* %39
%40 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 4
%41 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> <i32 28, i32 31, i32 30, i32 31>, <4 x i32>* %41
%42 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 8
store i32 30, i32* %42
%43 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 9
store i32 31, i32* %43
%44 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 10
store i32 31, i32* %44
br label %45
45: ; preds = %38, %31
%46 = phi i64 [ 13, %31 ], [ 11, %38 ]
%47 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 %46
store i32 30, i32* %47
br label %48
48: ; preds = %45, %17
%49 = load i32, i32* %4
%50 = load i32, i32* %5
%51 = icmp sgt i32 %49, %50
br i1 %51, label %115, label %52
52: ; preds = %48
%53 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 8
%54 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 4
br label %55
55: ; preds = %52, %108
%56 = phi i32 [ %50, %52 ], [ %109, %108 ]
%57 = phi i32 [ %30, %52 ], [ %110, %108 ]
%58 = phi float [ 0.000000e+00, %52 ], [ %112, %108 ]
%59 = phi i32 [ %49, %52 ], [ %113, %108 ]
%60 = phi i32 [ 0, %52 ], [ %111, %108 ]
%61 = and i32 %59, 3
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %70
63: ; preds = %55
%64 = icmp eq i32 %57, 14
br i1 %64, label %65, label %66
65: ; preds = %63
store i32 29, i32* %53
br label %69
66: ; preds = %63
store i32 28, i32* %53
%67 = icmp eq i32 %57, 12
br i1 %67, label %68, label %69
68: ; preds = %66
store i32 29, i32* %54
br label %72
69: ; preds = %65, %66
store i32 28, i32* %54
br label %70
70: ; preds = %69, %55
%71 = icmp sgt i32 %57, 0
br i1 %71, label %72, label %108
72: ; preds = %68, %70
br label %73
73: ; preds = %72, %99
%74 = phi i64 [ %103, %99 ], [ 0, %72 ]
%75 = phi float [ %102, %99 ], [ %58, %72 ]
%76 = phi i32 [ %101, %99 ], [ %60, %72 ]
%77 = call i64 @fscanf(i32* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%78 = load i64, i64* @EOF
%79 = icmp eq i64 %77, %78
br i1 %79, label %80, label %82
80: ; preds = %73
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([108 x i8], [108 x i8]* @str, i64 0, i64 0))
br label %82
82: ; preds = %80, %73
%83 = load float, float* %3
%84 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 %74
%85 = load i32, i32* %84
%86 = sitofp i32 %85 to float
%87 = call float @llvm.fmuladd.f32(float %83, float %86, float %75)
%88 = add nsw i32 %85, %76
%89 = load i32, i32* %7
%90 = add nsw i32 %89, -1
%91 = zext i32 %90 to i64
%92 = icmp eq i64 %74, %91
br i1 %92, label %93, label %99
93: ; preds = %82
%94 = sitofp i32 %88 to float
%95 = fdiv float %87, %94
%96 = fpext float %95 to double
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %96)
%98 = load i32, i32* %7
br label %99
99: ; preds = %82, %93
%100 = phi i32 [ %98, %93 ], [ %89, %82 ]
%101 = phi i32 [ 0, %93 ], [ %88, %82 ]
%102 = phi float [ 0.000000e+00, %93 ], [ %87, %82 ]
%103 = add nuw nsw i64 %74, 1
%104 = sext i32 %100 to i64
%105 = icmp slt i64 %103, %104
br i1 %105, label %73, label %106
106: ; preds = %99
%107 = load i32, i32* %5
br label %108
108: ; preds = %106, %70
%109 = phi i32 [ %56, %70 ], [ %107, %106 ]
%110 = phi i32 [ %57, %70 ], [ %100, %106 ]
%111 = phi i32 [ %60, %70 ], [ %101, %106 ]
%112 = phi float [ %58, %70 ], [ %102, %106 ]
%113 = add nsw i32 %59, 1
%114 = icmp slt i32 %59, %109
br i1 %114, label %55, label %115
115: ; preds = %108, %48
%116 = call i32 @fclose(i32* %20)
ret i32 0
}