int avconv_parse_options(int argc, char **argv) { OptionParseContext octx; uint8_t error[128]; int ret; memset(&octx, 0, sizeof(octx)); /* split the commandline into an internal representation */ ret = split_commandline(&octx, argc, argv, options, groups); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Error splitting the argument list: "); goto fail; } /* apply global options */ ret = parse_optgroup(NULL, &octx.global_opts); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Error parsing global options: "); goto fail; } /* open input files */ ret = open_files(&octx.groups[GROUP_INFILE], "input", open_input_file); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Error opening input files: "); goto fail; } /* open output files */ ret = open_files(&octx.groups[GROUP_OUTFILE], "output", open_output_file); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Error opening output files: "); goto fail; } fail: uninit_parse_context(&octx); if (ret < 0) { av_strerror(ret, error, sizeof(error)); av_log(NULL, AV_LOG_FATAL, "%s\n", error); } return ret; }


  void UrlParser::parse(char ch)
  {
    switch(_state)
    {
      case state_0:
        if (ch == '=')
          _state = state_value;
        else if (ch == '&')
          ;
        else if (ch == '%')
          _state = state_keyesc;
        else
        {
          _key = ch;
          _state = state_key;
        }
        break;

      case state_key:
        if (ch == '=')
          _state = state_value;
        else if (ch == '&')
        {
          _q.add(_key);
          _key.clear();
          _state = state_0;
        }
        else if (ch == '%')
          _state = state_keyesc;
        else
          _key += ch;
        break;

      case state_value:
        if (ch == '%')
          _state = state_valueesc;
        else if (ch == '&')
        {
          _q.add(_key, _value);
          _key.clear();
          _value.clear();
          _state = state_0;
        }
        else if (ch == '+')
          _value += ' ';
        else
          _value += ch;
        break;

      case state_keyesc:
      case state_valueesc:
        if (ch >= '0' && ch <= '9')
        {
          ++_cnt;
          _v = (_v << 4) + (ch - '0');
        }
        else if (ch >= 'a' && ch <= 'f')
        {
          ++_cnt;
          _v = (_v << 4) + (ch - 'a' + 10);
        }
        else if (ch >= 'A' && ch <= 'F')
        {
          ++_cnt;
          _v = (_v << 4) + (ch - 'A' + 10);
        }
        else
        {
          if (_cnt == 0)
          {
            if (_state == state_keyesc)
              _state = state_key;
            else
              _state = state_value;
            parse('%');
          }
          else
          {
            if (_state == state_keyesc)
            {
              _key += static_cast<char>(_v);
              _state = state_key;
            }
            else
            {
              _value += static_cast<char>(_v);
              _state = state_value;
            }

            _cnt = 0;
            _v = 0;
          }

          parse(ch);
          break;
        }

        if (_cnt >= 2)
        {
          if (_state == state_keyesc)
          {
            _key += static_cast<char>(_v);
            _state = state_key;
          }
          else
          {
            _value += static_cast<char>(_v);
            _state = state_value;
          }
          _cnt = 0;
          _v = 0;
        }

        break;

    }

  }


static ssize_t k90_show_macro_mode(struct device *dev,
				   struct device_attribute *attr, char *buf)
{
	int ret;
	struct usb_interface *usbif = to_usb_interface(dev->parent);
	struct usb_device *usbdev = interface_to_usbdev(usbif);
	const char *macro_mode;
	char data[8];

	ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0),
			      K90_REQUEST_GET_MODE,
			      USB_DIR_IN | USB_TYPE_VENDOR |
			      USB_RECIP_DEVICE, 0, 0, data, 2,
			      USB_CTRL_SET_TIMEOUT);
	if (ret < 0) {
		dev_warn(dev, "Failed to get K90 initial mode (error %d).\n",
			 ret);
		return -EIO;
	}

	switch (data[0]) {
	case K90_MACRO_MODE_HW:
		macro_mode = "HW";
		break;

	case K90_MACRO_MODE_SW:
		macro_mode = "SW";
		break;
	default:
		dev_warn(dev, "K90 in unknown mode: %02hhx.\n",
			 data[0]);
		return -EIO;
	}

	return snprintf(buf, PAGE_SIZE, "%s\n", macro_mode);
}


static int lvf_probe(AVProbeData *p) { if (AV_RL32(p->buf) == MKTAG('L', 'V', 'F', 'F')) return AVPROBE_SCORE_EXTENSION; return 0; }


TfLiteStatus CalculateArithmeticOpData(TfLiteContext* context, TfLiteNode* node,
                                       OpData* data) {
  const TfLiteTensor* input = GetInput(context, node, kInputTensor);
  TF_LITE_ENSURE(context, input != nullptr);
  TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
  TF_LITE_ENSURE(context, output != nullptr);

  TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type);
  if (input->type == kTfLiteInt8) {
    TF_LITE_ENSURE_EQ(context, output->params.zero_point,
                      std::numeric_limits<int8_t>::min());

    static constexpr int kInputIntegerBits = 4;
    const double input_real_multiplier =
        static_cast<double>(input->params.scale) *
        static_cast<double>(1 << (31 - kInputIntegerBits));

    data->input_zero_point = input->params.zero_point;

    const double q = std::frexp(input_real_multiplier, &data->input_left_shift);
    data->input_multiplier = static_cast<int32_t>(TfLiteRound(q * (1ll << 31)));

    data->input_range_radius =
        CalculateInputRadius(kInputIntegerBits, data->input_left_shift, 31);
  }
  return kTfLiteOk;
}


xps_parse_gradient_stops(xps_document *doc, char *base_uri, fz_xml *node,
	struct stop *stops, int maxcount)
{
	fz_colorspace *colorspace;
	float sample[8];
	float rgb[3];
	int before, after;
	int count;
	int i;

	/* We may have to insert 2 extra stops when postprocessing */
	maxcount -= 2;

	count = 0;
	while (node && count < maxcount)
	{
		if (!strcmp(fz_xml_tag(node), "GradientStop"))
		{
			char *offset = fz_xml_att(node, "Offset");
			char *color = fz_xml_att(node, "Color");
			if (offset && color)
			{
				stops[count].offset = fz_atof(offset);
				stops[count].index = count;

				xps_parse_color(doc, base_uri, color, &colorspace, sample);

				fz_convert_color(doc->ctx, fz_device_rgb(doc->ctx), rgb, colorspace, sample + 1);

				stops[count].r = rgb[0];
				stops[count].g = rgb[1];
				stops[count].b = rgb[2];
				stops[count].a = sample[0];

				count ++;
			}
		}
		node = fz_xml_next(node);
	}

	if (count == 0)
	{
		fz_warn(doc->ctx, "gradient brush has no gradient stops");
		stops[0].offset = 0;
		stops[0].r = 0;
		stops[0].g = 0;
		stops[0].b = 0;
		stops[0].a = 1;
		stops[1].offset = 1;
		stops[1].r = 1;
		stops[1].g = 1;
		stops[1].b = 1;
		stops[1].a = 1;
		return 2;
	}

	if (count == maxcount)
		fz_warn(doc->ctx, "gradient brush exceeded maximum number of gradient stops");

	/* Postprocess to make sure the range of offsets is 0.0 to 1.0 */

	qsort(stops, count, sizeof(struct stop), cmp_stop);

	before = -1;
	after = -1;

	for (i = 0; i < count; i++)
	{
		if (stops[i].offset < 0)
			before = i;
		if (stops[i].offset > 1)
		{
			after = i;
			break;
		}
	}

	/* Remove all stops < 0 except the largest one */
	if (before > 0)
	{
		memmove(stops, stops + before, (count - before) * sizeof(struct stop));
		count -= before;
	}

	/* Remove all stops > 1 except the smallest one */
	if (after >= 0)
		count = after + 1;

	/* Expand single stop to 0 .. 1 */
	if (count == 1)
	{
		stops[1] = stops[0];
		stops[0].offset = 0;
		stops[1].offset = 1;
		return 2;
	}

	/* First stop < 0 -- interpolate value to 0 */
	if (stops[0].offset < 0)
	{
		float d = -stops[0].offset / (stops[1].offset - stops[0].offset);
		stops[0].offset = 0;
		stops[0].r = lerp(stops[0].r, stops[1].r, d);
		stops[0].g = lerp(stops[0].g, stops[1].g, d);
		stops[0].b = lerp(stops[0].b, stops[1].b, d);
		stops[0].a = lerp(stops[0].a, stops[1].a, d);
	}

	/* Last stop > 1 -- interpolate value to 1 */
	if (stops[count-1].offset > 1)
	{
		float d = (1 - stops[count-2].offset) / (stops[count-1].offset - stops[count-2].offset);
		stops[count-1].offset = 1;
		stops[count-1].r = lerp(stops[count-2].r, stops[count-1].r, d);
		stops[count-1].g = lerp(stops[count-2].g, stops[count-1].g, d);
		stops[count-1].b = lerp(stops[count-2].b, stops[count-1].b, d);
		stops[count-1].a = lerp(stops[count-2].a, stops[count-1].a, d);
	}

	/* First stop > 0 -- insert a duplicate at 0 */
	if (stops[0].offset > 0)
	{
		memmove(stops + 1, stops, count * sizeof(struct stop));
		stops[0] = stops[1];
		stops[0].offset = 0;
		count++;
	}

	/* Last stop < 1 -- insert a duplicate at 1 */
	if (stops[count-1].offset < 1)
	{
		stops[count] = stops[count-1];
		stops[count].offset = 1;
		count++;
	}

	return count;
}


static av_cold int opus_decode_init(AVCodecContext *avctx) { OpusContext *c = avctx->priv_data; int ret, i, j; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->sample_rate = 48000; c->fdsp = avpriv_float_dsp_alloc(0); if (!c->fdsp) return AVERROR(ENOMEM); /* find out the channel configuration */ ret = ff_opus_parse_extradata(avctx, c); if (ret < 0) return ret; /* allocate and init each independent decoder */ c->streams = av_mallocz_array(c->nb_streams, sizeof(*c->streams)); c->out = av_mallocz_array(c->nb_streams, 2 * sizeof(*c->out)); c->out_size = av_mallocz_array(c->nb_streams, sizeof(*c->out_size)); c->sync_buffers = av_mallocz_array(c->nb_streams, sizeof(*c->sync_buffers)); c->decoded_samples = av_mallocz_array(c->nb_streams, sizeof(*c->decoded_samples)); if (!c->streams || !c->sync_buffers || !c->decoded_samples || !c->out || !c->out_size) { c->nb_streams = 0; ret = AVERROR(ENOMEM); goto fail; } for (i = 0; i < c->nb_streams; i++) { OpusStreamContext *s = &c->streams[i]; uint64_t layout; s->output_channels = (i < c->nb_stereo_streams) ? 2 : 1; s->avctx = avctx; for (j = 0; j < s->output_channels; j++) { s->silk_output[j] = s->silk_buf[j]; s->celt_output[j] = s->celt_buf[j]; s->redundancy_output[j] = s->redundancy_buf[j]; } s->fdsp = c->fdsp; s->swr =swr_alloc(); if (!s->swr) goto fail; layout = (s->output_channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; av_opt_set_int(s->swr, "in_sample_fmt", avctx->sample_fmt, 0); av_opt_set_int(s->swr, "out_sample_fmt", avctx->sample_fmt, 0); av_opt_set_int(s->swr, "in_channel_layout", layout, 0); av_opt_set_int(s->swr, "out_channel_layout", layout, 0); av_opt_set_int(s->swr, "out_sample_rate", avctx->sample_rate, 0); av_opt_set_int(s->swr, "filter_size", 16, 0); ret = ff_silk_init(avctx, &s->silk, s->output_channels); if (ret < 0) goto fail; ret = ff_celt_init(avctx, &s->celt, s->output_channels); if (ret < 0) goto fail; s->celt_delay = av_audio_fifo_alloc(avctx->sample_fmt, s->output_channels, 1024); if (!s->celt_delay) { ret = AVERROR(ENOMEM); goto fail; } c->sync_buffers[i] = av_audio_fifo_alloc(avctx->sample_fmt, s->output_channels, 32); if (!c->sync_buffers[i]) { ret = AVERROR(ENOMEM); goto fail; } } return 0; fail: opus_decode_close(avctx); return ret; }


static void pipe_advance(struct iov_iter *i, size_t size)
{
	struct pipe_inode_info *pipe = i->pipe;
	struct pipe_buffer *buf;
	int idx = i->idx;
	size_t off = i->iov_offset, orig_sz;

	if (unlikely(i->count < size))
		size = i->count;
	orig_sz = size;

	if (size) {
		if (off) /* make it relative to the beginning of buffer */
			size += off - pipe->bufs[idx].offset;
		while (1) {
			buf = &pipe->bufs[idx];
			if (size <= buf->len)
				break;
			size -= buf->len;
			idx = next_idx(idx, pipe);
		}
		buf->len = size;
		i->idx = idx;
		off = i->iov_offset = buf->offset + size;
	}
	if (off)
		idx = next_idx(idx, pipe);
	if (pipe->nrbufs) {
		int unused = (pipe->curbuf + pipe->nrbufs) & (pipe->buffers - 1);
		/* [curbuf,unused) is in use.  Free [idx,unused) */
		while (idx != unused) {
			pipe_buf_release(pipe, &pipe->bufs[idx]);
			idx = next_idx(idx, pipe);
			pipe->nrbufs--;
		}
	}
	i->count -= orig_sz;
}


static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{
	struct cp2112_device *dev = gpiochip_get_data(chip);
	struct hid_device *hdev = dev->hdev;
	u8 *buf = dev->in_out_buffer;
	unsigned long flags;
	int ret;

	spin_lock_irqsave(&dev->lock, flags);

	ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,
				 CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,
				 HID_REQ_GET_REPORT);
	if (ret != CP2112_GPIO_CONFIG_LENGTH) {
		hid_err(hdev, "error requesting GPIO config: %d\n", ret);
		goto exit;
	}

	buf[1] &= ~(1 << offset);
	buf[2] = gpio_push_pull;

	ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,
				 CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,
				 HID_REQ_SET_REPORT);
	if (ret < 0) {
		hid_err(hdev, "error setting GPIO config: %d\n", ret);
		goto exit;
	}

	ret = 0;

