#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(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, float *);
int /*<<< orphan*/ printf(char *, char *);
void read_wind(char windfile[200], float WIND[65][15]) {
  FILE *fp;
  int i, j;
  if ((fp = fopen(windfile, "r")) == NULL) {
    printf("Cannot open file %s \n", windfile);
    exit(0);
  }
  for (i = 0; i < 65; i++)
    for (j = 0; j < 14; j++)
      fscanf(fp, "%f", &WIND[i][j]);
  fclose(fp);
}


x86 assembly (clang, -O0):
<read_wind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1195 <read_wind+0x45>
mov    -0x8(%rbp),%rsi
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x41,-0x1c(%rbp)
jge    1202 <read_wind+0xb2>
movl   $0x0,-0x20(%rbp)
cmpl   $0xe,-0x20(%rbp)
jge    11ef <read_wind+0x9f>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
movslq -0x1c(%rbp),%rax
imul   $0x3c,%rax,%rax
add    %rax,%rdx
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe3c(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ad <read_wind+0x5d>
jmp    11f4 <read_wind+0xa4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119c <read_wind+0x4c>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_wind>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe9b(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     12aa <read_wind+0x15a>
mov    %rax,%r12
xor    %ebx,%ebx
lea    0xe99(%rip),%r15
nop
lea    (%r14,%rbx,1),%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x4,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x8,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0xc,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x10,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x14,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x18,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x1c,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x20,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x24,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x28,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x2c,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x30,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
lea    (%r14,%rbx,1),%rdx
add    $0x34,%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
add    $0x3c,%rbx
cmp    $0xf3c,%rbx
jne    1180 <read_wind+0x30>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <fclose@plt>
lea    0xd51(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"Cannot open file %s \0A\00"
@.str.2 = [3 x i8] c"%f\00"
define void @read_wind(i8* %0, [15 x float]* %1) {
%3 = alloca i8*
%4 = alloca [15 x float]*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store [15 x float]* %1, [15 x float]** %4
%8 = load i8*, i8** %3
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %2
store i32 0, i32* %6
br label %16
16: ; preds = %37, %15
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, 65
br i1 %18, label %19, label %40
19: ; preds = %16
store i32 0, i32* %7
br label %20
20: ; preds = %33, %19
%21 = load i32, i32* %7
%22 = icmp slt i32 %21, 14
br i1 %22, label %23, label %36
23: ; preds = %20
%24 = load i32*, i32** %5
%25 = load [15 x float]*, [15 x float]** %4
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [15 x float], [15 x float]* %25, i64 %27
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [15 x float], [15 x float]* %28, i64 0, i64 %30
%32 = call i32 @fscanf(i32* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %31)
br label %33
33: ; preds = %23
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %20
36: ; preds = %20
br label %37
37: ; preds = %36
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %16
40: ; preds = %16
%41 = load i32*, i32** %5
%42 = call i32 @fclose(i32* %41)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"Cannot open file %s \0A\00"
@.str.2 = [3 x i8] c"%f\00"
define void @read_wind(i8* %0, [15 x float]* %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2, %8
%9 = phi i64 [ %38, %8 ], [ 0, %2 ]
%10 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 0
%11 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %10)
%12 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 1
%13 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %12)
%14 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 2
%15 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %14)
%16 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 3
%17 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %16)
%18 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 4
%19 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %18)
%20 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 5
%21 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %20)
%22 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 6
%23 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %22)
%24 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 7
%25 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %24)
%26 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 8
%27 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %26)
%28 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 9
%29 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %28)
%30 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 10
%31 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %30)
%32 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 11
%33 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %32)
%34 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 12
%35 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %34)
%36 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 %9, i64 13
%37 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %36)
%38 = add nuw nsw i64 %9, 1
%39 = icmp eq i64 %38, 65
br i1 %39, label %40, label %8
40: ; preds = %8
%41 = tail call i32 @fclose(i32* %3)
ret void
}