#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 */

/* Variables and functions */
int days_in_month(int, int);
int /*<<< orphan*/ printf(char *, ...);
void make_windseries(float METDATA[4749][4], float CELLWIND[12]) {
  int i, j, k;
  int total_steps = 0;
  printf("make_windseries\n");
  for (i = 1980; i < (1992 + 1); i++) {
    for (j = 0; j < 12; j++) {
      for (k = 0; k < days_in_month(i, j + 1); k++) {
        METDATA[total_steps][3] = CELLWIND[j];
        total_steps++;
      }
    }
  }
  printf("total_steps %d\n", total_steps);
}


x86 assembly (clang, -O0):
<make_windseries>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x7bc,-0x14(%rbp)
cmpl   $0x7c9,-0x14(%rbp)
jge    11f0 <make_windseries+0xd0>
movl   $0x0,-0x18(%rbp)
cmpl   $0xc,-0x18(%rbp)
jge    11dd <make_windseries+0xbd>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
add    $0x1,%esi
call   1040 <days_in_month@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    11ca <make_windseries+0xaa>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movss  %xmm0,0xc(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1171 <make_windseries+0x51>
jmp    11cf <make_windseries+0xaf>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1160 <make_windseries+0x40>
jmp    11e2 <make_windseries+0xc2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114c <make_windseries+0x2c>
mov    -0x20(%rbp),%esi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_windseries>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
add    $0xc,%rbx
mov    %rbx,0x8(%rsp)
mov    $0x7bc,%r13d
xor    %r14d,%r14d
jmp    117d <make_windseries+0x4d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r13d
cmp    $0x7c9,%r13d
je     11ec <make_windseries+0xbc>
xor    %ebp,%ebp
jmp    1196 <make_windseries+0x66>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0xc,%rbp
je     1170 <make_windseries+0x40>
mov    %rbp,%rbx
add    $0x1,%rbp
mov    %r13d,%edi
mov    %ebp,%esi
call   1050 <days_in_month@plt>
test   %eax,%eax
jle    1190 <make_windseries+0x60>
mov    %r14,0x10(%rsp)
movslq %r14d,%r14
shl    $0x4,%r14
add    0x8(%rsp),%r14
xor    %r15d,%r15d
nop
movss  (%r12,%rbx,4),%xmm0
movss  %xmm0,(%r14)
add    $0x1,%r15d
mov    %r13d,%edi
mov    %ebp,%esi
call   1050 <days_in_month@plt>
add    $0x10,%r14
cmp    %eax,%r15d
jl     11c0 <make_windseries+0x90>
mov    0x10(%rsp),%r14
add    %r15d,%r14d
jmp    1190 <make_windseries+0x60>
lea    0xe0d(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"make_windseries\0A\00"
@.str.1 = [16 x i8] c"total_steps %d\0A\00"
define void @make_windseries([4 x float]* %0, float* %1) {
%3 = alloca [4 x float]*
%4 = alloca float*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store [4 x float]* %0, [4 x float]** %3
store float* %1, float** %4
store i32 0, i32* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 1980, i32* %5
br label %10
10: ; preds = %46, %2
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 1993
br i1 %12, label %13, label %49
13: ; preds = %10
store i32 0, i32* %6
br label %14
14: ; preds = %42, %13
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 12
br i1 %16, label %17, label %45
17: ; preds = %14
store i32 0, i32* %7
br label %18
18: ; preds = %38, %17
%19 = load i32, i32* %7
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
%23 = call i32 @days_in_month(i32 %20, i32 %22)
%24 = icmp slt i32 %19, %23
br i1 %24, label %25, label %41
25: ; preds = %18
%26 = load float*, float** %4
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds float, float* %26, i64 %28
%30 = load float, float* %29
%31 = load [4 x float]*, [4 x float]** %3
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [4 x float], [4 x float]* %31, i64 %33
%35 = getelementptr inbounds [4 x float], [4 x float]* %34, i64 0, i64 3
store float %30, float* %35
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %38
38: ; preds = %25
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %18
41: ; preds = %18
br label %42
42: ; preds = %41
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %14
45: ; preds = %14
br label %46
46: ; preds = %45
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %10
49: ; preds = %10
%50 = load i32, i32* %8
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %50)
ret void
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"total_steps %d\0A\00"
@str = [16 x i8] c"make_windseries\00"
define void @make_windseries([4 x float]* nocapture writeonly %0, float* nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %2, %31
%5 = phi i32 [ 0, %2 ], [ %10, %31 ]
%6 = phi i32 [ 1980, %2 ], [ %32, %31 ]
br label %12
7: ; preds = %22
%8 = trunc i64 %27 to i32
br label %9
9: ; preds = %7, %12
%10 = phi i32 [ %14, %12 ], [ %8, %7 ]
%11 = icmp eq i64 %15, 12
br i1 %11, label %31, label %12
12: ; preds = %4, %9
%13 = phi i64 [ 0, %4 ], [ %15, %9 ]
%14 = phi i32 [ %5, %4 ], [ %10, %9 ]
%15 = add nuw nsw i64 %13, 1
%16 = trunc i64 %15 to i32
%17 = tail call i32 @days_in_month(i32 %6, i32 %16)
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %9
19: ; preds = %12
%20 = getelementptr inbounds float, float* %1, i64 %13
%21 = sext i32 %14 to i64
br label %22
22: ; preds = %19, %22
%23 = phi i64 [ %21, %19 ], [ %27, %22 ]
%24 = phi i32 [ 0, %19 ], [ %28, %22 ]
%25 = load float, float* %20
%26 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 %23, i64 3
store float %25, float* %26
%27 = add nsw i64 %23, 1
%28 = add nuw nsw i32 %24, 1
%29 = tail call i32 @days_in_month(i32 %6, i32 %16)
%30 = icmp slt i32 %28, %29
br i1 %30, label %22, label %7
31: ; preds = %9
%32 = add nuw nsw i32 %6, 1
%33 = icmp eq i32 %32, 1993
br i1 %33, label %34, label %4
34: ; preds = %31
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret void
}