exit:
	spin_unlock_irqrestore(&dev->lock, flags);
	return ret <= 0 ? ret : -EIO;
}


gs_window_class_init (GSWindowClass *klass)
{
        GObjectClass   *object_class = G_OBJECT_CLASS (klass);
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);

        object_class->finalize     = gs_window_finalize;
        object_class->get_property = gs_window_get_property;
        object_class->set_property = gs_window_set_property;

        widget_class->show                = gs_window_real_show;
        widget_class->hide                = gs_window_real_hide;
        widget_class->realize             = gs_window_real_realize;
        widget_class->unrealize           = gs_window_real_unrealize;
        widget_class->key_press_event     = gs_window_real_key_press_event;
        widget_class->motion_notify_event = gs_window_real_motion_notify_event;
        widget_class->button_press_event  = gs_window_real_button_press_event;
        widget_class->scroll_event        = gs_window_real_scroll_event;
        widget_class->get_preferred_width        = gs_window_real_get_preferred_width;
        widget_class->get_preferred_height       = gs_window_real_get_preferred_height;
        widget_class->grab_broken_event   = gs_window_real_grab_broken;
        widget_class->visibility_notify_event = gs_window_real_visibility_notify_event;

        g_type_class_add_private (klass, sizeof (GSWindowPrivate));

        signals [ACTIVITY] =
                g_signal_new ("activity",
                              G_TYPE_FROM_CLASS (object_class),
                              G_SIGNAL_RUN_LAST,
                              G_STRUCT_OFFSET (GSWindowClass, activity),
                              NULL,
                              NULL,
                              gs_marshal_BOOLEAN__VOID,
                              G_TYPE_BOOLEAN,
                              0);
        signals [DEACTIVATED] =
                g_signal_new ("deactivated",
                              G_TYPE_FROM_CLASS (object_class),
                              G_SIGNAL_RUN_LAST,
                              G_STRUCT_OFFSET (GSWindowClass, deactivated),
                              NULL,
                              NULL,
                              g_cclosure_marshal_VOID__VOID,
                              G_TYPE_NONE,
                              0);

        g_object_class_install_property (object_class,
                                         PROP_OBSCURED,
                                         g_param_spec_boolean ("obscured",
                                                               NULL,
                                                               NULL,
                                                               FALSE,
                                                               G_PARAM_READABLE));
        g_object_class_install_property (object_class,
                                         PROP_DIALOG_UP,
                                         g_param_spec_boolean ("dialog-up",
                                                               NULL,
                                                               NULL,
                                                               FALSE,
                                                               G_PARAM_READABLE));
        g_object_class_install_property (object_class,
                                         PROP_LOCK_ENABLED,
                                         g_param_spec_boolean ("lock-enabled",
                                                               NULL,
                                                               NULL,
                                                               FALSE,
                                                               G_PARAM_READWRITE));
        g_object_class_install_property (object_class,
                                         PROP_LOGOUT_ENABLED,
                                         g_param_spec_boolean ("logout-enabled",
                                                               NULL,
                                                               NULL,
                                                               FALSE,
                                                               G_PARAM_READWRITE));
        g_object_class_install_property (object_class,
                                         PROP_LOGOUT_TIMEOUT,
                                         g_param_spec_long ("logout-timeout",
                                                            NULL,
                                                            NULL,
                                                            -1,
                                                            G_MAXLONG,
                                                            0,
                                                            G_PARAM_READWRITE));
        g_object_class_install_property (object_class,
                                         PROP_LOGOUT_COMMAND,
                                         g_param_spec_string ("logout-command",
                                                              NULL,
                                                              NULL,
                                                              NULL,
                                                              G_PARAM_READWRITE));

        g_object_class_install_property (object_class,
                                         PROP_KEYBOARD_ENABLED,
                                         g_param_spec_boolean ("keyboard-enabled",
                                                               NULL,
                                                               NULL,
                                                               FALSE,
                                                               G_PARAM_READWRITE));
        g_object_class_install_property (object_class,
                                         PROP_KEYBOARD_COMMAND,
                                         g_param_spec_string ("keyboard-command",
                                                              NULL,
                                                              NULL,
                                                              NULL,
                                                              G_PARAM_READWRITE));

        g_object_class_install_property (object_class,
                                         PROP_MONITOR,
                                         g_param_spec_int ("monitor",
                                                           "Xinerama monitor",
                                                           "The monitor (in terms of Xinerama) which the window is on",
                                                           0,
                                                           G_MAXINT,
                                                           0,
                                                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT));

}


static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{
	struct cp2112_device *dev = gpiochip_get_data(chip);
	struct hid_device *hdev = dev->hdev;
	u8 *buf = dev->in_out_buffer;
	int ret;

	mutex_lock(&dev->lock);

	ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,
				 CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,
				 HID_REQ_GET_REPORT);
	if (ret != CP2112_GPIO_CONFIG_LENGTH) {
		hid_err(hdev, "error requesting GPIO config: %d\n", ret);
		goto exit;
	}

	buf[1] &= ~(1 << offset);
	buf[2] = gpio_push_pull;

	ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,
				 CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,
				 HID_REQ_SET_REPORT);
	if (ret < 0) {
		hid_err(hdev, "error setting GPIO config: %d\n", ret);
		goto exit;
	}

	ret = 0;

exit:
	mutex_unlock(&dev->lock);
	return ret < 0 ? ret : -EIO;
}


int build_ntlmssp_auth_blob(unsigned char **pbuffer,
					u16 *buflen,
				   struct cifs_ses *ses,
				   const struct nls_table *nls_cp)
{
	int rc;
	AUTHENTICATE_MESSAGE *sec_blob;
	__u32 flags;
	unsigned char *tmp;

	rc = setup_ntlmv2_rsp(ses, nls_cp);
	if (rc) {
		cifs_dbg(VFS, "Error %d during NTLMSSP authentication\n", rc);
		*buflen = 0;
		goto setup_ntlmv2_ret;
	}
	*pbuffer = kmalloc(size_of_ntlmssp_blob(ses), GFP_KERNEL);
	sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer;

	memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8);
	sec_blob->MessageType = NtLmAuthenticate;

	flags = NTLMSSP_NEGOTIATE_56 |
		NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_TARGET_INFO |
		NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE |
		NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC;
	if (ses->server->sign) {
		flags |= NTLMSSP_NEGOTIATE_SIGN;
		if (!ses->server->session_estab ||
				ses->ntlmssp->sesskey_per_smbsess)
			flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
	}

	tmp = *pbuffer + sizeof(AUTHENTICATE_MESSAGE);
	sec_blob->NegotiateFlags = cpu_to_le32(flags);

	sec_blob->LmChallengeResponse.BufferOffset =
				cpu_to_le32(sizeof(AUTHENTICATE_MESSAGE));
	sec_blob->LmChallengeResponse.Length = 0;
	sec_blob->LmChallengeResponse.MaximumLength = 0;

	sec_blob->NtChallengeResponse.BufferOffset =
				cpu_to_le32(tmp - *pbuffer);
	if (ses->user_name != NULL) {
		memcpy(tmp, ses->auth_key.response + CIFS_SESS_KEY_SIZE,
				ses->auth_key.len - CIFS_SESS_KEY_SIZE);
		tmp += ses->auth_key.len - CIFS_SESS_KEY_SIZE;

		sec_blob->NtChallengeResponse.Length =
				cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE);
		sec_blob->NtChallengeResponse.MaximumLength =
				cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE);
	} else {
		/*
		 * don't send an NT Response for anonymous access
		 */
		sec_blob->NtChallengeResponse.Length = 0;
		sec_blob->NtChallengeResponse.MaximumLength = 0;
	}

	if (ses->domainName == NULL) {
		sec_blob->DomainName.BufferOffset = cpu_to_le32(tmp - *pbuffer);
		sec_blob->DomainName.Length = 0;
		sec_blob->DomainName.MaximumLength = 0;
		tmp += 2;
	} else {
		int len;
		len = cifs_strtoUTF16((__le16 *)tmp, ses->domainName,
				      CIFS_MAX_DOMAINNAME_LEN, nls_cp);
		len *= 2; /* unicode is 2 bytes each */
		sec_blob->DomainName.BufferOffset = cpu_to_le32(tmp - *pbuffer);
		sec_blob->DomainName.Length = cpu_to_le16(len);
		sec_blob->DomainName.MaximumLength = cpu_to_le16(len);
		tmp += len;
	}

	if (ses->user_name == NULL) {
		sec_blob->UserName.BufferOffset = cpu_to_le32(tmp - *pbuffer);
		sec_blob->UserName.Length = 0;
		sec_blob->UserName.MaximumLength = 0;
		tmp += 2;
	} else {
		int len;
		len = cifs_strtoUTF16((__le16 *)tmp, ses->user_name,
				      CIFS_MAX_USERNAME_LEN, nls_cp);
		len *= 2; /* unicode is 2 bytes each */
		sec_blob->UserName.BufferOffset = cpu_to_le32(tmp - *pbuffer);
		sec_blob->UserName.Length = cpu_to_le16(len);
		sec_blob->UserName.MaximumLength = cpu_to_le16(len);
		tmp += len;
	}

	sec_blob->WorkstationName.BufferOffset = cpu_to_le32(tmp - *pbuffer);
	sec_blob->WorkstationName.Length = 0;
	sec_blob->WorkstationName.MaximumLength = 0;
	tmp += 2;

	if (((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) ||
		(ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC))
			&& !calc_seckey(ses)) {
		memcpy(tmp, ses->ntlmssp->ciphertext, CIFS_CPHTXT_SIZE);
		sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - *pbuffer);
		sec_blob->SessionKey.Length = cpu_to_le16(CIFS_CPHTXT_SIZE);
		sec_blob->SessionKey.MaximumLength =
				cpu_to_le16(CIFS_CPHTXT_SIZE);
		tmp += CIFS_CPHTXT_SIZE;
	} else {
		sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - *pbuffer);
		sec_blob->SessionKey.Length = 0;
		sec_blob->SessionKey.MaximumLength = 0;
	}

	*buflen = tmp - *pbuffer;
setup_ntlmv2_ret:
	return rc;
}


pdf_xobject * pdf_load_xobject ( fz_context * ctx , pdf_document * doc , pdf_obj * dict ) {
 pdf_xobject * form ;
 if ( ( form = pdf_find_item ( ctx , pdf_drop_xobject_imp , dict ) ) != NULL ) return form ;
 form = fz_malloc_struct ( ctx , pdf_xobject ) ;
 FZ_INIT_STORABLE ( form , 1 , pdf_drop_xobject_imp ) ;
 form -> obj = NULL ;
 form -> iteration = 0 ;
 pdf_store_item ( ctx , dict , form , pdf_xobject_size ( form ) ) ;
 form -> obj = pdf_keep_obj ( ctx , dict ) ;
 return form ;
 }


SMB2_sess_establish_session(struct SMB2_sess_data *sess_data)
{
	int rc = 0;
	struct cifs_ses *ses = sess_data->ses;

	mutex_lock(&ses->server->srv_mutex);
	if (ses->server->ops->generate_signingkey) {
		rc = ses->server->ops->generate_signingkey(ses);
		if (rc) {
			cifs_dbg(FYI,
				"SMB3 session key generation failed\n");
			mutex_unlock(&ses->server->srv_mutex);
			return rc;
		}
	}
	if (!ses->server->session_estab) {
		ses->server->sequence_number = 0x2;
		ses->server->session_estab = true;
	}
	mutex_unlock(&ses->server->srv_mutex);

	cifs_dbg(FYI, "SMB2/3 session established successfully\n");
	spin_lock(&GlobalMid_Lock);
	ses->status = CifsGood;
	ses->need_reconnect = false;
	spin_unlock(&GlobalMid_Lock);
	return rc;
}


TfLiteStatus LogSoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) {
  LogSoftmaxOpData* data = reinterpret_cast<LogSoftmaxOpData*>(node->user_data);

  TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
  TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
  const TfLiteTensor* input = GetInput(context, node, 0);
  TfLiteTensor* output = GetOutput(context, node, 0);
  TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type);

  if (input->type == kTfLiteUInt8 || input->type == kTfLiteInt8) {
    TF_LITE_ENSURE_EQ(context, output->params.scale, 16.0 / 256);
    static const double kBeta = 1.0;
    if (input->type == kTfLiteUInt8) {
      TF_LITE_ENSURE_EQ(context, output->params.zero_point, 255);
      data->params.table = data->f_table;
      optimized_ops::PopulateSoftmaxLookupTable(&data->params,
                                                input->params.scale, kBeta);
      data->params.zero_point = output->params.zero_point;
      data->params.scale = output->params.scale;
    }
    if (input->type == kTfLiteInt8) {
      TF_LITE_ENSURE_EQ(context, output->params.zero_point, 127);
      static const int kScaledDiffIntegerBits = 5;
      tflite::PreprocessLogSoftmaxScalingExp(
          kBeta, input->params.scale, kScaledDiffIntegerBits,
          &data->input_multiplier, &data->input_left_shift,
          &data->reverse_scaling_divisor, &data->reverse_scaling_right_shift);
      data->reverse_scaling_right_shift *= -1;
      data->diff_min =
          -1.0 * tflite::CalculateInputRadius(kScaledDiffIntegerBits,
                                              data->input_left_shift);
    }
  }

  return context->ResizeTensor(context, output,
                               TfLiteIntArrayCopy(input->dims));
}


