WORD32 ih264d_parse_bmb_cavlc(dec_struct_t * ps_dec,
 dec_mb_info_t * ps_cur_mb_info,
                              UWORD8 u1_mb_num,
                              UWORD8 u1_num_mbsNby2)
{
    UWORD32 u4_cbp;
 deblk_mb_t * ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_mb_num;
 dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
    UWORD32 * pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
 const UWORD8 *puc_mb_mc_mode = (const UWORD8 *)gau1_ih264d_mb_mc_mode;
    UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type;

    WORD32 ret;
    UWORD8 u1_Bdirect_tranform_read = 1;
    ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag = 1;
    ps_cur_mb_info->u1_tran_form8x8 = 0;
    ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;

    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;

    ps_cur_mb_info->u1_mb_mc_mode = puc_mb_mc_mode[5 + u1_mb_type];

    ps_cur_deblk_mb->u1_mb_type |= D_B_SLICE;
 if(u1_mb_type != B_DIRECT)
 {
        ret = ih264d_parse_bmb_non_direct_cavlc(ps_dec, ps_cur_mb_info, u1_mb_num,
                                          u1_num_mbsNby2);
 if(ret != OK)
 return ret;
 }
 else
 {
 /************ STORING PARTITION INFO ***********/
 parse_part_params_t * ps_part_info;
        ps_part_info = ps_dec->ps_part;
        ps_part_info->u1_is_direct = PART_DIRECT_16x16;
        ps_part_info->u1_sub_mb_num = 0;
        ps_dec->ps_part++;
 /* check whether transform8x8 u4_flag to be read or not */
        u1_Bdirect_tranform_read =
                        ps_dec->s_high_profile.u1_direct_8x8_inference_flag;
 }

 /* Read the Coded block pattern */
 {
 const UWORD8 * puc_CbpInter = gau1_ih264d_cbp_inter;
        UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
        UWORD32 u4_word, u4_ldz;

 /***************************************************************/
 /* Find leading zeros in next 32 bits                          */
 /***************************************************************/
        NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
        u4_ldz = CLZ(u4_word);
 /* Flush the ps_bitstrm */
        u4_bitstream_offset += (u4_ldz + 1);
 /* Read the suffix from the ps_bitstrm */
        u4_word = 0;
 if(u4_ldz)
            GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
 *pu4_bitstrm_ofst = u4_bitstream_offset;
        u4_cbp = ((1 << u4_ldz) + u4_word - 1);
 if(u4_cbp > 47)
 return ERROR_CBP;
        u4_cbp = puc_CbpInter[u4_cbp];

 if((ps_dec->s_high_profile.u1_transform8x8_present) && (u4_cbp & (0xf))
 && (ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag)
 && (u1_Bdirect_tranform_read))
 {
            ps_cur_mb_info->u1_tran_form8x8 = ih264d_get_bit_h264(ps_bitstrm);
            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
 }

 }

    COPYTHECONTEXT("coded_block_pattern", u4_cbp);
    ps_cur_mb_info->u1_cbp = u4_cbp;

 /* Read mb_qp_delta */
 if(u4_cbp)
 {
        WORD32 i_temp;

        UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
        UWORD32 u4_word, u4_ldz, u4_abs_val;

 /***************************************************************/
 /* Find leading zeros in next 32 bits                          */
 /***************************************************************/
        NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
        u4_ldz = CLZ(u4_word);

 /* Flush the ps_bitstrm */
        u4_bitstream_offset += (u4_ldz + 1);

 /* Read the suffix from the ps_bitstrm */
        u4_word = 0;
 if(u4_ldz)
            GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);

 *pu4_bitstrm_ofst = u4_bitstream_offset;
        u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;

 if(u4_word & 0x1)
            i_temp = (-(WORD32)u4_abs_val);
 else
            i_temp = (u4_abs_val);

 if(i_temp < -26 || i_temp > 25)
 return ERROR_INV_RANGE_QP_T;
        COPYTHECONTEXT("mb_qp_delta", i_temp);
 if(i_temp)
 {
            ret = ih264d_update_qp(ps_dec, (WORD8)i_temp);
 if(ret != OK)
 return ret;
 }

        ret = ih264d_parse_residual4x4_cavlc(ps_dec, ps_cur_mb_info, 0);
 if(ret != OK)
 return ret;
 if(EXCEED_OFFSET(ps_bitstrm))
 return ERROR_EOB_TERMINATE_T;
 }
 else
 {
        ps_dec->i1_prev_mb_qp_delta = 0;
        ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC);
 }

 return OK;
}


static int dissect_q931_ie_cs7 ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) {
 dissect_q931_IEs ( tvb , pinfo , NULL , tree , FALSE , 0 , 7 ) ;
 return tvb_captured_length ( tvb ) ;
 }


void ConfigHelper::setDownstreamMaxRequestsPerConnection(uint64_t max_requests_per_connection) {
  addConfigModifier(
      [max_requests_per_connection](
          envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager&
              hcm) {
        hcm.mutable_common_http_protocol_options()
            ->mutable_max_requests_per_connection()
            ->set_value(max_requests_per_connection);
      });
}


void RenderView::OnMediaPlayerActionAt(const gfx::Point& location,
                                       const WebMediaPlayerAction& action) {
  if (webview())
    webview()->performMediaPlayerAction(action, location);
}


static int hashcieabcspace(i_ctx_t * i_ctx_p, ref *space, gs_md5_state_t *md5)
{
    int code = 0;
    ref CIEdict1, spacename;

    code = array_get(imemory, space, 0, &spacename);
    if (code < 0)
        return 0;
    gs_md5_append(md5, (const gs_md5_byte_t *)&spacename.value.pname, sizeof(spacename.value.pname));

    code = array_get(imemory, space, 1, &CIEdict1);
    if (code < 0)
        return 0;
    if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)"WhitePoint", md5))
        return 0;
    if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)"BlackPoint", md5))
        return 0;
    if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)"RangeABC", md5))
        return 0;
    if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)"DecodeABC", md5))
        return 0;
    if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)"MatrixABC", md5))
        return 0;
    if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)"RangeLMN", md5))
        return 0;
    if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)"DecodeLMN", md5))
        return 0;
    if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)"MatrixMN", md5))
        return 0;
    return 1;
}


flatpak_transaction_get_include_unused_uninstall_ops (FlatpakTransaction *self)
{
  FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (self);

  return priv->include_unused_uninstall_ops;
}


void hw_perf_event_setup(int cpu)
{
	struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);

	memset(cpuhw, 0, sizeof(*cpuhw));
}


std::string get_program_invocation(const std::string& program_name) {
#ifdef DEBUG
  #ifdef _WIN32
	const char *program_suffix = "-debug.exe";
  #else
	const char *program_suffix = "-debug";
  #endif
#else
  #ifdef _WIN32
	const char *program_suffix = ".exe";
  #else
	const char *program_suffix = "";
  #endif
#endif

	const std::string real_program_name(program_name + program_suffix);
	if(game_config::wesnoth_program_dir.empty()) return real_program_name;
#ifdef _WIN32
	return game_config::wesnoth_program_dir + "\\" + real_program_name;
#else
	return game_config::wesnoth_program_dir + "/" + real_program_name;
#endif
}


DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)

{

    const char *buf;

    const char *file = NULL;

    char devname[128];

    const char *serial;

    const char *mediastr = "";

    BlockInterfaceType type;

    enum { MEDIA_DISK, MEDIA_CDROM } media;

    int bus_id, unit_id;

    int cyls, heads, secs, translation;

    BlockDriver *drv = NULL;

    int max_devs;

    int index;

    int ro = 0;

    int bdrv_flags = 0;

    int on_read_error, on_write_error;

    const char *devaddr;

    DriveInfo *dinfo;

    BlockIOLimit io_limits;

    int snapshot = 0;

    bool copy_on_read;

    int ret;

    translation = BIOS_ATA_TRANSLATION_AUTO;

    media = MEDIA_DISK;

    /* extract parameters */

    bus_id  = qemu_opt_get_number(opts, "bus", 0);

    unit_id = qemu_opt_get_number(opts, "unit", -1);

    index   = qemu_opt_get_number(opts, "index", -1);

    cyls  = qemu_opt_get_number(opts, "cyls", 0);

    heads = qemu_opt_get_number(opts, "heads", 0);

    secs  = qemu_opt_get_number(opts, "secs", 0);

    snapshot = qemu_opt_get_bool(opts, "snapshot", 0);

    ro = qemu_opt_get_bool(opts, "readonly", 0);

    copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false);

    file = qemu_opt_get(opts, "file");

    serial = qemu_opt_get(opts, "serial");

    if ((buf = qemu_opt_get(opts, "if")) != NULL) {

        pstrcpy(devname, sizeof(devname), buf);

        for (type = 0; type < IF_COUNT && strcmp(buf, if_name[type]); type++)

            ;

        if (type == IF_COUNT) {

            error_report("unsupported bus type '%s'", buf);

            return NULL;

	}

    } else {

        type = default_to_scsi ? IF_SCSI : IF_IDE;

        pstrcpy(devname, sizeof(devname), if_name[type]);

    }

    max_devs = if_max_devs[type];

    if (cyls || heads || secs) {

        if (cyls < 1 || (type == IF_IDE && cyls > 16383)) {

            error_report("invalid physical cyls number");

	    return NULL;

	}

        if (heads < 1 || (type == IF_IDE && heads > 16)) {

            error_report("invalid physical heads number");

	    return NULL;

	}

        if (secs < 1 || (type == IF_IDE && secs > 63)) {

            error_report("invalid physical secs number");

	    return NULL;

	}

    }

    if ((buf = qemu_opt_get(opts, "trans")) != NULL) {

        if (!cyls) {

            error_report("'%s' trans must be used with cyls, heads and secs",

                         buf);

            return NULL;

        }

        if (!strcmp(buf, "none"))

            translation = BIOS_ATA_TRANSLATION_NONE;

        else if (!strcmp(buf, "lba"))

            translation = BIOS_ATA_TRANSLATION_LBA;

        else if (!strcmp(buf, "auto"))

            translation = BIOS_ATA_TRANSLATION_AUTO;

	else {

            error_report("'%s' invalid translation type", buf);

	    return NULL;

	}

    }

    if ((buf = qemu_opt_get(opts, "media")) != NULL) {

        if (!strcmp(buf, "disk")) {

	    media = MEDIA_DISK;

	} else if (!strcmp(buf, "cdrom")) {

            if (cyls || secs || heads) {

                error_report("CHS can't be set with media=%s", buf);

	        return NULL;

            }

	    media = MEDIA_CDROM;

	} else {

	    error_report("'%s' invalid media", buf);

	    return NULL;

	}

    }

    if ((buf = qemu_opt_get(opts, "cache")) != NULL) {

        if (bdrv_parse_cache_flags(buf, &bdrv_flags) != 0) {

            error_report("invalid cache option");

            return NULL;

        }

    }

#ifdef CONFIG_LINUX_AIO

    if ((buf = qemu_opt_get(opts, "aio")) != NULL) {

        if (!strcmp(buf, "native")) {

            bdrv_flags |= BDRV_O_NATIVE_AIO;

        } else if (!strcmp(buf, "threads")) {

            /* this is the default */

        } else {

           error_report("invalid aio option");

           return NULL;

        }

    }

