// File: /workspace/github_c_makefile_star2_O0/debbiemarkslab[P]plmc/src/plm.c
// Function: OutputParametersSite
void OutputParametersSite(char *outputFile, const numeric_t *x,
    alignment_t *ali) {
    FILE *fpOutput = NULL;
    fpOutput = fopen(outputFile, "w");
    if (fpOutput != NULL) {
        /* 1: nSites */
        fwrite(&(ali->nSites), sizeof(ali->nSites), 1, fpOutput);

        /* 2: (Focus mode only) target sequence */
        if (ali->target >= 0) {
            for (int i = 0; i < ali->nSites; i++) {
                char c = (char) ali->alphabet[seq(ali->target, i)];
                fwrite(&c, sizeof(char), 1, fpOutput);
            }
        } else {
            char c = ali->alphabet[0];
            for (int i = 0; i < ali->nSites; i++)
                fwrite(&c, sizeof(c), 1, fpOutput);
        }

        /* 3: (Focus mode only) offset map */
        if (ali->target >= 0) {
            for (int i = 0; i < ali->nSites; i++) {
                int ix = ali->offsets[i];
                fwrite(&ix, sizeof(ix), 1, fpOutput);
            }
        } else {
            for (int i = 0; i < ali->nSites; i++) {
                int ix = i + 1;
                fwrite(&ix, sizeof(ix), 1, fpOutput);
            }
        }

        /* 4,5: sitewise marginals fi, twice */
        for (int x = 0; x < 2; x++)
            for (int i = 0; i < ali->nSites; i++)
                for (int ai = 0; ai < ali->nCodes; ai++) {
                    OUTPUT_PRECISION f = (OUTPUT_PRECISION) fi(i, ai);
                    fwrite(&f, sizeof(f), 1, fpOutput);
                }

        /* 6: sitewise parameters hi */
        for (int i = 0; i < ali->nSites; i++)
            for (int ai = 0; ai < ali->nCodes; ai++) {
                OUTPUT_PRECISION h = (OUTPUT_PRECISION) xHi(i, ai);
                fwrite(&h, sizeof(h), 1, fpOutput);
            }

        fclose(fpOutput);
    } else {
        fprintf(stderr, "Error writing parameters\n");
        exit(1);
    }
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x50(%rsp), %rdi
leaq 0x103cb(%rip), %rsi     # 0x1a1a3
callq 0x1190
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0xa0c6
movq 0x40(%rsp), %rdi
addq $0x4, %rdi
movq 0x38(%rsp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x11d0
movq 0x40(%rsp), %rax
cmpl $0x0, 0x38(%rax)
jl 0x9e89
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x9e87
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x40(%rsp), %rcx
movq 0x20(%rcx), %rcx
movl 0x34(%rsp), %edx
movq 0x40(%rsp), %rsi
movl 0x38(%rsi), %esi
movq 0x40(%rsp), %rdi
imull 0x4(%rdi), %esi
addl %esi, %edx
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
movb (%rax,%rcx), %al
movb %al, 0x33(%rsp)
movq 0x38(%rsp), %rcx
leaq 0x33(%rsp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x11d0
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x9e1e
jmp 0x9ed4
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movb (%rax), %al
movb %al, 0x32(%rsp)
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x9ed2
movq 0x38(%rsp), %rcx
leaq 0x32(%rsp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x11d0
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x9ea0
jmp 0x9ed4
movq 0x40(%rsp), %rax
cmpl $0x0, 0x38(%rax)
jl 0x9f32
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x9f30
movq 0x40(%rsp), %rax
movq 0x40(%rax), %rax
movslq 0x28(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x24(%rsp)
movq 0x38(%rsp), %rcx
leaq 0x24(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x11d0
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x9ee7
jmp 0x9f7b
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x9f79
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movq 0x38(%rsp), %rcx
leaq 0x1c(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x11d0
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x9f3a
jmp 0x9f7b
movl $0x0, 0x18(%rsp)
cmpl $0x2, 0x18(%rsp)
jge 0xa032
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jge 0xa020
movl $0x0, 0x10(%rsp)
movl 0x10(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xa00e
movq 0x40(%rsp), %rax
movq 0x58(%rax), %rax
movl 0x14(%rsp), %ecx
movq 0x40(%rsp), %rdx
movl 0x4(%rdx), %edx
imull 0x10(%rsp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
movq 0x38(%rsp), %rcx
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x11d0
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x9fac
jmp 0xa010
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x9f96
jmp 0xa022
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x9f83
movl $0x0, 0x8(%rsp)
movl 0x8(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jge 0xa0ba
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xa0ab
movq 0x48(%rsp), %rax
movl 0x8(%rsp), %ecx
movq 0x40(%rsp), %rdx
movl 0x4(%rdx), %edx
imull 0x4(%rsp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rsp)
movq 0x38(%rsp), %rcx
movq %rsp, %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x11d0
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0xa050
jmp 0xa0ad
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0xa03a
movq 0x38(%rsp), %rdi
callq 0x10a0
jmp 0xa0e8
movq 0x11f2b(%rip), %rax     # 0x1bff8
movq (%rax), %rdi
leaq 0xf25d(%rip), %rsi      # 0x19334
movb $0x0, %al
callq 0x1140
movl $0x1, %edi
callq 0x11c0
addq $0x58, %rsp
retq
nopl (%rax)