plpgsql_validator(PG_FUNCTION_ARGS)
{
	Oid			funcoid = PG_GETARG_OID(0);
	HeapTuple	tuple;
	Form_pg_proc proc;
	char		functyptype;
	int			numargs;
	Oid		   *argtypes;
	char	  **argnames;
	char	   *argmodes;
	bool		is_dml_trigger = false;
	bool		is_event_trigger = false;
	int			i;

	/* Get the new function's pg_proc entry */
	tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
	if (!HeapTupleIsValid(tuple))
		elog(ERROR, "cache lookup failed for function %u", funcoid);
	proc = (Form_pg_proc) GETSTRUCT(tuple);

	functyptype = get_typtype(proc->prorettype);

	/* Disallow pseudotype result */
	/* except for TRIGGER, RECORD, VOID, or polymorphic */
	if (functyptype == TYPTYPE_PSEUDO)
	{
		/* we assume OPAQUE with no arguments means a trigger */
		if (proc->prorettype == TRIGGEROID ||
			(proc->prorettype == OPAQUEOID && proc->pronargs == 0))
			is_dml_trigger = true;
		else if (proc->prorettype == EVTTRIGGEROID)
			is_event_trigger = true;
		else if (proc->prorettype != RECORDOID &&
				 proc->prorettype != VOIDOID &&
				 !IsPolymorphicType(proc->prorettype))
			ereport(ERROR,
					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
					 errmsg("PL/pgSQL functions cannot return type %s",
							format_type_be(proc->prorettype))));
	}

	/* Disallow pseudotypes in arguments (either IN or OUT) */
	/* except for polymorphic */
	numargs = get_func_arg_info(tuple,
								&argtypes, &argnames, &argmodes);
	for (i = 0; i < numargs; i++)
	{
		if (get_typtype(argtypes[i]) == TYPTYPE_PSEUDO)
		{
			if (!IsPolymorphicType(argtypes[i]))
				ereport(ERROR,
						(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
						 errmsg("PL/pgSQL functions cannot accept type %s",
								format_type_be(argtypes[i]))));
		}
	}

	/* Postpone body checks if !check_function_bodies */
	if (check_function_bodies)
	{
		FunctionCallInfoData fake_fcinfo;
		FmgrInfo	flinfo;
		int			rc;
		TriggerData trigdata;
		EventTriggerData etrigdata;

		/*
		 * Connect to SPI manager (is this needed for compilation?)
		 */
		if ((rc = SPI_connect()) != SPI_OK_CONNECT)
			elog(ERROR, "SPI_connect failed: %s", SPI_result_code_string(rc));

		/*
		 * Set up a fake fcinfo with just enough info to satisfy
		 * plpgsql_compile().
		 */
		MemSet(&fake_fcinfo, 0, sizeof(fake_fcinfo));
		MemSet(&flinfo, 0, sizeof(flinfo));
		fake_fcinfo.flinfo = &flinfo;
		flinfo.fn_oid = funcoid;
		flinfo.fn_mcxt = CurrentMemoryContext;
		if (is_dml_trigger)
		{
			MemSet(&trigdata, 0, sizeof(trigdata));
			trigdata.type = T_TriggerData;
			fake_fcinfo.context = (Node *) &trigdata;
		}
		else if (is_event_trigger)
		{
			MemSet(&etrigdata, 0, sizeof(etrigdata));
			etrigdata.type = T_EventTriggerData;
			fake_fcinfo.context = (Node *) &etrigdata;
		}

		/* Test-compile the function */
		plpgsql_compile(&fake_fcinfo, true);

		/*
		 * Disconnect from SPI manager
		 */
		if ((rc = SPI_finish()) != SPI_OK_FINISH)
			elog(ERROR, "SPI_finish failed: %s", SPI_result_code_string(rc));
	}

	ReleaseSysCache(tuple);

	PG_RETURN_VOID();
}


static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data)
{
	int ret;

	ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0),
			      PEGASUS_REQ_SET_REGS, PEGASUS_REQT_WRITE, 0,
			      indx, data, size, 100);
	if (ret < 0)
		netif_dbg(pegasus, drv, pegasus->net,
			  "%s returned %d\n", __func__, ret);
	return ret;
}


static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
{
	return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
			       RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
			       indx, 0, data, size, 500);
}


TfLiteStatus Relu1Eval(TfLiteContext* context, TfLiteNode* node) {
  const TfLiteTensor* input = GetInput(context, node, 0);
  TfLiteTensor* output = GetOutput(context, node, 0);
  const ReluOpData* data = reinterpret_cast<ReluOpData*>(node->user_data);
  switch (input->type) {
    case kTfLiteFloat32: {
      optimized_ops::Relu1(GetTensorShape(input), GetTensorData<float>(input),
                           GetTensorShape(output),
                           GetTensorData<float>(output));
      return kTfLiteOk;
    } break;
    case kTfLiteUInt8: {
      QuantizedReluX<uint8_t>(-1.0f, 1.0f, input, output, data);
      return kTfLiteOk;
    } break;
    case kTfLiteInt8: {
      QuantizedReluX<int8_t>(-1, 1, input, output, data);
      return kTfLiteOk;
    } break;
    default:
      TF_LITE_KERNEL_LOG(context,
                         "Only float32, uint8, int8 supported "
                         "currently, got %s.",
                         TfLiteTypeGetName(input->type));
      return kTfLiteError;
  }
}


CheckIndexCompatible(Oid oldId,
					 RangeVar *heapRelation,
					 char *accessMethodName,
					 List *attributeList,
					 List *exclusionOpNames)
{
	bool		isconstraint;
	Oid		   *typeObjectId;
	Oid		   *collationObjectId;
	Oid		   *classObjectId;
	Oid			accessMethodId;
	Oid			relationId;
	HeapTuple	tuple;
	Form_pg_index indexForm;
	Form_pg_am	accessMethodForm;
	bool		amcanorder;
	int16	   *coloptions;
	IndexInfo  *indexInfo;
	int			numberOfAttributes;
	int			old_natts;
	bool		isnull;
	bool		ret = true;
	oidvector  *old_indclass;
	oidvector  *old_indcollation;
	Relation	irel;
	int			i;
	Datum		d;

	/* Caller should already have the relation locked in some way. */
	relationId = RangeVarGetRelid(heapRelation, NoLock, false);

	/*
	 * We can pretend isconstraint = false unconditionally.  It only serves to
	 * decide the text of an error message that should never happen for us.
	 */
	isconstraint = false;

	numberOfAttributes = list_length(attributeList);
	Assert(numberOfAttributes > 0);
	Assert(numberOfAttributes <= INDEX_MAX_KEYS);

	/* look up the access method */
	tuple = SearchSysCache1(AMNAME, PointerGetDatum(accessMethodName));
	if (!HeapTupleIsValid(tuple))
		ereport(ERROR,
				(errcode(ERRCODE_UNDEFINED_OBJECT),
				 errmsg("access method \"%s\" does not exist",
						accessMethodName)));
	accessMethodId = HeapTupleGetOid(tuple);
	accessMethodForm = (Form_pg_am) GETSTRUCT(tuple);
	amcanorder = accessMethodForm->amcanorder;
	ReleaseSysCache(tuple);

	/*
	 * Compute the operator classes, collations, and exclusion operators for
	 * the new index, so we can test whether it's compatible with the existing
	 * one.  Note that ComputeIndexAttrs might fail here, but that's OK:
	 * DefineIndex would have called this function with the same arguments
	 * later on, and it would have failed then anyway.
	 */
	indexInfo = makeNode(IndexInfo);
	indexInfo->ii_Expressions = NIL;
	indexInfo->ii_ExpressionsState = NIL;
	indexInfo->ii_PredicateState = NIL;
	indexInfo->ii_ExclusionOps = NULL;
	indexInfo->ii_ExclusionProcs = NULL;
	indexInfo->ii_ExclusionStrats = NULL;
	typeObjectId = (Oid *) palloc(numberOfAttributes * sizeof(Oid));
	collationObjectId = (Oid *) palloc(numberOfAttributes * sizeof(Oid));
	classObjectId = (Oid *) palloc(numberOfAttributes * sizeof(Oid));
	coloptions = (int16 *) palloc(numberOfAttributes * sizeof(int16));
	ComputeIndexAttrs(indexInfo,
					  typeObjectId, collationObjectId, classObjectId,
					  coloptions, attributeList,
					  exclusionOpNames, relationId,
					  accessMethodName, accessMethodId,
					  amcanorder, isconstraint);

	/* Get the soon-obsolete pg_index tuple. */
	tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(oldId));
	if (!HeapTupleIsValid(tuple))
		elog(ERROR, "cache lookup failed for index %u", oldId);
	indexForm = (Form_pg_index) GETSTRUCT(tuple);

	/*
	 * We don't assess expressions or predicates; assume incompatibility.
	 * Also, if the index is invalid for any reason, treat it as incompatible.
	 */
	if (!(heap_attisnull(tuple, Anum_pg_index_indpred) &&
		  heap_attisnull(tuple, Anum_pg_index_indexprs) &&
		  IndexIsValid(indexForm)))
	{
		ReleaseSysCache(tuple);
		return false;
	}

	/* Any change in operator class or collation breaks compatibility. */
	old_natts = indexForm->indnatts;
	Assert(old_natts == numberOfAttributes);

	d = SysCacheGetAttr(INDEXRELID, tuple, Anum_pg_index_indcollation, &isnull);
	Assert(!isnull);
	old_indcollation = (oidvector *) DatumGetPointer(d);

	d = SysCacheGetAttr(INDEXRELID, tuple, Anum_pg_index_indclass, &isnull);
	Assert(!isnull);
	old_indclass = (oidvector *) DatumGetPointer(d);

	ret = (memcmp(old_indclass->values, classObjectId,
				  old_natts * sizeof(Oid)) == 0 &&
		   memcmp(old_indcollation->values, collationObjectId,
				  old_natts * sizeof(Oid)) == 0);

	ReleaseSysCache(tuple);

	if (!ret)
		return false;

	/* For polymorphic opcintype, column type changes break compatibility. */
	irel = index_open(oldId, AccessShareLock);	/* caller probably has a lock */
	for (i = 0; i < old_natts; i++)
	{
		if (IsPolymorphicType(get_opclass_input_type(classObjectId[i])) &&
			irel->rd_att->attrs[i]->atttypid != typeObjectId[i])
		{
			ret = false;
			break;
		}
	}

	/* Any change in exclusion operator selections breaks compatibility. */
	if (ret && indexInfo->ii_ExclusionOps != NULL)
	{
		Oid		   *old_operators,
				   *old_procs;
		uint16	   *old_strats;

		RelationGetExclusionInfo(irel, &old_operators, &old_procs, &old_strats);
		ret = memcmp(old_operators, indexInfo->ii_ExclusionOps,
					 old_natts * sizeof(Oid)) == 0;

		/* Require an exact input type match for polymorphic operators. */
		if (ret)
		{
			for (i = 0; i < old_natts && ret; i++)
			{
				Oid			left,
							right;

				op_input_types(indexInfo->ii_ExclusionOps[i], &left, &right);
				if ((IsPolymorphicType(left) || IsPolymorphicType(right)) &&
					irel->rd_att->attrs[i]->atttypid != typeObjectId[i])
				{
					ret = false;
					break;
				}
			}
		}
	}

	index_close(irel, NoLock);
	return ret;
}


TfLiteStatus Relu6Eval(TfLiteContext* context, TfLiteNode* node) {
  const TfLiteTensor* input = GetInput(context, node, 0);
  TfLiteTensor* output = GetOutput(context, node, 0);
  ReluOpData* data = reinterpret_cast<ReluOpData*>(node->user_data);
  switch (input->type) {
    case kTfLiteFloat32: {
      size_t elements = input->bytes / sizeof(float);
      const float* in = GetTensorData<float>(input);
      const float* in_end = in + elements;
      float* out = GetTensorData<float>(output);
      for (; in < in_end; in++, out++) *out = std::min(std::max(0.f, *in), 6.f);
      return kTfLiteOk;
    } break;
    case kTfLiteUInt8:
      QuantizedReluX<uint8_t>(0.0f, 6.0f, input, output, data);
      return kTfLiteOk;
    case kTfLiteInt8: {
      QuantizedReluX<int8_t>(0.0f, 6.0f, input, output, data);
      return kTfLiteOk;
    } break;
    default:
      TF_LITE_KERNEL_LOG(
          context,
          "Only float32, uint8 and int8 are supported currently, got %s.",
          TfLiteTypeGetName(input->type));
      return kTfLiteError;
  }
}