#endif

    if ((buf = qemu_opt_get(opts, "format")) != NULL) {

       if (strcmp(buf, "?") == 0) {

           error_printf("Supported formats:");

           bdrv_iterate_format(bdrv_format_print, NULL);

           error_printf("\n");

           return NULL;

        }

        drv = bdrv_find_whitelisted_format(buf);

        if (!drv) {

            error_report("'%s' invalid format", buf);

            return NULL;

        }

    }

    /* disk I/O throttling */

    io_limits.bps[BLOCK_IO_LIMIT_TOTAL]  =

                           qemu_opt_get_number(opts, "bps", 0);

    io_limits.bps[BLOCK_IO_LIMIT_READ]   =

                           qemu_opt_get_number(opts, "bps_rd", 0);

    io_limits.bps[BLOCK_IO_LIMIT_WRITE]  =

                           qemu_opt_get_number(opts, "bps_wr", 0);

    io_limits.iops[BLOCK_IO_LIMIT_TOTAL] =

                           qemu_opt_get_number(opts, "iops", 0);

    io_limits.iops[BLOCK_IO_LIMIT_READ]  =

                           qemu_opt_get_number(opts, "iops_rd", 0);

    io_limits.iops[BLOCK_IO_LIMIT_WRITE] =

                           qemu_opt_get_number(opts, "iops_wr", 0);

    if (!do_check_io_limits(&io_limits)) {

        error_report("bps(iops) and bps_rd/bps_wr(iops_rd/iops_wr) "

                     "cannot be used at the same time");

        return NULL;

    }

    on_write_error = BLOCK_ERR_STOP_ENOSPC;

    if ((buf = qemu_opt_get(opts, "werror")) != NULL) {

        if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) {

            error_report("werror is not supported by this bus type");

            return NULL;

        }

        on_write_error = parse_block_error_action(buf, 0);

        if (on_write_error < 0) {

            return NULL;

        }

    }

    on_read_error = BLOCK_ERR_REPORT;

    if ((buf = qemu_opt_get(opts, "rerror")) != NULL) {

        if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && type != IF_NONE) {

            error_report("rerror is not supported by this bus type");

            return NULL;

        }

        on_read_error = parse_block_error_action(buf, 1);

        if (on_read_error < 0) {

            return NULL;

        }

    }

    if ((devaddr = qemu_opt_get(opts, "addr")) != NULL) {

        if (type != IF_VIRTIO) {

            error_report("addr is not supported by this bus type");

            return NULL;

        }

    }

    /* compute bus and unit according index */

    if (index != -1) {

        if (bus_id != 0 || unit_id != -1) {

            error_report("index cannot be used with bus and unit");

            return NULL;

        }

        bus_id = drive_index_to_bus_id(type, index);

        unit_id = drive_index_to_unit_id(type, index);

    }

    /* if user doesn't specify a unit_id,

     * try to find the first free

     */

    if (unit_id == -1) {

       unit_id = 0;

       while (drive_get(type, bus_id, unit_id) != NULL) {

           unit_id++;

           if (max_devs && unit_id >= max_devs) {

               unit_id -= max_devs;

               bus_id++;

           }

       }

    }

    /* check unit id */

    if (max_devs && unit_id >= max_devs) {

        error_report("unit %d too big (max is %d)",

                     unit_id, max_devs - 1);

        return NULL;

    }

    /*

     * catch multiple definitions

     */

    if (drive_get(type, bus_id, unit_id) != NULL) {

        error_report("drive with bus=%d, unit=%d (index=%d) exists",

                     bus_id, unit_id, index);

        return NULL;

    }

    /* init */

    dinfo = g_malloc0(sizeof(*dinfo));

    if ((buf = qemu_opts_id(opts)) != NULL) {

        dinfo->id = g_strdup(buf);

    } else {

        /* no id supplied -> create one */

        dinfo->id = g_malloc0(32);

        if (type == IF_IDE || type == IF_SCSI)

            mediastr = (media == MEDIA_CDROM) ? "-cd" : "-hd";

        if (max_devs)

            snprintf(dinfo->id, 32, "%s%i%s%i",

                     devname, bus_id, mediastr, unit_id);

        else

            snprintf(dinfo->id, 32, "%s%s%i",

                     devname, mediastr, unit_id);

    }

    dinfo->bdrv = bdrv_new(dinfo->id);

    dinfo->devaddr = devaddr;

    dinfo->type = type;

    dinfo->bus = bus_id;

    dinfo->unit = unit_id;

    dinfo->opts = opts;

    dinfo->refcount = 1;

    if (serial) {

        pstrcpy(dinfo->serial, sizeof(dinfo->serial), serial);

    }

    QTAILQ_INSERT_TAIL(&drives, dinfo, next);

    bdrv_set_on_error(dinfo->bdrv, on_read_error, on_write_error);

    /* disk I/O throttling */

    bdrv_set_io_limits(dinfo->bdrv, &io_limits);

    switch(type) {

    case IF_IDE:

    case IF_SCSI:

    case IF_XEN:

    case IF_NONE:

        switch(media) {

	case MEDIA_DISK:

            if (cyls != 0) {

                bdrv_set_geometry_hint(dinfo->bdrv, cyls, heads, secs);

                bdrv_set_translation_hint(dinfo->bdrv, translation);

            }

	    break;

	case MEDIA_CDROM:

            dinfo->media_cd = 1;

	    break;

	}

        break;

    case IF_SD:

    case IF_FLOPPY:

    case IF_PFLASH:

    case IF_MTD:

        break;

    case IF_VIRTIO:

        /* add virtio block device */

        opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0);

        if (arch_type == QEMU_ARCH_S390X) {

            qemu_opt_set(opts, "driver", "virtio-blk-s390");

        } else {

            qemu_opt_set(opts, "driver", "virtio-blk-pci");

        }

        qemu_opt_set(opts, "drive", dinfo->id);

        if (devaddr)

            qemu_opt_set(opts, "addr", devaddr);

        break;

    default:

        abort();

    }

    if (!file || !*file) {

        return dinfo;

    }

    if (snapshot) {

        /* always use cache=unsafe with snapshot */

        bdrv_flags &= ~BDRV_O_CACHE_MASK;

        bdrv_flags |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH);

    }

    if (copy_on_read) {

        bdrv_flags |= BDRV_O_COPY_ON_READ;

    }

    if (runstate_check(RUN_STATE_INMIGRATE)) {

        bdrv_flags |= BDRV_O_INCOMING;

    }

    if (media == MEDIA_CDROM) {

        /* CDROM is fine for any interface, don't check.  */

        ro = 1;

    } else if (ro == 1) {

        if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY &&

            type != IF_NONE && type != IF_PFLASH) {

            error_report("readonly not supported by this bus type");

            goto err;

        }

    }

    bdrv_flags |= ro ? 0 : BDRV_O_RDWR;

    ret = bdrv_open(dinfo->bdrv, file, bdrv_flags, drv);

    if (ret < 0) {

        error_report("could not open disk image %s: %s",

                     file, strerror(-ret));

        goto err;

    }

    if (bdrv_key_required(dinfo->bdrv))

        autostart = 0;

    return dinfo;

err:

    bdrv_delete(dinfo->bdrv);

    g_free(dinfo->id);

    QTAILQ_REMOVE(&drives, dinfo, next);

    g_free(dinfo);

    return NULL;

}


DisownSelection(XtermWidget xw)
{
    TScreen *screen = TScreenOf(xw);
    Atom *atoms = screen->selection_atoms;
    Cardinal count = screen->selection_count;
    Cardinal i;

    TRACE(("DisownSelection count %d, start %d.%d, end %d.%d\n",
	   count,
	   screen->startH.row,
	   screen->startH.col,
	   screen->endH.row,
	   screen->endH.col));

    for (i = 0; i < count; i++) {
	int cutbuffer = CutBuffer(atoms[i]);
	if (cutbuffer < 0) {
	    XtDisownSelection((Widget) xw, atoms[i],
			      screen->selection_time);
	}
    }
    /*
     * If none of the callbacks via XtDisownSelection() reset highlighting
     * do it now.
     */
    if (ScrnHaveSelection(screen)) {
	/* save data which will be reset */
	CELL first = screen->startH;
	CELL last = screen->endH;

	ResetSelectionState(screen);
	ReHiliteText(xw, &first, &last);
    } else {
	ResetSelectionState(screen);
    }
}


mode_pass(struct cpio *cpio, const char *destdir)
{
	struct lafe_line_reader *lr;
	const char *p;
	int r;

	/* Ensure target dir has a trailing '/' to simplify path surgery. */
	cpio->destdir = malloc(strlen(destdir) + 8);
	strcpy(cpio->destdir, destdir);
	if (destdir[strlen(destdir) - 1] != '/')
		strcat(cpio->destdir, "/");

	cpio->archive = archive_write_disk_new();
	if (cpio->archive == NULL)
		lafe_errc(1, 0, "Failed to allocate archive object");
	r = archive_write_disk_set_options(cpio->archive, cpio->extract_flags);
	if (r != ARCHIVE_OK)
		lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
	cpio->linkresolver = archive_entry_linkresolver_new();
	archive_write_disk_set_standard_lookup(cpio->archive);

	cpio->archive_read_disk = archive_read_disk_new();
	if (cpio->archive_read_disk == NULL)
		lafe_errc(1, 0, "Failed to allocate archive object");
	if (cpio->option_follow_links)
		archive_read_disk_set_symlink_logical(cpio->archive_read_disk);
	else
		archive_read_disk_set_symlink_physical(cpio->archive_read_disk);
	archive_read_disk_set_standard_lookup(cpio->archive_read_disk);

	lr = lafe_line_reader("-", cpio->option_null);
	while ((p = lafe_line_reader_next(lr)) != NULL)
		file_to_archive(cpio, p);
	lafe_line_reader_free(lr);

	archive_entry_linkresolver_free(cpio->linkresolver);
	r = archive_write_close(cpio->archive);
	if (cpio->dot)
		fprintf(stderr, "\n");
	if (r != ARCHIVE_OK)
		lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));

	if (!cpio->quiet) {
		int64_t blocks =
			(archive_filter_bytes(cpio->archive, 0) + 511)
			/ 512;
		fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
		    blocks == 1 ? "block" : "blocks");
	}

	archive_write_free(cpio->archive);
}


void RunClosureAfterCookiesCleared(const base::Closure& task,
                                   uint32_t cookies_deleted) {
  task.Run();
}


armv6pmu_read_counter(int counter)
{
	unsigned long value = 0;

	if (ARMV6_CYCLE_COUNTER == counter)
		asm volatile("mrc   p15, 0, %0, c15, c12, 1" : "=r"(value));
	else if (ARMV6_COUNTER0 == counter)
		asm volatile("mrc   p15, 0, %0, c15, c12, 2" : "=r"(value));
	else if (ARMV6_COUNTER1 == counter)
		asm volatile("mrc   p15, 0, %0, c15, c12, 3" : "=r"(value));
	else
		WARN_ONCE(1, "invalid counter number (%d)\n", counter);

	return value;
}


static int dlist_tonum64(struct dlist *dl, bit64 *valp)
{
    const char *end;
    bit64 newval;

    if (!dl) return 0;

    switch (dl->type) {
    case DL_ATOM:
    case DL_BUF:
        if (parsenum(dl->sval, &end, dl->nval, &newval))
            return 0;
        if (end - dl->sval != (int)dl->nval)
            return 0;
        /* successfully parsed - switch to a numeric value */
        dlist_makenum64(dl, newval);
        break;

    case DL_NUM:
    case DL_HEX:
    case DL_DATE:
        break;

    default:
        return 0;
    }

    if (valp) *valp = dl->nval;

    return 1;
}


