contract SecuredTokenTransfer {

    /// @dev Transfers a token and returns if it was a success
    /// @param token Token that should be transferred
    /// @param receiver Receiver to whom the token should be transferred
    /// @param amount The amount of tokens that should be transferred
    function transferToken (
        address token, 
        address receiver,
        uint256 amount
    )
        internal
        returns (bool transferred)
    {
        bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", receiver, amount);
        // solium-disable-next-line security/no-inline-assembly
        assembly {
            let success := call(sub(gas, 10000), token, 0, add(data, 0x20), mload(data), 0, 0)
            let ptr := mload(0x40)
            returndatacopy(ptr, 0, returndatasize)
            switch returndatasize 
            case 0 { transferred := success }
            case 0x20 { transferred := iszero(or(iszero(success), iszero(mload(ptr)))) }
            default { transferred := 0 }
        }
    }
}
function transferToken (
    address token, 
    address receiver,
    uint256 amount
)
    internal
    returns (bool transferred)
{
    bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", receiver, amount);
    // solium-disable-next-line security/no-inline-assembly
    assembly {
        let success := call(sub(gas, 10000), token, 0, add(data, 0x20), mload(data), 0, 0)
        let ptr := mload(0x40)
        returndatacopy(ptr, 0, returndatasize)
        switch returndatasize 
        case 0 { transferred := success }
        case 0x20 { transferred := iszero(or(iszero(success), iszero(mload(ptr)))) }
        default { transferred := 0 }
    }
}

/// @dev Transfers a token and returns if it was a success
/// @param token Token that should be transferred
/// @param receiver Receiver to whom the token should be transferred
/// @param amount The amount of tokens that should be transferred