static void truemotion1_decode_24bit ( TrueMotion1Context * s ) {
 int y ;
 int pixels_left ;
 unsigned int predictor_pair ;
 unsigned int horiz_pred ;
 unsigned int * vert_pred ;
 unsigned int * current_pixel_pair ;
 unsigned char * current_line = s -> frame . data [ 0 ] ;
 int keyframe = s -> flags & FLAG_KEYFRAME ;
 const unsigned char * mb_change_bits = s -> mb_change_bits ;
 unsigned char mb_change_byte ;
 unsigned char mb_change_byte_mask ;
 int mb_change_index ;
 int index_stream_index = 0 ;
 int index ;
 memset ( s -> vert_pred , 0 , s -> avctx -> width * sizeof ( unsigned int ) ) ;
 GET_NEXT_INDEX ( ) ;
 for ( y = 0 ;
 y < s -> avctx -> height ;
 y ++ ) {
 horiz_pred = 0 ;
 current_pixel_pair = ( unsigned int * ) current_line ;
 vert_pred = s -> vert_pred ;
 mb_change_index = 0 ;
 mb_change_byte = mb_change_bits [ mb_change_index ++ ] ;
 mb_change_byte_mask = 0x01 ;
 pixels_left = s -> avctx -> width ;
 while ( pixels_left > 0 ) {
 if ( keyframe || ( ( mb_change_byte & mb_change_byte_mask ) == 0 ) ) {
 switch ( y & 3 ) {
 case 0 : if ( s -> block_width == 2 ) {
 APPLY_C_PREDICTOR_24 ( ) ;
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 APPLY_C_PREDICTOR_24 ( ) ;
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 }
 else {
 APPLY_C_PREDICTOR_24 ( ) ;
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 }
 break ;
 case 1 : case 3 : APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 break ;
 case 2 : if ( s -> block_type == BLOCK_2x2 ) {
 APPLY_C_PREDICTOR_24 ( ) ;
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 APPLY_C_PREDICTOR_24 ( ) ;
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 }
 else if ( s -> block_type == BLOCK_4x2 ) {
 APPLY_C_PREDICTOR_24 ( ) ;
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 }
 else {
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 APPLY_Y_PREDICTOR_24 ( ) ;
 OUTPUT_PIXEL_PAIR ( ) ;
 }
 break ;
 }
 }
 else {
 * vert_pred ++ = * current_pixel_pair ++ ;
 horiz_pred = * current_pixel_pair - * vert_pred ;
 * vert_pred ++ = * current_pixel_pair ++ ;
 }
 if ( ! keyframe ) {
 mb_change_byte_mask <<= 1 ;
 if ( ! mb_change_byte_mask ) {
 mb_change_byte = mb_change_bits [ mb_change_index ++ ] ;
 mb_change_byte_mask = 0x01 ;
 }
 }
 pixels_left -= 2 ;
 }
 if ( ( ( y + 1 ) & 3 ) == 0 ) mb_change_bits += s -> mb_change_bits_row_size ;
 current_line += s -> frame . linesize [ 0 ] ;
 }
 }


static void flush_char ( GifCtx * ctx ) {
 if ( ctx -> a_count > 0 ) {
 gdPutC ( ctx -> a_count , ctx -> g_outfile ) ;
 gdPutBuf ( ctx -> accum , ctx -> a_count , ctx -> g_outfile ) ;
 ctx -> a_count = 0 ;
 }
 }


CheckRelationOwnership(RangeVar *rel, bool noCatalogs)
{
	Oid			relOid;
	HeapTuple	tuple;

	/*
	 * XXX: This is unsafe in the presence of concurrent DDL, since it is
	 * called before acquiring any lock on the target relation.  However,
	 * locking the target relation (especially using something like
	 * AccessExclusiveLock) before verifying that the user has permissions is
	 * not appealing either.
	 */
	relOid = RangeVarGetRelid(rel, NoLock, false);

	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
	if (!HeapTupleIsValid(tuple))		/* should not happen */
		elog(ERROR, "cache lookup failed for relation %u", relOid);

	if (!pg_class_ownercheck(relOid, GetUserId()))
		aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS,
					   rel->relname);

	if (noCatalogs)
	{
		if (!allowSystemTableMods &&
			IsSystemClass(relOid, (Form_pg_class) GETSTRUCT(tuple)))
			ereport(ERROR,
					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
					 errmsg("permission denied: \"%s\" is a system catalog",
							rel->relname)));
	}

	ReleaseSysCache(tuple);
}


static CharDriverState *chr_open(const char *subtype, void (*set_fe_open)(struct CharDriverState *, int)) { CharDriverState *chr; SpiceCharDriver *s; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(SpiceCharDriver)); s->chr = chr; s->active = false; s->sin.subtype = g_strdup(subtype); chr->opaque = s; chr->chr_write = spice_chr_write; chr->chr_add_watch = spice_chr_add_watch; chr->chr_close = spice_chr_close; chr->chr_set_fe_open = set_fe_open; chr->explicit_be_open = true; chr->chr_fe_event = spice_chr_fe_event; QLIST_INSERT_HEAD(&spice_chars, s, next); return chr; }


build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) { AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp); bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16, true /* fseg memory */); memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id)); rsdp->length = cpu_to_le32(sizeof(*rsdp)); rsdp->revision = 0x02; /* Point to RSDT */ rsdp->rsdt_physical_address = cpu_to_le32(rsdt); /* Address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE, ACPI_BUILD_TABLE_FILE, rsdp_table, &rsdp->rsdt_physical_address, sizeof rsdp->rsdt_physical_address); rsdp->checksum = 0; /* Checksum to be filled by Guest linker */ bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, rsdp, rsdp, sizeof *rsdp, &rsdp->checksum); return rsdp_table; }


poly_path(PG_FUNCTION_ARGS)
{
	POLYGON    *poly = PG_GETARG_POLYGON_P(0);
	PATH	   *path;
	int			size;
	int			i;

	size = offsetof(PATH, p[0]) +sizeof(path->p[0]) * poly->npts;
	path = (PATH *) palloc(size);

	SET_VARSIZE(path, size);
	path->npts = poly->npts;
	path->closed = TRUE;
	/* prevent instability in unused pad bytes */
	path->dummy = 0;

	for (i = 0; i < poly->npts; i++)
	{
		path->p[i].x = poly->p[i].x;
		path->p[i].y = poly->p[i].y;
	}

	PG_RETURN_PATH_P(path);
}


static uint64_t xilinx_spips_read(void *opaque, hwaddr addr, unsigned size) { XilinxSPIPS *s = opaque; uint32_t mask = ~0; uint32_t ret; addr >>= 2; switch (addr) { case R_CONFIG: mask = 0x0002FFFF; break; case R_INTR_STATUS: ret = s->regs[addr] & IXR_ALL; s->regs[addr] = 0; DB_PRINT("addr=" TARGET_FMT_plx " = %x\n", addr * 4, ret); return ret; case R_INTR_MASK: mask = IXR_ALL; break; case R_EN: mask = 0x1; break; case R_SLAVE_IDLE_COUNT: mask = 0xFF; break; case R_MOD_ID: mask = 0x01FFFFFF; break; case R_INTR_EN: case R_INTR_DIS: case R_TX_DATA: mask = 0; break; case R_RX_DATA: rx_data_bytes(s, &ret, s->num_txrx_bytes); DB_PRINT("addr=" TARGET_FMT_plx " = %x\n", addr * 4, ret); xilinx_spips_update_ixr(s); return ret; } DB_PRINT("addr=" TARGET_FMT_plx " = %x\n", addr * 4, s->regs[addr] & mask); return s->regs[addr] & mask; }


TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
  TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
  TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);

  const TfLiteTensor* input = GetInput(context, node, kInputTensor);
  const TfLiteTensor* axis = GetInput(context, node, kAxis);
  // Make sure the axis is only 1 dimension.
  TF_LITE_ENSURE_EQ(context, NumElements(axis), 1);
  // Make sure the axis is only either int32 or int64.
  TF_LITE_ENSURE(context,
                 axis->type == kTfLiteInt32 || axis->type == kTfLiteInt64);

  TfLiteTensor* output = GetOutput(context, node, kOutputTensor);

  auto* params = reinterpret_cast<TfLiteArgMaxParams*>(node->builtin_data);
  switch (params->output_type) {
    case kTfLiteInt32:
      output->type = kTfLiteInt32;
      break;
    case kTfLiteInt64:
      output->type = kTfLiteInt64;
      break;
    default:
      context->ReportError(context, "Unknown index output data type: %d",
                           params->output_type);
      return kTfLiteError;
  }

  // Check conditions for different types.
  switch (input->type) {
    case kTfLiteFloat32:
    case kTfLiteUInt8:
    case kTfLiteInt8:
    case kTfLiteInt32:
      break;

    default:
      context->ReportError(
          context,
          "Unknown input type: %d, only float32 and int types are supported",
          input->type);
      return kTfLiteError;
  }

  TF_LITE_ENSURE(context, NumDimensions(input) >= 1);

  if (IsConstantTensor(axis)) {
    TF_LITE_ENSURE_STATUS(ResizeOutput(context, input, axis, output));
  } else {
    SetTensorToDynamic(output);
  }

  return kTfLiteOk;
}


static unsigned int usbdev_poll ( struct file * file , struct poll_table_struct * wait ) {
 struct usb_dev_state * ps = file -> private_data ;
 unsigned int mask = 0 ;
 poll_wait ( file , & ps -> wait , wait ) ;
 if ( file -> f_mode & FMODE_WRITE && ! list_empty ( & ps -> async_completed ) ) mask |= POLLOUT | POLLWRNORM ;
 if ( ! connected ( ps ) ) mask |= POLLERR | POLLHUP ;
 return mask ;
 }


static uint64_t memory_region_dispatch_read1(MemoryRegion *mr, hwaddr addr, unsigned size) { uint64_t data = 0; if (!memory_region_access_valid(mr, addr, size, false)) { return -1U; /* FIXME: better signalling */ } if (!mr->ops->read) { return mr->ops->old_mmio.read[bitops_ffsl(size)](mr->opaque, addr); } /* FIXME: support unaligned access */ access_with_adjusted_size(addr, &data, size, mr->ops->impl.min_access_size, mr->ops->impl.max_access_size, memory_region_read_accessor, mr); return data; }


TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
  const TfLiteTensor* input = GetInput(context, node, kInputTensor);
  TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
  const int num_elements = NumElements(input);
  TF_LITE_ENSURE_EQ(context, num_elements, NumElements(output));
  switch (input->type) {
    case kTfLiteInt64:
      return copyToTensor(context, input->data.i64, output, num_elements);
    case kTfLiteInt32:
      return copyToTensor(context, input->data.i32, output, num_elements);
    case kTfLiteUInt8:
      return copyToTensor(context, input->data.uint8, output, num_elements);
    case kTfLiteFloat32:
      return copyToTensor(context, GetTensorData<float>(input), output,
                          num_elements);
    case kTfLiteBool:
      return copyToTensor(context, input->data.b, output, num_elements);
    case kTfLiteComplex64:
      return copyToTensor(
          context, reinterpret_cast<std::complex<float>*>(input->data.c64),
          output, num_elements);
    default:
      // Unsupported type.
      TF_LITE_UNSUPPORTED_TYPE(context, input->type, "Cast");
  }
  return kTfLiteOk;
}


rfbClientPtr rfbClientIteratorNext ( rfbClientIteratorPtr i ) {
 if ( i -> next == 0 ) {
 LOCK ( rfbClientListMutex ) ;
 i -> next = i -> screen -> clientHead ;
 UNLOCK ( rfbClientListMutex ) ;
 }
 else {
 IF_PTHREADS ( rfbClientPtr cl = i -> next ) ;
 i -> next = i -> next -> next ;
 IF_PTHREADS ( rfbDecrClientRef ( cl ) ) ;
 }
 # ifdef LIBVNCSERVER_HAVE_LIBPTHREAD if ( ! i -> closedToo ) while ( i -> next && i -> next -> sock < 0 ) i -> next = i -> next -> next ;
 if ( i -> next ) rfbIncrClientRef ( i -> next ) ;
 # endif return i -> next ;
 }


static void mdb_writewait ( Operation * op , slap_callback * sc ) {
 ww_ctx * ww = sc -> sc_private ;
 if ( ! ww -> flag ) {
 mdb_rtxn_snap ( op , ww ) ;
 }
 }