GF_Box *trex_box_new()
{
	ISOM_DECL_BOX_ALLOC(GF_TrackExtendsBox, GF_ISOM_BOX_TYPE_TREX);
	return (GF_Box *)tmp;


void WebPluginImpl::InitiateHTTPRangeRequest(const char* url,
                                             const char* range_info,
                                             intptr_t existing_stream,
                                             bool notify_needed,
                                             intptr_t notify_data) {
   unsigned long resource_id = GetNextResourceId();
   if (!resource_id)
     return;

   GURL complete_url = CompleteURL(url);

  WebPluginResourceClient* resource_client = delegate_->CreateResourceClient(
      resource_id, complete_url, notify_needed, notify_data, existing_stream);
   InitiateHTTPRequest(
      resource_id, resource_client, "GET", NULL, 0, complete_url, range_info,
       load_manually_ ? NO_REFERRER : PLUGIN_SRC);
 }


int jbig2_decode_halftone_mmr ( Jbig2Ctx * ctx , const Jbig2GenericRegionParams * params , const byte * data , size_t size , Jbig2Image * image , size_t * consumed_bytes ) {
 Jbig2MmrCtx mmr ;
 const int rowstride = image -> stride ;
 byte * dst = image -> data ;
 byte * ref = NULL ;
 int y ;
 int code = 0 ;
 const uint32_t EOFB = 0x001001 ;
 jbig2_decode_mmr_init ( & mmr , image -> width , image -> height , data , size ) ;
 for ( y = 0 ;
 y < image -> height ;
 y ++ ) {
 memset ( dst , 0 , rowstride ) ;
 code = jbig2_decode_mmr_line ( & mmr , ref , dst ) ;
 if ( code < 0 ) return code ;
 ref = dst ;
 dst += rowstride ;
 }
 if ( mmr . word >> 8 == EOFB ) {
 mmr . data_index += 3 ;
 }
 * consumed_bytes += mmr . data_index + ( mmr . bit_index >> 3 ) + ( mmr . bit_index > 0 ? 1 : 0 ) ;
 return code ;
 }


poolAppend(STRING_POOL *pool, const ENCODING *enc, const char *ptr,
           const char *end) {
  if (! pool->ptr && ! poolGrow(pool))
    return NULL;
  for (;;) {
    const enum XML_Convert_Result convert_res = XmlConvert(
        enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
    if ((convert_res == XML_CONVERT_COMPLETED)
        || (convert_res == XML_CONVERT_INPUT_INCOMPLETE))
      break;
    if (! poolGrow(pool))
      return NULL;
  }
  return pool->start;
}


void Server::Run(std::size_t workers, std::size_t loops) {
  assert(workers > 0);

#if WEBCC_STUDY_SERVER_THREADING
  LOG_USER("Run(workers:%u, loops:%u)", workers, loops);
#endif

  {
    std::lock_guard<std::mutex> lock{ state_mutex_ };

    assert(worker_threads_.empty());

    if (IsRunning()) {
      LOG_WARN("Server is already running");
      return;
    }

    running_ = true;
    io_context_.restart();

    if (!Listen(port_)) {
      LOG_ERRO("Server is NOT going to run");
      return;
    }

    LOG_INFO("Server is going to run");

    AsyncWaitSignals();

    AsyncAccept();

    // Create worker threads.
    for (std::size_t i = 0; i < workers; ++i) {
      worker_threads_.emplace_back(&Server::WorkerRoutine, this);
    }
  }

  // Start the event loop.
  // The io_context::run() call will block until all asynchronous operations
  // have finished. While the server is running, there is always at least one
  // asynchronous operation outstanding: the asynchronous accept call waiting
  // for new incoming connections.

  LOG_INFO("Loop is running in %u thread(s)", loops);

  if (loops == 1) {
    // Run the loop in current thread.
    io_context_.run();
  } else {
    std::vector<std::thread> loop_threads;
    for (std::size_t i = 0; i < loops; ++i) {
      loop_threads.emplace_back(&boost::asio::io_context::run, &io_context_);
    }
    // Join the threads for blocking.
    for (std::size_t i = 0; i < loops; ++i) {
      loop_threads[i].join();
    }
  }
}


GURL DevToolsWindow::GetDevToolsURL(Profile* profile,
                                    const GURL& base_url,
                                    bool shared_worker_frontend,
                                    bool v8_only_frontend,
                                    const std::string& remote_frontend,
                                    bool can_dock,
                                    const std::string& panel) {
  if (base_url.SchemeIs("data"))
    return base_url;

  std::string frontend_url(
      !remote_frontend.empty() ?
          remote_frontend :
          base_url.is_empty() ? chrome::kChromeUIDevToolsURL : base_url.spec());
  std::string url_string(
      frontend_url +
      ((frontend_url.find("?") == std::string::npos) ? "?" : "&"));
  if (shared_worker_frontend)
    url_string += "&isSharedWorker=true";
  if (v8_only_frontend)
    url_string += "&v8only=true";
  if (remote_frontend.size()) {
    url_string += "&remoteFrontend=true";
  } else {
    url_string += "&remoteBase=" + DevToolsUI::GetRemoteBaseURL().spec();
  }
  if (can_dock)
     url_string += "&can_dock=true";
   if (panel.size())
     url_string += "&panel=" + panel;
  return DevToolsUI::SanitizeFrontendURL(GURL(url_string));
 }


void NavigationController::AddTransientEntry(NavigationEntry* entry) {
  int index = 0;
  if (last_committed_entry_index_ != -1)
    index = last_committed_entry_index_ + 1;
  DiscardTransientEntry();
  entries_.insert(entries_.begin() + index, linked_ptr<NavigationEntry>(entry));
  transient_entry_index_ = index;
  tab_contents_->NotifyNavigationStateChanged(kInvalidateAllButShelves);
}


static int vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp)

{

    int ret;

    vdev->msix->pending = g_malloc0(BITS_TO_LONGS(vdev->msix->entries) *

                                    sizeof(unsigned long));

    ret = msix_init(&vdev->pdev, vdev->msix->entries,

                    vdev->bars[vdev->msix->table_bar].region.mem,

                    vdev->msix->table_bar, vdev->msix->table_offset,

                    vdev->bars[vdev->msix->pba_bar].region.mem,

                    vdev->msix->pba_bar, vdev->msix->pba_offset, pos);

    if (ret < 0) {

        if (ret == -ENOTSUP) {

            return 0;

        }

        error_setg(errp, "msix_init failed");

        return ret;

    }

    /*

     * The PCI spec suggests that devices provide additional alignment for

     * MSI-X structures and avoid overlapping non-MSI-X related registers.

     * For an assigned device, this hopefully means that emulation of MSI-X

     * structures does not affect the performance of the device.  If devices

     * fail to provide that alignment, a significant performance penalty may

     * result, for instance Mellanox MT27500 VFs:

     * http://www.spinics.net/lists/kvm/msg125881.html

     *

     * The PBA is simply not that important for such a serious regression and

     * most drivers do not appear to look at it.  The solution for this is to

     * disable the PBA MemoryRegion unless it's being used.  We disable it

     * here and only enable it if a masked vector fires through QEMU.  As the

     * vector-use notifier is called, which occurs on unmask, we test whether

     * PBA emulation is needed and again disable if not.

     */

    memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, false);

    return 0;

}


int enc_untrusted_getsockopt(int sockfd, int level, int optname, void *optval,
                             socklen_t *optlen) {
  if (!optval || !optlen || *optlen == 0) {
    errno = EINVAL;
    return -1;
  }

  MessageWriter input;
  input.Push<int>(sockfd);
  input.Push<int>(level);
  input.Push<int>(TokLinuxOptionName(level, optname));
  input.PushByReference(Extent{reinterpret_cast<char *>(optval), *optlen});
  MessageReader output;
  const auto status = NonSystemCallDispatcher(
      ::asylo::host_call::kGetSockOptHandler, &input, &output);
  CheckStatusAndParamCount(status, output, "enc_untrusted_getsockopt", 3);

  int result = output.next<int>();
  int klinux_errno = output.next<int>();
  Extent opt_received = output.next();

  if (result == -1) {
    errno = FromkLinuxErrorNumber(klinux_errno);
    return -1;
  }

  // The returned |optlen| should not exceed the buffer size.
  if (opt_received.size() <= *optlen) {
    *optlen = opt_received.size();
  }
  memcpy(optval, opt_received.data(), *optlen);
  return result;
}


void HTMLFormControlElement::DisabledAttributeChanged() {
  EventDispatchForbiddenScope event_forbidden;

  ListedElement::DisabledAttributeChanged();
  if (LayoutObject* o = GetLayoutObject())
    o->InvalidateIfControlStateChanged(kEnabledControlState);

  if (AXObjectCache* cache = GetDocument().ExistingAXObjectCache())
    cache->CheckedStateChanged(this);
}


void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect)
{
    m_uiClient.drawFooter(this, frame, rect);
}


static int avg_bits_per_pixel(int pix_fmt)

{

    int bits;

    const PixFmtInfo *pf;

    pf = &pix_fmt_info[pix_fmt];

    if (pf->is_packed) {

        switch(pix_fmt) {

        case PIX_FMT_RGB24:

        case PIX_FMT_BGR24:

            bits = 24;

            break;

        case PIX_FMT_RGBA32:

            bits = 32;

                        break;

        case PIX_FMT_RGB565:

        case PIX_FMT_RGB555:

            bits = 16;

                        break;

        case PIX_FMT_PAL8:

            bits = 8;

            break;

        default:

            bits = 32;

            break;

        }

    } else {

        bits = pf->depth;

        bits += (2 * pf->depth >>

                 (pf->x_chroma_shift + pf->x_chroma_shift));

    }

    return bits;

}


int proto_register(struct proto *prot, int alloc_slab)
{
	if (alloc_slab) {
		prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0,
					SLAB_HWCACHE_ALIGN | prot->slab_flags,
					NULL);

		if (prot->slab == NULL) {
			pr_crit("%s: Can't create sock SLAB cache!\n",
				prot->name);
			goto out;
		}

		if (prot->rsk_prot != NULL) {
			prot->rsk_prot->slab_name = kasprintf(GFP_KERNEL, "request_sock_%s", prot->name);
			if (prot->rsk_prot->slab_name == NULL)
				goto out_free_sock_slab;

			prot->rsk_prot->slab = kmem_cache_create(prot->rsk_prot->slab_name,
								 prot->rsk_prot->obj_size, 0,
								 SLAB_HWCACHE_ALIGN, NULL);

			if (prot->rsk_prot->slab == NULL) {
				pr_crit("%s: Can't create request sock SLAB cache!\n",
					prot->name);
				goto out_free_request_sock_slab_name;
			}
		}

		if (prot->twsk_prot != NULL) {
			prot->twsk_prot->twsk_slab_name = kasprintf(GFP_KERNEL, "tw_sock_%s", prot->name);

			if (prot->twsk_prot->twsk_slab_name == NULL)
				goto out_free_request_sock_slab;

			prot->twsk_prot->twsk_slab =
				kmem_cache_create(prot->twsk_prot->twsk_slab_name,
						  prot->twsk_prot->twsk_obj_size,
						  0,
						  SLAB_HWCACHE_ALIGN |
							prot->slab_flags,
						  NULL);
			if (prot->twsk_prot->twsk_slab == NULL)
				goto out_free_timewait_sock_slab_name;
		}
	}

	mutex_lock(&proto_list_mutex);
	list_add(&prot->node, &proto_list);
	assign_proto_idx(prot);
	mutex_unlock(&proto_list_mutex);
	return 0;

out_free_timewait_sock_slab_name:
	kfree(prot->twsk_prot->twsk_slab_name);
out_free_request_sock_slab:
	if (prot->rsk_prot && prot->rsk_prot->slab) {
		kmem_cache_destroy(prot->rsk_prot->slab);
		prot->rsk_prot->slab = NULL;
	}
out_free_request_sock_slab_name:
	if (prot->rsk_prot)
		kfree(prot->rsk_prot->slab_name);
out_free_sock_slab:
	kmem_cache_destroy(prot->slab);
	prot->slab = NULL;
out:
	return -ENOBUFS;
}


static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
{
	struct snd_usb_midi *umidi = substream->rmidi->private_data;
	struct usbmidi_out_port *port = NULL;
	int i, j;

	for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i)
		if (umidi->endpoints[i].out)
			for (j = 0; j < 0x10; ++j)
				if (umidi->endpoints[i].out->ports[j].substream == substream) {
					port = &umidi->endpoints[i].out->ports[j];
					break;
				}
	if (!port) {
		snd_BUG();
		return -ENXIO;
	}

	substream->runtime->private_data = port;
	port->state = STATE_UNKNOWN;
	return substream_open(substream, 0, 1);
}


SYSCALL_DEFINE2(mkdir, const char __user *, pathname, int, mode)
{
	return sys_mkdirat(AT_FDCWD, pathname, mode);
}


static void ems_usb_write_bulk_callback(struct urb *urb)
{
	struct ems_tx_urb_context *context = urb->context;
	struct ems_usb *dev;
	struct net_device *netdev;

	BUG_ON(!context);

	dev = context->dev;
	netdev = dev->netdev;

	/* free up our allocated buffer */
	usb_free_coherent(urb->dev, urb->transfer_buffer_length,
			  urb->transfer_buffer, urb->transfer_dma);

	atomic_dec(&dev->active_tx_urbs);

	if (!netif_device_present(netdev))
		return;

	if (urb->status)
		netdev_info(netdev, "Tx URB aborted (%d)\n", urb->status);

	netif_trans_update(netdev);

	/* transmission complete interrupt */
	netdev->stats.tx_packets++;
	netdev->stats.tx_bytes += can_get_echo_skb(netdev, context->echo_index,
						   NULL);

	/* Release context */
	context->echo_index = MAX_TX_URBS;

}


SPL_METHOD ( SplDoublyLinkedList , unserialize ) {
 spl_dllist_object * intern = ( spl_dllist_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
 zval * flags , * elem ;
 char * buf ;
 int buf_len ;
 const unsigned char * p , * s ;
 php_unserialize_data_t var_hash ;
 if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "s" , & buf , & buf_len ) == FAILURE ) {
 return ;
 }
 if ( buf_len == 0 ) {
 zend_throw_exception_ex ( spl_ce_UnexpectedValueException , 0 TSRMLS_CC , "Serialized string cannot be empty" ) ;
 return ;
 }
 s = p = ( const unsigned char * ) buf ;
 PHP_VAR_UNSERIALIZE_INIT ( var_hash ) ;
 ALLOC_INIT_ZVAL ( flags ) ;
 if ( ! php_var_unserialize ( & flags , & p , s + buf_len , & var_hash TSRMLS_CC ) || Z_TYPE_P ( flags ) != IS_LONG ) {
 zval_ptr_dtor ( & flags ) ;
 goto error ;
 }
 intern -> flags = Z_LVAL_P ( flags ) ;
 zval_ptr_dtor ( & flags ) ;
 while ( * p == ':' ) {
 ++ p ;
 ALLOC_INIT_ZVAL ( elem ) ;
 if ( ! php_var_unserialize ( & elem , & p , s + buf_len , & var_hash TSRMLS_CC ) ) {
 zval_ptr_dtor ( & elem ) ;
 goto error ;
 }
 spl_ptr_llist_push ( intern -> llist , elem TSRMLS_CC ) ;
 }
 if ( * p != '\0' ) {
 goto error ;
 }
 PHP_VAR_UNSERIALIZE_DESTROY ( var_hash ) ;
 return ;
 error : PHP_VAR_UNSERIALIZE_DESTROY ( var_hash ) ;
 zend_throw_exception_ex ( spl_ce_UnexpectedValueException , 0 TSRMLS_CC , "Error at offset %ld of %d bytes" , ( long ) ( ( char * ) p - buf ) , buf_len ) ;
 return ;
 }


static void next_decode_page(struct nfsd4_compoundargs *argp)
{
	argp->p = page_address(argp->pagelist[0]);
	argp->pagelist++;
	if (argp->pagelen < PAGE_SIZE) {
		argp->end = argp->p + (argp->pagelen>>2);
		argp->pagelen = 0;
	} else {
		argp->end = argp->p + (PAGE_SIZE>>2);
		argp->pagelen -= PAGE_SIZE;
	}
}


