// File: /workspace/github_cpp_makefile_star2_O1/btbujiangjun[P]abcdl/src/algebra/MatrixAlgebra.cpp
// Function: abcdl::algebra::Matrix<float>::argmax(unsigned long, abcdl::algebra::Axis_type) const
size_t Matrix<T>::argmax(const size_t id, const Axis_type axis_type) const{
    bool is_row = (axis_type == abcdl::algebra::Axis_type::ROW);
	if(is_row){
        CHECK(id < _rows);
    }else{
        CHECK(id < _cols);
    }

    size_t max_idx 	= 0;
	T max 			= is_row ? get_data(id, 0) : get_data(0, id);
	size_t size 	= is_row ? _cols : _rows;
	
	for(size_t i = 0; i != size; i++){
		T value = is_row ? get_data(id, i) : get_data(i, id);
		if(value > max){
			max = value;
			max_idx = i;
		}
	}
	return max_idx;   
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %edx, %ebx
movq %rdi, %r15
testl %edx, %edx
je 0x2af00
cmpq %rsi, 0x8(%r15)
ja 0x2af09
movq %rsi, %r14
leaq 0x128c8(%rip), %rsi     # 0x3d798
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0xc1, %edx
movl $0x3, %ecx
callq 0x3894e
leaq 0x128e1(%rip), %rsi     # 0x3d7cf
movl $0x18, %edx
movq %r12, %rdi
callq 0x93b0
jmp 0x2b0cc
cmpq %rsi, (%r15)
jbe 0x2b097
movq 0x8(%r15), %rax
testl %ebx, %ebx
je 0x2af61
imulq (%r15), %rax
movq %rsi, %r14
cmpq %rsi, %rax
ja 0x2af75
movq %rsi, %r14
leaq 0x11526(%rip), %rsi     # 0x3c44d
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0x44, %edx
movl $0x3, %ecx
callq 0x3894e
leaq 0x115db(%rip), %rsi     # 0x3c520
movl $0x1f, %edx
movq %r12, %rdi
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x38b76
movq %r14, %rsi
jmp 0x2af75
movq %rax, %r14
imulq %rsi, %r14
imulq (%r15), %rax
cmpq %rax, %r14
jae 0x2b0de
leaq 0x8(%r15), %rax
testl %ebx, %ebx
cmovneq %r15, %rax
movq (%rax), %r12
testq %r12, %r12
je 0x2b080
movq 0x10(%r15), %rax
movss (%rax,%r14,4), %xmm1
xorl %r13d, %r13d
leaq 0x114ae(%rip), %rcx     # 0x3c44d
leaq 0x10(%rsp), %rdx
xorl %ebp, %ebp
movq 0x8(%r15), %r14
movq (%r15), %rax
imulq %r14, %rax
testl %ebx, %ebx
je 0x2aff9
imulq %r13, %r14
addq %rsi, %r14
cmpq %rax, %r14
jb 0x2b005
movss %xmm1, 0x4(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdx, %rdi
movq %rcx, %rsi
movl $0x44, %edx
movl $0x3, %ecx
callq 0x3894e
movl $0x1f, %edx
leaq 0x10(%rsp), %rdi
leaq 0x1152e(%rip), %rsi     # 0x3c520
callq 0x93b0
jmp 0x2b05d
imulq %rsi, %r14
addq %r13, %r14
cmpq %rax, %r14
jae 0x2b027
movq 0x10(%r15), %rax
movss (%rax,%r14,4), %xmm0
ucomiss %xmm1, %xmm0
cmovaq %r13, %rbp
maxss %xmm1, %xmm0
incq %r13
movaps %xmm0, %xmm1
cmpq %r13, %r12
jne 0x2afa6
jmp 0x2b082
movss %xmm1, 0x4(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdx, %rdi
movq %rcx, %rsi
movl $0x44, %edx
movl $0x3, %ecx
callq 0x3894e
movl $0x1f, %edx
leaq 0x10(%rsp), %rdi
leaq 0x114c8(%rip), %rsi     # 0x3c520
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x38b76
movq 0x8(%rsp), %rsi
leaq 0x113da(%rip), %rcx     # 0x3c44d
leaq 0x10(%rsp), %rdx
movss 0x4(%rsp), %xmm1
jmp 0x2b005
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r14
leaq 0x126f7(%rip), %rsi     # 0x3d798
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0xbf, %edx
movl $0x3, %ecx
callq 0x3894e
leaq 0x126f7(%rip), %rsi     # 0x3d7b6
movl $0x18, %edx
movq %r12, %rdi
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x38b76
movq %r14, %rsi
jmp 0x2af09
movq %rsi, %r13
leaq 0x11365(%rip), %rsi     # 0x3c44d
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0x44, %edx
movl $0x3, %ecx
callq 0x3894e
leaq 0x1141a(%rip), %rsi     # 0x3c520
movl $0x1f, %edx
movq %r12, %rdi
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x38b76
movq %r13, %rsi
jmp 0x2af75
jmp 0x2b12f
jmp 0x2b12f
jmp 0x2b12f
jmp 0x2b12f
jmp 0x2b12f
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x38b76
movq %rbx, %rdi
callq 0x95d0