static int gs_usb_probe(struct usb_interface *intf,
			const struct usb_device_id *id)
{
	struct gs_usb *dev;
	int rc = -ENOMEM;
	unsigned int icount, i;
	struct gs_host_config hconf = {
		.byte_order = 0x0000beef,
	};
	struct gs_device_config dconf;

	/* send host config */
	rc = usb_control_msg(interface_to_usbdev(intf),
			     usb_sndctrlpipe(interface_to_usbdev(intf), 0),
			     GS_USB_BREQ_HOST_FORMAT,
			     USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
			     1,
			     intf->altsetting[0].desc.bInterfaceNumber,
			     &hconf,
			     sizeof(hconf),
			     1000);

	if (rc < 0) {
		dev_err(&intf->dev, "Couldn't send data format (err=%d)\n",
			rc);
		return rc;
	}

	/* read device config */
	rc = usb_control_msg(interface_to_usbdev(intf),
			     usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
			     GS_USB_BREQ_DEVICE_CONFIG,
			     USB_DIR_IN|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
			     1,
			     intf->altsetting[0].desc.bInterfaceNumber,
			     &dconf,
			     sizeof(dconf),
			     1000);
	if (rc < 0) {
		dev_err(&intf->dev, "Couldn't get device config: (err=%d)\n",
			rc);
		return rc;
	}

	icount = dconf.icount + 1;
	dev_info(&intf->dev, "Configuring for %d interfaces\n", icount);

	if (icount > GS_MAX_INTF) {
		dev_err(&intf->dev,
			"Driver cannot handle more that %d CAN interfaces\n",
			GS_MAX_INTF);
		return -EINVAL;
	}

	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
	if (!dev)
		return -ENOMEM;
	init_usb_anchor(&dev->rx_submitted);

	atomic_set(&dev->active_channels, 0);

	usb_set_intfdata(intf, dev);
	dev->udev = interface_to_usbdev(intf);

	for (i = 0; i < icount; i++) {
		dev->canch[i] = gs_make_candev(i, intf, &dconf);
		if (IS_ERR_OR_NULL(dev->canch[i])) {
			/* save error code to return later */
			rc = PTR_ERR(dev->canch[i]);

			/* on failure destroy previously created candevs */
			icount = i;
			for (i = 0; i < icount; i++)
				gs_destroy_candev(dev->canch[i]);

			usb_kill_anchored_urbs(&dev->rx_submitted);
			kfree(dev);
			return rc;
		}
		dev->canch[i]->parent = dev;
	}

	return 0;
}


extern int as_mysql_job_start ( mysql_conn_t * mysql_conn , struct job_record * job_ptr ) {
 int rc = SLURM_SUCCESS ;
 char * nodes = NULL , * jname = NULL , * node_inx = NULL ;
 int track_steps = 0 ;
 char * block_id = NULL , * partition = NULL ;
 char * gres_req = NULL , * gres_alloc = NULL ;
 char temp_bit [ BUF_SIZE ] ;
 char * query = NULL ;
 int reinit = 0 ;
 time_t begin_time , check_time , start_time , submit_time ;
 uint32_t wckeyid = 0 ;
 uint32_t job_state ;
 int node_cnt = 0 ;
 uint32_t array_task_id = ( job_ptr -> array_job_id ) ? job_ptr -> array_task_id : NO_VAL ;
 uint64_t job_db_inx = job_ptr -> db_index ;
 job_array_struct_t * array_recs = job_ptr -> array_recs ;
 if ( ( ! job_ptr -> details || ! job_ptr -> details -> submit_time ) && ! job_ptr -> resize_time ) {
 error ( "as_mysql_job_start: " "Not inputing this job, it has no submit time." ) ;
 return SLURM_ERROR ;
 }
 if ( check_connection ( mysql_conn ) != SLURM_SUCCESS ) return ESLURM_DB_CONNECTION ;
 debug2 ( "as_mysql_slurmdb_job_start() called" ) ;
 job_state = job_ptr -> job_state ;
 if ( job_ptr -> resize_time ) {
 begin_time = job_ptr -> resize_time ;
 submit_time = job_ptr -> resize_time ;
 start_time = job_ptr -> resize_time ;
 }
 else {
 begin_time = job_ptr -> details -> begin_time ;
 submit_time = job_ptr -> details -> submit_time ;
 start_time = job_ptr -> start_time ;
 }
 if ( job_ptr -> state_reason == WAIT_ARRAY_TASK_LIMIT ) begin_time = INFINITE ;
 if ( IS_JOB_RESIZING ( job_ptr ) ) {
 if ( ! job_ptr -> db_index ) {
 error ( "We don't have a db_index for job %u, " "this should only happen when resizing " "jobs and the database interface was down." , job_ptr -> job_id ) ;
 job_ptr -> db_index = _get_db_index ( mysql_conn , job_ptr -> details -> submit_time , job_ptr -> job_id , job_ptr -> assoc_id ) ;
 }
 if ( job_ptr -> db_index ) as_mysql_job_complete ( mysql_conn , job_ptr ) ;
 job_state &= ( ~ JOB_RESIZING ) ;
 job_ptr -> db_index = 0 ;
 }
 job_state &= JOB_STATE_BASE ;
 if ( start_time ) check_time = start_time ;
 else if ( begin_time ) check_time = begin_time ;
 else check_time = submit_time ;
 slurm_mutex_lock ( & rollup_lock ) ;
 if ( check_time < global_last_rollup ) {
 MYSQL_RES * result = NULL ;
 MYSQL_ROW row ;
 query = xstrdup_printf ( "select job_db_inx " "from \"%s_%s\" where id_job=%u and " "time_submit=%ld and time_eligible=%ld " "and time_start=%ld;
" , mysql_conn -> cluster_name , job_table , job_ptr -> job_id , submit_time , begin_time , start_time ) ;
 if ( debug_flags & DEBUG_FLAG_DB_JOB ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ;
 if ( ! ( result = mysql_db_query_ret ( mysql_conn , query , 0 ) ) ) {
 xfree ( query ) ;
 slurm_mutex_unlock ( & rollup_lock ) ;
 return SLURM_ERROR ;
 }
 xfree ( query ) ;
 if ( ( row = mysql_fetch_row ( result ) ) ) {
 mysql_free_result ( result ) ;
 debug4 ( "revieved an update for a " "job (%u) already known about" , job_ptr -> job_id ) ;
 slurm_mutex_unlock ( & rollup_lock ) ;
 goto no_rollup_change ;
 }
 mysql_free_result ( result ) ;
 if ( job_ptr -> start_time ) debug ( "Need to reroll usage from %s Job %u " "from %s started then and we are just " "now hearing about it." , slurm_ctime2 ( & check_time ) , job_ptr -> job_id , mysql_conn -> cluster_name ) ;
 else if ( begin_time ) debug ( "Need to reroll usage from %s Job %u " "from %s became eligible then and we are just " "now hearing about it." , slurm_ctime2 ( & check_time ) , job_ptr -> job_id , mysql_conn -> cluster_name ) ;
 else debug ( "Need to reroll usage from %s Job %u " "from %s was submitted then and we are just " "now hearing about it." , slurm_ctime2 ( & check_time ) , job_ptr -> job_id , mysql_conn -> cluster_name ) ;
 global_last_rollup = check_time ;
 slurm_mutex_unlock ( & rollup_lock ) ;
 query = xstrdup_printf ( "update \"%s_%s\" set " "hourly_rollup=%ld, " "daily_rollup=%ld, monthly_rollup=%ld" , mysql_conn -> cluster_name , last_ran_table , check_time , check_time , check_time ) ;
 if ( debug_flags & DEBUG_FLAG_DB_JOB ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ;
 rc = mysql_db_query ( mysql_conn , query ) ;
 xfree ( query ) ;
 }
 else slurm_mutex_unlock ( & rollup_lock ) ;
 no_rollup_change : if ( job_ptr -> name && job_ptr -> name [ 0 ] ) jname = slurm_add_slash_to_quotes ( job_ptr -> name ) ;
 else {
 jname = xstrdup ( "allocation" ) ;
 track_steps = 1 ;
 }
 if ( job_ptr -> nodes && job_ptr -> nodes [ 0 ] ) nodes = job_ptr -> nodes ;
 else nodes = "None assigned" ;
 if ( job_ptr -> batch_flag ) track_steps = 1 ;
 if ( slurmdbd_conf ) {
 block_id = xstrdup ( job_ptr -> comment ) ;
 node_cnt = job_ptr -> total_nodes ;
 node_inx = job_ptr -> network ;
 }
 else {
 if ( job_ptr -> node_bitmap ) {
 node_inx = bit_fmt ( temp_bit , sizeof ( temp_bit ) , job_ptr -> node_bitmap ) ;
 }
 # ifdef HAVE_BG select_g_select_jobinfo_get ( job_ptr -> select_jobinfo , SELECT_JOBDATA_BLOCK_ID , & block_id ) ;
 select_g_select_jobinfo_get ( job_ptr -> select_jobinfo , SELECT_JOBDATA_NODE_CNT , & node_cnt ) ;
 # else node_cnt = job_ptr -> total_nodes ;
 # endif }
 if ( job_ptr -> assoc_id && ( ! job_ptr -> db_index || job_ptr -> wckey ) ) wckeyid = _get_wckeyid ( mysql_conn , & job_ptr -> wckey , job_ptr -> user_id , mysql_conn -> cluster_name , job_ptr -> assoc_id ) ;
 if ( ! IS_JOB_PENDING ( job_ptr ) && job_ptr -> part_ptr ) partition = slurm_add_slash_to_quotes ( job_ptr -> part_ptr -> name ) ;
 else if ( job_ptr -> partition ) partition = slurm_add_slash_to_quotes ( job_ptr -> partition ) ;
 if ( job_ptr -> gres_req ) gres_req = slurm_add_slash_to_quotes ( job_ptr -> gres_req ) ;
 if ( job_ptr -> gres_alloc ) gres_alloc = slurm_add_slash_to_quotes ( job_ptr -> gres_alloc ) ;
 if ( ! job_ptr -> db_index ) {
 query = xstrdup_printf ( "insert into \"%s_%s\" " "(id_job, mod_time, id_array_job, id_array_task, " "id_assoc, id_qos, id_user, " "id_group, nodelist, id_resv, timelimit, " "time_eligible, time_submit, time_start, " "job_name, track_steps, state, priority, cpus_req, " "nodes_alloc, mem_req" , mysql_conn -> cluster_name , job_table ) ;
 if ( wckeyid ) xstrcat ( query , ", id_wckey" ) ;
 if ( job_ptr -> account ) xstrcat ( query , ", account" ) ;
 if ( partition ) xstrcat ( query , ", `partition`" ) ;
 if ( block_id ) xstrcat ( query , ", id_block" ) ;
 if ( job_ptr -> wckey ) xstrcat ( query , ", wckey" ) ;
 if ( node_inx ) xstrcat ( query , ", node_inx" ) ;
 if ( gres_req ) xstrcat ( query , ", gres_req" ) ;
 if ( gres_alloc ) xstrcat ( query , ", gres_alloc" ) ;
 if ( array_recs && array_recs -> task_id_str ) xstrcat ( query , ", array_task_str, array_max_tasks, " "array_task_pending" ) ;
 else xstrcat ( query , ", array_task_str, array_task_pending" ) ;
 if ( job_ptr -> tres_alloc_str ) xstrcat ( query , ", tres_alloc" ) ;
 if ( job_ptr -> tres_req_str ) xstrcat ( query , ", tres_req" ) ;
 xstrfmtcat ( query , ") values (%u, UNIX_TIMESTAMP(), " "%u, %u, %u, %u, %u, %u, " "'%s', %u, %u, %ld, %ld, %ld, " "'%s', %u, %u, %u, %u, %u, %" PRIu64 "" , job_ptr -> job_id , job_ptr -> array_job_id , array_task_id , job_ptr -> assoc_id , job_ptr -> qos_id , job_ptr -> user_id , job_ptr -> group_id , nodes , job_ptr -> resv_id , job_ptr -> time_limit , begin_time , submit_time , start_time , jname , track_steps , job_state , job_ptr -> priority , job_ptr -> details -> min_cpus , node_cnt , job_ptr -> details -> pn_min_memory ) ;
 if ( wckeyid ) xstrfmtcat ( query , ", %u" , wckeyid ) ;
 if ( job_ptr -> account ) xstrfmtcat ( query , ", '%s'" , job_ptr -> account ) ;
 if ( partition ) xstrfmtcat ( query , ", '%s'" , partition ) ;
 if ( block_id ) xstrfmtcat ( query , ", '%s'" , block_id ) ;
 if ( job_ptr -> wckey ) xstrfmtcat ( query , ", '%s'" , job_ptr -> wckey ) ;
 if ( node_inx ) xstrfmtcat ( query , ", '%s'" , node_inx ) ;
 if ( gres_req ) xstrfmtcat ( query , ", '%s'" , gres_req ) ;
 if ( gres_alloc ) xstrfmtcat ( query , ", '%s'" , gres_alloc ) ;
 if ( array_recs && array_recs -> task_id_str ) xstrfmtcat ( query , ", '%s', %u, %u" , array_recs -> task_id_str , array_recs -> max_run_tasks , array_recs -> task_cnt ) ;
 else xstrcat ( query , ", NULL, 0" ) ;
 if ( job_ptr -> tres_alloc_str ) xstrfmtcat ( query , ", '%s'" , job_ptr -> tres_alloc_str ) ;
 if ( job_ptr -> tres_req_str ) xstrfmtcat ( query , ", '%s'" , job_ptr -> tres_req_str ) ;
 xstrfmtcat ( query , ") on duplicate key update " "job_db_inx=LAST_INSERT_ID(job_db_inx), " "id_user=%u, id_group=%u, " "nodelist='%s', id_resv=%u, timelimit=%u, " "time_submit=%ld, time_eligible=%ld, " "time_start=%ld, mod_time=UNIX_TIMESTAMP(), " "job_name='%s', track_steps=%u, id_qos=%u, " "state=greatest(state, %u), priority=%u, " "cpus_req=%u, nodes_alloc=%u, " "mem_req=%" PRIu64 ", id_array_job=%u, id_array_task=%u" , job_ptr -> user_id , job_ptr -> group_id , nodes , job_ptr -> resv_id , job_ptr -> time_limit , submit_time , begin_time , start_time , jname , track_steps , job_ptr -> qos_id , job_state , job_ptr -> priority , job_ptr -> details -> min_cpus , node_cnt , job_ptr -> details -> pn_min_memory , job_ptr -> array_job_id , array_task_id ) ;
 if ( wckeyid ) xstrfmtcat ( query , ", id_wckey=%u" , wckeyid ) ;
 if ( job_ptr -> account ) xstrfmtcat ( query , ", account='%s'" , job_ptr -> account ) ;
 if ( partition ) xstrfmtcat ( query , ", `partition`='%s'" , partition ) ;
 if ( block_id ) xstrfmtcat ( query , ", id_block='%s'" , block_id ) ;
 if ( job_ptr -> wckey ) xstrfmtcat ( query , ", wckey='%s'" , job_ptr -> wckey ) ;
 if ( node_inx ) xstrfmtcat ( query , ", node_inx='%s'" , node_inx ) ;
 if ( gres_req ) xstrfmtcat ( query , ", gres_req='%s'" , gres_req ) ;
 if ( gres_alloc ) xstrfmtcat ( query , ", gres_alloc='%s'" , gres_alloc ) ;
 if ( array_recs && array_recs -> task_id_str ) xstrfmtcat ( query , ", array_task_str='%s', " "array_max_tasks=%u, array_task_pending=%u" , array_recs -> task_id_str , array_recs -> max_run_tasks , array_recs -> task_cnt ) ;
 else xstrfmtcat ( query , ", array_task_str=NULL, " "array_task_pending=0" ) ;
 if ( job_ptr -> tres_alloc_str ) xstrfmtcat ( query , ", tres_alloc='%s'" , job_ptr -> tres_alloc_str ) ;
 if ( job_ptr -> tres_req_str ) xstrfmtcat ( query , ", tres_req='%s'" , job_ptr -> tres_req_str ) ;
 if ( debug_flags & DEBUG_FLAG_DB_JOB ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ;
 try_again : if ( ! ( job_ptr -> db_index = mysql_db_insert_ret_id ( mysql_conn , query ) ) ) {
 if ( ! reinit ) {
 error ( "It looks like the storage has gone " "away trying to reconnect" ) ;
 check_connection ( mysql_conn ) ;
 reinit = 1 ;
 goto try_again ;
 }
 else rc = SLURM_ERROR ;
 }
 }
 else {
 query = xstrdup_printf ( "update \"%s_%s\" set nodelist='%s', " , mysql_conn -> cluster_name , job_table , nodes ) ;
 if ( wckeyid ) xstrfmtcat ( query , "id_wckey=%u, " , wckeyid ) ;
 if ( job_ptr -> account ) xstrfmtcat ( query , "account='%s', " , job_ptr -> account ) ;
 if ( partition ) xstrfmtcat ( query , "`partition`='%s', " , partition ) ;
 if ( block_id ) xstrfmtcat ( query , "id_block='%s', " , block_id ) ;
 if ( job_ptr -> wckey ) xstrfmtcat ( query , "wckey='%s', " , job_ptr -> wckey ) ;
 if ( node_inx ) xstrfmtcat ( query , "node_inx='%s', " , node_inx ) ;
 if ( gres_req ) xstrfmtcat ( query , "gres_req='%s', " , gres_req ) ;
 if ( gres_alloc ) xstrfmtcat ( query , "gres_alloc='%s', " , gres_alloc ) ;
 if ( array_recs && array_recs -> task_id_str ) xstrfmtcat ( query , "array_task_str='%s', " "array_max_tasks=%u, " "array_task_pending=%u, " , array_recs -> task_id_str , array_recs -> max_run_tasks , array_recs -> task_cnt ) ;
 else xstrfmtcat ( query , "array_task_str=NULL, " "array_task_pending=0, " ) ;
 if ( job_ptr -> tres_alloc_str ) xstrfmtcat ( query , "tres_alloc='%s', " , job_ptr -> tres_alloc_str ) ;
 if ( job_ptr -> tres_req_str ) xstrfmtcat ( query , "tres_req='%s', " , job_ptr -> tres_req_str ) ;
 xstrfmtcat ( query , "time_start=%ld, job_name='%s', state=%u, " "nodes_alloc=%u, id_qos=%u, " "id_assoc=%u, id_resv=%u, " "timelimit=%u, mem_req=%" PRIu64 ", " "id_array_job=%u, id_array_task=%u, " "time_eligible=%ld, mod_time=UNIX_TIMESTAMP() " "where job_db_inx=%" PRIu64 , start_time , jname , job_state , node_cnt , job_ptr -> qos_id , job_ptr -> assoc_id , job_ptr -> resv_id , job_ptr -> time_limit , job_ptr -> details -> pn_min_memory , job_ptr -> array_job_id , array_task_id , begin_time , job_ptr -> db_index ) ;
 if ( debug_flags & DEBUG_FLAG_DB_JOB ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ;
 rc = mysql_db_query ( mysql_conn , query ) ;
 }
 xfree ( block_id ) ;
 xfree ( partition ) ;
 xfree ( gres_req ) ;
 xfree ( gres_alloc ) ;
 xfree ( jname ) ;
 xfree ( query ) ;
 if ( IS_JOB_RESIZING ( job_ptr ) ) {
 if ( IS_JOB_SUSPENDED ( job_ptr ) ) as_mysql_suspend ( mysql_conn , job_db_inx , job_ptr ) ;
 }
 return rc ;
 }


TfLiteStatus GreaterEqualEval(TfLiteContext* context, TfLiteNode* node) {
  const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
  const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2);
  TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
  bool requires_broadcast = !HaveSameShapes(input1, input2);
  switch (input1->type) {
    case kTfLiteFloat32:
      Comparison<float, reference_ops::GreaterEqualFn>(input1, input2, output,
                                                       requires_broadcast);
      break;
    case kTfLiteInt32:
      Comparison<int32_t, reference_ops::GreaterEqualFn>(input1, input2, output,
                                                         requires_broadcast);
      break;
    case kTfLiteInt64:
      Comparison<int64_t, reference_ops::GreaterEqualFn>(input1, input2, output,
                                                         requires_broadcast);
      break;
    case kTfLiteUInt8:
      ComparisonQuantized<uint8_t, reference_ops::GreaterEqualFn>(
          input1, input2, output, requires_broadcast);
      break;
    case kTfLiteInt8:
      ComparisonQuantized<int8_t, reference_ops::GreaterEqualFn>(
          input1, input2, output, requires_broadcast);
      break;
    default:
      context->ReportError(context,
                           "Does not support type %d, requires float|int|uint8",
                           input1->type);
      return kTfLiteError;
  }
  return kTfLiteOk;
}


static int t220_frontend_attach(struct dvb_usb_adapter *d)
{
	u8 obuf[3] = { 0xe, 0x87, 0 };
	u8 ibuf[] = { 0 };

	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
		err("command 0x0e transfer failed.");

	obuf[0] = 0xe;
	obuf[1] = 0x86;
	obuf[2] = 1;

	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
		err("command 0x0e transfer failed.");

	obuf[0] = 0xe;
	obuf[1] = 0x80;
	obuf[2] = 0;

	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
		err("command 0x0e transfer failed.");

	msleep(50);

	obuf[0] = 0xe;
	obuf[1] = 0x80;
	obuf[2] = 1;

	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
		err("command 0x0e transfer failed.");

	obuf[0] = 0x51;

	if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
		err("command 0x51 transfer failed.");

	d->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config,
					&d->dev->i2c_adap, NULL);
	if (d->fe_adap[0].fe != NULL) {
		if (dvb_attach(tda18271_attach, d->fe_adap[0].fe, 0x60,
					&d->dev->i2c_adap, &tda18271_config)) {
			info("Attached TDA18271HD/CXD2820R!");
			return 0;
		}
	}

	info("Failed to attach TDA18271HD/CXD2820R!");
	return -EIO;
}


void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info) { host_to_target_siginfo_noswap(tinfo, info); tswap_siginfo(tinfo, tinfo); }


static __inline__ int TLV_LIST_CHECK ( struct tlv_list_desc * list , __u16 exp_type ) {
 return TLV_CHECK ( list -> tlv_ptr , list -> tlv_space , exp_type ) ;
 }


int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type)
{
	struct hexline *hx;
	u8 *buf;
	int ret, pos = 0;
	u16 cpu_cs_register = cypress[type].cpu_cs_register;

	buf = kmalloc(sizeof(*hx), GFP_KERNEL);
	if (!buf)
		return -ENOMEM;
	hx = (struct hexline *)buf;

	/* stop the CPU */
	buf[0] = 1;
	if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1)
		err("could not stop the USB controller CPU.");

	while ((ret = dvb_usb_get_hexline(fw, hx, &pos)) > 0) {
		deb_fw("writing to address 0x%04x (buffer: 0x%02x %02x)\n", hx->addr, hx->len, hx->chk);
		ret = usb_cypress_writemem(udev, hx->addr, hx->data, hx->len);

		if (ret != hx->len) {
			err("error while transferring firmware (transferred size: %d, block size: %d)",
				ret, hx->len);
			ret = -EINVAL;
			break;
		}
	}
	if (ret < 0) {
		err("firmware download failed at %d with %d",pos,ret);
		kfree(buf);
		return ret;
	}

	if (ret == 0) {
		/* restart the CPU */
		buf[0] = 0;
		if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1) {
			err("could not restart the USB controller CPU.");
			ret = -EINVAL;
		}
	} else
		ret = -EIO;

	kfree(buf);

	return ret;
}


