// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, -0x40(%rbp)
xorl %r14d, %r14d
cmpb $0x4e, (%rdi)
setne %r14b
xorl %eax, %eax
cmpb $0x4e, 0x1(%rdi)
sete %al
addl %r14d, %r14d
subl %eax, %r14d
addl $0x2, %r14d
movslq %edx, %rdx
xorl %edi, %edi
testl %ecx, %ecx
movl $0x0, %ebx
cmovgl %ecx, %ebx
movslq %esi, %rsi
testl %edx, %edx
movl $0x0, %eax
cmovgl %edx, %eax
testl %esi, %esi
movl $0x0, %r9d
cmovgl %esi, %r9d
movq %r9, -0x48(%rbp)
movslq %ecx, %r12
movq %rax, %rcx
shlq $0x3, %r12
shlq $0x3, %rdx
leaq (,%rsi,8), %r15
decl %r14d
xorpd %xmm2, %xmm2
movq %r8, -0x30(%rbp)
movq %r8, %r13
cmpq -0x48(%rbp), %rdi
je 0x460f5
movq 0x10(%rbp), %rax
movq %rdi, -0x50(%rbp)
leaq (%rax,%rdi,8), %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rax
movq %rax, %r9
xorl %r10d, %r10d
leaq 0x208e2(%rip), %rdi     # 0x668a4
cmpq %rcx, %r10
je 0x460e1
movslq (%rdi,%r14,4), %r8
addq %rdi, %r8
jmpq *%r8
xorpd %xmm3, %xmm3
movq -0x30(%rbp), %r8
xorl %r11d, %r11d
cmpq %r11, %rbx
je 0x46096
movsd (%r8), %xmm4
mulsd (%r9,%r11,8), %xmm4
addsd %xmm4, %xmm3
incq %r11
addq %r15, %r8
jmp 0x45fe0
xorpd %xmm3, %xmm3
xorl %r8d, %r8d
cmpq %r8, %rbx
je 0x46096
movsd (%r13,%r8,8), %xmm4
mulsd (%r9,%r8,8), %xmm4
addsd %xmm4, %xmm3
incq %r8
jmp 0x46007
xorpd %xmm3, %xmm3
movq %rax, %r8
xorl %r11d, %r11d
cmpq %r11, %rbx
je 0x46096
movsd (%r13,%r11,8), %xmm4
mulsd (%r8), %xmm4
addsd %xmm4, %xmm3
incq %r11
addq %rdx, %r8
jmp 0x46030
movq %r12, %rdi
movq %rcx, %r12
movq %rsi, %rcx
movq %r14, %rsi
xorpd %xmm3, %xmm3
movq %rax, %r14
movq -0x30(%rbp), %r8
movq %rbx, %r11
subq $0x1, %r11
jb 0x46083
movsd (%r8), %xmm4
mulsd (%r14), %xmm4
addsd %xmm4, %xmm3
addq %r15, %r8
addq %rdx, %r14
jmp 0x46067
movq %rsi, %r14
movq %rcx, %rsi
movq %r12, %rcx
movq %rdi, %r12
leaq 0x2080e(%rip), %rdi     # 0x668a4
ucomisd %xmm2, %xmm1
jne 0x460af
jp 0x460af
mulsd %xmm0, %xmm3
movq %r10, %r8
imulq %rsi, %r8
movq -0x38(%rbp), %r11
jmp 0x460cc
movq %r10, %r8
imulq %rsi, %r8
movq -0x38(%rbp), %r11
movsd (%r11,%r8,8), %xmm4
mulsd %xmm1, %xmm4
mulsd %xmm0, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%r11,%r8,8)
incq %r10
addq $0x8, %rax
addq %r12, %r9
jmp 0x45fc2
movq -0x50(%rbp), %rdi
incq %rdi
addq %r12, %r13
addq $0x8, -0x30(%rbp)
jmp 0x45f97
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq