#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 EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
void getMonths(char *months) {
  int c;
  int i, j;
  i = j = 0;
  FILE *file;
  file = fopen("wordbank.txt", "r");
  while ((c = getc(file)) != EOF) {
    if (c != '\n') {
      months[i * 10 + j] = (char)c;
      ++j;
    } else {
      months[i * 10 + j] = '\0';
      ++i;
      j = 0;
    }
  }
  fclose(file);
}


x86 assembly (clang, -O0):
<getMonths>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeaf(%rip),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e74(%rip),%rcx
cmp    (%rcx),%eax
je     11d1 <getMonths+0xa1>
cmpl   $0xa,-0xc(%rbp)
je     11aa <getMonths+0x7a>
mov    -0xc(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
imul   $0xa,-0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11cc <getMonths+0x9c>
mov    -0x8(%rbp),%rax
imul   $0xa,-0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    1161 <getMonths+0x31>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMonths>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r14
lea    0xebd(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1050 <getc@plt>
mov    0x2e87(%rip),%r15
cmp    (%r15),%eax
jne    1177 <getMonths+0x47>
mov    %r12,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <fclose@plt>
xor    %r13d,%r13d
xor    %ebx,%ebx
jmp    11a2 <getMonths+0x72>
xchg   %ax,%ax
lea    0x0(%r13,%r13,4),%eax
lea    (%rbx,%rax,2),%eax
cltq
movb   $0x0,(%r14,%rax,1)
add    $0x1,%r13d
xor    %ebx,%ebx
mov    %r12,%rdi
call   1050 <getc@plt>
cmp    (%r15),%eax
je     1166 <getMonths+0x36>
cmp    $0xa,%eax
je     1180 <getMonths+0x50>
lea    0x0(%r13,%r13,4),%ecx
lea    (%rbx,%rcx,2),%ecx
movslq %ecx,%rcx
mov    %al,(%r14,%rcx,1)
add    $0x1,%ebx
jmp    1195 <getMonths+0x65>

LLVM IR (-O0):
@.str = [13 x i8] c"wordbank.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
define void @getMonths(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %2
store i32 0, i32* %5
store i32 0, i32* %4
%7 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %6
br label %8
8: ; preds = %38, %1
%9 = load i32*, i32** %6
%10 = call i32 @getc(i32* %9)
store i32 %10, i32* %3
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %39
13: ; preds = %8
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 10
br i1 %15, label %16, label %28
16: ; preds = %13
%17 = load i32, i32* %3
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %2
%20 = load i32, i32* %4
%21 = mul nsw i32 %20, 10
%22 = load i32, i32* %5
%23 = add nsw i32 %21, %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %19, i64 %24
store i8 %18, i8* %25
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %38
28: ; preds = %13
%29 = load i8*, i8** %2
%30 = load i32, i32* %4
%31 = mul nsw i32 %30, 10
%32 = load i32, i32* %5
%33 = add nsw i32 %31, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %29, i64 %34
store i8 0, i8* %35
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
store i32 0, i32* %5
br label %38
38: ; preds = %28, %16
br label %8
39: ; preds = %8
%40 = load i32*, i32** %6
%41 = call i32 @fclose(i32* %40)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"wordbank.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
define void @getMonths(i8* nocapture writeonly %0) {
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @getc(i32* %2)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %30, label %6
6: ; preds = %1, %24
%7 = phi i32 [ %27, %24 ], [ %3, %1 ]
%8 = phi i32 [ %26, %24 ], [ 0, %1 ]
%9 = phi i32 [ %25, %24 ], [ 0, %1 ]
%10 = icmp eq i32 %7, 10
br i1 %10, label %18, label %11
11: ; preds = %6
%12 = trunc i32 %7 to i8
%13 = mul nsw i32 %8, 10
%14 = add nsw i32 %13, %9
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
store i8 %12, i8* %16
%17 = add nsw i32 %9, 1
br label %24
18: ; preds = %6
%19 = mul nsw i32 %8, 10
%20 = add nsw i32 %19, %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %0, i64 %21
store i8 0, i8* %22
%23 = add nsw i32 %8, 1
br label %24
24: ; preds = %18, %11
%25 = phi i32 [ %17, %11 ], [ 0, %18 ]
%26 = phi i32 [ %8, %11 ], [ %23, %18 ]
%27 = tail call i32 @getc(i32* %2)
%28 = load i32, i32* @EOF
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %6
30: ; preds = %24, %1
%31 = tail call i32 @fclose(i32* %2)
ret void
}