// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::matmul(char const*, int, int, int, double, double const*, double const*, double, double*)
extern void matmul(const char *tr, int n, int k, int m, double alpha,
                   const double *A, const double *B, double beta, double *C)
{
    double d;
    int i,j,x,f=tr[0]=='N'?(tr[1]=='N'?1:2):(tr[1]=='N'?3:4);
    
    for (i=0;i<n;i++) for (j=0;j<k;j++) {
        d=0.0;
        switch (f) {
            case 1: for (x=0;x<m;x++) d+=A[i+x*n]*B[x+j*m]; break;
            case 2: for (x=0;x<m;x++) d+=A[i+x*n]*B[j+x*k]; break;
            case 3: for (x=0;x<m;x++) d+=A[x+i*m]*B[x+j*m]; break;
            case 4: for (x=0;x<m;x++) d+=A[x+i*m]*B[j+x*k]; break;
        }
        if (beta==0.0) C[i+j*n]=alpha*d; else C[i+j*n]=alpha*d+beta*C[i+j*n];
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movsd %xmm0, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movsd %xmm1, -0x38(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4e, %eax
jne 0x8ca70
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %edx
movl $0x2, %eax
movl $0x1, %ecx
cmpl $0x4e, %edx
cmovel %ecx, %eax
movl %eax, -0x54(%rbp)
jmp 0x8ca8b
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %edx
movl $0x4, %eax
movl $0x3, %ecx
cmpl $0x4e, %edx
cmovel %ecx, %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x8cd00
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x8ccf0
movq $0x0, -0x40(%rbp)
movl -0x50(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x60(%rbp)
subl $0x3, %eax
ja 0x8cc65
movq -0x60(%rbp), %rax
leaq 0x36176(%rip), %rcx     # 0xc2c54
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8cb43
movq -0x28(%rbp), %rax
movl -0x44(%rbp), %ecx
movl -0x4c(%rbp), %edx
imull -0xc(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x48(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x40(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8caee
jmp 0x8cc65
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8cba4
movq -0x28(%rbp), %rax
movl -0x44(%rbp), %ecx
movl -0x4c(%rbp), %edx
imull -0xc(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movl -0x48(%rbp), %ecx
movl -0x4c(%rbp), %edx
imull -0x10(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x40(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8cb4f
jmp 0x8cc65
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8cc05
movq -0x28(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x44(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x48(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x40(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8cbb0
jmp 0x8cc65
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8cc63
movq -0x28(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x44(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movl -0x48(%rbp), %ecx
movl -0x4c(%rbp), %edx
imull -0x10(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x40(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8cc0e
jmp 0x8cc65
movsd -0x38(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x8cc99
jp 0x8cc99
movsd -0x20(%rbp), %xmm0
mulsd -0x40(%rbp), %xmm0
movq 0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %edx
imull -0xc(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x8cce0
movsd -0x20(%rbp), %xmm0
movsd -0x40(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
movq 0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %edx
imull -0xc(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %edx
imull -0xc(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x8cce2
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x8caab
jmp 0x8ccf2
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x8ca98
popq %rbp
retq
nopw %cs:(%rax,%rax)