void AwContents::EnableOnNewPicture(JNIEnv* env,
                                    jobject obj,
                                    jboolean enabled) {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);
  browser_view_renderer_.EnableOnNewPicture(enabled);
}


int main(int argc, char *argv[])
{
	int ret;
	struct lxc_lock *lock;

	lock = lxc_newlock(NULL, NULL);
	if (!lock) {
		fprintf(stderr, "%d: failed to get unnamed lock\n", __LINE__);
		exit(1);
	}
	ret = lxclock(lock, 0);
	if (ret) {
		fprintf(stderr, "%d: failed to take unnamed lock (%d)\n", __LINE__, ret);
		exit(1);
	}

	ret = lxcunlock(lock);
	if (ret) {
		fprintf(stderr, "%d: failed to put unnamed lock (%d)\n", __LINE__, ret);
		exit(1);
	}
	lxc_putlock(lock);

	lock = lxc_newlock("/var/lib/lxc", mycontainername);
	if (!lock) {
		fprintf(stderr, "%d: failed to get lock\n", __LINE__);
		exit(1);
	}
	struct stat sb;
	char *pathname = RUNTIME_PATH "/lock/lxc/var/lib/lxc/";
	ret = stat(pathname, &sb);
	if (ret != 0) {
		fprintf(stderr, "%d: filename %s not created\n", __LINE__,
			pathname);
		exit(1);
	}
	lxc_putlock(lock);

	test_two_locks();

	fprintf(stderr, "all tests passed\n");

	exit(ret);
}


static bool get_discovery_client(struct btd_adapter *adapter, const char *owner,
				struct discovery_client **client)
{
	GSList *list = g_slist_find_custom(adapter->discovery_list, owner,
								compare_sender);
	if (list) {
		*client = list->data;
		return true;
	}

	list = g_slist_find_custom(adapter->set_filter_list, owner,
								compare_sender);
	if (list) {
		*client = list->data;
		return false;
	}

	*client = NULL;
	return false;
}


  void pg_stat_queue_dequeue(PG *pg) {
    pg_stat_queue_lock.Lock();
    if (pg->stat_queue_item.remove_myself())
      pg->put("pg_stat_queue");
    pg_stat_queue_lock.Unlock();
  }


int git_path_fromurl(git_buf *local_path_out, const char *file_url)
{
	int offset;

	assert(local_path_out && file_url);

	if ((offset = local_file_url_prefixlen(file_url)) < 0 ||
		file_url[offset] == '\0' || file_url[offset] == '/')
		return error_invalid_local_file_uri(file_url);

#ifndef GIT_WIN32
	offset--;	/* A *nix absolute path starts with a forward slash */
#endif

	git_buf_clear(local_path_out);
	return git__percent_decode(local_path_out, file_url + offset);
}


void ServiceWorkerDevToolsAgentHost::WorkerDestroyed() {
  DCHECK_NE(WORKER_TERMINATED, state_);
  state_ = WORKER_TERMINATED;
  agent_ptr_.reset();
  for (auto* inspector : protocol::InspectorHandler::ForAgentHost(this))
    inspector->TargetCrashed();
  for (DevToolsSession* session : sessions())
    session->SetRenderer(-1, nullptr);
}


    virtual void TearDown()
    {
        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
        m_webViewImpl->close();
        m_webViewImpl = 0;
        m_mainFrame->close();
        m_mainFrame = 0;
    }


bwrapinfo_watcher_data_free (BwrapinfoWatcherData* data)
{
  g_object_unref (data->instance);
  g_free (data);
}


VOID ixheaacd_hbe_post_anal_prod3(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer,
                                  WORD32 qmf_voc_columns, WORD32 qmf_band_idx) {
  WORD32 i, inp_band_idx, rem;

  FLOAT32 *out_buf = &ptr_hbe_txposer->qmf_out_buf[2][2 * qmf_band_idx];

 for (; qmf_band_idx < ptr_hbe_txposer->x_over_qmf[2]; qmf_band_idx++) {
    FLOAT32 temp_r, temp_i;
    FLOAT32 temp_r1, temp_i1;
 const FLOAT32 *ptr_sel, *ptr_sel1;

    inp_band_idx = (2 * qmf_band_idx) / 3;
    ptr_sel = &ixheaacd_sel_case[(inp_band_idx + 1) & 3][0];
    ptr_sel1 = &ixheaacd_sel_case[((inp_band_idx + 1) & 3) + 1][0];
    rem = 2 * qmf_band_idx - 3 * inp_band_idx;

 if (rem == 0 || rem == 1) {
      FLOAT32 *in_buf = &ptr_hbe_txposer->qmf_in_buf[0][2 * inp_band_idx];

 for (i = 0; i < qmf_voc_columns; i += 1) {
        WORD32 k;
        FLOAT32 vec_x[2 * HBE_OPER_WIN_LEN];
        FLOAT32 *ptr_vec_x = &vec_x[0];
        FLOAT32 x_zero_band_r, x_zero_band_i;

        FLOAT32 mag_scaling_fac;

 for (k = 0; k < (HBE_OPER_BLK_LEN_3); k += 2) {
          FLOAT64 base1;
          FLOAT64 base = 1e-17;

          temp_r = in_buf[0];
          temp_i = in_buf[1];

          in_buf += 256;

          base1 = base + temp_r * temp_r;
          base1 = base1 + temp_i * temp_i;

          mag_scaling_fac = (FLOAT32)(ixheaacd_cbrt_calc((FLOAT32)base1));

          ptr_vec_x[0] = temp_r * mag_scaling_fac;
          ptr_vec_x[1] = temp_i * mag_scaling_fac;

          temp_r = in_buf[0];
          temp_i = in_buf[1];

          in_buf -= 128;

          temp_r1 = ptr_sel[0] * temp_r + ptr_sel[1] * temp_i;
          temp_i1 = ptr_sel[2] * temp_r + ptr_sel[3] * temp_i;

          temp_r = in_buf[0];
          temp_i = in_buf[1];

          temp_r1 += ptr_sel[4] * temp_r + ptr_sel[5] * temp_i;
          temp_i1 += ptr_sel[6] * temp_r + ptr_sel[7] * temp_i;

          temp_r1 *= 0.3984033437f;
          temp_i1 *= 0.3984033437f;

          base1 = base + temp_r1 * temp_r1;
          base1 = base1 + temp_i1 * temp_i1;
          mag_scaling_fac = (FLOAT32)(ixheaacd_cbrt_calc((FLOAT32)base1));

          ptr_vec_x[2] = temp_r1 * mag_scaling_fac;
          ptr_vec_x[3] = temp_i1 * mag_scaling_fac;

          ptr_vec_x += 4;
          in_buf += 256;
 }
        ptr_vec_x = &vec_x[0];
        temp_r = vec_x[2 * (HBE_ZERO_BAND_IDX - 2)];
        temp_i = vec_x[(2 * (HBE_ZERO_BAND_IDX - 2)) + 1];

        x_zero_band_r = temp_r * temp_r - temp_i * temp_i;
        x_zero_band_i = temp_r * temp_i + temp_i * temp_r;

 for (k = 0; k < (HBE_OPER_BLK_LEN_3); k++) {
          temp_r = ptr_vec_x[0] * x_zero_band_r - ptr_vec_x[1] * x_zero_band_i;
          temp_i = ptr_vec_x[0] * x_zero_band_i + ptr_vec_x[1] * x_zero_band_r;

          out_buf[0] += (temp_r * 0.4714045f);
          out_buf[1] += (temp_i * 0.4714045f);

          ptr_vec_x += 2;
          out_buf += 128;
 }

        in_buf -= 128 * 11;
        out_buf -= 128 * 6;
 }
 } else {
      FLOAT32 *in_buf = &ptr_hbe_txposer->qmf_in_buf[0][2 * inp_band_idx];
      FLOAT32 *in_buf1 =
 &ptr_hbe_txposer->qmf_in_buf[0][2 * (inp_band_idx + 1)];

 for (i = 0; i < qmf_voc_columns; i++) {
        WORD32 k;
        FLOAT32 vec_x[2 * HBE_OPER_WIN_LEN];
        FLOAT32 vec_x_cap[2 * HBE_OPER_WIN_LEN];

        FLOAT32 x_zero_band_r, x_zero_band_i;
        FLOAT32 *ptr_vec_x = &vec_x[0];
        FLOAT32 *ptr_vec_x_cap = &vec_x_cap[0];

        FLOAT32 mag_scaling_fac;

 for (k = 0; k < (HBE_OPER_BLK_LEN_3); k += 2) {
          FLOAT32 tmp_vr, tmp_vi;
          FLOAT32 tmp_cr, tmp_ci;
          FLOAT64 base1;
          FLOAT64 base = 1e-17;

          temp_r1 = in_buf[0];
          temp_i1 = in_buf[1];
          temp_r = in_buf1[0];
          temp_i = in_buf1[1];

          base1 = base + temp_r * temp_r;
          base1 = base1 + temp_i * temp_i;

          mag_scaling_fac = (FLOAT32)(ixheaacd_cbrt_calc((FLOAT32)base1));

          ptr_vec_x[0] = temp_r * mag_scaling_fac;
          ptr_vec_x[1] = temp_i * mag_scaling_fac;

          base1 = base + temp_r1 * temp_r1;
          base1 = base1 + temp_i1 * temp_i1;

          mag_scaling_fac = (FLOAT32)(ixheaacd_cbrt_calc((FLOAT32)base1));

          ptr_vec_x_cap[0] = temp_r1 * mag_scaling_fac;
          ptr_vec_x_cap[1] = temp_i1 * mag_scaling_fac;

          in_buf += 256;

          temp_r = in_buf[0];
          temp_i = in_buf[1];

          temp_r1 = ptr_sel[0] * temp_r + ptr_sel[1] * temp_i;
          temp_i1 = ptr_sel[2] * temp_r + ptr_sel[3] * temp_i;

          in_buf -= 128;

          temp_r = in_buf[0];
          temp_i = in_buf[1];

          tmp_cr = temp_r1 + ptr_sel[4] * temp_r + ptr_sel[5] * temp_i;
          tmp_ci = temp_i1 + ptr_sel[6] * temp_r + ptr_sel[7] * temp_i;

          in_buf1 += 256;

          temp_r = in_buf1[0];
          temp_i = in_buf1[1];

          temp_r1 = ptr_sel1[0] * temp_r + ptr_sel1[1] * temp_i;
          temp_i1 = ptr_sel1[2] * temp_r + ptr_sel1[3] * temp_i;

          in_buf1 -= 128;

          temp_r = in_buf1[0];
          temp_i = in_buf1[1];

          tmp_vr = temp_r1 + ptr_sel1[4] * temp_r + ptr_sel1[5] * temp_i;
          tmp_vi = temp_i1 + ptr_sel1[6] * temp_r + ptr_sel1[7] * temp_i;

          tmp_cr *= 0.3984033437f;
          tmp_ci *= 0.3984033437f;

          tmp_vr *= 0.3984033437f;
          tmp_vi *= 0.3984033437f;

          base1 = base + tmp_vr * tmp_vr;
          base1 = base1 + tmp_vi * tmp_vi;

          mag_scaling_fac = (FLOAT32)(ixheaacd_cbrt_calc((FLOAT32)base1));

          ptr_vec_x[2] = tmp_vr * mag_scaling_fac;
          ptr_vec_x[3] = tmp_vi * mag_scaling_fac;

          base1 = base + tmp_cr * tmp_cr;
          base1 = base1 + tmp_ci * tmp_ci;

          mag_scaling_fac = (FLOAT32)(ixheaacd_cbrt_calc((FLOAT32)base1));

          ptr_vec_x_cap[2] = tmp_cr * mag_scaling_fac;
          ptr_vec_x_cap[3] = tmp_ci * mag_scaling_fac;

          in_buf += 256;
          in_buf1 += 256;
          ptr_vec_x += 4;
          ptr_vec_x_cap += 4;
 }
        ptr_vec_x = &vec_x[0];
        ptr_vec_x_cap = &vec_x_cap[0];

        temp_r = vec_x_cap[2 * (HBE_ZERO_BAND_IDX - 2)];
        temp_i = vec_x_cap[2 * (HBE_ZERO_BAND_IDX - 2) + 1];
        temp_r1 = vec_x[2 * (HBE_ZERO_BAND_IDX - 2)];
        temp_i1 = vec_x[2 * (HBE_ZERO_BAND_IDX - 2) + 1];

        x_zero_band_r = temp_r * temp_r - temp_i * temp_i;
        x_zero_band_i = temp_r * temp_i + temp_i * temp_r;

        temp_r = temp_r1 * temp_r1 - temp_i1 * temp_i1;
        temp_i = temp_r1 * temp_i1 + temp_i1 * temp_r1;

 for (k = 0; k < (HBE_OPER_BLK_LEN_3); k++) {
          temp_r1 = ptr_vec_x[0] * x_zero_band_r - ptr_vec_x[1] * x_zero_band_i;
          temp_i1 = ptr_vec_x[0] * x_zero_band_i + ptr_vec_x[1] * x_zero_band_r;

          temp_r1 += ptr_vec_x_cap[0] * temp_r - ptr_vec_x_cap[1] * temp_i;
          temp_i1 += ptr_vec_x_cap[0] * temp_i + ptr_vec_x_cap[1] * temp_r;

          out_buf[0] += (temp_r1 * 0.23570225f);
          out_buf[1] += (temp_i1 * 0.23570225f);

          out_buf += 128;
          ptr_vec_x += 2;
          ptr_vec_x_cap += 2;
 }

        in_buf -= 128 * 11;
        in_buf1 -= 128 * 11;
        out_buf -= 128 * 6;
 }
 }

    out_buf -= (256 * qmf_voc_columns) - 2;
 }
}


