// File: /workspace/github_c_makefile_star2_O0/stanfordnlp[P]GloVe/src/glove.c
// Function: initialize_parameters
void initialize_parameters(void) {
    // TODO: return an error code when an error occurs, clean up in the calling routine
    if (seed == 0) {
        seed = time(0);
    }
    fprintf(stderr, "Using random seed %d\n", seed);
    srand(seed);
    long long a;
    long long W_size = 2 * vocab_size * (vector_size + 1); // +1 to allocate space for bias

    /* Allocate space for word vectors and context word vectors, and correspodning gradsq */
    a = posix_memalign((void **)&W, 128, W_size * sizeof(real)); // Might perform better than malloc
    if (W == NULL) {
        fprintf(stderr, "Error allocating memory for W\n");
        exit(1);
    }
    a = posix_memalign((void **)&gradsq, 128, W_size * sizeof(real)); // Might perform better than malloc
    if (gradsq == NULL) {
        fprintf(stderr, "Error allocating memory for gradsq\n");
        free(W);
        exit(1);
    }
    if (load_init_param) {
        // Load existing parameters
        fprintf(stderr, "\nLoading initial parameters from %s \n", init_param_file);
        if (load_init_file(init_param_file, W, W_size)) {
            free(W);
            free(gradsq);
            exit(1);
        }
    } else {
        // Initialize new parameters
        for (a = 0; a < W_size; ++a) {
            W[a] = (rand() / (real)RAND_MAX - 0.5) / vector_size;
        }
    }

    if (load_init_gradsq) {
        // Load existing squared gradients
        fprintf(stderr, "\nLoading initial squared gradients from %s \n", init_gradsq_file);
        if (load_init_file(init_gradsq_file, gradsq, W_size)) {
            free(W);
            free(gradsq);
            exit(1);
        }
    } else {
        // Initialize new squared gradients
        for (a = 0; a < W_size; ++a) {
            gradsq[a] = 1.0; // So initial value of eta is equal to initial learning rate
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpl $0x0, 0x6d25(%rip)      # 0x8194
jne 0x1480
xorl %eax, %eax
movl %eax, %edi
callq 0x1160
movl %eax, 0x6d14(%rip)      # 0x8194
movq 0x6b71(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
movl 0x6d04(%rip), %edx      # 0x8194
leaq 0x3be3(%rip), %rsi      # 0x507a
movb $0x0, %al
callq 0x1140
movl 0x6cf0(%rip), %edi      # 0x8194
callq 0x1110
movq 0x6d00(%rip), %rax      # 0x81b0
shlq %rax
movl 0x6c9f(%rip), %ecx      # 0x8158
addl $0x1, %ecx
movslq %ecx, %rcx
imulq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdx
shlq $0x3, %rdx
leaq 0x6ce2(%rip), %rdi      # 0x81b8
movl $0x80, %esi
callq 0x1220
cltq
movq %rax, -0x8(%rbp)
cmpq $0x0, 0x6cca(%rip)      # 0x81b8
jne 0x1512
movq 0x6b01(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x3b8f(%rip), %rsi      # 0x5090
movb $0x0, %al
callq 0x1140
movl $0x1, %edi
callq 0x1200
movq -0x10(%rbp), %rdx
shlq $0x3, %rdx
leaq 0x6c9f(%rip), %rdi      # 0x81c0
movl $0x80, %esi
callq 0x1220
cltq
movq %rax, -0x8(%rbp)
cmpq $0x0, 0x6c87(%rip)      # 0x81c0
jne 0x1569
movq 0x6ab6(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x3b63(%rip), %rsi      # 0x50af
movb $0x0, %al
callq 0x1140
movq 0x6c5e(%rip), %rdi      # 0x81b8
callq 0x1030
movl $0x1, %edi
callq 0x1200
cmpl $0x0, 0x6c34(%rip)      # 0x81a4
je 0x15d1
movq 0x6a7f(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x3b50(%rip), %rsi      # 0x50d3
leaq 0x6c46(%rip), %rdx      # 0x81d0
movb $0x0, %al
callq 0x1140
movq 0x6c20(%rip), %rsi      # 0x81b8
movq -0x10(%rbp), %rdx
leaq 0x6c2d(%rip), %rdi      # 0x81d0
callq 0x1370
cmpl $0x0, %eax
je 0x15cf
movq 0x6c04(%rip), %rdi      # 0x81b8
callq 0x1030
movq 0x6c00(%rip), %rdi      # 0x81c0
callq 0x1030
movl $0x1, %edi
callq 0x1200
jmp 0x1630
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x162e
callq 0x1260
cvtsi2sd %eax, %xmm0
movsd 0x3a1c(%rip), %xmm1     # 0x5010
divsd %xmm1, %xmm0
movsd 0x3a08(%rip), %xmm1     # 0x5008
subsd %xmm1, %xmm0
cvtsi2sdl 0x6b4c(%rip), %xmm1 # 0x8158
divsd %xmm1, %xmm0
movq 0x6ba1(%rip), %rax      # 0x81b8
movq -0x8(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x15d9
jmp 0x1630
cmpl $0x0, 0x6b75(%rip)      # 0x81ac
je 0x1698
movq 0x69b8(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x3aaf(%rip), %rsi      # 0x50f9
leaq 0x6f6f(%rip), %rdx      # 0x85c0
movb $0x0, %al
callq 0x1140
movq 0x6b61(%rip), %rsi      # 0x81c0
movq -0x10(%rbp), %rdx
leaq 0x6f56(%rip), %rdi      # 0x85c0
callq 0x1370
cmpl $0x0, %eax
je 0x1696
movq 0x6b3d(%rip), %rdi      # 0x81b8
callq 0x1030
movq 0x6b39(%rip), %rdi      # 0x81c0
callq 0x1030
movl $0x1, %edi
callq 0x1200
jmp 0x16d2
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x16d0
movq 0x6b0f(%rip), %rax      # 0x81c0
movq -0x8(%rbp), %rcx
movsd 0x395b(%rip), %xmm0     # 0x5018
movsd %xmm0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x16a0
jmp 0x16d2
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)