#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 time_t;
struct dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
float atof(char *);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int get_time(char *);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ normalize_etf_values(float **);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
char *strtok(char *, char *);
void load_etf_values(float **values, char **etf_names) {
  printf("[START]Loading ETF values...\n");
  DIR *dir;
  struct dirent *ent;
  time_t start = get_time("1993-01-29");
  if ((dir = opendir("c:\\downloaded_data\\USD\\")) != NULL) {
    int etf_index = 0;
    while ((ent = readdir(dir)) != NULL) {
      if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")) {
        continue;
      }
      int etf_name_len = strlen(ent->d_name) - 3;
      char *etf_name = malloc(etf_name_len * sizeof(char));
      memcpy(etf_name, ent->d_name, strlen(ent->d_name) - 4);
      etf_name[strlen(ent->d_name) - 4] = '\0';
      etf_names[etf_index] = malloc(strlen(etf_name) * sizeof(char));
      memcpy(etf_names[etf_index], etf_name, strlen(etf_name) + 1);
      FILE *file;
      int filename_length =
          strlen(ent->d_name) + strlen("c:\\downloaded_data\\USD\\") + 1;
      char *filename = malloc(filename_length * sizeof(char));
      memset(filename, 0, filename_length * sizeof(char));
      strncat(filename, "c:\\downloaded_data\\USD\\",
              strlen("c:\\downloaded_data\\USD\\"));
      strncat(filename, ent->d_name, strlen(ent->d_name));
      file = fopen(filename, "r");
      if (file == NULL)
        exit(EXIT_FAILURE);
      char line[80];
      while (fgets(line, 80, file) != NULL) {
        char *token = strtok(line, ",");
        int count = 0;
        int index = 0;
        while (token) {
          if (count == 0) {
            time_t cur = get_time(token);
            index = (int)((cur - start) / 86400);
            count++;
          } else {
            float val = atof(token);
            values[index][etf_index] = val;
          }
          token = strtok(NULL, " ");
        }
      }
      fclose(file);
      if (filename) {
        free(filename);
      }
      etf_index++;
      free(etf_name);
    }
    closedir(dir);
  } else {
    perror("");
    exit(EXIT_FAILURE);
  }
  printf("[START]Normalizing ETF values...\n");
  normalize_etf_values(values);
  printf("[DONE]Normalizing ETF values...\n");
  printf("[DONE]Loading ETF values...\n");
}