static int default_cu2_call(struct notifier_block *nfb, unsigned long action,
        void *data)
{
	struct pt_regs *regs = data;

	switch (action) {
	default:
		die_if_kernel("Unhandled kernel unaligned access or invalid "
			      "instruction", regs);
		/* Fall through  */

	case CU2_EXCEPTION:
		force_sig(SIGILL, current);
	}

	return NOTIFY_OK;
}


save_dbg_stuff(struct dbg_stuff *dsp)
{
    dsp->trylevel	= trylevel;		trylevel = 0;
    dsp->force_abort	= force_abort;		force_abort = FALSE;
    dsp->caught_stack	= caught_stack;		caught_stack = NULL;
    dsp->vv_exception	= v_exception(NULL);
    dsp->vv_throwpoint	= v_throwpoint(NULL);

    /* Necessary for debugging an inactive ":catch", ":finally", ":endtry" */
    dsp->did_emsg	= did_emsg;		did_emsg     = FALSE;
    dsp->got_int	= got_int;		got_int	     = FALSE;
    dsp->did_throw	= did_throw;		did_throw    = FALSE;
    dsp->need_rethrow	= need_rethrow;		need_rethrow = FALSE;
    dsp->check_cstack	= check_cstack;		check_cstack = FALSE;
    dsp->current_exception = current_exception;	current_exception = NULL;
}


  Value_Obj Parser::parse_static_value()
  {
    lex< static_value >();
    Token str(lexed);
    // static values always have trailing white-
    // space and end delimiter (\s*[;]$) included
    --pstate.offset.column;
    --after_token.column;
    --str.end;
    --position;

    return color_or_string(str.time_wspace());;
  }


void WebProcessProxy::didBecomeResponsive(ResponsivenessTimer*)
{
    Vector<RefPtr<WebPageProxy> > pages;
    copyValuesToVector(m_pageMap, pages);
    for (size_t i = 0, size = pages.size(); i < size; ++i)
        pages[i]->processDidBecomeResponsive();
}


_sprint_hexstring_line(u_char ** buf, size_t * buf_len, size_t * out_len,
                       int allow_realloc, const u_char * cp, size_t line_len)
{
    const u_char   *tp;
    const u_char   *cp2 = cp;
    size_t          lenleft = line_len;

    /*
     * Make sure there's enough room for the hex output....
     */
    while ((*out_len + line_len*3+1) >= *buf_len) {
        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
            return 0;
        }
    }

    /*
     * .... and display the hex values themselves....
     */
    for (; lenleft >= 8; lenleft-=8) {
        sprintf((char *) (*buf + *out_len),
                "%02X %02X %02X %02X %02X %02X %02X %02X ", cp[0], cp[1],
                cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
        *out_len += strlen((char *) (*buf + *out_len));
        cp       += 8;
    }
    for (; lenleft > 0; lenleft--) {
        sprintf((char *) (*buf + *out_len), "%02X ", *cp++);
        *out_len += strlen((char *) (*buf + *out_len));
    }

    /*
     * .... plus (optionally) do the same for the ASCII equivalent.
     */
    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT)) {
        while ((*out_len + line_len+5) >= *buf_len) {
            if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
                return 0;
            }
        }
        sprintf((char *) (*buf + *out_len), "  [");
        *out_len += strlen((char *) (*buf + *out_len));
        for (tp = cp2; tp < cp; tp++) {
            sprint_char((char *) (*buf + *out_len), *tp);
            (*out_len)++;
        }
        sprintf((char *) (*buf + *out_len), "]");
        *out_len += strlen((char *) (*buf + *out_len));
    }
    return 1;
}


static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
{
	u32 vmx_msr_low, vmx_msr_high;
	u32 min, opt, min2, opt2;
	u32 _pin_based_exec_control = 0;
	u32 _cpu_based_exec_control = 0;
	u32 _cpu_based_2nd_exec_control = 0;
	u32 _vmexit_control = 0;
	u32 _vmentry_control = 0;

	min = CPU_BASED_HLT_EXITING |
#ifdef CONFIG_X86_64
	      CPU_BASED_CR8_LOAD_EXITING |
	      CPU_BASED_CR8_STORE_EXITING |
#endif
	      CPU_BASED_CR3_LOAD_EXITING |
	      CPU_BASED_CR3_STORE_EXITING |
	      CPU_BASED_USE_IO_BITMAPS |
	      CPU_BASED_MOV_DR_EXITING |
	      CPU_BASED_USE_TSC_OFFSETING |
	      CPU_BASED_MWAIT_EXITING |
	      CPU_BASED_MONITOR_EXITING |
	      CPU_BASED_INVLPG_EXITING |
	      CPU_BASED_RDPMC_EXITING;

	opt = CPU_BASED_TPR_SHADOW |
	      CPU_BASED_USE_MSR_BITMAPS |
	      CPU_BASED_ACTIVATE_SECONDARY_CONTROLS;
	if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS,
				&_cpu_based_exec_control) < 0)
		return -EIO;
#ifdef CONFIG_X86_64
	if ((_cpu_based_exec_control & CPU_BASED_TPR_SHADOW))
		_cpu_based_exec_control &= ~CPU_BASED_CR8_LOAD_EXITING &
					   ~CPU_BASED_CR8_STORE_EXITING;
#endif
	if (_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) {
		min2 = 0;
		opt2 = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
			SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE |
			SECONDARY_EXEC_WBINVD_EXITING |
			SECONDARY_EXEC_ENABLE_VPID |
			SECONDARY_EXEC_ENABLE_EPT |
			SECONDARY_EXEC_UNRESTRICTED_GUEST |
			SECONDARY_EXEC_PAUSE_LOOP_EXITING |
			SECONDARY_EXEC_RDTSCP |
			SECONDARY_EXEC_ENABLE_INVPCID |
			SECONDARY_EXEC_APIC_REGISTER_VIRT |
			SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
			SECONDARY_EXEC_SHADOW_VMCS |
			SECONDARY_EXEC_XSAVES |
			SECONDARY_EXEC_ENABLE_PML |
			SECONDARY_EXEC_PCOMMIT |
			SECONDARY_EXEC_TSC_SCALING;
		if (adjust_vmx_controls(min2, opt2,
					MSR_IA32_VMX_PROCBASED_CTLS2,
					&_cpu_based_2nd_exec_control) < 0)
			return -EIO;
	}
#ifndef CONFIG_X86_64
	if (!(_cpu_based_2nd_exec_control &
				SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
		_cpu_based_exec_control &= ~CPU_BASED_TPR_SHADOW;
#endif

	if (!(_cpu_based_exec_control & CPU_BASED_TPR_SHADOW))
		_cpu_based_2nd_exec_control &= ~(
				SECONDARY_EXEC_APIC_REGISTER_VIRT |
				SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE |
				SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY);

	if (_cpu_based_2nd_exec_control & SECONDARY_EXEC_ENABLE_EPT) {
		/* CR3 accesses and invlpg don't need to cause VM Exits when EPT
		   enabled */
		_cpu_based_exec_control &= ~(CPU_BASED_CR3_LOAD_EXITING |
					     CPU_BASED_CR3_STORE_EXITING |
					     CPU_BASED_INVLPG_EXITING);
		rdmsr(MSR_IA32_VMX_EPT_VPID_CAP,
		      vmx_capability.ept, vmx_capability.vpid);
	}

	min = VM_EXIT_SAVE_DEBUG_CONTROLS;
#ifdef CONFIG_X86_64
	min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;
#endif
	opt = VM_EXIT_SAVE_IA32_PAT | VM_EXIT_LOAD_IA32_PAT |
		VM_EXIT_ACK_INTR_ON_EXIT | VM_EXIT_CLEAR_BNDCFGS;
	if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_EXIT_CTLS,
				&_vmexit_control) < 0)
		return -EIO;

	min = PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING;
	opt = PIN_BASED_VIRTUAL_NMIS | PIN_BASED_POSTED_INTR;
	if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PINBASED_CTLS,
				&_pin_based_exec_control) < 0)
		return -EIO;

	if (!(_cpu_based_2nd_exec_control &
		SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) ||
		!(_vmexit_control & VM_EXIT_ACK_INTR_ON_EXIT))
		_pin_based_exec_control &= ~PIN_BASED_POSTED_INTR;

	min = VM_ENTRY_LOAD_DEBUG_CONTROLS;
	opt = VM_ENTRY_LOAD_IA32_PAT | VM_ENTRY_LOAD_BNDCFGS;
	if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_ENTRY_CTLS,
				&_vmentry_control) < 0)
		return -EIO;

	rdmsr(MSR_IA32_VMX_BASIC, vmx_msr_low, vmx_msr_high);

	/* IA-32 SDM Vol 3B: VMCS size is never greater than 4kB. */
	if ((vmx_msr_high & 0x1fff) > PAGE_SIZE)
		return -EIO;

#ifdef CONFIG_X86_64
	/* IA-32 SDM Vol 3B: 64-bit CPUs always have VMX_BASIC_MSR[48]==0. */
	if (vmx_msr_high & (1u<<16))
		return -EIO;
#endif

	/* Require Write-Back (WB) memory type for VMCS accesses. */
	if (((vmx_msr_high >> 18) & 15) != 6)
		return -EIO;

	vmcs_conf->size = vmx_msr_high & 0x1fff;
	vmcs_conf->order = get_order(vmcs_config.size);
	vmcs_conf->revision_id = vmx_msr_low;

	vmcs_conf->pin_based_exec_ctrl = _pin_based_exec_control;
	vmcs_conf->cpu_based_exec_ctrl = _cpu_based_exec_control;
	vmcs_conf->cpu_based_2nd_exec_ctrl = _cpu_based_2nd_exec_control;
	vmcs_conf->vmexit_ctrl         = _vmexit_control;
	vmcs_conf->vmentry_ctrl        = _vmentry_control;

	cpu_has_load_ia32_efer =
		allow_1_setting(MSR_IA32_VMX_ENTRY_CTLS,
				VM_ENTRY_LOAD_IA32_EFER)
		&& allow_1_setting(MSR_IA32_VMX_EXIT_CTLS,
				   VM_EXIT_LOAD_IA32_EFER);

	cpu_has_load_perf_global_ctrl =
		allow_1_setting(MSR_IA32_VMX_ENTRY_CTLS,
				VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL)
		&& allow_1_setting(MSR_IA32_VMX_EXIT_CTLS,
				   VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL);

	/*
	 * Some cpus support VM_ENTRY_(LOAD|SAVE)_IA32_PERF_GLOBAL_CTRL
	 * but due to arrata below it can't be used. Workaround is to use
	 * msr load mechanism to switch IA32_PERF_GLOBAL_CTRL.
	 *
	 * VM Exit May Incorrectly Clear IA32_PERF_GLOBAL_CTRL [34:32]
	 *
	 * AAK155             (model 26)
	 * AAP115             (model 30)
	 * AAT100             (model 37)
	 * BC86,AAY89,BD102   (model 44)
	 * BA97               (model 46)
	 *
	 */
	if (cpu_has_load_perf_global_ctrl && boot_cpu_data.x86 == 0x6) {
		switch (boot_cpu_data.x86_model) {
		case 26:
		case 30:
		case 37:
		case 44:
		case 46:
			cpu_has_load_perf_global_ctrl = false;
			printk_once(KERN_WARNING"kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL "
					"does not work properly. Using workaround\n");
			break;
		default:
			break;
		}
	}

	if (cpu_has_xsaves)
		rdmsrl(MSR_IA32_XSS, host_xss);

	return 0;
}


