// File: btbujiangjun[P]abcdl/include/utils/ParallelOperator.h
// Function: abcdl::utils::ParallelOperator<int>::parallel_reduce_boolean(bool*, int const*, unsigned long, std::function<void (bool*, int const&)> const&) const
void parallel_reduce_boolean(bool* result_value,
                                 const T* op1,
                             	 const size_t num_op1,
                         		 const std::function<void(bool*, const T&)> &f) const{
        *result_value = true;
        size_t block_size = get_block_size(num_op1);
        size_t num_thread = get_num_thread(num_op1, block_size);
        std::vector<std::thread> threads(num_thread);
        
        bool* values = new bool[num_thread];
        for(size_t i = 0; i != num_thread; i++){
            bool* value = &values[i];
            *value = true;
            threads[i] = std::thread(
                [&value, &op1, &f](size_t start_idx, size_t end_idx){
					for(size_t ti = start_idx; ti != end_idx && *value; ti++){
    					f(value, op1[ti]);
                    }
                }, i * block_size, std::min(num_op1, (i + 1) * block_size)
            );
        }

        for(auto& thread : threads){
            thread.join();
        }
        bool reduce_result = true;
        for(size_t i = 0; i < num_thread && reduce_result; i++){
           reduce_result = reduce_result && values[i]; 
        }
        *result_value = reduce_result;
    }

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movq %rdx, 0x100(%rsp)
movq %rcx, 0xf8(%rsp)
movq %r8, 0xf0(%rsp)
movq 0x110(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movq 0x108(%rsp), %rax
movb $0x1, (%rax)
movq 0xf8(%rsp), %rsi
callq 0xa8e0
movq 0x20(%rsp), %rdi
movq %rax, 0xe8(%rsp)
movq 0xf8(%rsp), %rsi
movq 0xe8(%rsp), %rdx
callq 0xa970
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0xc7(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xa9f0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0xc8(%rsp), %rdi
callq 0xaa00
jmp 0xcd16
leaq 0xc7(%rsp), %rdi
callq 0xaa80
movq 0xe0(%rsp), %rdi
callq 0x9030
movq %rax, 0x18(%rsp)
jmp 0xcd37
movq 0x18(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq $0x0, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
cmpq 0xe0(%rsp), %rax
je 0xcebc
movq 0xa8(%rsp), %rax
movq 0xa0(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rax
movb $0x1, (%rax)
leaq 0x98(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x100(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0xa0(%rsp), %rax
movq 0xe8(%rsp), %rcx
imulq %rcx, %rax
movq %rax, 0x70(%rsp)
movq 0xa0(%rsp), %rax
incq %rax
movq 0xe8(%rsp), %rcx
imulq %rcx, %rax
movq %rax, 0x68(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0xaa90
movq %rax, 0x10(%rsp)
jmp 0xce07
movq 0x10(%rsp), %rcx
leaq 0x90(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0xcfd0
jmp 0xce25
movq 0xa0(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xaba0
movq %rax, %rdi
leaq 0x90(%rsp), %rsi
callq 0xabc0
leaq 0x90(%rsp), %rdi
callq 0xac00
movq 0xa0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa0(%rsp)
jmp 0xcd50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0xc7(%rsp), %rdi
callq 0xaa80
jmp 0xcfbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0xacf0
jmp 0xcfbb
leaq 0xc8(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rdi
callq 0xac20
movq %rax, 0x58(%rsp)
movq 0x60(%rsp), %rdi
callq 0xac50
movq %rax, 0x50(%rsp)
leaq 0x58(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0xac80
testb $0x1, %al
jne 0xcefc
jmp 0xcf25
leaq 0x58(%rsp), %rdi
callq 0xacc0
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
callq 0x96c0
jmp 0xcf17
jmp 0xcf19
leaq 0x58(%rsp), %rdi
callq 0xacd0
jmp 0xcee7
movb $0x1, 0x47(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x38(%rsp), %rcx
xorl %eax, %eax
cmpq 0xe0(%rsp), %rcx
movb %al, 0xf(%rsp)
jae 0xcf50
movb 0x47(%rsp), %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0xcf5a
jmp 0xcf95
xorl %eax, %eax
testb $0x1, 0x47(%rsp)
movb %al, 0xe(%rsp)
je 0xcf7b
movq 0xa8(%rsp), %rax
movq 0x38(%rsp), %rcx
movb (%rax,%rcx), %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
andb $0x1, %al
movb %al, 0x47(%rsp)
movq 0x38(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0xcf33
movb 0x47(%rsp), %cl
movq 0x108(%rsp), %rax
andb $0x1, %cl
movb %cl, (%rax)
leaq 0xc8(%rsp), %rdi
callq 0xacf0
addq $0x118, %rsp            # imm = 0x118
retq
movq 0xb8(%rsp), %rdi
callq 0x9700
nopl (%rax,%rax)