Hewlett Packard Enterprise Development systems may need arithmetic logic implemented without relying on hardware division or multiplication instructions. Given two integers, compute the quotient without using /, //, or *.
Implement divide(a, b) with these rules:
a divided by b, truncated toward zero.b is never zero.[-2147483648, 2147483647].The solution should improve on subtracting the divisor one time per quotient unit by repeatedly doubling the largest usable divisor chunk.
Input: two integers a and b.
Output: one integer representing a / b, truncated toward zero and clamped to the signed 32-bit range.
def divide(a, b):