static int ogg_packet ( AVFormatContext * s , int * sid , int * dstart , int * dsize , int64_t * fpos ) {
 struct ogg * ogg = s -> priv_data ;
 int idx , i , ret ;
 struct ogg_stream * os ;
 int complete = 0 ;
 int segp = 0 , psize = 0 ;
 av_log ( s , AV_LOG_TRACE , "ogg_packet: curidx=%i\n" , ogg -> curidx ) ;
 if ( sid ) * sid = - 1 ;
 do {
 idx = ogg -> curidx ;
 while ( idx < 0 ) {
 ret = ogg_read_page ( s , & idx ) ;
 if ( ret < 0 ) return ret ;
 }
 os = ogg -> streams + idx ;
 av_log ( s , AV_LOG_TRACE , "ogg_packet: idx=%d pstart=%d psize=%d segp=%d nsegs=%d\n" , idx , os -> pstart , os -> psize , os -> segp , os -> nsegs ) ;
 if ( ! os -> codec ) {
 if ( os -> header < 0 ) {
 os -> codec = ogg_find_codec ( os -> buf , os -> bufpos ) ;
 if ( ! os -> codec ) {
 av_log ( s , AV_LOG_WARNING , "Codec not found\n" ) ;
 os -> header = 0 ;
 return 0 ;
 }
 }
 else {
 return 0 ;
 }
 }
 segp = os -> segp ;
 psize = os -> psize ;
 while ( os -> segp < os -> nsegs ) {
 int ss = os -> segments [ os -> segp ++ ] ;
 os -> psize += ss ;
 if ( ss < 255 ) {
 complete = 1 ;
 break ;
 }
 }
 if ( ! complete && os -> segp == os -> nsegs ) {
 ogg -> curidx = - 1 ;
 os -> incomplete = ! ! os -> psize ;
 }
 }
 while ( ! complete ) ;
 if ( os -> granule == - 1 ) av_log ( s , AV_LOG_WARNING , "Page at %" PRId64 " is missing granule\n" , os -> page_pos ) ;
 ogg -> curidx = idx ;
 os -> incomplete = 0 ;
 if ( os -> header ) {
 os -> header = os -> codec -> header ( s , idx ) ;
 if ( ! os -> header ) {
 os -> segp = segp ;
 os -> psize = psize ;
 ogg -> headers = 1 ;
 if ( ! s -> internal -> data_offset ) s -> internal -> data_offset = os -> sync_pos ;
 for ( i = 0 ;
 i < ogg -> nstreams ;
 i ++ ) {
 struct ogg_stream * cur_os = ogg -> streams + i ;
 if ( cur_os -> incomplete ) s -> internal -> data_offset = FFMIN ( s -> internal -> data_offset , cur_os -> sync_pos ) ;
 }
 }
 else {
 os -> nb_header ++ ;
 os -> pstart += os -> psize ;
 os -> psize = 0 ;
 }
 }
 else {
 os -> pflags = 0 ;
 os -> pduration = 0 ;
 if ( os -> codec && os -> codec -> packet ) os -> codec -> packet ( s , idx ) ;
 if ( sid ) * sid = idx ;
 if ( dstart ) * dstart = os -> pstart ;
 if ( dsize ) * dsize = os -> psize ;
 if ( fpos ) * fpos = os -> sync_pos ;
 os -> pstart += os -> psize ;
 os -> psize = 0 ;
 if ( os -> pstart == os -> bufpos ) os -> bufpos = os -> pstart = 0 ;
 os -> sync_pos = os -> page_pos ;
 }
 os -> page_end = 1 ;
 for ( i = os -> segp ;
 i < os -> nsegs ;
 i ++ ) if ( os -> segments [ i ] < 255 ) {
 os -> page_end = 0 ;
 break ;
 }
 if ( os -> segp == os -> nsegs ) ogg -> curidx = - 1 ;
 return 0 ;
 }


const char *get_header(HttpRequest req, const char *name) {
        for (HttpHeader p = req->headers; p; p = p->next)
                if (IS(p->name, name))
                        return (p->value);
        return NULL;
}


static void apply_delogo(uint8_t *dst, int dst_linesize,

                         uint8_t *src, int src_linesize,

                         int w, int h, AVRational sar,

                         int logo_x, int logo_y, int logo_w, int logo_h,

                         unsigned int band, int show, int direct)

{

    int x, y;

    uint64_t interp, weightl, weightr, weightt, weightb;

    uint8_t *xdst, *xsrc;

    uint8_t *topleft, *botleft, *topright;

    unsigned int left_sample, right_sample;

    int xclipl, xclipr, yclipt, yclipb;

    int logo_x1, logo_x2, logo_y1, logo_y2;

    xclipl = FFMAX(-logo_x, 0);

    xclipr = FFMAX(logo_x+logo_w-w, 0);

    yclipt = FFMAX(-logo_y, 0);

    yclipb = FFMAX(logo_y+logo_h-h, 0);

    logo_x1 = logo_x + xclipl;

    logo_x2 = logo_x + logo_w - xclipr;

    logo_y1 = logo_y + yclipt;

    logo_y2 = logo_y + logo_h - yclipb;

    topleft  = src+logo_y1     * src_linesize+logo_x1;

    topright = src+logo_y1     * src_linesize+logo_x2-1;

    botleft  = src+(logo_y2-1) * src_linesize+logo_x1;

    if (!direct)

        av_image_copy_plane(dst, dst_linesize, src, src_linesize, w, h);

    dst += (logo_y1 + 1) * dst_linesize;

    src += (logo_y1 + 1) * src_linesize;

    for (y = logo_y1+1; y < logo_y2-1; y++) {

        left_sample = topleft[src_linesize*(y-logo_y1)]   +

                      topleft[src_linesize*(y-logo_y1-1)] +

                      topleft[src_linesize*(y-logo_y1+1)];

        right_sample = topright[src_linesize*(y-logo_y1)]   +

                       topright[src_linesize*(y-logo_y1-1)] +

                       topright[src_linesize*(y-logo_y1+1)];

        for (x = logo_x1+1,

             xdst = dst+logo_x1+1,

             xsrc = src+logo_x1+1; x < logo_x2-1; x++, xdst++, xsrc++) {

            /* Weighted interpolation based on relative distances, taking SAR into account */

            weightl = (uint64_t)              (logo_x2-1-x) * (y-logo_y1) * (logo_y2-1-y) * sar.den;

            weightr = (uint64_t)(x-logo_x1)                 * (y-logo_y1) * (logo_y2-1-y) * sar.den;

            weightt = (uint64_t)(x-logo_x1) * (logo_x2-1-x)               * (logo_y2-1-y) * sar.num;

            weightb = (uint64_t)(x-logo_x1) * (logo_x2-1-x) * (y-logo_y1)                 * sar.num;

            interp =

                left_sample * weightl

                +

                right_sample * weightr

                +

                (topleft[x-logo_x1]    +

                 topleft[x-logo_x1-1]  +

                 topleft[x-logo_x1+1]) * weightt

                +

                (botleft[x-logo_x1]    +

                 botleft[x-logo_x1-1]  +

                 botleft[x-logo_x1+1]) * weightb;

            interp /= (weightl + weightr + weightt + weightb) * 3U;

            if (y >= logo_y+band && y < logo_y+logo_h-band &&

                x >= logo_x+band && x < logo_x+logo_w-band) {

                *xdst = interp;

            } else {

                unsigned dist = 0;

                if      (x < logo_x+band)

                    dist = FFMAX(dist, logo_x-x+band);

                else if (x >= logo_x+logo_w-band)

                    dist = FFMAX(dist, x-(logo_x+logo_w-1-band));

                if      (y < logo_y+band)

                    dist = FFMAX(dist, logo_y-y+band);

                else if (y >= logo_y+logo_h-band)

                    dist = FFMAX(dist, y-(logo_y+logo_h-1-band));

                *xdst = (*xsrc*dist + interp*(band-dist))/band;

                if (show && (dist == band-1))

                    *xdst = 0;

            }

        }

        dst += dst_linesize;

        src += src_linesize;

    }

}


int main ( int argc , char * * argv ) {
 unsigned int i ;
 git_extract_argv0_path ( argv [ 0 ] ) ;
 git_setup_gettext ( ) ;
 if ( argc == 2 && ! strcmp ( argv [ 1 ] , "-h" ) ) usage ( fast_import_usage ) ;
 setup_git_directory ( ) ;
 reset_pack_idx_option ( & pack_idx_opts ) ;
 git_pack_config ( ) ;
 if ( ! pack_compression_seen && core_compression_seen ) pack_compression_level = core_compression_level ;
 alloc_objects ( object_entry_alloc ) ;
 strbuf_init ( & command_buf , 0 ) ;
 atom_table = xcalloc ( atom_table_sz , sizeof ( struct atom_str * ) ) ;
 branch_table = xcalloc ( branch_table_sz , sizeof ( struct branch * ) ) ;
 avail_tree_table = xcalloc ( avail_tree_table_sz , sizeof ( struct avail_tree_content * ) ) ;
 marks = pool_calloc ( 1 , sizeof ( struct mark_set ) ) ;
 global_argc = argc ;
 global_argv = argv ;
 rc_free = pool_alloc ( cmd_save * sizeof ( * rc_free ) ) ;
 for ( i = 0 ;
 i < ( cmd_save - 1 ) ;
 i ++ ) rc_free [ i ] . next = & rc_free [ i + 1 ] ;
 rc_free [ cmd_save - 1 ] . next = NULL ;
 prepare_packed_git ( ) ;
 start_packfile ( ) ;
 set_die_routine ( die_nicely ) ;
 set_checkpoint_signal ( ) ;
 while ( read_next_command ( ) != EOF ) {
 const char * v ;
 if ( ! strcmp ( "blob" , command_buf . buf ) ) parse_new_blob ( ) ;
 else if ( skip_prefix ( command_buf . buf , "ls " , & v ) ) parse_ls ( v , NULL ) ;
 else if ( skip_prefix ( command_buf . buf , "commit " , & v ) ) parse_new_commit ( v ) ;
 else if ( skip_prefix ( command_buf . buf , "tag " , & v ) ) parse_new_tag ( v ) ;
 else if ( skip_prefix ( command_buf . buf , "reset " , & v ) ) parse_reset_branch ( v ) ;
 else if ( ! strcmp ( "checkpoint" , command_buf . buf ) ) parse_checkpoint ( ) ;
 else if ( ! strcmp ( "done" , command_buf . buf ) ) break ;
 else if ( starts_with ( command_buf . buf , "progress " ) ) parse_progress ( ) ;
 else if ( skip_prefix ( command_buf . buf , "feature " , & v ) ) parse_feature ( v ) ;
 else if ( skip_prefix ( command_buf . buf , "option git " , & v ) ) parse_option ( v ) ;
 else if ( starts_with ( command_buf . buf , "option " ) ) ;
 else die ( "Unsupported command: %s" , command_buf . buf ) ;
 if ( checkpoint_requested ) checkpoint ( ) ;
 }
 if ( ! seen_data_command ) parse_argv ( ) ;
 if ( require_explicit_termination && feof ( stdin ) ) die ( "stream ends early" ) ;
 end_packfile ( ) ;
 dump_branches ( ) ;
 dump_tags ( ) ;
 unkeep_all_packs ( ) ;
 dump_marks ( ) ;
 if ( pack_edges ) fclose ( pack_edges ) ;
 if ( show_stats ) {
 uintmax_t total_count = 0 , duplicate_count = 0 ;
 for ( i = 0 ;
 i < ARRAY_SIZE ( object_count_by_type ) ;
 i ++ ) total_count += object_count_by_type [ i ] ;
 for ( i = 0 ;
 i < ARRAY_SIZE ( duplicate_count_by_type ) ;
 i ++ ) duplicate_count += duplicate_count_by_type [ i ] ;
 fprintf ( stderr , "%s statistics:\n" , argv [ 0 ] ) ;
 fprintf ( stderr , "---------------------------------------------------------------------\n" ) ;
 fprintf ( stderr , "Alloc'd objects: %10" PRIuMAX "\n" , alloc_count ) ;
 fprintf ( stderr , "Total objects: %10" PRIuMAX " (%10" PRIuMAX " duplicates )\n" , total_count , duplicate_count ) ;
 fprintf ( stderr , " blobs : %10" PRIuMAX " (%10" PRIuMAX " duplicates %10" PRIuMAX " deltas of %10" PRIuMAX " attempts)\n" , object_count_by_type [ OBJ_BLOB ] , duplicate_count_by_type [ OBJ_BLOB ] , delta_count_by_type [ OBJ_BLOB ] , delta_count_attempts_by_type [ OBJ_BLOB ] ) ;
 fprintf ( stderr , " trees : %10" PRIuMAX " (%10" PRIuMAX " duplicates %10" PRIuMAX " deltas of %10" PRIuMAX " attempts)\n" , object_count_by_type [ OBJ_TREE ] , duplicate_count_by_type [ OBJ_TREE ] , delta_count_by_type [ OBJ_TREE ] , delta_count_attempts_by_type [ OBJ_TREE ] ) ;
 fprintf ( stderr , " commits: %10" PRIuMAX " (%10" PRIuMAX " duplicates %10" PRIuMAX " deltas of %10" PRIuMAX " attempts)\n" , object_count_by_type [ OBJ_COMMIT ] , duplicate_count_by_type [ OBJ_COMMIT ] , delta_count_by_type [ OBJ_COMMIT ] , delta_count_attempts_by_type [ OBJ_COMMIT ] ) ;
 fprintf ( stderr , " tags : %10" PRIuMAX " (%10" PRIuMAX " duplicates %10" PRIuMAX " deltas of %10" PRIuMAX " attempts)\n" , object_count_by_type [ OBJ_TAG ] , duplicate_count_by_type [ OBJ_TAG ] , delta_count_by_type [ OBJ_TAG ] , delta_count_attempts_by_type [ OBJ_TAG ] ) ;
 fprintf ( stderr , "Total branches: %10lu (%10lu loads )\n" , branch_count , branch_load_count ) ;
 fprintf ( stderr , " marks: %10" PRIuMAX " (%10" PRIuMAX " unique )\n" , ( ( ( uintmax_t ) 1 ) << marks -> shift ) * 1024 , marks_set_count ) ;
 fprintf ( stderr , " atoms: %10u\n" , atom_cnt ) ;
 fprintf ( stderr , "Memory total: %10" PRIuMAX " KiB\n" , ( total_allocd + alloc_count * sizeof ( struct object_entry ) ) / 1024 ) ;
 fprintf ( stderr , " pools: %10lu KiB\n" , ( unsigned long ) ( total_allocd / 1024 ) ) ;
 fprintf ( stderr , " objects: %10" PRIuMAX " KiB\n" , ( alloc_count * sizeof ( struct object_entry ) ) / 1024 ) ;
 fprintf ( stderr , "---------------------------------------------------------------------\n" ) ;
 pack_report ( ) ;
 fprintf ( stderr , "---------------------------------------------------------------------\n" ) ;
 fprintf ( stderr , "\n" ) ;
 }
 return failure ? 1 : 0 ;
 }