int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type)
{
	struct hexline *hx;
	u8 reset;
	int ret,pos=0;

	hx = kmalloc(sizeof(*hx), GFP_KERNEL);
	if (!hx)
		return -ENOMEM;

	/* stop the CPU */
	reset = 1;
	if ((ret = usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1)) != 1)
		err("could not stop the USB controller CPU.");

	while ((ret = dvb_usb_get_hexline(fw, hx, &pos)) > 0) {
		deb_fw("writing to address 0x%04x (buffer: 0x%02x %02x)\n", hx->addr, hx->len, hx->chk);
		ret = usb_cypress_writemem(udev, hx->addr, hx->data, hx->len);

		if (ret != hx->len) {
			err("error while transferring firmware (transferred size: %d, block size: %d)",
				ret, hx->len);
			ret = -EINVAL;
			break;
		}
	}
	if (ret < 0) {
		err("firmware download failed at %d with %d",pos,ret);
		kfree(hx);
		return ret;
	}

	if (ret == 0) {
		/* restart the CPU */
		reset = 0;
		if (ret || usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1) != 1) {
			err("could not restart the USB controller CPU.");
			ret = -EINVAL;
		}
	} else
		ret = -EIO;

	kfree(hx);

	return ret;
}


void vp9_idct32x32_1024_add_sse2 ( const int16_t * input , uint8_t * dest , int stride ) {
 const __m128i rounding = _mm_set1_epi32 ( DCT_CONST_ROUNDING ) ;
 const __m128i final_rounding = _mm_set1_epi16 ( 1 << 5 ) ;
 const __m128i zero = _mm_setzero_si128 ( ) ;
 const __m128i stg1_0 = pair_set_epi16 ( cospi_31_64 , - cospi_1_64 ) ;
 const __m128i stg1_1 = pair_set_epi16 ( cospi_1_64 , cospi_31_64 ) ;
 const __m128i stg1_2 = pair_set_epi16 ( cospi_15_64 , - cospi_17_64 ) ;
 const __m128i stg1_3 = pair_set_epi16 ( cospi_17_64 , cospi_15_64 ) ;
 const __m128i stg1_4 = pair_set_epi16 ( cospi_23_64 , - cospi_9_64 ) ;
 const __m128i stg1_5 = pair_set_epi16 ( cospi_9_64 , cospi_23_64 ) ;
 const __m128i stg1_6 = pair_set_epi16 ( cospi_7_64 , - cospi_25_64 ) ;
 const __m128i stg1_7 = pair_set_epi16 ( cospi_25_64 , cospi_7_64 ) ;
 const __m128i stg1_8 = pair_set_epi16 ( cospi_27_64 , - cospi_5_64 ) ;
 const __m128i stg1_9 = pair_set_epi16 ( cospi_5_64 , cospi_27_64 ) ;
 const __m128i stg1_10 = pair_set_epi16 ( cospi_11_64 , - cospi_21_64 ) ;
 const __m128i stg1_11 = pair_set_epi16 ( cospi_21_64 , cospi_11_64 ) ;
 const __m128i stg1_12 = pair_set_epi16 ( cospi_19_64 , - cospi_13_64 ) ;
 const __m128i stg1_13 = pair_set_epi16 ( cospi_13_64 , cospi_19_64 ) ;
 const __m128i stg1_14 = pair_set_epi16 ( cospi_3_64 , - cospi_29_64 ) ;
 const __m128i stg1_15 = pair_set_epi16 ( cospi_29_64 , cospi_3_64 ) ;
 const __m128i stg2_0 = pair_set_epi16 ( cospi_30_64 , - cospi_2_64 ) ;
 const __m128i stg2_1 = pair_set_epi16 ( cospi_2_64 , cospi_30_64 ) ;
 const __m128i stg2_2 = pair_set_epi16 ( cospi_14_64 , - cospi_18_64 ) ;
 const __m128i stg2_3 = pair_set_epi16 ( cospi_18_64 , cospi_14_64 ) ;
 const __m128i stg2_4 = pair_set_epi16 ( cospi_22_64 , - cospi_10_64 ) ;
 const __m128i stg2_5 = pair_set_epi16 ( cospi_10_64 , cospi_22_64 ) ;
 const __m128i stg2_6 = pair_set_epi16 ( cospi_6_64 , - cospi_26_64 ) ;
 const __m128i stg2_7 = pair_set_epi16 ( cospi_26_64 , cospi_6_64 ) ;
 const __m128i stg3_0 = pair_set_epi16 ( cospi_28_64 , - cospi_4_64 ) ;
 const __m128i stg3_1 = pair_set_epi16 ( cospi_4_64 , cospi_28_64 ) ;
 const __m128i stg3_2 = pair_set_epi16 ( cospi_12_64 , - cospi_20_64 ) ;
 const __m128i stg3_3 = pair_set_epi16 ( cospi_20_64 , cospi_12_64 ) ;
 const __m128i stg3_4 = pair_set_epi16 ( - cospi_4_64 , cospi_28_64 ) ;
 const __m128i stg3_5 = pair_set_epi16 ( cospi_28_64 , cospi_4_64 ) ;
 const __m128i stg3_6 = pair_set_epi16 ( - cospi_28_64 , - cospi_4_64 ) ;
 const __m128i stg3_8 = pair_set_epi16 ( - cospi_20_64 , cospi_12_64 ) ;
 const __m128i stg3_9 = pair_set_epi16 ( cospi_12_64 , cospi_20_64 ) ;
 const __m128i stg3_10 = pair_set_epi16 ( - cospi_12_64 , - cospi_20_64 ) ;
 const __m128i stg4_0 = pair_set_epi16 ( cospi_16_64 , cospi_16_64 ) ;
 const __m128i stg4_1 = pair_set_epi16 ( cospi_16_64 , - cospi_16_64 ) ;
 const __m128i stg4_2 = pair_set_epi16 ( cospi_24_64 , - cospi_8_64 ) ;
 const __m128i stg4_3 = pair_set_epi16 ( cospi_8_64 , cospi_24_64 ) ;
 const __m128i stg4_4 = pair_set_epi16 ( - cospi_8_64 , cospi_24_64 ) ;
 const __m128i stg4_5 = pair_set_epi16 ( cospi_24_64 , cospi_8_64 ) ;
 const __m128i stg4_6 = pair_set_epi16 ( - cospi_24_64 , - cospi_8_64 ) ;
 const __m128i stg6_0 = pair_set_epi16 ( - cospi_16_64 , cospi_16_64 ) ;
 __m128i in [ 32 ] , col [ 128 ] , zero_idx [ 16 ] ;
 __m128i stp1_0 , stp1_1 , stp1_2 , stp1_3 , stp1_4 , stp1_5 , stp1_6 , stp1_7 , stp1_8 , stp1_9 , stp1_10 , stp1_11 , stp1_12 , stp1_13 , stp1_14 , stp1_15 , stp1_16 , stp1_17 , stp1_18 , stp1_19 , stp1_20 , stp1_21 , stp1_22 , stp1_23 , stp1_24 , stp1_25 , stp1_26 , stp1_27 , stp1_28 , stp1_29 , stp1_30 , stp1_31 ;
 __m128i stp2_0 , stp2_1 , stp2_2 , stp2_3 , stp2_4 , stp2_5 , stp2_6 , stp2_7 , stp2_8 , stp2_9 , stp2_10 , stp2_11 , stp2_12 , stp2_13 , stp2_14 , stp2_15 , stp2_16 , stp2_17 , stp2_18 , stp2_19 , stp2_20 , stp2_21 , stp2_22 , stp2_23 , stp2_24 , stp2_25 , stp2_26 , stp2_27 , stp2_28 , stp2_29 , stp2_30 , stp2_31 ;
 __m128i tmp0 , tmp1 , tmp2 , tmp3 , tmp4 , tmp5 , tmp6 , tmp7 ;
 int i , j , i32 ;
 for ( i = 0 ;
 i < 4 ;
 i ++ ) {
 i32 = ( i << 5 ) ;
 LOAD_DQCOEFF ( in [ 0 ] , input ) ;
 LOAD_DQCOEFF ( in [ 8 ] , input ) ;
 LOAD_DQCOEFF ( in [ 16 ] , input ) ;
 LOAD_DQCOEFF ( in [ 24 ] , input ) ;
 LOAD_DQCOEFF ( in [ 1 ] , input ) ;
 LOAD_DQCOEFF ( in [ 9 ] , input ) ;
 LOAD_DQCOEFF ( in [ 17 ] , input ) ;
 LOAD_DQCOEFF ( in [ 25 ] , input ) ;
 LOAD_DQCOEFF ( in [ 2 ] , input ) ;
 LOAD_DQCOEFF ( in [ 10 ] , input ) ;
 LOAD_DQCOEFF ( in [ 18 ] , input ) ;
 LOAD_DQCOEFF ( in [ 26 ] , input ) ;
 LOAD_DQCOEFF ( in [ 3 ] , input ) ;
 LOAD_DQCOEFF ( in [ 11 ] , input ) ;
 LOAD_DQCOEFF ( in [ 19 ] , input ) ;
 LOAD_DQCOEFF ( in [ 27 ] , input ) ;
 LOAD_DQCOEFF ( in [ 4 ] , input ) ;
 LOAD_DQCOEFF ( in [ 12 ] , input ) ;
 LOAD_DQCOEFF ( in [ 20 ] , input ) ;
 LOAD_DQCOEFF ( in [ 28 ] , input ) ;
 LOAD_DQCOEFF ( in [ 5 ] , input ) ;
 LOAD_DQCOEFF ( in [ 13 ] , input ) ;
 LOAD_DQCOEFF ( in [ 21 ] , input ) ;
 LOAD_DQCOEFF ( in [ 29 ] , input ) ;
 LOAD_DQCOEFF ( in [ 6 ] , input ) ;
 LOAD_DQCOEFF ( in [ 14 ] , input ) ;
 LOAD_DQCOEFF ( in [ 22 ] , input ) ;
 LOAD_DQCOEFF ( in [ 30 ] , input ) ;
 LOAD_DQCOEFF ( in [ 7 ] , input ) ;
 LOAD_DQCOEFF ( in [ 15 ] , input ) ;
 LOAD_DQCOEFF ( in [ 23 ] , input ) ;
 LOAD_DQCOEFF ( in [ 31 ] , input ) ;
 zero_idx [ 0 ] = _mm_or_si128 ( in [ 0 ] , in [ 1 ] ) ;
 zero_idx [ 1 ] = _mm_or_si128 ( in [ 2 ] , in [ 3 ] ) ;
 zero_idx [ 2 ] = _mm_or_si128 ( in [ 4 ] , in [ 5 ] ) ;
 zero_idx [ 3 ] = _mm_or_si128 ( in [ 6 ] , in [ 7 ] ) ;
 zero_idx [ 4 ] = _mm_or_si128 ( in [ 8 ] , in [ 9 ] ) ;
 zero_idx [ 5 ] = _mm_or_si128 ( in [ 10 ] , in [ 11 ] ) ;
 zero_idx [ 6 ] = _mm_or_si128 ( in [ 12 ] , in [ 13 ] ) ;
 zero_idx [ 7 ] = _mm_or_si128 ( in [ 14 ] , in [ 15 ] ) ;
 zero_idx [ 8 ] = _mm_or_si128 ( in [ 16 ] , in [ 17 ] ) ;
 zero_idx [ 9 ] = _mm_or_si128 ( in [ 18 ] , in [ 19 ] ) ;
 zero_idx [ 10 ] = _mm_or_si128 ( in [ 20 ] , in [ 21 ] ) ;
 zero_idx [ 11 ] = _mm_or_si128 ( in [ 22 ] , in [ 23 ] ) ;
 zero_idx [ 12 ] = _mm_or_si128 ( in [ 24 ] , in [ 25 ] ) ;
 zero_idx [ 13 ] = _mm_or_si128 ( in [ 26 ] , in [ 27 ] ) ;
 zero_idx [ 14 ] = _mm_or_si128 ( in [ 28 ] , in [ 29 ] ) ;
 zero_idx [ 15 ] = _mm_or_si128 ( in [ 30 ] , in [ 31 ] ) ;
 zero_idx [ 0 ] = _mm_or_si128 ( zero_idx [ 0 ] , zero_idx [ 1 ] ) ;
 zero_idx [ 1 ] = _mm_or_si128 ( zero_idx [ 2 ] , zero_idx [ 3 ] ) ;
 zero_idx [ 2 ] = _mm_or_si128 ( zero_idx [ 4 ] , zero_idx [ 5 ] ) ;
 zero_idx [ 3 ] = _mm_or_si128 ( zero_idx [ 6 ] , zero_idx [ 7 ] ) ;
 zero_idx [ 4 ] = _mm_or_si128 ( zero_idx [ 8 ] , zero_idx [ 9 ] ) ;
 zero_idx [ 5 ] = _mm_or_si128 ( zero_idx [ 10 ] , zero_idx [ 11 ] ) ;
 zero_idx [ 6 ] = _mm_or_si128 ( zero_idx [ 12 ] , zero_idx [ 13 ] ) ;
 zero_idx [ 7 ] = _mm_or_si128 ( zero_idx [ 14 ] , zero_idx [ 15 ] ) ;
 zero_idx [ 8 ] = _mm_or_si128 ( zero_idx [ 0 ] , zero_idx [ 1 ] ) ;
 zero_idx [ 9 ] = _mm_or_si128 ( zero_idx [ 2 ] , zero_idx [ 3 ] ) ;
 zero_idx [ 10 ] = _mm_or_si128 ( zero_idx [ 4 ] , zero_idx [ 5 ] ) ;
 zero_idx [ 11 ] = _mm_or_si128 ( zero_idx [ 6 ] , zero_idx [ 7 ] ) ;
 zero_idx [ 12 ] = _mm_or_si128 ( zero_idx [ 8 ] , zero_idx [ 9 ] ) ;
 zero_idx [ 13 ] = _mm_or_si128 ( zero_idx [ 10 ] , zero_idx [ 11 ] ) ;
 zero_idx [ 14 ] = _mm_or_si128 ( zero_idx [ 12 ] , zero_idx [ 13 ] ) ;
 if ( _mm_movemask_epi8 ( _mm_cmpeq_epi32 ( zero_idx [ 14 ] , zero ) ) == 0xFFFF ) {
 col [ i32 + 0 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 1 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 2 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 3 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 4 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 5 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 6 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 7 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 8 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 9 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 10 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 11 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 12 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 13 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 14 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 15 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 16 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 17 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 18 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 19 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 20 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 21 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 22 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 23 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 24 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 25 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 26 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 27 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 28 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 29 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 30 ] = _mm_setzero_si128 ( ) ;
 col [ i32 + 31 ] = _mm_setzero_si128 ( ) ;
 continue ;
 }
 array_transpose_8x8 ( in , in ) ;
 array_transpose_8x8 ( in + 8 , in + 8 ) ;
 array_transpose_8x8 ( in + 16 , in + 16 ) ;
 array_transpose_8x8 ( in + 24 , in + 24 ) ;
 IDCT32 col [ i32 + 0 ] = _mm_add_epi16 ( stp1_0 , stp1_31 ) ;
 col [ i32 + 1 ] = _mm_add_epi16 ( stp1_1 , stp1_30 ) ;
 col [ i32 + 2 ] = _mm_add_epi16 ( stp1_2 , stp1_29 ) ;
 col [ i32 + 3 ] = _mm_add_epi16 ( stp1_3 , stp1_28 ) ;
 col [ i32 + 4 ] = _mm_add_epi16 ( stp1_4 , stp1_27 ) ;
 col [ i32 + 5 ] = _mm_add_epi16 ( stp1_5 , stp1_26 ) ;
 col [ i32 + 6 ] = _mm_add_epi16 ( stp1_6 , stp1_25 ) ;
 col [ i32 + 7 ] = _mm_add_epi16 ( stp1_7 , stp1_24 ) ;
 col [ i32 + 8 ] = _mm_add_epi16 ( stp1_8 , stp1_23 ) ;
 col [ i32 + 9 ] = _mm_add_epi16 ( stp1_9 , stp1_22 ) ;
 col [ i32 + 10 ] = _mm_add_epi16 ( stp1_10 , stp1_21 ) ;
 col [ i32 + 11 ] = _mm_add_epi16 ( stp1_11 , stp1_20 ) ;
 col [ i32 + 12 ] = _mm_add_epi16 ( stp1_12 , stp1_19 ) ;
 col [ i32 + 13 ] = _mm_add_epi16 ( stp1_13 , stp1_18 ) ;
 col [ i32 + 14 ] = _mm_add_epi16 ( stp1_14 , stp1_17 ) ;
 col [ i32 + 15 ] = _mm_add_epi16 ( stp1_15 , stp1_16 ) ;
 col [ i32 + 16 ] = _mm_sub_epi16 ( stp1_15 , stp1_16 ) ;
 col [ i32 + 17 ] = _mm_sub_epi16 ( stp1_14 , stp1_17 ) ;
 col [ i32 + 18 ] = _mm_sub_epi16 ( stp1_13 , stp1_18 ) ;
 col [ i32 + 19 ] = _mm_sub_epi16 ( stp1_12 , stp1_19 ) ;
 col [ i32 + 20 ] = _mm_sub_epi16 ( stp1_11 , stp1_20 ) ;
 col [ i32 + 21 ] = _mm_sub_epi16 ( stp1_10 , stp1_21 ) ;
 col [ i32 + 22 ] = _mm_sub_epi16 ( stp1_9 , stp1_22 ) ;
 col [ i32 + 23 ] = _mm_sub_epi16 ( stp1_8 , stp1_23 ) ;
 col [ i32 + 24 ] = _mm_sub_epi16 ( stp1_7 , stp1_24 ) ;
 col [ i32 + 25 ] = _mm_sub_epi16 ( stp1_6 , stp1_25 ) ;
 col [ i32 + 26 ] = _mm_sub_epi16 ( stp1_5 , stp1_26 ) ;
 col [ i32 + 27 ] = _mm_sub_epi16 ( stp1_4 , stp1_27 ) ;
 col [ i32 + 28 ] = _mm_sub_epi16 ( stp1_3 , stp1_28 ) ;
 col [ i32 + 29 ] = _mm_sub_epi16 ( stp1_2 , stp1_29 ) ;
 col [ i32 + 30 ] = _mm_sub_epi16 ( stp1_1 , stp1_30 ) ;
 col [ i32 + 31 ] = _mm_sub_epi16 ( stp1_0 , stp1_31 ) ;
 }
 for ( i = 0 ;
 i < 4 ;
 i ++ ) {
 j = i << 3 ;
 array_transpose_8x8 ( col + j , in ) ;
 array_transpose_8x8 ( col + j + 32 , in + 8 ) ;
 array_transpose_8x8 ( col + j + 64 , in + 16 ) ;
 array_transpose_8x8 ( col + j + 96 , in + 24 ) ;
 IDCT32 in [ 0 ] = _mm_add_epi16 ( stp1_0 , stp1_31 ) ;
 in [ 1 ] = _mm_add_epi16 ( stp1_1 , stp1_30 ) ;
 in [ 2 ] = _mm_add_epi16 ( stp1_2 , stp1_29 ) ;
 in [ 3 ] = _mm_add_epi16 ( stp1_3 , stp1_28 ) ;
 in [ 4 ] = _mm_add_epi16 ( stp1_4 , stp1_27 ) ;
 in [ 5 ] = _mm_add_epi16 ( stp1_5 , stp1_26 ) ;
 in [ 6 ] = _mm_add_epi16 ( stp1_6 , stp1_25 ) ;
 in [ 7 ] = _mm_add_epi16 ( stp1_7 , stp1_24 ) ;
 in [ 8 ] = _mm_add_epi16 ( stp1_8 , stp1_23 ) ;
 in [ 9 ] = _mm_add_epi16 ( stp1_9 , stp1_22 ) ;
 in [ 10 ] = _mm_add_epi16 ( stp1_10 , stp1_21 ) ;
 in [ 11 ] = _mm_add_epi16 ( stp1_11 , stp1_20 ) ;
 in [ 12 ] = _mm_add_epi16 ( stp1_12 , stp1_19 ) ;
 in [ 13 ] = _mm_add_epi16 ( stp1_13 , stp1_18 ) ;
 in [ 14 ] = _mm_add_epi16 ( stp1_14 , stp1_17 ) ;
 in [ 15 ] = _mm_add_epi16 ( stp1_15 , stp1_16 ) ;
 in [ 16 ] = _mm_sub_epi16 ( stp1_15 , stp1_16 ) ;
 in [ 17 ] = _mm_sub_epi16 ( stp1_14 , stp1_17 ) ;
 in [ 18 ] = _mm_sub_epi16 ( stp1_13 , stp1_18 ) ;
 in [ 19 ] = _mm_sub_epi16 ( stp1_12 , stp1_19 ) ;
 in [ 20 ] = _mm_sub_epi16 ( stp1_11 , stp1_20 ) ;
 in [ 21 ] = _mm_sub_epi16 ( stp1_10 , stp1_21 ) ;
 in [ 22 ] = _mm_sub_epi16 ( stp1_9 , stp1_22 ) ;
 in [ 23 ] = _mm_sub_epi16 ( stp1_8 , stp1_23 ) ;
 in [ 24 ] = _mm_sub_epi16 ( stp1_7 , stp1_24 ) ;
 in [ 25 ] = _mm_sub_epi16 ( stp1_6 , stp1_25 ) ;
 in [ 26 ] = _mm_sub_epi16 ( stp1_5 , stp1_26 ) ;
 in [ 27 ] = _mm_sub_epi16 ( stp1_4 , stp1_27 ) ;
 in [ 28 ] = _mm_sub_epi16 ( stp1_3 , stp1_28 ) ;
 in [ 29 ] = _mm_sub_epi16 ( stp1_2 , stp1_29 ) ;
 in [ 30 ] = _mm_sub_epi16 ( stp1_1 , stp1_30 ) ;
 in [ 31 ] = _mm_sub_epi16 ( stp1_0 , stp1_31 ) ;
 in [ 0 ] = _mm_adds_epi16 ( in [ 0 ] , final_rounding ) ;
 in [ 1 ] = _mm_adds_epi16 ( in [ 1 ] , final_rounding ) ;
 in [ 2 ] = _mm_adds_epi16 ( in [ 2 ] , final_rounding ) ;
 in [ 3 ] = _mm_adds_epi16 ( in [ 3 ] , final_rounding ) ;
 in [ 4 ] = _mm_adds_epi16 ( in [ 4 ] , final_rounding ) ;
 in [ 5 ] = _mm_adds_epi16 ( in [ 5 ] , final_rounding ) ;
 in [ 6 ] = _mm_adds_epi16 ( in [ 6 ] , final_rounding ) ;
 in [ 7 ] = _mm_adds_epi16 ( in [ 7 ] , final_rounding ) ;
 in [ 8 ] = _mm_adds_epi16 ( in [ 8 ] , final_rounding ) ;
 in [ 9 ] = _mm_adds_epi16 ( in [ 9 ] , final_rounding ) ;
 in [ 10 ] = _mm_adds_epi16 ( in [ 10 ] , final_rounding ) ;
 in [ 11 ] = _mm_adds_epi16 ( in [ 11 ] , final_rounding ) ;
 in [ 12 ] = _mm_adds_epi16 ( in [ 12 ] , final_rounding ) ;
 in [ 13 ] = _mm_adds_epi16 ( in [ 13 ] , final_rounding ) ;
 in [ 14 ] = _mm_adds_epi16 ( in [ 14 ] , final_rounding ) ;
 in [ 15 ] = _mm_adds_epi16 ( in [ 15 ] , final_rounding ) ;
 in [ 16 ] = _mm_adds_epi16 ( in [ 16 ] , final_rounding ) ;
 in [ 17 ] = _mm_adds_epi16 ( in [ 17 ] , final_rounding ) ;
 in [ 18 ] = _mm_adds_epi16 ( in [ 18 ] , final_rounding ) ;
 in [ 19 ] = _mm_adds_epi16 ( in [ 19 ] , final_rounding ) ;
 in [ 20 ] = _mm_adds_epi16 ( in [ 20 ] , final_rounding ) ;
 in [ 21 ] = _mm_adds_epi16 ( in [ 21 ] , final_rounding ) ;
 in [ 22 ] = _mm_adds_epi16 ( in [ 22 ] , final_rounding ) ;
 in [ 23 ] = _mm_adds_epi16 ( in [ 23 ] , final_rounding ) ;
 in [ 24 ] = _mm_adds_epi16 ( in [ 24 ] , final_rounding ) ;
 in [ 25 ] = _mm_adds_epi16 ( in [ 25 ] , final_rounding ) ;
 in [ 26 ] = _mm_adds_epi16 ( in [ 26 ] , final_rounding ) ;
 in [ 27 ] = _mm_adds_epi16 ( in [ 27 ] , final_rounding ) ;
 in [ 28 ] = _mm_adds_epi16 ( in [ 28 ] , final_rounding ) ;
 in [ 29 ] = _mm_adds_epi16 ( in [ 29 ] , final_rounding ) ;
 in [ 30 ] = _mm_adds_epi16 ( in [ 30 ] , final_rounding ) ;
 in [ 31 ] = _mm_adds_epi16 ( in [ 31 ] , final_rounding ) ;
 in [ 0 ] = _mm_srai_epi16 ( in [ 0 ] , 6 ) ;
 in [ 1 ] = _mm_srai_epi16 ( in [ 1 ] , 6 ) ;
 in [ 2 ] = _mm_srai_epi16 ( in [ 2 ] , 6 ) ;
 in [ 3 ] = _mm_srai_epi16 ( in [ 3 ] , 6 ) ;
 in [ 4 ] = _mm_srai_epi16 ( in [ 4 ] , 6 ) ;
 in [ 5 ] = _mm_srai_epi16 ( in [ 5 ] , 6 ) ;
 in [ 6 ] = _mm_srai_epi16 ( in [ 6 ] , 6 ) ;
 in [ 7 ] = _mm_srai_epi16 ( in [ 7 ] , 6 ) ;
 in [ 8 ] = _mm_srai_epi16 ( in [ 8 ] , 6 ) ;
 in [ 9 ] = _mm_srai_epi16 ( in [ 9 ] , 6 ) ;
 in [ 10 ] = _mm_srai_epi16 ( in [ 10 ] , 6 ) ;
 in [ 11 ] = _mm_srai_epi16 ( in [ 11 ] , 6 ) ;
 in [ 12 ] = _mm_srai_epi16 ( in [ 12 ] , 6 ) ;
 in [ 13 ] = _mm_srai_epi16 ( in [ 13 ] , 6 ) ;
 in [ 14 ] = _mm_srai_epi16 ( in [ 14 ] , 6 ) ;
 in [ 15 ] = _mm_srai_epi16 ( in [ 15 ] , 6 ) ;
 in [ 16 ] = _mm_srai_epi16 ( in [ 16 ] , 6 ) ;
 in [ 17 ] = _mm_srai_epi16 ( in [ 17 ] , 6 ) ;
 in [ 18 ] = _mm_srai_epi16 ( in [ 18 ] , 6 ) ;
 in [ 19 ] = _mm_srai_epi16 ( in [ 19 ] , 6 ) ;
 in [ 20 ] = _mm_srai_epi16 ( in [ 20 ] , 6 ) ;
 in [ 21 ] = _mm_srai_epi16 ( in [ 21 ] , 6 ) ;
 in [ 22 ] = _mm_srai_epi16 ( in [ 22 ] , 6 ) ;
 in [ 23 ] = _mm_srai_epi16 ( in [ 23 ] , 6 ) ;
 in [ 24 ] = _mm_srai_epi16 ( in [ 24 ] , 6 ) ;
 in [ 25 ] = _mm_srai_epi16 ( in [ 25 ] , 6 ) ;
 in [ 26 ] = _mm_srai_epi16 ( in [ 26 ] , 6 ) ;
 in [ 27 ] = _mm_srai_epi16 ( in [ 27 ] , 6 ) ;
 in [ 28 ] = _mm_srai_epi16 ( in [ 28 ] , 6 ) ;
 in [ 29 ] = _mm_srai_epi16 ( in [ 29 ] , 6 ) ;
 in [ 30 ] = _mm_srai_epi16 ( in [ 30 ] , 6 ) ;
 in [ 31 ] = _mm_srai_epi16 ( in [ 31 ] , 6 ) ;
 RECON_AND_STORE ( dest , in [ 0 ] ) ;
 RECON_AND_STORE ( dest , in [ 1 ] ) ;
 RECON_AND_STORE ( dest , in [ 2 ] ) ;
 RECON_AND_STORE ( dest , in [ 3 ] ) ;
 RECON_AND_STORE ( dest , in [ 4 ] ) ;
 RECON_AND_STORE ( dest , in [ 5 ] ) ;
 RECON_AND_STORE ( dest , in [ 6 ] ) ;
 RECON_AND_STORE ( dest , in [ 7 ] ) ;
 RECON_AND_STORE ( dest , in [ 8 ] ) ;
 RECON_AND_STORE ( dest , in [ 9 ] ) ;
 RECON_AND_STORE ( dest , in [ 10 ] ) ;
 RECON_AND_STORE ( dest , in [ 11 ] ) ;
 RECON_AND_STORE ( dest , in [ 12 ] ) ;
 RECON_AND_STORE ( dest , in [ 13 ] ) ;
 RECON_AND_STORE ( dest , in [ 14 ] ) ;
 RECON_AND_STORE ( dest , in [ 15 ] ) ;
 RECON_AND_STORE ( dest , in [ 16 ] ) ;
 RECON_AND_STORE ( dest , in [ 17 ] ) ;
 RECON_AND_STORE ( dest , in [ 18 ] ) ;
 RECON_AND_STORE ( dest , in [ 19 ] ) ;
 RECON_AND_STORE ( dest , in [ 20 ] ) ;
 RECON_AND_STORE ( dest , in [ 21 ] ) ;
 RECON_AND_STORE ( dest , in [ 22 ] ) ;
 RECON_AND_STORE ( dest , in [ 23 ] ) ;
 RECON_AND_STORE ( dest , in [ 24 ] ) ;
 RECON_AND_STORE ( dest , in [ 25 ] ) ;
 RECON_AND_STORE ( dest , in [ 26 ] ) ;
 RECON_AND_STORE ( dest , in [ 27 ] ) ;
 RECON_AND_STORE ( dest , in [ 28 ] ) ;
 RECON_AND_STORE ( dest , in [ 29 ] ) ;
 RECON_AND_STORE ( dest , in [ 30 ] ) ;
 RECON_AND_STORE ( dest , in [ 31 ] ) ;
 dest += 8 - ( stride * 32 ) ;
 }
 }


file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
    int mode, int text)
{
	struct mlist *ml;
	int rv;
	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
		if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
		    text, 0, NULL)) != 0)
			return rv;

	return 0;
}