x86 assembly (clang, -O0):
<load_etf_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xda6(%rip),%rdi
call   1080 <printf@plt>
lea    0xdb8(%rip),%rdi
call   10e0 <get_time@plt>
mov    %eax,-0x24(%rbp)
lea    0xdb4(%rip),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     15fd <load_etf_values+0x3bd>
movl   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1110 <readdir@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     15ef <load_etf_values+0x3af>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xd8e(%rip),%rsi
call   10f0 <strcmp@plt>
cmp    $0x0,%eax
je     12de <load_etf_values+0x9e>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xd71(%rip),%rsi
call   10f0 <strcmp@plt>
cmp    $0x0,%eax
jne    12e3 <load_etf_values+0xa3>
jmp    128f <load_etf_values+0x4f>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1070 <strlen@plt>
sub    $0x3,%eax
mov    %eax,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1120 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xf8(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1070 <strlen@plt>
mov    -0x100(%rbp),%rdi
mov    -0xf8(%rbp),%rsi
mov    %eax,%edx
sub    $0x4,%edx
call   1100 <memcpy@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0xf0(%rbp),%rax
sub    $0x4,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x38(%rbp),%rdi
call   1070 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1120 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0xe8(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0xe8(%rbp),%rdi
mov    -0xe0(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1100 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1070 <strlen@plt>
mov    %eax,-0xd4(%rbp)
lea    0xc3d(%rip),%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0xd4(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
movslq -0x44(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1120 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
movslq -0x44(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1090 <memset@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0xd0(%rbp)
lea    0xbee(%rip),%rdi
call   1070 <strlen@plt>
mov    -0xd0(%rbp),%rdi
mov    %eax,%edx
lea    0xbd9(%rip),%rsi
call   10a0 <strncat@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1070 <strlen@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc0(%rbp),%rsi
mov    %eax,%edx
call   10a0 <strncat@plt>
mov    -0x50(%rbp),%rdi
lea    0xbaa(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    14bc <load_etf_values+0x27c>
mov    0x2b2b(%rip),%rax
mov    (%rax),%edi
call   1160 <exit@plt>
jmp    14c1 <load_etf_values+0x281>
lea    -0xa0(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    $0x50,%esi
call   10d0 <fgets@plt>
cmp    $0x0,%rax
je     15bb <load_etf_values+0x37b>
lea    -0xa0(%rbp),%rdi
lea    0xb58(%rip),%rsi
call   1150 <strtok@plt>
mov    %rax,-0xa8(%rbp)
movl   $0x0,-0xac(%rbp)
movl   $0x0,-0xb0(%rbp)
cmpq   $0x0,-0xa8(%rbp)
je     15b6 <load_etf_values+0x376>
cmpl   $0x0,-0xac(%rbp)
jne    1566 <load_etf_values+0x326>
mov    -0xa8(%rbp),%rdi
call   10e0 <get_time@plt>
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
sub    -0x24(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %eax,-0xb0(%rbp)
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    159a <load_etf_values+0x35a>
mov    -0xa8(%rbp),%rdi
call   1040 <atof@plt>
movss  %xmm0,-0xb8(%rbp)
ff
movss  -0xb8(%rbp),%xmm0
ff
mov    -0x8(%rbp),%rax
movslq -0xb0(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
xor    %eax,%eax
mov    %eax,%edi
lea    0xaa3(%rip),%rsi
call   1150 <strtok@plt>
mov    %rax,-0xa8(%rbp)
jmp    150e <load_etf_values+0x2ce>
jmp    14c1 <load_etf_values+0x281>
mov    -0x40(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x50(%rbp)
je     15d8 <load_etf_values+0x398>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
jmp    128f <load_etf_values+0x4f>
mov    -0x18(%rbp),%rdi
call   10c0 <closedir@plt>
jmp    1617 <load_etf_values+0x3d7>
lea    0xaa5(%rip),%rdi
call   1140 <perror@plt>
mov    0x29d0(%rip),%rax
mov    (%rax),%edi
call   1160 <exit@plt>
lea    0xa2c(%rip),%rdi
call   1080 <printf@plt>
mov    -0x8(%rbp),%rdi
call   10b0 <normalize_etf_values@plt>
lea    0xa39(%rip),%rdi
call   1080 <printf@plt>
lea    0xa4e(%rip),%rdi
call   1080 <printf@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_etf_values>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,0x18(%rsp)
mov    %rdi,%rbx
lea    0xdcc(%rip),%rdi
call   1040 <puts@plt>
lea    0xd97(%rip),%rdi
call   10e0 <get_time@plt>
mov    %eax,0xc(%rsp)
lea    0xd92(%rip),%rdi
call   1070 <opendir@plt>
test   %rax,%rax
je     1508 <load_etf_values+0x2c8>
mov    %rax,%r14
mov    %rax,%rdi
call   1110 <readdir@plt>
test   %rax,%rax
je     14c5 <load_etf_values+0x285>
mov    %rax,%r13
xor    %r12d,%r12d
lea    0xd7f(%rip),%r15
jmp    12d4 <load_etf_values+0x94>
add    $0x1,%r12
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1110 <readdir@plt>
mov    %rax,%r13
test   %rax,%rax
je     14c5 <load_etf_values+0x285>
mov    0x0(%r13),%rbp
mov    %rbp,%rdi
lea    0xdbf(%rip),%rsi
call   10f0 <strcmp@plt>
test   %eax,%eax
je     12c0 <load_etf_values+0x80>
mov    %rbp,%rdi
lea    0xdab(%rip),%rsi
call   10f0 <strcmp@plt>
test   %eax,%eax
je     12c0 <load_etf_values+0x80>
mov    %rbp,%rdi
call   1080 <strlen@plt>
lea    -0x3(%rax),%edi
call   1120 <malloc@plt>
mov    %rax,%rbp
mov    0x0(%r13),%rdi
mov    %rdi,(%rsp)
call   1080 <strlen@plt>
lea    -0x4(%rax),%edx
mov    %rbp,%rdi
mov    (%rsp),%rsi
call   1100 <memcpy@plt>
mov    0x0(%r13),%rdi
call   1080 <strlen@plt>
cltq
movb   $0x0,-0x4(%rax,%rbp,1)
mov    %rbp,%rdi
call   1080 <strlen@plt>
mov    %eax,%edi
call   1120 <malloc@plt>
mov    %rax,%rcx
mov    %rax,(%rsp)
mov    0x18(%rsp),%rax
mov    %rcx,(%rax,%r12,8)
mov    %rbp,%rdi
call   1080 <strlen@plt>
lea    0x1(%rax),%edx
mov    (%rsp),%rdi
mov    %rbp,0x10(%rsp)
mov    %rbp,%rsi
call   1100 <memcpy@plt>
mov    0x0(%r13),%rdi
call   1080 <strlen@plt>
mov    %eax,%ebp
lea    0xc81(%rip),%rdi
call   1080 <strlen@plt>
lea    (%rax,%rbp,1),%edi
add    $0x1,%edi
mov    %edi,(%rsp)
call   1120 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
xor    %esi,%esi
mov    (%rsp),%edx
call   1090 <memset@plt>
lea    0xc57(%rip),%rdi
call   1080 <strlen@plt>
mov    %rbp,%rdi
lea    0xc48(%rip),%rsi
mov    %eax,%edx
call   10a0 <strncat@plt>
mov    0x0(%r13),%r13
mov    %r13,%rdi
call   1080 <strlen@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   10a0 <strncat@plt>
mov    %rbp,(%rsp)
mov    %rbp,%rdi
lea    0xc32(%rip),%rsi
call   1130 <fopen@plt>
test   %rax,%rax
je     1514 <load_etf_values+0x2d4>
mov    %rax,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x50,%esi
mov    %r13,%rdx
call   10d0 <fgets@plt>
test   %rax,%rax
je     14a6 <load_etf_values+0x266>
mov    %rbp,%rdi
lea    0xbf1(%rip),%rsi
call   1150 <strtok@plt>
test   %rax,%rax
je     1410 <load_etf_values+0x1d0>
mov    %rax,%rdi
call   10e0 <get_time@plt>
mov    %eax,%ebp
xor    %edi,%edi
mov    %r15,%rsi
call   1150 <strtok@plt>
test   %rax,%rax
je     1410 <load_etf_values+0x1d0>
sub    0xc(%rsp),%ebp
movslq %ebp,%rcx
imul   $0xffffffffc22e4507,%rcx,%rdx
shr    $0x20,%rdx
add    %edx,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x10,%ecx
add    %edx,%ecx
movslq %ecx,%rbp
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1050 <atof@plt>
mov    (%rbx,%rbp,8),%rax
movss  %xmm0,(%rax,%r12,4)
xor    %edi,%edi
mov    %r15,%rsi
call   1150 <strtok@plt>
test   %rax,%rax
jne    1480 <load_etf_values+0x240>
jmp    1410 <load_etf_values+0x1d0>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    (%rsp),%rdi
test   %rdi,%rdi
je     12aa <load_etf_values+0x6a>
call   1030 <free@plt>
jmp    12aa <load_etf_values+0x6a>
mov    %r14,%rdi
call   10c0 <closedir@plt>
lea    0xb72(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   10b0 <normalize_etf_values@plt>
lea    0xb7f(%rip),%rdi
call   1040 <puts@plt>
lea    0xb93(%rip),%rdi
call   1040 <puts@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb19(%rip),%rdi
call   1140 <perror@plt>
mov    0x2ac5(%rip),%rax
mov    (%rax),%edi
call   1160 <exit@plt>

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [30 x i8] c"[START]Loading ETF values...\0A\00"
@.str.1 = [11 x i8] c"1993-01-29\00"
@.str.2 = [24 x i8] c"c:\\downloaded_data\\USD\\\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [3 x i8] c"..\00"
@.str.5 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@.str.6 = [2 x i8] c",\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [34 x i8] c"[START]Normalizing ETF values...\0A\00"
@.str.10 = [33 x i8] c"[DONE]Normalizing ETF values...\0A\00"
@.str.11 = [29 x i8] c"[DONE]Loading ETF values...\0A\00"
define void @load_etf_values(float** %0, i8** %1) {
%3 = alloca float**
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca %struct.dirent*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca [80 x i8]
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca float
store float** %0, float*** %3
store i8** %1, i8*** %4
%20 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @get_time(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 %21, i32* %7
%22 = call i32* @opendir(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
store i32* %22, i32** %5
%23 = icmp ne i32* %22, null
br i1 %23, label %24, label %183
24: ; preds = %2
store i32 0, i32* %8
br label %25
25: ; preds = %175, %41, %24
%26 = load i32*, i32** %5
%27 = call %struct.dirent* @readdir(i32* %26)
store %struct.dirent* %27, %struct.dirent** %6
%28 = icmp ne %struct.dirent* %27, null
br i1 %28, label %29, label %180
29: ; preds = %25
%30 = load %struct.dirent*, %struct.dirent** %6
%31 = getelementptr inbounds %struct.dirent, %struct.dirent* %30, i32 0, i32 0
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %41
35: ; preds = %29
%36 = load %struct.dirent*, %struct.dirent** %6
%37 = getelementptr inbounds %struct.dirent, %struct.dirent* %36, i32 0, i32 0
%38 = load i8*, i8** %37
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %42, label %41
41: ; preds = %35, %29
br label %25
42: ; preds = %35
%43 = load %struct.dirent*, %struct.dirent** %6
%44 = getelementptr inbounds %struct.dirent, %struct.dirent* %43, i32 0, i32 0
%45 = load i8*, i8** %44
%46 = call i32 @strlen(i8* %45)
%47 = sub nsw i32 %46, 3
store i32 %47, i32* %9
%48 = load i32, i32* %9
%49 = sext i32 %48 to i64
%50 = mul i64 %49, 1
%51 = trunc i64 %50 to i32
%52 = call i8* @malloc(i32 %51)
store i8* %52, i8** %10
%53 = load i8*, i8** %10
%54 = load %struct.dirent*, %struct.dirent** %6
%55 = getelementptr inbounds %struct.dirent, %struct.dirent* %54, i32 0, i32 0
%56 = load i8*, i8** %55
%57 = load %struct.dirent*, %struct.dirent** %6
%58 = getelementptr inbounds %struct.dirent, %struct.dirent* %57, i32 0, i32 0
%59 = load i8*, i8** %58
%60 = call i32 @strlen(i8* %59)
%61 = sub nsw i32 %60, 4
%62 = call i32 @memcpy(i8* %53, i8* %56, i32 %61)
%63 = load i8*, i8** %10
%64 = load %struct.dirent*, %struct.dirent** %6
%65 = getelementptr inbounds %struct.dirent, %struct.dirent* %64, i32 0, i32 0
%66 = load i8*, i8** %65
%67 = call i32 @strlen(i8* %66)
%68 = sub nsw i32 %67, 4
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %63, i64 %69
store i8 0, i8* %70
%71 = load i8*, i8** %10
%72 = call i32 @strlen(i8* %71)
%73 = sext i32 %72 to i64
%74 = mul i64 %73, 1
%75 = trunc i64 %74 to i32
%76 = call i8* @malloc(i32 %75)
%77 = load i8**, i8*** %4
%78 = load i32, i32* %8
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
store i8* %76, i8** %80
%81 = load i8**, i8*** %4
%82 = load i32, i32* %8
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8*, i8** %81, i64 %83
%85 = load i8*, i8** %84
%86 = load i8*, i8** %10
%87 = load i8*, i8** %10
%88 = call i32 @strlen(i8* %87)
%89 = add nsw i32 %88, 1
%90 = call i32 @memcpy(i8* %85, i8* %86, i32 %89)
%91 = load %struct.dirent*, %struct.dirent** %6
%92 = getelementptr inbounds %struct.dirent, %struct.dirent* %91, i32 0, i32 0
%93 = load i8*, i8** %92
%94 = call i32 @strlen(i8* %93)
%95 = call i32 @strlen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%96 = add nsw i32 %94, %95
%97 = add nsw i32 %96, 1
store i32 %97, i32* %12
%98 = load i32, i32* %12
%99 = sext i32 %98 to i64
%100 = mul i64 %99, 1
%101 = trunc i64 %100 to i32
%102 = call i8* @malloc(i32 %101)
store i8* %102, i8** %13
%103 = load i8*, i8** %13
%104 = load i32, i32* %12
%105 = sext i32 %104 to i64
%106 = mul i64 %105, 1
%107 = trunc i64 %106 to i32
%108 = call i32 @memset(i8* %103, i32 0, i32 %107)
%109 = load i8*, i8** %13
%110 = call i32 @strlen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%111 = call i32 @strncat(i8* %109, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %110)
%112 = load i8*, i8** %13
%113 = load %struct.dirent*, %struct.dirent** %6
%114 = getelementptr inbounds %struct.dirent, %struct.dirent* %113, i32 0, i32 0
%115 = load i8*, i8** %114
%116 = load %struct.dirent*, %struct.dirent** %6
%117 = getelementptr inbounds %struct.dirent, %struct.dirent* %116, i32 0, i32 0
%118 = load i8*, i8** %117
%119 = call i32 @strlen(i8* %118)
%120 = call i32 @strncat(i8* %112, i8* %115, i32 %119)
%121 = load i8*, i8** %13
%122 = call i32* @fopen(i8* %121, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %122, i32** %11
%123 = load i32*, i32** %11
%124 = icmp eq i32* %123, null
br i1 %124, label %125, label %128
125: ; preds = %42
%126 = load i32, i32* @EXIT_FAILURE
%127 = call i32 @exit(i32 %126)
unreachable
128: ; preds = %42
br label %129
129: ; preds = %166, %128
%130 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%131 = load i32*, i32** %11
%132 = call i32* @fgets(i8* %130, i32 80, i32* %131)
%133 = icmp ne i32* %132, null
br i1 %133, label %134, label %167
134: ; preds = %129
%135 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%136 = call i8* @strtok(i8* %135, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i8* %136, i8** %15
store i32 0, i32* %16
store i32 0, i32* %17
br label %137
137: ; preds = %164, %134
%138 = load i8*, i8** %15
%139 = icmp ne i8* %138, null
br i1 %139, label %140, label %166
140: ; preds = %137
%141 = load i32, i32* %16
%142 = icmp eq i32 %141, 0
br i1 %142, label %143, label %152
143: ; preds = %140
%144 = load i8*, i8** %15
%145 = call i32 @get_time(i8* %144)
store i32 %145, i32* %18
%146 = load i32, i32* %18
%147 = load i32, i32* %7
%148 = sub nsw i32 %146, %147
%149 = sdiv i32 %148, 86400
store i32 %149, i32* %17
%150 = load i32, i32* %16
%151 = add nsw i32 %150, 1
store i32 %151, i32* %16
br label %164
152: ; preds = %140
%153 = load i8*, i8** %15
%154 = call float @atof(i8* %153)
store float %154, float* %19
%155 = load float, float* %19
%156 = load float**, float*** %3
%157 = load i32, i32* %17
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds float*, float** %156, i64 %158
%160 = load float*, float** %159
%161 = load i32, i32* %8
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds float, float* %160, i64 %162
store float %155, float* %163
br label %164
164: ; preds = %152, %143
%165 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i8* %165, i8** %15
br label %137
166: ; preds = %137
br label %129
167: ; preds = %129
%168 = load i32*, i32** %11
%169 = call i32 @fclose(i32* %168)
%170 = load i8*, i8** %13
%171 = icmp ne i8* %170, null
br i1 %171, label %172, label %175
172: ; preds = %167
%173 = load i8*, i8** %13
%174 = call i32 @free(i8* %173)
br label %175
175: ; preds = %172, %167
%176 = load i32, i32* %8
%177 = add nsw i32 %176, 1
store i32 %177, i32* %8
%178 = load i8*, i8** %10
%179 = call i32 @free(i8* %178)
br label %25
180: ; preds = %25
%181 = load i32*, i32** %5
%182 = call i32 @closedir(i32* %181)
br label %187
183: ; preds = %2
%184 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0))
%185 = load i32, i32* @EXIT_FAILURE
%186 = call i32 @exit(i32 %185)
unreachable
187: ; preds = %180
%188 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0))
%189 = load float**, float*** %3
%190 = call i32 @normalize_etf_values(float** %189)
%191 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0))
%192 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str.1 = [11 x i8] c"1993-01-29\00"
@.str.2 = [24 x i8] c"c:\\downloaded_data\\USD\\\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [3 x i8] c"..\00"
@.str.5 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@.str.6 = [2 x i8] c",\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [1 x i8] zeroinitializer
@str = [29 x i8] c"[START]Loading ETF values...\00"
@str.12 = [33 x i8] c"[START]Normalizing ETF values...\00"
@str.13 = [32 x i8] c"[DONE]Normalizing ETF values...\00"
@str.14 = [28 x i8] c"[DONE]Loading ETF values...\00"
define void @load_etf_values(float** %0, i8** nocapture writeonly %1) {
%3 = alloca [80 x i8]
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @get_time(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32* @opendir(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %106, label %8
8: ; preds = %2
%9 = call %struct.dirent* @readdir(i32* %6)
%10 = icmp eq %struct.dirent* %9, null
br i1 %10, label %100, label %11
11: ; preds = %8
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
br label %13
13: ; preds = %11, %95
%14 = phi i64 [ 0, %11 ], [ %96, %95 ]
%15 = phi %struct.dirent* [ %9, %11 ], [ %98, %95 ]
br label %16
16: ; preds = %13, %25
%17 = phi %struct.dirent* [ %15, %13 ], [ %26, %25 ]
%18 = getelementptr inbounds %struct.dirent, %struct.dirent* %17, i64 0, i32 0
%19 = load i8*, i8** %18
%20 = call i32 @strcmp(i8* dereferenceable(1) %19, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %16
%23 = call i32 @strcmp(i8* dereferenceable(1) %19, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22, %16
%26 = call %struct.dirent* @readdir(i32* %6)
%27 = icmp eq %struct.dirent* %26, null
br i1 %27, label %100, label %16
28: ; preds = %22
%29 = getelementptr inbounds %struct.dirent, %struct.dirent* %17, i64 0, i32 0
%30 = call i32 @strlen(i8* %19)
%31 = add nsw i32 %30, -3
%32 = call i8* @malloc(i32 %31)
%33 = load i8*, i8** %29
%34 = call i32 @strlen(i8* %33)
%35 = add nsw i32 %34, -4
%36 = call i32 @memcpy(i8* %32, i8* %33, i32 %35)
%37 = load i8*, i8** %29
%38 = call i32 @strlen(i8* %37)
%39 = add nsw i32 %38, -4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %32, i64 %40
store i8 0, i8* %41
%42 = call i32 @strlen(i8* %32)
%43 = call i8* @malloc(i32 %42)
%44 = getelementptr inbounds i8*, i8** %1, i64 %14
store i8* %43, i8** %44
%45 = call i32 @strlen(i8* %32)
%46 = add nsw i32 %45, 1
%47 = call i32 @memcpy(i8* %43, i8* %32, i32 %46)
%48 = load i8*, i8** %29
%49 = call i32 @strlen(i8* %48)
%50 = call i32 @strlen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%51 = add i32 %49, 1
%52 = add i32 %51, %50
%53 = call i8* @malloc(i32 %52)
%54 = call i32 @memset(i8* %53, i32 0, i32 %52)
%55 = call i32 @strlen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%56 = call i32 @strncat(i8* %53, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %55)
%57 = load i8*, i8** %29
%58 = call i32 @strlen(i8* %57)
%59 = call i32 @strncat(i8* %53, i8* %57, i32 %58)
%60 = call i32* @fopen(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %65
62: ; preds = %28
%63 = load i32, i32* @EXIT_FAILURE
%64 = call i32 @exit(i32 %63)
unreachable
65: ; preds = %28
%66 = call i32* @fgets(i8* %12, i32 80, i32* %60)
%67 = icmp eq i32* %66, null
br i1 %67, label %90, label %71
68: ; preds = %83, %74, %71
%69 = call i32* @fgets(i8* %12, i32 80, i32* %60)
%70 = icmp eq i32* %69, null
br i1 %70, label %90, label %71
71: ; preds = %65, %68
%72 = call i8* @strtok(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%73 = icmp eq i8* %72, null
br i1 %73, label %68, label %74
74: ; preds = %71
%75 = call i32 @get_time(i8* %72)
%76 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%77 = icmp eq i8* %76, null
br i1 %77, label %68, label %78
78: ; preds = %74
%79 = sub nsw i32 %75, %5
%80 = sdiv i32 %79, 86400
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds float*, float** %0, i64 %81
br label %83
83: ; preds = %78, %83
%84 = phi i8* [ %88, %83 ], [ %76, %78 ]
%85 = call float @atof(i8* %84)
%86 = load float*, float** %82
%87 = getelementptr inbounds float, float* %86, i64 %14
store float %85, float* %87
%88 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%89 = icmp eq i8* %88, null
br i1 %89, label %68, label %83
90: ; preds = %68, %65
%91 = call i32 @fclose(i32* %60)
%92 = icmp eq i8* %53, null
br i1 %92, label %95, label %93
93: ; preds = %90
%94 = call i32 @free(i8* %53)
br label %95
95: ; preds = %93, %90
%96 = add nuw i64 %14, 1
%97 = call i32 @free(i8* %32)
%98 = call %struct.dirent* @readdir(i32* %6)
%99 = icmp eq %struct.dirent* %98, null
br i1 %99, label %100, label %13
100: ; preds = %95, %25, %8
%101 = call i32 @closedir(i32* %6)
%102 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0))
%103 = call i32 @normalize_etf_values(float** %0)
%104 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.13, i64 0, i64 0))
%105 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.14, i64 0, i64 0))
ret void
106: ; preds = %2
%107 = tail call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0))
%108 = load i32, i32* @EXIT_FAILURE
%109 = tail call i32 @exit(i32 %108)
unreachable
}