prologProcessor(XML_Parser parser, const char *s, const char *end,
                const char **nextPtr) {
  const char *next = s;
  int tok = XmlPrologTok(parser->m_encoding, s, end, &next);
  return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr,
                  (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE);
}


static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid)
{
	__be32 *p;
	int ret = 0;

	*fileid = 0;
	if (unlikely(bitmap[1] & (FATTR4_WORD1_MOUNTED_ON_FILEID - 1U)))
		return -EIO;
	if (likely(bitmap[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)) {
		p = xdr_inline_decode(xdr, 8);
		if (unlikely(!p))
			goto out_overflow;
		xdr_decode_hyper(p, fileid);
		bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
		ret = NFS_ATTR_FATTR_MOUNTED_ON_FILEID;
	}
	dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid);
	return ret;
out_overflow:
	print_overflow_msg(__func__, xdr);
	return -EIO;
}


void * hb_shape_plan_get_user_data ( hb_shape_plan_t * shape_plan , hb_user_data_key_t * key ) {
 return hb_object_get_user_data ( shape_plan , key ) ;
 }


static int ciedefgvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_comps)
{
    os_ptr op = osp;
    int i;

    if (num_comps < 4)
        return_error(gs_error_stackunderflow);

    op -= 3;
    for (i=0;i < 4;i++) {
        if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
            return_error(gs_error_typecheck);
        op++;
    }
    return 0;
}


static GF_Node *lsr_read_linearGradient(GF_LASeRCodec *lsr)
{
	GF_Node *elt = gf_node_new(lsr->sg, TAG_SVG_linearGradient);
	lsr_read_id(lsr, elt);
	lsr_read_rare(lsr, elt);
	lsr_read_fill(lsr, elt);
	lsr_read_stroke(lsr, elt);
	lsr_read_gradient_units(lsr, elt);
	lsr_read_coordinate_ptr(lsr, elt, TAG_SVG_ATT_x1, 1, "x1");
	lsr_read_coordinate_ptr(lsr, elt, TAG_SVG_ATT_x2, 1, "x2");
	lsr_read_coordinate_ptr(lsr, elt, TAG_SVG_ATT_y1, 1, "y1");
	lsr_read_coordinate_ptr(lsr, elt, TAG_SVG_ATT_y2, 1, "y2");
	lsr_read_any_attribute(lsr, elt, 1);
	lsr_read_group_content(lsr, elt, 0);
	return elt;
}


Packet *StreamTcpPseudoSetup(Packet *parent, uint8_t *pkt, uint32_t len)
{
    SCEnter();

    if (len == 0) {
        SCReturnPtr(NULL, "Packet");
    }

    Packet *p = PacketGetFromQueueOrAlloc();
    if (p == NULL) {
        SCReturnPtr(NULL, "Packet");
    }

    /* set the root ptr to the lowest layer */
    if (parent->root != NULL)
        p->root = parent->root;
    else
        p->root = parent;

    /* copy packet and set length, proto */
    p->proto = parent->proto;
    p->datalink = parent->datalink;

    PacketCopyData(p, pkt, len);
    p->recursion_level = parent->recursion_level + 1;
    p->ts.tv_sec = parent->ts.tv_sec;
    p->ts.tv_usec = parent->ts.tv_usec;

    FlowReference(&p->flow, parent->flow);
    /* set tunnel flags */

    /* tell new packet it's part of a tunnel */
    SET_TUNNEL_PKT(p);
    /* tell parent packet it's part of a tunnel */
    SET_TUNNEL_PKT(parent);

    /* increment tunnel packet refcnt in the root packet */
    TUNNEL_INCR_PKT_TPR(p);

    return p;
}


static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod7(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSTestObj::s_info))
        return throwVMTypeError(exec);
    JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 1)
        return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
     DOMStringList* arrayArg(toDOMStringList(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
    impl->overloadedMethod(arrayArg);
    return JSValue::encode(jsUndefined());
}


static bool ahci_map_fis_address(AHCIDevice *ad)
{
    AHCIPortRegs *pr = &ad->port_regs;
    map_page(ad->hba->as, &ad->res_fis,
             ((uint64_t)pr->fis_addr_hi << 32) | pr->fis_addr, 256);
    if (ad->res_fis != NULL) {
        pr->cmd |= PORT_CMD_FIS_ON;
        return true;
    }

    pr->cmd &= ~PORT_CMD_FIS_ON;
    return false;
}


xfs_file_fallocate(
	struct file		*file,
	int			mode,
	loff_t			offset,
	loff_t			len)
{
	struct inode		*inode = file_inode(file);
	struct xfs_inode	*ip = XFS_I(inode);
	struct xfs_trans	*tp;
	long			error;
	loff_t			new_size = 0;

	if (!S_ISREG(inode->i_mode))
		return -EINVAL;
	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
		     FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE))
		return -EOPNOTSUPP;

	xfs_ilock(ip, XFS_IOLOCK_EXCL);
	if (mode & FALLOC_FL_PUNCH_HOLE) {
		error = xfs_free_file_space(ip, offset, len);
		if (error)
			goto out_unlock;
	} else if (mode & FALLOC_FL_COLLAPSE_RANGE) {
		unsigned blksize_mask = (1 << inode->i_blkbits) - 1;

		if (offset & blksize_mask || len & blksize_mask) {
			error = -EINVAL;
			goto out_unlock;
		}

		/*
		 * There is no need to overlap collapse range with EOF,
		 * in which case it is effectively a truncate operation
		 */
		if (offset + len >= i_size_read(inode)) {
			error = -EINVAL;
			goto out_unlock;
		}

		new_size = i_size_read(inode) - len;

		error = xfs_collapse_file_space(ip, offset, len);
		if (error)
			goto out_unlock;
	} else {
		if (!(mode & FALLOC_FL_KEEP_SIZE) &&
		    offset + len > i_size_read(inode)) {
			new_size = offset + len;
			error = -inode_newsize_ok(inode, new_size);
			if (error)
				goto out_unlock;
		}

		if (mode & FALLOC_FL_ZERO_RANGE)
			error = xfs_zero_file_space(ip, offset, len);
		else
			error = xfs_alloc_file_space(ip, offset, len,
						     XFS_BMAPI_PREALLOC);
		if (error)
			goto out_unlock;
	}

	tp = xfs_trans_alloc(ip->i_mount, XFS_TRANS_WRITEID);
	error = xfs_trans_reserve(tp, &M_RES(ip->i_mount)->tr_writeid, 0, 0);
	if (error) {
		xfs_trans_cancel(tp, 0);
		goto out_unlock;
	}

	xfs_ilock(ip, XFS_ILOCK_EXCL);
	xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
	ip->i_d.di_mode &= ~S_ISUID;
	if (ip->i_d.di_mode & S_IXGRP)
		ip->i_d.di_mode &= ~S_ISGID;

	if (!(mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE)))
		ip->i_d.di_flags |= XFS_DIFLAG_PREALLOC;

	xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
	xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);

	if (file->f_flags & O_DSYNC)
		xfs_trans_set_sync(tp);
	error = xfs_trans_commit(tp, 0);
	if (error)
		goto out_unlock;

	/* Change file size if needed */
	if (new_size) {
		struct iattr iattr;

		iattr.ia_valid = ATTR_SIZE;
		iattr.ia_size = new_size;
		error = xfs_setattr_size(ip, &iattr);
	}

out_unlock:
	xfs_iunlock(ip, XFS_IOLOCK_EXCL);
	return -error;
}


static void voidMethodOptionalLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
    TestObjectPythonV8Internal::voidMethodOptionalLongArgMethod(info);
    TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}


static kadm5_ret_t apply_keysalt_policy ( kadm5_server_handle_t handle , const char * policy , int n_ks_tuple , krb5_key_salt_tuple * ks_tuple , int * new_n_kstp , krb5_key_salt_tuple * * new_kstp ) {
 kadm5_ret_t ret ;
 kadm5_policy_ent_rec polent ;
 krb5_boolean have_polent ;
 int ak_n_ks_tuple = 0 ;
 int new_n_ks_tuple = 0 ;
 krb5_key_salt_tuple * ak_ks_tuple = NULL ;
 krb5_key_salt_tuple * new_ks_tuple = NULL ;
 krb5_key_salt_tuple * subset ;
 int i , m ;
 if ( new_n_kstp != NULL ) {
 * new_n_kstp = 0 ;
 * new_kstp = NULL ;
 }
 memset ( & polent , 0 , sizeof ( polent ) ) ;
 ret = get_policy ( handle , policy , & polent , & have_polent ) ;
 if ( ret ) goto cleanup ;
 if ( polent . allowed_keysalts == NULL ) {
 if ( n_ks_tuple == 0 ) {
 n_ks_tuple = handle -> params . num_keysalts ;
 ks_tuple = handle -> params . keysalts ;
 }
 new_ks_tuple = malloc ( n_ks_tuple * sizeof ( * new_ks_tuple ) ) ;
 if ( new_ks_tuple == NULL ) {
 ret = ENOMEM ;
 goto cleanup ;
 }
 memcpy ( new_ks_tuple , ks_tuple , n_ks_tuple * sizeof ( * new_ks_tuple ) ) ;
 new_n_ks_tuple = n_ks_tuple ;
 ret = 0 ;
 goto cleanup ;
 }
 ret = krb5_string_to_keysalts ( polent . allowed_keysalts , "," , NULL , 0 , & ak_ks_tuple , & ak_n_ks_tuple ) ;
 if ( ret ) goto cleanup ;
 for ( i = 0 ;
 i < n_ks_tuple ;
 i ++ ) {
 if ( ! ks_tuple_present ( ak_n_ks_tuple , ak_ks_tuple , & ks_tuple [ i ] ) ) {
 ret = KADM5_BAD_KEYSALTS ;
 goto cleanup ;
 }
 }
 if ( n_ks_tuple == 0 ) {
 new_n_ks_tuple = ak_n_ks_tuple ;
 new_ks_tuple = ak_ks_tuple ;
 ak_ks_tuple = NULL ;
 goto cleanup ;
 }
 subset = calloc ( n_ks_tuple , sizeof ( * subset ) ) ;
 if ( subset == NULL ) {
 ret = ENOMEM ;
 goto cleanup ;
 }
 for ( m = 0 , i = 0 ;
 i < ak_n_ks_tuple && m < n_ks_tuple ;
 i ++ ) {
 if ( ks_tuple_present ( n_ks_tuple , ks_tuple , & ak_ks_tuple [ i ] ) ) subset [ m ++ ] = ak_ks_tuple [ i ] ;
 }
 new_ks_tuple = subset ;
 new_n_ks_tuple = m ;
 ret = 0 ;
 cleanup : if ( have_polent ) kadm5_free_policy_ent ( handle -> lhandle , & polent ) ;
 free ( ak_ks_tuple ) ;
 if ( new_n_kstp != NULL ) {
 * new_n_kstp = new_n_ks_tuple ;
 * new_kstp = new_ks_tuple ;
 }
 else {
 free ( new_ks_tuple ) ;
 }
 return ret ;
 }


DU_cechoStatusString(Uint16 statusCode)
{
    const char *s = NULL;

    if (statusCode == STATUS_Success)
        s = "Success";
    else {
        sprintf(staticBuf, "Unknown Status: 0x%x", (unsigned int)statusCode);
        s = staticBuf;
    }
    return s;
}


  absl::Status IsSupported(const TfLiteContext* context,
                           const TfLiteNode* tflite_node,
                           const TfLiteRegistration* registration) final {
    return CheckInputsOutputs(context, tflite_node,
                              /*runtime_inputs=*/2, /*outputs=*/1);
  }


