// File: /workspace/github_cpp_makefile_star2_O1/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, -0x58(%rbp)
movq %r8, -0x50(%rbp)
movl %ecx, -0x2c(%rbp)
movl %edx, -0x30(%rbp)
cmpb $0x4e, (%rdi)
setne %cl
xorl %eax, %eax
cmpb $0x4e, 0x1(%rdi)
sete %dl
testl %esi, %esi
jle 0x4eb07
movb %dl, %al
xorl %r14d, %r14d
movb %cl, %r14b
addl %r14d, %r14d
subl %eax, %r14d
addl $0x2, %r14d
movl -0x30(%rbp), %ecx
movl %esi, %esi
movl -0x2c(%rbp), %eax
movq %rcx, -0x68(%rbp)
leaq (,%rcx,8), %rbx
leaq (,%rax,8), %rcx
movq %rcx, -0x60(%rbp)
leaq (,%rsi,8), %r15
movq $0x0, -0x40(%rbp)
decl %r14d
leaq 0x21f27(%rip), %r13     # 0x708c4
xorpd %xmm2, %xmm2
movq -0x50(%rbp), %rcx
movq %rcx, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
cmpl $0x0, -0x30(%rbp)
jle 0x4eae3
movl -0x40(%rbp), %ecx
movq -0x50(%rbp), %rdx
leaq (%rdx,%rcx,8), %r12
movq 0x10(%rbp), %rcx
movq -0x38(%rbp), %rdx
leaq (%rcx,%rdx,8), %rdx
movq -0x58(%rbp), %rcx
movq %rcx, %r9
xorl %r8d, %r8d
movslq (%r13,%r14,4), %rdi
addq %r13, %rdi
jmpq *%rdi
cmpl $0x0, -0x2c(%rbp)
jle 0x4ea98
xorpd %xmm3, %xmm3
movq -0x48(%rbp), %rdi
xorl %r10d, %r10d
movsd (%rdi), %xmm4
mulsd (%r9,%r10,8), %xmm4
addsd %xmm4, %xmm3
incq %r10
addq %r15, %rdi
cmpq %r10, %rax
jne 0x4e9fb
jmp 0x4ea9c
cmpl $0x0, -0x2c(%rbp)
jle 0x4ea98
xorpd %xmm3, %xmm3
xorl %edi, %edi
movsd (%r12,%rdi,8), %xmm4
mulsd (%r9,%rdi,8), %xmm4
addsd %xmm4, %xmm3
incq %rdi
cmpq %rdi, %rax
jne 0x4ea25
jmp 0x4ea9c
cmpl $0x0, -0x2c(%rbp)
jle 0x4ea98
xorpd %xmm3, %xmm3
movq %rcx, %rdi
xorl %r10d, %r10d
movsd (%r12,%r10,8), %xmm4
mulsd (%rdi), %xmm4
addsd %xmm4, %xmm3
incq %r10
addq %rbx, %rdi
cmpq %r10, %rax
jne 0x4ea4f
jmp 0x4ea9c
cmpl $0x0, -0x2c(%rbp)
jle 0x4ea98
xorpd %xmm3, %xmm3
movq %rax, %r11
movq -0x48(%rbp), %r10
movq %rcx, %rdi
movsd (%r10), %xmm4
mulsd (%rdi), %xmm4
addsd %xmm4, %xmm3
addq %rbx, %rdi
addq %r15, %r10
decq %r11
jne 0x4ea7e
jmp 0x4ea9c
xorpd %xmm3, %xmm3
ucomisd %xmm2, %xmm1
jne 0x4eab1
jp 0x4eab1
mulsd %xmm0, %xmm3
movq %r8, %rdi
imulq %rsi, %rdi
jmp 0x4eac9
movq %r8, %rdi
imulq %rsi, %rdi
movsd (%rdx,%rdi,8), %xmm4
mulsd %xmm1, %xmm4
mulsd %xmm0, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%rdx,%rdi,8)
incq %r8
addq $0x8, %rcx
addq -0x60(%rbp), %r9
cmpq -0x68(%rbp), %r8
jne 0x4e9dc
movq -0x38(%rbp), %rdx
incq %rdx
movq -0x40(%rbp), %rcx
addl -0x2c(%rbp), %ecx
movq %rcx, -0x40(%rbp)
addq $0x8, -0x48(%rbp)
movq %rdx, -0x38(%rbp)
cmpq %rsi, %rdx
jne 0x4e9b1
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq