// File: btbujiangjun[P]abcdl/include/utils/ParallelOperator.h
// Function: abcdl::utils::ParallelOperator<int>::parallel_mul2mul_cross(int*, int const*, unsigned long, int const*, unsigned long, std::function<void (int*, int const&, int const&)> const&) const
void parallel_mul2mul_cross(T* result_data,
                                const T* op1,
                                const size_t num_op1,
                                const T* op2,
                                const size_t num_op2,
                                const std::function<void(T*, const T&, const T&)> &f) const{
        CHECK(num_op1 > 0 && num_op2 > 0);
        size_t block_size = get_block_size(num_op1 * num_op2);
        size_t num_thread = get_num_thread(num_op1 * num_op2, block_size);
        std::vector<std::thread> threads(num_thread);
        block_size = num_op1 / num_thread;
        if(num_op1 % num_thread != 0){
            block_size += 1;
        }

        for(size_t i = 0; i != num_thread; i++){
            threads[i] = std::thread(
                [&result_data, &op1, &op2, num_op2, &f](size_t start_idx, size_t end_idx){
                    size_t idx = start_idx * num_op2;
                    for(size_t ti = start_idx; ti != end_idx; ti++){
                        for(size_t tj = 0; tj != num_op2; tj++){
                            f(&result_data[idx++], op1[ti], op2[tj]);
                        }
                    }
                }, i * block_size, std::min(num_op1, (i + 1) * block_size)
            );
        }

        for(auto& thread : threads){
            thread.join();
        }
    }

// Assembly:
subq $0x298, %rsp            # imm = 0x298
movq 0x2a0(%rsp), %rax
movq %rdi, 0x290(%rsp)
movq %rsi, 0x288(%rsp)
movq %rdx, 0x280(%rsp)
movq %rcx, 0x278(%rsp)
movq %r8, 0x270(%rsp)
movq %r9, 0x268(%rsp)
movq 0x290(%rsp), %rax
movq %rax, 0x28(%rsp)
xorl %eax, %eax
cmpq $0x0, 0x278(%rsp)
movb %al, 0x37(%rsp)
jbe 0xbfed
cmpq $0x0, 0x268(%rsp)
seta %al
movb %al, 0x37(%rsp)
movb 0x37(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xbff9
jmp 0xc064
leaq 0x82014(%rip), %rsi     # 0x8e014
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movl $0xb6, %edx
movl $0x3, %ecx
callq 0x89860
movq 0x20(%rsp), %rdi
leaq 0x82053(%rip), %rsi     # 0x8e07b
callq 0xc340
jmp 0xc02f
leaq 0xe0(%rsp), %rdi
callq 0x89c20
jmp 0xc064
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x89c20
jmp 0xc330
movq 0x28(%rsp), %rdi
movq 0x278(%rsp), %rsi
movq 0x268(%rsp), %rax
imulq %rax, %rsi
callq 0xa8e0
movq 0x28(%rsp), %rdi
movq %rax, 0xc8(%rsp)
movq 0x278(%rsp), %rsi
movq 0x268(%rsp), %rax
imulq %rax, %rsi
movq 0xc8(%rsp), %rdx
callq 0xa970
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0xa7(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xa9f0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0xa8(%rsp), %rdi
callq 0xaa00
jmp 0xc0f0
leaq 0xa7(%rsp), %rdi
callq 0xaa80
movq 0x278(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0xc0(%rsp)
movq %rax, 0xc8(%rsp)
movq 0x278(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0xc0(%rsp)
cmpq $0x0, %rdx
je 0xc16f
movq 0xc8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xc8(%rsp)
jmp 0xc16f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0xa7(%rsp), %rdi
callq 0xaa80
jmp 0xc330
movq $0x0, 0x98(%rsp)
movq 0x98(%rsp), %rax
cmpq 0xc0(%rsp), %rax
je 0xc2b2
leaq 0x288(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x280(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x270(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x268(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x2a0(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x98(%rsp), %rax
movq 0xc8(%rsp), %rcx
imulq %rcx, %rax
movq %rax, 0x60(%rsp)
movq 0x98(%rsp), %rax
incq %rax
movq 0xc8(%rsp), %rcx
imulq %rcx, %rax
movq %rax, 0x58(%rsp)
leaq 0x278(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xaa90
movq %rax, 0x8(%rsp)
jmp 0xc226
movq 0x8(%rsp), %rcx
leaq 0x90(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0xc370
jmp 0xc244
movq 0x98(%rsp), %rsi
leaq 0xa8(%rsp), %rdi
callq 0xaba0
movq %rax, %rdi
leaq 0x90(%rsp), %rsi
callq 0xabc0
leaq 0x90(%rsp), %rdi
callq 0xac00
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x98(%rsp)
jmp 0xc17b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0xacf0
jmp 0xc330
leaq 0xa8(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
callq 0xac20
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rdi
callq 0xac50
movq %rax, 0x40(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xac80
testb $0x1, %al
jne 0xc2f2
jmp 0xc31b
leaq 0x48(%rsp), %rdi
callq 0xacc0
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
callq 0x96c0
jmp 0xc30d
jmp 0xc30f
leaq 0x48(%rsp), %rdi
callq 0xacd0
jmp 0xc2dd
leaq 0xa8(%rsp), %rdi
callq 0xacf0
addq $0x298, %rsp            # imm = 0x298
retq
movq 0xd8(%rsp), %rdi
callq 0x9700
nopl (%rax)