bool InputHandler::didNodeOpenPopup(Node* node)
{
    if (!node)
        return false;

    ASSERT(!node->isInShadowTree());

    if (node->hasTagName(HTMLNames::selectTag))
        return openSelectPopup(static_cast<HTMLSelectElement*>(node));

    if (node->hasTagName(HTMLNames::optionTag)) {
        HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(node);
        return openSelectPopup(optionElement->ownerSelectElement());
    }

    if (HTMLInputElement* element = node->toInputElement()) {
        if (DOMSupport::isDateTimeInputField(element))
            return openDatePopup(element, elementType(element));

        if (DOMSupport::isColorInputField(element))
            return openColorPopup(element);
    }
    return false;
}


BackingStore* RenderWidgetHostViewAura::AllocBackingStore(
    const gfx::Size& size) {
  return new BackingStoreAura(host_, size);
}


exif_data_load_data (ExifData *data, const unsigned char *d_orig,
		     unsigned int ds)
{
	unsigned int l;
	ExifLong offset;
	ExifShort n;
	const unsigned char *d = d_orig;
	unsigned int len, fullds;

	if (!data || !data->priv || !d || !ds)
		return;

	exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
		  "Parsing %i byte(s) EXIF data...\n", ds);

	/*
	 * It can be that the data starts with the EXIF header. If it does
	 * not, search the EXIF marker.
	 */
	if (ds < 6) {
		LOG_TOO_SMALL;
		return;
	}
	if (!memcmp (d, ExifHeader, 6)) {
		exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
			  "Found EXIF header at start.");
	} else {
		while (ds >= 3) {
			while (ds && (d[0] == 0xff)) {
				d++;
				ds--;
			}

			/* JPEG_MARKER_SOI */
			if (ds && d[0] == JPEG_MARKER_SOI) {
				d++;
				ds--;
				continue;
			}

			/* JPEG_MARKER_APP1 */
			if (ds && d[0] == JPEG_MARKER_APP1)
				break;

			/* Skip irrelevant APP markers. The branch for APP1 must come before this,
			   otherwise this code block will cause APP1 to be skipped. This code path
			   is only relevant for files that are nonconformant to the EXIF
			   specification. For conformant files, the APP1 code path above will be
			   taken. */
			if (ds >= 3 && d[0] >= 0xe0 && d[0] <= 0xef) {  /* JPEG_MARKER_APPn */
				d++;
				ds--;
				l = (d[0] << 8) | d[1];
				if (l > ds)
					return;
				d += l;
				ds -= l;
				continue;
			}

			/* Unknown marker or data. Give up. */
			exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA,
				  "ExifData", _("EXIF marker not found."));
			return;
		}
		if (ds < 3) {
			LOG_TOO_SMALL;
			return;
		}
		d++;
		ds--;
		len = (d[0] << 8) | d[1];
		exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
			  "We have to deal with %i byte(s) of EXIF data.",
			  len);
		d += 2;
		ds -= 2;
	}

	/*
	 * Verify the exif header
	 * (offset 2, length 6).
	 */
	if (ds < 6) {
		LOG_TOO_SMALL;
		return;
	}
	if (memcmp (d, ExifHeader, 6)) {
		exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA,
			  "ExifData", _("EXIF header not found."));
		return;
	}

	exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
		  "Found EXIF header.");

	/* Sanity check the data length */
	if (ds < 14)
		return;

	/* The JPEG APP1 section can be no longer than 64 KiB (including a
	   16-bit length), so cap the data length to protect against overflow
	   in future offset calculations */
	fullds = ds;
	if (ds > 0xfffe)
		ds = 0xfffe;

	/* Byte order (offset 6, length 2) */
	if (!memcmp (d + 6, "II", 2))
		data->priv->order = EXIF_BYTE_ORDER_INTEL;
	else if (!memcmp (d + 6, "MM", 2))
		data->priv->order = EXIF_BYTE_ORDER_MOTOROLA;
	else {
		exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA,
			  "ExifData", _("Unknown encoding."));
		return;
	}

	/* Fixed value */
	if (exif_get_short (d + 8, data->priv->order) != 0x002a)
		return;

	/* IFD 0 offset */
	offset = exif_get_long (d + 10, data->priv->order);
	exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
		  "IFD 0 at %i.", (int) offset);

	/* ds is restricted to 16 bit above, so offset is restricted too, and offset+8 should not overflow. */
	if (offset > ds || offset + 6 + 2 > ds)
		return;

	/* Parse the actual exif data (usually offset 14 from start) */
	exif_data_load_data_content (data, EXIF_IFD_0, d + 6, ds - 6, offset, 0);

	/* IFD 1 offset */
	n = exif_get_short (d + 6 + offset, data->priv->order);
	/* offset < 2<<16, n is 16 bit at most, so this op will not overflow */
	if (offset + 6 + 2 + 12 * n + 4 > ds)
		return;

	offset = exif_get_long (d + 6 + offset + 2 + 12 * n, data->priv->order);
	if (offset) {
		exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
			  "IFD 1 at %i.", (int) offset);

		/* Sanity check. ds is ensured to be above 6 above, offset is 16bit */
		if (offset > ds - 6) {
			exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA,
				  "ExifData", "Bogus offset of IFD1.");
		} else {
		   exif_data_load_data_content (data, EXIF_IFD_1, d + 6, ds - 6, offset, 0);
		}
	}

	/*
	 * If we got an EXIF_TAG_MAKER_NOTE, try to interpret it. Some
	 * cameras use pointers in the maker note tag that point to the
	 * space between IFDs. Here is the only place where we have access
	 * to that data.
	 */
	interpret_maker_note(data, d, fullds);

	/* Fixup tags if requested */
	if (data->priv->options & EXIF_DATA_OPTION_FOLLOW_SPECIFICATION)
		exif_data_fix (data);
}


int ip_options_get_from_user(struct net *net, struct ip_options **optp,
			     unsigned char __user *data, int optlen)
{
	struct ip_options *opt = ip_options_get_alloc(optlen);

	if (!opt)
		return -ENOMEM;
	if (optlen && copy_from_user(opt->__data, data, optlen)) {
		kfree(opt);
		return -EFAULT;
	}
	return ip_options_get_finish(net, optp, opt, optlen);
}


void NotifyPrunedEntries(NavigationController* nav_controller,
                         bool from_front,
                         int count) {
  NavigationController::PrunedDetails details;
  details.from_front = from_front;
  details.count = count;
  NotificationService::current()->Notify(
      NotificationType::NAV_LIST_PRUNED,
      Source<NavigationController>(nav_controller),
      Details<NavigationController::PrunedDetails>(&details));
}


void SetBuildInfoAnnotations(std::map<std::string, std::string>* annotations) {
  base::android::BuildInfo* info = base::android::BuildInfo::GetInstance();

   (*annotations)["android_build_id"] = info->android_build_id();
   (*annotations)["android_build_fp"] = info->android_build_fp();
   (*annotations)["device"] = info->device();
   (*annotations)["model"] = info->model();
   (*annotations)["brand"] = info->brand();
  (*annotations)["board"] = info->board();
  (*annotations)["installer_package_name"] = info->installer_package_name();
  (*annotations)["abi_name"] = info->abi_name();
  (*annotations)["custom_themes"] = info->custom_themes();
  (*annotations)["resources_verison"] = info->resources_version();
  (*annotations)["gms_core_version"] = info->gms_version_code();

  if (info->firebase_app_id()[0] != '\0') {
    (*annotations)["package"] = std::string(info->firebase_app_id()) + " v" +
                                info->package_version_code() + " (" +
                                info->package_version_name() + ")";
  }
}


inline CachedShapingResults* HarfBuzzRunCache::find(const std::wstring& key) const
{
    CachedShapingResultsMap::const_iterator it = m_harfBuzzRunMap.find(key);

    return it != m_harfBuzzRunMap.end() ? it->second : 0;
}


Auth::Digest::Config::type() const
{
    return Auth::Digest::Scheme::GetInstance()->type();
}


int wc_ecc_size(ecc_key* key)
{
    if (key == NULL) return 0;

    return key->dp->size;
}


  void connectSuccess() noexcept override {
    std::cerr << "client SSL socket connected" << std::endl;
    if (sslSocket_->getSSLSessionReused()) {
      hit_++;
    } else {
      miss_++;
      if (session_ != nullptr) {
        SSL_SESSION_free(session_);
      }
      session_ = sslSocket_->getSSLSession();
    }

    // write()
    sslSocket_->setMaxReadsPerEvent(kMaxReadsPerEvent);
    sslSocket_->write(this, buf_, sizeof(buf_));
    sslSocket_->setReadCB(this);
    memset(readbuf_, 'b', sizeof(readbuf_));
    bytesRead_ = 0;
  }


bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta)
{
    if (!contentsInCompositedLayer() || hasSlowRepaintObjects())
        return false;

    if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()) {
        hostWindow()->scroll();
        return true;
    }

    Region regionToUpdate;
    ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObjects->end();
    for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrainedObjects->begin(); it != end; ++it) {
        RenderObject* renderer = *it;
        ASSERT(renderer->style()->hasViewportConstrainedPosition());
        ASSERT(renderer->hasLayer());
        RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();

        CompositingState state = layer->compositingState();
        if (state == PaintsIntoOwnBacking || state == PaintsIntoGroupedBacking)
            continue;

        if (layer->subtreeIsInvisible())
            continue;

        if (layer->hasAncestorWithFilterOutsets())
            return false;

        IntRect updateRect = pixelSnappedIntRect(layer->paintInvalidator().paintInvalidationRectIncludingNonCompositingDescendants());

        const RenderLayerModelObject* repaintContainer = layer->renderer()->containerForPaintInvalidation();
        if (repaintContainer && !repaintContainer->isRenderView()) {
            updateRect.moveBy(scrollPosition());
            IntRect previousRect = updateRect;
            previousRect.move(scrollDelta);
            updateRect.unite(previousRect);
            layer->renderer()->invalidatePaintUsingContainer(repaintContainer, updateRect, InvalidationScroll);
        } else {
            updateRect = contentsToRootView(updateRect);
            if (!updateRect.isEmpty())
                regionToUpdate.unite(updateRect);
        }
    }

    hostWindow()->scroll();

    Vector<IntRect> subRectsToUpdate = regionToUpdate.rects();
    size_t viewportConstrainedObjectsCount = subRectsToUpdate.size();
    for (size_t i = 0; i < viewportConstrainedObjectsCount; ++i) {
        IntRect updateRect = subRectsToUpdate[i];
        IntRect scrolledRect = updateRect;
        scrolledRect.move(-scrollDelta);
        updateRect.unite(scrolledRect);
        renderView()->layer()->paintInvalidator().setBackingNeedsPaintInvalidationInRect(rootViewToContents(updateRect));
    }

    return true;
}


static int dissect_h245_SEQUENCE_SIZE_1_256_OF_QOSCapability ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
 offset = dissect_per_constrained_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h245_SEQUENCE_SIZE_1_256_OF_QOSCapability , SEQUENCE_SIZE_1_256_OF_QOSCapability_sequence_of , 1 , 256 , FALSE ) ;
 return offset ;
 }


  virtual void GetQuotaLimitHeuristics(
      QuotaLimitHeuristics* heuristics) const {
    heuristics->push_back(new SustainedLimit(TimeDelta::FromMinutes(5),
        k2PerMinute, new Mapper()));
    heuristics->push_back(new TimedLimit(k20PerHour, new Mapper()));
  }


void HTMLElement::addHTMLLengthToStyle(StylePropertySet* style, CSSPropertyID propertyID, const String& value)
{

    StringImpl* v = value.impl();
    if (v) {
        unsigned int l = 0;

        while (l < v->length() && (*v)[l] <= ' ')
            l++;

        for (; l < v->length(); l++) {
            UChar cc = (*v)[l];
            if (cc > '9')
                break;
            if (cc < '0') {
                if (cc == '%' || cc == '*')
                    l++;
                if (cc != '.')
                    break;
            }
        }

        if (l != v->length()) {
            addPropertyToAttributeStyle(style, propertyID, v->substring(0, l));
            return;
        }
    }

    addPropertyToAttributeStyle(style, propertyID, value);
}


format_METER(const struct ofpact_meter *a, struct ds *s)
{
    ds_put_format(s, "%smeter:%s%"PRIu32,
                  colors.param, colors.end, a->meter_id);
}


void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged, bool heightChanged)
{
    if (!hasViewportConstrainedObjects())
        return;

    if (m_frame->settings()
        && !m_frame->settings()->viewportEnabled()
        && !m_frame->settings()->pinchVirtualViewportEnabled())
        return;

    ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObjects->end();
    for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrainedObjects->begin(); it != end; ++it) {
        RenderObject* renderer = *it;
        RenderStyle* style = renderer->style();
        if (widthChanged) {
            if (style->width().isFixed() && (style->left().isAuto() || style->right().isAuto()))
                renderer->setNeedsPositionedMovementLayout();
            else
                renderer->setNeedsLayoutAndFullPaintInvalidation();
        }
        if (heightChanged) {
            if (style->height().isFixed() && (style->top().isAuto() || style->bottom().isAuto()))
                renderer->setNeedsPositionedMovementLayout();
            else
                renderer->setNeedsLayoutAndFullPaintInvalidation();
        }
    }
}