path
stringlengths 14
112
| content
stringlengths 0
6.32M
| size
int64 0
6.32M
| max_lines
int64 1
100k
| repo_name
stringclasses 2
values | autogenerated
bool 1
class |
---|---|---|---|---|---|
cosmopolitan/third_party/lua/lcorolib.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â â
â Lua â
â Copyright © 2004-2021 Lua.org, PUC-Rio. â
â â
â Permission is hereby granted, free of charge, to any person obtaining â
â a copy of this software and associated documentation files (the â
â "Software"), to deal in the Software without restriction, including â
â without limitation the rights to use, copy, modify, merge, publish, â
â distribute, sublicense, and/or sell copies of the Software, and to â
â permit persons to whom the Software is furnished to do so, subject to â
â the following conditions: â
â â
â The above copyright notice and this permission notice shall be â
â included in all copies or substantial portions of the Software. â
â â
â THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, â
â EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF â
â MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. â
â IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY â
â CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, â
â TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE â
â SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. â
â â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#define lcorolib_c
#define LUA_LIB
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/lprefix.h"
#include "third_party/lua/lua.h"
#include "third_party/lua/lualib.h"
// clang-format off
asm(".ident\t\"\\n\\n\
Lua 5.4.3 (MIT License)\\n\
Copyright 1994â2021 Lua.org, PUC-Rio.\"");
asm(".include \"libc/disclaimer.inc\"");
static lua_State *getco (lua_State *L) {
lua_State *co = lua_tothread(L, 1);
luaL_argexpected(L, co, 1, "thread");
return co;
}
/*
** Resumes a coroutine. Returns the number of results for non-error
** cases or -1 for errors.
*/
static int auxresume (lua_State *L, lua_State *co, int narg) {
int status, nres;
if (l_unlikely(!lua_checkstack(co, narg))) {
lua_pushliteral(L, "too many arguments to resume");
return -1; /* error flag */
}
lua_xmove(L, co, narg);
status = lua_resume(co, L, narg, &nres);
if (l_likely(status == LUA_OK || status == LUA_YIELD)) {
if (l_unlikely(!lua_checkstack(L, nres + 1))) {
lua_pop(co, nres); /* remove results anyway */
lua_pushliteral(L, "too many results to resume");
return -1; /* error flag */
}
lua_xmove(co, L, nres); /* move yielded values */
return nres;
}
else {
lua_xmove(co, L, 1); /* move error message */
return -1; /* error flag */
}
}
static int luaB_coresume (lua_State *L) {
lua_State *co = getco(L);
int r;
r = auxresume(L, co, lua_gettop(L) - 1);
if (l_unlikely(r < 0)) {
lua_pushboolean(L, 0);
lua_insert(L, -2);
return 2; /* return false + error message */
}
else {
lua_pushboolean(L, 1);
lua_insert(L, -(r + 1));
return r + 1; /* return true + 'resume' returns */
}
}
static int luaB_auxwrap (lua_State *L) {
lua_State *co = lua_tothread(L, lua_upvalueindex(1));
int r = auxresume(L, co, lua_gettop(L));
if (l_unlikely(r < 0)) { /* error? */
int stat = lua_status(co);
if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */
stat = lua_resetthread(co); /* close its tbc variables */
lua_assert(stat != LUA_OK);
lua_xmove(co, L, 1); /* copy error message */
}
if (stat != LUA_ERRMEM && /* not a memory error and ... */
lua_type(L, -1) == LUA_TSTRING) { /* ... error object is a string? */
luaL_where(L, 1); /* add extra info, if available */
lua_insert(L, -2);
lua_concat(L, 2);
}
return lua_error(L); /* propagate error */
}
return r;
}
static int luaB_cocreate (lua_State *L) {
lua_State *NL;
luaL_checktype(L, 1, LUA_TFUNCTION);
NL = lua_newthread(L);
lua_pushvalue(L, 1); /* move function to top */
lua_xmove(L, NL, 1); /* move function from L to NL */
return 1;
}
static int luaB_cowrap (lua_State *L) {
luaB_cocreate(L);
lua_pushcclosure(L, luaB_auxwrap, 1);
return 1;
}
static int luaB_yield (lua_State *L) {
return lua_yield(L, lua_gettop(L));
}
#define COS_RUN 0
#define COS_DEAD 1
#define COS_YIELD 2
#define COS_NORM 3
static const char *const statname[] =
{"running", "dead", "suspended", "normal"};
static int auxstatus (lua_State *L, lua_State *co) {
if (L == co) return COS_RUN;
else {
switch (lua_status(co)) {
case LUA_YIELD:
return COS_YIELD;
case LUA_OK: {
lua_Debug ar;
if (lua_getstack(co, 0, &ar)) /* does it have frames? */
return COS_NORM; /* it is running */
else if (lua_gettop(co) == 0)
return COS_DEAD;
else
return COS_YIELD; /* initial state */
}
default: /* some error occurred */
return COS_DEAD;
}
}
}
static int luaB_costatus (lua_State *L) {
lua_State *co = getco(L);
lua_pushstring(L, statname[auxstatus(L, co)]);
return 1;
}
static int luaB_yieldable (lua_State *L) {
lua_State *co = lua_isnone(L, 1) ? L : getco(L);
lua_pushboolean(L, lua_isyieldable(co));
return 1;
}
static int luaB_corunning (lua_State *L) {
int ismain = lua_pushthread(L);
lua_pushboolean(L, ismain);
return 2;
}
static int luaB_close (lua_State *L) {
lua_State *co = getco(L);
int status = auxstatus(L, co);
switch (status) {
case COS_DEAD: case COS_YIELD: {
status = lua_resetthread(co);
if (status == LUA_OK) {
lua_pushboolean(L, 1);
return 1;
}
else {
lua_pushboolean(L, 0);
lua_xmove(co, L, 1); /* copy error message */
return 2;
}
}
default: /* normal or running coroutine */
return luaL_error(L, "cannot close a %s coroutine", statname[status]);
}
}
static const luaL_Reg co_funcs[] = {
{"create", luaB_cocreate},
{"resume", luaB_coresume},
{"running", luaB_corunning},
{"status", luaB_costatus},
{"wrap", luaB_cowrap},
{"yield", luaB_yield},
{"isyieldable", luaB_yieldable},
{"close", luaB_close},
{NULL, NULL}
};
LUAMOD_API int luaopen_coroutine (lua_State *L) {
luaL_newlib(L, co_funcs);
return 1;
}
| 7,553 | 232 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/luaparseurl.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¡
â Copyright 2022 Justine Alexandra Roberts Tunney â
â â
â Permission to use, copy, modify, and/or distribute this software for â
â any purpose with or without fee is hereby granted, provided that the â
â above copyright notice and this permission notice appear in all copies. â
â â
â THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL â
â WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED â
â WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE â
â AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL â
â DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR â
â PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER â
â TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR â
â PERFORMANCE OF THIS SOFTWARE. â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/mem/mem.h"
#include "net/http/url.h"
#include "third_party/lua/cosmo.h"
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/lua.h"
static void LuaPushUrlView(lua_State *L, struct UrlView *v) {
if (v->p) {
lua_pushlstring(L, v->p, v->n);
} else {
lua_pushnil(L);
}
}
static void LuaSetUrlView(lua_State *L, struct UrlView *v, const char *k) {
LuaPushUrlView(L, v);
lua_setfield(L, -2, k);
}
int LuaParseUrl(lua_State *L) {
int f;
void *m;
size_t n;
struct Url h;
const char *p;
p = luaL_checklstring(L, 1, &n);
f = luaL_optinteger(L, 2, 0);
m = ParseUrl(p, n, &h, f);
lua_newtable(L);
LuaSetUrlView(L, &h.scheme, "scheme");
LuaSetUrlView(L, &h.user, "user");
LuaSetUrlView(L, &h.pass, "pass");
LuaSetUrlView(L, &h.host, "host");
LuaSetUrlView(L, &h.port, "port");
LuaSetUrlView(L, &h.path, "path");
LuaSetUrlView(L, &h.fragment, "fragment");
LuaPushUrlParams(L, &h.params);
lua_setfield(L, -2, "params");
free(h.params.p);
free(m);
return 1;
}
| 2,868 | 61 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/gc.lua | -- $Id: test/gc.lua $
-- See Copyright Notice in file all.lua
print('testing incremental garbage collection')
local debug = require"debug"
assert(collectgarbage("isrunning"))
collectgarbage()
local oldmode = collectgarbage("incremental")
-- changing modes should return previous mode
assert(collectgarbage("generational") == "incremental")
assert(collectgarbage("generational") == "generational")
assert(collectgarbage("incremental") == "generational")
assert(collectgarbage("incremental") == "incremental")
local function nop () end
local function gcinfo ()
return collectgarbage"count" * 1024
end
-- test weird parameters to 'collectgarbage'
do
-- save original parameters
local a = collectgarbage("setpause", 200)
local b = collectgarbage("setstepmul", 200)
local t = {0, 2, 10, 90, 500, 5000, 30000, 0x7ffffffe}
for i = 1, #t do
local p = t[i]
for j = 1, #t do
local m = t[j]
collectgarbage("setpause", p)
collectgarbage("setstepmul", m)
collectgarbage("step", 0)
collectgarbage("step", 10000)
end
end
-- restore original parameters
collectgarbage("setpause", a)
collectgarbage("setstepmul", b)
collectgarbage()
end
_G["while"] = 234
--
-- tests for GC activation when creating different kinds of objects
--
local function GC1 ()
local u
local b -- (above 'u' it in the stack)
local finish = false
u = setmetatable({}, {__gc = function () finish = true end})
b = {34}
repeat u = {} until finish
assert(b[1] == 34) -- 'u' was collected, but 'b' was not
finish = false; local i = 1
u = setmetatable({}, {__gc = function () finish = true end})
repeat i = i + 1; u = tostring(i) .. tostring(i) until finish
assert(b[1] == 34) -- 'u' was collected, but 'b' was not
finish = false
u = setmetatable({}, {__gc = function () finish = true end})
repeat local i; u = function () return i end until finish
assert(b[1] == 34) -- 'u' was collected, but 'b' was not
end
local function GC2 ()
local u
local finish = false
u = {setmetatable({}, {__gc = function () finish = true end})}
local b = {34}
repeat u = {{}} until finish
assert(b[1] == 34) -- 'u' was collected, but 'b' was not
finish = false; local i = 1
u = {setmetatable({}, {__gc = function () finish = true end})}
repeat i = i + 1; u = {tostring(i) .. tostring(i)} until finish
assert(b[1] == 34) -- 'u' was collected, but 'b' was not
finish = false
u = {setmetatable({}, {__gc = function () finish = true end})}
repeat local i; u = {function () return i end} until finish
assert(b[1] == 34) -- 'u' was collected, but 'b' was not
end
local function GC() GC1(); GC2() end
do
print("creating many objects")
local limit = 5000
for i = 1, limit do
local a = {}; a = nil
end
local a = "a"
for i = 1, limit do
a = i .. "b";
a = string.gsub(a, '(%d%d*)', "%1 %1")
a = "a"
end
a = {}
function a:test ()
for i = 1, limit do
load(string.format("function temp(a) return 'a%d' end", i), "")()
assert(temp() == string.format('a%d', i))
end
end
a:test()
end
-- collection of functions without locals, globals, etc.
do local f = function () end end
print("functions with errors")
prog = [[
do
a = 10;
function foo(x,y)
a = sin(a+0.456-0.23e-12);
return function (z) return sin(%x+z) end
end
local x = function (w) a=a+w; end
end
]]
do
local step = 1
if _soft then step = 13 end
for i=1, string.len(prog), step do
for j=i, string.len(prog), step do
pcall(load(string.sub(prog, i, j), ""))
end
end
end
foo = nil
print('long strings')
x = "01234567890123456789012345678901234567890123456789012345678901234567890123456789"
assert(string.len(x)==80)
s = ''
k = math.min(300, (math.maxinteger // 80) // 2)
for n = 1, k do s = s..x; j=tostring(n) end
assert(string.len(s) == k*80)
s = string.sub(s, 1, 10000)
s, i = string.gsub(s, '(%d%d%d%d)', '')
assert(i==10000 // 4)
s = nil
x = nil
assert(_G["while"] == 234)
--
-- test the "size" of basic GC steps (whatever they mean...)
--
do
print("steps")
print("steps (2)")
local function dosteps (siz)
collectgarbage()
local a = {}
for i=1,100 do a[i] = {{}}; local b = {} end
local x = gcinfo()
local i = 0
repeat -- do steps until it completes a collection cycle
i = i+1
until collectgarbage("step", siz)
assert(gcinfo() < x)
return i -- number of steps
end
collectgarbage"stop"
if not _port then
assert(dosteps(10) < dosteps(2))
end
-- collector should do a full collection with so many steps
assert(dosteps(20000) == 1)
assert(collectgarbage("step", 20000) == true)
assert(collectgarbage("step", 20000) == true)
assert(not collectgarbage("isrunning"))
collectgarbage"restart"
assert(collectgarbage("isrunning"))
end
if not _port then
-- test the pace of the collector
collectgarbage(); collectgarbage()
local x = gcinfo()
collectgarbage"stop"
repeat
local a = {}
until gcinfo() > 3 * x
collectgarbage"restart"
assert(collectgarbage("isrunning"))
repeat
local a = {}
until gcinfo() <= x * 2
end
print("clearing tables")
lim = 15
a = {}
-- fill a with `collectable' indices
for i=1,lim do a[{}] = i end
b = {}
for k,v in pairs(a) do b[k]=v end
-- remove all indices and collect them
for n in pairs(b) do
a[n] = undef
assert(type(n) == 'table' and next(n) == nil)
collectgarbage()
end
b = nil
collectgarbage()
for n in pairs(a) do error'cannot be here' end
for i=1,lim do a[i] = i end
for i=1,lim do assert(a[i] == i) end
print('weak tables')
a = {}; setmetatable(a, {__mode = 'k'});
-- fill a with some `collectable' indices
for i=1,lim do a[{}] = i end
-- and some non-collectable ones
for i=1,lim do a[i] = i end
for i=1,lim do local s=string.rep('@', i); a[s] = s..'#' end
collectgarbage()
local i = 0
for k,v in pairs(a) do assert(k==v or k..'#'==v); i=i+1 end
assert(i == 2*lim)
a = {}; setmetatable(a, {__mode = 'v'});
a[1] = string.rep('b', 21)
collectgarbage()
assert(a[1]) -- strings are *values*
a[1] = undef
-- fill a with some `collectable' values (in both parts of the table)
for i=1,lim do a[i] = {} end
for i=1,lim do a[i..'x'] = {} end
-- and some non-collectable ones
for i=1,lim do local t={}; a[t]=t end
for i=1,lim do a[i+lim]=i..'x' end
collectgarbage()
local i = 0
for k,v in pairs(a) do assert(k==v or k-lim..'x' == v); i=i+1 end
assert(i == 2*lim)
a = {}; setmetatable(a, {__mode = 'kv'});
local x, y, z = {}, {}, {}
-- keep only some items
a[1], a[2], a[3] = x, y, z
a[string.rep('$', 11)] = string.rep('$', 11)
-- fill a with some `collectable' values
for i=4,lim do a[i] = {} end
for i=1,lim do a[{}] = i end
for i=1,lim do local t={}; a[t]=t end
collectgarbage()
assert(next(a) ~= nil)
local i = 0
for k,v in pairs(a) do
assert((k == 1 and v == x) or
(k == 2 and v == y) or
(k == 3 and v == z) or k==v);
i = i+1
end
assert(i == 4)
x,y,z=nil
collectgarbage()
assert(next(a) == string.rep('$', 11))
-- 'bug' in 5.1
a = {}
local t = {x = 10}
local C = setmetatable({key = t}, {__mode = 'v'})
local C1 = setmetatable({[t] = 1}, {__mode = 'k'})
a.x = t -- this should not prevent 't' from being removed from
-- weak table 'C' by the time 'a' is finalized
setmetatable(a, {__gc = function (u)
assert(C.key == nil)
assert(type(next(C1)) == 'table')
end})
a, t = nil
collectgarbage()
collectgarbage()
assert(next(C) == nil and next(C1) == nil)
C, C1 = nil
-- ephemerons
local mt = {__mode = 'k'}
a = {{10},{20},{30},{40}}; setmetatable(a, mt)
x = nil
for i = 1, 100 do local n = {}; a[n] = {k = {x}}; x = n end
GC()
local n = x
local i = 0
while n do n = a[n].k[1]; i = i + 1 end
assert(i == 100)
x = nil
GC()
for i = 1, 4 do assert(a[i][1] == i * 10); a[i] = undef end
assert(next(a) == nil)
local K = {}
a[K] = {}
for i=1,10 do a[K][i] = {}; a[a[K][i]] = setmetatable({}, mt) end
x = nil
local k = 1
for j = 1,100 do
local n = {}; local nk = k%10 + 1
a[a[K][nk]][n] = {x, k = k}; x = n; k = nk
end
GC()
local n = x
local i = 0
while n do local t = a[a[K][k]][n]; n = t[1]; k = t.k; i = i + 1 end
assert(i == 100)
K = nil
GC()
-- assert(next(a) == nil)
-- testing errors during GC
if T then
collectgarbage("stop") -- stop collection
local u = {}
local s = {}; setmetatable(s, {__mode = 'k'})
setmetatable(u, {__gc = function (o)
local i = s[o]
s[i] = true
assert(not s[i - 1]) -- check proper finalization order
if i == 8 then error("@expected@") end -- error during GC
end})
for i = 6, 10 do
local n = setmetatable({}, getmetatable(u))
s[n] = i
end
warn("@on"); warn("@store")
collectgarbage()
assert(string.find(_WARN, "error in __gc metamethod"))
assert(string.match(_WARN, "@(.-)@") == "expected"); _WARN = false
for i = 8, 10 do assert(s[i]) end
for i = 1, 5 do
local n = setmetatable({}, getmetatable(u))
s[n] = i
end
collectgarbage()
for i = 1, 10 do assert(s[i]) end
getmetatable(u).__gc = nil
warn("@normal")
end
print '+'
-- testing userdata
if T==nil then
(Message or print)('\n >>> testC not active: skipping userdata GC tests <<<\n')
else
local function newproxy(u)
return debug.setmetatable(T.newuserdata(0), debug.getmetatable(u))
end
collectgarbage("stop") -- stop collection
local u = newproxy(nil)
debug.setmetatable(u, {__gc = true})
local s = 0
local a = {[u] = 0}; setmetatable(a, {__mode = 'vk'})
for i=1,10 do a[newproxy(u)] = i end
for k in pairs(a) do assert(getmetatable(k) == getmetatable(u)) end
local a1 = {}; for k,v in pairs(a) do a1[k] = v end
for k,v in pairs(a1) do a[v] = k end
for i =1,10 do assert(a[i]) end
getmetatable(u).a = a1
getmetatable(u).u = u
do
local u = u
getmetatable(u).__gc = function (o)
assert(a[o] == 10-s)
assert(a[10-s] == undef) -- udata already removed from weak table
assert(getmetatable(o) == getmetatable(u))
assert(getmetatable(o).a[o] == 10-s)
s=s+1
end
end
a1, u = nil
assert(next(a) ~= nil)
collectgarbage()
assert(s==11)
collectgarbage()
assert(next(a) == nil) -- finalized keys are removed in two cycles
end
-- __gc x weak tables
local u = setmetatable({}, {__gc = true})
-- __gc metamethod should be collected before running
setmetatable(getmetatable(u), {__mode = "v"})
getmetatable(u).__gc = function (o) os.exit(1) end -- cannot happen
u = nil
collectgarbage()
local u = setmetatable({}, {__gc = true})
local m = getmetatable(u)
m.x = {[{0}] = 1; [0] = {1}}; setmetatable(m.x, {__mode = "kv"});
m.__gc = function (o)
assert(next(getmetatable(o).x) == nil)
m = 10
end
u, m = nil
collectgarbage()
assert(m==10)
do -- tests for string keys in weak tables
collectgarbage(); collectgarbage()
local m = collectgarbage("count") -- current memory
local a = setmetatable({}, {__mode = "kv"})
a[string.rep("a", 2^22)] = 25 -- long string key -> number value
a[string.rep("b", 2^22)] = {} -- long string key -> colectable value
a[{}] = 14 -- colectable key
assert(collectgarbage("count") > m + 2^13) -- 2^13 == 2 * 2^22 in KB
collectgarbage()
assert(collectgarbage("count") >= m + 2^12 and
collectgarbage("count") < m + 2^13) -- one key was collected
local k, v = next(a) -- string key with number value preserved
assert(k == string.rep("a", 2^22) and v == 25)
assert(next(a, k) == nil) -- everything else cleared
assert(a[string.rep("b", 2^22)] == undef)
a[k] = undef -- erase this last entry
k = nil
collectgarbage()
assert(next(a) == nil)
-- make sure will not try to compare with dead key
assert(a[string.rep("b", 100)] == undef)
assert(collectgarbage("count") <= m + 1) -- eveything collected
end
-- errors during collection
if T then
warn("@store")
u = setmetatable({}, {__gc = function () error "@expected error" end})
u = nil
collectgarbage()
assert(string.find(_WARN, "@expected error")); _WARN = false
warn("@normal")
end
if not _soft then
print("long list")
local a = {}
for i = 1,200000 do
a = {next = a}
end
a = nil
collectgarbage()
end
-- create many threads with self-references and open upvalues
print("self-referenced threads")
local thread_id = 0
local threads = {}
local function fn (thread)
local x = {}
threads[thread_id] = function()
thread = x
end
coroutine.yield()
end
while thread_id < 1000 do
local thread = coroutine.create(fn)
coroutine.resume(thread, thread)
thread_id = thread_id + 1
end
-- Create a closure (function inside 'f') with an upvalue ('param') that
-- points (through a table) to the closure itself and to the thread
-- ('co' and the initial value of 'param') where closure is running.
-- Then, assert that table (and therefore everything else) will be
-- collected.
do
local collected = false -- to detect collection
collectgarbage(); collectgarbage("stop")
do
local function f (param)
;(function ()
assert(type(f) == 'function' and type(param) == 'thread')
param = {param, f}
setmetatable(param, {__gc = function () collected = true end})
coroutine.yield(100)
end)()
end
local co = coroutine.create(f)
assert(coroutine.resume(co, co))
end
-- Now, thread and closure are not reacheable any more.
collectgarbage()
assert(collected)
collectgarbage("restart")
end
do
collectgarbage()
collectgarbage"stop"
collectgarbage("step", 0) -- steps should not unblock the collector
local x = gcinfo()
repeat
for i=1,1000 do _ENV.a = {} end -- no collection during the loop
until gcinfo() > 2 * x
collectgarbage"restart"
end
if T then -- tests for weird cases collecting upvalues
local function foo ()
local a = {x = 20}
coroutine.yield(function () return a.x end) -- will run collector
assert(a.x == 20) -- 'a' is 'ok'
a = {x = 30} -- create a new object
assert(T.gccolor(a) == "white") -- of course it is new...
coroutine.yield(100) -- 'a' is still local to this thread
end
local t = setmetatable({}, {__mode = "kv"})
collectgarbage(); collectgarbage('stop')
-- create coroutine in a weak table, so it will never be marked
t.co = coroutine.wrap(foo)
local f = t.co() -- create function to access local 'a'
T.gcstate("atomic") -- ensure all objects are traversed
assert(T.gcstate() == "atomic")
assert(t.co() == 100) -- resume coroutine, creating new table for 'a'
assert(T.gccolor(t.co) == "white") -- thread was not traversed
T.gcstate("pause") -- collect thread, but should mark 'a' before that
assert(t.co == nil and f() == 30) -- ensure correct access to 'a'
collectgarbage("restart")
-- test barrier in sweep phase (backing userdata to gray)
local u = T.newuserdata(0, 1) -- create a userdata
collectgarbage()
collectgarbage"stop"
local a = {} -- avoid 'u' as first element in 'allgc'
T.gcstate"atomic"
T.gcstate"sweepallgc"
local x = {}
assert(T.gccolor(u) == "black") -- userdata is "old" (black)
assert(T.gccolor(x) == "white") -- table is "new" (white)
debug.setuservalue(u, x) -- trigger barrier
assert(T.gccolor(u) == "gray") -- userdata changed back to gray
collectgarbage"restart"
print"+"
end
if T then
local debug = require "debug"
collectgarbage("stop")
local x = T.newuserdata(0)
local y = T.newuserdata(0)
debug.setmetatable(y, {__gc = nop}) -- bless the new udata before...
debug.setmetatable(x, {__gc = nop}) -- ...the old one
assert(T.gccolor(y) == "white")
T.checkmemory()
collectgarbage("restart")
end
if T then
print("emergency collections")
collectgarbage()
collectgarbage()
T.totalmem(T.totalmem() + 200)
for i=1,200 do local a = {} end
T.totalmem(0)
collectgarbage()
local t = T.totalmem("table")
local a = {{}, {}, {}} -- create 4 new tables
assert(T.totalmem("table") == t + 4)
t = T.totalmem("function")
a = function () end -- create 1 new closure
assert(T.totalmem("function") == t + 1)
t = T.totalmem("thread")
a = coroutine.create(function () end) -- create 1 new coroutine
assert(T.totalmem("thread") == t + 1)
end
-- create an object to be collected when state is closed
do
local setmetatable,assert,type,print,getmetatable =
setmetatable,assert,type,print,getmetatable
local tt = {}
tt.__gc = function (o)
assert(getmetatable(o) == tt)
-- create new objects during GC
local a = 'xuxu'..(10+3)..'joao', {}
___Glob = o -- ressurrect object!
setmetatable({}, tt) -- creates a new one with same metatable
print(">>> closing state " .. "<<<\n")
end
local u = setmetatable({}, tt)
___Glob = {u} -- avoid object being collected before program end
end
-- create several objects to raise errors when collected while closing state
if T then
local error, assert, find, warn = error, assert, string.find, warn
local n = 0
local lastmsg
local mt = {__gc = function (o)
n = n + 1
assert(n == o[1])
if n == 1 then
_WARN = false
elseif n == 2 then
assert(find(_WARN, "@expected warning"))
lastmsg = _WARN -- get message from previous error (first 'o')
else
assert(lastmsg == _WARN) -- subsequent error messages are equal
end
warn("@store"); _WARN = false
error"@expected warning"
end}
for i = 10, 1, -1 do
-- create object and preserve it until the end
table.insert(___Glob, setmetatable({i}, mt))
end
end
-- just to make sure
assert(collectgarbage'isrunning')
do -- check that the collector is reentrant in incremental mode
setmetatable({}, {__gc = function ()
collectgarbage()
end})
collectgarbage()
end
collectgarbage(oldmode)
print('OK')
| 17,929 | 690 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/attrib.lua | -- $Id: test/attrib.lua $
-- See Copyright Notice in file all.lua
print "testing require"
assert(require"string" == string)
assert(require"math" == math)
assert(require"table" == table)
assert(require"io" == io)
assert(require"os" == os)
assert(require"coroutine" == coroutine)
assert(type(package.path) == "string")
assert(type(package.cpath) == "string")
assert(type(package.loaded) == "table")
assert(type(package.preload) == "table")
assert(type(package.config) == "string")
print("package config: "..string.gsub(package.config, "\n", "|"))
do
-- create a path with 'max' templates,
-- each with 1-10 repetitions of '?'
local max = _soft and 100 or 2000
local t = {}
for i = 1,max do t[i] = string.rep("?", i%10 + 1) end
t[#t + 1] = ";" -- empty template
local path = table.concat(t, ";")
-- use that path in a search
local s, err = package.searchpath("xuxu", path)
-- search fails; check that message has an occurrence of
-- '??????????' with ? replaced by xuxu and at least 'max' lines
assert(not s and
string.find(err, string.rep("xuxu", 10)) and
#string.gsub(err, "[^\n]", "") >= max)
-- path with one very long template
local path = string.rep("?", max)
local s, err = package.searchpath("xuxu", path)
assert(not s and string.find(err, string.rep('xuxu', max)))
end
do
local oldpath = package.path
package.path = {}
local s, err = pcall(require, "no-such-file")
assert(not s and string.find(err, "package.path"))
package.path = oldpath
end
do print"testing 'require' message"
local oldpath = package.path
local oldcpath = package.cpath
package.path = "?.lua;?/?"
package.cpath = "?.so;?/init"
local st, msg = pcall(require, 'XXX')
local expected = [[module 'XXX' not found:
no field package.preload['XXX']
no file 'XXX.lua'
no file 'XXX/XXX'
no file 'XXX.so'
no file 'XXX/init']]
assert(msg == expected)
package.path = oldpath
package.cpath = oldcpath
end
print('+')
-- The next tests for 'require' assume some specific directories and
-- libraries.
if not _port then --[
local dirsep = string.match(package.config, "^([^\n]+)\n")
-- auxiliary directory with C modules and temporary files
local DIR = "libs" .. dirsep
-- prepend DIR to a name and correct directory separators
local function D (x)
x = string.gsub(x, "/", dirsep)
return DIR .. x
end
-- prepend DIR and pospend proper C lib. extension to a name
local function DC (x)
local ext = (dirsep == '\\') and ".dll" or ".so"
return D(x .. ext)
end
local function createfiles (files, preextras, posextras)
for n,c in pairs(files) do
io.output(D(n))
io.write(string.format(preextras, n))
io.write(c)
io.write(string.format(posextras, n))
io.close(io.output())
end
end
function removefiles (files)
for n in pairs(files) do
os.remove(D(n))
end
end
local files = {
["names.lua"] = "do return {...} end\n",
["err.lua"] = "B = 15; a = a + 1;",
["synerr.lua"] = "B =",
["A.lua"] = "",
["B.lua"] = "assert(...=='B');require 'A'",
["A.lc"] = "",
["A"] = "",
["L"] = "",
["XXxX"] = "",
["C.lua"] = "package.loaded[...] = 25; require'C'",
}
AA = nil
local extras = [[
NAME = '%s'
REQUIRED = ...
return AA]]
createfiles(files, "", extras)
-- testing explicit "dir" separator in 'searchpath'
assert(package.searchpath("C.lua", D"?", "", "") == D"C.lua")
assert(package.searchpath("C.lua", D"?", ".", ".") == D"C.lua")
assert(package.searchpath("--x-", D"?", "-", "X") == D"XXxX")
assert(package.searchpath("---xX", D"?", "---", "XX") == D"XXxX")
assert(package.searchpath(D"C.lua", "?", dirsep) == D"C.lua")
assert(package.searchpath(".\\C.lua", D"?", "\\") == D"./C.lua")
local oldpath = package.path
package.path = string.gsub("D/?.lua;D/?.lc;D/?;D/??x?;D/L", "D/", DIR)
local try = function (p, n, r, ext)
NAME = nil
local rr, x = require(p)
assert(NAME == n)
assert(REQUIRED == p)
assert(rr == r)
assert(ext == x)
end
a = require"names"
assert(a[1] == "names" and a[2] == D"names.lua")
_G.a = nil
local st, msg = pcall(require, "err")
assert(not st and string.find(msg, "arithmetic") and B == 15)
st, msg = pcall(require, "synerr")
assert(not st and string.find(msg, "error loading module"))
assert(package.searchpath("C", package.path) == D"C.lua")
assert(require"C" == 25)
assert(require"C" == 25)
AA = nil
try('B', 'B.lua', true, "libs/B.lua")
assert(package.loaded.B)
assert(require"B" == true)
assert(package.loaded.A)
assert(require"C" == 25)
package.loaded.A = nil
try('B', nil, true, nil) -- should not reload package
try('A', 'A.lua', true, "libs/A.lua")
package.loaded.A = nil
os.remove(D'A.lua')
AA = {}
try('A', 'A.lc', AA, "libs/A.lc") -- now must find second option
assert(package.searchpath("A", package.path) == D"A.lc")
assert(require("A") == AA)
AA = false
try('K', 'L', false, "libs/L") -- default option
try('K', 'L', false, "libs/L") -- default option (should reload it)
assert(rawget(_G, "_REQUIREDNAME") == nil)
AA = "x"
try("X", "XXxX", AA, "libs/XXxX")
removefiles(files)
-- testing require of sub-packages
local _G = _G
package.path = string.gsub("D/?.lua;D/?/init.lua", "D/", DIR)
files = {
["P1/init.lua"] = "AA = 10",
["P1/xuxu.lua"] = "AA = 20",
}
createfiles(files, "_ENV = {}\n", "\nreturn _ENV\n")
AA = 0
local m, ext = assert(require"P1")
assert(ext == "libs/P1/init.lua")
assert(AA == 0 and m.AA == 10)
assert(require"P1" == m)
assert(require"P1" == m)
assert(package.searchpath("P1.xuxu", package.path) == D"P1/xuxu.lua")
m.xuxu, ext = assert(require"P1.xuxu")
assert(AA == 0 and m.xuxu.AA == 20)
assert(ext == "libs/P1/xuxu.lua")
assert(require"P1.xuxu" == m.xuxu)
assert(require"P1.xuxu" == m.xuxu)
assert(require"P1" == m and m.AA == 10)
removefiles(files)
package.path = ""
assert(not pcall(require, "file_does_not_exist"))
package.path = "??\0?"
assert(not pcall(require, "file_does_not_exist1"))
package.path = oldpath
-- check 'require' error message
local fname = "file_does_not_exist2"
local m, err = pcall(require, fname)
for t in string.gmatch(package.path..";"..package.cpath, "[^;]+") do
t = string.gsub(t, "?", fname)
assert(string.find(err, t, 1, true))
end
do -- testing 'package.searchers' not being a table
local searchers = package.searchers
package.searchers = 3
local st, msg = pcall(require, 'a')
assert(not st and string.find(msg, "must be a table"))
package.searchers = searchers
end
local function import(...)
local f = {...}
return function (m)
for i=1, #f do m[f[i]] = _G[f[i]] end
end
end
-- cannot change environment of a C function
assert(not pcall(module, 'XUXU'))
-- testing require of C libraries
local p = "" -- On Mac OS X, redefine this to "_"
-- check whether loadlib works in this system
local st, err, when = package.loadlib(DC"lib1", "*")
if not st then
local f, err, when = package.loadlib("donotexist", p.."xuxu")
assert(not f and type(err) == "string" and when == "absent")
;(Message or print)('\n >>> cannot load dynamic library <<<\n')
print(err, when)
else
-- tests for loadlib
local f = assert(package.loadlib(DC"lib1", p.."onefunction"))
local a, b = f(15, 25)
assert(a == 25 and b == 15)
f = assert(package.loadlib(DC"lib1", p.."anotherfunc"))
assert(f(10, 20) == "10%20\n")
-- check error messages
local f, err, when = package.loadlib(DC"lib1", p.."xuxu")
assert(not f and type(err) == "string" and when == "init")
f, err, when = package.loadlib("donotexist", p.."xuxu")
assert(not f and type(err) == "string" and when == "open")
-- symbols from 'lib1' must be visible to other libraries
f = assert(package.loadlib(DC"lib11", p.."luaopen_lib11"))
assert(f() == "exported")
-- test C modules with prefixes in names
package.cpath = DC"?"
local lib2, ext = require"lib2-v2"
assert(string.find(ext, "libs/lib2-v2", 1, true))
-- check correct access to global environment and correct
-- parameters
assert(_ENV.x == "lib2-v2" and _ENV.y == DC"lib2-v2")
assert(lib2.id("x") == true) -- a different "id" implementation
-- test C submodules
local fs, ext = require"lib1.sub"
assert(_ENV.x == "lib1.sub" and _ENV.y == DC"lib1")
assert(string.find(ext, "libs/lib1", 1, true))
assert(fs.id(45) == 45)
end
_ENV = _G
-- testing preload
do
local p = package
package = {}
p.preload.pl = function (...)
local _ENV = {...}
function xuxu (x) return x+20 end
return _ENV
end
local pl, ext = require"pl"
assert(require"pl" == pl)
assert(pl.xuxu(10) == 30)
assert(pl[1] == "pl" and pl[2] == ":preload:" and ext == ":preload:")
package = p
assert(type(package.path) == "string")
end
print('+')
end --]
print("testing assignments, logical operators, and constructors")
local res, res2 = 27
a, b = 1, 2+3
assert(a==1 and b==5)
a={}
function f() return 10, 11, 12 end
a.x, b, a[1] = 1, 2, f()
assert(a.x==1 and b==2 and a[1]==10)
a[f()], b, a[f()+3] = f(), a, 'x'
assert(a[10] == 10 and b == a and a[13] == 'x')
do
local f = function (n) local x = {}; for i=1,n do x[i]=i end;
return table.unpack(x) end;
local a,b,c
a,b = 0, f(1)
assert(a == 0 and b == 1)
A,b = 0, f(1)
assert(A == 0 and b == 1)
a,b,c = 0,5,f(4)
assert(a==0 and b==5 and c==1)
a,b,c = 0,5,f(0)
assert(a==0 and b==5 and c==nil)
end
a, b, c, d = 1 and nil, 1 or nil, (1 and (nil or 1)), 6
assert(not a and b and c and d==6)
d = 20
a, b, c, d = f()
assert(a==10 and b==11 and c==12 and d==nil)
a,b = f(), 1, 2, 3, f()
assert(a==10 and b==1)
assert(a<b == false and a>b == true)
assert((10 and 2) == 2)
assert((10 or 2) == 10)
assert((10 or assert(nil)) == 10)
assert(not (nil and assert(nil)))
assert((nil or "alo") == "alo")
assert((nil and 10) == nil)
assert((false and 10) == false)
assert((true or 10) == true)
assert((false or 10) == 10)
assert(false ~= nil)
assert(nil ~= false)
assert(not nil == true)
assert(not not nil == false)
assert(not not 1 == true)
assert(not not a == true)
assert(not not (6 or nil) == true)
assert(not not (nil and 56) == false)
assert(not not (nil and true) == false)
assert(not 10 == false)
assert(not {} == false)
assert(not 0.5 == false)
assert(not "x" == false)
assert({} ~= {})
print('+')
a = {}
a[true] = 20
a[false] = 10
assert(a[1<2] == 20 and a[1>2] == 10)
function f(a) return a end
local a = {}
for i=3000,-3000,-1 do a[i + 0.0] = i; end
a[10e30] = "alo"; a[true] = 10; a[false] = 20
assert(a[10e30] == 'alo' and a[not 1] == 20 and a[10<20] == 10)
for i=3000,-3000,-1 do assert(a[i] == i); end
a[print] = assert
a[f] = print
a[a] = a
assert(a[a][a][a][a][print] == assert)
a[print](a[a[f]] == a[print])
assert(not pcall(function () local a = {}; a[nil] = 10 end))
assert(not pcall(function () local a = {[nil] = 10} end))
assert(a[nil] == undef)
a = nil
a = {10,9,8,7,6,5,4,3,2; [-3]='a', [f]=print, a='a', b='ab'}
a, a.x, a.y = a, a[-3]
assert(a[1]==10 and a[-3]==a.a and a[f]==print and a.x=='a' and not a.y)
a[1], f(a)[2], b, c = {['alo']=assert}, 10, a[1], a[f], 6, 10, 23, f(a), 2
a[1].alo(a[2]==10 and b==10 and c==print)
a.aVeryLongName012345678901234567890123456789012345678901234567890123456789 = 10
local function foo ()
return a.aVeryLongName012345678901234567890123456789012345678901234567890123456789
end
assert(foo() == 10 and
a.aVeryLongName012345678901234567890123456789012345678901234567890123456789 ==
10)
-- test of large float/integer indices
-- compute maximum integer where all bits fit in a float
local maxint = math.maxinteger
-- trim (if needed) to fit in a float
while maxint ~= (maxint + 0.0) or (maxint - 1) ~= (maxint - 1.0) do
maxint = maxint // 2
end
maxintF = maxint + 0.0 -- float version
assert(maxintF == maxint and math.type(maxintF) == "float" and
maxintF >= 2.0^14)
-- floats and integers must index the same places
a[maxintF] = 10; a[maxintF - 1.0] = 11;
a[-maxintF] = 12; a[-maxintF + 1.0] = 13;
assert(a[maxint] == 10 and a[maxint - 1] == 11 and
a[-maxint] == 12 and a[-maxint + 1] == 13)
a[maxint] = 20
a[-maxint] = 22
assert(a[maxintF] == 20 and a[maxintF - 1.0] == 11 and
a[-maxintF] == 22 and a[-maxintF + 1.0] == 13)
a = nil
-- test conflicts in multiple assignment
do
local a,i,j,b
a = {'a', 'b'}; i=1; j=2; b=a
i, a[i], a, j, a[j], a[i+j] = j, i, i, b, j, i
assert(i == 2 and b[1] == 1 and a == 1 and j == b and b[2] == 2 and
b[3] == 1)
a = {}
local function foo () -- assigining to upvalues
b, a.x, a = a, 10, 20
end
foo()
assert(a == 20 and b.x == 10)
end
-- repeat test with upvalues
do
local a,i,j,b
a = {'a', 'b'}; i=1; j=2; b=a
local function foo ()
i, a[i], a, j, a[j], a[i+j] = j, i, i, b, j, i
end
foo()
assert(i == 2 and b[1] == 1 and a == 1 and j == b and b[2] == 2 and
b[3] == 1)
local t = {}
(function (a) t[a], a = 10, 20 end)(1);
assert(t[1] == 10)
end
-- bug in 5.2 beta
local function foo ()
local a
return function ()
local b
a, b = 3, 14 -- local and upvalue have same index
return a, b
end
end
local a, b = foo()()
assert(a == 3 and b == 14)
print('OK')
return res
| 13,123 | 516 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/tracegc.lua | -- track collections
local M = {}
-- import list
local setmetatable, stderr, collectgarbage =
setmetatable, io.stderr, collectgarbage
_ENV = nil
local active = false
-- each time a table is collected, remark it for finalization on next
-- cycle
local mt = {}
function mt.__gc (o)
stderr:write'.' -- mark progress
if active then
setmetatable(o, mt) -- remark object for finalization
end
end
function M.start ()
if not active then
active = true
setmetatable({}, mt) -- create initial object
end
end
function M.stop ()
if active then
active = false
collectgarbage() -- call finalizer for the last time
end
end
return M
| 680 | 41 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/sort.lua | -- $Id: test/sort.lua $
-- See Copyright Notice in file all.lua
print "testing (parts of) table library"
print "testing unpack"
local unpack = table.unpack
local maxI = math.maxinteger
local minI = math.mininteger
local function checkerror (msg, f, ...)
local s, err = pcall(f, ...)
assert(not s and string.find(err, msg))
end
checkerror("wrong number of arguments", table.insert, {}, 2, 3, 4)
local x,y,z,a,n
a = {}; lim = _soft and 200 or 2000
for i=1, lim do a[i]=i end
assert(select(lim, unpack(a)) == lim and select('#', unpack(a)) == lim)
x = unpack(a)
assert(x == 1)
x = {unpack(a)}
assert(#x == lim and x[1] == 1 and x[lim] == lim)
x = {unpack(a, lim-2)}
assert(#x == 3 and x[1] == lim-2 and x[3] == lim)
x = {unpack(a, 10, 6)}
assert(next(x) == nil) -- no elements
x = {unpack(a, 11, 10)}
assert(next(x) == nil) -- no elements
x,y = unpack(a, 10, 10)
assert(x == 10 and y == nil)
x,y,z = unpack(a, 10, 11)
assert(x == 10 and y == 11 and z == nil)
a,x = unpack{1}
assert(a==1 and x==nil)
a,x = unpack({1,2}, 1, 1)
assert(a==1 and x==nil)
do
local maxi = (1 << 31) - 1 -- maximum value for an int (usually)
local mini = -(1 << 31) -- minimum value for an int (usually)
checkerror("too many results", unpack, {}, 0, maxi)
checkerror("too many results", unpack, {}, 1, maxi)
checkerror("too many results", unpack, {}, 0, maxI)
checkerror("too many results", unpack, {}, 1, maxI)
checkerror("too many results", unpack, {}, mini, maxi)
checkerror("too many results", unpack, {}, -maxi, maxi)
checkerror("too many results", unpack, {}, minI, maxI)
unpack({}, maxi, 0)
unpack({}, maxi, 1)
unpack({}, maxI, minI)
pcall(unpack, {}, 1, maxi + 1)
local a, b = unpack({[maxi] = 20}, maxi, maxi)
assert(a == 20 and b == nil)
a, b = unpack({[maxi] = 20}, maxi - 1, maxi)
assert(a == nil and b == 20)
local t = {[maxI - 1] = 12, [maxI] = 23}
a, b = unpack(t, maxI - 1, maxI); assert(a == 12 and b == 23)
a, b = unpack(t, maxI, maxI); assert(a == 23 and b == nil)
a, b = unpack(t, maxI, maxI - 1); assert(a == nil and b == nil)
t = {[minI] = 12.3, [minI + 1] = 23.5}
a, b = unpack(t, minI, minI + 1); assert(a == 12.3 and b == 23.5)
a, b = unpack(t, minI, minI); assert(a == 12.3 and b == nil)
a, b = unpack(t, minI + 1, minI); assert(a == nil and b == nil)
end
do -- length is not an integer
local t = setmetatable({}, {__len = function () return 'abc' end})
assert(#t == 'abc')
checkerror("object length is not an integer", table.insert, t, 1)
end
print "testing pack"
a = table.pack()
assert(a[1] == undef and a.n == 0)
a = table.pack(table)
assert(a[1] == table and a.n == 1)
a = table.pack(nil, nil, nil, nil)
assert(a[1] == nil and a.n == 4)
-- testing move
do
checkerror("table expected", table.move, 1, 2, 3, 4)
local function eqT (a, b)
for k, v in pairs(a) do assert(b[k] == v) end
for k, v in pairs(b) do assert(a[k] == v) end
end
local a = table.move({10,20,30}, 1, 3, 2) -- move forward
eqT(a, {10,10,20,30})
-- move forward with overlap of 1
a = table.move({10, 20, 30}, 1, 3, 3)
eqT(a, {10, 20, 10, 20, 30})
-- moving to the same table (not being explicit about it)
a = {10, 20, 30, 40}
table.move(a, 1, 4, 2, a)
eqT(a, {10, 10, 20, 30, 40})
a = table.move({10,20,30}, 2, 3, 1) -- move backward
eqT(a, {20,30,30})
a = {} -- move to new table
assert(table.move({10,20,30}, 1, 3, 1, a) == a)
eqT(a, {10,20,30})
a = {}
assert(table.move({10,20,30}, 1, 0, 3, a) == a) -- empty move (no move)
eqT(a, {})
a = table.move({10,20,30}, 1, 10, 1) -- move to the same place
eqT(a, {10,20,30})
-- moving on the fringes
a = table.move({[maxI - 2] = 1, [maxI - 1] = 2, [maxI] = 3},
maxI - 2, maxI, -10, {})
eqT(a, {[-10] = 1, [-9] = 2, [-8] = 3})
a = table.move({[minI] = 1, [minI + 1] = 2, [minI + 2] = 3},
minI, minI + 2, -10, {})
eqT(a, {[-10] = 1, [-9] = 2, [-8] = 3})
a = table.move({45}, 1, 1, maxI)
eqT(a, {45, [maxI] = 45})
a = table.move({[maxI] = 100}, maxI, maxI, minI)
eqT(a, {[minI] = 100, [maxI] = 100})
a = table.move({[minI] = 100}, minI, minI, maxI)
eqT(a, {[minI] = 100, [maxI] = 100})
a = setmetatable({}, {
__index = function (_,k) return k * 10 end,
__newindex = error})
local b = table.move(a, 1, 10, 3, {})
eqT(a, {})
eqT(b, {nil,nil,10,20,30,40,50,60,70,80,90,100})
b = setmetatable({""}, {
__index = error,
__newindex = function (t,k,v)
t[1] = string.format("%s(%d,%d)", t[1], k, v)
end})
table.move(a, 10, 13, 3, b)
assert(b[1] == "(3,100)(4,110)(5,120)(6,130)")
local stat, msg = pcall(table.move, b, 10, 13, 3, b)
assert(not stat and msg == b)
end
do
-- for very long moves, just check initial accesses and interrupt
-- move with an error
local function checkmove (f, e, t, x, y)
local pos1, pos2
local a = setmetatable({}, {
__index = function (_,k) pos1 = k end,
__newindex = function (_,k) pos2 = k; error() end, })
local st, msg = pcall(table.move, a, f, e, t)
assert(not st and not msg and pos1 == x and pos2 == y)
end
checkmove(1, maxI, 0, 1, 0)
checkmove(0, maxI - 1, 1, maxI - 1, maxI)
checkmove(minI, -2, -5, -2, maxI - 6)
checkmove(minI + 1, -1, -2, -1, maxI - 3)
checkmove(minI, -2, 0, minI, 0) -- non overlapping
checkmove(minI + 1, -1, 1, minI + 1, 1) -- non overlapping
end
checkerror("too many", table.move, {}, 0, maxI, 1)
checkerror("too many", table.move, {}, -1, maxI - 1, 1)
checkerror("too many", table.move, {}, minI, -1, 1)
checkerror("too many", table.move, {}, minI, maxI, 1)
checkerror("wrap around", table.move, {}, 1, maxI, 2)
checkerror("wrap around", table.move, {}, 1, 2, maxI)
checkerror("wrap around", table.move, {}, minI, -2, 2)
print"testing sort"
-- strange lengths
local a = setmetatable({}, {__len = function () return -1 end})
assert(#a == -1)
table.sort(a, error) -- should not compare anything
a = setmetatable({}, {__len = function () return maxI end})
checkerror("too big", table.sort, a)
-- test checks for invalid order functions
local function check (t)
local function f(a, b) assert(a and b); return true end
checkerror("invalid order function", table.sort, t, f)
end
check{1,2,3,4}
check{1,2,3,4,5}
check{1,2,3,4,5,6}
function check (a, f)
f = f or function (x,y) return x<y end;
for n = #a, 2, -1 do
assert(not f(a[n], a[n-1]))
end
end
a = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"}
table.sort(a)
check(a)
function perm (s, n)
n = n or #s
if n == 1 then
local t = {unpack(s)}
table.sort(t)
check(t)
else
for i = 1, n do
s[i], s[n] = s[n], s[i]
perm(s, n - 1)
s[i], s[n] = s[n], s[i]
end
end
end
perm{}
perm{1}
perm{1,2}
perm{1,2,3}
perm{1,2,3,4}
perm{2,2,3,4}
perm{1,2,3,4,5}
perm{1,2,3,3,5}
perm{1,2,3,4,5,6}
perm{2,2,3,3,5,6}
function timesort (a, n, func, msg, pre)
local x = os.clock()
table.sort(a, func)
x = (os.clock() - x) * 1000
pre = pre or ""
print(string.format("%ssorting %d %s elements in %.2f msec.", pre, n, msg, x))
check(a, func)
end
limit = 50000
if _soft then limit = 5000 end
a = {}
for i=1,limit do
a[i] = math.random()
end
timesort(a, limit, nil, "random")
timesort(a, limit, nil, "sorted", "re-")
a = {}
for i=1,limit do
a[i] = math.random()
end
x = os.clock(); i=0
table.sort(a, function(x,y) i=i+1; return y<x end)
x = (os.clock() - x) * 1000
print(string.format("Invert-sorting other %d elements in %.2f msec., with %i comparisons",
limit, x, i))
check(a, function(x,y) return y<x end)
table.sort{} -- empty array
for i=1,limit do a[i] = false end
timesort(a, limit, function(x,y) return nil end, "equal")
for i,v in pairs(a) do assert(v == false) end
A = {"álo", "\0first :-)", "alo", "then this one", "45", "and a new"}
table.sort(A)
check(A)
table.sort(A, function (x, y)
load(string.format("A[%q] = ''", x), "")()
collectgarbage()
return x<y
end)
tt = {__lt = function (a,b) return a.val < b.val end}
a = {}
for i=1,10 do a[i] = {val=math.random(100)}; setmetatable(a[i], tt); end
table.sort(a)
check(a, tt.__lt)
check(a)
print"OK"
| 8,311 | 311 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/strings.lua | -- $Id: test/strings.lua $
-- See Copyright Notice in file all.lua
print('testing strings and string library')
local maxi <const> = math.maxinteger
local mini <const> = math.mininteger
local function checkerror (msg, f, ...)
local s, err = pcall(f, ...)
assert(not s and string.find(err, msg))
end
-- testing string comparisons
assert('alo' < 'alo1')
assert('' < 'a')
assert('alo\0alo' < 'alo\0b')
assert('alo\0alo\0\0' > 'alo\0alo\0')
assert('alo' < 'alo\0')
assert('alo\0' > 'alo')
assert('\0' < '\1')
assert('\0\0' < '\0\1')
assert('\1\0a\0a' <= '\1\0a\0a')
assert(not ('\1\0a\0b' <= '\1\0a\0a'))
assert('\0\0\0' < '\0\0\0\0')
assert(not('\0\0\0\0' < '\0\0\0'))
assert('\0\0\0' <= '\0\0\0\0')
assert(not('\0\0\0\0' <= '\0\0\0'))
assert('\0\0\0' <= '\0\0\0')
assert('\0\0\0' >= '\0\0\0')
assert(not ('\0\0b' < '\0\0a\0'))
-- testing string.sub
assert(string.sub("123456789",2,4) == "234")
assert(string.sub("123456789",7) == "789")
assert(string.sub("123456789",7,6) == "")
assert(string.sub("123456789",7,7) == "7")
assert(string.sub("123456789",0,0) == "")
assert(string.sub("123456789",-10,10) == "123456789")
assert(string.sub("123456789",1,9) == "123456789")
assert(string.sub("123456789",-10,-20) == "")
assert(string.sub("123456789",-1) == "9")
assert(string.sub("123456789",-4) == "6789")
assert(string.sub("123456789",-6, -4) == "456")
assert(string.sub("123456789", mini, -4) == "123456")
assert(string.sub("123456789", mini, maxi) == "123456789")
assert(string.sub("123456789", mini, mini) == "")
assert(string.sub("\000123456789",3,5) == "234")
assert(("\000123456789"):sub(8) == "789")
-- testing string.find
assert(string.find("123456789", "345") == 3)
a,b = string.find("123456789", "345")
assert(string.sub("123456789", a, b) == "345")
assert(string.find("1234567890123456789", "345", 3) == 3)
assert(string.find("1234567890123456789", "345", 4) == 13)
assert(not string.find("1234567890123456789", "346", 4))
assert(string.find("1234567890123456789", ".45", -9) == 13)
assert(not string.find("abcdefg", "\0", 5, 1))
assert(string.find("", "") == 1)
assert(string.find("", "", 1) == 1)
assert(not string.find("", "", 2))
assert(not string.find('', 'aaa', 1))
assert(('alo(.)alo'):find('(.)', 1, 1) == 4)
assert(string.len("") == 0)
assert(string.len("\0\0\0") == 3)
assert(string.len("1234567890") == 10)
assert(#"" == 0)
assert(#"\0\0\0" == 3)
assert(#"1234567890" == 10)
-- testing string.byte/string.char
assert(string.byte("a") == 97)
assert(string.byte("\xe4") > 127)
assert(string.byte(string.char(255)) == 255)
assert(string.byte(string.char(0)) == 0)
assert(string.byte("\0") == 0)
assert(string.byte("\0\0alo\0x", -1) == string.byte('x'))
assert(string.byte("ba", 2) == 97)
assert(string.byte("\n\n", 2, -1) == 10)
assert(string.byte("\n\n", 2, 2) == 10)
assert(string.byte("") == nil)
assert(string.byte("hi", -3) == nil)
assert(string.byte("hi", 3) == nil)
assert(string.byte("hi", 9, 10) == nil)
assert(string.byte("hi", 2, 1) == nil)
assert(string.char() == "")
assert(string.char(0, 255, 0) == "\0\255\0")
assert(string.char(0, string.byte("\xe4"), 0) == "\0\xe4\0")
assert(string.char(string.byte("\xe4l\0óu", 1, -1)) == "\xe4l\0óu")
assert(string.char(string.byte("\xe4l\0óu", 1, 0)) == "")
assert(string.char(string.byte("\xe4l\0óu", -10, 100)) == "\xe4l\0óu")
checkerror("out of range", string.char, 256)
checkerror("out of range", string.char, -1)
checkerror("out of range", string.char, math.maxinteger)
checkerror("out of range", string.char, math.mininteger)
assert(string.upper("ab\0c") == "AB\0C")
assert(string.lower("\0ABCc%$") == "\0abcc%$")
assert(string.rep('teste', 0) == '')
assert(string.rep('tés\00tê', 2) == 'tés\0têtés\000tê')
assert(string.rep('', 10) == '')
if string.packsize("i") == 4 then
-- result length would be 2^31 (int overflow)
checkerror("too large", string.rep, 'aa', (1 << 30))
checkerror("too large", string.rep, 'a', (1 << 30), ',')
end
-- repetitions with separator
assert(string.rep('teste', 0, 'xuxu') == '')
assert(string.rep('teste', 1, 'xuxu') == 'teste')
assert(string.rep('\1\0\1', 2, '\0\0') == '\1\0\1\0\0\1\0\1')
assert(string.rep('', 10, '.') == string.rep('.', 9))
assert(not pcall(string.rep, "aa", maxi // 2 + 10))
assert(not pcall(string.rep, "", maxi // 2 + 10, "aa"))
assert(string.reverse"" == "")
assert(string.reverse"\0\1\2\3" == "\3\2\1\0")
assert(string.reverse"\0001234" == "4321\0")
for i=0,30 do assert(string.len(string.rep('a', i)) == i) end
assert(type(tostring(nil)) == 'string')
assert(type(tostring(12)) == 'string')
assert(string.find(tostring{}, 'table:'))
assert(string.find(tostring(print), 'function:'))
assert(#tostring('\0') == 1)
assert(tostring(true) == "true")
assert(tostring(false) == "false")
assert(tostring(-1203) == "-1203")
assert(tostring(1203.125) == "1203.125")
assert(tostring(-0.5) == "-0.5")
assert(tostring(-32767) == "-32767")
if math.tointeger(2147483647) then -- no overflow? (32 bits)
assert(tostring(-2147483647) == "-2147483647")
end
if math.tointeger(4611686018427387904) then -- no overflow? (64 bits)
assert(tostring(4611686018427387904) == "4611686018427387904")
assert(tostring(-4611686018427387904) == "-4611686018427387904")
end
if tostring(0.0) == "0.0" then -- "standard" coercion float->string
assert('' .. 12 == '12' and 12.0 .. '' == '12.0')
assert(tostring(-1203 + 0.0) == "-1203.0")
else -- compatible coercion
assert(tostring(0.0) == "0")
assert('' .. 12 == '12' and 12.0 .. '' == '12')
assert(tostring(-1203 + 0.0) == "-1203")
end
do -- tests for '%p' format
-- not much to test, as C does not specify what '%p' does.
-- ("The value of the pointer is converted to a sequence of printing
-- characters, in an implementation-defined manner.")
local null = "(null)" -- nulls are formatted by Lua
assert(string.format("%p", 4) == null)
assert(string.format("%p", true) == null)
assert(string.format("%p", nil) == null)
assert(string.format("%p", {}) ~= null)
assert(string.format("%p", print) ~= null)
assert(string.format("%p", coroutine.running()) ~= null)
assert(string.format("%p", io.stdin) ~= null)
assert(string.format("%p", io.stdin) == string.format("%p", io.stdin))
assert(string.format("%p", print) == string.format("%p", print))
assert(string.format("%p", print) ~= string.format("%p", assert))
assert(#string.format("%90p", {}) == 90)
assert(#string.format("%-60p", {}) == 60)
assert(string.format("%10p", false) == string.rep(" ", 10 - #null) .. null)
assert(string.format("%-12p", 1.5) == null .. string.rep(" ", 12 - #null))
do
local t1 = {}; local t2 = {}
assert(string.format("%p", t1) ~= string.format("%p", t2))
end
do -- short strings are internalized
local s1 = string.rep("a", 10)
local s2 = string.rep("aa", 5)
assert(string.format("%p", s1) == string.format("%p", s2))
end
do -- long strings aren't internalized
local s1 = string.rep("a", 300); local s2 = string.rep("a", 300)
assert(string.format("%p", s1) ~= string.format("%p", s2))
end
end
x = '"ílo"\n\\'
assert(string.format('%q%s', x, x) == '"\\"ílo\\"\\\n\\\\""ílo"\n\\')
assert(string.format('%q', "\0") == [["\0"]])
assert(load(string.format('return %q', x))() == x)
x = "\0\1\0023\5\0009"
assert(load(string.format('return %q', x))() == x)
assert(string.format("\0%c\0%c%x\0", string.byte("\xe4"), string.byte("b"), 140) ==
"\0\xe4\0b8c\0")
assert(string.format('') == "")
assert(string.format("%c",34)..string.format("%c",48)..string.format("%c",90)..string.format("%c",100) ==
string.format("%c%c%c%c", 34, 48, 90, 100))
assert(string.format("%s\0 is not \0%s", 'not be', 'be') == 'not be\0 is not \0be')
assert(string.format("%%%d %010d", 10, 23) == "%10 0000000023")
assert(tonumber(string.format("%f", 10.3)) == 10.3)
x = string.format('"%-50s"', 'a')
assert(#x == 52)
assert(string.sub(x, 1, 4) == '"a ')
assert(string.format("-%.20s.20s", string.rep("%", 2000)) ==
"-"..string.rep("%", 20)..".20s")
assert(string.format('"-%20s.20s"', string.rep("%", 2000)) ==
string.format("%q", "-"..string.rep("%", 2000)..".20s"))
do
local function checkQ (v)
local s = string.format("%q", v)
local nv = load("return " .. s)()
assert(v == nv and math.type(v) == math.type(nv))
end
checkQ("\0\0\1\255\u{234}")
checkQ(math.maxinteger)
checkQ(math.mininteger)
checkQ(math.pi)
checkQ(0.1)
checkQ(true)
checkQ(nil)
checkQ(false)
checkQ(math.huge)
checkQ(-math.huge)
assert(string.format("%q", 0/0) == "(0/0)") -- NaN
checkerror("no literal", string.format, "%q", {})
end
assert(string.format("\0%s\0", "\0\0\1") == "\0\0\0\1\0")
checkerror("contains zeros", string.format, "%10s", "\0")
checkerror("cannot have modifiers", string.format, "%10q", "1")
-- format x tostring
assert(string.format("%s %s", nil, true) == "nil true")
assert(string.format("%s %.4s", false, true) == "false true")
assert(string.format("%.3s %.3s", false, true) == "fal tru")
local m = setmetatable({}, {__tostring = function () return "hello" end,
__name = "hi"})
assert(string.format("%s %.10s", m, m) == "hello hello")
getmetatable(m).__tostring = nil -- will use '__name' from now on
assert(string.format("%.4s", m) == "hi: ")
getmetatable(m).__tostring = function () return {} end
checkerror("'__tostring' must return a string", tostring, m)
assert(string.format("%x", 0.0) == "0")
assert(string.format("%02x", 0.0) == "00")
assert(string.format("%08X", 0xFFFFFFFF) == "FFFFFFFF")
assert(string.format("%+08d", 31501) == "+0031501")
assert(string.format("%+08d", -30927) == "-0030927")
do -- longest number that can be formatted
local i = 1
local j = 10000
while i + 1 < j do -- binary search for maximum finite float
local m = (i + j) // 2
if 10^m < math.huge then i = m else j = m end
end
assert(10^i < math.huge and 10^j == math.huge)
local s = string.format('%.99f', -(10^i))
assert(string.len(s) >= i + 101)
assert(tonumber(s) == -(10^i))
-- limit for floats
assert(10^38 < math.huge)
local s = string.format('%.99f', -(10^38))
assert(string.len(s) >= 38 + 101)
assert(tonumber(s) == -(10^38))
end
-- testing large numbers for format
do -- assume at least 32 bits
local max, min = 0x7fffffff, -0x80000000 -- "large" for 32 bits
assert(string.sub(string.format("%8x", -1), -8) == "ffffffff")
assert(string.format("%x", max) == "7fffffff")
assert(string.sub(string.format("%x", min), -8) == "80000000")
assert(string.format("%d", max) == "2147483647")
assert(string.format("%d", min) == "-2147483648")
assert(string.format("%u", 0xffffffff) == "4294967295")
assert(string.format("%o", 0xABCD) == "125715")
max, min = 0x7fffffffffffffff, -0x8000000000000000
if max > 2.0^53 then -- only for 64 bits
assert(string.format("%x", (2^52 | 0) - 1) == "fffffffffffff")
assert(string.format("0x%8X", 0x8f000003) == "0x8F000003")
assert(string.format("%d", 2^53) == "9007199254740992")
assert(string.format("%i", -2^53) == "-9007199254740992")
assert(string.format("%x", max) == "7fffffffffffffff")
assert(string.format("%x", min) == "8000000000000000")
assert(string.format("%d", max) == "9223372036854775807")
assert(string.format("%d", min) == "-9223372036854775808")
assert(string.format("%u", ~(-1 << 64)) == "18446744073709551615")
assert(tostring(1234567890123) == '1234567890123')
end
end
do print("testing 'format %a %A'")
local function matchhexa (n)
local s = string.format("%a", n)
-- result matches ISO C requirements
assert(string.find(s, "^%-?0x[1-9a-f]%.?[0-9a-f]*p[-+]?%d+$"))
assert(tonumber(s) == n) -- and has full precision
s = string.format("%A", n)
assert(string.find(s, "^%-?0X[1-9A-F]%.?[0-9A-F]*P[-+]?%d+$"))
assert(tonumber(s) == n)
end
for _, n in ipairs{0.1, -0.1, 1/3, -1/3, 1e30, -1e30,
-45/247, 1, -1, 2, -2, 3e-20, -3e-20} do
matchhexa(n)
end
assert(string.find(string.format("%A", 0.0), "^0X0%.?0*P%+?0$"))
assert(string.find(string.format("%a", -0.0), "^%-0x0%.?0*p%+?0$"))
if not _port then -- test inf, -inf, NaN, and -0.0
assert(string.find(string.format("%a", 1/0), "^inf"))
assert(string.find(string.format("%A", -1/0), "^%-INF"))
assert(string.find(string.format("%a", 0/0), "^%-?nan"))
assert(string.find(string.format("%a", -0.0), "^%-0x0"))
end
if not pcall(string.format, "%.3a", 0) then
(Message or print)("\n >>> modifiers for format '%a' not available <<<\n")
else
assert(string.find(string.format("%+.2A", 12), "^%+0X%x%.%x0P%+?%d$"))
assert(string.find(string.format("%.4A", -12), "^%-0X%x%.%x000P%+?%d$"))
end
end
-- errors in format
local function check (fmt, msg)
checkerror(msg, string.format, fmt, 10)
end
local aux = string.rep('0', 600)
check("%100.3d", "too long")
check("%1"..aux..".3d", "too long")
check("%1.100d", "too long")
check("%10.1"..aux.."004d", "too long")
check("%t", "invalid conversion")
check("%"..aux.."d", "repeated flags")
check("%d %d", "no value")
assert(load("return 1\n--comment without ending EOL")() == 1)
checkerror("table expected", table.concat, 3)
checkerror("at index " .. maxi, table.concat, {}, " ", maxi, maxi)
-- '%' escapes following minus signal
checkerror("at index %" .. mini, table.concat, {}, " ", mini, mini)
assert(table.concat{} == "")
assert(table.concat({}, 'x') == "")
assert(table.concat({'\0', '\0\1', '\0\1\2'}, '.\0.') == "\0.\0.\0\1.\0.\0\1\2")
local a = {}; for i=1,300 do a[i] = "xuxu" end
assert(table.concat(a, "123").."123" == string.rep("xuxu123", 300))
assert(table.concat(a, "b", 20, 20) == "xuxu")
assert(table.concat(a, "", 20, 21) == "xuxuxuxu")
assert(table.concat(a, "x", 22, 21) == "")
assert(table.concat(a, "3", 299) == "xuxu3xuxu")
assert(table.concat({}, "x", maxi, maxi - 1) == "")
assert(table.concat({}, "x", mini + 1, mini) == "")
assert(table.concat({}, "x", maxi, mini) == "")
assert(table.concat({[maxi] = "alo"}, "x", maxi, maxi) == "alo")
assert(table.concat({[maxi] = "alo", [maxi - 1] = "y"}, "-", maxi - 1, maxi)
== "y-alo")
assert(not pcall(table.concat, {"a", "b", {}}))
a = {"a","b","c"}
assert(table.concat(a, ",", 1, 0) == "")
assert(table.concat(a, ",", 1, 1) == "a")
assert(table.concat(a, ",", 1, 2) == "a,b")
assert(table.concat(a, ",", 2) == "b,c")
assert(table.concat(a, ",", 3) == "c")
assert(table.concat(a, ",", 4) == "")
if not _port then
local locales = { "ptb", "pt_BR.iso88591", "ISO-8859-1" }
local function trylocale (w)
for i = 1, #locales do
if os.setlocale(locales[i], w) then
print(string.format("'%s' locale set to '%s'", w, locales[i]))
return locales[i]
end
end
print(string.format("'%s' locale not found", w))
return false
end
if trylocale("collate") then
assert("alo" < "álo" and "álo" < "amo")
end
if trylocale("ctype") then
assert(string.gsub("áéíóú", "%a", "x") == "xxxxx")
assert(string.gsub("áÁéÉ", "%l", "x") == "xÁxÉ")
assert(string.gsub("áÁéÉ", "%u", "x") == "áxéx")
assert(string.upper"áÁé{xuxu}ção" == "ÁÁÉ{XUXU}ÇÃO")
end
os.setlocale("C")
assert(os.setlocale() == 'C')
assert(os.setlocale(nil, "numeric") == 'C')
end
-- bug in Lua 5.3.2
-- 'gmatch' iterator does not work across coroutines
do
local f = string.gmatch("1 2 3 4 5", "%d+")
assert(f() == "1")
co = coroutine.wrap(f)
assert(co() == "2")
end
if T==nil then
(Message or print)
("\n >>> testC not active: skipping 'pushfstring' tests <<<\n")
else
print"testing 'pushfstring'"
-- formats %U, %f, %I already tested elsewhere
local blen = 200 -- internal buffer length in 'luaO_pushfstring'
local function callpfs (op, fmt, n)
local x = {T.testC("pushfstring" .. op .. "; return *", fmt, n)}
-- stack has code, 'fmt', 'n', and result from operation
assert(#x == 4) -- make sure nothing else was left in the stack
return x[4]
end
local function testpfs (op, fmt, n)
assert(callpfs(op, fmt, n) == string.format(fmt, n))
end
testpfs("I", "", 0)
testpfs("I", string.rep("a", blen - 1), 0)
testpfs("I", string.rep("a", blen), 0)
testpfs("I", string.rep("a", blen + 1), 0)
local str = string.rep("ab", blen) .. "%d" .. string.rep("d", blen / 2)
testpfs("I", str, 2^14)
testpfs("I", str, -2^15)
str = "%d" .. string.rep("cd", blen)
testpfs("I", str, 2^14)
testpfs("I", str, -2^15)
str = string.rep("c", blen - 2) .. "%d"
testpfs("I", str, 2^14)
testpfs("I", str, -2^15)
for l = 12, 14 do
local str1 = string.rep("a", l)
for i = 0, 500, 13 do
for j = 0, 500, 13 do
str = string.rep("a", i) .. "%s" .. string.rep("d", j)
testpfs("S", str, str1)
testpfs("S", str, str)
end
end
end
str = "abc %c def"
testpfs("I", str, string.byte("A"))
testpfs("I", str, 255)
str = string.rep("a", blen - 1) .. "%p" .. string.rep("cd", blen)
testpfs("P", str, {})
str = string.rep("%%", 3 * blen) .. "%p" .. string.rep("%%", 2 * blen)
testpfs("P", str, {})
end
print('OK')
| 17,152 | 499 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/closure.lua | -- $Id: test/closure.lua $
-- See Copyright Notice in file all.lua
print "testing closures"
local A,B = 0,{g=10}
function f(x)
local a = {}
for i=1,1000 do
local y = 0
do
a[i] = function () B.g = B.g+1; y = y+x; return y+A end
end
end
local dummy = function () return a[A] end
collectgarbage()
A = 1; assert(dummy() == a[1]); A = 0;
assert(a[1]() == x)
assert(a[3]() == x)
collectgarbage()
assert(B.g == 12)
return a
end
local a = f(10)
-- force a GC in this level
local x = {[1] = {}} -- to detect a GC
setmetatable(x, {__mode = 'kv'})
while x[1] do -- repeat until GC
local a = A..A..A..A -- create garbage
A = A+1
end
assert(a[1]() == 20+A)
assert(a[1]() == 30+A)
assert(a[2]() == 10+A)
collectgarbage()
assert(a[2]() == 20+A)
assert(a[2]() == 30+A)
assert(a[3]() == 20+A)
assert(a[8]() == 10+A)
assert(getmetatable(x).__mode == 'kv')
assert(B.g == 19)
-- testing equality
a = {}
for i = 1, 5 do a[i] = function (x) return i + a + _ENV end end
assert(a[3] ~= a[4] and a[4] ~= a[5])
do
local a = function (x) return math.sin(_ENV[x]) end
local function f()
return a
end
assert(f() == f())
end
-- testing closures with 'for' control variable
a = {}
for i=1,10 do
a[i] = {set = function(x) i=x end, get = function () return i end}
if i == 3 then break end
end
assert(a[4] == undef)
a[1].set(10)
assert(a[2].get() == 2)
a[2].set('a')
assert(a[3].get() == 3)
assert(a[2].get() == 'a')
a = {}
local t = {"a", "b"}
for i = 1, #t do
local k = t[i]
a[i] = {set = function(x, y) i=x; k=y end,
get = function () return i, k end}
if i == 2 then break end
end
a[1].set(10, 20)
local r,s = a[2].get()
assert(r == 2 and s == 'b')
r,s = a[1].get()
assert(r == 10 and s == 20)
a[2].set('a', 'b')
r,s = a[2].get()
assert(r == "a" and s == "b")
-- testing closures with 'for' control variable x break
for i=1,3 do
f = function () return i end
break
end
assert(f() == 1)
for k = 1, #t do
local v = t[k]
f = function () return k, v end
break
end
assert(({f()})[1] == 1)
assert(({f()})[2] == "a")
-- testing closure x break x return x errors
local b
function f(x)
local first = 1
while 1 do
if x == 3 and not first then return end
local a = 'xuxu'
b = function (op, y)
if op == 'set' then
a = x+y
else
return a
end
end
if x == 1 then do break end
elseif x == 2 then return
else if x ~= 3 then error() end
end
first = nil
end
end
for i=1,3 do
f(i)
assert(b('get') == 'xuxu')
b('set', 10); assert(b('get') == 10+i)
b = nil
end
pcall(f, 4);
assert(b('get') == 'xuxu')
b('set', 10); assert(b('get') == 14)
local w
-- testing multi-level closure
function f(x)
return function (y)
return function (z) return w+x+y+z end
end
end
y = f(10)
w = 1.345
assert(y(20)(30) == 60+w)
-- testing closures x break
do
local X, Y
local a = math.sin(0)
while a do
local b = 10
X = function () return b end -- closure with upvalue
if a then break end
end
do
local b = 20
Y = function () return b end -- closure with upvalue
end
-- upvalues must be different
assert(X() == 10 and Y() == 20)
end
-- testing closures x repeat-until
local a = {}
local i = 1
repeat
local x = i
a[i] = function () i = x+1; return x end
until i > 10 or a[i]() ~= x
assert(i == 11 and a[1]() == 1 and a[3]() == 3 and i == 4)
-- testing closures created in 'then' and 'else' parts of 'if's
a = {}
for i = 1, 10 do
if i % 3 == 0 then
local y = 0
a[i] = function (x) local t = y; y = x; return t end
elseif i % 3 == 1 then
goto L1
error'not here'
::L1::
local y = 1
a[i] = function (x) local t = y; y = x; return t end
elseif i % 3 == 2 then
local t
goto l4
::l4a:: a[i] = t; goto l4b
error("should never be here!")
::l4::
local y = 2
t = function (x) local t = y; y = x; return t end
goto l4a
error("should never be here!")
::l4b::
end
end
for i = 1, 10 do
assert(a[i](i * 10) == i % 3 and a[i]() == i * 10)
end
print'+'
-- test for correctly closing upvalues in tail calls of vararg functions
local function t ()
local function c(a,b) assert(a=="test" and b=="OK") end
local function v(f, ...) c("test", f() ~= 1 and "FAILED" or "OK") end
local x = 1
return v(function() return x end)
end
t()
-- test for debug manipulation of upvalues
local debug = require'debug'
do
local a , b, c = 3, 5, 7
foo1 = function () return a+b end;
foo2 = function () return b+a end;
do
local a = 10
foo3 = function () return a+b end;
end
end
assert(debug.upvalueid(foo1, 1))
assert(debug.upvalueid(foo1, 2))
assert(not debug.upvalueid(foo1, 3))
assert(debug.upvalueid(foo1, 1) == debug.upvalueid(foo2, 2))
assert(debug.upvalueid(foo1, 2) == debug.upvalueid(foo2, 1))
assert(debug.upvalueid(foo3, 1))
assert(debug.upvalueid(foo1, 1) ~= debug.upvalueid(foo3, 1))
assert(debug.upvalueid(foo1, 2) == debug.upvalueid(foo3, 2))
assert(debug.upvalueid(string.gmatch("x", "x"), 1) ~= nil)
assert(foo1() == 3 + 5 and foo2() == 5 + 3)
debug.upvaluejoin(foo1, 2, foo2, 2)
assert(foo1() == 3 + 3 and foo2() == 5 + 3)
assert(foo3() == 10 + 5)
debug.upvaluejoin(foo3, 2, foo2, 1)
assert(foo3() == 10 + 5)
debug.upvaluejoin(foo3, 2, foo2, 2)
assert(foo3() == 10 + 3)
assert(not pcall(debug.upvaluejoin, foo1, 3, foo2, 1))
assert(not pcall(debug.upvaluejoin, foo1, 1, foo2, 3))
assert(not pcall(debug.upvaluejoin, foo1, 0, foo2, 1))
assert(not pcall(debug.upvaluejoin, print, 1, foo2, 1))
assert(not pcall(debug.upvaluejoin, {}, 1, foo2, 1))
assert(not pcall(debug.upvaluejoin, foo1, 1, print, 1))
print'OK'
| 5,710 | 271 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/events.lua | -- $Id: test/events.lua $
-- See Copyright Notice in file all.lua
print('testing metatables')
local debug = require'debug'
X = 20; B = 30
_ENV = setmetatable({}, {__index=_G})
collectgarbage()
X = X+10
assert(X == 30 and _G.X == 20)
B = false
assert(B == false)
_ENV["B"] = undef
assert(B == 30)
assert(getmetatable{} == nil)
assert(getmetatable(4) == nil)
assert(getmetatable(nil) == nil)
a={name = "NAME"}; setmetatable(a, {__metatable = "xuxu",
__tostring=function(x) return x.name end})
assert(getmetatable(a) == "xuxu")
assert(tostring(a) == "NAME")
-- cannot change a protected metatable
assert(pcall(setmetatable, a, {}) == false)
a.name = "gororoba"
assert(tostring(a) == "gororoba")
local a, t = {10,20,30; x="10", y="20"}, {}
assert(setmetatable(a,t) == a)
assert(getmetatable(a) == t)
assert(setmetatable(a,nil) == a)
assert(getmetatable(a) == nil)
assert(setmetatable(a,t) == a)
function f (t, i, e)
assert(not e)
local p = rawget(t, "parent")
return (p and p[i]+3), "dummy return"
end
t.__index = f
a.parent = {z=25, x=12, [4] = 24}
assert(a[1] == 10 and a.z == 28 and a[4] == 27 and a.x == "10")
collectgarbage()
a = setmetatable({}, t)
function f(t, i, v) rawset(t, i, v-3) end
setmetatable(t, t) -- causes a bug in 5.1 !
t.__newindex = f
a[1] = 30; a.x = "101"; a[5] = 200
assert(a[1] == 27 and a.x == 98 and a[5] == 197)
do -- bug in Lua 5.3.2
local mt = {}
mt.__newindex = mt
local t = setmetatable({}, mt)
t[1] = 10 -- will segfault on some machines
assert(mt[1] == 10)
end
local c = {}
a = setmetatable({}, t)
t.__newindex = c
t.__index = c
a[1] = 10; a[2] = 20; a[3] = 90;
for i = 4, 20 do a[i] = i * 10 end
assert(a[1] == 10 and a[2] == 20 and a[3] == 90)
for i = 4, 20 do assert(a[i] == i * 10) end
assert(next(a) == nil)
do
local a;
a = setmetatable({}, {__index = setmetatable({},
{__index = setmetatable({},
{__index = function (_,n) return a[n-3]+4, "lixo" end})})})
a[0] = 20
for i=0,10 do
assert(a[i*3] == 20 + i*4)
end
end
do -- newindex
local foi
local a = {}
for i=1,10 do a[i] = 0; a['a'..i] = 0; end
setmetatable(a, {__newindex = function (t,k,v) foi=true; rawset(t,k,v) end})
foi = false; a[1]=0; assert(not foi)
foi = false; a['a1']=0; assert(not foi)
foi = false; a['a11']=0; assert(foi)
foi = false; a[11]=0; assert(foi)
foi = false; a[1]=undef; assert(not foi)
a[1] = undef
foi = false; a[1]=nil; assert(foi)
end
setmetatable(t, nil)
function f (t, ...) return t, {...} end
t.__call = f
do
local x,y = a(table.unpack{'a', 1})
assert(x==a and y[1]=='a' and y[2]==1 and y[3]==undef)
x,y = a()
assert(x==a and y[1]==undef)
end
local b = setmetatable({}, t)
setmetatable(b,t)
function f(op)
return function (...) cap = {[0] = op, ...} ; return (...) end
end
t.__add = f("add")
t.__sub = f("sub")
t.__mul = f("mul")
t.__div = f("div")
t.__idiv = f("idiv")
t.__mod = f("mod")
t.__unm = f("unm")
t.__pow = f("pow")
t.__len = f("len")
t.__band = f("band")
t.__bor = f("bor")
t.__bxor = f("bxor")
t.__shl = f("shl")
t.__shr = f("shr")
t.__bnot = f("bnot")
t.__lt = f("lt")
t.__le = f("le")
local function checkcap (t)
assert(#cap + 1 == #t)
for i = 1, #t do
assert(cap[i - 1] == t[i])
assert(math.type(cap[i - 1]) == math.type(t[i]))
end
end
-- Some tests are done inside small anonymous functions to ensure
-- that constants go to constant table even in debug compilation,
-- when the constant table is very small.
assert(b+5 == b); checkcap{"add", b, 5}
assert(5.2 + b == 5.2); checkcap{"add", 5.2, b}
assert(b+'5' == b); checkcap{"add", b, '5'}
assert(5+b == 5); checkcap{"add", 5, b}
assert('5'+b == '5'); checkcap{"add", '5', b}
b=b-3; assert(getmetatable(b) == t); checkcap{"sub", b, 3}
assert(5-a == 5); checkcap{"sub", 5, a}
assert('5'-a == '5'); checkcap{"sub", '5', a}
assert(a*a == a); checkcap{"mul", a, a}
assert(a/0 == a); checkcap{"div", a, 0}
assert(a/0.0 == a); checkcap{"div", a, 0.0}
assert(a%2 == a); checkcap{"mod", a, 2}
assert(a // (1/0) == a); checkcap{"idiv", a, 1/0}
;(function () assert(a & "hi" == a) end)(); checkcap{"band", a, "hi"}
;(function () assert(10 & a == 10) end)(); checkcap{"band", 10, a}
;(function () assert(a | 10 == a) end)(); checkcap{"bor", a, 10}
assert(a | "hi" == a); checkcap{"bor", a, "hi"}
assert("hi" ~ a == "hi"); checkcap{"bxor", "hi", a}
;(function () assert(10 ~ a == 10) end)(); checkcap{"bxor", 10, a}
assert(-a == a); checkcap{"unm", a, a}
assert(a^4.0 == a); checkcap{"pow", a, 4.0}
assert(a^'4' == a); checkcap{"pow", a, '4'}
assert(4^a == 4); checkcap{"pow", 4, a}
assert('4'^a == '4'); checkcap{"pow", '4', a}
assert(#a == a); checkcap{"len", a, a}
assert(~a == a); checkcap{"bnot", a, a}
assert(a << 3 == a); checkcap{"shl", a, 3}
assert(1.5 >> a == 1.5); checkcap{"shr", 1.5, a}
-- for comparison operators, all results are true
assert(5.0 > a); checkcap{"lt", a, 5.0}
assert(a >= 10); checkcap{"le", 10, a}
assert(a <= -10.0); checkcap{"le", a, -10.0}
assert(a < -10); checkcap{"lt", a, -10}
-- test for rawlen
t = setmetatable({1,2,3}, {__len = function () return 10 end})
assert(#t == 10 and rawlen(t) == 3)
assert(rawlen"abc" == 3)
assert(not pcall(rawlen, io.stdin))
assert(not pcall(rawlen, 34))
assert(not pcall(rawlen))
-- rawlen for long strings
assert(rawlen(string.rep('a', 1000)) == 1000)
t = {}
t.__lt = function (a,b,c)
collectgarbage()
assert(c == nil)
if type(a) == 'table' then a = a.x end
if type(b) == 'table' then b = b.x end
return a<b, "dummy"
end
t.__le = function (a,b,c)
assert(c == nil)
if type(a) == 'table' then a = a.x end
if type(b) == 'table' then b = b.x end
return a<=b, "dummy"
end
t.__eq = function (a,b,c)
assert(c == nil)
if type(a) == 'table' then a = a.x end
if type(b) == 'table' then b = b.x end
return a == b, "dummy"
end
function Op(x) return setmetatable({x=x}, t) end
local function test (a, b, c)
assert(not(Op(1)<Op(1)) and (Op(1)<Op(2)) and not(Op(2)<Op(1)))
assert(not(1 < Op(1)) and (Op(1) < 2) and not(2 < Op(1)))
assert(not(Op('a')<Op('a')) and (Op('a')<Op('b')) and not(Op('b')<Op('a')))
assert(not('a' < Op('a')) and (Op('a') < 'b') and not(Op('b') < Op('a')))
assert((Op(1)<=Op(1)) and (Op(1)<=Op(2)) and not(Op(2)<=Op(1)))
assert((Op('a')<=Op('a')) and (Op('a')<=Op('b')) and not(Op('b')<=Op('a')))
assert(not(Op(1)>Op(1)) and not(Op(1)>Op(2)) and (Op(2)>Op(1)))
assert(not(Op('a')>Op('a')) and not(Op('a')>Op('b')) and (Op('b')>Op('a')))
assert((Op(1)>=Op(1)) and not(Op(1)>=Op(2)) and (Op(2)>=Op(1)))
assert((1 >= Op(1)) and not(1 >= Op(2)) and (Op(2) >= 1))
assert((Op('a')>=Op('a')) and not(Op('a')>=Op('b')) and (Op('b')>=Op('a')))
assert(('a' >= Op('a')) and not(Op('a') >= 'b') and (Op('b') >= Op('a')))
assert(Op(1) == Op(1) and Op(1) ~= Op(2))
assert(Op('a') == Op('a') and Op('a') ~= Op('b'))
assert(a == a and a ~= b)
assert(Op(3) == c)
end
test(Op(1), Op(2), Op(3))
-- test `partial order'
local function rawSet(x)
local y = {}
for _,k in pairs(x) do y[k] = 1 end
return y
end
local function Set(x)
return setmetatable(rawSet(x), t)
end
t.__lt = function (a,b)
for k in pairs(a) do
if not b[k] then return false end
b[k] = undef
end
return next(b) ~= nil
end
t.__le = function (a,b)
for k in pairs(a) do
if not b[k] then return false end
end
return true
end
assert(Set{1,2,3} < Set{1,2,3,4})
assert(not(Set{1,2,3,4} < Set{1,2,3,4}))
assert((Set{1,2,3,4} <= Set{1,2,3,4}))
assert((Set{1,2,3,4} >= Set{1,2,3,4}))
assert(not (Set{1,3} <= Set{3,5}))
assert(not(Set{1,3} <= Set{3,5}))
assert(not(Set{1,3} >= Set{3,5}))
t.__eq = function (a,b)
for k in pairs(a) do
if not b[k] then return false end
b[k] = undef
end
return next(b) == nil
end
local s = Set{1,3,5}
assert(s == Set{3,5,1})
assert(not rawequal(s, Set{3,5,1}))
assert(rawequal(s, s))
assert(Set{1,3,5,1} == rawSet{3,5,1})
assert(rawSet{1,3,5,1} == Set{3,5,1})
assert(Set{1,3,5} ~= Set{3,5,1,6})
-- '__eq' is not used for table accesses
t[Set{1,3,5}] = 1
assert(t[Set{1,3,5}] == undef)
do -- test invalidating flags
local mt = {__eq = true}
local a = setmetatable({10}, mt)
local b = setmetatable({10}, mt)
mt.__eq = nil
assert(a ~= b) -- no metamethod
mt.__eq = function (x,y) return x[1] == y[1] end
assert(a == b) -- must use metamethod now
end
if not T then
(Message or print)('\n >>> testC not active: skipping tests for \z
userdata <<<\n')
else
local u1 = T.newuserdata(0, 1)
local u2 = T.newuserdata(0, 1)
local u3 = T.newuserdata(0, 1)
assert(u1 ~= u2 and u1 ~= u3)
debug.setuservalue(u1, 1);
debug.setuservalue(u2, 2);
debug.setuservalue(u3, 1);
debug.setmetatable(u1, {__eq = function (a, b)
return debug.getuservalue(a) == debug.getuservalue(b)
end})
debug.setmetatable(u2, {__eq = function (a, b)
return true
end})
assert(u1 == u3 and u3 == u1 and u1 ~= u2)
assert(u2 == u1 and u2 == u3 and u3 == u2)
assert(u2 ~= {}) -- different types cannot be equal
assert(rawequal(u1, u1) and not rawequal(u1, u3))
local mirror = {}
debug.setmetatable(u3, {__index = mirror, __newindex = mirror})
for i = 1, 10 do u3[i] = i end
for i = 1, 10 do assert(u3[i] == i) end
end
t.__concat = function (a,b,c)
assert(c == nil)
if type(a) == 'table' then a = a.val end
if type(b) == 'table' then b = b.val end
if A then return a..b
else
return setmetatable({val=a..b}, t)
end
end
c = {val="c"}; setmetatable(c, t)
d = {val="d"}; setmetatable(d, t)
A = true
assert(c..d == 'cd')
assert(0 .."a".."b"..c..d.."e".."f"..(5+3).."g" == "0abcdef8g")
A = false
assert((c..d..c..d).val == 'cdcd')
x = c..d
assert(getmetatable(x) == t and x.val == 'cd')
x = 0 .."a".."b"..c..d.."e".."f".."g"
assert(x.val == "0abcdefg")
-- concat metamethod x numbers (bug in 5.1.1)
c = {}
local x
setmetatable(c, {__concat = function (a,b)
assert(type(a) == "number" and b == c or type(b) == "number" and a == c)
return c
end})
assert(c..5 == c and 5 .. c == c)
assert(4 .. c .. 5 == c and 4 .. 5 .. 6 .. 7 .. c == c)
-- test comparison compatibilities
local t1, t2, c, d
t1 = {}; c = {}; setmetatable(c, t1)
d = {}
t1.__eq = function () return true end
t1.__lt = function () return true end
t1.__le = function () return false end
setmetatable(d, t1)
assert(c == d and c < d and not(d <= c))
t2 = {}
t2.__eq = t1.__eq
t2.__lt = t1.__lt
setmetatable(d, t2)
assert(c == d and c < d and not(d <= c))
-- test for several levels of calls
local i
local tt = {
__call = function (t, ...)
i = i+1
if t.f then return t.f(...)
else return {...}
end
end
}
local a = setmetatable({}, tt)
local b = setmetatable({f=a}, tt)
local c = setmetatable({f=b}, tt)
i = 0
x = c(3,4,5)
assert(i == 3 and x[1] == 3 and x[3] == 5)
assert(_G.X == 20)
print'+'
local _g = _G
_ENV = setmetatable({}, {__index=function (_,k) return _g[k] end})
a = {}
rawset(a, "x", 1, 2, 3)
assert(a.x == 1 and rawget(a, "x", 3) == 1)
print '+'
-- testing metatables for basic types
mt = {__index = function (a,b) return a+b end,
__len = function (x) return math.floor(x) end}
debug.setmetatable(10, mt)
assert(getmetatable(-2) == mt)
assert((10)[3] == 13)
assert((10)["3"] == 13)
assert(#3.45 == 3)
debug.setmetatable(23, nil)
assert(getmetatable(-2) == nil)
debug.setmetatable(true, mt)
assert(getmetatable(false) == mt)
mt.__index = function (a,b) return a or b end
assert((true)[false] == true)
assert((false)[false] == false)
debug.setmetatable(false, nil)
assert(getmetatable(true) == nil)
debug.setmetatable(nil, mt)
assert(getmetatable(nil) == mt)
mt.__add = function (a,b) return (a or 1) + (b or 2) end
assert(10 + nil == 12)
assert(nil + 23 == 24)
assert(nil + nil == 3)
debug.setmetatable(nil, nil)
assert(getmetatable(nil) == nil)
debug.setmetatable(nil, {})
-- loops in delegation
a = {}; setmetatable(a, a); a.__index = a; a.__newindex = a
assert(not pcall(function (a,b) return a[b] end, a, 10))
assert(not pcall(function (a,b,c) a[b] = c end, a, 10, true))
-- bug in 5.1
T, K, V = nil
grandparent = {}
grandparent.__newindex = function(t,k,v) T=t; K=k; V=v end
parent = {}
parent.__newindex = parent
setmetatable(parent, grandparent)
child = setmetatable({}, parent)
child.foo = 10 --> CRASH (on some machines)
assert(T == parent and K == "foo" and V == 10)
print 'OK'
return 12
| 12,399 | 489 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/code.lua | -- $Id: test/code.lua $
-- See Copyright Notice in file all.lua
if T==nil then
(Message or print)('\n >>> testC not active: skipping opcode tests <<<\n')
return
end
print "testing code generation and optimizations"
-- to test constant propagation
local k0aux <const> = 0
local k0 <const> = k0aux
local k1 <const> = 1
local k3 <const> = 3
local k6 <const> = k3 + (k3 << k0)
local kFF0 <const> = 0xFF0
local k3_78 <const> = 3.78
local x, k3_78_4 <const> = 10, k3_78 / 4
assert(x == 10)
local kx <const> = "x"
local kTrue <const> = true
local kFalse <const> = false
local kNil <const> = nil
-- this code gave an error for the code checker
do
local function f (a)
for k,v,w in a do end
end
end
-- testing reuse in constant table
local function checkKlist (func, list)
local k = T.listk(func)
assert(#k == #list)
for i = 1, #k do
assert(k[i] == list[i] and math.type(k[i]) == math.type(list[i]))
end
end
local function foo ()
local a
a = k3;
a = 0; a = 0.0; a = -7 + 7
a = k3_78/4; a = k3_78_4
a = -k3_78/4; a = k3_78/4; a = -3.78/4
a = -3.79/4; a = 0.0; a = -0;
a = k3; a = 3.0; a = 3; a = 3.0
end
checkKlist(foo, {3.78/4, -3.78/4, -3.79/4})
foo = function (f, a)
f(100 * 1000)
f(100.0 * 1000)
f(-100 * 1000)
f(-100 * 1000.0)
f(100000)
f(100000.0)
f(-100000)
f(-100000.0)
end
checkKlist(foo, {100000, 100000.0, -100000, -100000.0})
-- testing opcodes
-- check that 'f' opcodes match '...'
function check (f, ...)
local arg = {...}
local c = T.listcode(f)
for i=1, #arg do
local opcode = string.match(c[i], "%u%w+")
-- print(arg[i], opcode)
assert(arg[i] == opcode)
end
assert(c[#arg+2] == undef)
end
-- check that 'f' opcodes match '...' and that 'f(p) == r'.
function checkR (f, p, r, ...)
local r1 = f(p)
assert(r == r1 and math.type(r) == math.type(r1))
check(f, ...)
end
-- check that 'a' and 'b' has the same opcodes
function checkequal (a, b)
a = T.listcode(a)
b = T.listcode(b)
assert(#a == #b)
for i = 1, #a do
a[i] = string.gsub(a[i], '%b()', '') -- remove line number
b[i] = string.gsub(b[i], '%b()', '') -- remove line number
assert(a[i] == b[i])
end
end
-- some basic instructions
check(function () -- function does not create upvalues
(function () end){f()}
end, 'CLOSURE', 'NEWTABLE', 'EXTRAARG', 'GETTABUP', 'CALL',
'SETLIST', 'CALL', 'RETURN0')
check(function (x) -- function creates upvalues
(function () return x end){f()}
end, 'CLOSURE', 'NEWTABLE', 'EXTRAARG', 'GETTABUP', 'CALL',
'SETLIST', 'CALL', 'RETURN')
-- sequence of LOADNILs
check(function ()
local kNil <const> = nil
local a,b,c
local d; local e;
local f,g,h;
d = nil; d=nil; b=nil; a=kNil; c=nil;
end, 'LOADNIL', 'RETURN0')
check(function ()
local a,b,c,d = 1,1,1,1
d=nil;c=nil;b=nil;a=nil
end, 'LOADI', 'LOADI', 'LOADI', 'LOADI', 'LOADNIL', 'RETURN0')
do
local a,b,c,d = 1,1,1,1
d=nil;c=nil;b=nil;a=nil
assert(a == nil and b == nil and c == nil and d == nil)
end
-- single return
check (function (a,b,c) return a end, 'RETURN1')
-- infinite loops
check(function () while kTrue do local a = -1 end end,
'LOADI', 'JMP', 'RETURN0')
check(function () while 1 do local a = -1 end end,
'LOADI', 'JMP', 'RETURN0')
check(function () repeat local x = 1 until true end,
'LOADI', 'RETURN0')
-- concat optimization
check(function (a,b,c,d) return a..b..c..d end,
'MOVE', 'MOVE', 'MOVE', 'MOVE', 'CONCAT', 'RETURN1')
-- not
check(function () return not not nil end, 'LOADFALSE', 'RETURN1')
check(function () return not not kFalse end, 'LOADFALSE', 'RETURN1')
check(function () return not not true end, 'LOADTRUE', 'RETURN1')
check(function () return not not k3 end, 'LOADTRUE', 'RETURN1')
-- direct access to locals
check(function ()
local a,b,c,d
a = b*a
c.x, a[b] = -((a + d/b - a[b]) ^ a.x), b
end,
'LOADNIL',
'MUL', 'MMBIN',
'DIV', 'MMBIN', 'ADD', 'MMBIN', 'GETTABLE', 'SUB', 'MMBIN',
'GETFIELD', 'POW', 'MMBIN', 'UNM', 'SETTABLE', 'SETFIELD', 'RETURN0')
-- direct access to constants
check(function ()
local a,b
local c = kNil
a[kx] = 3.2
a.x = b
a[b] = 'x'
end,
'LOADNIL', 'SETFIELD', 'SETFIELD', 'SETTABLE', 'RETURN0')
-- "get/set table" with numeric indices
check(function (a)
local k255 <const> = 255
a[1] = a[100]
a[k255] = a[256]
a[256] = 5
end,
'GETI', 'SETI',
'LOADI', 'GETTABLE', 'SETI',
'LOADI', 'SETTABLE', 'RETURN0')
check(function ()
local a,b
a = a - a
b = a/a
b = 5-4
end,
'LOADNIL', 'SUB', 'MMBIN', 'DIV', 'MMBIN', 'LOADI', 'RETURN0')
check(function ()
local a,b
a[kTrue] = false
end,
'LOADNIL', 'LOADTRUE', 'SETTABLE', 'RETURN0')
-- equalities
checkR(function (a) if a == 1 then return 2 end end, 1, 2,
'EQI', 'JMP', 'LOADI', 'RETURN1')
checkR(function (a) if -4.0 == a then return 2 end end, -4, 2,
'EQI', 'JMP', 'LOADI', 'RETURN1')
checkR(function (a) if a == "hi" then return 2 end end, 10, nil,
'EQK', 'JMP', 'LOADI', 'RETURN1')
checkR(function (a) if a == 10000 then return 2 end end, 1, nil,
'EQK', 'JMP', 'LOADI', 'RETURN1') -- number too large
checkR(function (a) if -10000 == a then return 2 end end, -10000, 2,
'EQK', 'JMP', 'LOADI', 'RETURN1') -- number too large
-- comparisons
checkR(function (a) if -10 <= a then return 2 end end, -10, 2,
'GEI', 'JMP', 'LOADI', 'RETURN1')
checkR(function (a) if 128.0 > a then return 2 end end, 129, nil,
'LTI', 'JMP', 'LOADI', 'RETURN1')
checkR(function (a) if -127.0 < a then return 2 end end, -127, nil,
'GTI', 'JMP', 'LOADI', 'RETURN1')
checkR(function (a) if 10 < a then return 2 end end, 11, 2,
'GTI', 'JMP', 'LOADI', 'RETURN1')
checkR(function (a) if 129 < a then return 2 end end, 130, 2,
'LOADI', 'LT', 'JMP', 'LOADI', 'RETURN1')
checkR(function (a) if a >= 23.0 then return 2 end end, 25, 2,
'GEI', 'JMP', 'LOADI', 'RETURN1')
checkR(function (a) if a >= 23.1 then return 2 end end, 0, nil,
'LOADK', 'LE', 'JMP', 'LOADI', 'RETURN1')
checkR(function (a) if a > 2300.0 then return 2 end end, 0, nil,
'LOADF', 'LT', 'JMP', 'LOADI', 'RETURN1')
-- constant folding
local function checkK (func, val)
check(func, 'LOADK', 'RETURN1')
checkKlist(func, {val})
assert(func() == val)
end
local function checkI (func, val)
check(func, 'LOADI', 'RETURN1')
checkKlist(func, {})
assert(func() == val)
end
local function checkF (func, val)
check(func, 'LOADF', 'RETURN1')
checkKlist(func, {})
assert(func() == val)
end
checkF(function () return 0.0 end, 0.0)
checkI(function () return k0 end, 0)
checkI(function () return -k0//1 end, 0)
checkK(function () return 3^-1 end, 1/3)
checkK(function () return (1 + 1)^(50 + 50) end, 2^100)
checkK(function () return (-2)^(31 - 2) end, -0x20000000 + 0.0)
checkF(function () return (-k3^0 + 5) // 3.0 end, 1.0)
checkI(function () return -k3 % 5 end, 2)
checkF(function () return -((2.0^8 + -(-1)) % 8)/2 * 4 - 3 end, -5.0)
checkF(function () return -((2^8 + -(-1)) % 8)//2 * 4 - 3 end, -7.0)
checkI(function () return 0xF0.0 | 0xCC.0 ~ 0xAA & 0xFD end, 0xF4)
checkI(function () return ~(~kFF0 | kFF0) end, 0)
checkI(function () return ~~-1024.0 end, -1024)
checkI(function () return ((100 << k6) << -4) >> 2 end, 100)
-- borders around MAXARG_sBx ((((1 << 17) - 1) >> 1) == 65535)
local a = 17; local sbx = ((1 << a) - 1) >> 1 -- avoid folding
local border <const> = 65535
checkI(function () return border end, sbx)
checkI(function () return -border end, -sbx)
checkI(function () return border + 1 end, sbx + 1)
checkK(function () return border + 2 end, sbx + 2)
checkK(function () return -(border + 1) end, -(sbx + 1))
local border <const> = 65535.0
checkF(function () return border end, sbx + 0.0)
checkF(function () return -border end, -sbx + 0.0)
checkF(function () return border + 1 end, (sbx + 1.0))
checkK(function () return border + 2 end, (sbx + 2.0))
checkK(function () return -(border + 1) end, -(sbx + 1.0))
-- immediate operands
checkR(function (x) return x + k1 end, 10, 11, 'ADDI', 'MMBINI', 'RETURN1')
checkR(function (x) return x - 127 end, 10, -117, 'ADDI', 'MMBINI', 'RETURN1')
checkR(function (x) return 128 + x end, 0.0, 128.0,
'ADDI', 'MMBINI', 'RETURN1')
checkR(function (x) return x * -127 end, -1.0, 127.0,
'MULK', 'MMBINK', 'RETURN1')
checkR(function (x) return 20 * x end, 2, 40, 'MULK', 'MMBINK', 'RETURN1')
checkR(function (x) return x ^ -2 end, 2, 0.25, 'POWK', 'MMBINK', 'RETURN1')
checkR(function (x) return x / 40 end, 40, 1.0, 'DIVK', 'MMBINK', 'RETURN1')
checkR(function (x) return x // 1 end, 10.0, 10.0,
'IDIVK', 'MMBINK', 'RETURN1')
checkR(function (x) return x % (100 - 10) end, 91, 1,
'MODK', 'MMBINK', 'RETURN1')
checkR(function (x) return k1 << x end, 3, 8, 'SHLI', 'MMBINI', 'RETURN1')
checkR(function (x) return x << 127 end, 10, 0, 'SHRI', 'MMBINI', 'RETURN1')
checkR(function (x) return x << -127 end, 10, 0, 'SHRI', 'MMBINI', 'RETURN1')
checkR(function (x) return x >> 128 end, 8, 0, 'SHRI', 'MMBINI', 'RETURN1')
checkR(function (x) return x >> -127 end, 8, 0, 'SHRI', 'MMBINI', 'RETURN1')
checkR(function (x) return x & 1 end, 9, 1, 'BANDK', 'MMBINK', 'RETURN1')
checkR(function (x) return 10 | x end, 1, 11, 'BORK', 'MMBINK', 'RETURN1')
checkR(function (x) return -10 ~ x end, -1, 9, 'BXORK', 'MMBINK', 'RETURN1')
-- K operands in arithmetic operations
checkR(function (x) return x + 0.0 end, 1, 1.0, 'ADDK', 'MMBINK', 'RETURN1')
-- check(function (x) return 128 + x end, 'ADDK', 'MMBINK', 'RETURN1')
checkR(function (x) return x * -10000 end, 2, -20000,
'MULK', 'MMBINK', 'RETURN1')
-- check(function (x) return 20 * x end, 'MULK', 'MMBINK', 'RETURN1')
checkR(function (x) return x ^ 0.5 end, 4, 2.0, 'POWK', 'MMBINK', 'RETURN1')
checkR(function (x) return x / 2.0 end, 4, 2.0, 'DIVK', 'MMBINK', 'RETURN1')
checkR(function (x) return x // 10000 end, 10000, 1,
'IDIVK', 'MMBINK', 'RETURN1')
checkR(function (x) return x % (100.0 - 10) end, 91, 1.0,
'MODK', 'MMBINK', 'RETURN1')
-- no foldings (and immediate operands)
check(function () return -0.0 end, 'LOADF', 'UNM', 'RETURN1')
check(function () return k3/0 end, 'LOADI', 'DIVK', 'MMBINK', 'RETURN1')
check(function () return 0%0 end, 'LOADI', 'MODK', 'MMBINK', 'RETURN1')
check(function () return -4//0 end, 'LOADI', 'IDIVK', 'MMBINK', 'RETURN1')
check(function (x) return x >> 2.0 end, 'LOADF', 'SHR', 'MMBIN', 'RETURN1')
check(function (x) return x << 128 end, 'LOADI', 'SHL', 'MMBIN', 'RETURN1')
check(function (x) return x & 2.0 end, 'LOADF', 'BAND', 'MMBIN', 'RETURN1')
-- basic 'for' loops
check(function () for i = -10, 10.5 do end end,
'LOADI', 'LOADK', 'LOADI', 'FORPREP', 'FORLOOP', 'RETURN0')
check(function () for i = 0xfffffff, 10.0, 1 do end end,
'LOADK', 'LOADF', 'LOADI', 'FORPREP', 'FORLOOP', 'RETURN0')
-- bug in constant folding for 5.1
check(function () return -nil end, 'LOADNIL', 'UNM', 'RETURN1')
check(function ()
local a,b,c
b[c], a = c, b
b[a], a = c, b
a, b = c, a
a = a
end,
'LOADNIL',
'MOVE', 'MOVE', 'SETTABLE',
'MOVE', 'MOVE', 'MOVE', 'SETTABLE',
'MOVE', 'MOVE', 'MOVE',
-- no code for a = a
'RETURN0')
-- x == nil , x ~= nil
-- checkequal(function (b) if (a==nil) then a=1 end; if a~=nil then a=1 end end,
-- function () if (a==9) then a=1 end; if a~=9 then a=1 end end)
-- check(function () if a==nil then a='a' end end,
-- 'GETTABUP', 'EQ', 'JMP', 'SETTABUP', 'RETURN')
do -- tests for table access in upvalues
local t
check(function () t[kx] = t.y end, 'GETTABUP', 'SETTABUP')
check(function (a) t[a()] = t[a()] end,
'MOVE', 'CALL', 'GETUPVAL', 'MOVE', 'CALL',
'GETUPVAL', 'GETTABLE', 'SETTABLE')
end
-- de morgan
checkequal(function () local a; if not (a or b) then b=a end end,
function () local a; if (not a and not b) then b=a end end)
checkequal(function (l) local a; return 0 <= a and a <= l end,
function (l) local a; return not (not(a >= 0) or not(a <= l)) end)
-- if-break optimizations
check(function (a, b)
while a do
if b then break else a = a + 1 end
end
end,
'TEST', 'JMP', 'TEST', 'JMP', 'ADDI', 'MMBINI', 'JMP', 'RETURN0')
checkequal(function () return 6 or true or nil end,
function () return k6 or kTrue or kNil end)
checkequal(function () return 6 and true or nil end,
function () return k6 and kTrue or kNil end)
do -- string constants
local k0 <const> = "00000000000000000000000000000000000000000000000000"
local function f1 ()
local k <const> = k0
return function ()
return function () return k end
end
end
local f2 = f1()
local f3 = f2()
assert(f3() == k0)
checkK(f3, k0)
-- string is not needed by other functions
assert(T.listk(f1)[1] == nil)
assert(T.listk(f2)[1] == nil)
end
print 'OK'
| 12,853 | 436 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/main.lua | # testing special comment on first line
-- $Id: test/main.lua $
-- See Copyright Notice in file all.lua
-- most (all?) tests here assume a reasonable "Unix-like" shell
if _port then return end
-- use only "double quotes" inside shell scripts (better change to
-- run on Windows)
print ("testing stand-alone interpreter")
assert(os.execute()) -- machine has a system command
local arg = arg or ARG
local prog = os.tmpname()
local otherprog = os.tmpname()
local out = os.tmpname()
local progname
do
local i = 0
while arg[i] do i=i-1 end
progname = arg[i+1]
end
print("progname: "..progname)
local prepfile = function (s, p)
p = p or prog
io.output(p)
io.write(s)
assert(io.close())
end
local function getoutput ()
io.input(out)
local t = io.read("a")
io.input():close()
assert(os.remove(out))
return t
end
local function checkprogout (s)
-- expected result must end with new line
assert(string.sub(s, -1) == "\n")
local t = getoutput()
for line in string.gmatch(s, ".-\n") do
assert(string.find(t, line, 1, true))
end
end
local function checkout (s)
local t = getoutput()
if s ~= t then print(string.format("'%s' - '%s'\n", s, t)) end
assert(s == t)
return t
end
local function RUN (p, ...)
p = string.gsub(p, "lua", '"'..progname..'"', 1)
local s = string.format(p, ...)
assert(os.execute(s))
end
local function NoRun (msg, p, ...)
p = string.gsub(p, "lua", '"'..progname..'"', 1)
local s = string.format(p, ...)
s = string.format("%s 2> %s", s, out) -- will send error to 'out'
assert(not os.execute(s))
assert(string.find(getoutput(), msg, 1, true)) -- check error message
end
RUN('lua -v')
print(string.format("(temporary program file used in these tests: %s)", prog))
-- running stdin as a file
prepfile""
RUN('lua - < %s > %s', prog, out)
checkout("")
prepfile[[
print(
1, a
)
]]
RUN('lua - < %s > %s', prog, out)
checkout("1\tnil\n")
RUN('echo "print(10)\nprint(2)\n" | lua > %s', out)
checkout("10\n2\n")
-- test option '-'
RUN('echo "print(arg[1])" | lua - -h > %s', out)
checkout("-h\n")
-- test environment variables used by Lua
prepfile("print(package.path)")
-- test LUA_PATH
RUN('env LUA_INIT= LUA_PATH=x lua %s > %s', prog, out)
checkout("x\n")
-- test LUA_PATH_version
RUN('env LUA_INIT= LUA_PATH_5_4=y LUA_PATH=x lua %s > %s', prog, out)
checkout("y\n")
-- test LUA_CPATH
prepfile("print(package.cpath)")
RUN('env LUA_INIT= LUA_CPATH=xuxu lua %s > %s', prog, out)
checkout("xuxu\n")
-- test LUA_CPATH_version
RUN('env LUA_INIT= LUA_CPATH_5_4=yacc LUA_CPATH=x lua %s > %s', prog, out)
checkout("yacc\n")
-- test LUA_INIT (and its access to 'arg' table)
prepfile("print(X)")
RUN('env LUA_INIT="X=tonumber(arg[1])" lua %s 3.2 > %s', prog, out)
checkout("3.2\n")
-- test LUA_INIT_version
prepfile("print(X)")
RUN('env LUA_INIT_5_4="X=10" LUA_INIT="X=3" lua %s > %s', prog, out)
checkout("10\n")
-- test LUA_INIT for files
prepfile("x = x or 10; print(x); x = x + 1")
RUN('env LUA_INIT="@%s" lua %s > %s', prog, prog, out)
checkout("10\n11\n")
-- test errors in LUA_INIT
NoRun('LUA_INIT:1: msg', 'env LUA_INIT="error(\'msg\')" lua')
-- test option '-E'
local defaultpath, defaultCpath
do
prepfile("print(package.path, package.cpath)")
RUN('env LUA_INIT="error(10)" LUA_PATH=xxx LUA_CPATH=xxx lua -E %s > %s',
prog, out)
local output = getoutput()
defaultpath = string.match(output, "^(.-)\t")
defaultCpath = string.match(output, "\t(.-)$")
-- running with an empty environment
RUN('env -i lua %s > %s', prog, out)
local out = getoutput()
assert(defaultpath == string.match(output, "^(.-)\t"))
assert(defaultCpath == string.match(output, "\t(.-)$"))
end
-- paths did not change
assert(not string.find(defaultpath, "xxx") and
string.find(defaultpath, "lua") and
not string.find(defaultCpath, "xxx") and
string.find(defaultCpath, "lua"))
-- test replacement of ';;' to default path
local function convert (p)
prepfile("print(package.path)")
RUN('env LUA_PATH="%s" lua %s > %s', p, prog, out)
local expected = getoutput()
expected = string.sub(expected, 1, -2) -- cut final end of line
if string.find(p, ";;") then
p = string.gsub(p, ";;", ";"..defaultpath..";")
p = string.gsub(p, "^;", "") -- remove ';' at the beginning
p = string.gsub(p, ";$", "") -- remove ';' at the end
end
assert(p == expected)
end
convert(";")
convert(";;")
convert("a;;b")
convert(";;b")
convert("a;;")
convert("a;b;;c")
-- test -l over multiple libraries
prepfile("print(1); a=2; return {x=15}")
prepfile(("print(a); print(_G['%s'].x)"):format(prog), otherprog)
RUN('env LUA_PATH="?;;" lua -l %s -l%s -lstring -l io %s > %s', prog, otherprog, otherprog, out)
checkout("1\n2\n15\n2\n15\n")
-- test 'arg' table
local a = [[
assert(#arg == 3 and arg[1] == 'a' and
arg[2] == 'b' and arg[3] == 'c')
assert(arg[-1] == '--' and arg[-2] == "-e " and arg[-3] == '%s')
assert(arg[4] == undef and arg[-4] == undef)
local a, b, c = ...
assert(... == 'a' and a == 'a' and b == 'b' and c == 'c')
]]
a = string.format(a, progname)
prepfile(a)
RUN('lua "-e " -- %s a b c', prog) -- "-e " runs an empty command
-- test 'arg' availability in libraries
prepfile"assert(arg)"
prepfile("assert(arg)", otherprog)
RUN('env LUA_PATH="?;;" lua -l%s - < %s', prog, otherprog)
-- test messing up the 'arg' table
RUN('echo "print(...)" | lua -e "arg[1] = 100" - > %s', out)
checkout("100\n")
NoRun("'arg' is not a table", 'echo "" | lua -e "arg = 1" -')
-- test error in 'print'
RUN('echo 10 | lua -e "print=nil" -i > /dev/null 2> %s', out)
assert(string.find(getoutput(), "error calling 'print'"))
-- test 'debug.debug'
RUN('echo "io.stderr:write(1000)\ncont" | lua -e "require\'debug\'.debug()" 2> %s', out)
checkout("lua_debug> 1000lua_debug> ")
print("testing warnings")
-- no warnings by default
RUN('echo "io.stderr:write(1); warn[[XXX]]" | lua 2> %s', out)
checkout("1")
prepfile[[
warn("@allow") -- unknown control, ignored
warn("@off", "XXX", "@off") -- these are not control messages
warn("@off") -- this one is
warn("@on", "YYY", "@on") -- not control, but warn is off
warn("@off") -- keep it off
warn("@on") -- restart warnings
warn("", "@on") -- again, no control, real warning
warn("@on") -- keep it "started"
warn("Z", "Z", "Z") -- common warning
]]
RUN('lua -W %s 2> %s', prog, out)
checkout[[
Lua warning: @offXXX@off
Lua warning: @on
Lua warning: ZZZ
]]
prepfile[[
warn("@allow")
-- create two objects to be finalized when closing state
-- the errors in the finalizers must generate warnings
u1 = setmetatable({}, {__gc = function () error("XYZ") end})
u2 = setmetatable({}, {__gc = function () error("ZYX") end})
]]
RUN('lua -W %s 2> %s', prog, out)
checkprogout("ZYX)\nXYZ)\n")
-- test many arguments
prepfile[[print(({...})[30])]]
RUN('lua %s %s > %s', prog, string.rep(" a", 30), out)
checkout("a\n")
RUN([[lua "-eprint(1)" -ea=3 -e "print(a)" > %s]], out)
checkout("1\n3\n")
-- test iteractive mode
prepfile[[
(6*2-6) -- ===
a =
10
print(a)
a]]
RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)
checkprogout("6\n10\n10\n\n")
prepfile("a = [[b\nc\nd\ne]]\n=a")
RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)
checkprogout("b\nc\nd\ne\n\n")
prompt = "alo"
prepfile[[ --
a = 2
]]
RUN([[lua "-e_PROMPT='%s'" -i < %s > %s]], prompt, prog, out)
local t = getoutput()
-- <disabled-by-jart>
-- [it doesn't make sense to print prompt if !isatty]
-- assert(string.find(t, prompt .. ".*" .. prompt .. ".*" .. prompt))
-- </disabled-by-jart>
-- -- using the prompt default
prepfile[[ --
a = 2
]]
RUN([[lua -i < %s > %s]], prog, out)
local t = getoutput()
prompt = "> " -- the default
-- <disabled-by-jart>
-- [it doesn't make sense to print prompt if !isatty]
-- assert(string.find(t, prompt .. ".*" .. prompt .. ".*" .. prompt))
-- </disabled-by-jart>
-- non-string prompt
prompt =
"local C = 0;\z
_PROMPT=setmetatable({},{__tostring = function () \z
C = C + 1; return C end})"
prepfile[[ --
a = 2
]]
-- <disabled-by-jart>
-- [it doesn't make sense to print prompt if !isatty]
-- RUN([[lua -e "%s" -i < %s > %s]], prompt, prog, out)
-- local t = getoutput()
-- assert(string.find(t, [[
-- 1 --
-- 2a = 2
-- 3
-- ]], 1, true) or string.find(t, "123", 1, true))
-- assert(string.find(t, prompt .. ".*" .. prompt .. ".*" .. prompt))
-- </disabled-by-jart>
-- test for error objects
prepfile[[
debug = require "debug"
m = {x=0}
setmetatable(m, {__tostring = function(x)
return tostring(debug.getinfo(4).currentline + x.x)
end})
error(m)
]]
NoRun(progname .. ": 6\n", [[lua %s]], prog)
prepfile("error{}")
NoRun("error object is a table value", [[lua %s]], prog)
-- chunk broken in many lines
s = [=[ --
function f ( x )
local a = [[
xuxu
]]
local b = "\
xuxu\n"
if x == 11 then return 1 + 12 , 2 + 20 end --[[ test multiple returns ]]
return x + 1
--\\
end
return( f( 100 ) )
assert( a == b )
do return f( 11 ) end ]=]
s = string.gsub(s, ' ', '\n\n') -- change all spaces for newlines
prepfile(s)
RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)
checkprogout("101\n13\t22\n\n")
prepfile[[#comment in 1st line without \n at the end]]
RUN('lua %s', prog)
prepfile[[#test line number when file starts with comment line
debug = require"debug"
print(debug.getinfo(1).currentline)
]]
RUN('lua %s > %s', prog, out)
checkprogout('3\n')
-- close Lua with an open file
prepfile(string.format([[io.output(%q); io.write('alo')]], out))
RUN('lua %s', prog)
checkout('alo')
-- bug in 5.2 beta (extra \0 after version line)
RUN([[lua -v -e"print'hello'" > %s]], out)
t = getoutput()
assert(string.find(t, "PUC%-Rio\nhello"))
-- testing os.exit
prepfile("os.exit(nil, true)")
RUN('lua %s', prog)
prepfile("os.exit(0, true)")
RUN('lua %s', prog)
prepfile("os.exit(true, true)")
RUN('lua %s', prog)
prepfile("os.exit(1, true)")
NoRun("", "lua %s", prog) -- no message
prepfile("os.exit(false, true)")
NoRun("", "lua %s", prog) -- no message
-- to-be-closed variables in main chunk
prepfile[[
local x <close> = setmetatable({},
{__close = function (self, err)
assert(err == nil)
print("Ok")
end})
local e1 <close> = setmetatable({}, {__close = function () print(120) end})
os.exit(true, true)
]]
RUN('lua %s > %s', prog, out)
checkprogout("120\nOk\n")
-- remove temporary files
assert(os.remove(prog))
assert(os.remove(otherprog))
assert(not os.remove(out))
-- invalid options
NoRun("unrecognized option '-h'", "lua -h")
NoRun("unrecognized option '---'", "lua ---")
NoRun("unrecognized option '-Ex'", "lua -Ex")
NoRun("unrecognized option '-vv'", "lua -vv")
NoRun("unrecognized option '-iv'", "lua -iv")
NoRun("'-e' needs argument", "lua -e")
NoRun("syntax error", "lua -e a")
NoRun("'-l' needs argument", "lua -l")
if T then -- test library?
print("testing 'not enough memory' to create a state")
NoRun("not enough memory", "env MEMLIMIT=100 lua")
-- testing 'warn'
warn("@store")
warn("@123", "456", "789")
assert(_WARN == "@123456789"); _WARN = false
warn("zip", "", " ", "zap")
assert(_WARN == "zip zap"); _WARN = false
warn("ZIP", "", " ", "ZAP")
assert(_WARN == "ZIP ZAP"); _WARN = false
warn("@normal")
end
do
-- 'warn' must get at least one argument
local st, msg = pcall(warn)
assert(string.find(msg, "string expected"))
-- 'warn' does not leave unfinished warning in case of errors
-- (message would appear in next warning)
st, msg = pcall(warn, "SHOULD NOT APPEAR", {})
assert(string.find(msg, "string expected"))
end
print('+')
print('testing Ctrl C')
do
-- interrupt a script
local function kill (pid)
return os.execute(string.format('kill -INT %s 2> /dev/null', pid))
end
-- function to run a script in background, returning its output file
-- descriptor and its pid
local function runback (luaprg)
-- shell script to run 'luaprg' in background and echo its pid
local shellprg = string.format('%s -e "%s" & echo $!', progname, luaprg)
local f = io.popen(shellprg, "r") -- run shell script
local pid = f:read() -- get pid for Lua script
print("(if test fails now, it may leave a Lua script running in \z
background, pid " .. pid .. ")")
return f, pid
end
-- Lua script that runs protected infinite loop and then prints '42'
local f, pid = runback[[
pcall(function () print(12); while true do end end); print(42)]]
-- wait until script is inside 'pcall'
assert(f:read() == "12")
kill(pid) -- send INT signal to Lua script
-- check that 'pcall' captured the exception and script continued running
assert(f:read() == "42") -- expected output
assert(f:close())
print("done")
-- Lua script in a long unbreakable search
local f, pid = runback[[
print(15); string.find(string.rep('a', 100000), '.*b')]]
-- wait (so script can reach the loop)
assert(f:read() == "15")
assert(os.execute("sleep 1"))
-- must send at least two INT signals to stop this Lua script
local n = 100
for i = 0, 100 do -- keep sending signals
if not kill(pid) then -- until it fails
n = i -- number of non-failed kills
break
end
end
assert(f:close())
assert(n >= 2)
print(string.format("done (with %d kills)", n))
end
print("OK")
| 13,445 | 505 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/utf8.lua | -- $Id: test/utf8.lua $
-- See Copyright Notice in file all.lua
print "testing UTF-8 library"
local utf8 = require'utf8'
local function checkerror (msg, f, ...)
local s, err = pcall(f, ...)
assert(not s and string.find(err, msg))
end
local function len (s)
return #string.gsub(s, "[\x80-\xBF]", "")
end
local justone = "^" .. utf8.charpattern .. "$"
-- 't' is the list of codepoints of 's'
local function checksyntax (s, t)
-- creates a string "return '\u{t[1]}...\u{t[n]}'"
local ts = {"return '"}
for i = 1, #t do ts[i + 1] = string.format("\\u{%x}", t[i]) end
ts[#t + 2] = "'"
ts = table.concat(ts)
-- its execution should result in 's'
assert(assert(load(ts))() == s)
end
assert(not utf8.offset("alo", 5))
assert(not utf8.offset("alo", -4))
-- 'check' makes several tests over the validity of string 's'.
-- 't' is the list of codepoints of 's'.
local function check (s, t, nonstrict)
local l = utf8.len(s, 1, -1, nonstrict)
assert(#t == l and len(s) == l)
assert(utf8.char(table.unpack(t)) == s) -- 't' and 's' are equivalent
assert(utf8.offset(s, 0) == 1)
checksyntax(s, t)
-- creates new table with all codepoints of 's'
local t1 = {utf8.codepoint(s, 1, -1, nonstrict)}
assert(#t == #t1)
for i = 1, #t do assert(t[i] == t1[i]) end -- 't' is equal to 't1'
for i = 1, l do -- for all codepoints
local pi = utf8.offset(s, i) -- position of i-th char
local pi1 = utf8.offset(s, 2, pi) -- position of next char
assert(string.find(string.sub(s, pi, pi1 - 1), justone))
assert(utf8.offset(s, -1, pi1) == pi)
assert(utf8.offset(s, i - l - 1) == pi)
assert(pi1 - pi == #utf8.char(utf8.codepoint(s, pi, pi, nonstrict)))
for j = pi, pi1 - 1 do
assert(utf8.offset(s, 0, j) == pi)
end
for j = pi + 1, pi1 - 1 do
assert(not utf8.len(s, j))
end
assert(utf8.len(s, pi, pi, nonstrict) == 1)
assert(utf8.len(s, pi, pi1 - 1, nonstrict) == 1)
assert(utf8.len(s, pi, -1, nonstrict) == l - i + 1)
assert(utf8.len(s, pi1, -1, nonstrict) == l - i)
assert(utf8.len(s, 1, pi, nonstrict) == i)
end
local i = 0
for p, c in utf8.codes(s, nonstrict) do
i = i + 1
assert(c == t[i] and p == utf8.offset(s, i))
assert(utf8.codepoint(s, p, p, nonstrict) == c)
end
assert(i == #t)
i = 0
for c in string.gmatch(s, utf8.charpattern) do
i = i + 1
assert(c == utf8.char(t[i]))
end
assert(i == #t)
for i = 1, l do
assert(utf8.offset(s, i) == utf8.offset(s, i - l - 1, #s + 1))
end
end
do -- error indication in utf8.len
local function check (s, p)
local a, b = utf8.len(s)
assert(not a and b == p)
end
check("abc\xE3def", 4)
check("æ±å\x80", #("æ±å") + 1)
check("\xF4\x9F\xBF", 1)
check("\xF4\x9F\xBF\xBF", 1)
end
-- errors in utf8.codes
do
local function errorcodes (s)
checkerror("invalid UTF%-8 code",
function ()
for c in utf8.codes(s) do assert(c) end
end)
end
errorcodes("ab\xff")
errorcodes("\u{110000}")
end
-- error in initial position for offset
checkerror("position out of bounds", utf8.offset, "abc", 1, 5)
checkerror("position out of bounds", utf8.offset, "abc", 1, -4)
checkerror("position out of bounds", utf8.offset, "", 1, 2)
checkerror("position out of bounds", utf8.offset, "", 1, -1)
checkerror("continuation byte", utf8.offset, "𦧺", 1, 2)
checkerror("continuation byte", utf8.offset, "𦧺", 1, 2)
checkerror("continuation byte", utf8.offset, "\x80", 1)
-- error in indices for len
checkerror("out of bounds", utf8.len, "abc", 0, 2)
checkerror("out of bounds", utf8.len, "abc", 1, 4)
local s = "hello World"
local t = {string.byte(s, 1, -1)}
for i = 1, utf8.len(s) do assert(t[i] == string.byte(s, i)) end
check(s, t)
check("æ±å/æ¼¢å", {27721, 23383, 47, 28450, 23383,})
do
local s = "áéÃ\128"
local t = {utf8.codepoint(s,1,#s - 1)}
assert(#t == 3 and t[1] == 225 and t[2] == 233 and t[3] == 237)
checkerror("invalid UTF%-8 code", utf8.codepoint, s, 1, #s)
checkerror("out of bounds", utf8.codepoint, s, #s + 1)
t = {utf8.codepoint(s, 4, 3)}
assert(#t == 0)
checkerror("out of bounds", utf8.codepoint, s, -(#s + 1), 1)
checkerror("out of bounds", utf8.codepoint, s, 1, #s + 1)
-- surrogates
assert(utf8.codepoint("\u{D7FF}") == 0xD800 - 1)
assert(utf8.codepoint("\u{E000}") == 0xDFFF + 1)
assert(utf8.codepoint("\u{D800}", 1, 1, true) == 0xD800)
assert(utf8.codepoint("\u{DFFF}", 1, 1, true) == 0xDFFF)
assert(utf8.codepoint("\u{7FFFFFFF}", 1, 1, true) == 0x7FFFFFFF)
end
assert(utf8.char() == "")
assert(utf8.char(0, 97, 98, 99, 1) == "\0abc\1")
assert(utf8.codepoint(utf8.char(0x10FFFF)) == 0x10FFFF)
assert(utf8.codepoint(utf8.char(0x7FFFFFFF), 1, 1, true) == (1<<31) - 1)
checkerror("value out of range", utf8.char, 0x7FFFFFFF + 1)
checkerror("value out of range", utf8.char, -1)
local function invalid (s)
checkerror("invalid UTF%-8 code", utf8.codepoint, s)
assert(not utf8.len(s))
end
-- UTF-8 representation for 0x11ffff (value out of valid range)
invalid("\xF4\x9F\xBF\xBF")
-- surrogates
invalid("\u{D800}")
invalid("\u{DFFF}")
-- overlong sequences
invalid("\xC0\x80") -- zero
invalid("\xC1\xBF") -- 0x7F (should be coded in 1 byte)
invalid("\xE0\x9F\xBF") -- 0x7FF (should be coded in 2 bytes)
invalid("\xF0\x8F\xBF\xBF") -- 0xFFFF (should be coded in 3 bytes)
-- invalid bytes
invalid("\x80") -- continuation byte
invalid("\xBF") -- continuation byte
invalid("\xFE") -- invalid byte
invalid("\xFF") -- invalid byte
-- empty string
check("", {})
-- minimum and maximum values for each sequence size
s = "\0 \x7F\z
\xC2\x80 \xDF\xBF\z
\xE0\xA0\x80 \xEF\xBF\xBF\z
\xF0\x90\x80\x80 \xF4\x8F\xBF\xBF"
s = string.gsub(s, " ", "")
check(s, {0,0x7F, 0x80,0x7FF, 0x800,0xFFFF, 0x10000,0x10FFFF})
do
-- original UTF-8 values
local s = "\u{4000000}\u{7FFFFFFF}"
assert(#s == 12)
check(s, {0x4000000, 0x7FFFFFFF}, true)
s = "\u{200000}\u{3FFFFFF}"
assert(#s == 10)
check(s, {0x200000, 0x3FFFFFF}, true)
s = "\u{10000}\u{1fffff}"
assert(#s == 8)
check(s, {0x10000, 0x1FFFFF}, true)
end
x = "æ¥æ¬èªa-4\0éó"
check(x, {26085, 26412, 35486, 97, 45, 52, 0, 233, 243})
-- Supplementary Characters
check("𣲷ð ð ±ð¡»ð µ¼ab𠺢",
{0x23CB7, 0x2070E, 0x20C53, 0x2107B, 0x20D7C, 0x61, 0x62, 0x20EA2,})
check("ð¨³ð©¶ð¦§ºð¨³ð¥«ð¤\xF4\x8F\xBF\xBF",
{0x28CCA, 0x29D98, 0x269FA, 0x28CD2, 0x2512B, 0x244D3, 0x10ffff})
local i = 0
for p, c in string.gmatch(x, "()(" .. utf8.charpattern .. ")") do
i = i + 1
assert(utf8.offset(x, i) == p)
assert(utf8.len(x, p) == utf8.len(x) - i + 1)
assert(utf8.len(c) == 1)
for j = 1, #c - 1 do
assert(utf8.offset(x, 0, p + j - 1) == p)
end
end
print'ok'
| 6,793 | 242 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/math.lua | -- $Id: test/math.lua $
-- See Copyright Notice in file all.lua
print("testing numbers and math lib")
local minint <const> = math.mininteger
local maxint <const> = math.maxinteger
local intbits <const> = math.floor(math.log(maxint, 2) + 0.5) + 1
assert((1 << intbits) == 0)
assert(minint == 1 << (intbits - 1))
assert(maxint == minint - 1)
-- number of bits in the mantissa of a floating-point number
local floatbits = 24
do
local p = 2.0^floatbits
while p < p + 1.0 do
p = p * 2.0
floatbits = floatbits + 1
end
end
local function isNaN (x)
return (x ~= x)
end
assert(isNaN(0/0))
assert(not isNaN(1/0))
do
local x = 2.0^floatbits
assert(x > x - 1.0 and x == x + 1.0)
print(string.format("%d-bit integers, %d-bit (mantissa) floats",
intbits, floatbits))
end
assert(math.type(0) == "integer" and math.type(0.0) == "float"
and not math.type("10"))
local function checkerror (msg, f, ...)
local s, err = pcall(f, ...)
assert(not s and string.find(err, msg))
end
local msgf2i = "number.* has no integer representation"
-- float equality
function eq (a,b,limit)
if not limit then
if floatbits >= 50 then limit = 1E-11
else limit = 1E-5
end
end
-- a == b needed for +inf/-inf
return a == b or math.abs(a-b) <= limit
end
-- equality with types
function eqT (a,b)
return a == b and math.type(a) == math.type(b)
end
-- basic float notation
assert(0e12 == 0 and .0 == 0 and 0. == 0 and .2e2 == 20 and 2.E-1 == 0.2)
do
local a,b,c = "2", " 3e0 ", " 10 "
assert(a+b == 5 and -b == -3 and b+"2" == 5 and "10"-c == 0)
assert(type(a) == 'string' and type(b) == 'string' and type(c) == 'string')
assert(a == "2" and b == " 3e0 " and c == " 10 " and -c == -" 10 ")
assert(c%a == 0 and a^b == 08)
a = 0
assert(a == -a and 0 == -0)
end
do
local x = -1
local mz = 0/x -- minus zero
t = {[0] = 10, 20, 30, 40, 50}
assert(t[mz] == t[0] and t[-0] == t[0])
end
do -- tests for 'modf'
local a,b = math.modf(3.5)
assert(a == 3.0 and b == 0.5)
a,b = math.modf(-2.5)
assert(a == -2.0 and b == -0.5)
a,b = math.modf(-3e23)
assert(a == -3e23 and b == 0.0)
a,b = math.modf(3e35)
assert(a == 3e35 and b == 0.0)
a,b = math.modf(-1/0) -- -inf
assert(a == -1/0 and b == 0.0)
a,b = math.modf(1/0) -- inf
assert(a == 1/0 and b == 0.0)
a,b = math.modf(0/0) -- NaN
assert(isNaN(a) and isNaN(b))
a,b = math.modf(3) -- integer argument
assert(eqT(a, 3) and eqT(b, 0.0))
a,b = math.modf(minint)
assert(eqT(a, minint) and eqT(b, 0.0))
end
assert(math.huge > 10e30)
assert(-math.huge < -10e30)
-- integer arithmetic
assert(minint < minint + 1)
assert(maxint - 1 < maxint)
assert(0 - minint == minint)
assert(minint * minint == 0)
assert(maxint * maxint * maxint == maxint)
-- testing floor division and conversions
for _, i in pairs{-16, -15, -3, -2, -1, 0, 1, 2, 3, 15} do
for _, j in pairs{-16, -15, -3, -2, -1, 1, 2, 3, 15} do
for _, ti in pairs{0, 0.0} do -- try 'i' as integer and as float
for _, tj in pairs{0, 0.0} do -- try 'j' as integer and as float
local x = i + ti
local y = j + tj
assert(i//j == math.floor(i/j))
end
end
end
end
assert(1//0.0 == 1/0)
assert(-1 // 0.0 == -1/0)
assert(eqT(3.5 // 1.5, 2.0))
assert(eqT(3.5 // -1.5, -3.0))
do -- tests for different kinds of opcodes
local x, y
x = 1; assert(x // 0.0 == 1/0)
x = 1.0; assert(x // 0 == 1/0)
x = 3.5; assert(eqT(x // 1, 3.0))
assert(eqT(x // -1, -4.0))
x = 3.5; y = 1.5; assert(eqT(x // y, 2.0))
x = 3.5; y = -1.5; assert(eqT(x // y, -3.0))
end
assert(maxint // maxint == 1)
assert(maxint // 1 == maxint)
assert((maxint - 1) // maxint == 0)
assert(maxint // (maxint - 1) == 1)
assert(minint // minint == 1)
assert(minint // minint == 1)
assert((minint + 1) // minint == 0)
assert(minint // (minint + 1) == 1)
assert(minint // 1 == minint)
assert(minint // -1 == -minint)
assert(minint // -2 == 2^(intbits - 2))
assert(maxint // -1 == -maxint)
-- negative exponents
do
assert(2^-3 == 1 / 2^3)
assert(eq((-3)^-3, 1 / (-3)^3))
for i = -3, 3 do -- variables avoid constant folding
for j = -3, 3 do
-- domain errors (0^(-n)) are not portable
if not _port or i ~= 0 or j > 0 then
assert(eq(i^j, 1 / i^(-j)))
end
end
end
end
-- comparison between floats and integers (border cases)
if floatbits < intbits then
assert(2.0^floatbits == (1 << floatbits))
assert(2.0^floatbits - 1.0 == (1 << floatbits) - 1.0)
assert(2.0^floatbits - 1.0 ~= (1 << floatbits))
-- float is rounded, int is not
assert(2.0^floatbits + 1.0 ~= (1 << floatbits) + 1)
else -- floats can express all integers with full accuracy
assert(maxint == maxint + 0.0)
assert(maxint - 1 == maxint - 1.0)
assert(minint + 1 == minint + 1.0)
assert(maxint ~= maxint - 1.0)
end
assert(maxint + 0.0 == 2.0^(intbits - 1) - 1.0)
assert(minint + 0.0 == minint)
assert(minint + 0.0 == -2.0^(intbits - 1))
-- order between floats and integers
assert(1 < 1.1); assert(not (1 < 0.9))
assert(1 <= 1.1); assert(not (1 <= 0.9))
assert(-1 < -0.9); assert(not (-1 < -1.1))
assert(1 <= 1.1); assert(not (-1 <= -1.1))
assert(-1 < -0.9); assert(not (-1 < -1.1))
assert(-1 <= -0.9); assert(not (-1 <= -1.1))
assert(minint <= minint + 0.0)
assert(minint + 0.0 <= minint)
assert(not (minint < minint + 0.0))
assert(not (minint + 0.0 < minint))
assert(maxint < minint * -1.0)
assert(maxint <= minint * -1.0)
do
local fmaxi1 = 2^(intbits - 1)
assert(maxint < fmaxi1)
assert(maxint <= fmaxi1)
assert(not (fmaxi1 <= maxint))
assert(minint <= -2^(intbits - 1))
assert(-2^(intbits - 1) <= minint)
end
if floatbits < intbits then
print("testing order (floats cannot represent all integers)")
local fmax = 2^floatbits
local ifmax = fmax | 0
assert(fmax < ifmax + 1)
assert(fmax - 1 < ifmax)
assert(-(fmax - 1) > -ifmax)
assert(not (fmax <= ifmax - 1))
assert(-fmax > -(ifmax + 1))
assert(not (-fmax >= -(ifmax - 1)))
assert(fmax/2 - 0.5 < ifmax//2)
assert(-(fmax/2 - 0.5) > -ifmax//2)
assert(maxint < 2^intbits)
assert(minint > -2^intbits)
assert(maxint <= 2^intbits)
assert(minint >= -2^intbits)
else
print("testing order (floats can represent all integers)")
assert(maxint < maxint + 1.0)
assert(maxint < maxint + 0.5)
assert(maxint - 1.0 < maxint)
assert(maxint - 0.5 < maxint)
assert(not (maxint + 0.0 < maxint))
assert(maxint + 0.0 <= maxint)
assert(not (maxint < maxint + 0.0))
assert(maxint + 0.0 <= maxint)
assert(maxint <= maxint + 0.0)
assert(not (maxint + 1.0 <= maxint))
assert(not (maxint + 0.5 <= maxint))
assert(not (maxint <= maxint - 1.0))
assert(not (maxint <= maxint - 0.5))
assert(minint < minint + 1.0)
assert(minint < minint + 0.5)
assert(minint <= minint + 0.5)
assert(minint - 1.0 < minint)
assert(minint - 1.0 <= minint)
assert(not (minint + 0.0 < minint))
assert(not (minint + 0.5 < minint))
assert(not (minint < minint + 0.0))
assert(minint + 0.0 <= minint)
assert(minint <= minint + 0.0)
assert(not (minint + 1.0 <= minint))
assert(not (minint + 0.5 <= minint))
assert(not (minint <= minint - 1.0))
end
do
local NaN <const> = 0/0
assert(not (NaN < 0))
assert(not (NaN > minint))
assert(not (NaN <= -9))
assert(not (NaN <= maxint))
assert(not (NaN < maxint))
assert(not (minint <= NaN))
assert(not (minint < NaN))
assert(not (4 <= NaN))
assert(not (4 < NaN))
end
-- avoiding errors at compile time
local function checkcompt (msg, code)
checkerror(msg, assert(load(code)))
end
checkcompt("divide by zero", "return 2 // 0")
checkcompt(msgf2i, "return 2.3 >> 0")
checkcompt(msgf2i, ("return 2.0^%d & 1"):format(intbits - 1))
checkcompt("field 'huge'", "return math.huge << 1")
checkcompt(msgf2i, ("return 1 | 2.0^%d"):format(intbits - 1))
checkcompt(msgf2i, "return 2.3 ~ 0.0")
-- testing overflow errors when converting from float to integer (runtime)
local function f2i (x) return x | x end
checkerror(msgf2i, f2i, math.huge) -- +inf
checkerror(msgf2i, f2i, -math.huge) -- -inf
checkerror(msgf2i, f2i, 0/0) -- NaN
if floatbits < intbits then
-- conversion tests when float cannot represent all integers
assert(maxint + 1.0 == maxint + 0.0)
assert(minint - 1.0 == minint + 0.0)
checkerror(msgf2i, f2i, maxint + 0.0)
assert(f2i(2.0^(intbits - 2)) == 1 << (intbits - 2))
assert(f2i(-2.0^(intbits - 2)) == -(1 << (intbits - 2)))
assert((2.0^(floatbits - 1) + 1.0) // 1 == (1 << (floatbits - 1)) + 1)
-- maximum integer representable as a float
local mf = maxint - (1 << (floatbits - intbits)) + 1
assert(f2i(mf + 0.0) == mf) -- OK up to here
mf = mf + 1
assert(f2i(mf + 0.0) ~= mf) -- no more representable
else
-- conversion tests when float can represent all integers
assert(maxint + 1.0 > maxint)
assert(minint - 1.0 < minint)
assert(f2i(maxint + 0.0) == maxint)
checkerror("no integer rep", f2i, maxint + 1.0)
checkerror("no integer rep", f2i, minint - 1.0)
end
-- 'minint' should be representable as a float no matter the precision
assert(f2i(minint + 0.0) == minint)
-- testing numeric strings
assert("2" + 1 == 3)
assert("2 " + 1 == 3)
assert(" -2 " + 1 == -1)
assert(" -0xa " + 1 == -9)
-- Literal integer Overflows (new behavior in 5.3.3)
do
-- no overflows
assert(eqT(tonumber(tostring(maxint)), maxint))
assert(eqT(tonumber(tostring(minint)), minint))
-- add 1 to last digit as a string (it cannot be 9...)
local function incd (n)
local s = string.format("%d", n)
s = string.gsub(s, "%d$", function (d)
assert(d ~= '9')
return string.char(string.byte(d) + 1)
end)
return s
end
-- 'tonumber' with overflow by 1
assert(eqT(tonumber(incd(maxint)), maxint + 1.0))
assert(eqT(tonumber(incd(minint)), minint - 1.0))
-- large numbers
assert(eqT(tonumber("1"..string.rep("0", 30)), 1e30))
assert(eqT(tonumber("-1"..string.rep("0", 30)), -1e30))
-- hexa format still wraps around
assert(eqT(tonumber("0x1"..string.rep("0", 30)), 0))
-- lexer in the limits
assert(minint == load("return " .. minint)())
assert(eqT(maxint, load("return " .. maxint)()))
assert(eqT(10000000000000000000000.0, 10000000000000000000000))
assert(eqT(-10000000000000000000000.0, -10000000000000000000000))
end
-- testing 'tonumber'
-- 'tonumber' with numbers
assert(tonumber(3.4) == 3.4)
assert(eqT(tonumber(3), 3))
assert(eqT(tonumber(maxint), maxint) and eqT(tonumber(minint), minint))
assert(tonumber(1/0) == 1/0)
-- 'tonumber' with strings
assert(tonumber("0") == 0)
assert(not tonumber(""))
assert(not tonumber(" "))
assert(not tonumber("-"))
assert(not tonumber(" -0x "))
assert(not tonumber{})
assert(tonumber'+0.01' == 1/100 and tonumber'+.01' == 0.01 and
tonumber'.01' == 0.01 and tonumber'-1.' == -1 and
tonumber'+1.' == 1)
assert(not tonumber'+ 0.01' and not tonumber'+.e1' and
not tonumber'1e' and not tonumber'1.0e+' and
not tonumber'.')
assert(tonumber('-012') == -010-2)
assert(tonumber('-1.2e2') == - - -120)
assert(tonumber("0xffffffffffff") == (1 << (4*12)) - 1)
assert(tonumber("0x"..string.rep("f", (intbits//4))) == -1)
assert(tonumber("-0x"..string.rep("f", (intbits//4))) == 1)
-- testing 'tonumber' with base
assert(tonumber(' 001010 ', 2) == 10)
assert(tonumber(' 001010 ', 10) == 001010)
assert(tonumber(' -1010 ', 2) == -10)
assert(tonumber('10', 36) == 36)
assert(tonumber(' -10 ', 36) == -36)
assert(tonumber(' +1Z ', 36) == 36 + 35)
assert(tonumber(' -1z ', 36) == -36 + -35)
assert(tonumber('-fFfa', 16) == -(10+(16*(15+(16*(15+(16*15)))))))
assert(tonumber(string.rep('1', (intbits - 2)), 2) + 1 == 2^(intbits - 2))
assert(tonumber('ffffFFFF', 16)+1 == (1 << 32))
assert(tonumber('0ffffFFFF', 16)+1 == (1 << 32))
assert(tonumber('-0ffffffFFFF', 16) - 1 == -(1 << 40))
for i = 2,36 do
local i2 = i * i
local i10 = i2 * i2 * i2 * i2 * i2 -- i^10
assert(tonumber('\t10000000000\t', i) == i10)
end
if not _soft then
-- tests with very long numerals
assert(tonumber("0x"..string.rep("f", 13)..".0") == 2.0^(4*13) - 1)
assert(tonumber("0x"..string.rep("f", 150)..".0") == 2.0^(4*150) - 1)
assert(tonumber("0x"..string.rep("f", 300)..".0") == 2.0^(4*300) - 1)
assert(tonumber("0x"..string.rep("f", 500)..".0") == 2.0^(4*500) - 1)
assert(tonumber('0x3.' .. string.rep('0', 1000)) == 3)
assert(tonumber('0x' .. string.rep('0', 1000) .. 'a') == 10)
assert(tonumber('0x0.' .. string.rep('0', 13).."1") == 2.0^(-4*14))
assert(tonumber('0x0.' .. string.rep('0', 150).."1") == 2.0^(-4*151))
assert(tonumber('0x0.' .. string.rep('0', 300).."1") == 2.0^(-4*301))
assert(tonumber('0x0.' .. string.rep('0', 500).."1") == 2.0^(-4*501))
assert(tonumber('0xe03' .. string.rep('0', 1000) .. 'p-4000') == 3587.0)
assert(tonumber('0x.' .. string.rep('0', 1000) .. '74p4004') == 0x7.4)
end
-- testing 'tonumber' for invalid formats
local function f (...)
if select('#', ...) == 1 then
return (...)
else
return "***"
end
end
assert(not f(tonumber('fFfa', 15)))
assert(not f(tonumber('099', 8)))
assert(not f(tonumber('1\0', 2)))
assert(not f(tonumber('', 8)))
assert(not f(tonumber(' ', 9)))
assert(not f(tonumber(' ', 9)))
assert(not f(tonumber('0xf', 10)))
assert(not f(tonumber('inf')))
assert(not f(tonumber(' INF ')))
assert(not f(tonumber('Nan')))
assert(not f(tonumber('nan')))
assert(not f(tonumber(' ')))
assert(not f(tonumber('')))
assert(not f(tonumber('1 a')))
assert(not f(tonumber('1 a', 2)))
assert(not f(tonumber('1\0')))
assert(not f(tonumber('1 \0')))
assert(not f(tonumber('1\0 ')))
assert(not f(tonumber('e1')))
assert(not f(tonumber('e 1')))
assert(not f(tonumber(' 3.4.5 ')))
-- testing 'tonumber' for invalid hexadecimal formats
assert(not tonumber('0x'))
assert(not tonumber('x'))
assert(not tonumber('x3'))
assert(not tonumber('0x3.3.3')) -- two decimal points
assert(not tonumber('00x2'))
assert(not tonumber('0x 2'))
assert(not tonumber('0 x2'))
assert(not tonumber('23x'))
assert(not tonumber('- 0xaa'))
assert(not tonumber('-0xaaP ')) -- no exponent
assert(not tonumber('0x0.51p'))
assert(not tonumber('0x5p+-2'))
-- testing hexadecimal numerals
assert(0x10 == 16 and 0xfff == 2^12 - 1 and 0XFB == 251)
assert(0x0p12 == 0 and 0x.0p-3 == 0)
assert(0xFFFFFFFF == (1 << 32) - 1)
assert(tonumber('+0x2') == 2)
assert(tonumber('-0xaA') == -170)
assert(tonumber('-0xffFFFfff') == -(1 << 32) + 1)
-- possible confusion with decimal exponent
assert(0E+1 == 0 and 0xE+1 == 15 and 0xe-1 == 13)
-- floating hexas
assert(tonumber(' 0x2.5 ') == 0x25/16)
assert(tonumber(' -0x2.5 ') == -0x25/16)
assert(tonumber(' +0x0.51p+8 ') == 0x51)
assert(0x.FfffFFFF == 1 - '0x.00000001')
assert('0xA.a' + 0 == 10 + 10/16)
assert(0xa.aP4 == 0XAA)
assert(0x4P-2 == 1)
assert(0x1.1 == '0x1.' + '+0x.1')
assert(0Xabcdef.0 == 0x.ABCDEFp+24)
assert(1.1 == 1.+.1)
assert(100.0 == 1E2 and .01 == 1e-2)
assert(1111111111 - 1111111110 == 1000.00e-03)
assert(1.1 == '1.'+'.1')
assert(tonumber'1111111111' - tonumber'1111111110' ==
tonumber" +0.001e+3 \n\t")
assert(0.1e-30 > 0.9E-31 and 0.9E30 < 0.1e31)
assert(0.123456 > 0.123455)
assert(tonumber('+1.23E18') == 1.23*10.0^18)
-- testing order operators
assert(not(1<1) and (1<2) and not(2<1))
assert(not('a'<'a') and ('a'<'b') and not('b'<'a'))
assert((1<=1) and (1<=2) and not(2<=1))
assert(('a'<='a') and ('a'<='b') and not('b'<='a'))
assert(not(1>1) and not(1>2) and (2>1))
assert(not('a'>'a') and not('a'>'b') and ('b'>'a'))
assert((1>=1) and not(1>=2) and (2>=1))
assert(('a'>='a') and not('a'>='b') and ('b'>='a'))
assert(1.3 < 1.4 and 1.3 <= 1.4 and not (1.3 < 1.3) and 1.3 <= 1.3)
-- testing mod operator
assert(eqT(-4 % 3, 2))
assert(eqT(4 % -3, -2))
assert(eqT(-4.0 % 3, 2.0))
assert(eqT(4 % -3.0, -2.0))
assert(eqT(4 % -5, -1))
assert(eqT(4 % -5.0, -1.0))
assert(eqT(4 % 5, 4))
assert(eqT(4 % 5.0, 4.0))
assert(eqT(-4 % -5, -4))
assert(eqT(-4 % -5.0, -4.0))
assert(eqT(-4 % 5, 1))
assert(eqT(-4 % 5.0, 1.0))
assert(eqT(4.25 % 4, 0.25))
assert(eqT(10.0 % 2, 0.0))
assert(eqT(-10.0 % 2, 0.0))
assert(eqT(-10.0 % -2, 0.0))
assert(math.pi - math.pi % 1 == 3)
assert(math.pi - math.pi % 0.001 == 3.141)
do -- very small numbers
local i, j = 0, 20000
while i < j do
local m = (i + j) // 2
if 10^-m > 0 then
i = m + 1
else
j = m
end
end
-- 'i' is the smallest possible ten-exponent
local b = 10^-(i - (i // 10)) -- a very small number
assert(b > 0 and b * b == 0)
local delta = b / 1000
assert(eq((2.1 * b) % (2 * b), (0.1 * b), delta))
assert(eq((-2.1 * b) % (2 * b), (2 * b) - (0.1 * b), delta))
assert(eq((2.1 * b) % (-2 * b), (0.1 * b) - (2 * b), delta))
assert(eq((-2.1 * b) % (-2 * b), (-0.1 * b), delta))
end
-- basic consistency between integer modulo and float modulo
for i = -10, 10 do
for j = -10, 10 do
if j ~= 0 then
assert((i + 0.0) % j == i % j)
end
end
end
for i = 0, 10 do
for j = -10, 10 do
if j ~= 0 then
assert((2^i) % j == (1 << i) % j)
end
end
end
do -- precision of module for large numbers
local i = 10
while (1 << i) > 0 do
assert((1 << i) % 3 == i % 2 + 1)
i = i + 1
end
i = 10
while 2^i < math.huge do
assert(2^i % 3 == i % 2 + 1)
i = i + 1
end
end
assert(eqT(minint % minint, 0))
assert(eqT(maxint % maxint, 0))
assert((minint + 1) % minint == minint + 1)
assert((maxint - 1) % maxint == maxint - 1)
assert(minint % maxint == maxint - 1)
assert(minint % -1 == 0)
assert(minint % -2 == 0)
assert(maxint % -2 == -1)
-- non-portable tests because Windows C library cannot compute
-- fmod(1, huge) correctly
if not _port then
local function anan (x) assert(isNaN(x)) end -- assert Not a Number
anan(0.0 % 0)
anan(1.3 % 0)
anan(math.huge % 1)
anan(math.huge % 1e30)
anan(-math.huge % 1e30)
anan(-math.huge % -1e30)
assert(1 % math.huge == 1)
assert(1e30 % math.huge == 1e30)
assert(1e30 % -math.huge == -math.huge)
assert(-1 % math.huge == math.huge)
assert(-1 % -math.huge == -1)
end
-- testing unsigned comparisons
assert(math.ult(3, 4))
assert(not math.ult(4, 4))
assert(math.ult(-2, -1))
assert(math.ult(2, -1))
assert(not math.ult(-2, -2))
assert(math.ult(maxint, minint))
assert(not math.ult(minint, maxint))
assert(eq(math.sin(-9.8)^2 + math.cos(-9.8)^2, 1))
assert(eq(math.tan(math.pi/4), 1))
assert(eq(math.sin(math.pi/2), 1) and eq(math.cos(math.pi/2), 0))
assert(eq(math.atan(1), math.pi/4) and eq(math.acos(0), math.pi/2) and
eq(math.asin(1), math.pi/2))
assert(eq(math.deg(math.pi/2), 90) and eq(math.rad(90), math.pi/2))
assert(math.abs(-10.43) == 10.43)
assert(eqT(math.abs(minint), minint))
assert(eqT(math.abs(maxint), maxint))
assert(eqT(math.abs(-maxint), maxint))
assert(eq(math.atan(1,0), math.pi/2))
assert(math.fmod(10,3) == 1)
assert(eq(math.sqrt(10)^2, 10))
assert(eq(math.log(2, 10), math.log(2)/math.log(10)))
assert(eq(math.log(2, 2), 1))
assert(eq(math.log(9, 3), 2))
assert(eq(math.exp(0), 1))
assert(eq(math.sin(10), math.sin(10%(2*math.pi))))
assert(tonumber(' 1.3e-2 ') == 1.3e-2)
assert(tonumber(' -1.00000000000001 ') == -1.00000000000001)
-- testing constant limits
-- 2^23 = 8388608
assert(8388609 + -8388609 == 0)
assert(8388608 + -8388608 == 0)
assert(8388607 + -8388607 == 0)
do -- testing floor & ceil
assert(eqT(math.floor(3.4), 3))
assert(eqT(math.ceil(3.4), 4))
assert(eqT(math.floor(-3.4), -4))
assert(eqT(math.ceil(-3.4), -3))
assert(eqT(math.floor(maxint), maxint))
assert(eqT(math.ceil(maxint), maxint))
assert(eqT(math.floor(minint), minint))
assert(eqT(math.floor(minint + 0.0), minint))
assert(eqT(math.ceil(minint), minint))
assert(eqT(math.ceil(minint + 0.0), minint))
assert(math.floor(1e50) == 1e50)
assert(math.ceil(1e50) == 1e50)
assert(math.floor(-1e50) == -1e50)
assert(math.ceil(-1e50) == -1e50)
for _, p in pairs{31,32,63,64} do
assert(math.floor(2^p) == 2^p)
assert(math.floor(2^p + 0.5) == 2^p)
assert(math.ceil(2^p) == 2^p)
assert(math.ceil(2^p - 0.5) == 2^p)
end
checkerror("number expected", math.floor, {})
checkerror("number expected", math.ceil, print)
assert(eqT(math.tointeger(minint), minint))
assert(eqT(math.tointeger(minint .. ""), minint))
assert(eqT(math.tointeger(maxint), maxint))
assert(eqT(math.tointeger(maxint .. ""), maxint))
assert(eqT(math.tointeger(minint + 0.0), minint))
assert(not math.tointeger(0.0 - minint))
assert(not math.tointeger(math.pi))
assert(not math.tointeger(-math.pi))
assert(math.floor(math.huge) == math.huge)
assert(math.ceil(math.huge) == math.huge)
assert(not math.tointeger(math.huge))
assert(math.floor(-math.huge) == -math.huge)
assert(math.ceil(-math.huge) == -math.huge)
assert(not math.tointeger(-math.huge))
assert(math.tointeger("34.0") == 34)
assert(not math.tointeger("34.3"))
assert(not math.tointeger({}))
assert(not math.tointeger(0/0)) -- NaN
end
-- testing fmod for integers
for i = -6, 6 do
for j = -6, 6 do
if j ~= 0 then
local mi = math.fmod(i, j)
local mf = math.fmod(i + 0.0, j)
assert(mi == mf)
assert(math.type(mi) == 'integer' and math.type(mf) == 'float')
if (i >= 0 and j >= 0) or (i <= 0 and j <= 0) or mi == 0 then
assert(eqT(mi, i % j))
end
end
end
end
assert(eqT(math.fmod(minint, minint), 0))
assert(eqT(math.fmod(maxint, maxint), 0))
assert(eqT(math.fmod(minint + 1, minint), minint + 1))
assert(eqT(math.fmod(maxint - 1, maxint), maxint - 1))
checkerror("zero", math.fmod, 3, 0)
do -- testing max/min
checkerror("value expected", math.max)
checkerror("value expected", math.min)
assert(eqT(math.max(3), 3))
assert(eqT(math.max(3, 5, 9, 1), 9))
assert(math.max(maxint, 10e60) == 10e60)
assert(eqT(math.max(minint, minint + 1), minint + 1))
assert(eqT(math.min(3), 3))
assert(eqT(math.min(3, 5, 9, 1), 1))
assert(math.min(3.2, 5.9, -9.2, 1.1) == -9.2)
assert(math.min(1.9, 1.7, 1.72) == 1.7)
assert(math.min(-10e60, minint) == -10e60)
assert(eqT(math.min(maxint, maxint - 1), maxint - 1))
assert(eqT(math.min(maxint - 2, maxint, maxint - 1), maxint - 2))
end
-- testing implicit conversions
local a,b = '10', '20'
assert(a*b == 200 and a+b == 30 and a-b == -10 and a/b == 0.5 and -b == -20)
assert(a == '10' and b == '20')
do
print("testing -0 and NaN")
local mz <const> = -0.0
local z <const> = 0.0
assert(mz == z)
assert(1/mz < 0 and 0 < 1/z)
local a = {[mz] = 1}
assert(a[z] == 1 and a[mz] == 1)
a[z] = 2
assert(a[z] == 2 and a[mz] == 2)
local inf = math.huge * 2 + 1
local mz <const> = -1/inf
local z <const> = 1/inf
assert(mz == z)
assert(1/mz < 0 and 0 < 1/z)
local NaN <const> = inf - inf
assert(NaN ~= NaN)
assert(not (NaN < NaN))
assert(not (NaN <= NaN))
assert(not (NaN > NaN))
assert(not (NaN >= NaN))
assert(not (0 < NaN) and not (NaN < 0))
local NaN1 <const> = 0/0
assert(NaN ~= NaN1 and not (NaN <= NaN1) and not (NaN1 <= NaN))
local a = {}
assert(not pcall(rawset, a, NaN, 1))
assert(a[NaN] == undef)
a[1] = 1
assert(not pcall(rawset, a, NaN, 1))
assert(a[NaN] == undef)
-- strings with same binary representation as 0.0 (might create problems
-- for constant manipulation in the pre-compiler)
local a1, a2, a3, a4, a5 = 0, 0, "\0\0\0\0\0\0\0\0", 0, "\0\0\0\0\0\0\0\0"
assert(a1 == a2 and a2 == a4 and a1 ~= a3)
assert(a3 == a5)
end
print("testing 'math.random'")
local random, max, min = math.random, math.max, math.min
local function testnear (val, ref, tol)
return (math.abs(val - ref) < ref * tol)
end
-- low-level!! For the current implementation of random in Lua,
-- the first call after seed 1007 should return 0x7a7040a5a323c9d6
do
-- all computations should work with 32-bit integers
local h <const> = 0x7a7040a5 -- higher half
local l <const> = 0xa323c9d6 -- lower half
math.randomseed(1007)
-- get the low 'intbits' of the 64-bit expected result
local res = (h << 32 | l) & ~(~0 << intbits)
assert(random(0) == res)
math.randomseed(1007, 0)
-- using higher bits to generate random floats; (the '% 2^32' converts
-- 32-bit integers to floats as unsigned)
local res
if floatbits <= 32 then
-- get all bits from the higher half
res = (h >> (32 - floatbits)) % 2^32
else
-- get 32 bits from the higher half and the rest from the lower half
res = (h % 2^32) * 2^(floatbits - 32) + ((l >> (64 - floatbits)) % 2^32)
end
local rand = random()
assert(eq(rand, 0x0.7a7040a5a323c9d6, 2^-floatbits))
assert(rand * 2^floatbits == res)
end
do
-- testing return of 'randomseed'
local x, y = math.randomseed()
local res = math.random(0)
x, y = math.randomseed(x, y) -- should repeat the state
assert(math.random(0) == res)
math.randomseed(x, y) -- again should repeat the state
assert(math.random(0) == res)
-- keep the random seed for following tests
end
do -- test random for floats
local randbits = math.min(floatbits, 64) -- at most 64 random bits
local mult = 2^randbits -- to make random float into an integral
local counts = {} -- counts for bits
for i = 1, randbits do counts[i] = 0 end
local up = -math.huge
local low = math.huge
local rounds = 100 * randbits -- 100 times for each bit
local totalrounds = 0
::doagain:: -- will repeat test until we get good statistics
for i = 0, rounds do
local t = random()
assert(0 <= t and t < 1)
up = max(up, t)
low = min(low, t)
assert(t * mult % 1 == 0) -- no extra bits
local bit = i % randbits -- bit to be tested
if (t * 2^bit) % 1 >= 0.5 then -- is bit set?
counts[bit + 1] = counts[bit + 1] + 1 -- increment its count
end
end
totalrounds = totalrounds + rounds
if not (eq(up, 1, 0.001) and eq(low, 0, 0.001)) then
goto doagain
end
-- all bit counts should be near 50%
local expected = (totalrounds / randbits / 2)
for i = 1, randbits do
if not testnear(counts[i], expected, 0.10) then
goto doagain
end
end
print(string.format("float random range in %d calls: [%f, %f]",
totalrounds, low, up))
end
do -- test random for full integers
local up = 0
local low = 0
local counts = {} -- counts for bits
for i = 1, intbits do counts[i] = 0 end
local rounds = 100 * intbits -- 100 times for each bit
local totalrounds = 0
::doagain:: -- will repeat test until we get good statistics
for i = 0, rounds do
local t = random(0)
up = max(up, t)
low = min(low, t)
local bit = i % intbits -- bit to be tested
-- increment its count if it is set
counts[bit + 1] = counts[bit + 1] + ((t >> bit) & 1)
end
totalrounds = totalrounds + rounds
local lim = maxint >> 10
if not (maxint - up < lim and low - minint < lim) then
goto doagain
end
-- all bit counts should be near 50%
local expected = (totalrounds / intbits / 2)
for i = 1, intbits do
if not testnear(counts[i], expected, 0.10) then
goto doagain
end
end
print(string.format(
"integer random range in %d calls: [minint + %.0fppm, maxint - %.0fppm]",
totalrounds, (minint - low) / minint * 1e6,
(maxint - up) / maxint * 1e6))
end
do
-- test distribution for a dice
local count = {0, 0, 0, 0, 0, 0}
local rep = 200
local totalrep = 0
::doagain::
for i = 1, rep * 6 do
local r = random(6)
count[r] = count[r] + 1
end
totalrep = totalrep + rep
for i = 1, 6 do
if not testnear(count[i], totalrep, 0.05) then
goto doagain
end
end
end
do
local function aux (x1, x2) -- test random for small intervals
local mark = {}; local count = 0 -- to check that all values appeared
while true do
local t = random(x1, x2)
assert(x1 <= t and t <= x2)
if not mark[t] then -- new value
mark[t] = true
count = count + 1
if count == x2 - x1 + 1 then -- all values appeared; OK
goto ok
end
end
end
::ok::
end
aux(-10,0)
aux(1, 6)
aux(1, 2)
aux(1, 13)
aux(1, 31)
aux(1, 32)
aux(1, 33)
aux(-10, 10)
aux(-10,-10) -- unit set
aux(minint, minint) -- unit set
aux(maxint, maxint) -- unit set
aux(minint, minint + 9)
aux(maxint - 3, maxint)
end
do
local function aux(p1, p2) -- test random for large intervals
local max = minint
local min = maxint
local n = 100
local mark = {}; local count = 0 -- to count how many different values
::doagain::
for _ = 1, n do
local t = random(p1, p2)
if not mark[t] then -- new value
assert(p1 <= t and t <= p2)
max = math.max(max, t)
min = math.min(min, t)
mark[t] = true
count = count + 1
end
end
-- at least 80% of values are different
if not (count >= n * 0.8) then
goto doagain
end
-- min and max not too far from formal min and max
local diff = (p2 - p1) >> 4
if not (min < p1 + diff and max > p2 - diff) then
goto doagain
end
end
aux(0, maxint)
aux(1, maxint)
aux(3, maxint // 3)
aux(minint, -1)
aux(minint // 2, maxint // 2)
aux(minint, maxint)
aux(minint + 1, maxint)
aux(minint, maxint - 1)
aux(0, 1 << (intbits - 5))
end
assert(not pcall(random, 1, 2, 3)) -- too many arguments
-- empty interval
assert(not pcall(random, minint + 1, minint))
assert(not pcall(random, maxint, maxint - 1))
assert(not pcall(random, maxint, minint))
print('OK')
| 29,609 | 1,024 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/constructs.lua | -- $Id: test/constructs.lua $
-- See Copyright Notice in file all.lua
;;print "testing syntax";;
local debug = require "debug"
local function checkload (s, msg)
assert(string.find(select(2, load(s)), msg))
end
-- testing semicollons
do ;;; end
; do ; a = 3; assert(a == 3) end;
;
-- invalid operations should not raise errors when not executed
if false then a = 3 // 0; a = 0 % 0 end
-- testing priorities
assert(2^3^2 == 2^(3^2));
assert(2^3*4 == (2^3)*4);
assert(2.0^-2 == 1/4 and -2^- -2 == - - -4);
assert(not nil and 2 and not(2>3 or 3<2));
assert(-3-1-5 == 0+0-9);
assert(-2^2 == -4 and (-2)^2 == 4 and 2*2-3-1 == 0);
assert(-3%5 == 2 and -3+5 == 2)
assert(2*1+3/3 == 3 and 1+2 .. 3*1 == "33");
assert(not(2+1 > 3*1) and "a".."b" > "a");
assert(0xF0 | 0xCC ~ 0xAA & 0xFD == 0xF4)
assert(0xFD & 0xAA ~ 0xCC | 0xF0 == 0xF4)
assert(0xF0 & 0x0F + 1 == 0x10)
assert(3^4//2^3//5 == 2)
assert(-3+4*5//2^3^2//9+4%10/3 == (-3)+(((4*5)//(2^(3^2)))//9)+((4%10)/3))
assert(not ((true or false) and nil))
assert( true or false and nil)
-- old bug
assert((((1 or false) and true) or false) == true)
assert((((nil and true) or false) and true) == false)
local a,b = 1,nil;
assert(-(1 or 2) == -1 and (1 and 2)+(-1.25 or -4) == 0.75);
x = ((b or a)+1 == 2 and (10 or a)+1 == 11); assert(x);
x = (((2<3) or 1) == true and (2<3 and 4) == 4); assert(x);
x,y=1,2;
assert((x>y) and x or y == 2);
x,y=2,1;
assert((x>y) and x or y == 2);
assert(1234567890 == tonumber('1234567890') and 1234567890+1 == 1234567891)
do -- testing operators with diffent kinds of constants
-- operands to consider:
-- * fit in register
-- * constant doesn't fit in register
-- * floats with integral values
local operand = {3, 100, 5.0, -10, -5.0, 10000, -10000}
local operator = {"+", "-", "*", "/", "//", "%", "^",
"&", "|", "^", "<<", ">>",
"==", "~=", "<", ">", "<=", ">=",}
for _, op in ipairs(operator) do
local f = assert(load(string.format([[return function (x,y)
return x %s y
end]], op)))();
for _, o1 in ipairs(operand) do
for _, o2 in ipairs(operand) do
local gab = f(o1, o2)
_ENV.XX = o1
code = string.format("return XX %s %s", op, o2)
res = assert(load(code))()
assert(res == gab)
_ENV.XX = o2
local code = string.format("return (%s) %s XX", o1, op)
local res = assert(load(code))()
assert(res == gab)
code = string.format("return (%s) %s %s", o1, op, o2)
res = assert(load(code))()
assert(res == gab)
end
end
end
end
-- silly loops
repeat until 1; repeat until true;
while false do end; while nil do end;
do -- test old bug (first name could not be an `upvalue')
local a; function f(x) x={a=1}; x={x=1}; x={G=1} end
end
function f (i)
if type(i) ~= 'number' then return i,'jojo'; end;
if i > 0 then return i, f(i-1); end;
end
x = {f(3), f(5), f(10);};
assert(x[1] == 3 and x[2] == 5 and x[3] == 10 and x[4] == 9 and x[12] == 1);
assert(x[nil] == nil)
x = {f'alo', f'xixi', nil};
assert(x[1] == 'alo' and x[2] == 'xixi' and x[3] == nil);
x = {f'alo'..'xixi'};
assert(x[1] == 'aloxixi')
x = {f{}}
assert(x[2] == 'jojo' and type(x[1]) == 'table')
local f = function (i)
if i < 10 then return 'a';
elseif i < 20 then return 'b';
elseif i < 30 then return 'c';
end;
end
assert(f(3) == 'a' and f(12) == 'b' and f(26) == 'c' and f(100) == nil)
for i=1,1000 do break; end;
n=100;
i=3;
t = {};
a=nil
while not a do
a=0; for i=1,n do for i=i,1,-1 do a=a+1; t[i]=1; end; end;
end
assert(a == n*(n+1)/2 and i==3);
assert(t[1] and t[n] and not t[0] and not t[n+1])
function f(b)
local x = 1;
repeat
local a;
if b==1 then local b=1; x=10; break
elseif b==2 then x=20; break;
elseif b==3 then x=30;
else local a,b,c,d=math.sin(1); x=x+1;
end
until x>=12;
return x;
end;
assert(f(1) == 10 and f(2) == 20 and f(3) == 30 and f(4)==12)
local f = function (i)
if i < 10 then return 'a'
elseif i < 20 then return 'b'
elseif i < 30 then return 'c'
else return 8
end
end
assert(f(3) == 'a' and f(12) == 'b' and f(26) == 'c' and f(100) == 8)
local a, b = nil, 23
x = {f(100)*2+3 or a, a or b+2}
assert(x[1] == 19 and x[2] == 25)
x = {f=2+3 or a, a = b+2}
assert(x.f == 5 and x.a == 25)
a={y=1}
x = {a.y}
assert(x[1] == 1)
function f(i)
while 1 do
if i>0 then i=i-1;
else return; end;
end;
end;
function g(i)
while 1 do
if i>0 then i=i-1
else return end
end
end
f(10); g(10);
do
function f () return 1,2,3; end
local a, b, c = f();
assert(a==1 and b==2 and c==3)
a, b, c = (f());
assert(a==1 and b==nil and c==nil)
end
local a,b = 3 and f();
assert(a==1 and b==nil)
function g() f(); return; end;
assert(g() == nil)
function g() return nil or f() end
a,b = g()
assert(a==1 and b==nil)
print'+';
do -- testing constants
local prog <const> = [[local x <XXX> = 10]]
checkload(prog, "unknown attribute 'XXX'")
checkload([[local xxx <const> = 20; xxx = 10]],
":1: attempt to assign to const variable 'xxx'")
checkload([[
local xx;
local xxx <const> = 20;
local yyy;
local function foo ()
local abc = xx + yyy + xxx;
return function () return function () xxx = yyy end end
end
]], ":6: attempt to assign to const variable 'xxx'")
checkload([[
local x <close> = nil
x = io.open()
]], ":2: attempt to assign to const variable 'x'")
end
f = [[
return function ( a , b , c , d , e )
local x = a >= b or c or ( d and e ) or nil
return x
end , { a = 1 , b = 2 >= 1 , } or { 1 };
]]
f = string.gsub(f, "%s+", "\n"); -- force a SETLINE between opcodes
f,a = load(f)();
assert(a.a == 1 and a.b)
function g (a,b,c,d,e)
if not (a>=b or c or d and e or nil) then return 0; else return 1; end;
end
function h (a,b,c,d,e)
while (a>=b or c or (d and e) or nil) do return 1; end;
return 0;
end;
assert(f(2,1) == true and g(2,1) == 1 and h(2,1) == 1)
assert(f(1,2,'a') == 'a' and g(1,2,'a') == 1 and h(1,2,'a') == 1)
assert(f(1,2,'a')
~= -- force SETLINE before nil
nil, "")
assert(f(1,2,'a') == 'a' and g(1,2,'a') == 1 and h(1,2,'a') == 1)
assert(f(1,2,nil,1,'x') == 'x' and g(1,2,nil,1,'x') == 1 and
h(1,2,nil,1,'x') == 1)
assert(f(1,2,nil,nil,'x') == nil and g(1,2,nil,nil,'x') == 0 and
h(1,2,nil,nil,'x') == 0)
assert(f(1,2,nil,1,nil) == nil and g(1,2,nil,1,nil) == 0 and
h(1,2,nil,1,nil) == 0)
assert(1 and 2<3 == true and 2<3 and 'a'<'b' == true)
x = 2<3 and not 3; assert(x==false)
x = 2<1 or (2>1 and 'a'); assert(x=='a')
do
local a; if nil then a=1; else a=2; end; -- this nil comes as PUSHNIL 2
assert(a==2)
end
function F(a)
assert(debug.getinfo(1, "n").name == 'F')
return a,2,3
end
a,b = F(1)~=nil; assert(a == true and b == nil);
a,b = F(nil)==nil; assert(a == true and b == nil)
----------------------------------------------------------------
------------------------------------------------------------------
-- sometimes will be 0, sometimes will not...
_ENV.GLOB1 = math.random(0, 1)
-- basic expressions with their respective values
local basiccases = {
{"nil", nil},
{"false", false},
{"true", true},
{"10", 10},
{"(0==_ENV.GLOB1)", 0 == _ENV.GLOB1},
}
local prog
if _ENV.GLOB1 == 0 then
basiccases[2][1] = "F" -- constant false
prog = [[
local F <const> = false
if %s then IX = true end
return %s
]]
else
basiccases[4][1] = "k10" -- constant 10
prog = [[
local k10 <const> = 10
if %s then IX = true end
return %s
]]
end
print('testing short-circuit optimizations (' .. _ENV.GLOB1 .. ')')
-- operators with their respective values
local binops <const> = {
{" and ", function (a,b) if not a then return a else return b end end},
{" or ", function (a,b) if a then return a else return b end end},
}
local cases <const> = {}
-- creates all combinations of '(cases[i] op cases[n-i])' plus
-- 'not(cases[i] op cases[n-i])' (syntax + value)
local function createcases (n)
local res = {}
for i = 1, n - 1 do
for _, v1 in ipairs(cases[i]) do
for _, v2 in ipairs(cases[n - i]) do
for _, op in ipairs(binops) do
local t = {
"(" .. v1[1] .. op[1] .. v2[1] .. ")",
op[2](v1[2], v2[2])
}
res[#res + 1] = t
res[#res + 1] = {"not" .. t[1], not t[2]}
end
end
end
end
return res
end
-- do not do too many combinations for soft tests
local level = _soft and 3 or 4
cases[1] = basiccases
for i = 2, level do cases[i] = createcases(i) end
print("+")
local i = 0
for n = 1, level do
for _, v in pairs(cases[n]) do
local s = v[1]
local p = load(string.format(prog, s, s), "")
IX = false
assert(p() == v[2] and IX == not not v[2])
i = i + 1
if i % 60000 == 0 then print('+') end
end
end
------------------------------------------------------------------
-- testing some syntax errors (chosen through 'gcov')
checkload("for x do", "expected")
checkload("x:call", "expected")
print'OK'
| 9,206 | 378 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/goto.lua | -- $Id: test/goto.lua $
-- See Copyright Notice in file all.lua
collectgarbage()
local function errmsg (code, m)
local st, msg = load(code)
assert(not st and string.find(msg, m))
end
-- cannot see label inside block
errmsg([[ goto l1; do ::l1:: end ]], "label 'l1'")
errmsg([[ do ::l1:: end goto l1; ]], "label 'l1'")
-- repeated label
errmsg([[ ::l1:: ::l1:: ]], "label 'l1'")
errmsg([[ ::l1:: do ::l1:: end]], "label 'l1'")
-- undefined label
errmsg([[ goto l1; local aa ::l1:: ::l2:: print(3) ]], "local 'aa'")
-- jumping over variable definition
errmsg([[
do local bb, cc; goto l1; end
local aa
::l1:: print(3)
]], "local 'aa'")
-- jumping into a block
errmsg([[ do ::l1:: end goto l1 ]], "label 'l1'")
errmsg([[ goto l1 do ::l1:: end ]], "label 'l1'")
-- cannot continue a repeat-until with variables
errmsg([[
repeat
if x then goto cont end
local xuxu = 10
::cont::
until xuxu < x
]], "local 'xuxu'")
-- simple gotos
local x
do
local y = 12
goto l1
::l2:: x = x + 1; goto l3
::l1:: x = y; goto l2
end
::l3:: ::l3_1:: assert(x == 13)
-- long labels
do
local prog = [[
do
local a = 1
goto l%sa; a = a + 1
::l%sa:: a = a + 10
goto l%sb; a = a + 2
::l%sb:: a = a + 20
return a
end
]]
local label = string.rep("0123456789", 40)
prog = string.format(prog, label, label, label, label)
assert(assert(load(prog))() == 31)
end
-- ok to jump over local dec. to end of block
do
goto l1
local a = 23
x = a
::l1::;
end
while true do
goto l4
goto l1 -- ok to jump over local dec. to end of block
goto l1 -- multiple uses of same label
local x = 45
::l1:: ;;;
end
::l4:: assert(x == 13)
if print then
goto l1 -- ok to jump over local dec. to end of block
error("should not be here")
goto l2 -- ok to jump over local dec. to end of block
local x
::l1:: ; ::l2:: ;;
else end
-- to repeat a label in a different function is OK
local function foo ()
local a = {}
goto l3
::l1:: a[#a + 1] = 1; goto l2;
::l2:: a[#a + 1] = 2; goto l5;
::l3::
::l3a:: a[#a + 1] = 3; goto l1;
::l4:: a[#a + 1] = 4; goto l6;
::l5:: a[#a + 1] = 5; goto l4;
::l6:: assert(a[1] == 3 and a[2] == 1 and a[3] == 2 and
a[4] == 5 and a[5] == 4)
if not a[6] then a[6] = true; goto l3a end -- do it twice
end
::l6:: foo()
do -- bug in 5.2 -> 5.3.2
local x
::L1::
local y -- cannot join this SETNIL with previous one
assert(y == nil)
y = true
if x == nil then
x = 1
goto L1
else
x = x + 1
end
assert(x == 2 and y == true)
end
-- bug in 5.3
do
local first = true
local a = false
if true then
goto LBL
::loop::
a = true
::LBL::
if first then
first = false
goto loop
end
end
assert(a)
end
do -- compiling infinite loops
goto escape -- do not run the infinite loops
::a:: goto a
::b:: goto c
::c:: goto b
end
::escape::
--------------------------------------------------------------------------------
-- testing closing of upvalues
local debug = require 'debug'
local function foo ()
local t = {}
do
local i = 1
local a, b, c, d
t[1] = function () return a, b, c, d end
::l1::
local b
do
local c
t[#t + 1] = function () return a, b, c, d end -- t[2], t[4], t[6]
if i > 2 then goto l2 end
do
local d
t[#t + 1] = function () return a, b, c, d end -- t[3], t[5]
i = i + 1
local a
goto l1
end
end
end
::l2:: return t
end
local a = foo()
assert(#a == 6)
-- all functions share same 'a'
for i = 2, 6 do
assert(debug.upvalueid(a[1], 1) == debug.upvalueid(a[i], 1))
end
-- 'b' and 'c' are shared among some of them
for i = 2, 6 do
-- only a[1] uses external 'b'/'b'
assert(debug.upvalueid(a[1], 2) ~= debug.upvalueid(a[i], 2))
assert(debug.upvalueid(a[1], 3) ~= debug.upvalueid(a[i], 3))
end
for i = 3, 5, 2 do
-- inner functions share 'b'/'c' with previous ones
assert(debug.upvalueid(a[i], 2) == debug.upvalueid(a[i - 1], 2))
assert(debug.upvalueid(a[i], 3) == debug.upvalueid(a[i - 1], 3))
-- but not with next ones
assert(debug.upvalueid(a[i], 2) ~= debug.upvalueid(a[i + 1], 2))
assert(debug.upvalueid(a[i], 3) ~= debug.upvalueid(a[i + 1], 3))
end
-- only external 'd' is shared
for i = 2, 6, 2 do
assert(debug.upvalueid(a[1], 4) == debug.upvalueid(a[i], 4))
end
-- internal 'd's are all different
for i = 3, 5, 2 do
for j = 1, 6 do
assert((debug.upvalueid(a[i], 4) == debug.upvalueid(a[j], 4))
== (i == j))
end
end
--------------------------------------------------------------------------------
-- testing if x goto optimizations
local function testG (a)
if a == 1 then
goto l1
error("should never be here!")
elseif a == 2 then goto l2
elseif a == 3 then goto l3
elseif a == 4 then
goto l1 -- go to inside the block
error("should never be here!")
::l1:: a = a + 1 -- must go to 'if' end
else
goto l4
::l4a:: a = a * 2; goto l4b
error("should never be here!")
::l4:: goto l4a
error("should never be here!")
::l4b::
end
do return a end
::l2:: do return "2" end
::l3:: do return "3" end
::l1:: return "1"
end
assert(testG(1) == "1")
assert(testG(2) == "2")
assert(testG(3) == "3")
assert(testG(4) == 5)
assert(testG(5) == 10)
do
-- if x back goto out of scope of upvalue
local X
goto L1
::L2:: goto L3
::L1:: do
local a <close> = setmetatable({}, {__close = function () X = true end})
assert(X == nil)
if a then goto L2 end -- jumping back out of scope of 'a'
end
::L3:: assert(X == true) -- checks that 'a' was correctly closed
end
--------------------------------------------------------------------------------
print'OK'
| 5,754 | 272 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/nextvar.lua | -- $Id: test/nextvar.lua $
-- See Copyright Notice in file all.lua
print('testing tables, next, and for')
local function checkerror (msg, f, ...)
local s, err = pcall(f, ...)
assert(not s and string.find(err, msg))
end
local a = {}
-- make sure table has lots of space in hash part
for i=1,100 do a[i.."+"] = true end
for i=1,100 do a[i.."+"] = undef end
-- fill hash part with numeric indices testing size operator
for i=1,100 do
a[i] = true
assert(#a == i)
end
-- testing ipairs
local x = 0
for k,v in ipairs{10,20,30;x=12} do
x = x + 1
assert(k == x and v == x * 10)
end
for _ in ipairs{x=12, y=24} do assert(nil) end
-- test for 'false' x ipair
x = false
local i = 0
for k,v in ipairs{true,false,true,false} do
i = i + 1
x = not x
assert(x == v)
end
assert(i == 4)
-- iterator function is always the same
assert(type(ipairs{}) == 'function' and ipairs{} == ipairs{})
if not T then
(Message or print)
('\n >>> testC not active: skipping tests for table sizes <<<\n')
else --[
-- testing table sizes
local function mp2 (n) -- minimum power of 2 >= n
local mp = 2^math.ceil(math.log(n, 2))
assert(n == 0 or (mp/2 < n and n <= mp))
return mp
end
local function check (t, na, nh)
local a, h = T.querytab(t)
if a ~= na or h ~= nh then
print(na, nh, a, h)
assert(nil)
end
end
-- testing C library sizes
do
local s = 0
for _ in pairs(math) do s = s + 1 end
check(math, 0, mp2(s))
end
-- testing constructor sizes
local sizes = {0, 1, 2, 3, 4, 5, 7, 8, 9, 15, 16, 17,
30, 31, 32, 33, 34, 254, 255, 256, 500, 1000}
for _, sa in ipairs(sizes) do -- 'sa' is size of the array part
local arr = {"return {"}
for i = 1, sa do arr[1 + i] = "1," end -- build array part
for _, sh in ipairs(sizes) do -- 'sh' is size of the hash part
for j = 1, sh do -- build hash part
arr[1 + sa + j] = string.format('k%x=%d,', j, j)
end
arr[1 + sa + sh + 1] = "}"
local prog = table.concat(arr)
local f = assert(load(prog))
collectgarbage("stop")
f() -- call once to ensure stack space
-- make sure table is not resized after being created
if sa == 0 or sh == 0 then
T.alloccount(2); -- header + array or hash part
else
T.alloccount(3); -- header + array part + hash part
end
local t = f()
T.alloccount();
collectgarbage("restart")
assert(#t == sa)
check(t, sa, mp2(sh))
end
end
-- tests with unknown number of elements
local a = {}
for i=1,sizes[#sizes] do a[i] = i end -- build auxiliary table
for k in ipairs(sizes) do
local t = {table.unpack(a,1,k)}
assert(#t == k)
check(t, k, 0)
t = {1,2,3,table.unpack(a,1,k)}
check(t, k+3, 0)
assert(#t == k + 3)
end
-- testing tables dynamically built
local lim = 130
local a = {}; a[2] = 1; check(a, 0, 1)
a = {}; a[0] = 1; check(a, 0, 1); a[2] = 1; check(a, 0, 2)
a = {}; a[0] = 1; a[1] = 1; check(a, 1, 1)
a = {}
for i = 1,lim do
a[i] = 1
assert(#a == i)
check(a, mp2(i), 0)
end
a = {}
for i = 1,lim do
a['a'..i] = 1
assert(#a == 0)
check(a, 0, mp2(i))
end
a = {}
for i=1,16 do a[i] = i end
check(a, 16, 0)
do
for i=1,11 do a[i] = undef end
for i=30,50 do a[i] = true; a[i] = undef end -- force a rehash (?)
check(a, 0, 8) -- 5 elements in the table
a[10] = 1
for i=30,50 do a[i] = true; a[i] = undef end -- force a rehash (?)
check(a, 0, 8) -- only 6 elements in the table
for i=1,14 do a[i] = true; a[i] = undef end
for i=18,50 do a[i] = true; a[i] = undef end -- force a rehash (?)
check(a, 0, 4) -- only 2 elements ([15] and [16])
end
-- reverse filling
for i=1,lim do
local a = {}
for i=i,1,-1 do a[i] = i end -- fill in reverse
check(a, mp2(i), 0)
end
-- size tests for vararg
lim = 35
function foo (n, ...)
local arg = {...}
check(arg, n, 0)
assert(select('#', ...) == n)
arg[n+1] = true
check(arg, mp2(n+1), 0)
arg.x = true
check(arg, mp2(n+1), 1)
end
local a = {}
for i=1,lim do a[i] = true; foo(i, table.unpack(a)) end
-- Table length with limit smaller than maximum value at array
local a = {}
for i = 1,64 do a[i] = true end -- make its array size 64
for i = 1,64 do a[i] = nil end -- erase all elements
assert(T.querytab(a) == 64) -- array part has 64 elements
a[32] = true; a[48] = true; -- binary search will find these ones
a[51] = true -- binary search will miss this one
assert(#a == 48) -- this will set the limit
assert(select(4, T.querytab(a)) == 48) -- this is the limit now
a[50] = true -- this will set a new limit
assert(select(4, T.querytab(a)) == 50) -- this is the limit now
-- but the size is larger (and still inside the array part)
assert(#a == 51)
end --]
-- test size operation on tables with nils
assert(#{} == 0)
assert(#{nil} == 0)
assert(#{nil, nil} == 0)
assert(#{nil, nil, nil} == 0)
assert(#{nil, nil, nil, nil} == 0)
assert(#{1, 2, 3, nil, nil} == 3)
print'+'
local nofind = {}
a,b,c = 1,2,3
a,b,c = nil
-- next uses always the same iteraction function
assert(next{} == next{})
local function find (name)
local n,v
while 1 do
n,v = next(_G, n)
if not n then return nofind end
assert(_G[n] ~= undef)
if n == name then return v end
end
end
local function find1 (name)
for n,v in pairs(_G) do
if n==name then return v end
end
return nil -- not found
end
assert(print==find("print") and print == find1("print"))
assert(_G["print"]==find("print"))
assert(assert==find1("assert"))
assert(nofind==find("return"))
assert(not find1("return"))
_G["ret" .. "urn"] = undef
assert(nofind==find("return"))
_G["xxx"] = 1
assert(xxx==find("xxx"))
-- invalid key to 'next'
checkerror("invalid key", next, {10,20}, 3)
-- both 'pairs' and 'ipairs' need an argument
checkerror("bad argument", pairs)
checkerror("bad argument", ipairs)
print('+')
a = {}
for i=0,10000 do
if math.fmod(i,10) ~= 0 then
a['x'..i] = i
end
end
n = {n=0}
for i,v in pairs(a) do
n.n = n.n+1
assert(i and v and a[i] == v)
end
assert(n.n == 9000)
a = nil
do -- clear global table
local a = {}
for n,v in pairs(_G) do a[n]=v end
for n,v in pairs(a) do
if not package.loaded[n] and type(v) ~= "function" and
not string.find(n, "^[%u_]") then
_G[n] = undef
end
collectgarbage()
end
end
--
local function checknext (a)
local b = {}
do local k,v = next(a); while k do b[k] = v; k,v = next(a,k) end end
for k,v in pairs(b) do assert(a[k] == v) end
for k,v in pairs(a) do assert(b[k] == v) end
end
checknext{1,x=1,y=2,z=3}
checknext{1,2,x=1,y=2,z=3}
checknext{1,2,3,x=1,y=2,z=3}
checknext{1,2,3,4,x=1,y=2,z=3}
checknext{1,2,3,4,5,x=1,y=2,z=3}
assert(#{} == 0)
assert(#{[-1] = 2} == 0)
for i=0,40 do
local a = {}
for j=1,i do a[j]=j end
assert(#a == i)
end
-- 'maxn' is now deprecated, but it is easily defined in Lua
function table.maxn (t)
local max = 0
for k in pairs(t) do
max = (type(k) == 'number') and math.max(max, k) or max
end
return max
end
assert(table.maxn{} == 0)
assert(table.maxn{["1000"] = true} == 0)
assert(table.maxn{["1000"] = true, [24.5] = 3} == 24.5)
assert(table.maxn{[1000] = true} == 1000)
assert(table.maxn{[10] = true, [100*math.pi] = print} == 100*math.pi)
table.maxn = nil
-- int overflow
a = {}
for i=0,50 do a[2^i] = true end
assert(a[#a])
print('+')
do -- testing 'next' with all kinds of keys
local a = {
[1] = 1, -- integer
[1.1] = 2, -- float
['x'] = 3, -- short string
[string.rep('x', 1000)] = 4, -- long string
[print] = 5, -- C function
[checkerror] = 6, -- Lua function
[coroutine.running()] = 7, -- thread
[true] = 8, -- boolean
[io.stdin] = 9, -- userdata
[{}] = 10, -- table
}
local b = {}; for i = 1, 10 do b[i] = true end
for k, v in pairs(a) do
assert(b[v]); b[v] = undef
end
assert(next(b) == nil) -- 'b' now is empty
end
-- erasing values
local t = {[{1}] = 1, [{2}] = 2, [string.rep("x ", 4)] = 3,
[100.3] = 4, [4] = 5}
local n = 0
for k, v in pairs( t ) do
n = n+1
assert(t[k] == v)
t[k] = undef
collectgarbage()
assert(t[k] == undef)
end
assert(n == 5)
do
print("testing next x GC of deleted keys")
-- bug in 5.4.1
local co = coroutine.wrap(function (t)
for k, v in pairs(t) do
local k1 = next(t) -- all previous keys were deleted
assert(k == k1) -- current key is the first in the table
t[k] = nil
local expected = (type(k) == "table" and k[1] or
type(k) == "function" and k() or
string.sub(k, 1, 1))
assert(expected == v)
coroutine.yield(v)
end
end)
local t = {}
t[{1}] = 1 -- add several unanchored, collectable keys
t[{2}] = 2
t[string.rep("a", 50)] = "a" -- long string
t[string.rep("b", 50)] = "b"
t[{3}] = 3
t[string.rep("c", 10)] = "c" -- short string
t[function () return 10 end] = 10
local count = 7
while co(t) do
collectgarbage("collect") -- collect dead keys
count = count - 1
end
assert(count == 0 and next(t) == nil) -- traversed the whole table
end
local function test (a)
assert(not pcall(table.insert, a, 2, 20));
table.insert(a, 10); table.insert(a, 2, 20);
table.insert(a, 1, -1); table.insert(a, 40);
table.insert(a, #a+1, 50)
table.insert(a, 2, -2)
assert(a[2] ~= undef)
assert(a["2"] == undef)
assert(not pcall(table.insert, a, 0, 20));
assert(not pcall(table.insert, a, #a + 2, 20));
assert(table.remove(a,1) == -1)
assert(table.remove(a,1) == -2)
assert(table.remove(a,1) == 10)
assert(table.remove(a,1) == 20)
assert(table.remove(a,1) == 40)
assert(table.remove(a,1) == 50)
assert(table.remove(a,1) == nil)
assert(table.remove(a) == nil)
assert(table.remove(a, #a) == nil)
end
a = {n=0, [-7] = "ban"}
test(a)
assert(a.n == 0 and a[-7] == "ban")
a = {[-7] = "ban"};
test(a)
assert(a.n == nil and #a == 0 and a[-7] == "ban")
a = {[-1] = "ban"}
test(a)
assert(#a == 0 and table.remove(a) == nil and a[-1] == "ban")
a = {[0] = "ban"}
assert(#a == 0 and table.remove(a) == "ban" and a[0] == undef)
table.insert(a, 1, 10); table.insert(a, 1, 20); table.insert(a, 1, -1)
assert(table.remove(a) == 10)
assert(table.remove(a) == 20)
assert(table.remove(a) == -1)
assert(table.remove(a) == nil)
a = {'c', 'd'}
table.insert(a, 3, 'a')
table.insert(a, 'b')
assert(table.remove(a, 1) == 'c')
assert(table.remove(a, 1) == 'd')
assert(table.remove(a, 1) == 'a')
assert(table.remove(a, 1) == 'b')
assert(table.remove(a, 1) == nil)
assert(#a == 0 and a.n == nil)
a = {10,20,30,40}
assert(table.remove(a, #a + 1) == nil)
assert(not pcall(table.remove, a, 0))
assert(a[#a] == 40)
assert(table.remove(a, #a) == 40)
assert(a[#a] == 30)
assert(table.remove(a, 2) == 20)
assert(a[#a] == 30 and #a == 2)
do -- testing table library with metamethods
local function test (proxy, t)
for i = 1, 10 do
table.insert(proxy, 1, i)
end
assert(#proxy == 10 and #t == 10 and proxy[1] ~= undef)
for i = 1, 10 do
assert(t[i] == 11 - i)
end
table.sort(proxy)
for i = 1, 10 do
assert(t[i] == i and proxy[i] == i)
end
assert(table.concat(proxy, ",") == "1,2,3,4,5,6,7,8,9,10")
for i = 1, 8 do
assert(table.remove(proxy, 1) == i)
end
assert(#proxy == 2 and #t == 2)
local a, b, c = table.unpack(proxy)
assert(a == 9 and b == 10 and c == nil)
end
-- all virtual
local t = {}
local proxy = setmetatable({}, {
__len = function () return #t end,
__index = t,
__newindex = t,
})
test(proxy, t)
-- only __newindex
local count = 0
t = setmetatable({}, {
__newindex = function (t,k,v) count = count + 1; rawset(t,k,v) end})
test(t, t)
assert(count == 10) -- after first 10, all other sets are not new
-- no __newindex
t = setmetatable({}, {
__index = function (_,k) return k + 1 end,
__len = function (_) return 5 end})
assert(table.concat(t, ";") == "2;3;4;5;6")
end
if not T then
(Message or print)
('\n >>> testC not active: skipping tests for table library on non-tables <<<\n')
else --[
local debug = require'debug'
local tab = {10, 20, 30}
local mt = {}
local u = T.newuserdata(0)
checkerror("table expected", table.insert, u, 40)
checkerror("table expected", table.remove, u)
debug.setmetatable(u, mt)
checkerror("table expected", table.insert, u, 40)
checkerror("table expected", table.remove, u)
mt.__index = tab
checkerror("table expected", table.insert, u, 40)
checkerror("table expected", table.remove, u)
mt.__newindex = tab
checkerror("table expected", table.insert, u, 40)
checkerror("table expected", table.remove, u)
mt.__len = function () return #tab end
table.insert(u, 40)
assert(#u == 4 and #tab == 4 and u[4] == 40 and tab[4] == 40)
assert(table.remove(u) == 40)
table.insert(u, 1, 50)
assert(#u == 4 and #tab == 4 and u[4] == 30 and tab[1] == 50)
mt.__newindex = nil
mt.__len = nil
local tab2 = {}
local u2 = T.newuserdata(0)
debug.setmetatable(u2, {__newindex = function (_, k, v) tab2[k] = v end})
table.move(u, 1, 4, 1, u2)
assert(#tab2 == 4 and tab2[1] == tab[1] and tab2[4] == tab[4])
end -- ]
print('+')
a = {}
for i=1,1000 do
a[i] = i; a[i - 1] = undef
end
assert(next(a,nil) == 1000 and next(a,1000) == nil)
assert(next({}) == nil)
assert(next({}, nil) == nil)
for a,b in pairs{} do error"not here" end
for i=1,0 do error'not here' end
for i=0,1,-1 do error'not here' end
a = nil; for i=1,1 do assert(not a); a=1 end; assert(a)
a = nil; for i=1,1,-1 do assert(not a); a=1 end; assert(a)
do
print("testing floats in numeric for")
local a
-- integer count
a = 0; for i=1, 1, 1 do a=a+1 end; assert(a==1)
a = 0; for i=10000, 1e4, -1 do a=a+1 end; assert(a==1)
a = 0; for i=1, 0.99999, 1 do a=a+1 end; assert(a==0)
a = 0; for i=9999, 1e4, -1 do a=a+1 end; assert(a==0)
a = 0; for i=1, 0.99999, -1 do a=a+1 end; assert(a==1)
-- float count
a = 0; for i=0, 0.999999999, 0.1 do a=a+1 end; assert(a==10)
a = 0; for i=1.0, 1, 1 do a=a+1 end; assert(a==1)
a = 0; for i=-1.5, -1.5, 1 do a=a+1 end; assert(a==1)
a = 0; for i=1e6, 1e6, -1 do a=a+1 end; assert(a==1)
a = 0; for i=1.0, 0.99999, 1 do a=a+1 end; assert(a==0)
a = 0; for i=99999, 1e5, -1.0 do a=a+1 end; assert(a==0)
a = 0; for i=1.0, 0.99999, -1 do a=a+1 end; assert(a==1)
end
do -- changing the control variable
local a
a = 0; for i = 1, 10 do a = a + 1; i = "x" end; assert(a == 10)
a = 0; for i = 10.0, 1, -1 do a = a + 1; i = "x" end; assert(a == 10)
end
-- conversion
a = 0; for i="10","1","-2" do a=a+1 end; assert(a==5)
do -- checking types
local c
local function checkfloat (i)
assert(math.type(i) == "float")
c = c + 1
end
c = 0; for i = 1.0, 10 do checkfloat(i) end
assert(c == 10)
c = 0; for i = -1, -10, -1.0 do checkfloat(i) end
assert(c == 10)
local function checkint (i)
assert(math.type(i) == "integer")
c = c + 1
end
local m = math.maxinteger
c = 0; for i = m, m - 10, -1 do checkint(i) end
assert(c == 11)
c = 0; for i = 1, 10.9 do checkint(i) end
assert(c == 10)
c = 0; for i = 10, 0.001, -1 do checkint(i) end
assert(c == 10)
c = 0; for i = 1, "10.8" do checkint(i) end
assert(c == 10)
c = 0; for i = 9, "3.4", -1 do checkint(i) end
assert(c == 6)
c = 0; for i = 0, " -3.4 ", -1 do checkint(i) end
assert(c == 4)
c = 0; for i = 100, "96.3", -2 do checkint(i) end
assert(c == 2)
c = 0; for i = 1, math.huge do if i > 10 then break end; checkint(i) end
assert(c == 10)
c = 0; for i = -1, -math.huge, -1 do
if i < -10 then break end; checkint(i)
end
assert(c == 10)
for i = math.mininteger, -10e100 do assert(false) end
for i = math.maxinteger, 10e100, -1 do assert(false) end
end
do -- testing other strange cases for numeric 'for'
local function checkfor (from, to, step, t)
local c = 0
for i = from, to, step do
c = c + 1
assert(i == t[c])
end
assert(c == #t)
end
local maxi = math.maxinteger
local mini = math.mininteger
checkfor(mini, maxi, maxi, {mini, -1, maxi - 1})
checkfor(mini, math.huge, maxi, {mini, -1, maxi - 1})
checkfor(maxi, mini, mini, {maxi, -1})
checkfor(maxi, mini, -maxi, {maxi, 0, -maxi})
checkfor(maxi, -math.huge, mini, {maxi, -1})
checkfor(maxi, mini, 1, {})
checkfor(mini, maxi, -1, {})
checkfor(maxi - 6, maxi, 3, {maxi - 6, maxi - 3, maxi})
checkfor(mini + 4, mini, -2, {mini + 4, mini + 2, mini})
local step = maxi // 10
local c = mini
for i = mini, maxi, step do
assert(i == c)
c = c + step
end
c = maxi
for i = maxi, mini, -step do
assert(i == c)
c = c - step
end
checkfor(maxi, maxi, maxi, {maxi})
checkfor(maxi, maxi, mini, {maxi})
checkfor(mini, mini, maxi, {mini})
checkfor(mini, mini, mini, {mini})
end
checkerror("'for' step is zero", function ()
for i = 1, 10, 0 do end
end)
checkerror("'for' step is zero", function ()
for i = 1, -10, 0 do end
end)
checkerror("'for' step is zero", function ()
for i = 1.0, -10, 0.0 do end
end)
collectgarbage()
-- testing generic 'for'
local function f (n, p)
local t = {}; for i=1,p do t[i] = i*10 end
return function (_, n, ...)
assert(select("#", ...) == 0) -- no extra arguments
if n > 0 then
n = n-1
return n, table.unpack(t)
end
end, nil, n
end
local x = 0
for n,a,b,c,d in f(5,3) do
x = x+1
assert(a == 10 and b == 20 and c == 30 and d == nil)
end
assert(x == 5)
-- testing __pairs and __ipairs metamethod
a = {}
do
local x,y,z = pairs(a)
assert(type(x) == 'function' and y == a and z == nil)
end
local function foo (e,i)
assert(e == a)
if i <= 10 then return i+1, i+2 end
end
local function foo1 (e,i)
i = i + 1
assert(e == a)
if i <= e.n then return i,a[i] end
end
setmetatable(a, {__pairs = function (x) return foo, x, 0 end})
local i = 0
for k,v in pairs(a) do
i = i + 1
assert(k == i and v == k+1)
end
a.n = 5
a[3] = 30
-- testing ipairs with metamethods
a = {n=10}
setmetatable(a, { __index = function (t,k)
if k <= t.n then return k * 10 end
end})
i = 0
for k,v in ipairs(a) do
i = i + 1
assert(k == i and v == i * 10)
end
assert(i == a.n)
print"OK"
| 18,556 | 768 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/vararg.lua | -- $Id: test/vararg.lua $
-- See Copyright Notice in file all.lua
print('testing vararg')
function f(a, ...)
local x = {n = select('#', ...), ...}
for i = 1, x.n do assert(a[i] == x[i]) end
return x.n
end
function c12 (...)
assert(arg == _G.arg) -- no local 'arg'
local x = {...}; x.n = #x
local res = (x.n==2 and x[1] == 1 and x[2] == 2)
if res then res = 55 end
return res, 2
end
function vararg (...) return {n = select('#', ...), ...} end
local call = function (f, args) return f(table.unpack(args, 1, args.n)) end
assert(f() == 0)
assert(f({1,2,3}, 1, 2, 3) == 3)
assert(f({"alo", nil, 45, f, nil}, "alo", nil, 45, f, nil) == 5)
assert(vararg().n == 0)
assert(vararg(nil, nil).n == 2)
assert(c12(1,2)==55)
a,b = assert(call(c12, {1,2}))
assert(a == 55 and b == 2)
a = call(c12, {1,2;n=2})
assert(a == 55 and b == 2)
a = call(c12, {1,2;n=1})
assert(not a)
assert(c12(1,2,3) == false)
local a = vararg(call(next, {_G,nil;n=2}))
local b,c = next(_G)
assert(a[1] == b and a[2] == c and a.n == 2)
a = vararg(call(call, {c12, {1,2}}))
assert(a.n == 2 and a[1] == 55 and a[2] == 2)
a = call(print, {'+'})
assert(a == nil)
local t = {1, 10}
function t:f (...) local arg = {...}; return self[...]+#arg end
assert(t:f(1,4) == 3 and t:f(2) == 11)
print('+')
lim = 20
local i, a = 1, {}
while i <= lim do a[i] = i+0.3; i=i+1 end
function f(a, b, c, d, ...)
local more = {...}
assert(a == 1.3 and more[1] == 5.3 and
more[lim-4] == lim+0.3 and not more[lim-3])
end
function g(a,b,c)
assert(a == 1.3 and b == 2.3 and c == 3.3)
end
call(f, a)
call(g, a)
a = {}
i = 1
while i <= lim do a[i] = i; i=i+1 end
assert(call(math.max, a) == lim)
print("+")
-- new-style varargs
function oneless (a, ...) return ... end
function f (n, a, ...)
local b
assert(arg == _G.arg) -- no local 'arg'
if n == 0 then
local b, c, d = ...
return a, b, c, d, oneless(oneless(oneless(...)))
else
n, b, a = n-1, ..., a
assert(b == ...)
return f(n, a, ...)
end
end
a,b,c,d,e = assert(f(10,5,4,3,2,1))
assert(a==5 and b==4 and c==3 and d==2 and e==1)
a,b,c,d,e = f(4)
assert(a==nil and b==nil and c==nil and d==nil and e==nil)
-- varargs for main chunks
f = load[[ return {...} ]]
x = f(2,3)
assert(x[1] == 2 and x[2] == 3 and x[3] == undef)
f = load[[
local x = {...}
for i=1,select('#', ...) do assert(x[i] == select(i, ...)) end
assert(x[select('#', ...)+1] == undef)
return true
]]
assert(f("a", "b", nil, {}, assert))
assert(f())
a = {select(3, table.unpack{10,20,30,40})}
assert(#a == 2 and a[1] == 30 and a[2] == 40)
a = {select(1)}
assert(next(a) == nil)
a = {select(-1, 3, 5, 7)}
assert(a[1] == 7 and a[2] == undef)
a = {select(-2, 3, 5, 7)}
assert(a[1] == 5 and a[2] == 7 and a[3] == undef)
pcall(select, 10000)
pcall(select, -10000)
-- bug in 5.2.2
function f(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
p11, p12, p13, p14, p15, p16, p17, p18, p19, p20,
p21, p22, p23, p24, p25, p26, p27, p28, p29, p30,
p31, p32, p33, p34, p35, p36, p37, p38, p39, p40,
p41, p42, p43, p44, p45, p46, p48, p49, p50, ...)
local a1,a2,a3,a4,a5,a6,a7
local a8,a9,a10,a11,a12,a13,a14
end
-- assertion fail here
f()
-- missing arguments in tail call
do
local function f(a,b,c) return c, b end
local function g() return f(1,2) end
local a, b = g()
assert(a == nil and b == 2)
end
print('OK')
| 3,358 | 152 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/calls.lua | -- $Id: test/calls.lua $
-- See Copyright Notice in file all.lua
print("testing functions and calls")
local debug = require "debug"
-- get the opportunity to test 'type' too ;)
assert(type(1<2) == 'boolean')
assert(type(true) == 'boolean' and type(false) == 'boolean')
assert(type(nil) == 'nil'
and type(-3) == 'number'
and type'x' == 'string'
and type{} == 'table'
and type(type) == 'function')
assert(type(assert) == type(print))
function f (x) return a:x (x) end
assert(type(f) == 'function')
assert(not pcall(type))
-- testing local-function recursion
fact = false
do
local res = 1
local function fact (n)
if n==0 then return res
else return n*fact(n-1)
end
end
assert(fact(5) == 120)
end
assert(fact == false)
-- testing declarations
a = {i = 10}
self = 20
function a:x (x) return x+self.i end
function a.y (x) return x+self end
assert(a:x(1)+10 == a.y(1))
a.t = {i=-100}
a["t"].x = function (self, a,b) return self.i+a+b end
assert(a.t:x(2,3) == -95)
do
local a = {x=0}
function a:add (x) self.x, a.y = self.x+x, 20; return self end
assert(a:add(10):add(20):add(30).x == 60 and a.y == 20)
end
local a = {b={c={}}}
function a.b.c.f1 (x) return x+1 end
function a.b.c:f2 (x,y) self[x] = y end
assert(a.b.c.f1(4) == 5)
a.b.c:f2('k', 12); assert(a.b.c.k == 12)
print('+')
t = nil -- 'declare' t
function f(a,b,c) local d = 'a'; t={a,b,c,d} end
f( -- this line change must be valid
1,2)
assert(t[1] == 1 and t[2] == 2 and t[3] == nil and t[4] == 'a')
f(1,2, -- this one too
3,4)
assert(t[1] == 1 and t[2] == 2 and t[3] == 3 and t[4] == 'a')
function fat(x)
if x <= 1 then return 1
else return x*load("return fat(" .. x-1 .. ")", "")()
end
end
assert(load "load 'assert(fat(6)==720)' () ")()
a = load('return fat(5), 3')
a,b = a()
assert(a == 120 and b == 3)
print('+')
function err_on_n (n)
if n==0 then error(); exit(1);
else err_on_n (n-1); exit(1);
end
end
do
function dummy (n)
if n > 0 then
assert(not pcall(err_on_n, n))
dummy(n-1)
end
end
end
dummy(10)
function deep (n)
if n>0 then deep(n-1) end
end
deep(10)
deep(180)
print"testing tail calls"
function deep (n) if n>0 then return deep(n-1) else return 101 end end
assert(deep(30000) == 101)
a = {}
function a:deep (n) if n>0 then return self:deep(n-1) else return 101 end end
assert(a:deep(30000) == 101)
do -- tail calls x varargs
local function foo (x, ...) local a = {...}; return x, a[1], a[2] end
local function foo1 (x) return foo(10, x, x + 1) end
local a, b, c = foo1(-2)
assert(a == 10 and b == -2 and c == -1)
-- tail calls x metamethods
local t = setmetatable({}, {__call = foo})
local function foo2 (x) return t(10, x) end
a, b, c = foo2(100)
assert(a == t and b == 10 and c == 100)
a, b = (function () return foo() end)()
assert(a == nil and b == nil)
local X, Y, A
local function foo (x, y, ...) X = x; Y = y; A = {...} end
local function foo1 (...) return foo(...) end
local a, b, c = foo1()
assert(X == nil and Y == nil and #A == 0)
a, b, c = foo1(10)
assert(X == 10 and Y == nil and #A == 0)
a, b, c = foo1(10, 20)
assert(X == 10 and Y == 20 and #A == 0)
a, b, c = foo1(10, 20, 30)
assert(X == 10 and Y == 20 and #A == 1 and A[1] == 30)
end
do -- tail calls x chain of __call
local n = 10000 -- depth
local function foo ()
if n == 0 then return 1023
else n = n - 1; return foo()
end
end
-- build a chain of __call metamethods ending in function 'foo'
for i = 1, 100 do
foo = setmetatable({}, {__call = foo})
end
-- call the first one as a tail call in a new coroutine
-- (to ensure stack is not preallocated)
assert(coroutine.wrap(function() return foo() end)() == 1023)
end
print('+')
do -- testing chains of '__call'
local N = 20
local u = table.pack
for i = 1, N do
u = setmetatable({i}, {__call = u})
end
local Res = u("a", "b", "c")
assert(Res.n == N + 3)
for i = 1, N do
assert(Res[i][1] == i)
end
assert(Res[N + 1] == "a" and Res[N + 2] == "b" and Res[N + 3] == "c")
end
a = nil
(function (x) a=x end)(23)
assert(a == 23 and (function (x) return x*2 end)(20) == 40)
-- testing closures
-- fixed-point operator
Z = function (le)
local function a (f)
return le(function (x) return f(f)(x) end)
end
return a(a)
end
-- non-recursive factorial
F = function (f)
return function (n)
if n == 0 then return 1
else return n*f(n-1) end
end
end
fat = Z(F)
assert(fat(0) == 1 and fat(4) == 24 and Z(F)(5)==5*Z(F)(4))
local function g (z)
local function f (a,b,c,d)
return function (x,y) return a+b+c+d+a+x+y+z end
end
return f(z,z+1,z+2,z+3)
end
f = g(10)
assert(f(9, 16) == 10+11+12+13+10+9+16+10)
Z, F, f = nil
print('+')
-- testing multiple returns
function unlpack (t, i)
i = i or 1
if (i <= #t) then
return t[i], unlpack(t, i+1)
end
end
function equaltab (t1, t2)
assert(#t1 == #t2)
for i = 1, #t1 do
assert(t1[i] == t2[i])
end
end
local pack = function (...) return (table.pack(...)) end
function f() return 1,2,30,4 end
function ret2 (a,b) return a,b end
local a,b,c,d = unlpack{1,2,3}
assert(a==1 and b==2 and c==3 and d==nil)
a = {1,2,3,4,false,10,'alo',false,assert}
equaltab(pack(unlpack(a)), a)
equaltab(pack(unlpack(a), -1), {1,-1})
a,b,c,d = ret2(f()), ret2(f())
assert(a==1 and b==1 and c==2 and d==nil)
a,b,c,d = unlpack(pack(ret2(f()), ret2(f())))
assert(a==1 and b==1 and c==2 and d==nil)
a,b,c,d = unlpack(pack(ret2(f()), (ret2(f()))))
assert(a==1 and b==1 and c==nil and d==nil)
a = ret2{ unlpack{1,2,3}, unlpack{3,2,1}, unlpack{"a", "b"}}
assert(a[1] == 1 and a[2] == 3 and a[3] == "a" and a[4] == "b")
-- testing calls with 'incorrect' arguments
rawget({}, "x", 1)
rawset({}, "x", 1, 2)
assert(math.sin(1,2) == math.sin(1))
table.sort({10,9,8,4,19,23,0,0}, function (a,b) return a<b end, "extra arg")
-- test for generic load
local x = "-- a comment\0\0\0\n x = 10 + \n23; \
local a = function () x = 'hi' end; \
return '\0'"
function read1 (x)
local i = 0
return function ()
collectgarbage()
i=i+1
return string.sub(x, i, i)
end
end
function cannotload (msg, a,b)
assert(not a and string.find(b, msg))
end
a = assert(load(read1(x), "modname", "t", _G))
assert(a() == "\0" and _G.x == 33)
assert(debug.getinfo(a).source == "modname")
-- cannot read text in binary mode
cannotload("attempt to load a text chunk", load(read1(x), "modname", "b", {}))
cannotload("attempt to load a text chunk", load(x, "modname", "b"))
a = assert(load(function () return nil end))
a() -- empty chunk
assert(not load(function () return true end))
-- small bug
local t = {nil, "return ", "3"}
f, msg = load(function () return table.remove(t, 1) end)
assert(f() == nil) -- should read the empty chunk
-- another small bug (in 5.2.1)
f = load(string.dump(function () return 1 end), nil, "b", {})
assert(type(f) == "function" and f() == 1)
do -- another bug (in 5.4.0)
-- loading a binary long string interrupted by GC cycles
local f = string.dump(function ()
return '01234567890123456789012345678901234567890123456789'
end)
f = load(read1(f))
assert(f() == '01234567890123456789012345678901234567890123456789')
end
x = string.dump(load("x = 1; return x"))
a = assert(load(read1(x), nil, "b"))
assert(a() == 1 and _G.x == 1)
cannotload("attempt to load a binary chunk", load(read1(x), nil, "t"))
cannotload("attempt to load a binary chunk", load(x, nil, "t"))
assert(not pcall(string.dump, print)) -- no dump of C functions
cannotload("unexpected symbol", load(read1("*a = 123")))
cannotload("unexpected symbol", load("*a = 123"))
cannotload("hhi", load(function () error("hhi") end))
-- any value is valid for _ENV
assert(load("return _ENV", nil, nil, 123)() == 123)
-- load when _ENV is not first upvalue
local x; XX = 123
local function h ()
local y=x -- use 'x', so that it becomes 1st upvalue
return XX -- global name
end
local d = string.dump(h)
x = load(d, "", "b")
assert(debug.getupvalue(x, 2) == '_ENV')
debug.setupvalue(x, 2, _G)
assert(x() == 123)
assert(assert(load("return XX + ...", nil, nil, {XX = 13}))(4) == 17)
-- test generic load with nested functions
x = [[
return function (x)
return function (y)
return function (z)
return x+y+z
end
end
end
]]
a = assert(load(read1(x), "read", "t"))
assert(a()(2)(3)(10) == 15)
-- repeat the test loading a binary chunk
x = string.dump(a)
a = assert(load(read1(x), "read", "b"))
assert(a()(2)(3)(10) == 15)
-- test for dump/undump with upvalues
local a, b = 20, 30
x = load(string.dump(function (x)
if x == "set" then a = 10+b; b = b+1 else
return a
end
end), "", "b", nil)
assert(x() == nil)
assert(debug.setupvalue(x, 1, "hi") == "a")
assert(x() == "hi")
assert(debug.setupvalue(x, 2, 13) == "b")
assert(not debug.setupvalue(x, 3, 10)) -- only 2 upvalues
x("set")
assert(x() == 23)
x("set")
assert(x() == 24)
-- test for dump/undump with many upvalues
do
local nup = 200 -- maximum number of local variables
local prog = {"local a1"}
for i = 2, nup do prog[#prog + 1] = ", a" .. i end
prog[#prog + 1] = " = 1"
for i = 2, nup do prog[#prog + 1] = ", " .. i end
local sum = 1
prog[#prog + 1] = "; return function () return a1"
for i = 2, nup do prog[#prog + 1] = " + a" .. i; sum = sum + i end
prog[#prog + 1] = " end"
prog = table.concat(prog)
local f = assert(load(prog))()
assert(f() == sum)
f = load(string.dump(f)) -- main chunk now has many upvalues
local a = 10
local h = function () return a end
for i = 1, nup do
debug.upvaluejoin(f, i, h, 1)
end
assert(f() == 10 * nup)
end
-- test for long method names
do
local t = {x = 1}
function t:_012345678901234567890123456789012345678901234567890123456789 ()
return self.x
end
assert(t:_012345678901234567890123456789012345678901234567890123456789() == 1)
end
-- test for bug in parameter adjustment
assert((function () return nil end)(4) == nil)
assert((function () local a; return a end)(4) == nil)
assert((function (a) return a end)() == nil)
print("testing binary chunks")
do
local header = string.pack("c4BBc6BBB",
"\27Lua", -- signature
0x54, -- version 5.4 (0x54)
0, -- format
"\x19\x93\r\n\x1a\n", -- data
4, -- size of instruction
string.packsize("j"), -- sizeof(lua integer)
string.packsize("n") -- sizeof(lua number)
)
local c = string.dump(function ()
local a = 1; local b = 3;
local f = function () return a + b + _ENV.c; end -- upvalues
local s1 = "a constant"
local s2 = "another constant"
return a + b * 3
end)
assert(assert(load(c))() == 10)
-- check header
assert(string.sub(c, 1, #header) == header)
-- check LUAC_INT and LUAC_NUM
local ci, cn = string.unpack("jn", c, #header + 1)
assert(ci == 0x5678 and cn == 370.5)
-- corrupted header
for i = 1, #header do
local s = string.sub(c, 1, i - 1) ..
string.char(string.byte(string.sub(c, i, i)) + 1) ..
string.sub(c, i + 1, -1)
assert(#s == #c)
assert(not load(s))
end
-- loading truncated binary chunks
for i = 1, #c - 1 do
local st, msg = load(string.sub(c, 1, i))
assert(not st and string.find(msg, "truncated"))
end
end
print('OK')
return deep
| 11,613 | 482 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/all.lua | #!../lua
-- $Id: test/all.lua $
-- See Copyright Notice at the end of this file
local version = "Lua 5.4"
if _VERSION ~= version then
io.stderr:write("This test suite is for ", version,
", not for ", _VERSION, "\nExiting tests")
return
end
_G.ARG = arg -- save arg for other tests
-- next variables control the execution of some tests
-- true means no test (so an undefined variable does not skip a test)
-- defaults are for Linux; test everything.
-- Make true to avoid long or memory consuming tests
_soft = rawget(_G, "_soft") or false
-- Make true to avoid non-portable tests
_port = rawget(_G, "_port") or false
-- Make true to avoid messages about tests not performed
_nomsg = rawget(_G, "_nomsg") or false
local usertests = rawget(_G, "_U")
if usertests then
-- tests for sissies ;) Avoid problems
_soft = true
_port = true
_nomsg = true
end
-- tests should require debug when needed
debug = nil
if usertests then
T = nil -- no "internal" tests for user tests
else
T = rawget(_G, "T") -- avoid problems with 'strict' module
end
--[=[
example of a long [comment],
[[spanning several [lines]]]
]=]
print("\n\tStarting Tests")
do
-- set random seed
local random_x, random_y = math.randomseed()
print(string.format("random seeds: %d, %d", random_x, random_y))
end
print("current path:\n****" .. package.path .. "****\n")
local initclock = os.clock()
local lastclock = initclock
local walltime = os.time()
local collectgarbage = collectgarbage
do -- (
-- track messages for tests not performed
local msgs = {}
function Message (m)
if not _nomsg then
print(m)
msgs[#msgs+1] = string.sub(m, 3, -3)
end
end
assert(os.setlocale"C")
local T,print,format,write,assert,type,unpack,floor =
T,print,string.format,io.write,assert,type,table.unpack,math.floor
-- use K for 1000 and M for 1000000 (not 2^10 -- 2^20)
local function F (m)
local function round (m)
m = m + 0.04999
return format("%.1f", m) -- keep one decimal digit
end
if m < 1000 then return m
else
m = m / 1000
if m < 1000 then return round(m).."K"
else
return round(m/1000).."M"
end
end
end
local Cstacklevel
local showmem
if not T then
local max = 0
showmem = function ()
local m = collectgarbage("count") * 1024
max = (m > max) and m or max
print(format(" ---- total memory: %s, max memory: %s ----\n",
F(m), F(max)))
end
Cstacklevel = function () return 0 end -- no info about stack level
else
showmem = function ()
T.checkmemory()
local total, numblocks, maxmem = T.totalmem()
local count = collectgarbage("count")
print(format(
"\n ---- total memory: %s (%.0fK), max use: %s, blocks: %d\n",
F(total), count, F(maxmem), numblocks))
print(format("\t(strings: %d, tables: %d, functions: %d, "..
"\n\tudata: %d, threads: %d)",
T.totalmem"string", T.totalmem"table", T.totalmem"function",
T.totalmem"userdata", T.totalmem"thread"))
end
Cstacklevel = function ()
local _, _, ncalls = T.stacklevel()
return ncalls -- number of C calls
end
end
local Cstack = Cstacklevel()
--
-- redefine dofile to run files through dump/undump
--
local function report (n) print("\n***** FILE '"..n.."'*****") end
local olddofile = dofile
local dofile = function (n, strip)
showmem()
local c = os.clock()
print(string.format("time: %g (+%g)", c - initclock, c - lastclock))
lastclock = c
report(n)
local f = assert(loadfile(n))
local b = string.dump(f, strip)
f = assert(load(b))
return f()
end
dofile('main.lua')
-- trace GC cycles
require"tracegc".start()
report"gc.lua"
local f = assert(loadfile('gc.lua'))
f()
dofile('db.lua')
assert(dofile('calls.lua') == deep and deep)
olddofile('strings.lua')
olddofile('literals.lua')
dofile('tpack.lua')
assert(dofile('attrib.lua') == 27)
dofile('gengc.lua')
assert(dofile('locals.lua') == 5)
dofile('constructs.lua')
dofile('code.lua', true)
if not _G._soft then
report('big.lua')
local f = coroutine.wrap(assert(loadfile('big.lua')))
assert(f() == 'b')
assert(f() == 'a')
end
dofile('cstack.lua')
dofile('nextvar.lua')
dofile('pm.lua')
dofile('utf8.lua')
dofile('api.lua')
assert(dofile('events.lua') == 12)
dofile('vararg.lua')
dofile('closure.lua')
dofile('coroutine.lua')
dofile('goto.lua', true)
dofile('errors.lua')
dofile('math.lua')
dofile('sort.lua', true)
dofile('bitwise.lua')
assert(dofile('verybig.lua', true) == 10); collectgarbage()
dofile('files.lua')
if #msgs > 0 then
local m = table.concat(msgs, "\n ")
warn("#tests not performed:\n ", m, "\n")
end
print("(there should be two warnings now)")
warn("@on")
warn("#This is ", "an expected", " warning")
warn("@off")
warn("******** THIS WARNING SHOULD NOT APPEAR **********")
warn("******** THIS WARNING ALSO SHOULD NOT APPEAR **********")
warn("@on")
warn("#This is", " another one")
-- no test module should define 'debug'
assert(debug == nil)
local debug = require "debug"
print(string.format("%d-bit integers, %d-bit floats",
string.packsize("j") * 8, string.packsize("n") * 8))
debug.sethook(function (a) assert(type(a) == 'string') end, "cr")
-- to survive outside block
_G.showmem = showmem
assert(Cstack == Cstacklevel(),
"should be at the same C-stack level it was when started the tests")
end --)
local _G, showmem, print, format, clock, time, difftime,
assert, open, warn =
_G, showmem, print, string.format, os.clock, os.time, os.difftime,
assert, io.open, warn
-- file with time of last performed test
local fname = T and "time-debug.txt" or "/tmp/time.txt"
local lasttime
if not usertests then
-- open file with time of last performed test
local f = io.open(fname)
if f then
lasttime = assert(tonumber(f:read'a'))
f:close();
else -- no such file; assume it is recording time for first time
lasttime = nil
end
end
-- erase (almost) all globals
print('cleaning all!!!!')
for n in pairs(_G) do
if not ({___Glob = 1, tostring = 1})[n] then
_G[n] = undef
end
end
collectgarbage()
collectgarbage()
collectgarbage()
collectgarbage()
collectgarbage()
collectgarbage();showmem()
local clocktime = clock() - initclock
walltime = difftime(time(), walltime)
print(format("\n\ntotal time: %.2fs (wall time: %gs)\n", clocktime, walltime))
if not usertests then
lasttime = lasttime or clocktime -- if no last time, ignore difference
-- check whether current test time differs more than 5% from last time
local diff = (clocktime - lasttime) / lasttime
local tolerance = 0.05 -- 5%
if (diff >= tolerance or diff <= -tolerance) then
warn(format("#time difference from previous test: %+.1f%%",
diff * 100))
end
assert(open(fname, "w")):write(clocktime):close()
end
print("final OK !!!")
--[[
*****************************************************************************
* Copyright (C) 1994-2016 Lua.org, PUC-Rio.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*****************************************************************************
]]
| 8,150 | 312 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/heavy.lua | -- $Id: heavy.lua,v 1.7 2017/12/29 15:42:15 roberto Exp $
-- See Copyright Notice in file all.lua
local function teststring ()
print("creating a string too long")
do
local a = "x"
local st, msg = pcall(function ()
while true do
a = a .. a.. a.. a.. a.. a.. a.. a.. a.. a
.. a .. a.. a.. a.. a.. a.. a.. a.. a.. a
.. a .. a.. a.. a.. a.. a.. a.. a.. a.. a
.. a .. a.. a.. a.. a.. a.. a.. a.. a.. a
.. a .. a.. a.. a.. a.. a.. a.. a.. a.. a
.. a .. a.. a.. a.. a.. a.. a.. a.. a.. a
.. a .. a.. a.. a.. a.. a.. a.. a.. a.. a
.. a .. a.. a.. a.. a.. a.. a.. a.. a.. a
.. a .. a.. a.. a.. a.. a.. a.. a.. a.. a
.. a .. a.. a.. a.. a.. a.. a.. a.. a.. a
print(string.format("string with %d bytes", #a))
end
end)
assert(not st and
(string.find(msg, "string length overflow") or
string.find(msg, "not enough memory")))
print("string length overflow with " .. #a * 100)
end
print('+')
end
local function loadrep (x, what)
local p = 1<<20
local s = string.rep(x, p)
local count = 0
local function f()
count = count + p
if count % (0x80*p) == 0 then
io.stderr:write("(", count // 2^20, " M)")
end
return s
end
local st, msg = load(f, "=big")
print("\nmemory: ", collectgarbage'count' * 1024)
msg = string.match(msg, "^[^\n]+") -- get only first line
print(string.format("total: 0x%x %s ('%s')", count, what, msg))
return st, msg
end
function controlstruct ()
print("control structure too long")
local lim = ((1 << 24) - 2) // 3
local s = string.rep("a = a + 1\n", lim)
s = "while true do " .. s .. "end"
assert(load(s))
print("ok with " .. lim .. " lines")
lim = lim + 3
s = string.rep("a = a + 1\n", lim)
s = "while true do " .. s .. "end"
local st, msg = load(s)
assert(not st and string.find(msg, "too long"))
print(msg)
end
function manylines ()
print("loading chunk with too many lines")
local st, msg = loadrep("\n", "lines")
assert(not st and string.find(msg, "too many lines"))
print('+')
end
function hugeid ()
print("loading chunk with huge identifier")
local st, msg = loadrep("a", "chars")
assert(not st and
(string.find(msg, "lexical element too long") or
string.find(msg, "not enough memory")))
print('+')
end
function toomanyinst ()
print("loading chunk with too many instructions")
local st, msg = loadrep("a = 10; ", "instructions")
print('+')
end
local function loadrepfunc (prefix, f)
local count = -1
local function aux ()
count = count + 1
if count == 0 then
return prefix
else
if count % (0x100000) == 0 then
io.stderr:write("(", count // 2^20, " M)")
end
return f(count)
end
end
local st, msg = load(aux, "k")
print("\nmemory: ", collectgarbage'count' * 1024)
msg = string.match(msg, "^[^\n]+") -- get only first line
print("expected error: ", msg)
end
function toomanyconst ()
print("loading function with too many constants")
loadrepfunc("function foo () return {0,",
function (n)
-- convert 'n' to a string in the format [["...",]],
-- where '...' is a kind of number in base 128
-- (in a range that does not include either the double quote
-- and the escape.)
return string.char(34,
((n // 128^0) & 127) + 128,
((n // 128^1) & 127) + 128,
((n // 128^2) & 127) + 128,
((n // 128^3) & 127) + 128,
((n // 128^4) & 127) + 128,
34, 44)
end)
end
function toomanystr ()
local a = {}
local st, msg = pcall(function ()
for i = 1, math.huge do
if i % (0x100000) == 0 then
io.stderr:write("(", i // 2^20, " M)")
end
a[i] = string.pack("I", i)
end
end)
local size = #a
a = collectgarbage'count'
print("\nmemory:", a * 1024)
print("expected error:", msg)
print("size:", size)
end
function toomanyidx ()
local a = {}
local st, msg = pcall(function ()
for i = 1, math.huge do
if i % (0x100000) == 0 then
io.stderr:write("(", i // 2^20, " M)")
end
a[i] = i
end
end)
print("\nmemory: ", collectgarbage'count' * 1024)
print("expected error: ", msg)
print("size:", #a)
end
-- teststring()
-- controlstruct()
-- manylines()
-- hugeid()
-- toomanyinst()
-- toomanyconst()
-- toomanystr()
toomanyidx()
print "OK"
| 4,462 | 174 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/tpack.lua | -- $Id: test/tpack.lua $
-- See Copyright Notice in file all.lua
local pack = string.pack
local packsize = string.packsize
local unpack = string.unpack
print "testing pack/unpack"
-- maximum size for integers
local NB = 16
local sizeshort = packsize("h")
local sizeint = packsize("i")
local sizelong = packsize("l")
local sizesize_t = packsize("T")
local sizeLI = packsize("j")
local sizefloat = packsize("f")
local sizedouble = packsize("d")
local sizenumber = packsize("n")
local little = (pack("i2", 1) == "\1\0")
local align = packsize("!xXi16")
assert(1 <= sizeshort and sizeshort <= sizeint and sizeint <= sizelong and
sizefloat <= sizedouble)
print("platform:")
print(string.format(
"\tshort %d, int %d, long %d, size_t %d, float %d, double %d,\n\z
\tlua Integer %d, lua Number %d",
sizeshort, sizeint, sizelong, sizesize_t, sizefloat, sizedouble,
sizeLI, sizenumber))
print("\t" .. (little and "little" or "big") .. " endian")
print("\talignment: " .. align)
-- check errors in arguments
function checkerror (msg, f, ...)
local status, err = pcall(f, ...)
-- print(status, err, msg)
assert(not status and string.find(err, msg))
end
-- minimum behavior for integer formats
assert(unpack("B", pack("B", 0xff)) == 0xff)
assert(unpack("b", pack("b", 0x7f)) == 0x7f)
assert(unpack("b", pack("b", -0x80)) == -0x80)
assert(unpack("H", pack("H", 0xffff)) == 0xffff)
assert(unpack("h", pack("h", 0x7fff)) == 0x7fff)
assert(unpack("h", pack("h", -0x8000)) == -0x8000)
assert(unpack("L", pack("L", 0xffffffff)) == 0xffffffff)
assert(unpack("l", pack("l", 0x7fffffff)) == 0x7fffffff)
assert(unpack("l", pack("l", -0x80000000)) == -0x80000000)
for i = 1, NB do
-- small numbers with signal extension ("\xFF...")
local s = string.rep("\xff", i)
assert(pack("i" .. i, -1) == s)
assert(packsize("i" .. i) == #s)
assert(unpack("i" .. i, s) == -1)
-- small unsigned number ("\0...\xAA")
s = "\xAA" .. string.rep("\0", i - 1)
assert(pack("<I" .. i, 0xAA) == s)
assert(unpack("<I" .. i, s) == 0xAA)
assert(pack(">I" .. i, 0xAA) == s:reverse())
assert(unpack(">I" .. i, s:reverse()) == 0xAA)
end
do
local lnum = 0x13121110090807060504030201
local s = pack("<j", lnum)
assert(unpack("<j", s) == lnum)
assert(unpack("<i" .. sizeLI + 1, s .. "\0") == lnum)
assert(unpack("<i" .. sizeLI + 1, s .. "\0") == lnum)
for i = sizeLI + 1, NB do
local s = pack("<j", -lnum)
assert(unpack("<j", s) == -lnum)
-- strings with (correct) extra bytes
assert(unpack("<i" .. i, s .. ("\xFF"):rep(i - sizeLI)) == -lnum)
assert(unpack(">i" .. i, ("\xFF"):rep(i - sizeLI) .. s:reverse()) == -lnum)
assert(unpack("<I" .. i, s .. ("\0"):rep(i - sizeLI)) == -lnum)
-- overflows
checkerror("does not fit", unpack, "<I" .. i, ("\x00"):rep(i - 1) .. "\1")
checkerror("does not fit", unpack, ">i" .. i, "\1" .. ("\x00"):rep(i - 1))
end
end
for i = 1, sizeLI do
local lstr = "\1\2\3\4\5\6\7\8\9\10\11\12\13"
local lnum = 0x13121110090807060504030201
local n = lnum & (~(-1 << (i * 8)))
local s = string.sub(lstr, 1, i)
assert(pack("<i" .. i, n) == s)
assert(pack(">i" .. i, n) == s:reverse())
assert(unpack(">i" .. i, s:reverse()) == n)
end
-- sign extension
do
local u = 0xf0
for i = 1, sizeLI - 1 do
assert(unpack("<i"..i, "\xf0"..("\xff"):rep(i - 1)) == -16)
assert(unpack(">I"..i, "\xf0"..("\xff"):rep(i - 1)) == u)
u = u * 256 + 0xff
end
end
-- mixed endianness
do
assert(pack(">i2 <i2", 10, 20) == "\0\10\20\0")
local a, b = unpack("<i2 >i2", "\10\0\0\20")
assert(a == 10 and b == 20)
assert(pack("=i4", 2001) == pack("i4", 2001))
end
print("testing invalid formats")
checkerror("out of limits", pack, "i0", 0)
checkerror("out of limits", pack, "i" .. NB + 1, 0)
checkerror("out of limits", pack, "!" .. NB + 1, 0)
checkerror("%(17%) out of limits %[1,16%]", pack, "Xi" .. NB + 1)
checkerror("invalid format option 'r'", pack, "i3r", 0)
checkerror("16%-byte integer", unpack, "i16", string.rep('\3', 16))
checkerror("not power of 2", pack, "!4i3", 0);
checkerror("missing size", pack, "c", "")
checkerror("variable%-length format", packsize, "s")
checkerror("variable%-length format", packsize, "z")
-- overflow in option size (error will be in digit after limit)
checkerror("invalid format", packsize, "c1" .. string.rep("0", 40))
if packsize("i") == 4 then
-- result would be 2^31 (2^3 repetitions of 2^28 strings)
local s = string.rep("c268435456", 2^3)
checkerror("too large", packsize, s)
-- one less is OK
s = string.rep("c268435456", 2^3 - 1) .. "c268435455"
assert(packsize(s) == 0x7fffffff)
end
-- overflow in packing
for i = 1, sizeLI - 1 do
local umax = (1 << (i * 8)) - 1
local max = umax >> 1
local min = ~max
checkerror("overflow", pack, "<I" .. i, -1)
checkerror("overflow", pack, "<I" .. i, min)
checkerror("overflow", pack, ">I" .. i, umax + 1)
checkerror("overflow", pack, ">i" .. i, umax)
checkerror("overflow", pack, ">i" .. i, max + 1)
checkerror("overflow", pack, "<i" .. i, min - 1)
assert(unpack(">i" .. i, pack(">i" .. i, max)) == max)
assert(unpack("<i" .. i, pack("<i" .. i, min)) == min)
assert(unpack(">I" .. i, pack(">I" .. i, umax)) == umax)
end
-- Lua integer size
assert(unpack(">j", pack(">j", math.maxinteger)) == math.maxinteger)
assert(unpack("<j", pack("<j", math.mininteger)) == math.mininteger)
assert(unpack("<J", pack("<j", -1)) == -1) -- maximum unsigned integer
if little then
assert(pack("f", 24) == pack("<f", 24))
else
assert(pack("f", 24) == pack(">f", 24))
end
print "testing pack/unpack of floating-point numbers"
for _, n in ipairs{0, -1.1, 1.9, 1/0, -1/0, 1e20, -1e20, 0.1, 2000.7} do
assert(unpack("n", pack("n", n)) == n)
assert(unpack("<n", pack("<n", n)) == n)
assert(unpack(">n", pack(">n", n)) == n)
assert(pack("<f", n) == pack(">f", n):reverse())
assert(pack(">d", n) == pack("<d", n):reverse())
end
-- for non-native precisions, test only with "round" numbers
for _, n in ipairs{0, -1.5, 1/0, -1/0, 1e10, -1e9, 0.5, 2000.25} do
assert(unpack("<f", pack("<f", n)) == n)
assert(unpack(">f", pack(">f", n)) == n)
assert(unpack("<d", pack("<d", n)) == n)
assert(unpack(">d", pack(">d", n)) == n)
end
print "testing pack/unpack of strings"
do
local s = string.rep("abc", 1000)
assert(pack("zB", s, 247) == s .. "\0\xF7")
local s1, b = unpack("zB", s .. "\0\xF9")
assert(b == 249 and s1 == s)
s1 = pack("s", s)
assert(unpack("s", s1) == s)
checkerror("does not fit", pack, "s1", s)
checkerror("contains zeros", pack, "z", "alo\0");
checkerror("unfinished string", unpack, "zc10000000", "alo")
for i = 2, NB do
local s1 = pack("s" .. i, s)
assert(unpack("s" .. i, s1) == s and #s1 == #s + i)
end
end
do
local x = pack("s", "alo")
checkerror("too short", unpack, "s", x:sub(1, -2))
checkerror("too short", unpack, "c5", "abcd")
checkerror("out of limits", pack, "s100", "alo")
end
do
assert(pack("c0", "") == "")
assert(packsize("c0") == 0)
assert(unpack("c0", "") == "")
assert(pack("<! c3", "abc") == "abc")
assert(packsize("<! c3") == 3)
assert(pack(">!4 c6", "abcdef") == "abcdef")
assert(pack("c3", "123") == "123")
assert(pack("c0", "") == "")
assert(pack("c8", "123456") == "123456\0\0")
assert(pack("c88", "") == string.rep("\0", 88))
assert(pack("c188", "ab") == "ab" .. string.rep("\0", 188 - 2))
local a, b, c = unpack("!4 z c3", "abcdefghi\0xyz")
assert(a == "abcdefghi" and b == "xyz" and c == 14)
checkerror("longer than", pack, "c3", "1234")
end
-- testing multiple types and sequence
do
local x = pack("<b h b f d f n i", 1, 2, 3, 4, 5, 6, 7, 8)
assert(#x == packsize("<b h b f d f n i"))
local a, b, c, d, e, f, g, h = unpack("<b h b f d f n i", x)
assert(a == 1 and b == 2 and c == 3 and d == 4 and e == 5 and f == 6 and
g == 7 and h == 8)
end
print "testing alignment"
do
assert(pack(" < i1 i2 ", 2, 3) == "\2\3\0") -- no alignment by default
local x = pack(">!8 b Xh i4 i8 c1 Xi8", -12, 100, 200, "\xEC")
assert(#x == packsize(">!8 b Xh i4 i8 c1 Xi8"))
assert(x == "\xf4" .. "\0\0\0" ..
"\0\0\0\100" ..
"\0\0\0\0\0\0\0\xC8" ..
"\xEC" .. "\0\0\0\0\0\0\0")
local a, b, c, d, pos = unpack(">!8 c1 Xh i4 i8 b Xi8 XI XH", x)
assert(a == "\xF4" and b == 100 and c == 200 and d == -20 and (pos - 1) == #x)
x = pack(">!4 c3 c4 c2 z i4 c5 c2 Xi4",
"abc", "abcd", "xz", "hello", 5, "world", "xy")
assert(x == "abcabcdxzhello\0\0\0\0\0\5worldxy\0")
local a, b, c, d, e, f, g, pos = unpack(">!4 c3 c4 c2 z i4 c5 c2 Xh Xi4", x)
assert(a == "abc" and b == "abcd" and c == "xz" and d == "hello" and
e == 5 and f == "world" and g == "xy" and (pos - 1) % 4 == 0)
x = pack(" b b Xd b Xb x", 1, 2, 3)
assert(packsize(" b b Xd b Xb x") == 4)
assert(x == "\1\2\3\0")
a, b, c, pos = unpack("bbXdb", x)
assert(a == 1 and b == 2 and c == 3 and pos == #x)
-- only alignment
assert(packsize("!8 xXi8") == 8)
local pos = unpack("!8 xXi8", "0123456701234567"); assert(pos == 9)
assert(packsize("!8 xXi2") == 2)
local pos = unpack("!8 xXi2", "0123456701234567"); assert(pos == 3)
assert(packsize("!2 xXi2") == 2)
local pos = unpack("!2 xXi2", "0123456701234567"); assert(pos == 3)
assert(packsize("!2 xXi8") == 2)
local pos = unpack("!2 xXi8", "0123456701234567"); assert(pos == 3)
assert(packsize("!16 xXi16") == 16)
local pos = unpack("!16 xXi16", "0123456701234567"); assert(pos == 17)
checkerror("invalid next option", pack, "X")
checkerror("invalid next option", unpack, "XXi", "")
checkerror("invalid next option", unpack, "X i", "")
checkerror("invalid next option", pack, "Xc1")
end
do -- testing initial position
local x = pack("i4i4i4i4", 1, 2, 3, 4)
for pos = 1, 16, 4 do
local i, p = unpack("i4", x, pos)
assert(i == pos//4 + 1 and p == pos + 4)
end
-- with alignment
for pos = 0, 12 do -- will always round position to power of 2
local i, p = unpack("!4 i4", x, pos + 1)
assert(i == (pos + 3)//4 + 1 and p == i*4 + 1)
end
-- negative indices
local i, p = unpack("!4 i4", x, -4)
assert(i == 4 and p == 17)
local i, p = unpack("!4 i4", x, -7)
assert(i == 4 and p == 17)
local i, p = unpack("!4 i4", x, -#x)
assert(i == 1 and p == 5)
-- limits
for i = 1, #x + 1 do
assert(unpack("c0", x, i) == "")
end
checkerror("out of string", unpack, "c0", x, #x + 2)
end
print "OK"
| 10,525 | 323 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/coroutine.lua | -- $Id: test/coroutine.lua $
-- See Copyright Notice in file all.lua
print "testing coroutines"
local debug = require'debug'
local f
local main, ismain = coroutine.running()
assert(type(main) == "thread" and ismain)
assert(not coroutine.resume(main))
assert(not coroutine.isyieldable(main) and not coroutine.isyieldable())
assert(not pcall(coroutine.yield))
-- trivial errors
assert(not pcall(coroutine.resume, 0))
assert(not pcall(coroutine.status, 0))
-- tests for multiple yield/resume arguments
local function eqtab (t1, t2)
assert(#t1 == #t2)
for i = 1, #t1 do
local v = t1[i]
assert(t2[i] == v)
end
end
_G.x = nil -- declare x
function foo (a, ...)
local x, y = coroutine.running()
assert(x == f and y == false)
-- next call should not corrupt coroutine (but must fail,
-- as it attempts to resume the running coroutine)
assert(coroutine.resume(f) == false)
assert(coroutine.status(f) == "running")
local arg = {...}
assert(coroutine.isyieldable(x))
for i=1,#arg do
_G.x = {coroutine.yield(table.unpack(arg[i]))}
end
return table.unpack(a)
end
f = coroutine.create(foo)
assert(coroutine.isyieldable(f))
assert(type(f) == "thread" and coroutine.status(f) == "suspended")
assert(string.find(tostring(f), "thread"))
local s,a,b,c,d
s,a,b,c,d = coroutine.resume(f, {1,2,3}, {}, {1}, {'a', 'b', 'c'})
assert(coroutine.isyieldable(f))
assert(s and a == nil and coroutine.status(f) == "suspended")
s,a,b,c,d = coroutine.resume(f)
eqtab(_G.x, {})
assert(s and a == 1 and b == nil)
assert(coroutine.isyieldable(f))
s,a,b,c,d = coroutine.resume(f, 1, 2, 3)
eqtab(_G.x, {1, 2, 3})
assert(s and a == 'a' and b == 'b' and c == 'c' and d == nil)
s,a,b,c,d = coroutine.resume(f, "xuxu")
eqtab(_G.x, {"xuxu"})
assert(s and a == 1 and b == 2 and c == 3 and d == nil)
assert(coroutine.status(f) == "dead")
s, a = coroutine.resume(f, "xuxu")
assert(not s and string.find(a, "dead") and coroutine.status(f) == "dead")
-- yields in tail calls
local function foo (i) return coroutine.yield(i) end
f = coroutine.wrap(function ()
for i=1,10 do
assert(foo(i) == _G.x)
end
return 'a'
end)
for i=1,10 do _G.x = i; assert(f(i) == i) end
_G.x = 'xuxu'; assert(f('xuxu') == 'a')
-- recursive
function pf (n, i)
coroutine.yield(n)
pf(n*i, i+1)
end
f = coroutine.wrap(pf)
local s=1
for i=1,10 do
assert(f(1, 1) == s)
s = s*i
end
-- sieve
function gen (n)
return coroutine.wrap(function ()
for i=2,n do coroutine.yield(i) end
end)
end
function filter (p, g)
return coroutine.wrap(function ()
while 1 do
local n = g()
if n == nil then return end
if math.fmod(n, p) ~= 0 then coroutine.yield(n) end
end
end)
end
local x = gen(80)
local a = {}
while 1 do
local n = x()
if n == nil then break end
table.insert(a, n)
x = filter(n, x)
end
assert(#a == 22 and a[#a] == 79)
x, a = nil
print("to-be-closed variables in coroutines")
local function func2close (f)
return setmetatable({}, {__close = f})
end
do
-- ok to close a dead coroutine
local co = coroutine.create(print)
assert(coroutine.resume(co, "testing 'coroutine.close'"))
assert(coroutine.status(co) == "dead")
local st, msg = coroutine.close(co)
assert(st and msg == nil)
-- cannot close the running coroutine
local st, msg = pcall(coroutine.close, coroutine.running())
assert(not st and string.find(msg, "running"))
local main = coroutine.running()
-- cannot close a "normal" coroutine
;(coroutine.wrap(function ()
local st, msg = pcall(coroutine.close, main)
assert(not st and string.find(msg, "normal"))
end))()
-- to-be-closed variables in coroutines
local X
-- closing a coroutine after an error
local co = coroutine.create(error)
local st, msg = coroutine.resume(co, 100)
assert(not st and msg == 100)
st, msg = coroutine.close(co)
assert(not st and msg == 100)
co = coroutine.create(function ()
local x <close> = func2close(function (self, err)
assert(err == nil); X = false
end)
X = true
coroutine.yield()
end)
coroutine.resume(co)
assert(X)
assert(coroutine.close(co))
assert(not X and coroutine.status(co) == "dead")
-- error closing a coroutine
local x = 0
co = coroutine.create(function()
local y <close> = func2close(function (self,err)
assert(err == 111)
x = 200
error(200)
end)
local x <close> = func2close(function (self, err)
assert(err == nil); error(111)
end)
coroutine.yield()
end)
coroutine.resume(co)
assert(x == 0)
local st, msg = coroutine.close(co)
assert(st == false and coroutine.status(co) == "dead" and msg == 200)
assert(x == 200)
end
do
-- <close> versus pcall in coroutines
local X = false
local Y = false
function foo ()
local x <close> = func2close(function (self, err)
Y = debug.getinfo(2)
X = err
end)
error(43)
end
co = coroutine.create(function () return pcall(foo) end)
local st1, st2, err = coroutine.resume(co)
assert(st1 and not st2 and err == 43)
assert(X == 43 and Y.name == "pcall")
-- recovering from errors in __close metamethods
local track = {}
local function h (o)
local hv <close> = o
return 1
end
local function foo ()
local x <close> = func2close(function(_,msg)
track[#track + 1] = msg or false
error(20)
end)
local y <close> = func2close(function(_,msg)
track[#track + 1] = msg or false
return 1000
end)
local z <close> = func2close(function(_,msg)
track[#track + 1] = msg or false
error(10)
end)
coroutine.yield(1)
h(func2close(function(_,msg)
track[#track + 1] = msg or false
error(2)
end))
end
local co = coroutine.create(pcall)
local st, res = coroutine.resume(co, foo) -- call 'foo' protected
assert(st and res == 1) -- yield 1
local st, res1, res2 = coroutine.resume(co) -- continue
assert(coroutine.status(co) == "dead")
assert(st and not res1 and res2 == 20) -- last error (20)
assert(track[1] == false and track[2] == 2 and track[3] == 10 and
track[4] == 10)
end
-- yielding across C boundaries
co = coroutine.wrap(function()
assert(not pcall(table.sort,{1,2,3}, coroutine.yield))
assert(coroutine.isyieldable())
coroutine.yield(20)
return 30
end)
assert(co() == 20)
assert(co() == 30)
local f = function (s, i) return coroutine.yield(i) end
local f1 = coroutine.wrap(function ()
return xpcall(pcall, function (...) return ... end,
function ()
local s = 0
for i in f, nil, 1 do pcall(function () s = s + i end) end
error({s})
end)
end)
f1()
for i = 1, 10 do assert(f1(i) == i) end
local r1, r2, v = f1(nil)
assert(r1 and not r2 and v[1] == (10 + 1)*10/2)
function f (a, b) a = coroutine.yield(a); error{a + b} end
function g(x) return x[1]*2 end
co = coroutine.wrap(function ()
coroutine.yield(xpcall(f, g, 10, 20))
end)
assert(co() == 10)
r, msg = co(100)
assert(not r and msg == 240)
-- unyieldable C call
do
local function f (c)
assert(not coroutine.isyieldable())
return c .. c
end
local co = coroutine.wrap(function (c)
assert(coroutine.isyieldable())
local s = string.gsub("a", ".", f)
return s
end)
assert(co() == "aa")
end
do -- testing single trace of coroutines
local X
local co = coroutine.create(function ()
coroutine.yield(10)
return 20;
end)
local trace = {}
local function dotrace (event)
trace[#trace + 1] = event
end
debug.sethook(co, dotrace, "clr")
repeat until not coroutine.resume(co)
local correcttrace = {"call", "line", "call", "return", "line", "return"}
assert(#trace == #correcttrace)
for k, v in pairs(trace) do
assert(v == correcttrace[k])
end
end
-- errors in coroutines
function foo ()
assert(debug.getinfo(1).currentline == debug.getinfo(foo).linedefined + 1)
assert(debug.getinfo(2).currentline == debug.getinfo(goo).linedefined)
coroutine.yield(3)
error(foo)
end
function goo() foo() end
x = coroutine.wrap(goo)
assert(x() == 3)
local a,b = pcall(x)
assert(not a and b == foo)
x = coroutine.create(goo)
a,b = coroutine.resume(x)
assert(a and b == 3)
a,b = coroutine.resume(x)
assert(not a and b == foo and coroutine.status(x) == "dead")
a,b = coroutine.resume(x)
assert(not a and string.find(b, "dead") and coroutine.status(x) == "dead")
-- co-routines x for loop
function all (a, n, k)
if k == 0 then coroutine.yield(a)
else
for i=1,n do
a[k] = i
all(a, n, k-1)
end
end
end
local a = 0
for t in coroutine.wrap(function () all({}, 5, 4) end) do
a = a+1
end
assert(a == 5^4)
-- access to locals of collected corroutines
local C = {}; setmetatable(C, {__mode = "kv"})
local x = coroutine.wrap (function ()
local a = 10
local function f () a = a+10; return a end
while true do
a = a+1
coroutine.yield(f)
end
end)
C[1] = x;
local f = x()
assert(f() == 21 and x()() == 32 and x() == f)
x = nil
collectgarbage()
assert(C[1] == undef)
assert(f() == 43 and f() == 53)
-- old bug: attempt to resume itself
function co_func (current_co)
assert(coroutine.running() == current_co)
assert(coroutine.resume(current_co) == false)
coroutine.yield(10, 20)
assert(coroutine.resume(current_co) == false)
coroutine.yield(23)
return 10
end
local co = coroutine.create(co_func)
local a,b,c = coroutine.resume(co, co)
assert(a == true and b == 10 and c == 20)
a,b = coroutine.resume(co, co)
assert(a == true and b == 23)
a,b = coroutine.resume(co, co)
assert(a == true and b == 10)
assert(coroutine.resume(co, co) == false)
assert(coroutine.resume(co, co) == false)
-- other old bug when attempting to resume itself
-- (trigger C-code assertions)
do
local A = coroutine.running()
local B = coroutine.create(function() return coroutine.resume(A) end)
local st, res = coroutine.resume(B)
assert(st == true and res == false)
local X = false
A = coroutine.wrap(function()
local _ <close> = setmetatable({}, {__close = function () X = true end})
return pcall(A, 1)
end)
st, res = A()
assert(not st and string.find(res, "non%-suspended") and X == true)
end
-- attempt to resume 'normal' coroutine
local co1, co2
co1 = coroutine.create(function () return co2() end)
co2 = coroutine.wrap(function ()
assert(coroutine.status(co1) == 'normal')
assert(not coroutine.resume(co1))
coroutine.yield(3)
end)
a,b = coroutine.resume(co1)
assert(a and b == 3)
assert(coroutine.status(co1) == 'dead')
-- infinite recursion of coroutines
a = function(a) coroutine.wrap(a)(a) end
assert(not pcall(a, a))
a = nil
-- access to locals of erroneous coroutines
local x = coroutine.create (function ()
local a = 10
_G.f = function () a=a+1; return a end
error('x')
end)
assert(not coroutine.resume(x))
-- overwrite previous position of local `a'
assert(not coroutine.resume(x, 1, 1, 1, 1, 1, 1, 1))
assert(_G.f() == 11)
assert(_G.f() == 12)
if not T then
(Message or print)
('\n >>> testC not active: skipping coroutine API tests <<<\n')
else
print "testing yields inside hooks"
local turn
function fact (t, x)
assert(turn == t)
if x == 0 then return 1
else return x*fact(t, x-1)
end
end
local A, B = 0, 0
local x = coroutine.create(function ()
T.sethook("yield 0", "", 2)
A = fact("A", 6)
end)
local y = coroutine.create(function ()
T.sethook("yield 0", "", 3)
B = fact("B", 7)
end)
while A==0 or B==0 do -- A ~= 0 when 'x' finishes (similar for 'B','y')
if A==0 then turn = "A"; assert(T.resume(x)) end
if B==0 then turn = "B"; assert(T.resume(y)) end
-- check that traceback works correctly after yields inside hooks
debug.traceback(x)
debug.traceback(y)
end
assert(B // A == 7) -- fact(7) // fact(6)
do -- hooks vs. multiple values
local done
local function test (n)
done = false
return coroutine.wrap(function ()
local a = {}
for i = 1, n do a[i] = i end
-- 'pushint' just to perturb the stack
T.sethook("pushint 10; yield 0", "", 1) -- yield at each op.
local a1 = {table.unpack(a)} -- must keep top between ops.
assert(#a1 == n)
for i = 1, n do assert(a[i] == i) end
done = true
end)
end
-- arguments to the coroutine are just to perturb its stack
local co = test(0); while not done do co(30) end
co = test(1); while not done do co(20, 10) end
co = test(3); while not done do co() end
co = test(100); while not done do co() end
end
local line = debug.getinfo(1, "l").currentline + 2 -- get line number
local function foo ()
local x = 10 --<< this line is 'line'
x = x + 10
_G.XX = x
end
-- testing yields in line hook
local co = coroutine.wrap(function ()
T.sethook("setglobal X; yield 0", "l", 0); foo(); return 10 end)
_G.XX = nil;
_G.X = nil; co(); assert(_G.X == line)
_G.X = nil; co(); assert(_G.X == line + 1)
_G.X = nil; co(); assert(_G.X == line + 2 and _G.XX == nil)
_G.X = nil; co(); assert(_G.X == line + 3 and _G.XX == 20)
assert(co() == 10)
-- testing yields in count hook
co = coroutine.wrap(function ()
T.sethook("yield 0", "", 1); foo(); return 10 end)
_G.XX = nil;
local c = 0
repeat c = c + 1; local a = co() until a == 10
assert(_G.XX == 20 and c >= 5)
co = coroutine.wrap(function ()
T.sethook("yield 0", "", 2); foo(); return 10 end)
_G.XX = nil;
local c = 0
repeat c = c + 1; local a = co() until a == 10
assert(_G.XX == 20 and c >= 5)
_G.X = nil; _G.XX = nil
do
-- testing debug library on a coroutine suspended inside a hook
-- (bug in 5.2/5.3)
c = coroutine.create(function (a, ...)
T.sethook("yield 0", "l") -- will yield on next two lines
assert(a == 10)
return ...
end)
assert(coroutine.resume(c, 1, 2, 3)) -- start coroutine
local n,v = debug.getlocal(c, 0, 1) -- check its local
assert(n == "a" and v == 1)
assert(debug.setlocal(c, 0, 1, 10)) -- test 'setlocal'
local t = debug.getinfo(c, 0) -- test 'getinfo'
assert(t.currentline == t.linedefined + 1)
assert(not debug.getinfo(c, 1)) -- no other level
assert(coroutine.resume(c)) -- run next line
v = {coroutine.resume(c)} -- finish coroutine
assert(v[1] == true and v[2] == 2 and v[3] == 3 and v[4] == undef)
assert(not coroutine.resume(c))
end
do
-- testing debug library on last function in a suspended coroutine
-- (bug in 5.2/5.3)
local c = coroutine.create(function () T.testC("yield 1", 10, 20) end)
local a, b = coroutine.resume(c)
assert(a and b == 20)
assert(debug.getinfo(c, 0).linedefined == -1)
a, b = debug.getlocal(c, 0, 2)
assert(b == 10)
end
print "testing coroutine API"
-- reusing a thread
assert(T.testC([[
newthread # create thread
pushvalue 2 # push body
pushstring 'a a a' # push argument
xmove 0 3 2 # move values to new thread
resume -1, 1 # call it first time
pushstatus
xmove 3 0 0 # move results back to stack
setglobal X # result
setglobal Y # status
pushvalue 2 # push body (to call it again)
pushstring 'b b b'
xmove 0 3 2
resume -1, 1 # call it again
pushstatus
xmove 3 0 0
return 1 # return result
]], function (...) return ... end) == 'b b b')
assert(X == 'a a a' and Y == 'OK')
-- resuming running coroutine
C = coroutine.create(function ()
return T.testC([[
pushnum 10;
pushnum 20;
resume -3 2;
pushstatus
gettop;
return 3]], C)
end)
local a, b, c, d = coroutine.resume(C)
assert(a == true and string.find(b, "non%-suspended") and
c == "ERRRUN" and d == 4)
a, b, c, d = T.testC([[
rawgeti R 1 # get main thread
pushnum 10;
pushnum 20;
resume -3 2;
pushstatus
gettop;
return 4]])
assert(a == coroutine.running() and string.find(b, "non%-suspended") and
c == "ERRRUN" and d == 4)
-- using a main thread as a coroutine (dubious use!)
local state = T.newstate()
-- check that yielddable is working correctly
assert(T.testC(state, "newthread; isyieldable -1; remove 1; return 1"))
-- main thread is not yieldable
assert(not T.testC(state, "rawgeti R 1; isyieldable -1; remove 1; return 1"))
T.testC(state, "settop 0")
T.loadlib(state)
assert(T.doremote(state, [[
coroutine = require'coroutine';
X = function (x) coroutine.yield(x, 'BB'); return 'CC' end;
return 'ok']]))
t = table.pack(T.testC(state, [[
rawgeti R 1 # get main thread
pushstring 'XX'
getglobal X # get function for body
pushstring AA # arg
resume 1 1 # 'resume' shadows previous stack!
gettop
setglobal T # top
setglobal B # second yielded value
setglobal A # fist yielded value
rawgeti R 1 # get main thread
pushnum 5 # arg (noise)
resume 1 1 # after coroutine ends, previous stack is back
pushstatus
return *
]]))
assert(t.n == 4 and t[2] == 'XX' and t[3] == 'CC' and t[4] == 'OK')
assert(T.doremote(state, "return T") == '2')
assert(T.doremote(state, "return A") == 'AA')
assert(T.doremote(state, "return B") == 'BB')
T.closestate(state)
print'+'
end
-- leaving a pending coroutine open
_X = coroutine.wrap(function ()
local a = 10
local x = function () a = a+1 end
coroutine.yield()
end)
_X()
if not _soft then
-- bug (stack overflow)
local j = 2^9
local lim = 1000000 -- (C stack limit; assume 32-bit machine)
local t = {lim - 10, lim - 5, lim - 1, lim, lim + 1}
for i = 1, #t do
local j = t[i]
co = coroutine.create(function()
local t = {}
for i = 1, j do t[i] = i end
return table.unpack(t)
end)
local r, msg = coroutine.resume(co)
assert(not r)
end
co = nil
end
assert(coroutine.running() == main)
print"+"
print"testing yields inside metamethods"
local function val(x)
if type(x) == "table" then return x.x else return x end
end
local mt = {
__eq = function(a,b) coroutine.yield(nil, "eq"); return val(a) == val(b) end,
__lt = function(a,b) coroutine.yield(nil, "lt"); return val(a) < val(b) end,
__le = function(a,b) coroutine.yield(nil, "le"); return a - b <= 0 end,
__add = function(a,b) coroutine.yield(nil, "add");
return val(a) + val(b) end,
__sub = function(a,b) coroutine.yield(nil, "sub"); return val(a) - val(b) end,
__mul = function(a,b) coroutine.yield(nil, "mul"); return val(a) * val(b) end,
__div = function(a,b) coroutine.yield(nil, "div"); return val(a) / val(b) end,
__idiv = function(a,b) coroutine.yield(nil, "idiv");
return val(a) // val(b) end,
__pow = function(a,b) coroutine.yield(nil, "pow"); return val(a) ^ val(b) end,
__mod = function(a,b) coroutine.yield(nil, "mod"); return val(a) % val(b) end,
__unm = function(a,b) coroutine.yield(nil, "unm"); return -val(a) end,
__bnot = function(a,b) coroutine.yield(nil, "bnot"); return ~val(a) end,
__shl = function(a,b) coroutine.yield(nil, "shl");
return val(a) << val(b) end,
__shr = function(a,b) coroutine.yield(nil, "shr");
return val(a) >> val(b) end,
__band = function(a,b)
coroutine.yield(nil, "band")
return val(a) & val(b)
end,
__bor = function(a,b) coroutine.yield(nil, "bor");
return val(a) | val(b) end,
__bxor = function(a,b) coroutine.yield(nil, "bxor");
return val(a) ~ val(b) end,
__concat = function(a,b)
coroutine.yield(nil, "concat");
return val(a) .. val(b)
end,
__index = function (t,k) coroutine.yield(nil, "idx"); return t.k[k] end,
__newindex = function (t,k,v) coroutine.yield(nil, "nidx"); t.k[k] = v end,
}
local function new (x)
return setmetatable({x = x, k = {}}, mt)
end
local a = new(10)
local b = new(12)
local c = new"hello"
local function run (f, t)
local i = 1
local c = coroutine.wrap(f)
while true do
local res, stat = c()
if res then assert(t[i] == undef); return res, t end
assert(stat == t[i])
i = i + 1
end
end
assert(run(function () if (a>=b) then return '>=' else return '<' end end,
{"le", "sub"}) == "<")
assert(run(function () if (a<=b) then return '<=' else return '>' end end,
{"le", "sub"}) == "<=")
assert(run(function () if (a==b) then return '==' else return '~=' end end,
{"eq"}) == "~=")
assert(run(function () return a & b + a end, {"add", "band"}) == 2)
assert(run(function () return 1 + a end, {"add"}) == 11)
assert(run(function () return a - 25 end, {"sub"}) == -15)
assert(run(function () return 2 * a end, {"mul"}) == 20)
assert(run(function () return a ^ 2 end, {"pow"}) == 100)
assert(run(function () return a / 2 end, {"div"}) == 5)
assert(run(function () return a % 6 end, {"mod"}) == 4)
assert(run(function () return a // 3 end, {"idiv"}) == 3)
assert(run(function () return a + b end, {"add"}) == 22)
assert(run(function () return a - b end, {"sub"}) == -2)
assert(run(function () return a * b end, {"mul"}) == 120)
assert(run(function () return a ^ b end, {"pow"}) == 10^12)
assert(run(function () return a / b end, {"div"}) == 10/12)
assert(run(function () return a % b end, {"mod"}) == 10)
assert(run(function () return a // b end, {"idiv"}) == 0)
-- repeat tests with larger constants (to use 'K' opcodes)
local a1000 = new(1000)
assert(run(function () return a1000 + 1000 end, {"add"}) == 2000)
assert(run(function () return a1000 - 25000 end, {"sub"}) == -24000)
assert(run(function () return 2000 * a end, {"mul"}) == 20000)
assert(run(function () return a1000 / 1000 end, {"div"}) == 1)
assert(run(function () return a1000 % 600 end, {"mod"}) == 400)
assert(run(function () return a1000 // 500 end, {"idiv"}) == 2)
assert(run(function () return a % b end, {"mod"}) == 10)
assert(run(function () return ~a & b end, {"bnot", "band"}) == ~10 & 12)
assert(run(function () return a | b end, {"bor"}) == 10 | 12)
assert(run(function () return a ~ b end, {"bxor"}) == 10 ~ 12)
assert(run(function () return a << b end, {"shl"}) == 10 << 12)
assert(run(function () return a >> b end, {"shr"}) == 10 >> 12)
assert(run(function () return 10 & b end, {"band"}) == 10 & 12)
assert(run(function () return a | 2 end, {"bor"}) == 10 | 2)
assert(run(function () return a ~ 2 end, {"bxor"}) == 10 ~ 2)
assert(run(function () return a >> 2 end, {"shr"}) == 10 >> 2)
assert(run(function () return 1 >> a end, {"shr"}) == 1 >> 10)
assert(run(function () return a << 2 end, {"shl"}) == 10 << 2)
assert(run(function () return 1 << a end, {"shl"}) == 1 << 10)
assert(run(function () return 2 ~ a end, {"bxor"}) == 2 ~ 10)
assert(run(function () return a..b end, {"concat"}) == "1012")
assert(run(function() return a .. b .. c .. a end,
{"concat", "concat", "concat"}) == "1012hello10")
assert(run(function() return "a" .. "b" .. a .. "c" .. c .. b .. "x" end,
{"concat", "concat", "concat"}) == "ab10chello12x")
do -- a few more tests for comparison operators
local mt1 = {
__le = function (a,b)
coroutine.yield(10)
return (val(a) <= val(b))
end,
__lt = function (a,b)
coroutine.yield(10)
return val(a) < val(b)
end,
}
local mt2 = { __lt = mt1.__lt, __le = mt1.__le }
local function run (f)
local co = coroutine.wrap(f)
local res
repeat
res = co()
until res ~= 10
return res
end
local function test ()
local a1 = setmetatable({x=1}, mt1)
local a2 = setmetatable({x=2}, mt2)
assert(a1 < a2)
assert(a1 <= a2)
assert(1 < a2)
assert(1 <= a2)
assert(2 > a1)
assert(2 >= a2)
return true
end
run(test)
end
assert(run(function ()
a.BB = print
return a.BB
end, {"nidx", "idx"}) == print)
-- getuptable & setuptable
do local _ENV = _ENV
f = function () AAA = BBB + 1; return AAA end
end
g = new(10); g.k.BBB = 10;
debug.setupvalue(f, 1, g)
assert(run(f, {"idx", "nidx", "idx"}) == 11)
assert(g.k.AAA == 11)
print"+"
print"testing yields inside 'for' iterators"
local f = function (s, i)
if i%2 == 0 then coroutine.yield(nil, "for") end
if i < s then return i + 1 end
end
assert(run(function ()
local s = 0
for i in f, 4, 0 do s = s + i end
return s
end, {"for", "for", "for"}) == 10)
-- tests for coroutine API
if T==nil then
(Message or print)('\n >>> testC not active: skipping coroutine API tests <<<\n')
print "OK"; return
end
print('testing coroutine API')
local function apico (...)
local x = {...}
return coroutine.wrap(function ()
return T.testC(table.unpack(x))
end)
end
local a = {apico(
[[
pushstring errorcode
pcallk 1 0 2;
invalid command (should not arrive here)
]],
[[return *]],
"stackmark",
error
)()}
assert(#a == 4 and
a[3] == "stackmark" and
a[4] == "errorcode" and
_G.status == "ERRRUN" and
_G.ctx == 2) -- 'ctx' to pcallk
local co = apico(
"pushvalue 2; pushnum 10; pcallk 1 2 3; invalid command;",
coroutine.yield,
"getglobal status; getglobal ctx; pushvalue 2; pushstring a; pcallk 1 0 4; invalid command",
"getglobal status; getglobal ctx; return *")
assert(co() == 10)
assert(co(20, 30) == 'a')
a = {co()}
assert(#a == 10 and
a[2] == coroutine.yield and
a[5] == 20 and a[6] == 30 and
a[7] == "YIELD" and a[8] == 3 and
a[9] == "YIELD" and a[10] == 4)
assert(not pcall(co)) -- coroutine is dead now
f = T.makeCfunc("pushnum 3; pushnum 5; yield 1;")
co = coroutine.wrap(function ()
assert(f() == 23); assert(f() == 23); return 10
end)
assert(co(23,16) == 5)
assert(co(23,16) == 5)
assert(co(23,16) == 10)
-- testing coroutines with C bodies
f = T.makeCfunc([[
pushnum 102
yieldk 1 U2
cannot be here!
]],
[[ # continuation
pushvalue U3 # accessing upvalues inside a continuation
pushvalue U4
return *
]], 23, "huu")
x = coroutine.wrap(f)
assert(x() == 102)
eqtab({x()}, {23, "huu"})
f = T.makeCfunc[[pushstring 'a'; pushnum 102; yield 2; ]]
a, b, c, d = T.testC([[newthread; pushvalue 2; xmove 0 3 1; resume 3 0;
pushstatus; xmove 3 0 0; resume 3 0; pushstatus;
return 4; ]], f)
assert(a == 'YIELD' and b == 'a' and c == 102 and d == 'OK')
-- testing chain of suspendable C calls
local count = 3 -- number of levels
f = T.makeCfunc([[
remove 1; # remove argument
pushvalue U3; # get selection function
call 0 1; # call it (result is 'f' or 'yield')
pushstring hello # single argument for selected function
pushupvalueindex 2; # index of continuation program
callk 1 -1 .; # call selected function
errorerror # should never arrive here
]],
[[
# continuation program
pushnum 34 # return value
return * # return all results
]],
function () -- selection function
count = count - 1
if count == 0 then return coroutine.yield
else return f
end
end
)
co = coroutine.wrap(function () return f(nil) end)
assert(co() == "hello") -- argument to 'yield'
a = {co()}
-- three '34's (one from each pending C call)
assert(#a == 3 and a[1] == a[2] and a[2] == a[3] and a[3] == 34)
-- testing yields with continuations
co = coroutine.wrap(function (...) return
T.testC([[ # initial function
yieldk 1 2
cannot be here!
]],
[[ # 1st continuation
yieldk 0 3
cannot be here!
]],
[[ # 2nd continuation
yieldk 0 4
cannot be here!
]],
[[ # 3th continuation
pushvalue 6 # function which is last arg. to 'testC' here
pushnum 10; pushnum 20;
pcall 2 0 0 # call should throw an error and return to next line
pop 1 # remove error message
pushvalue 6
getglobal status; getglobal ctx
pcallk 2 2 5 # call should throw an error and jump to continuation
cannot be here!
]],
[[ # 4th (and last) continuation
return *
]],
-- function called by 3th continuation
function (a,b) x=a; y=b; error("errmsg") end,
...
)
end)
local a = {co(3,4,6)}
assert(a[1] == 6 and a[2] == undef)
a = {co()}; assert(a[1] == undef and _G.status == "YIELD" and _G.ctx == 2)
a = {co()}; assert(a[1] == undef and _G.status == "YIELD" and _G.ctx == 3)
a = {co(7,8)};
-- original arguments
assert(type(a[1]) == 'string' and type(a[2]) == 'string' and
type(a[3]) == 'string' and type(a[4]) == 'string' and
type(a[5]) == 'string' and type(a[6]) == 'function')
-- arguments left from fist resume
assert(a[7] == 3 and a[8] == 4)
-- arguments to last resume
assert(a[9] == 7 and a[10] == 8)
-- error message and nothing more
assert(a[11]:find("errmsg") and #a == 11)
-- check arguments to pcallk
assert(x == "YIELD" and y == 4)
assert(not pcall(co)) -- coroutine should be dead
-- bug in nCcalls
local co = coroutine.wrap(function ()
local a = {pcall(pcall,pcall,pcall,pcall,pcall,pcall,pcall,error,"hi")}
return pcall(assert, table.unpack(a))
end)
local a = {co()}
assert(a[10] == "hi")
print'OK'
| 29,839 | 1,102 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/gengc.lua | -- $Id: test/gengc.lua $
-- See Copyright Notice in file all.lua
print('testing generational garbage collection')
local debug = require"debug"
assert(collectgarbage("isrunning"))
collectgarbage()
local oldmode = collectgarbage("generational")
-- ensure that table barrier evolves correctly
do
local U = {}
-- full collection makes 'U' old
collectgarbage()
assert(not T or T.gcage(U) == "old")
-- U refers to a new table, so it becomes 'touched1'
U[1] = {x = {234}}
assert(not T or (T.gcage(U) == "touched1" and T.gcage(U[1]) == "new"))
-- both U and the table survive one more collection
collectgarbage("step", 0)
assert(not T or (T.gcage(U) == "touched2" and T.gcage(U[1]) == "survival"))
-- both U and the table survive yet another collection
-- now everything is old
collectgarbage("step", 0)
assert(not T or (T.gcage(U) == "old" and T.gcage(U[1]) == "old1"))
-- data was not corrupted
assert(U[1].x[1] == 234)
end
do
-- ensure that 'firstold1' is corrected when object is removed from
-- the 'allgc' list
local function foo () end
local old = {10}
collectgarbage() -- make 'old' old
assert(not T or T.gcage(old) == "old")
setmetatable(old, {}) -- new table becomes OLD0 (barrier)
assert(not T or T.gcage(getmetatable(old)) == "old0")
collectgarbage("step", 0) -- new table becomes OLD1 and firstold1
assert(not T or T.gcage(getmetatable(old)) == "old1")
setmetatable(getmetatable(old), {__gc = foo}) -- get it out of allgc list
collectgarbage("step", 0) -- should not seg. fault
end
do -- bug in 5.4.0
-- When an object aged OLD1 is finalized, it is moved from the list
-- 'finobj' to the *beginning* of the list 'allgc', but that part of the
-- list was not being visited by 'markold'.
local A = {}
A[1] = false -- old anchor for object
-- obj finalizer
local function gcf (obj)
A[1] = obj -- anchor object
assert(not T or T.gcage(obj) == "old1")
obj = nil -- remove it from the stack
collectgarbage("step", 0) -- do a young collection
print(getmetatable(A[1]).x) -- metatable was collected
end
collectgarbage() -- make A old
local obj = {} -- create a new object
collectgarbage("step", 0) -- make it a survival
assert(not T or T.gcage(obj) == "survival")
setmetatable(obj, {__gc = gcf, x = "+"}) -- create its metatable
assert(not T or T.gcage(getmetatable(obj)) == "new")
obj = nil -- clear object
collectgarbage("step", 0) -- will call obj's finalizer
end
do -- another bug in 5.4.0
local old = {10}
collectgarbage() -- make 'old' old
local co = coroutine.create(
function ()
local x = nil
local f = function ()
return x[1]
end
x = coroutine.yield(f)
coroutine.yield()
end
)
local _, f = coroutine.resume(co) -- create closure over 'x' in coroutine
collectgarbage("step", 0) -- make upvalue a survival
old[1] = {"hello"} -- 'old' go to grayagain as 'touched1'
coroutine.resume(co, {123}) -- its value will be new
co = nil
collectgarbage("step", 0) -- hit the barrier
assert(f() == 123 and old[1][1] == "hello")
collectgarbage("step", 0) -- run the collector once more
-- make sure old[1] was not collected
assert(f() == 123 and old[1][1] == "hello")
end
do -- bug introduced in commit 9cf3299fa
local t = setmetatable({}, {__mode = "kv"}) -- all-weak table
collectgarbage() -- full collection
assert(not T or T.gcage(t) == "old")
t[1] = {10}
assert(not T or (T.gcage(t) == "touched1" and T.gccolor(t) == "gray"))
collectgarbage("step", 0) -- minor collection
assert(not T or (T.gcage(t) == "touched2" and T.gccolor(t) == "black"))
collectgarbage("step", 0) -- minor collection
assert(not T or T.gcage(t) == "old") -- t should be black, but it was gray
t[1] = {10} -- no barrier here, so t was still old
collectgarbage("step", 0) -- minor collection
-- t, being old, is ignored by the collection, so it is not cleared
assert(t[1] == nil) -- fails with the bug
end
if T == nil then
(Message or print)('\n >>> testC not active: \z
skipping some generational tests <<<\n')
print 'OK'
return
end
-- ensure that userdata barrier evolves correctly
do
local U = T.newuserdata(0, 1)
-- full collection makes 'U' old
collectgarbage()
assert(T.gcage(U) == "old")
-- U refers to a new table, so it becomes 'touched1'
debug.setuservalue(U, {x = {234}})
assert(T.gcage(U) == "touched1" and
T.gcage(debug.getuservalue(U)) == "new")
-- both U and the table survive one more collection
collectgarbage("step", 0)
assert(T.gcage(U) == "touched2" and
T.gcage(debug.getuservalue(U)) == "survival")
-- both U and the table survive yet another collection
-- now everything is old
collectgarbage("step", 0)
assert(T.gcage(U) == "old" and
T.gcage(debug.getuservalue(U)) == "old1")
-- data was not corrupted
assert(debug.getuservalue(U).x[1] == 234)
end
-- just to make sure
assert(collectgarbage'isrunning')
-- just to make sure
assert(collectgarbage'isrunning')
collectgarbage(oldmode)
print('OK')
| 5,218 | 173 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/api.lua | -- $Id: test/api.lua $
-- See Copyright Notice in file all.lua
if T==nil then
(Message or print)('\n >>> testC not active: skipping API tests <<<\n')
return
end
local debug = require "debug"
local pack = table.pack
-- standard error message for memory errors
local MEMERRMSG = "not enough memory"
function tcheck (t1, t2)
assert(t1.n == (t2.n or #t2) + 1)
for i = 2, t1.n do assert(t1[i] == t2[i - 1]) end
end
local function checkerr (msg, f, ...)
local stat, err = pcall(f, ...)
assert(not stat and string.find(err, msg))
end
print('testing C API')
a = T.testC("pushvalue R; return 1")
assert(a == debug.getregistry())
-- absindex
assert(T.testC("settop 10; absindex -1; return 1") == 10)
assert(T.testC("settop 5; absindex -5; return 1") == 1)
assert(T.testC("settop 10; absindex 1; return 1") == 1)
assert(T.testC("settop 10; absindex R; return 1") < -10)
-- testing alignment
a = T.d2s(12458954321123.0)
assert(a == string.pack("d", 12458954321123.0))
assert(T.s2d(a) == 12458954321123.0)
a,b,c = T.testC("pushnum 1; pushnum 2; pushnum 3; return 2")
assert(a == 2 and b == 3 and not c)
f = T.makeCfunc("pushnum 1; pushnum 2; pushnum 3; return 2")
a,b,c = f()
assert(a == 2 and b == 3 and not c)
-- test that all trues are equal
a,b,c = T.testC("pushbool 1; pushbool 2; pushbool 0; return 3")
assert(a == b and a == true and c == false)
a,b,c = T.testC"pushbool 0; pushbool 10; pushnil;\
tobool -3; tobool -3; tobool -3; return 3"
assert(a==false and b==true and c==false)
a,b,c = T.testC("gettop; return 2", 10, 20, 30, 40)
assert(a == 40 and b == 5 and not c)
t = pack(T.testC("settop 5; return *", 2, 3))
tcheck(t, {n=4,2,3})
t = pack(T.testC("settop 0; settop 15; return 10", 3, 1, 23))
assert(t.n == 10 and t[1] == nil and t[10] == nil)
t = pack(T.testC("remove -2; return *", 2, 3, 4))
tcheck(t, {n=2,2,4})
t = pack(T.testC("insert -1; return *", 2, 3))
tcheck(t, {n=2,2,3})
t = pack(T.testC("insert 3; return *", 2, 3, 4, 5))
tcheck(t, {n=4,2,5,3,4})
t = pack(T.testC("replace 2; return *", 2, 3, 4, 5))
tcheck(t, {n=3,5,3,4})
t = pack(T.testC("replace -2; return *", 2, 3, 4, 5))
tcheck(t, {n=3,2,3,5})
t = pack(T.testC("remove 3; return *", 2, 3, 4, 5))
tcheck(t, {n=3,2,4,5})
t = pack(T.testC("copy 3 4; return *", 2, 3, 4, 5))
tcheck(t, {n=4,2,3,3,5})
t = pack(T.testC("copy -3 -1; return *", 2, 3, 4, 5))
tcheck(t, {n=4,2,3,4,3})
do -- testing 'rotate'
local t = {10, 20, 30, 40, 50, 60}
for i = -6, 6 do
local s = string.format("rotate 2 %d; return 7", i)
local t1 = pack(T.testC(s, 10, 20, 30, 40, 50, 60))
tcheck(t1, t)
table.insert(t, 1, table.remove(t))
end
t = pack(T.testC("rotate -2 1; return *", 10, 20, 30, 40))
tcheck(t, {10, 20, 40, 30})
t = pack(T.testC("rotate -2 -1; return *", 10, 20, 30, 40))
tcheck(t, {10, 20, 40, 30})
-- some corner cases
t = pack(T.testC("rotate -1 0; return *", 10, 20, 30, 40))
tcheck(t, {10, 20, 30, 40})
t = pack(T.testC("rotate -1 1; return *", 10, 20, 30, 40))
tcheck(t, {10, 20, 30, 40})
t = pack(T.testC("rotate 5 -1; return *", 10, 20, 30, 40))
tcheck(t, {10, 20, 30, 40})
end
-- testing warnings
T.testC([[
warningC "#This shold be a"
warningC " single "
warning "warning"
warningC "#This should be "
warning "another one"
]])
-- testing message handlers
do
local f = T.makeCfunc[[
getglobal error
pushstring bola
pcall 1 1 1 # call 'error' with given handler
pushstatus
return 2 # return error message and status
]]
local msg, st = f(string.upper) -- function handler
assert(st == "ERRRUN" and msg == "BOLA")
local msg, st = f(string.len) -- function handler
assert(st == "ERRRUN" and msg == 4)
end
t = pack(T.testC("insert 3; pushvalue 3; remove 3; pushvalue 2; remove 2; \
insert 2; pushvalue 1; remove 1; insert 1; \
insert -2; pushvalue -2; remove -3; return *",
2, 3, 4, 5, 10, 40, 90))
tcheck(t, {n=7,2,3,4,5,10,40,90})
t = pack(T.testC("concat 5; return *", "alo", 2, 3, "joao", 12))
tcheck(t, {n=1,"alo23joao12"})
-- testing MULTRET
t = pack(T.testC("call 2,-1; return *",
function (a,b) return 1,2,3,4,a,b end, "alo", "joao"))
tcheck(t, {n=6,1,2,3,4,"alo", "joao"})
do -- test returning more results than fit in the caller stack
local a = {}
for i=1,1000 do a[i] = true end; a[999] = 10
local b = T.testC([[pcall 1 -1 0; pop 1; tostring -1; return 1]],
table.unpack, a)
assert(b == "10")
end
-- testing globals
_G.a = 14; _G.b = "a31"
local a = {T.testC[[
getglobal a;
getglobal b;
getglobal b;
setglobal a;
return *
]]}
assert(a[2] == 14 and a[3] == "a31" and a[4] == nil and _G.a == "a31")
-- testing arith
assert(T.testC("pushnum 10; pushnum 20; arith /; return 1") == 0.5)
assert(T.testC("pushnum 10; pushnum 20; arith -; return 1") == -10)
assert(T.testC("pushnum 10; pushnum -20; arith *; return 1") == -200)
assert(T.testC("pushnum 10; pushnum 3; arith ^; return 1") == 1000)
assert(T.testC("pushnum 10; pushstring 20; arith /; return 1") == 0.5)
assert(T.testC("pushstring 10; pushnum 20; arith -; return 1") == -10)
assert(T.testC("pushstring 10; pushstring -20; arith *; return 1") == -200)
assert(T.testC("pushstring 10; pushstring 3; arith ^; return 1") == 1000)
assert(T.testC("arith /; return 1", 2, 0) == 10.0/0)
a = T.testC("pushnum 10; pushint 3; arith \\; return 1")
assert(a == 3.0 and math.type(a) == "float")
a = T.testC("pushint 10; pushint 3; arith \\; return 1")
assert(a == 3 and math.type(a) == "integer")
a = assert(T.testC("pushint 10; pushint 3; arith +; return 1"))
assert(a == 13 and math.type(a) == "integer")
a = assert(T.testC("pushnum 10; pushint 3; arith +; return 1"))
assert(a == 13 and math.type(a) == "float")
a,b,c = T.testC([[pushnum 1;
pushstring 10; arith _;
pushstring 5; return 3]])
assert(a == 1 and b == -10 and c == "5")
mt = {__add = function (a,b) return setmetatable({a[1] + b[1]}, mt) end,
__mod = function (a,b) return setmetatable({a[1] % b[1]}, mt) end,
__unm = function (a) return setmetatable({a[1]* 2}, mt) end}
a,b,c = setmetatable({4}, mt),
setmetatable({8}, mt),
setmetatable({-3}, mt)
x,y,z = T.testC("arith +; return 2", 10, a, b)
assert(x == 10 and y[1] == 12 and z == nil)
assert(T.testC("arith %; return 1", a, c)[1] == 4%-3)
assert(T.testC("arith _; arith +; arith %; return 1", b, a, c)[1] ==
8 % (4 + (-3)*2))
-- errors in arithmetic
checkerr("divide by zero", T.testC, "arith \\", 10, 0)
checkerr("%%0", T.testC, "arith %", 10, 0)
-- testing lessthan and lessequal
assert(T.testC("compare LT 2 5, return 1", 3, 2, 2, 4, 2, 2))
assert(T.testC("compare LE 2 5, return 1", 3, 2, 2, 4, 2, 2))
assert(not T.testC("compare LT 3 4, return 1", 3, 2, 2, 4, 2, 2))
assert(T.testC("compare LE 3 4, return 1", 3, 2, 2, 4, 2, 2))
assert(T.testC("compare LT 5 2, return 1", 4, 2, 2, 3, 2, 2))
assert(not T.testC("compare LT 2 -3, return 1", "4", "2", "2", "3", "2", "2"))
assert(not T.testC("compare LT -3 2, return 1", "3", "2", "2", "4", "2", "2"))
-- non-valid indices produce false
assert(not T.testC("compare LT 1 4, return 1"))
assert(not T.testC("compare LE 9 1, return 1"))
assert(not T.testC("compare EQ 9 9, return 1"))
local b = {__lt = function (a,b) return a[1] < b[1] end}
local a1,a3,a4 = setmetatable({1}, b),
setmetatable({3}, b),
setmetatable({4}, b)
assert(T.testC("compare LT 2 5, return 1", a3, 2, 2, a4, 2, 2))
assert(T.testC("compare LE 2 5, return 1", a3, 2, 2, a4, 2, 2))
assert(T.testC("compare LT 5 -6, return 1", a4, 2, 2, a3, 2, 2))
a,b = T.testC("compare LT 5 -6, return 2", a1, 2, 2, a3, 2, 20)
assert(a == 20 and b == false)
a,b = T.testC("compare LE 5 -6, return 2", a1, 2, 2, a3, 2, 20)
assert(a == 20 and b == false)
a,b = T.testC("compare LE 5 -6, return 2", a1, 2, 2, a1, 2, 20)
assert(a == 20 and b == true)
do -- testing lessthan and lessequal with metamethods
local mt = {__lt = function (a,b) return a[1] < b[1] end,
__le = function (a,b) return a[1] <= b[1] end,
__eq = function (a,b) return a[1] == b[1] end}
local function O (x)
return setmetatable({x}, mt)
end
local a, b = T.testC("compare LT 2 3; pushint 10; return 2", O(1), O(2))
assert(a == true and b == 10)
local a, b = T.testC("compare LE 2 3; pushint 10; return 2", O(3), O(2))
assert(a == false and b == 10)
local a, b = T.testC("compare EQ 2 3; pushint 10; return 2", O(3), O(3))
assert(a == true and b == 10)
end
-- testing length
local t = setmetatable({x = 20}, {__len = function (t) return t.x end})
a,b,c = T.testC([[
len 2;
Llen 2;
objsize 2;
return 3
]], t)
assert(a == 20 and b == 20 and c == 0)
t.x = "234"; t[1] = 20
a,b,c = T.testC([[
len 2;
Llen 2;
objsize 2;
return 3
]], t)
assert(a == "234" and b == 234 and c == 1)
t.x = print; t[1] = 20
a,c = T.testC([[
len 2;
objsize 2;
return 2
]], t)
assert(a == print and c == 1)
-- testing __concat
a = setmetatable({x="u"}, {__concat = function (a,b) return a.x..'.'..b.x end})
x,y = T.testC([[
pushnum 5
pushvalue 2;
pushvalue 2;
concat 2;
pushvalue -2;
return 2;
]], a, a)
assert(x == a..a and y == 5)
-- concat with 0 elements
assert(T.testC("concat 0; return 1") == "")
-- concat with 1 element
assert(T.testC("concat 1; return 1", "xuxu") == "xuxu")
-- testing lua_is
function B(x) return x and 1 or 0 end
function count (x, n)
n = n or 2
local prog = [[
isnumber %d;
isstring %d;
isfunction %d;
iscfunction %d;
istable %d;
isuserdata %d;
isnil %d;
isnull %d;
return 8
]]
prog = string.format(prog, n, n, n, n, n, n, n, n)
local a,b,c,d,e,f,g,h = T.testC(prog, x)
return B(a)+B(b)+B(c)+B(d)+B(e)+B(f)+B(g)+(100*B(h))
end
assert(count(3) == 2)
assert(count('alo') == 1)
assert(count('32') == 2)
assert(count({}) == 1)
assert(count(print) == 2)
assert(count(function () end) == 1)
assert(count(nil) == 1)
assert(count(io.stdin) == 1)
assert(count(nil, 15) == 100)
-- testing lua_to...
function to (s, x, n)
n = n or 2
return T.testC(string.format("%s %d; return 1", s, n), x)
end
local null = T.pushuserdata(0)
local hfunc = string.gmatch("", "") -- a "heavy C function" (with upvalues)
assert(debug.getupvalue(hfunc, 1))
assert(to("tostring", {}) == nil)
assert(to("tostring", "alo") == "alo")
assert(to("tostring", 12) == "12")
assert(to("tostring", 12, 3) == nil)
assert(to("objsize", {}) == 0)
assert(to("objsize", {1,2,3}) == 3)
assert(to("objsize", "alo\0\0a") == 6)
assert(to("objsize", T.newuserdata(0)) == 0)
assert(to("objsize", T.newuserdata(101)) == 101)
assert(to("objsize", 124) == 0)
assert(to("objsize", true) == 0)
assert(to("tonumber", {}) == 0)
assert(to("tonumber", "12") == 12)
assert(to("tonumber", "s2") == 0)
assert(to("tonumber", 1, 20) == 0)
assert(to("topointer", 10) == null)
assert(to("topointer", true) == null)
assert(to("topointer", nil) == null)
assert(to("topointer", "abc") ~= null)
assert(to("topointer", string.rep("x", 10)) ==
to("topointer", string.rep("x", 10))) -- short strings
do -- long strings
local s1 = string.rep("x", 300)
local s2 = string.rep("x", 300)
assert(to("topointer", s1) ~= to("topointer", s2))
end
assert(to("topointer", T.pushuserdata(20)) ~= null)
assert(to("topointer", io.read) ~= null) -- light C function
assert(to("topointer", hfunc) ~= null) -- "heavy" C function
assert(to("topointer", function () end) ~= null) -- Lua function
assert(to("topointer", io.stdin) ~= null) -- full userdata
assert(to("func2num", 20) == 0)
assert(to("func2num", T.pushuserdata(10)) == 0)
assert(to("func2num", io.read) ~= 0) -- light C function
assert(to("func2num", hfunc) ~= 0) -- "heavy" C function (with upvalue)
a = to("tocfunction", math.deg)
assert(a(3) == math.deg(3) and a == math.deg)
print("testing panic function")
do
-- trivial error
assert(T.checkpanic("pushstring hi; error") == "hi")
-- using the stack inside panic
assert(T.checkpanic("pushstring hi; error;",
[[checkstack 5 XX
pushstring ' alo'
pushstring ' mundo'
concat 3]]) == "hi alo mundo")
-- "argerror" without frames
assert(T.checkpanic("loadstring 4") ==
"bad argument #4 (string expected, got no value)")
-- memory error
T.totalmem(T.totalmem()+10000) -- set low memory limit (+10k)
assert(T.checkpanic("newuserdata 20000") == MEMERRMSG)
T.totalmem(0) -- restore high limit
-- stack error
if not _soft then
local msg = T.checkpanic[[
pushstring "function f() f() end"
loadstring -1; call 0 0
getglobal f; call 0 0
]]
assert(string.find(msg, "stack overflow"))
end
-- exit in panic still close to-be-closed variables
assert(T.checkpanic([[
pushstring "return {__close = function () Y = 'ho'; end}"
newtable
loadstring -2
call 0 1
setmetatable -2
toclose -1
pushstring "hi"
error
]],
[[
getglobal Y
concat 2 # concat original error with global Y
]]) == "hiho")
end
-- testing deep C stack
if not _soft then
print("testing stack overflow")
collectgarbage("stop")
checkerr("XXXX", T.testC, "checkstack 1000023 XXXX") -- too deep
-- too deep (with no message)
checkerr("^stack overflow$", T.testC, "checkstack 1000023 ''")
local s = string.rep("pushnil;checkstack 1 XX;", 1000000)
checkerr("overflow", T.testC, s)
collectgarbage("restart")
print'+'
end
local lim = _soft and 500 or 12000
local prog = {"checkstack " .. (lim * 2 + 100) .. "msg", "newtable"}
for i = 1,lim do
prog[#prog + 1] = "pushnum " .. i
prog[#prog + 1] = "pushnum " .. i * 10
end
prog[#prog + 1] = "rawgeti R 2" -- get global table in registry
prog[#prog + 1] = "insert " .. -(2*lim + 2)
for i = 1,lim do
prog[#prog + 1] = "settable " .. -(2*(lim - i + 1) + 1)
end
prog[#prog + 1] = "return 2"
prog = table.concat(prog, ";")
local g, t = T.testC(prog)
assert(g == _G)
for i = 1,lim do assert(t[i] == i*10); t[i] = undef end
assert(next(t) == nil)
prog, g, t = nil
-- testing errors
a = T.testC([[
loadstring 2; pcall 0 1 0;
pushvalue 3; insert -2; pcall 1 1 0;
pcall 0 0 0;
return 1
]], "x=150", function (a) assert(a==nil); return 3 end)
assert(type(a) == 'string' and x == 150)
function check3(p, ...)
local arg = {...}
assert(#arg == 3)
assert(string.find(arg[3], p))
end
check3(":1:", T.testC("loadstring 2; return *", "x="))
check3("%.", T.testC("loadfile 2; return *", "."))
check3("xxxx", T.testC("loadfile 2; return *", "xxxx"))
-- test errors in non protected threads
function checkerrnopro (code, msg)
local th = coroutine.create(function () end) -- create new thread
local stt, err = pcall(T.testC, th, code) -- run code there
assert(not stt and string.find(err, msg))
end
if not _soft then
collectgarbage("stop") -- avoid __gc with full stack
checkerrnopro("pushnum 3; call 0 0", "attempt to call")
print"testing stack overflow in unprotected thread"
function f () f() end
checkerrnopro("getglobal 'f'; call 0 0;", "stack overflow")
collectgarbage("restart")
end
print"+"
-- testing table access
do -- getp/setp
local a = {}
local a1 = T.testC("rawsetp 2 1; return 1", a, 20)
assert(a == a1)
assert(a[T.pushuserdata(1)] == 20)
local a1, res = T.testC("rawgetp -1 1; return 2", a)
assert(a == a1 and res == 20)
end
do -- using the table itself as index
local a = {}
a[a] = 10
local prog = "gettable -1; return *"
local res = {T.testC(prog, a)}
assert(#res == 2 and res[1] == prog and res[2] == 10)
local prog = "settable -2; return *"
local res = {T.testC(prog, a, 20)}
assert(a[a] == 20)
assert(#res == 1 and res[1] == prog)
-- raw
a[a] = 10
local prog = "rawget -1; return *"
local res = {T.testC(prog, a)}
assert(#res == 2 and res[1] == prog and res[2] == 10)
local prog = "rawset -2; return *"
local res = {T.testC(prog, a, 20)}
assert(a[a] == 20)
assert(#res == 1 and res[1] == prog)
-- using the table as the value to set
local prog = "rawset -1; return *"
local res = {T.testC(prog, 30, a)}
assert(a[30] == a)
assert(#res == 1 and res[1] == prog)
local prog = "settable -1; return *"
local res = {T.testC(prog, 40, a)}
assert(a[40] == a)
assert(#res == 1 and res[1] == prog)
local prog = "rawseti -1 100; return *"
local res = {T.testC(prog, a)}
assert(a[100] == a)
assert(#res == 1 and res[1] == prog)
local prog = "seti -1 200; return *"
local res = {T.testC(prog, a)}
assert(a[200] == a)
assert(#res == 1 and res[1] == prog)
end
a = {x=0, y=12}
x, y = T.testC("gettable 2; pushvalue 4; gettable 2; return 2",
a, 3, "y", 4, "x")
assert(x == 0 and y == 12)
T.testC("settable -5", a, 3, 4, "x", 15)
assert(a.x == 15)
a[a] = print
x = T.testC("gettable 2; return 1", a) -- table and key are the same object!
assert(x == print)
T.testC("settable 2", a, "x") -- table and key are the same object!
assert(a[a] == "x")
b = setmetatable({p = a}, {})
getmetatable(b).__index = function (t, i) return t.p[i] end
k, x = T.testC("gettable 3, return 2", 4, b, 20, 35, "x")
assert(x == 15 and k == 35)
k = T.testC("getfield 2 y, return 1", b)
assert(k == 12)
getmetatable(b).__index = function (t, i) return a[i] end
getmetatable(b).__newindex = function (t, i,v ) a[i] = v end
y = T.testC("insert 2; gettable -5; return 1", 2, 3, 4, "y", b)
assert(y == 12)
k = T.testC("settable -5, return 1", b, 3, 4, "x", 16)
assert(a.x == 16 and k == 4)
a[b] = 'xuxu'
y = T.testC("gettable 2, return 1", b)
assert(y == 'xuxu')
T.testC("settable 2", b, 19)
assert(a[b] == 19)
--
do -- testing getfield/setfield with long keys
local t = {_012345678901234567890123456789012345678901234567890123456789 = 32}
local a = T.testC([[
getfield 2 _012345678901234567890123456789012345678901234567890123456789
return 1
]], t)
assert(a == 32)
local a = T.testC([[
pushnum 33
setglobal _012345678901234567890123456789012345678901234567890123456789
]])
assert(_012345678901234567890123456789012345678901234567890123456789 == 33)
_012345678901234567890123456789012345678901234567890123456789 = nil
end
-- testing next
a = {}
t = pack(T.testC("next; return *", a, nil))
tcheck(t, {n=1,a})
a = {a=3}
t = pack(T.testC("next; return *", a, nil))
tcheck(t, {n=3,a,'a',3})
t = pack(T.testC("next; pop 1; next; return *", a, nil))
tcheck(t, {n=1,a})
-- testing upvalues
do
local A = T.testC[[ pushnum 10; pushnum 20; pushcclosure 2; return 1]]
t, b, c = A([[pushvalue U0; pushvalue U1; pushvalue U2; return 3]])
assert(b == 10 and c == 20 and type(t) == 'table')
a, b = A([[tostring U3; tonumber U4; return 2]])
assert(a == nil and b == 0)
A([[pushnum 100; pushnum 200; replace U2; replace U1]])
b, c = A([[pushvalue U1; pushvalue U2; return 2]])
assert(b == 100 and c == 200)
A([[replace U2; replace U1]], {x=1}, {x=2})
b, c = A([[pushvalue U1; pushvalue U2; return 2]])
assert(b.x == 1 and c.x == 2)
T.checkmemory()
end
-- testing absent upvalues from C-function pointers
assert(T.testC[[isnull U1; return 1]] == true)
assert(T.testC[[isnull U100; return 1]] == true)
assert(T.testC[[pushvalue U1; return 1]] == nil)
local f = T.testC[[ pushnum 10; pushnum 20; pushcclosure 2; return 1]]
assert(T.upvalue(f, 1) == 10 and
T.upvalue(f, 2) == 20 and
T.upvalue(f, 3) == nil)
T.upvalue(f, 2, "xuxu")
assert(T.upvalue(f, 2) == "xuxu")
-- large closures
do
local A = "checkstack 300 msg;" ..
string.rep("pushnum 10;", 255) ..
"pushcclosure 255; return 1"
A = T.testC(A)
for i=1,255 do
assert(A(("pushvalue U%d; return 1"):format(i)) == 10)
end
assert(A("isnull U256; return 1"))
assert(not A("isnil U256; return 1"))
end
-- testing get/setuservalue
-- bug in 5.1.2
checkerr("got number", debug.setuservalue, 3, {})
checkerr("got nil", debug.setuservalue, nil, {})
checkerr("got light userdata", debug.setuservalue, T.pushuserdata(1), {})
-- testing multiple user values
local b = T.newuserdata(0, 10)
for i = 1, 10 do
local v, p = debug.getuservalue(b, i)
assert(v == nil and p)
end
do -- indices out of range
local v, p = debug.getuservalue(b, -2)
assert(v == nil and not p)
local v, p = debug.getuservalue(b, 11)
assert(v == nil and not p)
end
local t = {true, false, 4.56, print, {}, b, "XYZ"}
for k, v in ipairs(t) do
debug.setuservalue(b, v, k)
end
for k, v in ipairs(t) do
local v1, p = debug.getuservalue(b, k)
assert(v1 == v and p)
end
assert(not debug.getuservalue(4))
debug.setuservalue(b, function () return 10 end, 10)
collectgarbage() -- function should not be collected
assert(debug.getuservalue(b, 10)() == 10)
debug.setuservalue(b, 134)
collectgarbage() -- number should not be a problem for collector
assert(debug.getuservalue(b) == 134)
-- test barrier for uservalues
do
local oldmode = collectgarbage("incremental")
T.gcstate("atomic")
assert(T.gccolor(b) == "black")
debug.setuservalue(b, {x = 100})
T.gcstate("pause") -- complete collection
assert(debug.getuservalue(b).x == 100) -- uvalue should be there
collectgarbage(oldmode)
end
-- long chain of userdata
for i = 1, 1000 do
local bb = T.newuserdata(0, 1)
debug.setuservalue(bb, b)
b = bb
end
collectgarbage() -- nothing should not be collected
for i = 1, 1000 do
b = debug.getuservalue(b)
end
assert(debug.getuservalue(b).x == 100)
b = nil
-- testing locks (refs)
-- reuse of references
local i = T.ref{}
T.unref(i)
assert(T.ref{} == i)
Arr = {}
Lim = 100
for i=1,Lim do -- lock many objects
Arr[i] = T.ref({})
end
assert(T.ref(nil) == -1 and T.getref(-1) == nil)
T.unref(-1); T.unref(-1)
for i=1,Lim do -- unlock all them
T.unref(Arr[i])
end
function printlocks ()
local f = T.makeCfunc("gettable R; return 1")
local n = f("n")
print("n", n)
for i=0,n do
print(i, f(i))
end
end
for i=1,Lim do -- lock many objects
Arr[i] = T.ref({})
end
for i=1,Lim,2 do -- unlock half of them
T.unref(Arr[i])
end
assert(type(T.getref(Arr[2])) == 'table')
assert(T.getref(-1) == nil)
a = T.ref({})
collectgarbage()
assert(type(T.getref(a)) == 'table')
-- colect in cl the `val' of all collected userdata
tt = {}
cl = {n=0}
A = nil; B = nil
local F
F = function (x)
local udval = T.udataval(x)
table.insert(cl, udval)
local d = T.newuserdata(100) -- create garbage
d = nil
assert(debug.getmetatable(x).__gc == F)
assert(load("table.insert({}, {})"))() -- create more garbage
collectgarbage() -- force a GC during GC
assert(debug.getmetatable(x).__gc == F) -- previous GC did not mess this?
local dummy = {} -- create more garbage during GC
if A ~= nil then
assert(type(A) == "userdata")
assert(T.udataval(A) == B)
debug.getmetatable(A) -- just access it
end
A = x -- ressucita userdata
B = udval
return 1,2,3
end
tt.__gc = F
-- test whether udate collection frees memory in the right time
do
collectgarbage();
collectgarbage();
local x = collectgarbage("count");
local a = T.newuserdata(5001)
assert(T.testC("objsize 2; return 1", a) == 5001)
assert(collectgarbage("count") >= x+4)
a = nil
collectgarbage();
assert(collectgarbage("count") <= x+1)
-- udata without finalizer
x = collectgarbage("count")
collectgarbage("stop")
for i=1,1000 do T.newuserdata(0) end
assert(collectgarbage("count") > x+10)
collectgarbage()
assert(collectgarbage("count") <= x+1)
-- udata with finalizer
collectgarbage()
x = collectgarbage("count")
collectgarbage("stop")
a = {__gc = function () end}
for i=1,1000 do debug.setmetatable(T.newuserdata(0), a) end
assert(collectgarbage("count") >= x+10)
collectgarbage() -- this collection only calls TM, without freeing memory
assert(collectgarbage("count") >= x+10)
collectgarbage() -- now frees memory
assert(collectgarbage("count") <= x+1)
collectgarbage("restart")
end
collectgarbage("stop")
-- create 3 userdatas with tag `tt'
a = T.newuserdata(0); debug.setmetatable(a, tt); na = T.udataval(a)
b = T.newuserdata(0); debug.setmetatable(b, tt); nb = T.udataval(b)
c = T.newuserdata(0); debug.setmetatable(c, tt); nc = T.udataval(c)
-- create userdata without meta table
x = T.newuserdata(4)
y = T.newuserdata(0)
checkerr("FILE%* expected, got userdata", io.input, a)
checkerr("FILE%* expected, got userdata", io.input, x)
assert(debug.getmetatable(x) == nil and debug.getmetatable(y) == nil)
d=T.ref(a);
e=T.ref(b);
f=T.ref(c);
t = {T.getref(d), T.getref(e), T.getref(f)}
assert(t[1] == a and t[2] == b and t[3] == c)
t=nil; a=nil; c=nil;
T.unref(e); T.unref(f)
collectgarbage()
-- check that unref objects have been collected
assert(#cl == 1 and cl[1] == nc)
x = T.getref(d)
assert(type(x) == 'userdata' and debug.getmetatable(x) == tt)
x =nil
tt.b = b -- create cycle
tt=nil -- frees tt for GC
A = nil
b = nil
T.unref(d);
n5 = T.newuserdata(0)
debug.setmetatable(n5, {__gc=F})
n5 = T.udataval(n5)
collectgarbage()
assert(#cl == 4)
-- check order of collection
assert(cl[2] == n5 and cl[3] == nb and cl[4] == na)
collectgarbage"restart"
a, na = {}, {}
for i=30,1,-1 do
a[i] = T.newuserdata(0)
debug.setmetatable(a[i], {__gc=F})
na[i] = T.udataval(a[i])
end
cl = {}
a = nil; collectgarbage()
assert(#cl == 30)
for i=1,30 do assert(cl[i] == na[i]) end
na = nil
for i=2,Lim,2 do -- unlock the other half
T.unref(Arr[i])
end
x = T.newuserdata(41); debug.setmetatable(x, {__gc=F})
assert(T.testC("objsize 2; return 1", x) == 41)
cl = {}
a = {[x] = 1}
x = T.udataval(x)
collectgarbage()
-- old `x' cannot be collected (`a' still uses it)
assert(#cl == 0)
for n in pairs(a) do a[n] = undef end
collectgarbage()
assert(#cl == 1 and cl[1] == x) -- old `x' must be collected
-- testing lua_equal
assert(T.testC("compare EQ 2 4; return 1", print, 1, print, 20))
assert(T.testC("compare EQ 3 2; return 1", 'alo', "alo"))
assert(T.testC("compare EQ 2 3; return 1", nil, nil))
assert(not T.testC("compare EQ 2 3; return 1", {}, {}))
assert(not T.testC("compare EQ 2 3; return 1"))
assert(not T.testC("compare EQ 2 3; return 1", 3))
-- testing lua_equal with fallbacks
do
local map = {}
local t = {__eq = function (a,b) return map[a] == map[b] end}
local function f(x)
local u = T.newuserdata(0)
debug.setmetatable(u, t)
map[u] = x
return u
end
assert(f(10) == f(10))
assert(f(10) ~= f(11))
assert(T.testC("compare EQ 2 3; return 1", f(10), f(10)))
assert(not T.testC("compare EQ 2 3; return 1", f(10), f(20)))
t.__eq = nil
assert(f(10) ~= f(10))
end
print'+'
-- testing changing hooks during hooks
_G.t = {}
T.sethook([[
# set a line hook after 3 count hooks
sethook 4 0 '
getglobal t;
pushvalue -3; append -2
pushvalue -2; append -2
']], "c", 3)
local a = 1 -- counting
a = 1 -- counting
a = 1 -- count hook (set line hook)
a = 1 -- line hook
a = 1 -- line hook
debug.sethook()
t = _G.t
assert(t[1] == "line")
line = t[2]
assert(t[3] == "line" and t[4] == line + 1)
assert(t[5] == "line" and t[6] == line + 2)
assert(t[7] == nil)
-------------------------------------------------------------------------
do -- testing errors during GC
warn("@off")
collectgarbage("stop")
local a = {}
for i=1,20 do
a[i] = T.newuserdata(i) -- creates several udata
end
for i=1,20,2 do -- mark half of them to raise errors during GC
debug.setmetatable(a[i],
{__gc = function (x) error("@expected error in gc") end})
end
for i=2,20,2 do -- mark the other half to count and to create more garbage
debug.setmetatable(a[i], {__gc = function (x) load("A=A+1")() end})
end
a = nil
_G.A = 0
collectgarbage()
assert(A == 10) -- number of normal collections
collectgarbage("restart")
warn("@on")
end
-------------------------------------------------------------------------
-- test for userdata vals
do
local a = {}; local lim = 30
for i=0,lim do a[i] = T.pushuserdata(i) end
for i=0,lim do assert(T.udataval(a[i]) == i) end
for i=0,lim do assert(T.pushuserdata(i) == a[i]) end
for i=0,lim do a[a[i]] = i end
for i=0,lim do a[T.pushuserdata(i)] = i end
assert(type(tostring(a[1])) == "string")
end
-------------------------------------------------------------------------
-- testing multiple states
T.closestate(T.newstate());
L1 = T.newstate()
assert(L1)
assert(T.doremote(L1, "X='a'; return 'a'") == 'a')
assert(#pack(T.doremote(L1, "function f () return 'alo', 3 end; f()")) == 0)
a, b = T.doremote(L1, "return f()")
assert(a == 'alo' and b == '3')
T.doremote(L1, "_ERRORMESSAGE = nil")
-- error: `sin' is not defined
a, _, b = T.doremote(L1, "return sin(1)")
assert(a == nil and b == 2) -- 2 == run-time error
-- error: syntax error
a, b, c = T.doremote(L1, "return a+")
assert(a == nil and c == 3 and type(b) == "string") -- 3 == syntax error
T.loadlib(L1)
a, b, c = T.doremote(L1, [[
string = require'string'
a = require'_G'; assert(a == _G and require("_G") == a)
io = require'io'; assert(type(io.read) == "function")
assert(require("io") == io)
a = require'table'; assert(type(a.insert) == "function")
a = require'debug'; assert(type(a.getlocal) == "function")
a = require'math'; assert(type(a.sin) == "function")
return string.sub('okinama', 1, 2)
]])
assert(a == "ok")
T.closestate(L1);
L1 = T.newstate()
T.loadlib(L1)
T.doremote(L1, "a = {}")
T.testC(L1, [[getglobal "a"; pushstring "x"; pushint 1;
settable -3]])
assert(T.doremote(L1, "return a.x") == "1")
T.closestate(L1)
L1 = nil
print('+')
-------------------------------------------------------------------------
-- testing to-be-closed variables
-------------------------------------------------------------------------
print"testing to-be-closed variables"
do
local openresource = {}
local function newresource ()
local x = setmetatable({10}, {__close = function(y)
assert(openresource[#openresource] == y)
openresource[#openresource] = nil
y[1] = y[1] + 1
end})
openresource[#openresource + 1] = x
return x
end
local a, b = T.testC([[
call 0 1 # create resource
pushnil
toclose -2 # mark call result to be closed
toclose -1 # mark nil to be closed (will be ignored)
return 2
]], newresource)
assert(a[1] == 11 and b == nil)
assert(#openresource == 0) -- was closed
-- repeat the test, but calling function in a 'multret' context
local a = {T.testC([[
call 0 1 # create resource
toclose 2 # mark it to be closed
return 2
]], newresource)}
assert(type(a[1]) == "string" and a[2][1] == 11)
assert(#openresource == 0) -- was closed
-- closing by error
local a, b = pcall(T.makeCfunc[[
call 0 1 # create resource
toclose -1 # mark it to be closed
error # resource is the error object
]], newresource)
assert(a == false and b[1] == 11)
assert(#openresource == 0) -- was closed
-- non-closable value
local a, b = pcall(T.makeCfunc[[
newtable # create non-closable object
toclose -1 # mark it to be closed (should raise an error)
abort # will not be executed
]])
assert(a == false and
string.find(b, "non%-closable value"))
local function check (n)
assert(#openresource == n)
end
-- closing resources with 'closeslot'
_ENV.xxx = true
local a = T.testC([[
pushvalue 2 # stack: S, NR, CH, NR
call 0 1 # create resource; stack: S, NR, CH, R
toclose -1 # mark it to be closed
pushvalue 2 # stack: S, NR, CH, R, NR
call 0 1 # create another resource; stack: S, NR, CH, R, R
toclose -1 # mark it to be closed
pushvalue 3 # stack: S, NR, CH, R, R, CH
pushint 2 # there should be two open resources
call 1 0 # stack: S, NR, CH, R, R
closeslot -1 # close second resource
pushvalue 3 # stack: S, NR, CH, R, R, CH
pushint 1 # there should be one open resource
call 1 0 # stack: S, NR, CH, R, R
closeslot 4
setglobal "xxx" # previous op. erased the slot
pop 1 # pop other resource from the stack
pushint *
return 1 # return stack size
]], newresource, check)
assert(a == 3 and _ENV.xxx == nil) -- no extra items left in the stack
-- closing resources with 'pop'
local a = T.testC([[
pushvalue 2 # stack: S, NR, CH, NR
call 0 1 # create resource; stack: S, NR, CH, R
toclose -1 # mark it to be closed
pushvalue 2 # stack: S, NR, CH, R, NR
call 0 1 # create another resource; stack: S, NR, CH, R, R
toclose -1 # mark it to be closed
pushvalue 3 # stack: S, NR, CH, R, R, CH
pushint 2 # there should be two open resources
call 1 0 # stack: S, NR, CH, R, R
pop 1 # pop second resource
pushvalue 3 # stack: S, NR, CH, R, CH
pushint 1 # there should be one open resource
call 1 0 # stack: S, NR, CH, R
pop 1 # pop other resource from the stack
pushvalue 3 # stack: S, NR, CH, CH
pushint 0 # there should be no open resources
call 1 0 # stack: S, NR, CH
pushint *
return 1 # return stack size
]], newresource, check)
assert(a == 3) -- no extra items left in the stack
-- non-closable value
local a, b = pcall(T.makeCfunc[[
pushint 32
toclose -1
]])
assert(not a and string.find(b, "(C temporary)"))
end
--[[
** {==================================================================
** Testing memory limits
** ===================================================================
--]]
print("memory-allocation errors")
checkerr("block too big", T.newuserdata, math.maxinteger)
collectgarbage()
local f = load"local a={}; for i=1,100000 do a[i]=i end"
T.alloccount(10)
checkerr(MEMERRMSG, f)
T.alloccount() -- remove limit
-- test memory errors; increase limit for maximum memory by steps,
-- o that we get memory errors in all allocations of a given
-- task, until there is enough memory to complete the task without
-- errors.
function testbytes (s, f)
collectgarbage()
local M = T.totalmem()
local oldM = M
local a,b = nil
while true do
collectgarbage(); collectgarbage()
T.totalmem(M)
a, b = T.testC("pcall 0 1 0; pushstatus; return 2", f)
T.totalmem(0) -- remove limit
if a and b == "OK" then break end -- stop when no more errors
if b ~= "OK" and b ~= MEMERRMSG then -- not a memory error?
error(a, 0) -- propagate it
end
M = M + 7 -- increase memory limit
end
print(string.format("minimum memory for %s: %d bytes", s, M - oldM))
return a
end
-- test memory errors; increase limit for number of allocations one
-- by one, so that we get memory errors in all allocations of a given
-- task, until there is enough allocations to complete the task without
-- errors.
function testalloc (s, f)
collectgarbage()
local M = 0
local a,b = nil
while true do
collectgarbage(); collectgarbage()
T.alloccount(M)
a, b = T.testC("pcall 0 1 0; pushstatus; return 2", f)
T.alloccount() -- remove limit
if a and b == "OK" then break end -- stop when no more errors
if b ~= "OK" and b ~= MEMERRMSG then -- not a memory error?
error(a, 0) -- propagate it
end
M = M + 1 -- increase allocation limit
end
print(string.format("minimum allocations for %s: %d allocations", s, M))
return a
end
local function testamem (s, f)
testalloc(s, f)
return testbytes(s, f)
end
-- doing nothing
b = testamem("doing nothing", function () return 10 end)
assert(b == 10)
-- testing memory errors when creating a new state
testamem("state creation", function ()
local st = T.newstate()
if st then T.closestate(st) end -- close new state
return st
end)
testamem("empty-table creation", function ()
return {}
end)
testamem("string creation", function ()
return "XXX" .. "YYY"
end)
testamem("coroutine creation", function()
return coroutine.create(print)
end)
-- testing to-be-closed variables
testamem("to-be-closed variables", function()
local flag
do
local x <close> =
setmetatable({}, {__close = function () flag = true end})
flag = false
local x = {}
end
return flag
end)
-- testing threads
-- get main thread from registry (at index LUA_RIDX_MAINTHREAD == 1)
mt = T.testC("rawgeti R 1; return 1")
assert(type(mt) == "thread" and coroutine.running() == mt)
function expand (n,s)
if n==0 then return "" end
local e = string.rep("=", n)
return string.format("T.doonnewstack([%s[ %s;\n collectgarbage(); %s]%s])\n",
e, s, expand(n-1,s), e)
end
G=0; collectgarbage(); a =collectgarbage("count")
load(expand(20,"G=G+1"))()
assert(G==20); collectgarbage(); -- assert(gcinfo() <= a+1)
testamem("running code on new thread", function ()
return T.doonnewstack("x=1") == 0 -- try to create thread
end)
-- testing memory x compiler
testamem("loadstring", function ()
return load("x=1") -- try to do load a string
end)
local testprog = [[
local function foo () return end
local t = {"x"}
a = "aaa"
for i = 1, #t do a=a..t[i] end
return true
]]
-- testing memory x dofile
_G.a = nil
local t =os.tmpname()
local f = assert(io.open(t, "w"))
f:write(testprog)
f:close()
testamem("dofile", function ()
local a = loadfile(t)
return a and a()
end)
assert(os.remove(t))
assert(_G.a == "aaax")
-- other generic tests
testamem("gsub", function ()
local a, b = string.gsub("alo alo", "(a)", function (x) return x..'b' end)
return (a == 'ablo ablo')
end)
testamem("dump/undump", function ()
local a = load(testprog)
local b = a and string.dump(a)
a = b and load(b)
return a and a()
end)
local t = os.tmpname()
testamem("file creation", function ()
local f = assert(io.open(t, 'w'))
assert (not io.open"nomenaoexistente")
io.close(f);
return not loadfile'nomenaoexistente'
end)
assert(os.remove(t))
testamem("table creation", function ()
local a, lim = {}, 10
for i=1,lim do a[i] = i; a[i..'a'] = {} end
return (type(a[lim..'a']) == 'table' and a[lim] == lim)
end)
testamem("constructors", function ()
local a = {10, 20, 30, 40, 50; a=1, b=2, c=3, d=4, e=5}
return (type(a) == 'table' and a.e == 5)
end)
local a = 1
close = nil
testamem("closure creation", function ()
function close (b)
return function (x) return b + x end
end
return (close(2)(4) == 6)
end)
testamem("using coroutines", function ()
local a = coroutine.wrap(function ()
coroutine.yield(string.rep("a", 10))
return {}
end)
assert(string.len(a()) == 10)
return a()
end)
do -- auxiliary buffer
local lim = 100
local a = {}; for i = 1, lim do a[i] = "01234567890123456789" end
testamem("auxiliary buffer", function ()
return (#table.concat(a, ",") == 20*lim + lim - 1)
end)
end
testamem("growing stack", function ()
local function foo (n)
if n == 0 then return 1 else return 1 + foo(n - 1) end
end
return foo(100)
end)
-- }==================================================================
do -- testing failing in 'lua_checkstack'
local res = T.testC([[rawcheckstack 500000; return 1]])
assert(res == false)
local L = T.newstate()
T.alloccount(0) -- will be unable to reallocate the stack
res = T.testC(L, [[rawcheckstack 5000; return 1]])
T.alloccount()
T.closestate(L)
assert(res == false)
end
do -- closing state with no extra memory
local L = T.newstate()
T.alloccount(0)
T.closestate(L)
T.alloccount()
end
do -- garbage collection with no extra memory
local L = T.newstate()
T.loadlib(L)
local res = (T.doremote(L, [[
_ENV = require"_G"
local T = require"T"
local a = {}
for i = 1, 1000 do a[i] = 'i' .. i end -- grow string table
local stsize, stuse = T.querystr()
assert(stuse > 1000)
local function foo (n)
if n > 0 then foo(n - 1) end
end
foo(180) -- grow stack
local _, stksize = T.stacklevel()
assert(stksize > 180)
a = nil
T.alloccount(0)
collectgarbage()
T.alloccount()
-- stack and string table could not be reallocated,
-- so they kept their sizes (without errors)
assert(select(2, T.stacklevel()) == stksize)
assert(T.querystr() == stsize)
return 'ok'
]]))
assert(res == 'ok')
T.closestate(L)
end
print'+'
-- testing some auxlib functions
local function gsub (a, b, c)
a, b = T.testC("gsub 2 3 4; gettop; return 2", a, b, c)
assert(b == 5)
return a
end
assert(gsub("alo.alo.uhuh.", ".", "//") == "alo//alo//uhuh//")
assert(gsub("alo.alo.uhuh.", "alo", "//") == "//.//.uhuh.")
assert(gsub("", "alo", "//") == "")
assert(gsub("...", ".", "/.") == "/././.")
assert(gsub("...", "...", "") == "")
-- testing luaL_newmetatable
local mt_xuxu, res, top = T.testC("newmetatable xuxu; gettop; return 3")
assert(type(mt_xuxu) == "table" and res and top == 3)
local d, res, top = T.testC("newmetatable xuxu; gettop; return 3")
assert(mt_xuxu == d and not res and top == 3)
d, res, top = T.testC("newmetatable xuxu1; gettop; return 3")
assert(mt_xuxu ~= d and res and top == 3)
x = T.newuserdata(0);
y = T.newuserdata(0);
T.testC("pushstring xuxu; gettable R; setmetatable 2", x)
assert(getmetatable(x) == mt_xuxu)
-- testing luaL_testudata
-- correct metatable
local res1, res2, top = T.testC([[testudata -1 xuxu
testudata 2 xuxu
gettop
return 3]], x)
assert(res1 and res2 and top == 4)
-- wrong metatable
res1, res2, top = T.testC([[testudata -1 xuxu1
testudata 2 xuxu1
gettop
return 3]], x)
assert(not res1 and not res2 and top == 4)
-- non-existent type
res1, res2, top = T.testC([[testudata -1 xuxu2
testudata 2 xuxu2
gettop
return 3]], x)
assert(not res1 and not res2 and top == 4)
-- userdata has no metatable
res1, res2, top = T.testC([[testudata -1 xuxu
testudata 2 xuxu
gettop
return 3]], y)
assert(not res1 and not res2 and top == 4)
-- erase metatables
do
local r = debug.getregistry()
assert(r.xuxu == mt_xuxu and r.xuxu1 == d)
r.xuxu = nil; r.xuxu1 = nil
end
print'OK'
| 42,135 | 1,535 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/errors.lua | -- $Id: test/errors.lua $
-- See Copyright Notice in file all.lua
print("testing errors")
local debug = require"debug"
-- avoid problems with 'strict' module (which may generate other error messages)
local mt = getmetatable(_G) or {}
local oldmm = mt.__index
mt.__index = nil
local function checkerr (msg, f, ...)
local st, err = pcall(f, ...)
assert(not st and string.find(err, msg))
end
local function doit (s)
local f, msg = load(s)
if not f then return msg end
local cond, msg = pcall(f)
return (not cond) and msg
end
local function checkmessage (prog, msg, debug)
local m = doit(prog)
if debug then print(m) end
assert(string.find(m, msg, 1, true))
end
local function checksyntax (prog, extra, token, line)
local msg = doit(prog)
if not string.find(token, "^<%a") and not string.find(token, "^char%(")
then token = "'"..token.."'" end
token = string.gsub(token, "(%p)", "%%%1")
local pt = string.format([[^%%[string ".*"%%]:%d: .- near %s$]],
line, token)
assert(string.find(msg, pt))
assert(string.find(msg, msg, 1, true))
end
-- test error message with no extra info
assert(doit("error('hi', 0)") == 'hi')
-- test error message with no info
assert(doit("error()") == nil)
-- test common errors/errors that crashed in the past
assert(doit("table.unpack({}, 1, n=2^30)"))
assert(doit("a=math.sin()"))
assert(not doit("tostring(1)") and doit("tostring()"))
assert(doit"tonumber()")
assert(doit"repeat until 1; a")
assert(doit"return;;")
assert(doit"assert(false)")
assert(doit"assert(nil)")
assert(doit("function a (... , ...) end"))
assert(doit("function a (, ...) end"))
assert(doit("local t={}; t = t[#t] + 1"))
checksyntax([[
local a = {4
]], "'}' expected (to close '{' at line 1)", "<eof>", 3)
do -- testing errors in goto/break
local function checksyntax (prog, msg, line)
local st, err = load(prog)
assert(string.find(err, "line " .. line))
assert(string.find(err, msg, 1, true))
end
checksyntax([[
::A:: a = 1
::A::
]], "label 'A' already defined", 1)
checksyntax([[
a = 1
goto A
do ::A:: end
]], "no visible label 'A'", 2)
end
if not T then
(Message or print)
('\n >>> testC not active: skipping memory message test <<<\n')
else
print "testing memory error message"
local a = {}
for i = 1, 10000 do a[i] = true end -- preallocate array
collectgarbage()
T.totalmem(T.totalmem() + 10000)
-- force a memory error (by a small margin)
local st, msg = pcall(function()
for i = 1, 100000 do a[i] = tostring(i) end
end)
T.totalmem(0)
assert(not st and msg == "not enough" .. " memory")
end
-- tests for better error messages
checkmessage("a = {} + 1", "arithmetic")
checkmessage("a = {} | 1", "bitwise operation")
checkmessage("a = {} < 1", "attempt to compare")
checkmessage("a = {} <= 1", "attempt to compare")
checkmessage("a=1; bbbb=2; a=math.sin(3)+bbbb(3)", "global 'bbbb'")
checkmessage("a={}; do local a=1 end a:bbbb(3)", "method 'bbbb'")
checkmessage("local a={}; a.bbbb(3)", "field 'bbbb'")
assert(not string.find(doit"a={13}; local bbbb=1; a[bbbb](3)", "'bbbb'"))
checkmessage("a={13}; local bbbb=1; a[bbbb](3)", "number")
checkmessage("a=(1)..{}", "a table value")
-- calls
checkmessage("local a; a(13)", "local 'a'")
checkmessage([[
local a = setmetatable({}, {__add = 34})
a = a + 1
]], "metamethod 'add'")
checkmessage([[
local a = setmetatable({}, {__lt = {}})
a = a > a
]], "metamethod 'lt'")
-- tail calls
checkmessage("local a={}; return a.bbbb(3)", "field 'bbbb'")
checkmessage("a={}; do local a=1 end; return a:bbbb(3)", "method 'bbbb'")
checkmessage("a = #print", "length of a function value")
checkmessage("a = #3", "length of a number value")
aaa = nil
checkmessage("aaa.bbb:ddd(9)", "global 'aaa'")
checkmessage("local aaa={bbb=1}; aaa.bbb:ddd(9)", "field 'bbb'")
checkmessage("local aaa={bbb={}}; aaa.bbb:ddd(9)", "method 'ddd'")
checkmessage("local a,b,c; (function () a = b+1.1 end)()", "upvalue 'b'")
assert(not doit"local aaa={bbb={ddd=next}}; aaa.bbb:ddd(nil)")
-- upvalues being indexed do not go to the stack
checkmessage("local a,b,cc; (function () a = cc[1] end)()", "upvalue 'cc'")
checkmessage("local a,b,cc; (function () a.x = 1 end)()", "upvalue 'a'")
checkmessage("local _ENV = {x={}}; a = a + 1", "global 'a'")
checkmessage("b=1; local aaa={}; x=aaa+b", "local 'aaa'")
checkmessage("aaa={}; x=3.3/aaa", "global 'aaa'")
checkmessage("aaa=2; b=nil;x=aaa*b", "global 'b'")
checkmessage("aaa={}; x=-aaa", "global 'aaa'")
-- short circuit
checkmessage("a=1; local a,bbbb=2,3; a = math.sin(1) and bbbb(3)",
"local 'bbbb'")
checkmessage("a=1; local a,bbbb=2,3; a = bbbb(1) or a(3)", "local 'bbbb'")
checkmessage("local a,b,c,f = 1,1,1; f((a and b) or c)", "local 'f'")
checkmessage("local a,b,c = 1,1,1; ((a and b) or c)()", "call a number value")
assert(not string.find(doit"aaa={}; x=(aaa or aaa)+(aaa and aaa)", "'aaa'"))
assert(not string.find(doit"aaa={}; (aaa or aaa)()", "'aaa'"))
checkmessage("print(print < 10)", "function with number")
checkmessage("print(print < print)", "two function values")
checkmessage("print('10' < 10)", "string with number")
checkmessage("print(10 < '23')", "number with string")
-- float->integer conversions
checkmessage("local a = 2.0^100; x = a << 2", "local a")
checkmessage("local a = 1 >> 2.0^100", "has no integer representation")
checkmessage("local a = 10.1 << 2.0^100", "has no integer representation")
checkmessage("local a = 2.0^100 & 1", "has no integer representation")
checkmessage("local a = 2.0^100 & 1e100", "has no integer representation")
checkmessage("local a = 2.0 | 1e40", "has no integer representation")
checkmessage("local a = 2e100 ~ 1", "has no integer representation")
checkmessage("string.sub('a', 2.0^100)", "has no integer representation")
checkmessage("string.rep('a', 3.3)", "has no integer representation")
checkmessage("return 6e40 & 7", "has no integer representation")
checkmessage("return 34 << 7e30", "has no integer representation")
checkmessage("return ~-3e40", "has no integer representation")
checkmessage("return ~-3.009", "has no integer representation")
checkmessage("return 3.009 & 1", "has no integer representation")
checkmessage("return 34 >> {}", "table value")
checkmessage("a = 24 // 0", "divide by zero")
checkmessage("a = 1 % 0", "'n%0'")
-- type error for an object which is neither in an upvalue nor a register.
-- The following code will try to index the value 10 that is stored in
-- the metatable, without moving it to a register.
checkmessage("local a = setmetatable({}, {__index = 10}).x",
"attempt to index a number value")
-- numeric for loops
checkmessage("for i = {}, 10 do end", "table")
checkmessage("for i = io.stdin, 10 do end", "FILE")
checkmessage("for i = {}, 10 do end", "initial value")
checkmessage("for i = 1, 'x', 10 do end", "string")
checkmessage("for i = 1, {}, 10 do end", "limit")
checkmessage("for i = 1, {} do end", "limit")
checkmessage("for i = 1, 10, print do end", "step")
checkmessage("for i = 1, 10, print do end", "function")
-- passing light userdata instead of full userdata
_G.D = debug
checkmessage([[
-- create light udata
local x = D.upvalueid(function () return debug end, 1)
D.setuservalue(x, {})
]], "light userdata")
_G.D = nil
do -- named objects (field '__name')
checkmessage("math.sin(io.input())", "(number expected, got FILE*)")
_G.XX = setmetatable({}, {__name = "My Type"})
assert(string.find(tostring(XX), "^My Type"))
checkmessage("io.input(XX)", "(FILE* expected, got My Type)")
checkmessage("return XX + 1", "on a My Type value")
checkmessage("return ~io.stdin", "on a FILE* value")
checkmessage("return XX < XX", "two My Type values")
checkmessage("return {} < XX", "table with My Type")
checkmessage("return XX < io.stdin", "My Type with FILE*")
_G.XX = nil
end
-- global functions
checkmessage("(io.write or print){}", "io.write")
checkmessage("(collectgarbage or print){}", "collectgarbage")
-- errors in functions without debug info
do
local f = function (a) return a + 1 end
f = assert(load(string.dump(f, true)))
assert(f(3) == 4)
checkerr("^%?:%-1:", f, {})
-- code with a move to a local var ('OP_MOV A B' with A<B)
f = function () local a; a = {}; return a + 2 end
-- no debug info (so that 'a' is unknown)
f = assert(load(string.dump(f, true)))
-- symbolic execution should not get lost
checkerr("^%?:%-1:.*table value", f)
end
-- tests for field accesses after RK limit
local t = {}
for i = 1, 1000 do
t[i] = "a = x" .. i
end
local s = table.concat(t, "; ")
t = nil
checkmessage(s.."; a = bbb + 1", "global 'bbb'")
checkmessage("local _ENV=_ENV;"..s.."; a = bbb + 1", "global 'bbb'")
checkmessage(s.."; local t = {}; a = t.bbb + 1", "field 'bbb'")
checkmessage(s.."; local t = {}; t:bbb()", "method 'bbb'")
checkmessage([[aaa=9
repeat until 3==3
local x=math.sin(math.cos(3))
if math.sin(1) == x then return math.sin(1) end -- tail call
local a,b = 1, {
{x='a'..'b'..'c', y='b', z=x},
{1,2,3,4,5} or 3+3<=3+3,
3+1>3+1,
{d = x and aaa[x or y]}}
]], "global 'aaa'")
checkmessage([[
local x,y = {},1
if math.sin(1) == 0 then return 3 end -- return
x.a()]], "field 'a'")
checkmessage([[
prefix = nil
insert = nil
while 1 do
local a
if nil then break end
insert(prefix, a)
end]], "global 'insert'")
checkmessage([[ -- tail call
return math.sin("a")
]], "'sin'")
checkmessage([[collectgarbage("nooption")]], "invalid option")
checkmessage([[x = print .. "a"]], "concatenate")
checkmessage([[x = "a" .. false]], "concatenate")
checkmessage([[x = {} .. 2]], "concatenate")
checkmessage("getmetatable(io.stdin).__gc()", "no value")
checkmessage([[
local Var
local function main()
NoSuchName (function() Var=0 end)
end
main()
]], "global 'NoSuchName'")
print'+'
a = {}; setmetatable(a, {__index = string})
checkmessage("a:sub()", "bad self")
checkmessage("string.sub('a', {})", "#2")
checkmessage("('a'):sub{}", "#1")
checkmessage("table.sort({1,2,3}, table.sort)", "'table.sort'")
checkmessage("string.gsub('s', 's', setmetatable)", "'setmetatable'")
-- tests for errors in coroutines
local function f (n)
local c = coroutine.create(f)
local a,b = coroutine.resume(c)
return b
end
assert(string.find(f(), "C stack overflow"))
checkmessage("coroutine.yield()", "outside a coroutine")
f = coroutine.wrap(function () table.sort({1,2,3}, coroutine.yield) end)
checkerr("yield across", f)
-- testing size of 'source' info; size of buffer for that info is
-- LUA_IDSIZE, declared as 60 in luaconf. Get one position for '\0'.
idsize = 60 - 1
local function checksize (source)
-- syntax error
local _, msg = load("x", source)
msg = string.match(msg, "^([^:]*):") -- get source (1st part before ':')
assert(msg:len() <= idsize)
end
for i = 60 - 10, 60 + 10 do -- check border cases around 60
checksize("@" .. string.rep("x", i)) -- file names
checksize(string.rep("x", i - 10)) -- string sources
checksize("=" .. string.rep("x", i)) -- exact sources
end
-- testing line error
local function lineerror (s, l)
local err,msg = pcall(load(s))
local line = tonumber(string.match(msg, ":(%d+):"))
assert(line == l or (not line and not l))
end
lineerror("local a\n for i=1,'a' do \n print(i) \n end", 2)
lineerror("\n local a \n for k,v in 3 \n do \n print(k) \n end", 3)
lineerror("\n\n for k,v in \n 3 \n do \n print(k) \n end", 4)
lineerror("function a.x.y ()\na=a+1\nend", 1)
lineerror("a = \na\n+\n{}", 3)
lineerror("a = \n3\n+\n(\n4\n/\nprint)", 6)
lineerror("a = \nprint\n+\n(\n4\n/\n7)", 3)
lineerror("a\n=\n-\n\nprint\n;", 3)
lineerror([[
a
(
23)
]], 1)
lineerror([[
local a = {x = 13}
a
.
x
(
23
)
]], 2)
lineerror([[
local a = {x = 13}
a
.
x
(
23 + a
)
]], 6)
local p = [[
function g() f() end
function f(x) error('a', X) end
g()
]]
X=3;lineerror((p), 3)
X=0;lineerror((p), false)
X=1;lineerror((p), 2)
X=2;lineerror((p), 1)
lineerror([[
local b = false
if not b then
error 'test'
end]], 3)
lineerror([[
local b = false
if not b then
if not b then
if not b then
error 'test'
end
end
end]], 5)
do
-- Force a negative estimate for base line. Error in instruction 2
-- (after VARARGPREP, GETGLOBAL), with first absolute line information
-- (forced by too many lines) in instruction 0.
local s = string.format("%s return __A.x", string.rep("\n", 300))
lineerror(s, 301)
end
if not _soft then
-- several tests that exaust the Lua stack
collectgarbage()
print"testing stack overflow"
C = 0
-- get line where stack overflow will happen
local l = debug.getinfo(1, "l").currentline + 1
local function auxy () C=C+1; auxy() end -- produce a stack overflow
function y ()
collectgarbage("stop") -- avoid running finalizers without stack space
auxy()
collectgarbage("restart")
end
local function checkstackmessage (m)
print("(expected stack overflow after " .. C .. " calls)")
C = 0 -- prepare next count
return (string.find(m, "stack overflow"))
end
-- repeated stack overflows (to check stack recovery)
assert(checkstackmessage(doit('y()')))
assert(checkstackmessage(doit('y()')))
assert(checkstackmessage(doit('y()')))
-- error lines in stack overflow
local l1
local function g(x)
l1 = debug.getinfo(x, "l").currentline + 2
collectgarbage("stop") -- avoid running finalizers without stack space
auxy()
collectgarbage("restart")
end
local _, stackmsg = xpcall(g, debug.traceback, 1)
print('+')
local stack = {}
for line in string.gmatch(stackmsg, "[^\n]*") do
local curr = string.match(line, ":(%d+):")
if curr then table.insert(stack, tonumber(curr)) end
end
local i=1
while stack[i] ~= l1 do
assert(stack[i] == l)
i = i+1
end
assert(i > 15)
-- error in error handling
local res, msg = xpcall(error, error)
assert(not res and type(msg) == 'string')
print('+')
local function f (x)
if x==0 then error('a\n')
else
local aux = function () return f(x-1) end
local a,b = xpcall(aux, aux)
return a,b
end
end
f(3)
local function loop (x,y,z) return 1 + loop(x, y, z) end
local res, msg = xpcall(loop, function (m)
assert(string.find(m, "stack overflow"))
checkerr("error handling", loop)
assert(math.sin(0) == 0)
return 15
end)
assert(msg == 15)
local f = function ()
for i = 999900, 1000000, 1 do table.unpack({}, 1, i) end
end
checkerr("too many results", f)
end
do
-- non string messages
local t = {}
local res, msg = pcall(function () error(t) end)
assert(not res and msg == t)
res, msg = pcall(function () error(nil) end)
assert(not res and msg == nil)
local function f() error{msg='x'} end
res, msg = xpcall(f, function (r) return {msg=r.msg..'y'} end)
assert(msg.msg == 'xy')
-- 'assert' with extra arguments
res, msg = pcall(assert, false, "X", t)
assert(not res and msg == "X")
-- 'assert' with no message
res, msg = pcall(function () assert(false) end)
local line = string.match(msg, "%w+%.lua:(%d+): assertion failed!$")
assert(tonumber(line) == debug.getinfo(1, "l").currentline - 2)
-- 'assert' with non-string messages
res, msg = pcall(assert, false, t)
assert(not res and msg == t)
res, msg = pcall(assert, nil, nil)
assert(not res and msg == nil)
-- 'assert' without arguments
res, msg = pcall(assert)
assert(not res and string.find(msg, "value expected"))
end
-- xpcall with arguments
a, b, c = xpcall(string.find, error, "alo", "al")
assert(a and b == 1 and c == 2)
a, b, c = xpcall(string.find, function (x) return {} end, true, "al")
assert(not a and type(b) == "table" and c == nil)
print("testing tokens in error messages")
checksyntax("syntax error", "", "error", 1)
checksyntax("1.000", "", "1.000", 1)
checksyntax("[[a]]", "", "[[a]]", 1)
checksyntax("'aa'", "", "'aa'", 1)
checksyntax("while << do end", "", "<<", 1)
checksyntax("for >> do end", "", ">>", 1)
-- test invalid non-printable char in a chunk
checksyntax("a\1a = 1", "", "<\\1>", 1)
-- test 255 as first char in a chunk
checksyntax("\255a = 1", "", "<\\255>", 1)
doit('I = load("a=9+"); a=3')
assert(a==3 and not I)
print('+')
lim = 1000
if _soft then lim = 100 end
for i=1,lim do
doit('a = ')
doit('a = 4+nil')
end
-- testing syntax limits
local function testrep (init, rep, close, repc, finalresult)
local s = init .. string.rep(rep, 100) .. close .. string.rep(repc, 100)
local res, msg = load(s)
assert(res) -- 100 levels is OK
if (finalresult) then
assert(res() == finalresult)
end
s = init .. string.rep(rep, 500)
local res, msg = load(s) -- 500 levels not ok
assert(not res and (string.find(msg, "too many") or
string.find(msg, "overflow")))
end
testrep("local a; a", ",a", "= 1", ",1") -- multiple assignment
testrep("local a; a=", "{", "0", "}")
testrep("return ", "(", "2", ")", 2)
testrep("local function a (x) return x end; return ", "a(", "2.2", ")", 2.2)
testrep("", "do ", "", " end")
testrep("", "while a do ", "", " end")
testrep("local a; ", "if a then else ", "", " end")
testrep("", "function foo () ", "", " end")
testrep("local a = ''; return ", "a..", "'a'", "", "a")
testrep("local a = 1; return ", "a^", "a", "", 1)
checkmessage("a = f(x" .. string.rep(",x", 260) .. ")", "too many registers")
-- testing other limits
-- upvalues
local lim = 127
local s = "local function fooA ()\n local "
for j = 1,lim do
s = s.."a"..j..", "
end
s = s.."b,c\n"
s = s.."local function fooB ()\n local "
for j = 1,lim do
s = s.."b"..j..", "
end
s = s.."b\n"
s = s.."function fooC () return b+c"
local c = 1+2
for j = 1,lim do
s = s.."+a"..j.."+b"..j
c = c + 2
end
s = s.."\nend end end"
local a,b = load(s)
assert(c > 255 and string.find(b, "too many upvalues") and
string.find(b, "line 5"))
-- local variables
s = "\nfunction foo ()\n local "
for j = 1,300 do
s = s.."a"..j..", "
end
s = s.."b\n"
local a,b = load(s)
assert(string.find(b, "line 2") and string.find(b, "too many local variables"))
mt.__index = oldmm
print('OK')
| 18,156 | 646 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/bwcoercion.lua | local tonumber, tointeger = tonumber, math.tointeger
local type, getmetatable, rawget, error = type, getmetatable, rawget, error
local strsub = string.sub
local print = print
_ENV = nil
-- Try to convert a value to an integer, without assuming any coercion.
local function toint (x)
x = tonumber(x) -- handle numerical strings
if not x then
return false -- not coercible to a number
end
return tointeger(x)
end
-- If operation fails, maybe second operand has a metamethod that should
-- have been called if not for this string metamethod, so try to
-- call it.
local function trymt (x, y, mtname)
if type(y) ~= "string" then -- avoid recalling original metamethod
local mt = getmetatable(y)
local mm = mt and rawget(mt, mtname)
if mm then
return mm(x, y)
end
end
-- if any test fails, there is no other metamethod to be called
error("attempt to '" .. strsub(mtname, 3) ..
"' a " .. type(x) .. " with a " .. type(y), 4)
end
local function checkargs (x, y, mtname)
local xi = toint(x)
local yi = toint(y)
if xi and yi then
return xi, yi
else
return trymt(x, y, mtname), nil
end
end
local smt = getmetatable("")
smt.__band = function (x, y)
local x, y = checkargs(x, y, "__band")
return y and x & y or x
end
smt.__bor = function (x, y)
local x, y = checkargs(x, y, "__bor")
return y and x | y or x
end
smt.__bxor = function (x, y)
local x, y = checkargs(x, y, "__bxor")
return y and x ~ y or x
end
smt.__shl = function (x, y)
local x, y = checkargs(x, y, "__shl")
return y and x << y or x
end
smt.__shr = function (x, y)
local x, y = checkargs(x, y, "__shr")
return y and x >> y or x
end
smt.__bnot = function (x)
local x, y = checkargs(x, x, "__bnot")
return y and ~x or x
end
| 1,791 | 79 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/locals.lua | -- $Id: test/locals.lua $
-- See Copyright Notice in file all.lua
print('testing local variables and environments')
local debug = require"debug"
local tracegc = require"tracegc"
-- bug in 5.1:
local function f(x) x = nil; return x end
assert(f(10) == nil)
local function f() local x; return x end
assert(f(10) == nil)
local function f(x) x = nil; local y; return x, y end
assert(f(10) == nil and select(2, f(20)) == nil)
do
local i = 10
do local i = 100; assert(i==100) end
do local i = 1000; assert(i==1000) end
assert(i == 10)
if i ~= 10 then
local i = 20
else
local i = 30
assert(i == 30)
end
end
f = nil
local f
x = 1
a = nil
load('local a = {}')()
assert(a == nil)
function f (a)
local _1, _2, _3, _4, _5
local _6, _7, _8, _9, _10
local x = 3
local b = a
local c,d = a,b
if (d == b) then
local x = 'q'
x = b
assert(x == 2)
else
assert(nil)
end
assert(x == 3)
local f = 10
end
local b=10
local a; repeat local b; a,b=1,2; assert(a+1==b); until a+b==3
assert(x == 1)
f(2)
assert(type(f) == 'function')
local function getenv (f)
local a,b = debug.getupvalue(f, 1)
assert(a == '_ENV')
return b
end
-- test for global table of loaded chunks
assert(getenv(load"a=3") == _G)
local c = {}; local f = load("a = 3", nil, nil, c)
assert(getenv(f) == c)
assert(c.a == nil)
f()
assert(c.a == 3)
-- old test for limits for special instructions
do
local i = 2
local p = 4 -- p == 2^i
repeat
for j=-3,3 do
assert(load(string.format([[local a=%s;
a=a+%s;
assert(a ==2^%s)]], j, p-j, i), '')) ()
assert(load(string.format([[local a=%s;
a=a-%s;
assert(a==-2^%s)]], -j, p-j, i), '')) ()
assert(load(string.format([[local a,b=0,%s;
a=b-%s;
assert(a==-2^%s)]], -j, p-j, i), '')) ()
end
p = 2 * p; i = i + 1
until p <= 0
end
print'+'
if rawget(_G, "T") then
-- testing clearing of dead elements from tables
collectgarbage("stop") -- stop GC
local a = {[{}] = 4, [3] = 0, alo = 1,
a1234567890123456789012345678901234567890 = 10}
local t = T.querytab(a)
for k,_ in pairs(a) do a[k] = undef end
collectgarbage() -- restore GC and collect dead fields in 'a'
for i=0,t-1 do
local k = querytab(a, i)
assert(k == nil or type(k) == 'number' or k == 'alo')
end
-- testing allocation errors during table insertions
local a = {}
local function additems ()
a.x = true; a.y = true; a.z = true
a[1] = true
a[2] = true
end
for i = 1, math.huge do
T.alloccount(i)
local st, msg = pcall(additems)
T.alloccount()
local count = 0
for k, v in pairs(a) do
assert(a[k] == v)
count = count + 1
end
if st then assert(count == 5); break end
end
end
-- testing lexical environments
assert(_ENV == _G)
do
local dummy
local _ENV = (function (...) return ... end)(_G, dummy) -- {
do local _ENV = {assert=assert}; assert(true) end
mt = {_G = _G}
local foo,x
A = false -- "declare" A
do local _ENV = mt
function foo (x)
A = x
do local _ENV = _G; A = 1000 end
return function (x) return A .. x end
end
end
assert(getenv(foo) == mt)
x = foo('hi'); assert(mt.A == 'hi' and A == 1000)
assert(x('*') == mt.A .. '*')
do local _ENV = {assert=assert, A=10};
do local _ENV = {assert=assert, A=20};
assert(A==20);x=A
end
assert(A==10 and x==20)
end
assert(x==20)
do -- constants
local a<const>, b, c<const> = 10, 20, 30
b = a + c + b -- 'b' is not constant
assert(a == 10 and b == 60 and c == 30)
local function checkro (name, code)
local st, msg = load(code)
local gab = string.format("attempt to assign to const variable '%s'", name)
assert(not st and string.find(msg, gab))
end
checkro("y", "local x, y <const>, z = 10, 20, 30; x = 11; y = 12")
checkro("x", "local x <const>, y, z <const> = 10, 20, 30; x = 11")
checkro("z", "local x <const>, y, z <const> = 10, 20, 30; y = 10; z = 11")
checkro("z", [[
local a, z <const>, b = 10;
function foo() a = 20; z = 32; end
]])
checkro("var1", [[
local a, var1 <const> = 10;
function foo() a = 20; z = function () var1 = 12; end end
]])
end
print"testing to-be-closed variables"
local function stack(n) n = ((n == 0) or stack(n - 1)) end
local function func2close (f, x, y)
local obj = setmetatable({}, {__close = f})
if x then
return x, obj, y
else
return obj
end
end
do
local a = {}
do
local b <close> = false -- not to be closed
local x <close> = setmetatable({"x"}, {__close = function (self)
a[#a + 1] = self[1] end})
local w, y <close>, z = func2close(function (self, err)
assert(err == nil); a[#a + 1] = "y"
end, 10, 20)
local c <close> = nil -- not to be closed
a[#a + 1] = "in"
assert(w == 10 and z == 20)
end
a[#a + 1] = "out"
assert(a[1] == "in" and a[2] == "y" and a[3] == "x" and a[4] == "out")
end
do
local X = false
local x, closescope = func2close(function (_, msg)
stack(10);
assert(msg == nil)
X = true
end, 100)
assert(x == 100); x = 101; -- 'x' is not read-only
-- closing functions do not corrupt returning values
local function foo (x)
local _ <close> = closescope
return x, X, 23
end
local a, b, c = foo(1.5)
assert(a == 1.5 and b == false and c == 23 and X == true)
X = false
foo = function (x)
local _<close> = func2close(function (_, msg)
-- without errors, enclosing function should be still active when
-- __close is called
assert(debug.getinfo(2).name == "foo")
assert(msg == nil)
end)
local _<close> = closescope
local y = 15
return y
end
assert(foo() == 15 and X == true)
X = false
foo = function ()
local x <close> = closescope
return x
end
assert(foo() == closescope and X == true)
end
-- testing to-be-closed x compile-time constants
-- (there were some bugs here in Lua 5.4-rc3, due to a confusion
-- between compile levels and stack levels of variables)
do
local flag = false
local x = setmetatable({},
{__close = function() assert(flag == false); flag = true end})
local y <const> = nil
local z <const> = nil
do
local a <close> = x
end
assert(flag) -- 'x' must be closed here
end
do
-- similar problem, but with implicit close in for loops
local flag = false
local x = setmetatable({},
{__close = function () assert(flag == false); flag = true end})
-- return an empty iterator, nil, nil, and 'x' to be closed
local function a ()
return (function () return nil end), nil, nil, x
end
local v <const> = 1
local w <const> = 1
local x <const> = 1
local y <const> = 1
local z <const> = 1
for k in a() do
a = k
end -- ending the loop must close 'x'
assert(flag) -- 'x' must be closed here
end
do
-- calls cannot be tail in the scope of to-be-closed variables
local X, Y
local function foo ()
local _ <close> = func2close(function () Y = 10 end)
assert(X == true and Y == nil) -- 'X' not closed yet
return 1,2,3
end
local function bar ()
local _ <close> = func2close(function () X = false end)
X = true
do
return foo() -- not a tail call!
end
end
local a, b, c, d = bar()
assert(a == 1 and b == 2 and c == 3 and X == false and Y == 10 and d == nil)
end
do print("testing errors in __close")
-- original error is in __close
local function foo ()
local x <close> =
func2close(function (self, msg)
assert(string.find(msg, "@y"))
error("@x")
end)
local x1 <close> =
func2close(function (self, msg)
assert(string.find(msg, "@y"))
end)
local gc <close> = func2close(function () collectgarbage() end)
local y <close> =
func2close(function (self, msg)
assert(string.find(msg, "@z")) -- error in 'z'
error("@y")
end)
local z <close> =
func2close(function (self, msg)
assert(msg == nil)
error("@z")
end)
return 200
end
local stat, msg = pcall(foo, false)
assert(string.find(msg, "@x"))
-- original error not in __close
local function foo ()
local x <close> =
func2close(function (self, msg)
-- after error, 'foo' was discarded, so caller now
-- must be 'pcall'
assert(debug.getinfo(2).name == "pcall")
assert(string.find(msg, "@x1"))
end)
local x1 <close> =
func2close(function (self, msg)
assert(debug.getinfo(2).name == "pcall")
assert(string.find(msg, "@y"))
error("@x1")
end)
local gc <close> = func2close(function () collectgarbage() end)
local y <close> =
func2close(function (self, msg)
assert(debug.getinfo(2).name == "pcall")
assert(string.find(msg, "@z"))
error("@y")
end)
local first = true
local z <close> =
func2close(function (self, msg)
assert(debug.getinfo(2).name == "pcall")
-- 'z' close is called once
assert(first and msg == 4)
first = false
error("@z")
end)
error(4) -- original error
end
local stat, msg = pcall(foo, true)
assert(string.find(msg, "@x1"))
-- error leaving a block
local function foo (...)
do
local x1 <close> =
func2close(function (self, msg)
assert(string.find(msg, "@X"))
error("@Y")
end)
local x123 <close> =
func2close(function (_, msg)
assert(msg == nil)
error("@X")
end)
end
os.exit(false) -- should not run
end
local st, msg = xpcall(foo, debug.traceback)
assert(string.match(msg, "^[^ ]* @Y"))
-- error in toclose in vararg function
local function foo (...)
local x123 <close> = func2close(function () error("@x123") end)
end
local st, msg = xpcall(foo, debug.traceback)
assert(string.match(msg, "^[^ ]* @x123"))
assert(string.find(msg, "in metamethod 'close'"))
end
do -- errors due to non-closable values
local function foo ()
local x <close> = {}
os.exit(false) -- should not run
end
local stat, msg = pcall(foo)
assert(not stat and
string.find(msg, "variable 'x' got a non%-closable value"))
local function foo ()
local xyz <close> = setmetatable({}, {__close = print})
getmetatable(xyz).__close = nil -- remove metamethod
end
local stat, msg = pcall(foo)
assert(not stat and string.find(msg, "metamethod 'close'"))
local function foo ()
local a1 <close> = func2close(function (_, msg)
assert(string.find(msg, "number value"))
error(12)
end)
local a2 <close> = setmetatable({}, {__close = print})
local a3 <close> = func2close(function (_, msg)
assert(msg == nil)
error(123)
end)
getmetatable(a2).__close = 4 -- invalidate metamethod
end
local stat, msg = pcall(foo)
assert(not stat and msg == 12)
end
do -- tbc inside close methods
local track = {}
local function foo ()
local x <close> = func2close(function ()
local xx <close> = func2close(function (_, msg)
assert(msg == nil)
track[#track + 1] = "xx"
end)
track[#track + 1] = "x"
end)
track[#track + 1] = "foo"
return 20, 30, 40
end
local a, b, c, d = foo()
assert(a == 20 and b == 30 and c == 40 and d == nil)
assert(track[1] == "foo" and track[2] == "x" and track[3] == "xx")
-- again, with errors
local track = {}
local function foo ()
local x0 <close> = func2close(function (_, msg)
assert(msg == 202)
track[#track + 1] = "x0"
end)
local x <close> = func2close(function ()
local xx <close> = func2close(function (_, msg)
assert(msg == 101)
track[#track + 1] = "xx"
error(202)
end)
track[#track + 1] = "x"
error(101)
end)
track[#track + 1] = "foo"
return 20, 30, 40
end
local st, msg = pcall(foo)
assert(not st and msg == 202)
assert(track[1] == "foo" and track[2] == "x" and track[3] == "xx" and
track[4] == "x0")
end
local function checktable (t1, t2)
assert(#t1 == #t2)
for i = 1, #t1 do
assert(t1[i] == t2[i])
end
end
do -- test for tbc variable high in the stack
-- function to force a stack overflow
local function overflow (n)
overflow(n + 1)
end
-- error handler will create tbc variable handling a stack overflow,
-- high in the stack
local function errorh (m)
assert(string.find(m, "stack overflow"))
local x <close> = func2close(function (o) o[1] = 10 end)
return x
end
local flag
local st, obj
-- run test in a coroutine so as not to swell the main stack
local co = coroutine.wrap(function ()
-- tbc variable down the stack
local y <close> = func2close(function (obj, msg)
assert(msg == nil)
obj[1] = 100
flag = obj
end)
tracegc.stop()
st, obj = xpcall(overflow, errorh, 0)
tracegc.start()
end)
co()
assert(not st and obj[1] == 10 and flag[1] == 100)
end
if rawget(_G, "T") then
-- memory error inside closing function
local function foo ()
local y <close> = func2close(function () T.alloccount() end)
local x <close> = setmetatable({}, {__close = function ()
T.alloccount(0); local x = {} -- force a memory error
end})
error(1000) -- common error inside the function's body
end
stack(5) -- ensure a minimal number of CI structures
-- despite memory error, 'y' will be executed and
-- memory limit will be lifted
local _, msg = pcall(foo)
assert(msg == "not enough memory")
local closemsg
local close = func2close(function (self, msg)
T.alloccount()
closemsg = msg
end)
-- set a memory limit and return a closing object to remove the limit
local function enter (count)
stack(10) -- reserve some stack space
T.alloccount(count)
closemsg = nil
return close
end
local function test ()
local x <close> = enter(0) -- set a memory limit
local y = {} -- raise a memory error
end
local _, msg = pcall(test)
assert(msg == "not enough memory" and closemsg == "not enough memory")
-- repeat test with extra closing upvalues
local function test ()
local xxx <close> = func2close(function (self, msg)
assert(msg == "not enough memory");
error(1000) -- raise another error
end)
local xx <close> = func2close(function (self, msg)
assert(msg == "not enough memory");
end)
local x <close> = enter(0) -- set a memory limit
local y = {} -- raise a memory error
end
local _, msg = pcall(test)
assert(msg == 1000 and closemsg == "not enough memory")
do -- testing 'toclose' in C string buffer
collectgarbage()
local s = string.rep('a', 10000) -- large string
local m = T.totalmem()
collectgarbage("stop")
s = string.upper(s) -- allocate buffer + new string (10K each)
-- ensure buffer was deallocated
assert(T.totalmem() - m <= 11000)
collectgarbage("restart")
end
do -- now some tests for freeing buffer in case of errors
local lim = 10000 -- some size larger than the static buffer
local extra = 2000 -- some extra memory (for callinfo, etc.)
local s = string.rep("a", lim)
-- concat this table needs two buffer resizes (one for each 's')
local a = {s, s}
collectgarbage(); collectgarbage()
m = T.totalmem()
collectgarbage("stop")
-- error in the first buffer allocation
T. totalmem(m + extra)
assert(not pcall(table.concat, a))
-- first buffer was not even allocated
assert(T.totalmem() - m <= extra)
-- error in the second buffer allocation
T. totalmem(m + lim + extra)
assert(not pcall(table.concat, a))
-- first buffer was released by 'toclose'
assert(T.totalmem() - m <= extra)
-- error in creation of final string
T.totalmem(m + 2 * lim + extra)
assert(not pcall(table.concat, a))
-- second buffer was released by 'toclose'
assert(T.totalmem() - m <= extra)
-- userdata, buffer, buffer, final string
T.totalmem(m + 4*lim + extra)
assert(#table.concat(a) == 2*lim)
T.totalmem(0) -- remove memory limit
collectgarbage("restart")
print'+'
end
do
-- '__close' vs. return hooks in C functions
local trace = {}
local function hook (event)
trace[#trace + 1] = event .. " " .. (debug.getinfo(2).name or "?")
end
-- create tbc variables to be used by C function
local x = func2close(function (_,msg)
trace[#trace + 1] = "x"
end)
local y = func2close(function (_,msg)
trace[#trace + 1] = "y"
end)
debug.sethook(hook, "r")
local t = {T.testC([[
toclose 2 # x
pushnum 10
pushint 20
toclose 3 # y
return 2
]], x, y)}
debug.sethook()
-- hooks ran before return hook from 'testC'
checktable(trace,
{"return sethook", "y", "return ?", "x", "return ?", "return testC"})
-- results are correct
checktable(t, {10, 20})
end
end
do -- '__close' vs. return hooks in Lua functions
local trace = {}
local function hook (event)
trace[#trace + 1] = event .. " " .. debug.getinfo(2).name
end
local function foo (...)
local x <close> = func2close(function (_,msg)
trace[#trace + 1] = "x"
end)
local y <close> = func2close(function (_,msg)
debug.sethook(hook, "r")
end)
return ...
end
local t = {foo(10,20,30)}
debug.sethook()
checktable(t, {10, 20, 30})
checktable(trace,
{"return sethook", "return close", "x", "return close", "return foo"})
end
print "to-be-closed variables in coroutines"
do
-- yielding inside closing metamethods
local trace = {}
local co = coroutine.wrap(function ()
trace[#trace + 1] = "nowX"
-- will be closed after 'y'
local x <close> = func2close(function (_, msg)
assert(msg == nil)
trace[#trace + 1] = "x1"
coroutine.yield("x")
trace[#trace + 1] = "x2"
end)
return pcall(function ()
do -- 'z' will be closed first
local z <close> = func2close(function (_, msg)
assert(msg == nil)
trace[#trace + 1] = "z1"
coroutine.yield("z")
trace[#trace + 1] = "z2"
end)
end
trace[#trace + 1] = "nowY"
-- will be closed after 'z'
local y <close> = func2close(function(_, msg)
assert(msg == nil)
trace[#trace + 1] = "y1"
coroutine.yield("y")
trace[#trace + 1] = "y2"
end)
return 10, 20, 30
end)
end)
assert(co() == "z")
assert(co() == "y")
assert(co() == "x")
checktable({co()}, {true, 10, 20, 30})
checktable(trace, {"nowX", "z1", "z2", "nowY", "y1", "y2", "x1", "x2"})
end
do
-- yielding inside closing metamethods after an error
local co = coroutine.wrap(function ()
local function foo (err)
local z <close> = func2close(function(_, msg)
assert(msg == nil or msg == err + 20)
coroutine.yield("z")
return 100, 200
end)
local y <close> = func2close(function(_, msg)
-- still gets the original error (if any)
assert(msg == err or (msg == nil and err == 1))
coroutine.yield("y")
if err then error(err + 20) end -- creates or changes the error
end)
local x <close> = func2close(function(_, msg)
assert(msg == err or (msg == nil and err == 1))
coroutine.yield("x")
return 100, 200
end)
if err == 10 then error(err) else return 10, 20 end
end
coroutine.yield(pcall(foo, nil)) -- no error
coroutine.yield(pcall(foo, 1)) -- error in __close
return pcall(foo, 10) -- 'foo' will raise an error
end)
local a, b = co() -- first foo: no error
assert(a == "x" and b == nil) -- yields inside 'x'; Ok
a, b = co()
assert(a == "y" and b == nil) -- yields inside 'y'; Ok
a, b = co()
assert(a == "z" and b == nil) -- yields inside 'z'; Ok
local a, b, c = co()
assert(a and b == 10 and c == 20) -- returns from 'pcall(foo, nil)'
local a, b = co() -- second foo: error in __close
assert(a == "x" and b == nil) -- yields inside 'x'; Ok
a, b = co()
assert(a == "y" and b == nil) -- yields inside 'y'; Ok
a, b = co()
assert(a == "z" and b == nil) -- yields inside 'z'; Ok
local st, msg = co() -- reports the error in 'y'
assert(not st and msg == 21)
local a, b = co() -- third foo: error in function body
assert(a == "x" and b == nil) -- yields inside 'x'; Ok
a, b = co()
assert(a == "y" and b == nil) -- yields inside 'y'; Ok
a, b = co()
assert(a == "z" and b == nil) -- yields inside 'z'; Ok
local st, msg = co() -- gets final error
assert(not st and msg == 10 + 20)
end
do
-- an error in a wrapped coroutine closes variables
local x = false
local y = false
local co = coroutine.wrap(function ()
local xv <close> = func2close(function () x = true end)
do
local yv <close> = func2close(function () y = true end)
coroutine.yield(100) -- yield doesn't close variable
end
coroutine.yield(200) -- yield doesn't close variable
error(23) -- error does
end)
local b = co()
assert(b == 100 and not x and not y)
b = co()
assert(b == 200 and not x and y)
local a, b = pcall(co)
assert(not a and b == 23 and x and y)
end
do
-- error in a wrapped coroutine raising errors when closing a variable
local x = 0
local co = coroutine.wrap(function ()
local xx <close> = func2close(function (_, msg)
x = x + 1;
assert(string.find(msg, "@XXX"))
error("@YYY")
end)
local xv <close> = func2close(function () x = x + 1; error("@XXX") end)
coroutine.yield(100)
error(200)
end)
assert(co() == 100); assert(x == 0)
local st, msg = pcall(co); assert(x == 2)
assert(not st and string.find(msg, "@YYY")) -- should get error raised
local x = 0
local y = 0
co = coroutine.wrap(function ()
local xx <close> = func2close(function (_, err)
y = y + 1;
assert(string.find(err, "XXX"))
error("YYY")
end)
local xv <close> = func2close(function ()
x = x + 1; error("XXX")
end)
coroutine.yield(100)
return 200
end)
assert(co() == 100); assert(x == 0)
local st, msg = pcall(co)
assert(x == 1 and y == 1)
-- should get first error raised
assert(not st and string.find(msg, "%w+%.%w+:%d+: YYY"))
end
-- a suspended coroutine should not close its variables when collected
local co
co = coroutine.wrap(function()
-- should not run
local x <close> = func2close(function () os.exit(false) end)
co = nil
coroutine.yield()
end)
co() -- start coroutine
assert(co == nil) -- eventually it will be collected
collectgarbage()
if rawget(_G, "T") then
print("to-be-closed variables x coroutines in C")
do
local token = 0
local count = 0
local f = T.makeCfunc[[
toclose 1
toclose 2
return .
]]
local obj = func2close(function (_, msg)
count = count + 1
token = coroutine.yield(count, token)
end)
local co = coroutine.wrap(f)
local ct, res = co(obj, obj, 10, 20, 30, 3) -- will return 10, 20, 30
-- initial token value, after closing 2nd obj
assert(ct == 1 and res == 0)
-- run until yield when closing 1st obj
ct, res = co(100)
assert(ct == 2 and res == 100)
res = {co(200)} -- run until end
assert(res[1] == 10 and res[2] == 20 and res[3] == 30 and res[4] == nil)
assert(token == 200)
end
do
local f = T.makeCfunc[[
toclose 1
return .
]]
local obj = func2close(function ()
local temp
local x <close> = func2close(function ()
coroutine.yield(temp)
return 1,2,3 -- to be ignored
end)
temp = coroutine.yield("closing obj")
return 1,2,3 -- to be ignored
end)
local co = coroutine.wrap(f)
local res = co(obj, 10, 30, 1) -- will return only 30
assert(res == "closing obj")
res = co("closing x")
assert(res == "closing x")
res = {co()}
assert(res[1] == 30 and res[2] == nil)
end
do
-- still cannot yield inside 'closeslot'
local f = T.makeCfunc[[
toclose 1
closeslot 1
]]
local obj = func2close(coroutine.yield)
local co = coroutine.create(f)
local st, msg = coroutine.resume(co, obj)
assert(not st and string.find(msg, "attempt to yield across"))
-- nor outside a coroutine
local f = T.makeCfunc[[
toclose 1
]]
local st, msg = pcall(f, obj)
assert(not st and string.find(msg, "attempt to yield from outside"))
end
end
-- to-be-closed variables in generic for loops
do
local numopen = 0
local function open (x)
numopen = numopen + 1
return
function () -- iteraction function
x = x - 1
if x > 0 then return x end
end,
nil, -- state
nil, -- control variable
func2close(function () numopen = numopen - 1 end) -- closing function
end
local s = 0
for i in open(10) do
s = s + i
end
assert(s == 45 and numopen == 0)
local s = 0
for i in open(10) do
if i < 5 then break end
s = s + i
end
assert(s == 35 and numopen == 0)
local s = 0
for i in open(10) do
for j in open(10) do
if i + j < 5 then goto endloop end
s = s + i
end
end
::endloop::
assert(s == 375 and numopen == 0)
end
print('OK')
return 5,f
end -- }
| 25,956 | 1,054 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/pm.lua | -- $Id: test/pm.lua $
-- See Copyright Notice in file all.lua
print('testing pattern matching')
local function checkerror (msg, f, ...)
local s, err = pcall(f, ...)
assert(not s and string.find(err, msg))
end
function f(s, p)
local i,e = string.find(s, p)
if i then return string.sub(s, i, e) end
end
a,b = string.find('', '') -- empty patterns are tricky
assert(a == 1 and b == 0);
a,b = string.find('alo', '')
assert(a == 1 and b == 0)
a,b = string.find('a\0o a\0o a\0o', 'a', 1) -- first position
assert(a == 1 and b == 1)
a,b = string.find('a\0o a\0o a\0o', 'a\0o', 2) -- starts in the midle
assert(a == 5 and b == 7)
a,b = string.find('a\0o a\0o a\0o', 'a\0o', 9) -- starts in the midle
assert(a == 9 and b == 11)
a,b = string.find('a\0a\0a\0a\0\0ab', '\0ab', 2); -- finds at the end
assert(a == 9 and b == 11);
a,b = string.find('a\0a\0a\0a\0\0ab', 'b') -- last position
assert(a == 11 and b == 11)
assert(not string.find('a\0a\0a\0a\0\0ab', 'b\0')) -- check ending
assert(not string.find('', '\0'))
assert(string.find('alo123alo', '12') == 4)
assert(not string.find('alo123alo', '^12'))
assert(string.match("aaab", ".*b") == "aaab")
assert(string.match("aaa", ".*a") == "aaa")
assert(string.match("b", ".*b") == "b")
assert(string.match("aaab", ".+b") == "aaab")
assert(string.match("aaa", ".+a") == "aaa")
assert(not string.match("b", ".+b"))
assert(string.match("aaab", ".?b") == "ab")
assert(string.match("aaa", ".?a") == "aa")
assert(string.match("b", ".?b") == "b")
assert(f('aloALO', '%l*') == 'alo')
assert(f('aLo_ALO', '%a*') == 'aLo')
assert(f(" \n\r*&\n\r xuxu \n\n", "%g%g%g+") == "xuxu")
assert(f('aaab', 'a*') == 'aaa');
assert(f('aaa', '^.*$') == 'aaa');
assert(f('aaa', 'b*') == '');
assert(f('aaa', 'ab*a') == 'aa')
assert(f('aba', 'ab*a') == 'aba')
assert(f('aaab', 'a+') == 'aaa')
assert(f('aaa', '^.+$') == 'aaa')
assert(not f('aaa', 'b+'))
assert(not f('aaa', 'ab+a'))
assert(f('aba', 'ab+a') == 'aba')
assert(f('a$a', '.$') == 'a')
assert(f('a$a', '.%$') == 'a$')
assert(f('a$a', '.$.') == 'a$a')
assert(not f('a$a', '$$'))
assert(not f('a$b', 'a$'))
assert(f('a$a', '$') == '')
assert(f('', 'b*') == '')
assert(not f('aaa', 'bb*'))
assert(f('aaab', 'a-') == '')
assert(f('aaa', '^.-$') == 'aaa')
assert(f('aabaaabaaabaaaba', 'b.*b') == 'baaabaaabaaab')
assert(f('aabaaabaaabaaaba', 'b.-b') == 'baaab')
assert(f('alo xo', '.o$') == 'xo')
assert(f(' \n isto é assim', '%S%S*') == 'isto')
assert(f(' \n isto é assim', '%S*$') == 'assim')
assert(f(' \n isto é assim', '[a-z]*$') == 'assim')
assert(f('um caracter ? extra', '[^%sa-z]') == '?')
assert(f('', 'a?') == '')
assert(f('á', 'á?') == 'á')
assert(f('ábl', 'á?b?l?') == 'ábl')
assert(f(' ábl', 'á?b?l?') == '')
assert(f('aa', '^aa?a?a') == 'aa')
assert(f(']]]áb', '[^]]') == 'á')
assert(f("0alo alo", "%x*") == "0a")
assert(f("alo alo", "%C+") == "alo alo")
print('+')
function f1(s, p)
p = string.gsub(p, "%%([0-9])", function (s)
return "%" .. (tonumber(s)+1)
end)
p = string.gsub(p, "^(^?)", "%1()", 1)
p = string.gsub(p, "($?)$", "()%1", 1)
local t = {string.match(s, p)}
return string.sub(s, t[1], t[#t] - 1)
end
assert(f1('alo alx 123 b\0o b\0o', '(..*) %1') == "b\0o b\0o")
assert(f1('axz123= 4= 4 34', '(.+)=(.*)=%2 %1') == '3= 4= 4 3')
assert(f1('=======', '^(=*)=%1$') == '=======')
assert(not string.match('==========', '^([=]*)=%1$'))
local function range (i, j)
if i <= j then
return i, range(i+1, j)
end
end
local abc = string.char(range(0, 127)) .. string.char(range(128, 255));
assert(string.len(abc) == 256)
function strset (p)
local res = {s=''}
string.gsub(abc, p, function (c) res.s = res.s .. c end)
return res.s
end;
assert(string.len(strset('[\200-\210]')) == 11)
assert(strset('[a-z]') == "abcdefghijklmnopqrstuvwxyz")
assert(strset('[a-z%d]') == strset('[%da-uu-z]'))
assert(strset('[a-]') == "-a")
assert(strset('[^%W]') == strset('[%w]'))
assert(strset('[]%%]') == '%]')
assert(strset('[a%-z]') == '-az')
assert(strset('[%^%[%-a%]%-b]') == '-[]^ab')
assert(strset('%Z') == strset('[\1-\255]'))
assert(strset('.') == strset('[\1-\255%z]'))
print('+');
assert(string.match("alo xyzK", "(%w+)K") == "xyz")
assert(string.match("254 K", "(%d*)K") == "")
assert(string.match("alo ", "(%w*)$") == "")
assert(not string.match("alo ", "(%w+)$"))
assert(string.find("(álo)", "%(á") == 1)
local a, b, c, d, e = string.match("âlo alo", "^(((.).).* (%w*))$")
assert(a == 'âlo alo' and b == 'âl' and c == 'â' and d == 'alo' and e == nil)
a, b, c, d = string.match('0123456789', '(.+(.?)())')
assert(a == '0123456789' and b == '' and c == 11 and d == nil)
print('+')
assert(string.gsub('ülo ülo', 'ü', 'x') == 'xlo xlo')
assert(string.gsub('alo úlo ', ' +$', '') == 'alo úlo') -- trim
assert(string.gsub(' alo alo ', '^%s*(.-)%s*$', '%1') == 'alo alo') -- double trim
assert(string.gsub('alo alo \n 123\n ', '%s+', ' ') == 'alo alo 123 ')
t = "abç d"
a, b = string.gsub(t, '(.)', '%1@')
assert('@'..a == string.gsub(t, '', '@') and b == 5)
a, b = string.gsub('abçd', '(.)', '%0@', 2)
assert(a == 'a@b@çd' and b == 2)
assert(string.gsub('alo alo', '()[al]', '%1') == '12o 56o')
assert(string.gsub("abc=xyz", "(%w*)(%p)(%w+)", "%3%2%1-%0") ==
"xyz=abc-abc=xyz")
assert(string.gsub("abc", "%w", "%1%0") == "aabbcc")
assert(string.gsub("abc", "%w+", "%0%1") == "abcabc")
assert(string.gsub('áéí', '$', '\0óú') == 'áéí\0óú')
assert(string.gsub('', '^', 'r') == 'r')
assert(string.gsub('', '$', 'r') == 'r')
print('+')
do -- new (5.3.3) semantics for empty matches
assert(string.gsub("a b cd", " *", "-") == "-a-b-c-d-")
local res = ""
local sub = "a \nbc\t\td"
local i = 1
for p, e in string.gmatch(sub, "()%s*()") do
res = res .. string.sub(sub, i, p - 1) .. "-"
i = e
end
assert(res == "-a-b-c-d-")
end
assert(string.gsub("um (dois) tres (quatro)", "(%(%w+%))", string.upper) ==
"um (DOIS) tres (QUATRO)")
do
local function setglobal (n,v) rawset(_G, n, v) end
string.gsub("a=roberto,roberto=a", "(%w+)=(%w%w*)", setglobal)
assert(_G.a=="roberto" and _G.roberto=="a")
end
function f(a,b) return string.gsub(a,'.',b) end
assert(string.gsub("trocar tudo em |teste|b| é |beleza|al|", "|([^|]*)|([^|]*)|", f) ==
"trocar tudo em bbbbb é alalalalalal")
local function dostring (s) return load(s, "")() or "" end
assert(string.gsub("alo $a='x'$ novamente $return a$",
"$([^$]*)%$",
dostring) == "alo novamente x")
x = string.gsub("$x=string.gsub('alo', '.', string.upper)$ assim vai para $return x$",
"$([^$]*)%$", dostring)
assert(x == ' assim vai para ALO')
t = {}
s = 'a alo jose joao'
r = string.gsub(s, '()(%w+)()', function (a,w,b)
assert(string.len(w) == b-a);
t[a] = b-a;
end)
assert(s == r and t[1] == 1 and t[3] == 3 and t[7] == 4 and t[13] == 4)
function isbalanced (s)
return not string.find(string.gsub(s, "%b()", ""), "[()]")
end
assert(isbalanced("(9 ((8))(\0) 7) \0\0 a b ()(c)() a"))
assert(not isbalanced("(9 ((8) 7) a b (\0 c) a"))
assert(string.gsub("alo 'oi' alo", "%b''", '"') == 'alo " alo')
local t = {"apple", "orange", "lime"; n=0}
assert(string.gsub("x and x and x", "x", function () t.n=t.n+1; return t[t.n] end)
== "apple and orange and lime")
t = {n=0}
string.gsub("first second word", "%w%w*", function (w) t.n=t.n+1; t[t.n] = w end)
assert(t[1] == "first" and t[2] == "second" and t[3] == "word" and t.n == 3)
t = {n=0}
assert(string.gsub("first second word", "%w+",
function (w) t.n=t.n+1; t[t.n] = w end, 2) == "first second word")
assert(t[1] == "first" and t[2] == "second" and t[3] == undef)
checkerror("invalid replacement value %(a table%)",
string.gsub, "alo", ".", {a = {}})
checkerror("invalid capture index %%2", string.gsub, "alo", ".", "%2")
checkerror("invalid capture index %%0", string.gsub, "alo", "(%0)", "a")
checkerror("invalid capture index %%1", string.gsub, "alo", "(%1)", "a")
checkerror("invalid use of '%%'", string.gsub, "alo", ".", "%x")
if not _soft then
print("big strings")
local a = string.rep('a', 300000)
assert(string.find(a, '^a*.?$'))
assert(not string.find(a, '^a*.?b$'))
assert(string.find(a, '^a-.?$'))
-- bug in 5.1.2
a = string.rep('a', 10000) .. string.rep('b', 10000)
assert(not pcall(string.gsub, a, 'b'))
end
-- recursive nest of gsubs
function rev (s)
return string.gsub(s, "(.)(.+)", function (c,s1) return rev(s1)..c end)
end
local x = "abcdef"
assert(rev(rev(x)) == x)
-- gsub with tables
assert(string.gsub("alo alo", ".", {}) == "alo alo")
assert(string.gsub("alo alo", "(.)", {a="AA", l=""}) == "AAo AAo")
assert(string.gsub("alo alo", "(.).", {a="AA", l="K"}) == "AAo AAo")
assert(string.gsub("alo alo", "((.)(.?))", {al="AA", o=false}) == "AAo AAo")
assert(string.gsub("alo alo", "().", {'x','yy','zzz'}) == "xyyzzz alo")
t = {}; setmetatable(t, {__index = function (t,s) return string.upper(s) end})
assert(string.gsub("a alo b hi", "%w%w+", t) == "a ALO b HI")
-- tests for gmatch
local a = 0
for i in string.gmatch('abcde', '()') do assert(i == a+1); a=i end
assert(a==6)
t = {n=0}
for w in string.gmatch("first second word", "%w+") do
t.n=t.n+1; t[t.n] = w
end
assert(t[1] == "first" and t[2] == "second" and t[3] == "word")
t = {3, 6, 9}
for i in string.gmatch ("xuxx uu ppar r", "()(.)%2") do
assert(i == table.remove(t, 1))
end
assert(#t == 0)
t = {}
for i,j in string.gmatch("13 14 10 = 11, 15= 16, 22=23", "(%d+)%s*=%s*(%d+)") do
t[tonumber(i)] = tonumber(j)
end
a = 0
for k,v in pairs(t) do assert(k+1 == v+0); a=a+1 end
assert(a == 3)
do -- init parameter in gmatch
local s = 0
for k in string.gmatch("10 20 30", "%d+", 3) do
s = s + tonumber(k)
end
assert(s == 50)
s = 0
for k in string.gmatch("11 21 31", "%d+", -4) do
s = s + tonumber(k)
end
assert(s == 32)
-- there is an empty string at the end of the subject
s = 0
for k in string.gmatch("11 21 31", "%w*", 9) do
s = s + 1
end
assert(s == 1)
-- there are no empty strings after the end of the subject
s = 0
for k in string.gmatch("11 21 31", "%w*", 10) do
s = s + 1
end
assert(s == 0)
end
-- tests for `%f' (`frontiers')
assert(string.gsub("aaa aa a aaa a", "%f[%w]a", "x") == "xaa xa x xaa x")
assert(string.gsub("[[]] [][] [[[[", "%f[[].", "x") == "x[]] x]x] x[[[")
assert(string.gsub("01abc45de3", "%f[%d]", ".") == ".01abc.45de.3")
assert(string.gsub("01abc45 de3x", "%f[%D]%w", ".") == "01.bc45 de3.")
assert(string.gsub("function", "%f[\1-\255]%w", ".") == ".unction")
assert(string.gsub("function", "%f[^\1-\255]", ".") == "function.")
assert(string.find("a", "%f[a]") == 1)
assert(string.find("a", "%f[^%z]") == 1)
assert(string.find("a", "%f[^%l]") == 2)
assert(string.find("aba", "%f[a%z]") == 3)
assert(string.find("aba", "%f[%z]") == 4)
assert(not string.find("aba", "%f[%l%z]"))
assert(not string.find("aba", "%f[^%l%z]"))
local i, e = string.find(" alo aalo allo", "%f[%S].-%f[%s].-%f[%S]")
assert(i == 2 and e == 5)
local k = string.match(" alo aalo allo", "%f[%S](.-%f[%s].-%f[%S])")
assert(k == 'alo ')
local a = {1, 5, 9, 14, 17,}
for k in string.gmatch("alo alo th02 is 1hat", "()%f[%w%d]") do
assert(table.remove(a, 1) == k)
end
assert(#a == 0)
-- malformed patterns
local function malform (p, m)
m = m or "malformed"
local r, msg = pcall(string.find, "a", p)
assert(not r and string.find(msg, m))
end
malform("(.", "unfinished capture")
malform(".)", "invalid pattern capture")
malform("[a")
malform("[]")
malform("[^]")
malform("[a%]")
malform("[a%")
malform("%b")
malform("%ba")
malform("%")
malform("%f", "missing")
-- \0 in patterns
assert(string.match("ab\0\1\2c", "[\0-\2]+") == "\0\1\2")
assert(string.match("ab\0\1\2c", "[\0-\0]+") == "\0")
assert(string.find("b$a", "$\0?") == 2)
assert(string.find("abc\0efg", "%\0") == 4)
assert(string.match("abc\0efg\0\1e\1g", "%b\0\1") == "\0efg\0\1e\1")
assert(string.match("abc\0\0\0", "%\0+") == "\0\0\0")
assert(string.match("abc\0\0\0", "%\0%\0?") == "\0\0")
-- magic char after \0
assert(string.find("abc\0\0","\0.") == 4)
assert(string.find("abcx\0\0abc\0abc","x\0\0abc\0a.") == 4)
do -- test reuse of original string in gsub
local s = string.rep("a", 100)
local r = string.gsub(s, "b", "c") -- no match
assert(string.format("%p", s) == string.format("%p", r))
r = string.gsub(s, ".", {x = "y"}) -- no substitutions
assert(string.format("%p", s) == string.format("%p", r))
local count = 0
r = string.gsub(s, ".", function (x)
assert(x == "a")
count = count + 1
return nil -- no substitution
end)
r = string.gsub(r, ".", {b = 'x'}) -- "a" is not a key; no subst.
assert(count == 100)
assert(string.format("%p", s) == string.format("%p", r))
count = 0
r = string.gsub(s, ".", function (x)
assert(x == "a")
count = count + 1
return x -- substitution...
end)
assert(count == 100)
-- no reuse in this case
assert(r == s and string.format("%p", s) ~= string.format("%p", r))
end
print('OK')
| 13,268 | 422 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/packtests | NAME=$1"-tests"
ln -s . $NAME
ln -s .. ltests
tar --create --gzip --no-recursion --file=$NAME.tar.gz \
$NAME/all.lua \
$NAME/api.lua \
$NAME/attrib.lua \
$NAME/big.lua \
$NAME/bitwise.lua \
$NAME/bwcoercion.lua \
$NAME/calls.lua \
$NAME/closure.lua \
$NAME/code.lua \
$NAME/constructs.lua \
$NAME/coroutine.lua \
$NAME/cstack.lua \
$NAME/db.lua \
$NAME/errors.lua \
$NAME/events.lua \
$NAME/files.lua \
$NAME/gc.lua \
$NAME/gengc.lua \
$NAME/goto.lua \
$NAME/heavy.lua \
$NAME/literals.lua \
$NAME/locals.lua \
$NAME/main.lua \
$NAME/math.lua \
$NAME/nextvar.lua \
$NAME/pm.lua \
$NAME/sort.lua \
$NAME/strings.lua \
$NAME/tpack.lua \
$NAME/tracegc.lua \
$NAME/utf8.lua \
$NAME/vararg.lua \
$NAME/verybig.lua \
$NAME/libs/makefile \
$NAME/libs/P1 \
$NAME/libs/lib1.c \
$NAME/libs/lib11.c \
$NAME/libs/lib2.c \
$NAME/libs/lib21.c \
$NAME/libs/lib22.c \
$NAME/ltests/ltests.h \
$NAME/ltests/ltests.c
\rm -I $NAME
\rm -I ltests
echo ${NAME}.tar.gz" created"
| 1,001 | 56 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/big.lua | -- $Id: test/big.lua $
-- See Copyright Notice in file all.lua
if _soft then
return 'a'
end
print "testing large tables"
local debug = require"debug"
local lim = 2^18 + 1000
local prog = { "local y = {0" }
for i = 1, lim do prog[#prog + 1] = i end
prog[#prog + 1] = "}\n"
prog[#prog + 1] = "X = y\n"
prog[#prog + 1] = ("assert(X[%d] == %d)"):format(lim - 1, lim - 2)
prog[#prog + 1] = "return 0"
prog = table.concat(prog, ";")
local env = {string = string, assert = assert}
local f = assert(load(prog, nil, nil, env))
f()
assert(env.X[lim] == lim - 1 and env.X[lim + 1] == lim)
for k in pairs(env) do env[k] = undef end
-- yields during accesses larger than K (in RK)
setmetatable(env, {
__index = function (t, n) coroutine.yield('g'); return _G[n] end,
__newindex = function (t, n, v) coroutine.yield('s'); _G[n] = v end,
})
X = nil
co = coroutine.wrap(f)
assert(co() == 's')
assert(co() == 'g')
assert(co() == 'g')
assert(co() == 0)
assert(X[lim] == lim - 1 and X[lim + 1] == lim)
-- errors in accesses larger than K (in RK)
getmetatable(env).__index = function () end
getmetatable(env).__newindex = function () end
local e, m = pcall(f)
assert(not e and m:find("global 'X'"))
-- errors in metamethods
getmetatable(env).__newindex = function () error("hi") end
local e, m = xpcall(f, debug.traceback)
assert(not e and m:find("'newindex'"))
f, X = nil
coroutine.yield'b'
if 2^32 == 0 then -- (small integers) {
print "testing string length overflow"
local repstrings = 192 -- number of strings to be concatenated
local ssize = math.ceil(2.0^32 / repstrings) + 1 -- size of each string
assert(repstrings * ssize > 2.0^32) -- it should be larger than maximum size
local longs = string.rep("\0", ssize) -- create one long string
-- create function to concatenate 'repstrings' copies of its argument
local rep = assert(load(
"local a = ...; return " .. string.rep("a", repstrings, "..")))
local a, b = pcall(rep, longs) -- call that function
-- it should fail without creating string (result would be too large)
assert(not a and string.find(b, "overflow"))
end -- }
print'OK'
return 'a'
| 2,142 | 83 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/cstack.lua | -- $Id: test/cstack.lua $
-- See Copyright Notice in file all.lua
local tracegc = require"tracegc"
print"testing stack overflow detection"
-- Segmentation faults in these tests probably result from a C-stack
-- overflow. To avoid these errors, you should set a smaller limit for
-- the use of C stack by Lua, by changing the constant 'LUAI_MAXCCALLS'.
-- Alternatively, you can ensure a larger stack for the program.
local function checkerror (msg, f, ...)
local s, err = pcall(f, ...)
assert(not s and string.find(err, msg))
end
do print("testing stack overflow in message handling")
local count = 0
local function loop (x, y, z)
count = count + 1
return 1 + loop(x, y, z)
end
tracegc.stop() -- __gc should not be called with a full stack
local res, msg = xpcall(loop, loop)
tracegc.start()
assert(msg == "error in error handling")
print("final count: ", count)
end
-- bug since 2.5 (C-stack overflow in recursion inside pattern matching)
do print("testing recursion inside pattern matching")
local function f (size)
local s = string.rep("a", size)
local p = string.rep(".?", size)
return string.match(s, p)
end
local m = f(80)
assert(#m == 80)
checkerror("too complex", f, 2000)
end
do print("testing stack-overflow in recursive 'gsub'")
local count = 0
local function foo ()
count = count + 1
string.gsub("a", ".", foo)
end
checkerror("stack overflow", foo)
print("final count: ", count)
print("testing stack-overflow in recursive 'gsub' with metatables")
local count = 0
local t = setmetatable({}, {__index = foo})
foo = function ()
count = count + 1
string.gsub("a", ".", t)
end
checkerror("stack overflow", foo)
print("final count: ", count)
end
do -- bug in 5.4.0
print("testing limits in coroutines inside deep calls")
local count = 0
local lim = 1000
local function stack (n)
if n > 0 then return stack(n - 1) + 1
else coroutine.wrap(function ()
count = count + 1
stack(lim)
end)()
end
end
local st, msg = xpcall(stack, function () return "ok" end, lim)
assert(not st and msg == "ok")
print("final count: ", count)
end
do
print("nesting of resuming yielded coroutines")
local count = 0
local function body ()
coroutine.yield()
local f = coroutine.wrap(body)
f(); -- start new coroutine (will stop in previous yield)
count = count + 1
f() -- call it recursively
end
local f = coroutine.wrap(body)
f()
assert(not pcall(f))
print("final count: ", count)
end
if T then
print("testing stack recovery")
local N = 0 -- trace number of calls
local LIM = -1 -- will store N just before stack overflow
-- trace stack size; after stack overflow, it should be
-- the maximum allowed stack size.
local stack1
local dummy
local function err(msg)
assert(string.find(msg, "stack overflow"))
local _, stacknow = T.stacklevel()
assert(stacknow == stack1 + 200)
end
-- When LIM==-1, the 'if' is not executed, so this function only
-- counts and stores the stack limits up to overflow. Then, LIM
-- becomes N, and then the 'if' code is run when the stack is
-- full. Then, there is a stack overflow inside 'xpcall', after which
-- the stack must have been restored back to its maximum normal size.
local function f()
dummy, stack1 = T.stacklevel()
if N == LIM then
xpcall(f, err)
local _, stacknow = T.stacklevel()
assert(stacknow == stack1)
return
end
N = N + 1
f()
end
local topB, sizeB -- top and size Before overflow
local topA, sizeA -- top and size After overflow
topB, sizeB = T.stacklevel()
tracegc.stop() -- __gc should not be called with a full stack
xpcall(f, err)
tracegc.start()
topA, sizeA = T.stacklevel()
-- sizes should be comparable
assert(topA == topB and sizeA < sizeB * 2)
print(string.format("maximum stack size: %d", stack1))
LIM = N -- will stop recursion at maximum level
N = 0 -- to count again
tracegc.stop() -- __gc should not be called with a full stack
f()
tracegc.start()
print"+"
end
print'OK'
| 4,187 | 158 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/db.lua | -- $Id: test/db.lua $
-- See Copyright Notice in file all.lua
-- testing debug library
local debug = require "debug"
local function dostring(s) return assert(load(s))() end
print"testing debug library and debug information"
do
local a=1
end
assert(not debug.gethook())
local testline = 19 -- line where 'test' is defined
function test (s, l, p) -- this must be line 19
collectgarbage() -- avoid gc during trace
local function f (event, line)
assert(event == 'line')
local l = table.remove(l, 1)
if p then print(l, line) end
assert(l == line, "wrong trace!!")
end
debug.sethook(f,"l"); load(s)(); debug.sethook()
assert(#l == 0)
end
do
assert(not pcall(debug.getinfo, print, "X")) -- invalid option
assert(not pcall(debug.getinfo, 0, ">")) -- invalid option
assert(not debug.getinfo(1000)) -- out of range level
assert(not debug.getinfo(-1)) -- out of range level
local a = debug.getinfo(print)
assert(a.what == "C" and a.short_src == "[C]")
a = debug.getinfo(print, "L")
assert(a.activelines == nil)
local b = debug.getinfo(test, "SfL")
assert(b.name == nil and b.what == "Lua" and b.linedefined == testline and
b.lastlinedefined == b.linedefined + 10 and
b.func == test and not string.find(b.short_src, "%["))
assert(b.activelines[b.linedefined + 1] and
b.activelines[b.lastlinedefined])
assert(not b.activelines[b.linedefined] and
not b.activelines[b.lastlinedefined + 1])
end
-- test file and string names truncation
a = "function f () end"
local function dostring (s, x) return load(s, x)() end
dostring(a)
assert(debug.getinfo(f).short_src == string.format('[string "%s"]', a))
dostring(a..string.format("; %s\n=1", string.rep('p', 400)))
assert(string.find(debug.getinfo(f).short_src, '^%[string [^\n]*%.%.%."%]$'))
dostring(a..string.format("; %s=1", string.rep('p', 400)))
assert(string.find(debug.getinfo(f).short_src, '^%[string [^\n]*%.%.%."%]$'))
dostring("\n"..a)
assert(debug.getinfo(f).short_src == '[string "..."]')
dostring(a, "")
assert(debug.getinfo(f).short_src == '[string ""]')
dostring(a, "@xuxu")
assert(debug.getinfo(f).short_src == "xuxu")
dostring(a, "@"..string.rep('p', 1000)..'t')
assert(string.find(debug.getinfo(f).short_src, "^%.%.%.p*t$"))
dostring(a, "=xuxu")
assert(debug.getinfo(f).short_src == "xuxu")
dostring(a, string.format("=%s", string.rep('x', 500)))
assert(string.find(debug.getinfo(f).short_src, "^x*$"))
dostring(a, "=")
assert(debug.getinfo(f).short_src == "")
a = nil; f = nil;
repeat
local g = {x = function ()
local a = debug.getinfo(2)
assert(a.name == 'f' and a.namewhat == 'local')
a = debug.getinfo(1)
assert(a.name == 'x' and a.namewhat == 'field')
return 'xixi'
end}
local f = function () return 1+1 and (not 1 or g.x()) end
assert(f() == 'xixi')
g = debug.getinfo(f)
assert(g.what == "Lua" and g.func == f and g.namewhat == "" and not g.name)
function f (x, name) -- local!
name = name or 'f'
local a = debug.getinfo(1)
assert(a.name == name and a.namewhat == 'local')
return x
end
-- breaks in different conditions
if 3>4 then break end; f()
if 3<4 then a=1 else break end; f()
while 1 do local x=10; break end; f()
local b = 1
if 3>4 then return math.sin(1) end; f()
a = 3<4; f()
a = 3<4 or 1; f()
repeat local x=20; if 4>3 then f() else break end; f() until 1
g = {}
f(g).x = f(2) and f(10)+f(9)
assert(g.x == f(19))
function g(x) if not x then return 3 end return (x('a', 'x')) end
assert(g(f) == 'a')
until 1
test([[if
math.sin(1)
then
a=1
else
a=2
end
]], {2,3,4,7})
test([[
local function foo()
end
foo()
A = 1
A = 2
A = 3
]], {2, 3, 2, 4, 5, 6})
test([[--
if nil then
a=1
else
a=2
end
]], {2,5,6})
test([[a=1
repeat
a=a+1
until a==3
]], {1,3,4,3,4})
test([[ do
return
end
]], {2})
test([[local a
a=1
while a<=3 do
a=a+1
end
]], {1,2,3,4,3,4,3,4,3,5})
test([[while math.sin(1) do
if math.sin(1)
then break
end
end
a=1]], {1,2,3,6})
test([[for i=1,3 do
a=i
end
]], {1,2,1,2,1,2,1,3})
test([[for i,v in pairs{'a','b'} do
a=tostring(i) .. v
end
]], {1,2,1,2,1,3})
test([[for i=1,4 do a=1 end]], {1,1,1,1})
do -- testing line info/trace with large gaps in source
local a = {1, 2, 3, 10, 124, 125, 126, 127, 128, 129, 130,
255, 256, 257, 500, 1000}
local s = [[
local b = {10}
a = b[1] X + Y b[1]
b = 4
]]
for _, i in ipairs(a) do
local subs = {X = string.rep("\n", i)}
for _, j in ipairs(a) do
subs.Y = string.rep("\n", j)
local s = string.gsub(s, "[XY]", subs)
test(s, {1, 2 + i, 2 + i + j, 2 + i, 2 + i + j, 3 + i + j})
end
end
end
print'+'
-- invalid levels in [gs]etlocal
assert(not pcall(debug.getlocal, 20, 1))
assert(not pcall(debug.setlocal, -1, 1, 10))
-- parameter names
local function foo (a,b,...) local d, e end
local co = coroutine.create(foo)
assert(debug.getlocal(foo, 1) == 'a')
assert(debug.getlocal(foo, 2) == 'b')
assert(not debug.getlocal(foo, 3))
assert(debug.getlocal(co, foo, 1) == 'a')
assert(debug.getlocal(co, foo, 2) == 'b')
assert(not debug.getlocal(co, foo, 3))
assert(not debug.getlocal(print, 1))
local function foo () return (debug.getlocal(1, -1)) end
assert(not foo(10))
-- varargs
local function foo (a, ...)
local t = table.pack(...)
for i = 1, t.n do
local n, v = debug.getlocal(1, -i)
assert(n == "(vararg)" and v == t[i])
end
assert(not debug.getlocal(1, -(t.n + 1)))
assert(not debug.setlocal(1, -(t.n + 1), 30))
if t.n > 0 then
(function (x)
assert(debug.setlocal(2, -1, x) == "(vararg)")
assert(debug.setlocal(2, -t.n, x) == "(vararg)")
end)(430)
assert(... == 430)
end
end
foo()
foo(print)
foo(200, 3, 4)
local a = {}
for i = 1, (_soft and 100 or 1000) do a[i] = i end
foo(table.unpack(a))
a = nil
do -- test hook presence in debug info
assert(not debug.gethook())
local count = 0
local function f ()
assert(debug.getinfo(1).namewhat == "hook")
local sndline = string.match(debug.traceback(), "\n(.-)\n")
assert(string.find(sndline, "hook"))
count = count + 1
end
debug.sethook(f, "l")
local a = 0
_ENV.a = a
a = 1
debug.sethook()
assert(count == 4)
end
-- hook table has weak keys
assert(getmetatable(debug.getregistry()._HOOKKEY).__mode == 'k')
a = {}; L = nil
local glob = 1
local oldglob = glob
debug.sethook(function (e,l)
collectgarbage() -- force GC during a hook
local f, m, c = debug.gethook()
assert(m == 'crl' and c == 0)
if e == "line" then
if glob ~= oldglob then
L = l-1 -- get the first line where "glob" has changed
oldglob = glob
end
elseif e == "call" then
local f = debug.getinfo(2, "f").func
a[f] = 1
else assert(e == "return")
end
end, "crl")
function f(a,b)
collectgarbage()
local _, x = debug.getlocal(1, 1)
local _, y = debug.getlocal(1, 2)
assert(x == a and y == b)
assert(debug.setlocal(2, 3, "pera") == "AA".."AA")
assert(debug.setlocal(2, 4, "maçã") == "B")
x = debug.getinfo(2)
assert(x.func == g and x.what == "Lua" and x.name == 'g' and
x.nups == 2 and string.find(x.source, "^@.*db%.lua$"))
glob = glob+1
assert(debug.getinfo(1, "l").currentline == L+1)
assert(debug.getinfo(1, "l").currentline == L+2)
end
function foo()
glob = glob+1
assert(debug.getinfo(1, "l").currentline == L+1)
end; foo() -- set L
-- check line counting inside strings and empty lines
_ = 'alo\
alo' .. [[
]]
--[[
]]
assert(debug.getinfo(1, "l").currentline == L+11) -- check count of lines
function g (...)
local arg = {...}
do local a,b,c; a=math.sin(40); end
local feijao
local AAAA,B = "xuxu", "mamão"
f(AAAA,B)
assert(AAAA == "pera" and B == "maçã")
do
local B = 13
local x,y = debug.getlocal(1,5)
assert(x == 'B' and y == 13)
end
end
g()
assert(a[f] and a[g] and a[assert] and a[debug.getlocal] and not a[print])
-- tests for manipulating non-registered locals (C and Lua temporaries)
local n, v = debug.getlocal(0, 1)
assert(v == 0 and n == "(C temporary)")
local n, v = debug.getlocal(0, 2)
assert(v == 2 and n == "(C temporary)")
assert(not debug.getlocal(0, 3))
assert(not debug.getlocal(0, 0))
function f()
assert(select(2, debug.getlocal(2,3)) == 1)
assert(not debug.getlocal(2,4))
debug.setlocal(2, 3, 10)
return 20
end
function g(a,b) return (a+1) + f() end
assert(g(0,0) == 30)
debug.sethook(nil);
assert(not debug.gethook())
-- minimal tests for setuservalue/getuservalue
do
assert(not debug.setuservalue(io.stdin, 10))
local a, b = debug.getuservalue(io.stdin, 10)
assert(a == nil and not b)
end
-- testing iteraction between multiple values x hooks
do
local function f(...) return 3, ... end
local count = 0
local a = {}
for i = 1, 100 do a[i] = i end
debug.sethook(function () count = count + 1 end, "", 1)
local t = {table.unpack(a)}
assert(#t == 100)
t = {table.unpack(a, 1, 3)}
assert(#t == 3)
t = {f(table.unpack(a, 1, 30))}
assert(#t == 31)
end
-- testing access to function arguments
local function collectlocals (level)
local tab = {}
for i = 1, math.huge do
local n, v = debug.getlocal(level + 1, i)
if not (n and string.find(n, "^[a-zA-Z0-9_]+$")) then
break -- consider only real variables
end
tab[n] = v
end
return tab
end
X = nil
a = {}
function a:f (a, b, ...) local arg = {...}; local c = 13 end
debug.sethook(function (e)
assert(e == "call")
dostring("XX = 12") -- test dostring inside hooks
-- testing errors inside hooks
assert(not pcall(load("a='joao'+1")))
debug.sethook(function (e, l)
assert(debug.getinfo(2, "l").currentline == l)
local f,m,c = debug.gethook()
assert(e == "line")
assert(m == 'l' and c == 0)
debug.sethook(nil) -- hook is called only once
assert(not X) -- check that
X = collectlocals(2)
end, "l")
end, "c")
a:f(1,2,3,4,5)
assert(X.self == a and X.a == 1 and X.b == 2 and X.c == nil)
assert(XX == 12)
assert(not debug.gethook())
-- testing access to local variables in return hook (bug in 5.2)
do
local X = false
local function foo (a, b, ...)
do local x,y,z end
local c, d = 10, 20
return
end
local function aux ()
if debug.getinfo(2).name == "foo" then
X = true -- to signal that it found 'foo'
local tab = {a = 100, b = 200, c = 10, d = 20}
for n, v in pairs(collectlocals(2)) do
assert(tab[n] == v)
tab[n] = undef
end
assert(next(tab) == nil) -- 'tab' must be empty
end
end
debug.sethook(aux, "r"); foo(100, 200); debug.sethook()
assert(X)
end
local function eqseq (t1, t2)
assert(#t1 == #t2)
for i = 1, #t1 do
assert(t1[i] == t2[i])
end
end
do print("testing inspection of parameters/returned values")
local on = false
local inp, out
local function hook (event)
if not on then return end
local ar = debug.getinfo(2, "ruS")
local t = {}
for i = ar.ftransfer, ar.ftransfer + ar.ntransfer - 1 do
local _, v = debug.getlocal(2, i)
t[#t + 1] = v
end
if event == "return" then
out = t
else
inp = t
end
end
debug.sethook(hook, "cr")
on = true; math.sin(3); on = false
eqseq(inp, {3}); eqseq(out, {math.sin(3)})
on = true; select(2, 10, 20, 30, 40); on = false
eqseq(inp, {2, 10, 20, 30, 40}); eqseq(out, {20, 30, 40})
local function foo (a, ...) return ... end
local function foo1 () on = not on; return foo(20, 10, 0) end
foo1(); on = false
eqseq(inp, {20}); eqseq(out, {10, 0})
debug.sethook()
end
-- testing upvalue access
local function getupvalues (f)
local t = {}
local i = 1
while true do
local name, value = debug.getupvalue(f, i)
if not name then break end
assert(not t[name])
t[name] = value
i = i + 1
end
return t
end
local a,b,c = 1,2,3
local function foo1 (a) b = a; return c end
local function foo2 (x) a = x; return c+b end
assert(not debug.getupvalue(foo1, 3))
assert(not debug.getupvalue(foo1, 0))
assert(not debug.setupvalue(foo1, 3, "xuxu"))
local t = getupvalues(foo1)
assert(t.a == nil and t.b == 2 and t.c == 3)
t = getupvalues(foo2)
assert(t.a == 1 and t.b == 2 and t.c == 3)
assert(debug.setupvalue(foo1, 1, "xuxu") == "b")
assert(({debug.getupvalue(foo2, 3)})[2] == "xuxu")
-- upvalues of C functions are allways "called" "" (the empty string)
assert(debug.getupvalue(string.gmatch("x", "x"), 1) == "")
-- testing count hooks
local a=0
debug.sethook(function (e) a=a+1 end, "", 1)
a=0; for i=1,1000 do end; assert(1000 < a and a < 1012)
debug.sethook(function (e) a=a+1 end, "", 4)
a=0; for i=1,1000 do end; assert(250 < a and a < 255)
local f,m,c = debug.gethook()
assert(m == "" and c == 4)
debug.sethook(function (e) a=a+1 end, "", 4000)
a=0; for i=1,1000 do end; assert(a == 0)
do
debug.sethook(print, "", 2^24 - 1) -- count upperbound
local f,m,c = debug.gethook()
assert(({debug.gethook()})[3] == 2^24 - 1)
end
debug.sethook()
-- tests for tail calls
local function f (x)
if x then
assert(debug.getinfo(1, "S").what == "Lua")
assert(debug.getinfo(1, "t").istailcall == true)
local tail = debug.getinfo(2)
assert(tail.func == g1 and tail.istailcall == true)
assert(debug.getinfo(3, "S").what == "main")
print"+"
end
end
function g(x) return f(x) end
function g1(x) g(x) end
local function h (x) local f=g1; return f(x) end
h(true)
local b = {}
debug.sethook(function (e) table.insert(b, e) end, "cr")
h(false)
debug.sethook()
local res = {"return", -- first return (from sethook)
"call", "tail call", "call", "tail call",
"return", "return",
"call", -- last call (to sethook)
}
for i = 1, #res do assert(res[i] == table.remove(b, 1)) end
b = 0
debug.sethook(function (e)
if e == "tail call" then
b = b + 1
assert(debug.getinfo(2, "t").istailcall == true)
else
assert(debug.getinfo(2, "t").istailcall == false)
end
end, "c")
h(false)
debug.sethook()
assert(b == 2) -- two tail calls
lim = _soft and 3000 or 30000
local function foo (x)
if x==0 then
assert(debug.getinfo(2).what == "main")
local info = debug.getinfo(1)
assert(info.istailcall == true and info.func == foo)
else return foo(x-1)
end
end
foo(lim)
print"+"
-- testing local function information
co = load[[
local A = function ()
return x
end
return
]]
local a = 0
-- 'A' should be visible to debugger only after its complete definition
debug.sethook(function (e, l)
if l == 3 then a = a + 1; assert(debug.getlocal(2, 1) == "(temporary)")
elseif l == 4 then a = a + 1; assert(debug.getlocal(2, 1) == "A")
end
end, "l")
co() -- run local function definition
debug.sethook() -- turn off hook
assert(a == 2) -- ensure all two lines where hooked
-- testing traceback
assert(debug.traceback(print) == print)
assert(debug.traceback(print, 4) == print)
assert(string.find(debug.traceback("hi", 4), "^hi\n"))
assert(string.find(debug.traceback("hi"), "^hi\n"))
assert(not string.find(debug.traceback("hi"), "'debug.traceback'"))
assert(string.find(debug.traceback("hi", 0), "'debug.traceback'"))
assert(string.find(debug.traceback(), "^stack traceback:\n"))
do -- C-function names in traceback
local st, msg = (function () return pcall end)()(debug.traceback)
assert(st == true and string.find(msg, "pcall"))
end
-- testing nparams, nups e isvararg
local t = debug.getinfo(print, "u")
assert(t.isvararg == true and t.nparams == 0 and t.nups == 0)
t = debug.getinfo(function (a,b,c) end, "u")
assert(t.isvararg == false and t.nparams == 3 and t.nups == 0)
t = debug.getinfo(function (a,b,...) return t[a] end, "u")
assert(t.isvararg == true and t.nparams == 2 and t.nups == 1)
t = debug.getinfo(1) -- main
assert(t.isvararg == true and t.nparams == 0 and t.nups == 1 and
debug.getupvalue(t.func, 1) == "_ENV")
t = debug.getinfo(math.sin) -- C function
assert(t.isvararg == true and t.nparams == 0 and t.nups == 0)
t = debug.getinfo(string.gmatch("abc", "a")) -- C closure
assert(t.isvararg == true and t.nparams == 0 and t.nups > 0)
-- testing debugging of coroutines
local function checktraceback (co, p, level)
local tb = debug.traceback(co, nil, level)
local i = 0
for l in string.gmatch(tb, "[^\n]+\n?") do
assert(i == 0 or string.find(l, p[i]))
i = i+1
end
assert(p[i] == undef)
end
local function f (n)
if n > 0 then f(n-1)
else coroutine.yield() end
end
local co = coroutine.create(f)
coroutine.resume(co, 3)
checktraceback(co, {"yield", "db.lua", "db.lua", "db.lua", "db.lua"})
checktraceback(co, {"db.lua", "db.lua", "db.lua", "db.lua"}, 1)
checktraceback(co, {"db.lua", "db.lua", "db.lua"}, 2)
checktraceback(co, {"db.lua"}, 4)
checktraceback(co, {}, 40)
co = coroutine.create(function (x)
local a = 1
coroutine.yield(debug.getinfo(1, "l"))
coroutine.yield(debug.getinfo(1, "l").currentline)
return a
end)
local tr = {}
local foo = function (e, l) if l then table.insert(tr, l) end end
debug.sethook(co, foo, "lcr")
local _, l = coroutine.resume(co, 10)
local x = debug.getinfo(co, 1, "lfLS")
assert(x.currentline == l.currentline and x.activelines[x.currentline])
assert(type(x.func) == "function")
for i=x.linedefined + 1, x.lastlinedefined do
assert(x.activelines[i])
x.activelines[i] = undef
end
assert(next(x.activelines) == nil) -- no 'extra' elements
assert(not debug.getinfo(co, 2))
local a,b = debug.getlocal(co, 1, 1)
assert(a == "x" and b == 10)
a,b = debug.getlocal(co, 1, 2)
assert(a == "a" and b == 1)
debug.setlocal(co, 1, 2, "hi")
assert(debug.gethook(co) == foo)
assert(#tr == 2 and
tr[1] == l.currentline-1 and tr[2] == l.currentline)
a,b,c = pcall(coroutine.resume, co)
assert(a and b and c == l.currentline+1)
checktraceback(co, {"yield", "in function <"})
a,b = coroutine.resume(co)
assert(a and b == "hi")
assert(#tr == 4 and tr[4] == l.currentline+2)
assert(debug.gethook(co) == foo)
assert(not debug.gethook())
checktraceback(co, {})
-- check get/setlocal in coroutines
co = coroutine.create(function (x)
local a, b = coroutine.yield(x)
assert(a == 100 and b == nil)
return x
end)
a, b = coroutine.resume(co, 10)
assert(a and b == 10)
a, b = debug.getlocal(co, 1, 1)
assert(a == "x" and b == 10)
assert(not debug.getlocal(co, 1, 5))
assert(debug.setlocal(co, 1, 1, 30) == "x")
assert(not debug.setlocal(co, 1, 5, 40))
a, b = coroutine.resume(co, 100)
assert(a and b == 30)
-- check traceback of suspended (or dead with error) coroutines
function f(i)
if i == 0 then error(i)
else coroutine.yield(); f(i-1)
end
end
co = coroutine.create(function (x) f(x) end)
a, b = coroutine.resume(co, 3)
t = {"'coroutine.yield'", "'f'", "in function <"}
while coroutine.status(co) == "suspended" do
checktraceback(co, t)
a, b = coroutine.resume(co)
table.insert(t, 2, "'f'") -- one more recursive call to 'f'
end
t[1] = "'error'"
checktraceback(co, t)
-- test acessing line numbers of a coroutine from a resume inside
-- a C function (this is a known bug in Lua 5.0)
local function g(x)
coroutine.yield(x)
end
local function f (i)
debug.sethook(function () end, "l")
for j=1,1000 do
g(i+j)
end
end
local co = coroutine.wrap(f)
co(10)
pcall(co)
pcall(co)
assert(type(debug.getregistry()) == "table")
-- test tagmethod information
local a = {}
local function f (t)
local info = debug.getinfo(1);
assert(info.namewhat == "metamethod")
a.op = info.name
return info.name
end
setmetatable(a, {
__index = f; __add = f; __div = f; __mod = f; __concat = f; __pow = f;
__mul = f; __idiv = f; __unm = f; __len = f; __sub = f;
__shl = f; __shr = f; __bor = f; __bxor = f;
__eq = f; __le = f; __lt = f; __unm = f; __len = f; __band = f;
__bnot = f;
})
local b = setmetatable({}, getmetatable(a))
assert(a[3] == "index" and a^3 == "pow" and a..a == "concat")
assert(a/3 == "div" and 3%a == "mod")
assert(a+3 == "add" and 3-a == "sub" and a*3 == "mul" and
-a == "unm" and #a == "len" and a&3 == "band")
assert(a + 30000 == "add" and a - 3.0 == "sub" and a * 3.0 == "mul" and
-a == "unm" and #a == "len" and a & 3 == "band")
assert(a|3 == "bor" and 3~a == "bxor" and a<<3 == "shl" and a>>1 == "shr")
assert (a==b and a.op == "eq")
assert (a>=b and a.op == "le")
assert ("x">=a and a.op == "le")
assert (a>b and a.op == "lt")
assert (a>10 and a.op == "lt")
assert(~a == "bnot")
do -- testing for-iterator name
local function f()
assert(debug.getinfo(1).name == "for iterator")
end
for i in f do end
end
do -- testing debug info for finalizers
local name = nil
-- create a piece of garbage with a finalizer
setmetatable({}, {__gc = function ()
local t = debug.getinfo(2) -- get callee information
assert(t.namewhat == "metamethod")
name = t.name
end})
-- repeat until previous finalizer runs (setting 'name')
repeat local a = {} until name
assert(name == "__gc")
end
do
print("testing traceback sizes")
local function countlines (s)
return select(2, string.gsub(s, "\n", ""))
end
local function deep (lvl, n)
if lvl == 0 then
return (debug.traceback("message", n))
else
return (deep(lvl-1, n))
end
end
local function checkdeep (total, start)
local s = deep(total, start)
local rest = string.match(s, "^message\nstack traceback:\n(.*)$")
local cl = countlines(rest)
-- at most 10 lines in first part, 11 in second, plus '...'
assert(cl <= 10 + 11 + 1)
local brk = string.find(rest, "%.%.%.")
if brk then -- does message have '...'?
local rest1 = string.sub(rest, 1, brk)
local rest2 = string.sub(rest, brk, #rest)
assert(countlines(rest1) == 10 and countlines(rest2) == 11)
else
assert(cl == total - start + 2)
end
end
for d = 1, 51, 10 do
for l = 1, d do
-- use coroutines to ensure complete control of the stack
coroutine.wrap(checkdeep)(d, l)
end
end
end
print("testing debug functions on chunk without debug info")
prog = [[-- program to be loaded without debug information (strip)
local debug = require'debug'
local a = 12 -- a local variable
local n, v = debug.getlocal(1, 1)
assert(n == "(temporary)" and v == debug) -- unkown name but known value
n, v = debug.getlocal(1, 2)
assert(n == "(temporary)" and v == 12) -- unkown name but known value
-- a function with an upvalue
local f = function () local x; return a end
n, v = debug.getupvalue(f, 1)
assert(n == "(no name)" and v == 12)
assert(debug.setupvalue(f, 1, 13) == "(no name)")
assert(a == 13)
local t = debug.getinfo(f)
assert(t.name == nil and t.linedefined > 0 and
t.lastlinedefined == t.linedefined and
t.short_src == "?")
assert(debug.getinfo(1).currentline == -1)
t = debug.getinfo(f, "L").activelines
assert(next(t) == nil) -- active lines are empty
-- dump/load a function without debug info
f = load(string.dump(f))
t = debug.getinfo(f)
assert(t.name == nil and t.linedefined > 0 and
t.lastlinedefined == t.linedefined and
t.short_src == "?")
assert(debug.getinfo(1).currentline == -1)
return a
]]
-- load 'prog' without debug info
local f = assert(load(string.dump(load(prog), true)))
assert(f() == 13)
do -- bug in 5.4.0: line hooks in stripped code
local function foo ()
local a = 1
local b = 2
return b
end
local s = load(string.dump(foo, true))
local line = true
debug.sethook(function (e, l)
assert(e == "line")
line = l
end, "l")
assert(s() == 2); debug.sethook(nil)
assert(line == nil) -- hook called withoug debug info for 1st instruction
end
do -- tests for 'source' in binary dumps
local prog = [[
return function (x)
return function (y)
return x + y
end
end
]]
local name = string.rep("x", 1000)
local p = assert(load(prog, name))
-- load 'p' as a binary chunk with debug information
local c = string.dump(p)
assert(#c > 1000 and #c < 2000) -- no repetition of 'source' in dump
local f = assert(load(c))
local g = f()
local h = g(3)
assert(h(5) == 8)
assert(debug.getinfo(f).source == name and -- all functions have 'source'
debug.getinfo(g).source == name and
debug.getinfo(h).source == name)
-- again, without debug info
local c = string.dump(p, true)
assert(#c < 500) -- no 'source' in dump
local f = assert(load(c))
local g = f()
local h = g(30)
assert(h(50) == 80)
assert(debug.getinfo(f).source == '=?' and -- no function has 'source'
debug.getinfo(g).source == '=?' and
debug.getinfo(h).source == '=?')
end
print"OK"
| 24,788 | 994 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/files.lua | -- $Id: test/files.lua $
-- See Copyright Notice in file all.lua
local debug = require "debug"
local maxint = math.maxinteger
assert(type(os.getenv"PATH") == "string")
assert(io.input(io.stdin) == io.stdin)
assert(not pcall(io.input, "non-existent-file"))
assert(io.output(io.stdout) == io.stdout)
local function testerr (msg, f, ...)
local stat, err = pcall(f, ...)
return (not stat and string.find(err, msg, 1, true))
end
local function checkerr (msg, f, ...)
assert(testerr(msg, f, ...))
end
-- cannot close standard files
assert(not io.close(io.stdin) and
not io.stdout:close() and
not io.stderr:close())
-- cannot call close method without an argument (new in 5.3.5)
checkerr("got no value", io.stdin.close)
assert(type(io.input()) == "userdata" and io.type(io.output()) == "file")
assert(type(io.stdin) == "userdata" and io.type(io.stderr) == "file")
assert(not io.type(8))
local a = {}; setmetatable(a, {})
assert(not io.type(a))
assert(getmetatable(io.input()).__name == "FILE*")
local a,b,c = io.open('xuxu_nao_existe')
assert(not a and type(b) == "string" and type(c) == "number")
a,b,c = io.open('/a/b/c/d', 'w')
assert(not a and type(b) == "string" and type(c) == "number")
local file = os.tmpname()
local f, msg = io.open(file, "w")
if not f then
(Message or print)("'os.tmpname' file cannot be open; skipping file tests")
else --{ most tests here need tmpname
f:close()
print('testing i/o')
local otherfile = os.tmpname()
checkerr("invalid mode", io.open, file, "rw")
checkerr("invalid mode", io.open, file, "rb+")
checkerr("invalid mode", io.open, file, "r+bk")
checkerr("invalid mode", io.open, file, "")
checkerr("invalid mode", io.open, file, "+")
checkerr("invalid mode", io.open, file, "b")
assert(io.open(file, "r+b")):close()
assert(io.open(file, "r+")):close()
assert(io.open(file, "rb")):close()
assert(os.setlocale('C', 'all'))
io.input(io.stdin); io.output(io.stdout);
os.remove(file)
assert(not loadfile(file))
checkerr("", dofile, file)
assert(not io.open(file))
io.output(file)
assert(io.output() ~= io.stdout)
if not _port then -- invalid seek
local status, msg, code = io.stdin:seek("set", 1000)
assert(not status and type(msg) == "string" and type(code) == "number")
end
assert(io.output():seek() == 0)
assert(io.write("alo alo"):seek() == string.len("alo alo"))
assert(io.output():seek("cur", -3) == string.len("alo alo")-3)
assert(io.write("joao"))
assert(io.output():seek("end") == string.len("alo joao"))
assert(io.output():seek("set") == 0)
assert(io.write('"álo"', "{a}\n", "second line\n", "third line \n"))
assert(io.write('çfourth_line'))
io.output(io.stdout)
collectgarbage() -- file should be closed by GC
assert(io.input() == io.stdin and rawequal(io.output(), io.stdout))
print('+')
-- test GC for files
collectgarbage()
for i=1,120 do
for i=1,5 do
io.input(file)
assert(io.open(file, 'r'))
io.lines(file)
end
collectgarbage()
end
io.input():close()
io.close()
assert(os.rename(file, otherfile))
assert(not os.rename(file, otherfile))
io.output(io.open(otherfile, "ab"))
assert(io.write("\n\n\t\t ", 3450, "\n"));
io.close()
do
-- closing file by scope
local F = nil
do
local f <close> = assert(io.open(file, "w"))
F = f
end
assert(tostring(F) == "file (closed)")
end
assert(os.remove(file))
do
-- test writing/reading numbers
local f <close> = assert(io.open(file, "w"))
f:write(maxint, '\n')
f:write(string.format("0X%x\n", maxint))
f:write("0xABCp-3", '\n')
f:write(0, '\n')
f:write(-maxint, '\n')
f:write(string.format("0x%X\n", -maxint))
f:write("-0xABCp-3", '\n')
assert(f:close())
local f <close> = assert(io.open(file, "r"))
assert(f:read("n") == maxint)
assert(f:read("n") == maxint)
assert(f:read("n") == 0xABCp-3)
assert(f:read("n") == 0)
assert(f:read("*n") == -maxint) -- test old format (with '*')
assert(f:read("n") == -maxint)
assert(f:read("*n") == -0xABCp-3) -- test old format (with '*')
end
assert(os.remove(file))
-- testing multiple arguments to io.read
do
local f <close> = assert(io.open(file, "w"))
f:write[[
a line
another line
1234
3.45
one
two
three
]]
local l1, l2, l3, l4, n1, n2, c, dummy
assert(f:close())
local f <close> = assert(io.open(file, "r"))
l1, l2, n1, n2, dummy = f:read("l", "L", "n", "n")
assert(l1 == "a line" and l2 == "another line\n" and
n1 == 1234 and n2 == 3.45 and dummy == nil)
assert(f:close())
local f <close> = assert(io.open(file, "r"))
l1, l2, n1, n2, c, l3, l4, dummy = f:read(7, "l", "n", "n", 1, "l", "l")
assert(l1 == "a line\n" and l2 == "another line" and c == '\n' and
n1 == 1234 and n2 == 3.45 and l3 == "one" and l4 == "two"
and dummy == nil)
assert(f:close())
local f <close> = assert(io.open(file, "r"))
-- second item failing
l1, n1, n2, dummy = f:read("l", "n", "n", "l")
assert(l1 == "a line" and not n1)
end
assert(os.remove(file))
-- test yielding during 'dofile'
f = assert(io.open(file, "w"))
f:write[[
local x, z = coroutine.yield(10)
local y = coroutine.yield(20)
return x + y * z
]]
assert(f:close())
f = coroutine.wrap(dofile)
assert(f(file) == 10)
assert(f(100, 101) == 20)
assert(f(200) == 100 + 200 * 101)
assert(os.remove(file))
f = assert(io.open(file, "w"))
-- test number termination
f:write[[
-12.3- -0xffff+ .3|5.E-3X +234e+13E 0xDEADBEEFDEADBEEFx
0x1.13Ap+3e
]]
-- very long number
f:write("1234"); for i = 1, 1000 do f:write("0") end; f:write("\n")
-- invalid sequences (must read and discard valid prefixes)
f:write[[
.e+ 0.e; --; 0xX;
]]
assert(f:close())
f = assert(io.open(file, "r"))
assert(f:read("n") == -12.3); assert(f:read(1) == "-")
assert(f:read("n") == -0xffff); assert(f:read(2) == "+ ")
assert(f:read("n") == 0.3); assert(f:read(1) == "|")
assert(f:read("n") == 5e-3); assert(f:read(1) == "X")
assert(f:read("n") == 234e13); assert(f:read(1) == "E")
assert(f:read("n") == 0Xdeadbeefdeadbeef); assert(f:read(2) == "x\n")
assert(f:read("n") == 0x1.13aP3); assert(f:read(1) == "e")
do -- attempt to read too long number
assert(not f:read("n")) -- fails
local s = f:read("L") -- read rest of line
assert(string.find(s, "^00*\n$")) -- lots of 0's left
end
assert(not f:read("n")); assert(f:read(2) == "e+")
assert(not f:read("n")); assert(f:read(1) == ";")
assert(not f:read("n")); assert(f:read(2) == "-;")
assert(not f:read("n")); assert(f:read(1) == "X")
assert(not f:read("n")); assert(f:read(1) == ";")
assert(not f:read("n")); assert(not f:read(0)) -- end of file
assert(f:close())
assert(os.remove(file))
-- test line generators
assert(not pcall(io.lines, "non-existent-file"))
assert(os.rename(otherfile, file))
io.output(otherfile)
local n = 0
local f = io.lines(file)
while f() do n = n + 1 end;
assert(n == 6) -- number of lines in the file
checkerr("file is already closed", f)
checkerr("file is already closed", f)
-- copy from file to otherfile
n = 0
for l in io.lines(file) do io.write(l, "\n"); n = n + 1 end
io.close()
assert(n == 6)
-- copy from otherfile back to file
local f = assert(io.open(otherfile))
assert(io.type(f) == "file")
io.output(file)
assert(not io.output():read())
n = 0
for l in f:lines() do io.write(l, "\n"); n = n + 1 end
assert(tostring(f):sub(1, 5) == "file ")
assert(f:close()); io.close()
assert(n == 6)
checkerr("closed file", io.close, f)
assert(tostring(f) == "file (closed)")
assert(io.type(f) == "closed file")
io.input(file)
f = io.open(otherfile):lines()
n = 0
for l in io.lines() do assert(l == f()); n = n + 1 end
f = nil; collectgarbage()
assert(n == 6)
assert(os.remove(otherfile))
do -- bug in 5.3.1
io.output(otherfile)
io.write(string.rep("a", 300), "\n")
io.close()
local t ={}; for i = 1, 250 do t[i] = 1 end
t = {io.lines(otherfile, table.unpack(t))()}
-- everything ok here
assert(#t == 250 and t[1] == 'a' and t[#t] == 'a')
t[#t + 1] = 1 -- one too many
checkerr("too many arguments", io.lines, otherfile, table.unpack(t))
collectgarbage() -- ensure 'otherfile' is closed
assert(os.remove(otherfile))
end
io.input(file)
do -- test error returns
local a,b,c = io.input():write("xuxu")
assert(not a and type(b) == "string" and type(c) == "number")
end
checkerr("invalid format", io.read, "x")
assert(io.read(0) == "") -- not eof
assert(io.read(5, 'l') == '"álo"')
assert(io.read(0) == "")
assert(io.read() == "second line")
local x = io.input():seek()
assert(io.read() == "third line ")
assert(io.input():seek("set", x))
assert(io.read('L') == "third line \n")
assert(io.read(1) == "ç")
assert(io.read(string.len"fourth_line") == "fourth_line")
assert(io.input():seek("cur", -string.len"fourth_line"))
assert(io.read() == "fourth_line")
assert(io.read() == "") -- empty line
assert(io.read('n') == 3450)
assert(io.read(1) == '\n')
assert(not io.read(0)) -- end of file
assert(not io.read(1)) -- end of file
assert(not io.read(30000)) -- end of file
assert(({io.read(1)})[2] == undef)
assert(not io.read()) -- end of file
assert(({io.read()})[2] == undef)
assert(not io.read('n')) -- end of file
assert(({io.read('n')})[2] == undef)
assert(io.read('a') == '') -- end of file (OK for 'a')
assert(io.read('a') == '') -- end of file (OK for 'a')
collectgarbage()
print('+')
io.close(io.input())
checkerr(" input file is closed", io.read)
assert(os.remove(file))
local t = '0123456789'
for i=1,10 do t = t..t; end
assert(string.len(t) == 10*2^10)
io.output(file)
io.write("alo"):write("\n")
io.close()
checkerr(" output file is closed", io.write)
local f = io.open(file, "a+b")
io.output(f)
collectgarbage()
assert(io.write(' ' .. t .. ' '))
assert(io.write(';', 'end of file\n'))
f:flush(); io.flush()
f:close()
print('+')
io.input(file)
assert(io.read() == "alo")
assert(io.read(1) == ' ')
assert(io.read(string.len(t)) == t)
assert(io.read(1) == ' ')
assert(io.read(0))
assert(io.read('a') == ';end of file\n')
assert(not io.read(0))
assert(io.close(io.input()))
-- test errors in read/write
do
local function ismsg (m)
-- error message is not a code number
return (type(m) == "string" and not tonumber(m))
end
-- read
local f = io.open(file, "w")
local r, m, c = f:read()
assert(not r and ismsg(m) and type(c) == "number")
assert(f:close())
-- write
f = io.open(file, "r")
r, m, c = f:write("whatever")
assert(not r and ismsg(m) and type(c) == "number")
assert(f:close())
-- lines
f = io.open(file, "w")
r, m = pcall(f:lines())
assert(r == false and ismsg(m))
assert(f:close())
end
assert(os.remove(file))
-- test for L format
io.output(file); io.write"\n\nline\nother":close()
io.input(file)
assert(io.read"L" == "\n")
assert(io.read"L" == "\n")
assert(io.read"L" == "line\n")
assert(io.read"L" == "other")
assert(not io.read"L")
io.input():close()
local f = assert(io.open(file))
local s = ""
for l in f:lines("L") do s = s .. l end
assert(s == "\n\nline\nother")
f:close()
io.input(file)
s = ""
for l in io.lines(nil, "L") do s = s .. l end
assert(s == "\n\nline\nother")
io.input():close()
s = ""
for l in io.lines(file, "L") do s = s .. l end
assert(s == "\n\nline\nother")
s = ""
for l in io.lines(file, "l") do s = s .. l end
assert(s == "lineother")
io.output(file); io.write"a = 10 + 34\na = 2*a\na = -a\n":close()
local t = {}
assert(load(io.lines(file, "L"), nil, nil, t))()
assert(t.a == -((10 + 34) * 2))
do -- testing closing file in line iteration
-- get the to-be-closed variable from a loop
local function gettoclose (lv)
lv = lv + 1
local stvar = 0 -- to-be-closed is 4th state variable in the loop
for i = 1, 1000 do
local n, v = debug.getlocal(lv, i)
if n == "(for state)" then
stvar = stvar + 1
if stvar == 4 then return v end
end
end
end
local f
for l in io.lines(file) do
f = gettoclose(1)
assert(io.type(f) == "file")
break
end
assert(io.type(f) == "closed file")
f = nil
local function foo (name)
for l in io.lines(name) do
f = gettoclose(1)
assert(io.type(f) == "file")
error(f) -- exit loop with an error
end
end
local st, msg = pcall(foo, file)
assert(st == false and io.type(msg) == "closed file")
end
-- test for multipe arguments in 'lines'
io.output(file); io.write"0123456789\n":close()
for a,b in io.lines(file, 1, 1) do
if a == "\n" then assert(not b)
else assert(tonumber(a) == tonumber(b) - 1)
end
end
for a,b,c in io.lines(file, 1, 2, "a") do
assert(a == "0" and b == "12" and c == "3456789\n")
end
for a,b,c in io.lines(file, "a", 0, 1) do
if a == "" then break end
assert(a == "0123456789\n" and not b and not c)
end
collectgarbage() -- to close file in previous iteration
io.output(file); io.write"00\n10\n20\n30\n40\n":close()
for a, b in io.lines(file, "n", "n") do
if a == 40 then assert(not b)
else assert(a == b - 10)
end
end
-- test load x lines
io.output(file);
io.write[[
local y
= X
X =
X *
2 +
X;
X =
X
- y;
]]:close()
_G.X = 1
assert(not load((io.lines(file))))
collectgarbage() -- to close file in previous iteration
load((io.lines(file, "L")))()
assert(_G.X == 2)
load((io.lines(file, 1)))()
assert(_G.X == 4)
load((io.lines(file, 3)))()
assert(_G.X == 8)
print('+')
local x1 = "string\n\n\\com \"\"''coisas [[estranhas]] ]]'"
io.output(file)
assert(io.write(string.format("x2 = %q\n-- comment without ending EOS", x1)))
io.close()
assert(loadfile(file))()
assert(x1 == x2)
print('+')
assert(os.remove(file))
assert(not os.remove(file))
assert(not os.remove(otherfile))
-- testing loadfile
local function testloadfile (s, expres)
io.output(file)
if s then io.write(s) end
io.close()
local res = assert(loadfile(file))()
assert(os.remove(file))
assert(res == expres)
end
-- loading empty file
testloadfile(nil, nil)
-- loading file with initial comment without end of line
testloadfile("# a non-ending comment", nil)
-- checking Unicode BOM in files
testloadfile("\xEF\xBB\xBF# some comment\nreturn 234", 234)
testloadfile("\xEF\xBB\xBFreturn 239", 239)
testloadfile("\xEF\xBB\xBF", nil) -- empty file with a BOM
-- checking line numbers in files with initial comments
testloadfile("# a comment\nreturn require'debug'.getinfo(1).currentline", 2)
-- loading binary file
io.output(io.open(file, "wb"))
assert(io.write(string.dump(function () return 10, '\0alo\255', 'hi' end)))
io.close()
a, b, c = assert(loadfile(file))()
assert(a == 10 and b == "\0alo\255" and c == "hi")
assert(os.remove(file))
-- bug in 5.2.1
do
io.output(io.open(file, "wb"))
-- save function with no upvalues
assert(io.write(string.dump(function () return 1 end)))
io.close()
f = assert(loadfile(file, "b", {}))
assert(type(f) == "function" and f() == 1)
assert(os.remove(file))
end
-- loading binary file with initial comment
io.output(io.open(file, "wb"))
assert(io.write("#this is a comment for a binary file\0\n",
string.dump(function () return 20, '\0\0\0' end)))
io.close()
a, b, c = assert(loadfile(file))()
assert(a == 20 and b == "\0\0\0" and c == nil)
assert(os.remove(file))
-- 'loadfile' with 'env'
do
local f = io.open(file, 'w')
f:write[[
if (...) then a = 15; return b, c, d
else return _ENV
end
]]
f:close()
local t = {b = 12, c = "xuxu", d = print}
local f = assert(loadfile(file, 't', t))
local b, c, d = f(1)
assert(t.a == 15 and b == 12 and c == t.c and d == print)
assert(f() == t)
f = assert(loadfile(file, 't', nil))
assert(f() == nil)
f = assert(loadfile(file))
assert(f() == _G)
assert(os.remove(file))
end
-- 'loadfile' x modes
do
io.open(file, 'w'):write("return 10"):close()
local s, m = loadfile(file, 'b')
assert(not s and string.find(m, "a text chunk"))
io.open(file, 'w'):write("\27 return 10"):close()
local s, m = loadfile(file, 't')
assert(not s and string.find(m, "a binary chunk"))
assert(os.remove(file))
end
io.output(file)
assert(io.write("qualquer coisa\n"))
assert(io.write("mais qualquer coisa"))
io.close()
assert(io.output(assert(io.open(otherfile, 'wb')))
:write("outra coisa\0\1\3\0\0\0\0\255\0")
:close())
local filehandle = assert(io.open(file, 'r+'))
local otherfilehandle = assert(io.open(otherfile, 'rb'))
assert(filehandle ~= otherfilehandle)
assert(type(filehandle) == "userdata")
assert(filehandle:read('l') == "qualquer coisa")
io.input(otherfilehandle)
assert(io.read(string.len"outra coisa") == "outra coisa")
assert(filehandle:read('l') == "mais qualquer coisa")
filehandle:close();
assert(type(filehandle) == "userdata")
io.input(otherfilehandle)
assert(io.read(4) == "\0\1\3\0")
assert(io.read(3) == "\0\0\0")
assert(io.read(0) == "") -- 255 is not eof
assert(io.read(1) == "\255")
assert(io.read('a') == "\0")
assert(not io.read(0))
assert(otherfilehandle == io.input())
otherfilehandle:close()
assert(os.remove(file))
assert(os.remove(otherfile))
collectgarbage()
io.output(file)
:write[[
123.4 -56e-2 not a number
second line
third line
and the rest of the file
]]
:close()
io.input(file)
local _,a,b,c,d,e,h,__ = io.read(1, 'n', 'n', 'l', 'l', 'l', 'a', 10)
assert(io.close(io.input()))
assert(_ == ' ' and not __)
assert(type(a) == 'number' and a==123.4 and b==-56e-2)
assert(d=='second line' and e=='third line')
assert(h==[[
and the rest of the file
]])
assert(os.remove(file))
collectgarbage()
-- testing buffers
do
local f = assert(io.open(file, "w"))
local fr = assert(io.open(file, "r"))
assert(f:setvbuf("full", 2000))
f:write("x")
assert(fr:read("all") == "") -- full buffer; output not written yet
f:close()
fr:seek("set")
assert(fr:read("all") == "x") -- `close' flushes it
f = assert(io.open(file), "w")
assert(f:setvbuf("no"))
f:write("x")
fr:seek("set")
assert(fr:read("all") == "x") -- no buffer; output is ready
f:close()
f = assert(io.open(file, "a"))
assert(f:setvbuf("line"))
f:write("x")
fr:seek("set", 1)
assert(fr:read("all") == "") -- line buffer; no output without `\n'
f:write("a\n"):seek("set", 1)
assert(fr:read("all") == "xa\n") -- now we have a whole line
f:close(); fr:close()
assert(os.remove(file))
end
if not _soft then
print("testing large files (> BUFSIZ)")
io.output(file)
for i=1,5001 do io.write('0123456789123') end
io.write('\n12346'):close()
io.input(file)
local x = io.read('a')
io.input():seek('set', 0)
local y = io.read(30001)..io.read(1005)..io.read(0)..
io.read(1)..io.read(100003)
assert(x == y and string.len(x) == 5001*13 + 6)
io.input():seek('set', 0)
y = io.read() -- huge line
assert(x == y..'\n'..io.read())
assert(not io.read())
io.close(io.input())
assert(os.remove(file))
x = nil; y = nil
end
if not _port then
local progname
do -- get name of running executable
local arg = arg or ARG
local i = 0
while arg[i] do i = i - 1 end
progname = '"' .. arg[i + 1] .. '"'
end
print("testing popen/pclose and execute")
-- invalid mode for popen
checkerr("invalid mode", io.popen, "cat", "")
checkerr("invalid mode", io.popen, "cat", "r+")
checkerr("invalid mode", io.popen, "cat", "rw")
do -- basic tests for popen
local file = os.tmpname()
local f = assert(io.popen("cat - > " .. file, "w"))
f:write("a line")
assert(f:close())
local f = assert(io.popen("cat - < " .. file, "r"))
assert(f:read("a") == "a line")
assert(f:close())
assert(os.remove(file))
end
local tests = {
-- command, what, code
{"ls > /dev/null", "ok"},
{"not-to-be-found-command", "exit"},
{"exit 3", "exit", 3},
{"exit 129", "exit", 129},
{"kill -s HUP $$", "signal", 1},
{"kill -s KILL $$", "signal", 9},
{"sh -c 'kill -s HUP $$'", "signal", 1},
{progname .. ' -e " "', "ok"},
{progname .. ' -e "os.exit(0, true)"', "ok"},
{progname .. ' -e "os.exit(20, true)"', "exit", 20},
}
print("\n(some error messages are expected now)")
for _, v in ipairs(tests) do
local x, y, z = io.popen(v[1]):close()
local x1, y1, z1 = os.execute(v[1])
assert(x == x1 and y == y1 and z == z1)
if v[2] == "ok" then
assert(x and y == 'exit' and z == 0)
else
assert(not x and y == v[2]) -- correct status and 'what'
-- correct code if known (but always different from 0)
assert((v[3] == nil and z > 0) or v[3] == z)
end
end
end
-- testing tmpfile
f = io.tmpfile()
assert(io.type(f) == "file")
f:write("alo")
f:seek("set")
assert(f:read"a" == "alo")
end --}
print'+'
print("testing date/time")
assert(os.date("") == "")
assert(os.date("!") == "")
assert(os.date("\0\0") == "\0\0")
assert(os.date("!\0\0") == "\0\0")
local x = string.rep("a", 10000)
assert(os.date(x) == x)
local t = os.time()
D = os.date("*t", t)
assert(os.date(string.rep("%d", 1000), t) ==
string.rep(os.date("%d", t), 1000))
assert(os.date(string.rep("%", 200)) == string.rep("%", 100))
local function checkDateTable (t)
_G.D = os.date("*t", t)
assert(os.time(D) == t)
load(os.date([[assert(D.year==%Y and D.month==%m and D.day==%d and
D.hour==%H and D.min==%M and D.sec==%S and
D.wday==%w+1 and D.yday==%j)]], t))()
_G.D = nil
end
checkDateTable(os.time())
if not _port then
-- assume that time_t can represent these values
checkDateTable(0)
checkDateTable(1)
checkDateTable(1000)
checkDateTable(0x7fffffff)
checkDateTable(0x80000000)
end
checkerr("invalid conversion specifier", os.date, "%")
checkerr("invalid conversion specifier", os.date, "%9")
checkerr("invalid conversion specifier", os.date, "%")
checkerr("invalid conversion specifier", os.date, "%O")
checkerr("invalid conversion specifier", os.date, "%E")
checkerr("invalid conversion specifier", os.date, "%Ea")
checkerr("not an integer", os.time, {year=1000, month=1, day=1, hour='x'})
checkerr("not an integer", os.time, {year=1000, month=1, day=1, hour=1.5})
checkerr("missing", os.time, {hour = 12}) -- missing date
if string.packsize("i") == 4 then -- 4-byte ints
checkerr("field 'year' is out-of-bound", os.time,
{year = -(1 << 31) + 1899, month = 1, day = 1})
end
if not _port then
-- test Posix-specific modifiers
assert(type(os.date("%Ex")) == 'string')
assert(type(os.date("%Oy")) == 'string')
-- test large dates (assume at least 4-byte ints and time_t)
local t0 = os.time{year = 1970, month = 1, day = 0}
local t1 = os.time{year = 1970, month = 1, day = 0, sec = (1 << 31) - 1}
assert(t1 - t0 == (1 << 31) - 1)
t0 = os.time{year = 1970, month = 1, day = 1}
t1 = os.time{year = 1970, month = 1, day = 1, sec = -(1 << 31)}
assert(t1 - t0 == -(1 << 31))
-- test out-of-range dates (at least for Unix)
if maxint >= 2^62 then -- cannot do these tests in Small Lua
-- no arith overflows
checkerr("out-of-bound", os.time, {year = -maxint, month = 1, day = 1})
if string.packsize("i") == 4 then -- 4-byte ints
if testerr("out-of-bound", os.date, "%Y", 2^40) then
-- time_t has 4 bytes and therefore cannot represent year 4000
print(" 4-byte time_t")
checkerr("cannot be represented", os.time, {year=4000, month=1, day=1})
else
-- time_t has 8 bytes; an int year cannot represent a huge time
print(" 8-byte time_t")
checkerr("cannot be represented", os.date, "%Y", 2^60)
-- -- this is the maximum year
-- assert(tonumber(os.time
-- {year=(1 << 31) + 1899, month=12, day=31, hour=23, min=59, sec=59}))
-- this is too much
checkerr("represented", os.time,
{year=(1 << 31) + 1899, month=12, day=31, hour=23, min=59, sec=60})
end
-- internal 'int' fields cannot hold these values
checkerr("field 'day' is out-of-bound", os.time,
{year = 0, month = 1, day = 2^32})
checkerr("field 'month' is out-of-bound", os.time,
{year = 0, month = -((1 << 31) + 1), day = 1})
checkerr("field 'year' is out-of-bound", os.time,
{year = (1 << 31) + 1900, month = 1, day = 1})
else -- 8-byte ints
-- assume time_t has 8 bytes too
print(" 8-byte time_t")
assert(tonumber(os.date("%Y", 2^60)))
-- but still cannot represent a huge year
checkerr("cannot be represented", os.time, {year=2^60, month=1, day=1})
end
end
end
do
local D = os.date("*t")
local t = os.time(D)
if D.isdst == nil then
print("no daylight saving information")
else
assert(type(D.isdst) == 'boolean')
end
D.isdst = nil
local t1 = os.time(D)
assert(t == t1) -- if isdst is absent uses correct default
end
local D = os.date("*t")
t = os.time(D)
D.year = D.year-1;
local t1 = os.time(D)
-- allow for leap years
assert(math.abs(os.difftime(t,t1)/(24*3600) - 365) < 2)
-- should not take more than 1 second to execute these two lines
t = os.time()
t1 = os.time(os.date("*t"))
local diff = os.difftime(t1,t)
assert(0 <= diff and diff <= 1)
diff = os.difftime(t,t1)
assert(-1 <= diff and diff <= 0)
local t1 = os.time{year=2000, month=10, day=1, hour=23, min=12}
local t2 = os.time{year=2000, month=10, day=1, hour=23, min=10, sec=19}
assert(os.difftime(t1,t2) == 60*2-19)
-- since 5.3.3, 'os.time' normalizes table fields
t1 = {year = 2005, month = 1, day = 1, hour = 1, min = 0, sec = -3602}
os.time(t1)
assert(t1.day == 31 and t1.month == 12 and t1.year == 2004 and
t1.hour == 23 and t1.min == 59 and t1.sec == 58 and
t1.yday == 366)
io.output(io.stdout)
local t = os.date('%d %m %Y %H %M %S')
local d, m, a, h, min, s = string.match(t,
"(%d+) (%d+) (%d+) (%d+) (%d+) (%d+)")
d = tonumber(d)
m = tonumber(m)
a = tonumber(a)
h = tonumber(h)
min = tonumber(min)
s = tonumber(s)
io.write(string.format('test done on %2.2d/%2.2d/%d', d, m, a))
io.write(string.format(', at %2.2d:%2.2d:%2.2d\n', h, min, s))
io.write(string.format('%s\n', _VERSION))
| 25,918 | 940 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/literals.lua | -- $Id: test/literals.lua $
-- See Copyright Notice in file all.lua
print('testing scanner')
local debug = require "debug"
local function dostring (x) return assert(load(x), "")() end
dostring("x \v\f = \t\r 'a\0a' \v\f\f")
assert(x == 'a\0a' and string.len(x) == 3)
-- escape sequences
assert('\n\"\'\\' == [[
"'\]])
assert(string.find("\a\b\f\n\r\t\v", "^%c%c%c%c%c%c%c$"))
-- assume ASCII just for tests:
assert("\09912" == 'c12')
assert("\99ab" == 'cab')
assert("\099" == '\99')
assert("\099\n" == 'c\10')
assert('\0\0\0alo' == '\0' .. '\0\0' .. 'alo')
assert(010 .. 020 .. -030 == "1020-30")
-- hexadecimal escapes
assert("\x00\x05\x10\x1f\x3C\xfF\xe8" == "\0\5\16\31\60\255\232")
local function lexstring (x, y, n)
local f = assert(load('return ' .. x ..
', require"debug".getinfo(1).currentline', ''))
local s, l = f()
assert(s == y and l == n)
end
lexstring("'abc\\z \n efg'", "abcefg", 2)
lexstring("'abc\\z \n\n\n'", "abc", 4)
lexstring("'\\z \n\t\f\v\n'", "", 3)
lexstring("[[\nalo\nalo\n\n]]", "alo\nalo\n\n", 5)
lexstring("[[\nalo\ralo\n\n]]", "alo\nalo\n\n", 5)
lexstring("[[\nalo\ralo\r\n]]", "alo\nalo\n", 4)
lexstring("[[\ralo\n\ralo\r\n]]", "alo\nalo\n", 4)
lexstring("[[alo]\n]alo]]", "alo]\n]alo", 2)
assert("abc\z
def\z
ghi\z
" == 'abcdefghi')
-- UTF-8 sequences
assert("\u{0}\u{00000000}\x00\0" == string.char(0, 0, 0, 0))
-- limits for 1-byte sequences
assert("\u{0}\u{7F}" == "\x00\x7F")
-- limits for 2-byte sequences
assert("\u{80}\u{7FF}" == "\xC2\x80\xDF\xBF")
-- limits for 3-byte sequences
assert("\u{800}\u{FFFF}" == "\xE0\xA0\x80\xEF\xBF\xBF")
-- limits for 4-byte sequences
assert("\u{10000}\u{1FFFFF}" == "\xF0\x90\x80\x80\xF7\xBF\xBF\xBF")
-- limits for 5-byte sequences
assert("\u{200000}\u{3FFFFFF}" == "\xF8\x88\x80\x80\x80\xFB\xBF\xBF\xBF\xBF")
-- limits for 6-byte sequences
assert("\u{4000000}\u{7FFFFFFF}" ==
"\xFC\x84\x80\x80\x80\x80\xFD\xBF\xBF\xBF\xBF\xBF")
-- Error in escape sequences
local function lexerror (s, err)
local st, msg = load('return ' .. s, '')
if err ~= '<eof>' then err = err .. "'" end
assert(not st and string.find(msg, "near .-" .. err))
end
lexerror([["abc\x"]], [[\x"]])
lexerror([["abc\x]], [[\x]])
lexerror([["\x]], [[\x]])
lexerror([["\x5"]], [[\x5"]])
lexerror([["\x5]], [[\x5]])
lexerror([["\xr"]], [[\xr]])
lexerror([["\xr]], [[\xr]])
lexerror([["\x.]], [[\x.]])
lexerror([["\x8%"]], [[\x8%%]])
lexerror([["\xAG]], [[\xAG]])
lexerror([["\g"]], [[\g]])
lexerror([["\g]], [[\g]])
lexerror([["\."]], [[\%.]])
lexerror([["\999"]], [[\999"]])
lexerror([["xyz\300"]], [[\300"]])
lexerror([[" \256"]], [[\256"]])
-- errors in UTF-8 sequences
lexerror([["abc\u{100000000}"]], [[abc\u{100000000]]) -- too large
lexerror([["abc\u11r"]], [[abc\u1]]) -- missing '{'
lexerror([["abc\u"]], [[abc\u"]]) -- missing '{'
lexerror([["abc\u{11r"]], [[abc\u{11r]]) -- missing '}'
lexerror([["abc\u{11"]], [[abc\u{11"]]) -- missing '}'
lexerror([["abc\u{11]], [[abc\u{11]]) -- missing '}'
lexerror([["abc\u{r"]], [[abc\u{r]]) -- no digits
-- unfinished strings
lexerror("[=[alo]]", "<eof>")
lexerror("[=[alo]=", "<eof>")
lexerror("[=[alo]", "<eof>")
lexerror("'alo", "<eof>")
lexerror("'alo \\z \n\n", "<eof>")
lexerror("'alo \\z", "<eof>")
lexerror([['alo \98]], "<eof>")
-- valid characters in variable names
for i = 0, 255 do
local s = string.char(i)
assert(not string.find(s, "[a-zA-Z_]") == not load(s .. "=1", ""))
assert(not string.find(s, "[a-zA-Z_0-9]") ==
not load("a" .. s .. "1 = 1", ""))
end
-- long variable names
var1 = string.rep('a', 15000) .. '1'
var2 = string.rep('a', 15000) .. '2'
prog = string.format([[
%s = 5
%s = %s + 1
return function () return %s - %s end
]], var1, var2, var1, var1, var2)
local f = dostring(prog)
assert(_G[var1] == 5 and _G[var2] == 6 and f() == -1)
var1, var2, f = nil
print('+')
-- escapes --
assert("\n\t" == [[
]])
assert([[
$debug]] == "\n $debug")
assert([[ [ ]] ~= [[ ] ]])
-- long strings --
b = "001234567890123456789012345678901234567891234567890123456789012345678901234567890012345678901234567890123456789012345678912345678901234567890123456789012345678900123456789012345678901234567890123456789123456789012345678901234567890123456789001234567890123456789012345678901234567891234567890123456789012345678901234567890012345678901234567890123456789012345678912345678901234567890123456789012345678900123456789012345678901234567890123456789123456789012345678901234567890123456789001234567890123456789012345678901234567891234567890123456789012345678901234567890012345678901234567890123456789012345678912345678901234567890123456789012345678900123456789012345678901234567890123456789123456789012345678901234567890123456789001234567890123456789012345678901234567891234567890123456789012345678901234567890012345678901234567890123456789012345678912345678901234567890123456789012345678900123456789012345678901234567890123456789123456789012345678901234567890123456789"
assert(string.len(b) == 960)
prog = [=[
print('+')
a1 = [["this is a 'string' with several 'quotes'"]]
a2 = "'quotes'"
assert(string.find(a1, a2) == 34)
print('+')
a1 = [==[temp = [[an arbitrary value]]; ]==]
assert(load(a1))()
assert(temp == 'an arbitrary value')
-- long strings --
b = "001234567890123456789012345678901234567891234567890123456789012345678901234567890012345678901234567890123456789012345678912345678901234567890123456789012345678900123456789012345678901234567890123456789123456789012345678901234567890123456789001234567890123456789012345678901234567891234567890123456789012345678901234567890012345678901234567890123456789012345678912345678901234567890123456789012345678900123456789012345678901234567890123456789123456789012345678901234567890123456789001234567890123456789012345678901234567891234567890123456789012345678901234567890012345678901234567890123456789012345678912345678901234567890123456789012345678900123456789012345678901234567890123456789123456789012345678901234567890123456789001234567890123456789012345678901234567891234567890123456789012345678901234567890012345678901234567890123456789012345678912345678901234567890123456789012345678900123456789012345678901234567890123456789123456789012345678901234567890123456789"
assert(string.len(b) == 960)
print('+')
a = [[00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
00123456789012345678901234567890123456789123456789012345678901234567890123456789
]]
assert(string.len(a) == 1863)
assert(string.sub(a, 1, 40) == string.sub(b, 1, 40))
x = 1
]=]
print('+')
x = nil
dostring(prog)
assert(x)
prog = nil
a = nil
b = nil
-- testing line ends
prog = [[
a = 1 -- a comment
b = 2
x = [=[
hi
]=]
y = "\
hello\r\n\
"
return require"debug".getinfo(1).currentline
]]
for _, n in pairs{"\n", "\r", "\n\r", "\r\n"} do
local prog, nn = string.gsub(prog, "\n", n)
assert(dostring(prog) == nn)
assert(_G.x == "hi\n" and _G.y == "\nhello\r\n\n")
end
-- testing comments and strings with long brackets
a = [==[]=]==]
assert(a == "]=")
a = [==[[===[[=[]]=][====[]]===]===]==]
assert(a == "[===[[=[]]=][====[]]===]===")
a = [====[[===[[=[]]=][====[]]===]===]====]
assert(a == "[===[[=[]]=][====[]]===]===")
a = [=[]]]]]]]]]=]
assert(a == "]]]]]]]]")
--[===[
x y z [==[ blu foo
]==
]
]=]==]
error error]=]===]
-- generate all strings of four of these chars
local x = {"=", "[", "]", "\n"}
local len = 4
local function gen (c, n)
if n==0 then coroutine.yield(c)
else
for _, a in pairs(x) do
gen(c..a, n-1)
end
end
end
for s in coroutine.wrap(function () gen("", len) end) do
assert(s == load("return [====[\n"..s.."]====]", "")())
end
-- testing decimal point locale
if os.setlocale("pt_BR") or os.setlocale("ptb") then
assert(tonumber("3,4") == 3.4 and tonumber"3.4" == 3.4)
assert(tonumber(" -.4 ") == -0.4)
assert(tonumber(" +0x.41 ") == 0X0.41)
assert(not load("a = (3,4)"))
assert(assert(load("return 3.4"))() == 3.4)
assert(assert(load("return .4,3"))() == .4)
assert(assert(load("return 4."))() == 4.)
assert(assert(load("return 4.+.5"))() == 4.5)
assert(" 0x.1 " + " 0x,1" + "-0X.1\t" == 0x0.1)
assert(not tonumber"inf" and not tonumber"NAN")
assert(assert(load(string.format("return %q", 4.51)))() == 4.51)
local a,b = load("return 4.5.")
assert(string.find(b, "'4%.5%.'"))
assert(os.setlocale("C"))
else
(Message or print)(
'\n >>> pt_BR locale not available: skipping decimal point tests <<<\n')
end
-- testing %q x line ends
local s = "a string with \r and \n and \r\n and \n\r"
local c = string.format("return %q", s)
assert(assert(load(c))() == s)
-- testing errors
assert(not load"a = 'non-ending string")
assert(not load"a = 'non-ending string\n'")
assert(not load"a = '\\345'")
assert(not load"a = [=x]")
local function malformednum (n, exp)
local s, msg = load("return " .. n)
assert(not s and string.find(msg, exp))
end
malformednum("0xe-", "near <eof>")
malformednum("0xep-p", "malformed number")
malformednum("1print()", "malformed number")
print('OK')
| 10,780 | 319 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/verybig.lua | -- $Id: test/verybig.lua $
-- See Copyright Notice in file all.lua
print "testing RK"
-- testing opcodes with RK arguments larger than K limit
local function foo ()
local dummy = {
-- fill first 256 entries in table of constants
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 98, 99, 100, 101, 102, 103, 104,
105, 106, 107, 108, 109, 110, 111, 112,
113, 114, 115, 116, 117, 118, 119, 120,
121, 122, 123, 124, 125, 126, 127, 128,
129, 130, 131, 132, 133, 134, 135, 136,
137, 138, 139, 140, 141, 142, 143, 144,
145, 146, 147, 148, 149, 150, 151, 152,
153, 154, 155, 156, 157, 158, 159, 160,
161, 162, 163, 164, 165, 166, 167, 168,
169, 170, 171, 172, 173, 174, 175, 176,
177, 178, 179, 180, 181, 182, 183, 184,
185, 186, 187, 188, 189, 190, 191, 192,
193, 194, 195, 196, 197, 198, 199, 200,
201, 202, 203, 204, 205, 206, 207, 208,
209, 210, 211, 212, 213, 214, 215, 216,
217, 218, 219, 220, 221, 222, 223, 224,
225, 226, 227, 228, 229, 230, 231, 232,
233, 234, 235, 236, 237, 238, 239, 240,
241, 242, 243, 244, 245, 246, 247, 248,
249, 250, 251, 252, 253, 254, 255, 256,
}
assert(24.5 + 0.6 == 25.1)
local t = {foo = function (self, x) return x + self.x end, x = 10}
t.t = t
assert(t:foo(1.5) == 11.5)
assert(t.t:foo(0.5) == 10.5) -- bug in 5.2 alpha
assert(24.3 == 24.3)
assert((function () return t.x end)() == 10)
end
foo()
foo = nil
if _soft then return 10 end
print "testing large programs (>64k)"
-- template to create a very big test file
prog = [[$
local a,b
b = {$1$
b30009 = 65534,
b30010 = 65535,
b30011 = 65536,
b30012 = 65537,
b30013 = 16777214,
b30014 = 16777215,
b30015 = 16777216,
b30016 = 16777217,
b30017 = 0x7fffff,
b30018 = -0x7fffff,
b30019 = 0x1ffffff,
b30020 = -0x1ffffd,
b30021 = -65534,
b30022 = -65535,
b30023 = -65536,
b30024 = -0xffffff,
b30025 = 15012.5,
$2$
};
assert(b.a50008 == 25004 and b["a11"] == -5.5)
assert(b.a33007 == -16503.5 and b.a50009 == -25004.5)
assert(b["b"..30024] == -0xffffff)
function b:xxx (a,b) return a+b end
assert(b:xxx(10, 12) == 22) -- pushself with non-constant index
b["xxx"] = undef
s = 0; n=0
for a,b in pairs(b) do s=s+b; n=n+1 end
-- with 32-bit floats, exact value of 's' depends on summation order
assert(81800000.0 < s and s < 81860000 and n == 70001)
a = nil; b = nil
print'+'
function f(x) b=x end
a = f{$3$} or 10
assert(a==10)
assert(b[1] == "a10" and b[2] == 5 and b[#b-1] == "a50009")
function xxxx (x) return b[x] end
assert(xxxx(3) == "a11")
a = nil; b=nil
xxxx = nil
return 10
]]
-- functions to fill in the $n$
local function sig (x)
return (x % 2 == 0) and '' or '-'
end
F = {
function () -- $1$
for i=10,50009 do
io.write('a', i, ' = ', sig(i), 5+((i-10)/2), ',\n')
end
end,
function () -- $2$
for i=30026,50009 do
io.write('b', i, ' = ', sig(i), 15013+((i-30026)/2), ',\n')
end
end,
function () -- $3$
for i=10,50009 do
io.write('"a', i, '", ', sig(i), 5+((i-10)/2), ',\n')
end
end,
}
file = os.tmpname()
io.output(file)
for s in string.gmatch(prog, "$([^$]+)") do
local n = tonumber(s)
if not n then io.write(s) else F[n]() end
end
io.close()
result = dofile(file)
assert(os.remove(file))
print'OK'
return result
| 3,682 | 153 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/bitwise.lua | -- $Id: test/bitwise.lua $
-- See Copyright Notice in file all.lua
print("testing bitwise operations")
require "bwcoercion"
local numbits = string.packsize('j') * 8
assert(~0 == -1)
assert((1 << (numbits - 1)) == math.mininteger)
-- basic tests for bitwise operators;
-- use variables to avoid constant folding
local a, b, c, d
a = 0xFFFFFFFFFFFFFFFF
assert(a == -1 and a & -1 == a and a & 35 == 35)
a = 0xF0F0F0F0F0F0F0F0
assert(a | -1 == -1)
assert(a ~ a == 0 and a ~ 0 == a and a ~ ~a == -1)
assert(a >> 4 == ~a)
a = 0xF0; b = 0xCC; c = 0xAA; d = 0xFD
assert(a | b ~ c & d == 0xF4)
a = 0xF0.0; b = 0xCC.0; c = "0xAA.0"; d = "0xFD.0"
assert(a | b ~ c & d == 0xF4)
a = 0xF0000000; b = 0xCC000000;
c = 0xAA000000; d = 0xFD000000
assert(a | b ~ c & d == 0xF4000000)
assert(~~a == a and ~a == -1 ~ a and -d == ~d + 1)
a = a << 32
b = b << 32
c = c << 32
d = d << 32
assert(a | b ~ c & d == 0xF4000000 << 32)
assert(~~a == a and ~a == -1 ~ a and -d == ~d + 1)
assert(-1 >> 1 == (1 << (numbits - 1)) - 1 and 1 << 31 == 0x80000000)
assert(-1 >> (numbits - 1) == 1)
assert(-1 >> numbits == 0 and
-1 >> -numbits == 0 and
-1 << numbits == 0 and
-1 << -numbits == 0)
assert((2^30 - 1) << 2^30 == 0)
assert((2^30 - 1) >> 2^30 == 0)
assert(1 >> -3 == 1 << 3 and 1000 >> 5 == 1000 << -5)
-- coercion from strings to integers
assert("0xffffffffffffffff" | 0 == -1)
assert("0xfffffffffffffffe" & "-1" == -2)
assert(" \t-0xfffffffffffffffe\n\t" & "-1" == 2)
assert(" \n -45 \t " >> " -2 " == -45 * 4)
assert("1234.0" << "5.0" == 1234 * 32)
assert("0xffff.0" ~ "0xAAAA" == 0x5555)
assert(~"0x0.000p4" == -1)
assert(("7" .. 3) << 1 == 146)
assert(0xffffffff >> (1 .. "9") == 0x1fff)
assert(10 | (1 .. "9") == 27)
do
local st, msg = pcall(function () return 4 & "a" end)
assert(string.find(msg, "'band'"))
local st, msg = pcall(function () return ~"a" end)
assert(string.find(msg, "'bnot'"))
end
-- out of range number
assert(not pcall(function () return "0xffffffffffffffff.0" | 0 end))
-- embedded zeros
assert(not pcall(function () return "0xffffffffffffffff\0" | 0 end))
print'+'
package.preload.bit32 = function () --{
-- no built-in 'bit32' library: implement it using bitwise operators
local bit = {}
function bit.bnot (a)
return ~a & 0xFFFFFFFF
end
--
-- in all vararg functions, avoid creating 'arg' table when there are
-- only 2 (or less) parameters, as 2 parameters is the common case
--
function bit.band (x, y, z, ...)
if not z then
return ((x or -1) & (y or -1)) & 0xFFFFFFFF
else
local arg = {...}
local res = x & y & z
for i = 1, #arg do res = res & arg[i] end
return res & 0xFFFFFFFF
end
end
function bit.bor (x, y, z, ...)
if not z then
return ((x or 0) | (y or 0)) & 0xFFFFFFFF
else
local arg = {...}
local res = x | y | z
for i = 1, #arg do res = res | arg[i] end
return res & 0xFFFFFFFF
end
end
function bit.bxor (x, y, z, ...)
if not z then
return ((x or 0) ~ (y or 0)) & 0xFFFFFFFF
else
local arg = {...}
local res = x ~ y ~ z
for i = 1, #arg do res = res ~ arg[i] end
return res & 0xFFFFFFFF
end
end
function bit.btest (...)
return bit.band(...) ~= 0
end
function bit.lshift (a, b)
return ((a & 0xFFFFFFFF) << b) & 0xFFFFFFFF
end
function bit.rshift (a, b)
return ((a & 0xFFFFFFFF) >> b) & 0xFFFFFFFF
end
function bit.arshift (a, b)
a = a & 0xFFFFFFFF
if b <= 0 or (a & 0x80000000) == 0 then
return (a >> b) & 0xFFFFFFFF
else
return ((a >> b) | ~(0xFFFFFFFF >> b)) & 0xFFFFFFFF
end
end
function bit.lrotate (a ,b)
b = b & 31
a = a & 0xFFFFFFFF
a = (a << b) | (a >> (32 - b))
return a & 0xFFFFFFFF
end
function bit.rrotate (a, b)
return bit.lrotate(a, -b)
end
local function checkfield (f, w)
w = w or 1
assert(f >= 0, "field cannot be negative")
assert(w > 0, "width must be positive")
assert(f + w <= 32, "trying to access non-existent bits")
return f, ~(-1 << w)
end
function bit.extract (a, f, w)
local f, mask = checkfield(f, w)
return (a >> f) & mask
end
function bit.replace (a, v, f, w)
local f, mask = checkfield(f, w)
v = v & mask
a = (a & ~(mask << f)) | (v << f)
return a & 0xFFFFFFFF
end
return bit
end --}
print("testing bitwise library")
local bit32 = require'bit32'
assert(bit32.band() == bit32.bnot(0))
assert(bit32.btest() == true)
assert(bit32.bor() == 0)
assert(bit32.bxor() == 0)
assert(bit32.band() == bit32.band(0xffffffff))
assert(bit32.band(1,2) == 0)
-- out-of-range numbers
assert(bit32.band(-1) == 0xffffffff)
assert(bit32.band((1 << 33) - 1) == 0xffffffff)
assert(bit32.band(-(1 << 33) - 1) == 0xffffffff)
assert(bit32.band((1 << 33) + 1) == 1)
assert(bit32.band(-(1 << 33) + 1) == 1)
assert(bit32.band(-(1 << 40)) == 0)
assert(bit32.band(1 << 40) == 0)
assert(bit32.band(-(1 << 40) - 2) == 0xfffffffe)
assert(bit32.band((1 << 40) - 4) == 0xfffffffc)
assert(bit32.lrotate(0, -1) == 0)
assert(bit32.lrotate(0, 7) == 0)
assert(bit32.lrotate(0x12345678, 0) == 0x12345678)
assert(bit32.lrotate(0x12345678, 32) == 0x12345678)
assert(bit32.lrotate(0x12345678, 4) == 0x23456781)
assert(bit32.rrotate(0x12345678, -4) == 0x23456781)
assert(bit32.lrotate(0x12345678, -8) == 0x78123456)
assert(bit32.rrotate(0x12345678, 8) == 0x78123456)
assert(bit32.lrotate(0xaaaaaaaa, 2) == 0xaaaaaaaa)
assert(bit32.lrotate(0xaaaaaaaa, -2) == 0xaaaaaaaa)
for i = -50, 50 do
assert(bit32.lrotate(0x89abcdef, i) == bit32.lrotate(0x89abcdef, i%32))
end
assert(bit32.lshift(0x12345678, 4) == 0x23456780)
assert(bit32.lshift(0x12345678, 8) == 0x34567800)
assert(bit32.lshift(0x12345678, -4) == 0x01234567)
assert(bit32.lshift(0x12345678, -8) == 0x00123456)
assert(bit32.lshift(0x12345678, 32) == 0)
assert(bit32.lshift(0x12345678, -32) == 0)
assert(bit32.rshift(0x12345678, 4) == 0x01234567)
assert(bit32.rshift(0x12345678, 8) == 0x00123456)
assert(bit32.rshift(0x12345678, 32) == 0)
assert(bit32.rshift(0x12345678, -32) == 0)
assert(bit32.arshift(0x12345678, 0) == 0x12345678)
assert(bit32.arshift(0x12345678, 1) == 0x12345678 // 2)
assert(bit32.arshift(0x12345678, -1) == 0x12345678 * 2)
assert(bit32.arshift(-1, 1) == 0xffffffff)
assert(bit32.arshift(-1, 24) == 0xffffffff)
assert(bit32.arshift(-1, 32) == 0xffffffff)
assert(bit32.arshift(-1, -1) == bit32.band(-1 * 2, 0xffffffff))
assert(0x12345678 << 4 == 0x123456780)
assert(0x12345678 << 8 == 0x1234567800)
assert(0x12345678 << -4 == 0x01234567)
assert(0x12345678 << -8 == 0x00123456)
assert(0x12345678 << 32 == 0x1234567800000000)
assert(0x12345678 << -32 == 0)
assert(0x12345678 >> 4 == 0x01234567)
assert(0x12345678 >> 8 == 0x00123456)
assert(0x12345678 >> 32 == 0)
assert(0x12345678 >> -32 == 0x1234567800000000)
print("+")
-- some special cases
local c = {0, 1, 2, 3, 10, 0x80000000, 0xaaaaaaaa, 0x55555555,
0xffffffff, 0x7fffffff}
for _, b in pairs(c) do
assert(bit32.band(b) == b)
assert(bit32.band(b, b) == b)
assert(bit32.band(b, b, b, b) == b)
assert(bit32.btest(b, b) == (b ~= 0))
assert(bit32.band(b, b, b) == b)
assert(bit32.band(b, b, b, ~b) == 0)
assert(bit32.btest(b, b, b) == (b ~= 0))
assert(bit32.band(b, bit32.bnot(b)) == 0)
assert(bit32.bor(b, bit32.bnot(b)) == bit32.bnot(0))
assert(bit32.bor(b) == b)
assert(bit32.bor(b, b) == b)
assert(bit32.bor(b, b, b) == b)
assert(bit32.bor(b, b, 0, ~b) == 0xffffffff)
assert(bit32.bxor(b) == b)
assert(bit32.bxor(b, b) == 0)
assert(bit32.bxor(b, b, b) == b)
assert(bit32.bxor(b, b, b, b) == 0)
assert(bit32.bxor(b, 0) == b)
assert(bit32.bnot(b) ~= b)
assert(bit32.bnot(bit32.bnot(b)) == b)
assert(bit32.bnot(b) == (1 << 32) - 1 - b)
assert(bit32.lrotate(b, 32) == b)
assert(bit32.rrotate(b, 32) == b)
assert(bit32.lshift(bit32.lshift(b, -4), 4) == bit32.band(b, bit32.bnot(0xf)))
assert(bit32.rshift(bit32.rshift(b, 4), -4) == bit32.band(b, bit32.bnot(0xf)))
end
-- for this test, use at most 24 bits (mantissa of a single float)
c = {0, 1, 2, 3, 10, 0x800000, 0xaaaaaa, 0x555555, 0xffffff, 0x7fffff}
for _, b in pairs(c) do
for i = -40, 40 do
local x = bit32.lshift(b, i)
local y = math.floor(math.fmod(b * 2.0^i, 2.0^32))
assert(math.fmod(x - y, 2.0^32) == 0)
end
end
assert(not pcall(bit32.band, {}))
assert(not pcall(bit32.bnot, "a"))
assert(not pcall(bit32.lshift, 45))
assert(not pcall(bit32.lshift, 45, print))
assert(not pcall(bit32.rshift, 45, print))
print("+")
-- testing extract/replace
assert(bit32.extract(0x12345678, 0, 4) == 8)
assert(bit32.extract(0x12345678, 4, 4) == 7)
assert(bit32.extract(0xa0001111, 28, 4) == 0xa)
assert(bit32.extract(0xa0001111, 31, 1) == 1)
assert(bit32.extract(0x50000111, 31, 1) == 0)
assert(bit32.extract(0xf2345679, 0, 32) == 0xf2345679)
assert(not pcall(bit32.extract, 0, -1))
assert(not pcall(bit32.extract, 0, 32))
assert(not pcall(bit32.extract, 0, 0, 33))
assert(not pcall(bit32.extract, 0, 31, 2))
assert(bit32.replace(0x12345678, 5, 28, 4) == 0x52345678)
assert(bit32.replace(0x12345678, 0x87654321, 0, 32) == 0x87654321)
assert(bit32.replace(0, 1, 2) == 2^2)
assert(bit32.replace(0, -1, 4) == 2^4)
assert(bit32.replace(-1, 0, 31) == (1 << 31) - 1)
assert(bit32.replace(-1, 0, 1, 2) == (1 << 32) - 7)
-- testing conversion of floats
assert(bit32.bor(3.0) == 3)
assert(bit32.bor(-4.0) == 0xfffffffc)
-- large floats and large-enough integers?
if 2.0^50 < 2.0^50 + 1.0 and 2.0^50 < (-1 >> 1) then
assert(bit32.bor(2.0^32 - 5.0) == 0xfffffffb)
assert(bit32.bor(-2.0^32 - 6.0) == 0xfffffffa)
assert(bit32.bor(2.0^48 - 5.0) == 0xfffffffb)
assert(bit32.bor(-2.0^48 - 6.0) == 0xfffffffa)
end
print'OK'
| 9,601 | 347 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/libs/makefile | # change this variable to point to the directory with Lua headers
# of the version being tested
LUA_DIR = ../../
CC = gcc
# compilation should generate Dynamic-Link Libraries
CFLAGS = -Wall -std=gnu99 -O2 -I$(LUA_DIR) -fPIC -shared
# libraries used by the tests
all: lib1.so lib11.so lib2.so lib21.so lib2-v2.so
touch all
lib1.so: lib1.c $(LUA_DIR)/luaconf.h
$(CC) $(CFLAGS) -o lib1.so lib1.c
lib11.so: lib11.c $(LUA_DIR)/luaconf.h
$(CC) $(CFLAGS) -o lib11.so lib11.c
lib2.so: lib2.c $(LUA_DIR)/luaconf.h
$(CC) $(CFLAGS) -o lib2.so lib2.c
lib21.so: lib21.c $(LUA_DIR)/luaconf.h
$(CC) $(CFLAGS) -o lib21.so lib21.c
lib2-v2.so: lib21.c $(LUA_DIR)/luaconf.h
$(CC) $(CFLAGS) -o lib2-v2.so lib22.c
| 707 | 28 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/libs/lib2.c | #include "lua.h"
#include "lauxlib.h"
static int id (lua_State *L) {
return lua_gettop(L);
}
static const struct luaL_Reg funcs[] = {
{"id", id},
{NULL, NULL}
};
LUAMOD_API int luaopen_lib2 (lua_State *L) {
lua_settop(L, 2);
lua_setglobal(L, "y"); /* y gets 2nd parameter */
lua_setglobal(L, "x"); /* x gets 1st parameter */
luaL_newlib(L, funcs);
return 1;
}
| 385 | 24 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/libs/lib11.c | #include "lua.h"
/* function from lib1.c */
int lib1_export (lua_State *L);
LUAMOD_API int luaopen_lib11 (lua_State *L) {
return lib1_export(L);
}
| 153 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/libs/lib22.c | #include "lua.h"
#include "lauxlib.h"
static int id (lua_State *L) {
lua_pushboolean(L, 1);
lua_insert(L, 1);
return lua_gettop(L);
}
static const struct luaL_Reg funcs[] = {
{"id", id},
{NULL, NULL}
};
LUAMOD_API int luaopen_lib2 (lua_State *L) {
lua_settop(L, 2);
lua_setglobal(L, "y"); /* y gets 2nd parameter */
lua_setglobal(L, "x"); /* x gets 1st parameter */
luaL_newlib(L, funcs);
return 1;
}
| 430 | 26 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/libs/lib1.c | #include "lua.h"
#include "lauxlib.h"
static int id (lua_State *L) {
return lua_gettop(L);
}
static const struct luaL_Reg funcs[] = {
{"id", id},
{NULL, NULL}
};
/* function used by lib11.c */
LUAMOD_API int lib1_export (lua_State *L) {
lua_pushstring(L, "exported");
return 1;
}
LUAMOD_API int onefunction (lua_State *L) {
luaL_checkversion(L);
lua_settop(L, 2);
lua_pushvalue(L, 1);
return 2;
}
LUAMOD_API int anotherfunc (lua_State *L) {
luaL_checkversion(L);
lua_pushfstring(L, "%d%%%d\n", (int)lua_tointeger(L, 1),
(int)lua_tointeger(L, 2));
return 1;
}
LUAMOD_API int luaopen_lib1_sub (lua_State *L) {
lua_setglobal(L, "y"); /* 2nd arg: extra value (file name) */
lua_setglobal(L, "x"); /* 1st arg: module name */
luaL_newlib(L, funcs);
return 1;
}
| 835 | 45 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/libs/lib21.c | #include "lua.h"
int luaopen_lib2 (lua_State *L);
LUAMOD_API int luaopen_lib21 (lua_State *L) {
return luaopen_lib2(L);
}
| 129 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/lua/test/libs/P1/dummy | # This is a dummy file just to make git keep the otherwise empty
# directory 'P1' in the repository.
| 101 | 3 | jart/cosmopolitan | false |
cosmopolitan/third_party/maxmind/maxminddb.h | #ifndef COSMOPOLITAN_THIRD_PARTY_MAXMIND_MAXMINDDB_H_
#define COSMOPOLITAN_THIRD_PARTY_MAXMIND_MAXMINDDB_H_
#include "libc/sock/sock.h"
#include "libc/stdio/stdio.h"
#define MMDB_MODE_MMAP 1
#define MMDB_MODE_MASK 7
#define MMDB_DATA_TYPE_EXTENDED 0
#define MMDB_DATA_TYPE_POINTER 1
#define MMDB_DATA_TYPE_UTF8_STRING 2
#define MMDB_DATA_TYPE_DOUBLE 3
#define MMDB_DATA_TYPE_BYTES 4
#define MMDB_DATA_TYPE_UINT16 5
#define MMDB_DATA_TYPE_UINT32 6
#define MMDB_DATA_TYPE_MAP 7
#define MMDB_DATA_TYPE_INT32 8
#define MMDB_DATA_TYPE_UINT64 9
#define MMDB_DATA_TYPE_UINT128 10
#define MMDB_DATA_TYPE_ARRAY 11
#define MMDB_DATA_TYPE_CONTAINER 12
#define MMDB_DATA_TYPE_END_MARKER 13
#define MMDB_DATA_TYPE_BOOLEAN 14
#define MMDB_DATA_TYPE_FLOAT 15
#define MMDB_RECORD_TYPE_SEARCH_NODE 0
#define MMDB_RECORD_TYPE_EMPTY 1
#define MMDB_RECORD_TYPE_DATA 2
#define MMDB_RECORD_TYPE_INVALID 3
#define MMDB_SUCCESS 0
#define MMDB_FILE_OPEN_ERROR 1
#define MMDB_CORRUPT_SEARCH_TREE_ERROR 2
#define MMDB_INVALID_METADATA_ERROR 3
#define MMDB_IO_ERROR 4
#define MMDB_OUT_OF_MEMORY_ERROR 5
#define MMDB_UNKNOWN_DATABASE_FORMAT_ERROR 6
#define MMDB_INVALID_DATA_ERROR 7
#define MMDB_INVALID_LOOKUP_PATH_ERROR 8
#define MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR 9
#define MMDB_INVALID_NODE_NUMBER_ERROR 10
#define MMDB_IPV6_LOOKUP_IN_IPV4_DATABASE_ERROR 11
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/* This is a pointer into the data section for a given IP address lookup */
typedef struct MMDB_entry_s {
const struct MMDB_s *mmdb;
uint32_t offset;
} MMDB_entry_s;
typedef struct MMDB_lookup_result_s {
bool found_entry;
MMDB_entry_s entry;
uint16_t netmask;
} MMDB_lookup_result_s;
typedef struct MMDB_entry_data_s {
bool has_data;
union {
uint32_t pointer;
const char *utf8_string;
double double_value;
const uint8_t *bytes;
uint16_t uint16;
uint32_t uint32;
int32_t int32;
uint64_t uint64;
uint128_t uint128;
bool boolean;
float float_value;
};
/* This is a 0 if a given entry cannot be found. This can only happen
* when a call to MMDB_(v)get_value() asks for hash keys or array
* indices that don't exist. */
uint32_t offset;
/* This is the next entry in the data section, but it's really only
* relevant for entries that part of a larger map or array
* struct. There's no good reason for an end user to look at this
* directly. */
uint32_t offset_to_next;
/* This is only valid for strings, utf8_strings or binary data */
uint32_t data_size;
/* This is an MMDB_DATA_TYPE_* constant */
uint32_t type;
} MMDB_entry_data_s;
/* This is the return type when someone asks for all the entry data in a map or
* array */
typedef struct MMDB_entry_data_list_s {
MMDB_entry_data_s entry_data;
struct MMDB_entry_data_list_s *next;
void *pool;
} MMDB_entry_data_list_s;
typedef struct MMDB_description_s {
const char *language;
const char *description;
} MMDB_description_s;
/* WARNING: do not add new fields to this struct without bumping the SONAME.
* The struct is allocated by the users of this library and increasing the
* size will cause existing users to allocate too little space when the shared
* library is upgraded */
typedef struct MMDB_metadata_s {
uint32_t node_count;
uint16_t record_size;
uint16_t ip_version;
const char *database_type;
struct {
size_t count;
const char **names;
} languages;
uint16_t binary_format_major_version;
uint16_t binary_format_minor_version;
uint64_t build_epoch;
struct {
size_t count;
MMDB_description_s **descriptions;
} description;
/* See above warning before adding fields */
} MMDB_metadata_s;
/* WARNING: do not add new fields to this struct without bumping the SONAME.
* The struct is allocated by the users of this library and increasing the
* size will cause existing users to allocate too little space when the shared
* library is upgraded */
typedef struct MMDB_ipv4_start_node_s {
uint16_t netmask;
uint32_t node_value;
/* See above warning before adding fields */
} MMDB_ipv4_start_node_s;
/* WARNING: do not add new fields to this struct without bumping the SONAME.
* The struct is allocated by the users of this library and increasing the
* size will cause existing users to allocate too little space when the shared
* library is upgraded */
typedef struct MMDB_s {
uint32_t flags;
const char *filename;
ssize_t file_size;
const uint8_t *file_content;
const uint8_t *data_section;
uint32_t data_section_size;
const uint8_t *metadata_section;
uint32_t metadata_section_size;
uint16_t full_record_byte_size;
uint16_t depth;
MMDB_ipv4_start_node_s ipv4_start_node;
MMDB_metadata_s metadata;
/* See above warning before adding fields */
} MMDB_s;
typedef struct MMDB_search_node_s {
uint64_t left_record;
uint64_t right_record;
uint8_t left_record_type;
uint8_t right_record_type;
MMDB_entry_s left_record_entry;
MMDB_entry_s right_record_entry;
} MMDB_search_node_s;
void MMDB_close(MMDB_s *);
int MMDB_open(const char *, uint32_t, MMDB_s *);
MMDB_lookup_result_s MMDB_lookup(const MMDB_s *, uint32_t, int *);
int MMDB_read_node(const MMDB_s *, uint32_t, MMDB_search_node_s *);
int MMDB_get_value(MMDB_entry_s *, MMDB_entry_data_s *, ...);
int MMDB_vget_value(MMDB_entry_s *, MMDB_entry_data_s *, va_list);
int MMDB_aget_value(MMDB_entry_s *, MMDB_entry_data_s *, const char *const *);
int MMDB_get_metadata_as_entry_data_list(const MMDB_s *,
MMDB_entry_data_list_s **);
int MMDB_get_entry_data_list(MMDB_entry_s *, MMDB_entry_data_list_s **);
void MMDB_free_entry_data_list(MMDB_entry_data_list_s *);
int MMDB_dump_entry_data_list(FILE *, MMDB_entry_data_list_s *, int);
const char *MMDB_lib_version(void);
const char *MMDB_strerror(int);
const char *GetMetroName(int);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_THIRD_PARTY_MAXMIND_MAXMINDDB_H_ */
| 6,268 | 183 | jart/cosmopolitan | false |
cosmopolitan/third_party/maxmind/maxminddb.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¡
â Copyright 2013-2021 MaxMind Incorporated â
â â
â Licensed under the Apache License, Version 2.0 (the "License"); â
â you may not use this file except in compliance with the License. â
â You may obtain a copy of the License at â
â â
â http://www.apache.org/licenses/LICENSE-2.0 â
â â
â Unless required by applicable law or agreed to in writing, software â
â distributed under the License is distributed on an "AS IS" BASIS, â
â WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. â
â See the License for the specific language governing permissions and â
â limitations under the License. â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/calls/weirdtypes.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/intrin/bits.h"
#include "libc/inttypes.h"
#include "libc/limits.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/struct/sockaddr6.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h"
#include "libc/sysv/consts/sock.h"
#include "third_party/maxmind/maxminddb.h"
#include "tool/build/lib/case.h"
asm(".ident\t\"\\n\\n\
libmaxminddb (Apache 2.0)\\n\
Copyright 2013-2021 MaxMind Incorporated\"");
asm(".include \"libc/disclaimer.inc\"");
#define METADATA_MARKER "\xab\xcd\xefMaxMind.com"
#define METADATA_BLOCK_MAX_SIZE 131072 /* This is 128kb */
#define MMDB_POOL_INIT_SIZE 64 /* 64 means 4kb on 64bit */
#define MMDB_DATA_SECTION_SEPARATOR 16
#define MAXIMUM_DATA_STRUCTURE_DEPTH 512
// This should be large enough that we never need to grow the array of pointers
// to blocks. 32 is enough. Even starting out of with size 1 (1 struct), the
// 32nd element alone will provide 2**32 structs as we exponentially increase
// the number in each block. Being confident that we do not have to grow the
// array lets us avoid writing code to do that. That code would be risky as it
// would rarely be hit and likely not be well tested.
#define DATA_POOL_NUM_BLOCKS 32
/* None of the values we check on the lhs are bigger than uint32_t, so on
* platforms where SIZE_MAX is a 64-bit integer, this would be a no-op, and it
* makes the compiler complain if we do the check anyway. */
#if SIZE_MAX == UINT32_MAX
#define MAYBE_CHECK_SIZE_OVERFLOW(lhs, rhs, error) \
if ((lhs) > (rhs)) { \
return error; \
}
#else
#define MAYBE_CHECK_SIZE_OVERFLOW(...)
#endif
#define CHECKED_DECODE_ONE(mmdb, offset, entry_data) \
do { \
int status = decode_one(mmdb, offset, entry_data); \
if (MMDB_SUCCESS != status) { \
DEBUG_MSGF("CHECKED_DECODE_ONE failed." \
" status = %d (%s)", \
status, MMDB_strerror(status)); \
return status; \
} \
} while (0)
#define CHECKED_DECODE_ONE_FOLLOW(mmdb, offset, entry_data) \
do { \
int status = decode_one_follow(mmdb, offset, entry_data); \
if (MMDB_SUCCESS != status) { \
DEBUG_MSGF("CHECKED_DECODE_ONE_FOLLOW failed." \
" status = %d (%s)", \
status, MMDB_strerror(status)); \
return status; \
} \
} while (0)
#define FREE_AND_SET_NULL(p) \
do { \
free((void *)(p)); \
(p) = NULL; \
} while (0)
#ifdef MMDB_DEBUG
#define DEBUG_MSG(msg) fprintf(stderr, msg "\n")
#define DEBUG_MSGF(fmt, ...) fprintf(stderr, fmt "\n", __VA_ARGS__)
#define DEBUG_BINARY(fmt, byte) \
do { \
char *binary = byte_to_binary(byte); \
if (!binary) { \
fprintf(stderr, "Calloc failed in DEBUG_BINARY\n"); \
abort(); \
} \
fprintf(stderr, fmt "\n", binary); \
free(binary); \
} while (0)
#define DEBUG_NL fprintf(stderr, "\n")
#else
#define DEBUG_MSG(...)
#define DEBUG_MSGF(...)
#define DEBUG_BINARY(...)
#define DEBUG_NL
#endif
typedef struct record_info_s {
uint16_t record_length;
uint32_t (*left_record_getter)(const uint8_t *);
uint32_t (*right_record_getter)(const uint8_t *);
uint8_t right_record_offset;
} record_info_s;
// A pool of memory for MMDB_entry_data_list_s structs. This is so we
// can allocate multiple up front rather than one at a time for
// performance reasons. The order you add elements to it (by calling
// data_pool_alloc()) ends up as the order of the list. The memory only
// grows. There is no support for releasing an element you take back to
// the pool.
typedef struct MMDB_data_pool_s {
size_t index; // Index of the current block we're allocating out of.
size_t size; // The size of the current block, counting by structs.
size_t used; // How many used in the current block, counting by structs.
MMDB_entry_data_list_s *block; // The current block we're allocating out of.
size_t sizes[DATA_POOL_NUM_BLOCKS]; // The size of each block.
// An array of pointers to blocks of memory holding space for list elements.
MMDB_entry_data_list_s *blocks[DATA_POOL_NUM_BLOCKS];
} MMDB_data_pool_s;
static char *byte_to_binary(uint8_t byte) {
int i;
char *p;
if ((p = malloc(9))) {
for (i = 0; i < 8; i++) {
p[i] = byte & (128 >> i) ? '1' : '0';
}
p[8] = '\0';
}
return p;
}
static char *type_num_to_name(uint8_t num) {
switch (num) {
case 0:
return "extended";
case 1:
return "pointer";
case 2:
return "utf8_string";
case 3:
return "double";
case 4:
return "bytes";
case 5:
return "uint16";
case 6:
return "uint32";
case 7:
return "map";
case 8:
return "int32";
case 9:
return "uint64";
case 10:
return "uint128";
case 11:
return "array";
case 12:
return "container";
case 13:
return "end_marker";
case 14:
return "boolean";
case 15:
return "float";
default:
return "unknown type";
}
}
static int get_ext_type(int x) {
return 7 + x;
}
static uint32_t get_uint16(const uint8_t *p) {
return p[0] << 8 | p[1];
}
static uint32_t get_uint24(const uint8_t *p) {
return p[0] << 16 | p[1] << 8 | p[2];
}
static uint32_t get_uint32(const uint8_t *p) {
return (uint32_t)p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
}
static uint128_t get_uint128(const uint8_t *p, int n) {
uint128_t x = 0;
while (n-- > 0) x <<= 8, x += *p++;
return x;
}
static uint64_t get_uintX(const uint8_t *p, int n) {
uint64_t x = 0;
while (n-- > 0) x <<= 8, x += *p++;
return x;
}
static int32_t get_sintX(const uint8_t *p, int n) {
return get_uintX(p, n);
}
static uint32_t get_right_28_bit_record(const uint8_t *p) {
return READ32BE(p) & 0xfffffff;
}
static uint32_t get_left_28_bit_record(const uint8_t *p) {
return p[0] * 65536 + p[1] * 256 + p[2] + ((p[3] & 0xf0) << 20);
}
static float get_ieee754_float(const uint8_t *restrict p) {
volatile float f;
uint8_t *q = (void *)&f;
q[3] = p[0];
q[2] = p[1];
q[1] = p[2];
q[0] = p[3];
return f;
}
static double get_ieee754_double(const uint8_t *restrict p) {
volatile double d;
uint8_t *q = (void *)&d;
q[7] = p[0];
q[6] = p[1];
q[5] = p[2];
q[4] = p[3];
q[3] = p[4];
q[2] = p[5];
q[1] = p[6];
q[0] = p[7];
return d;
}
static inline uint32_t get_ptr_from(uint8_t ctrl, uint8_t const *const ptr,
int k) {
switch (k) {
case 1:
return ((ctrl & 7) << 8) + ptr[0];
case 2:
return 2048 + ((ctrl & 7) << 16) + (ptr[0] << 8) + ptr[1];
case 3:
return 2048 + 524288 + ((ctrl & 7) << 24) +
(ptr[0] << 16 | ptr[1] << 8 | ptr[2]);
case 4:
return READ32BE(ptr);
default:
unreachable;
}
}
// Determine if we can multiply m*n. We can do this if the result will be below
// the given max. max will typically be SIZE_MAX. We want to know if we'll wrap
static bool CanMultiply(size_t max, size_t m, size_t n) {
if (!m) return false;
return n <= max / m;
}
// Clean up the data pool.
static void data_pool_destroy(MMDB_data_pool_s *const pool) {
size_t i;
if (!pool) return;
for (i = 0; i <= pool->index; i++) free(pool->blocks[i]);
free(pool);
}
// Allocate an MMDB_data_pool_s. It initially has space for size
// MMDB_entry_data_list_s structs.
static MMDB_data_pool_s *data_pool_new(size_t const size) {
MMDB_data_pool_s *pool;
if (!(pool = calloc(1, sizeof(MMDB_data_pool_s)))) return NULL;
if (size && CanMultiply(SIZE_MAX, size, sizeof(MMDB_entry_data_list_s))) {
pool->size = size;
if ((pool->blocks[0] =
calloc(pool->size, sizeof(MMDB_entry_data_list_s)))) {
pool->blocks[0]->pool = pool;
pool->sizes[0] = size;
pool->block = pool->blocks[0];
return pool;
}
}
data_pool_destroy(pool);
return NULL;
}
// Claim a new struct from the pool. Doing this may cause the pool's size to
// grow.
static MMDB_entry_data_list_s *data_pool_alloc(MMDB_data_pool_s *const pool) {
size_t new_index, new_size;
MMDB_entry_data_list_s *element;
if (!pool) return NULL;
if (pool->used < pool->size) {
element = pool->block + pool->used;
pool->used++;
return element;
}
// Take it from a new block of memory.
new_index = pool->index + 1;
// See the comment about not growing this on DATA_POOL_NUM_BLOCKS.
if (new_index == DATA_POOL_NUM_BLOCKS) return NULL;
if (!CanMultiply(SIZE_MAX, pool->size, 2)) return NULL;
new_size = pool->size * 2;
if (!CanMultiply(SIZE_MAX, new_size, sizeof(*element))) return NULL;
pool->blocks[new_index] = calloc(new_size, sizeof(*element));
if (!pool->blocks[new_index]) return NULL;
// We don't need to set this, but it's useful for introspection in tests.
pool->blocks[new_index]->pool = pool;
pool->index = new_index;
pool->block = pool->blocks[pool->index];
pool->size = new_size;
pool->sizes[pool->index] = pool->size;
element = pool->block;
pool->used = 1;
return element;
}
// Turn the structs in the array-like pool into a linked list.
//
// Before calling this function, the list isn't linked up.
static MMDB_entry_data_list_s *data_pool_to_list(MMDB_data_pool_s *const pool) {
size_t i, j, size;
MMDB_entry_data_list_s *block, *cur, *last;
if (!pool) return NULL;
if (!pool->index && !pool->used) return NULL;
for (i = 0; i <= pool->index; i++) {
block = pool->blocks[i];
size = pool->sizes[i];
if (i == pool->index) size = pool->used;
for (j = 0; j < size - 1; j++) {
cur = block + j;
cur->next = block + j + 1;
}
if (i < pool->index) {
last = block + size - 1;
last->next = pool->blocks[i + 1];
}
}
return pool->blocks[0];
}
static int map_file(MMDB_s *const mmdb) {
uint8_t *p;
ssize_t size;
struct stat s;
int fd, status, saved;
status = MMDB_SUCCESS;
fd = open(mmdb->filename, O_RDONLY | O_CLOEXEC);
if (fd < 0 || fstat(fd, &s)) {
status = MMDB_FILE_OPEN_ERROR;
goto cleanup;
}
size = s.st_size;
if (size < 0 || size != s.st_size) {
status = MMDB_OUT_OF_MEMORY_ERROR;
goto cleanup;
}
if ((p = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) {
status = errno == ENOMEM ? MMDB_OUT_OF_MEMORY_ERROR : MMDB_IO_ERROR;
goto cleanup;
}
mmdb->file_size = size;
mmdb->file_content = p;
cleanup:;
saved = errno;
if (fd >= 0) close(fd);
errno = saved;
return status;
}
static MMDB_s make_fake_metadata_db(const MMDB_s *const mmdb) {
return (MMDB_s){.data_section = mmdb->metadata_section,
.data_section_size = mmdb->metadata_section_size};
}
static int value_for_key_as_uint16(MMDB_entry_s *start, char *key,
uint16_t *value) {
MMDB_entry_data_s entry_data;
const char *path[] = {key, NULL};
int status = MMDB_aget_value(start, &entry_data, path);
if (MMDB_SUCCESS != status) return status;
if (MMDB_DATA_TYPE_UINT16 != entry_data.type) {
DEBUG_MSGF("expect uint16 for %s but received %s", key,
type_num_to_name(entry_data.type));
return MMDB_INVALID_METADATA_ERROR;
}
*value = entry_data.uint16;
return MMDB_SUCCESS;
}
static int value_for_key_as_uint32(MMDB_entry_s *start, char *key,
uint32_t *value) {
MMDB_entry_data_s entry_data;
const char *path[] = {key, NULL};
int status = MMDB_aget_value(start, &entry_data, path);
if (MMDB_SUCCESS != status) return status;
if (MMDB_DATA_TYPE_UINT32 != entry_data.type) {
DEBUG_MSGF("expect uint32 for %s but received %s", key,
type_num_to_name(entry_data.type));
return MMDB_INVALID_METADATA_ERROR;
}
*value = entry_data.uint32;
return MMDB_SUCCESS;
}
static int value_for_key_as_uint64(MMDB_entry_s *start, char *key,
uint64_t *value) {
MMDB_entry_data_s entry_data;
const char *path[] = {key, NULL};
int status = MMDB_aget_value(start, &entry_data, path);
if (MMDB_SUCCESS != status) return status;
if (MMDB_DATA_TYPE_UINT64 != entry_data.type) {
DEBUG_MSGF("expect uint64 for %s but received %s", key,
type_num_to_name(entry_data.type));
return MMDB_INVALID_METADATA_ERROR;
}
*value = entry_data.uint64;
return MMDB_SUCCESS;
}
static int value_for_key_as_string(MMDB_entry_s *start, char *key,
char const **value) {
MMDB_entry_data_s entry_data;
const char *path[] = {key, NULL};
int status = MMDB_aget_value(start, &entry_data, path);
if (MMDB_SUCCESS != status) return status;
if (MMDB_DATA_TYPE_UTF8_STRING != entry_data.type) {
DEBUG_MSGF("expect string for %s but received %s", key,
type_num_to_name(entry_data.type));
return MMDB_INVALID_METADATA_ERROR;
}
*value = strndup((char *)entry_data.utf8_string, entry_data.data_size);
if (!*value) return MMDB_OUT_OF_MEMORY_ERROR;
return MMDB_SUCCESS;
}
static int populate_languages_metadata(MMDB_s *mmdb, MMDB_s *metadata_db,
MMDB_entry_s *metadata_start) {
MMDB_entry_data_s entry_data;
const char *path[] = {"languages", NULL};
int status = MMDB_aget_value(metadata_start, &entry_data, path);
if (MMDB_SUCCESS != status) return status;
if (MMDB_DATA_TYPE_ARRAY != entry_data.type) {
return MMDB_INVALID_METADATA_ERROR;
}
MMDB_entry_s array_start = {.mmdb = metadata_db, .offset = entry_data.offset};
MMDB_entry_data_list_s *member;
status = MMDB_get_entry_data_list(&array_start, &member);
if (MMDB_SUCCESS != status) return status;
MMDB_entry_data_list_s *first_member = member;
uint32_t array_size = member->entry_data.data_size;
MAYBE_CHECK_SIZE_OVERFLOW(array_size, SIZE_MAX / sizeof(char *),
MMDB_INVALID_METADATA_ERROR);
mmdb->metadata.languages.count = 0;
mmdb->metadata.languages.names = calloc(array_size, sizeof(char *));
if (!mmdb->metadata.languages.names) return MMDB_OUT_OF_MEMORY_ERROR;
for (uint32_t i = 0; i < array_size; i++) {
member = member->next;
if (MMDB_DATA_TYPE_UTF8_STRING != member->entry_data.type) {
return MMDB_INVALID_METADATA_ERROR;
}
mmdb->metadata.languages.names[i] = strndup(
(char *)member->entry_data.utf8_string, member->entry_data.data_size);
if (!mmdb->metadata.languages.names[i]) return MMDB_OUT_OF_MEMORY_ERROR;
// We assign this as we go so that if we fail a calloc and need to
// free it, the count is right.
mmdb->metadata.languages.count = i + 1;
}
MMDB_free_entry_data_list(first_member);
return MMDB_SUCCESS;
}
static int populate_description_metadata(MMDB_s *mmdb, MMDB_s *metadata_db,
MMDB_entry_s *metadata_start) {
MMDB_entry_data_s entry_data;
const char *path[] = {"description", NULL};
int status = MMDB_aget_value(metadata_start, &entry_data, path);
if (MMDB_SUCCESS != status) return status;
if (MMDB_DATA_TYPE_MAP != entry_data.type) {
DEBUG_MSGF("Unexpected entry_data type: %d", entry_data.type);
return MMDB_INVALID_METADATA_ERROR;
}
MMDB_entry_s map_start = {.mmdb = metadata_db, .offset = entry_data.offset};
MMDB_entry_data_list_s *member;
status = MMDB_get_entry_data_list(&map_start, &member);
if (MMDB_SUCCESS != status) {
DEBUG_MSGF("MMDB_get_entry_data_list failed while populating description."
" status = %d (%s)",
status, MMDB_strerror(status));
return status;
}
MMDB_entry_data_list_s *first_member = member;
uint32_t map_size = member->entry_data.data_size;
mmdb->metadata.description.count = 0;
if (0 == map_size) {
mmdb->metadata.description.descriptions = NULL;
goto cleanup;
}
MAYBE_CHECK_SIZE_OVERFLOW(map_size, SIZE_MAX / sizeof(MMDB_description_s *),
MMDB_INVALID_METADATA_ERROR);
mmdb->metadata.description.descriptions =
calloc(map_size, sizeof(MMDB_description_s *));
if (!mmdb->metadata.description.descriptions) {
status = MMDB_OUT_OF_MEMORY_ERROR;
goto cleanup;
}
for (uint32_t i = 0; i < map_size; i++) {
mmdb->metadata.description.descriptions[i] =
calloc(1, sizeof(MMDB_description_s));
if (!mmdb->metadata.description.descriptions[i]) {
status = MMDB_OUT_OF_MEMORY_ERROR;
goto cleanup;
}
mmdb->metadata.description.count = i + 1;
mmdb->metadata.description.descriptions[i]->language = NULL;
mmdb->metadata.description.descriptions[i]->description = NULL;
member = member->next;
if (MMDB_DATA_TYPE_UTF8_STRING != member->entry_data.type) {
status = MMDB_INVALID_METADATA_ERROR;
goto cleanup;
}
mmdb->metadata.description.descriptions[i]->language = strndup(
(char *)member->entry_data.utf8_string, member->entry_data.data_size);
if (!mmdb->metadata.description.descriptions[i]->language) {
status = MMDB_OUT_OF_MEMORY_ERROR;
goto cleanup;
}
member = member->next;
if (MMDB_DATA_TYPE_UTF8_STRING != member->entry_data.type) {
status = MMDB_INVALID_METADATA_ERROR;
goto cleanup;
}
mmdb->metadata.description.descriptions[i]->description = strndup(
(char *)member->entry_data.utf8_string, member->entry_data.data_size);
if (!mmdb->metadata.description.descriptions[i]->description) {
status = MMDB_OUT_OF_MEMORY_ERROR;
goto cleanup;
}
}
cleanup:
MMDB_free_entry_data_list(first_member);
return status;
}
static int read_metadata(MMDB_s *mmdb) {
/* We need to create a fake MMDB_s struct in order to decode values from
the metadata. The metadata is basically just like the data section, so we
want to use the same functions we use for the data section to get
metadata values. */
MMDB_s metadata_db = make_fake_metadata_db(mmdb);
MMDB_entry_s metadata_start = {.mmdb = &metadata_db, .offset = 0};
int status = value_for_key_as_uint32(&metadata_start, "node_count",
&mmdb->metadata.node_count);
if (MMDB_SUCCESS != status) return status;
if (!mmdb->metadata.node_count) {
DEBUG_MSG("could not find node_count value in metadata");
return MMDB_INVALID_METADATA_ERROR;
}
status = value_for_key_as_uint16(&metadata_start, "record_size",
&mmdb->metadata.record_size);
if (MMDB_SUCCESS != status) return status;
if (!mmdb->metadata.record_size) {
DEBUG_MSG("could not find record_size value in metadata");
return MMDB_INVALID_METADATA_ERROR;
}
if (mmdb->metadata.record_size != 24 && mmdb->metadata.record_size != 28 &&
mmdb->metadata.record_size != 32) {
DEBUG_MSGF("bad record size in metadata: %i", mmdb->metadata.record_size);
return MMDB_UNKNOWN_DATABASE_FORMAT_ERROR;
}
status = value_for_key_as_uint16(&metadata_start, "ip_version",
&mmdb->metadata.ip_version);
if (MMDB_SUCCESS != status) return status;
if (!mmdb->metadata.ip_version) {
DEBUG_MSG("could not find ip_version value in metadata");
return MMDB_INVALID_METADATA_ERROR;
}
if (!(mmdb->metadata.ip_version == 4 || mmdb->metadata.ip_version == 6)) {
DEBUG_MSGF("ip_version value in metadata is not 4 or 6 - it was %i",
mmdb->metadata.ip_version);
return MMDB_INVALID_METADATA_ERROR;
}
status = value_for_key_as_string(&metadata_start, "database_type",
&mmdb->metadata.database_type);
if (MMDB_SUCCESS != status) {
DEBUG_MSG("error finding database_type value in metadata");
return status;
}
status = populate_languages_metadata(mmdb, &metadata_db, &metadata_start);
if (MMDB_SUCCESS != status) {
DEBUG_MSG("could not populate languages from metadata");
return status;
}
status =
value_for_key_as_uint16(&metadata_start, "binary_format_major_version",
&mmdb->metadata.binary_format_major_version);
if (MMDB_SUCCESS != status) return status;
if (!mmdb->metadata.binary_format_major_version) {
DEBUG_MSG("could not find binary_format_major_version value in metadata");
return MMDB_INVALID_METADATA_ERROR;
}
status =
value_for_key_as_uint16(&metadata_start, "binary_format_minor_version",
&mmdb->metadata.binary_format_minor_version);
if (MMDB_SUCCESS != status) return status;
status = value_for_key_as_uint64(&metadata_start, "build_epoch",
&mmdb->metadata.build_epoch);
if (MMDB_SUCCESS != status) return status;
if (!mmdb->metadata.build_epoch) {
DEBUG_MSG("could not find build_epoch value in metadata");
return MMDB_INVALID_METADATA_ERROR;
}
status = populate_description_metadata(mmdb, &metadata_db, &metadata_start);
if (MMDB_SUCCESS != status) {
DEBUG_MSG("could not populate description from metadata");
return status;
}
mmdb->full_record_byte_size = mmdb->metadata.record_size * 2 / 8U;
mmdb->depth = mmdb->metadata.ip_version == 4 ? 32 : 128;
return MMDB_SUCCESS;
}
static const uint8_t *find_metadata(const uint8_t *file_content,
ssize_t file_size,
uint32_t *metadata_size) {
ssize_t marker_len, max_size;
uint8_t *search_area, *start, *tmp;
marker_len = sizeof(METADATA_MARKER) - 1;
max_size =
file_size > METADATA_BLOCK_MAX_SIZE ? METADATA_BLOCK_MAX_SIZE : file_size;
search_area = (uint8_t *)(file_content + (file_size - max_size));
start = search_area;
do {
tmp = memmem(search_area, max_size, METADATA_MARKER, marker_len);
if (tmp) {
max_size -= tmp - search_area;
search_area = tmp;
/* Continue searching just after the marker we just read, in case
* there are multiple markers in the same file. This would be odd
* but is certainly not impossible. */
max_size -= marker_len;
search_area += marker_len;
}
} while (tmp);
if (search_area == start) return NULL;
*metadata_size = (uint32_t)max_size;
return search_area;
}
static record_info_s record_info_for_database(const MMDB_s *const mmdb) {
record_info_s record_info = {.record_length = mmdb->full_record_byte_size,
.right_record_offset = 0};
if (record_info.record_length == 6) {
record_info.left_record_getter = &get_uint24;
record_info.right_record_getter = &get_uint24;
record_info.right_record_offset = 3;
} else if (record_info.record_length == 7) {
record_info.left_record_getter = &get_left_28_bit_record;
record_info.right_record_getter = &get_right_28_bit_record;
record_info.right_record_offset = 3;
} else if (record_info.record_length == 8) {
record_info.left_record_getter = &get_uint32;
record_info.right_record_getter = &get_uint32;
record_info.right_record_offset = 4;
} else {
unreachable;
}
return record_info;
}
static int find_ipv4_start_node(MMDB_s *const mmdb) {
/* In a pathological case of a database with a single node search tree,
* this check will be true even after we've found the IPv4 start node, but
* that doesn't seem worth trying to fix. */
if (mmdb->ipv4_start_node.node_value) return MMDB_SUCCESS;
record_info_s record_info = record_info_for_database(mmdb);
const uint8_t *search_tree = mmdb->file_content;
uint32_t node_value = 0;
const uint8_t *record_pointer;
uint16_t netmask;
uint32_t node_count = mmdb->metadata.node_count;
for (netmask = 0; netmask < 96 && node_value < node_count; netmask++) {
record_pointer = &search_tree[node_value * record_info.record_length];
if (record_pointer + record_info.record_length > mmdb->data_section) {
return MMDB_CORRUPT_SEARCH_TREE_ERROR;
}
node_value = record_info.left_record_getter(record_pointer);
}
mmdb->ipv4_start_node.node_value = node_value;
mmdb->ipv4_start_node.netmask = netmask;
return MMDB_SUCCESS;
}
static void free_languages_metadata(MMDB_s *mmdb) {
if (!mmdb->metadata.languages.names) return;
for (size_t i = 0; i < mmdb->metadata.languages.count; i++) {
FREE_AND_SET_NULL(mmdb->metadata.languages.names[i]);
}
FREE_AND_SET_NULL(mmdb->metadata.languages.names);
}
static void free_descriptions_metadata(MMDB_s *mmdb) {
if (!mmdb->metadata.description.count) return;
for (size_t i = 0; i < mmdb->metadata.description.count; i++) {
if (mmdb->metadata.description.descriptions[i]) {
if (mmdb->metadata.description.descriptions[i]->language) {
FREE_AND_SET_NULL(mmdb->metadata.description.descriptions[i]->language);
}
if (mmdb->metadata.description.descriptions[i]->description) {
FREE_AND_SET_NULL(
mmdb->metadata.description.descriptions[i]->description);
}
FREE_AND_SET_NULL(mmdb->metadata.description.descriptions[i]);
}
}
FREE_AND_SET_NULL(mmdb->metadata.description.descriptions);
}
static void free_mmdb_struct(MMDB_s *const mmdb) {
if (!mmdb) return;
if (mmdb->filename) FREE_AND_SET_NULL(mmdb->filename);
if (mmdb->file_content) munmap((void *)mmdb->file_content, mmdb->file_size);
if (mmdb->metadata.database_type) {
FREE_AND_SET_NULL(mmdb->metadata.database_type);
}
free_languages_metadata(mmdb);
free_descriptions_metadata(mmdb);
}
int MMDB_open(const char *const filename, uint32_t flags, MMDB_s *const mmdb) {
int status, saved;
const uint8_t *metadata;
uint32_t metadata_size, search_tree_size;
status = MMDB_SUCCESS;
mmdb->file_content = NULL;
mmdb->data_section = NULL;
mmdb->metadata.database_type = NULL;
mmdb->metadata.languages.count = 0;
mmdb->metadata.languages.names = NULL;
mmdb->metadata.description.count = 0;
mmdb->filename = strdup(filename);
if (!mmdb->filename) {
status = MMDB_OUT_OF_MEMORY_ERROR;
goto cleanup;
}
if ((flags & MMDB_MODE_MASK) == 0) flags |= MMDB_MODE_MMAP;
mmdb->flags = flags;
if (MMDB_SUCCESS != (status = map_file(mmdb))) goto cleanup;
metadata_size = 0;
metadata = find_metadata(mmdb->file_content, mmdb->file_size, &metadata_size);
if (!metadata) {
status = MMDB_INVALID_METADATA_ERROR;
goto cleanup;
}
mmdb->metadata_section = metadata;
mmdb->metadata_section_size = metadata_size;
status = read_metadata(mmdb);
if (MMDB_SUCCESS != status) goto cleanup;
if (mmdb->metadata.binary_format_major_version != 2) {
status = MMDB_UNKNOWN_DATABASE_FORMAT_ERROR;
goto cleanup;
}
search_tree_size = mmdb->metadata.node_count * mmdb->full_record_byte_size;
mmdb->data_section =
mmdb->file_content + search_tree_size + MMDB_DATA_SECTION_SEPARATOR;
if (search_tree_size + MMDB_DATA_SECTION_SEPARATOR >
(uint32_t)mmdb->file_size) {
status = MMDB_INVALID_METADATA_ERROR;
goto cleanup;
}
mmdb->data_section_size = (uint32_t)mmdb->file_size - search_tree_size -
MMDB_DATA_SECTION_SEPARATOR;
// Although it is likely not possible to construct a database with valid
// valid metadata, as parsed above, and a data_section_size less than 3,
// we do this check as later we assume it is at least three when doing
// bound checks.
if (mmdb->data_section_size < 3) {
status = MMDB_INVALID_DATA_ERROR;
goto cleanup;
}
mmdb->metadata_section = metadata;
mmdb->ipv4_start_node.node_value = 0;
mmdb->ipv4_start_node.netmask = 0;
// We do this immediately as otherwise there is a race to set
// ipv4_start_node.node_value and ipv4_start_node.netmask.
if (mmdb->metadata.ip_version == 6) {
status = find_ipv4_start_node(mmdb);
if (status != MMDB_SUCCESS) goto cleanup;
}
cleanup:
if (status != MMDB_SUCCESS) {
saved = errno;
free_mmdb_struct(mmdb);
errno = saved;
}
return status;
}
static uint32_t data_section_offset_for_record(const MMDB_s *const mmdb,
uint64_t record) {
return (uint32_t)record - mmdb->metadata.node_count -
MMDB_DATA_SECTION_SEPARATOR;
}
static int find_address_in_search_tree(const MMDB_s *const mmdb,
uint8_t *address,
sa_family_t address_family,
MMDB_lookup_result_s *result) {
record_info_s record_info = record_info_for_database(mmdb);
if (!record_info.right_record_offset) {
return MMDB_UNKNOWN_DATABASE_FORMAT_ERROR;
}
uint32_t value = 0;
uint16_t current_bit = 0;
if (mmdb->metadata.ip_version == 6 && address_family == AF_INET) {
value = mmdb->ipv4_start_node.node_value;
current_bit = mmdb->ipv4_start_node.netmask;
}
uint32_t node_count = mmdb->metadata.node_count;
const uint8_t *search_tree = mmdb->file_content;
const uint8_t *record_pointer;
for (; current_bit < mmdb->depth && value < node_count; current_bit++) {
uint8_t bit = 1U & (address[current_bit >> 3] >> (7 - (current_bit % 8)));
record_pointer = &search_tree[value * record_info.record_length];
if (record_pointer + record_info.record_length > mmdb->data_section) {
return MMDB_CORRUPT_SEARCH_TREE_ERROR;
}
if (bit) {
record_pointer += record_info.right_record_offset;
value = record_info.right_record_getter(record_pointer);
} else {
value = record_info.left_record_getter(record_pointer);
}
}
result->netmask = current_bit;
if (value >= node_count + mmdb->data_section_size) {
// The pointer points off the end of the database.
return MMDB_CORRUPT_SEARCH_TREE_ERROR;
}
if (value == node_count) {
// record is empty
result->found_entry = false;
return MMDB_SUCCESS;
}
result->found_entry = true;
result->entry.offset = data_section_offset_for_record(mmdb, value);
return MMDB_SUCCESS;
}
MMDB_lookup_result_s MMDB_lookup(const MMDB_s *mmdb, uint32_t ip, int *error) {
uint8_t a[16];
MMDB_lookup_result_s result = {.entry = {.mmdb = mmdb}};
a[0x0] = 0;
a[0x1] = 0;
a[0x2] = 0;
a[0x3] = 0;
a[0x4] = 0;
a[0x5] = 0;
a[0x6] = 0;
a[0x7] = 0;
a[0x8] = 0;
a[0x9] = 0;
a[0xa] = 0;
a[0xb] = 0;
a[0xc] = (ip & 0xff000000) >> 030;
a[0xd] = (ip & 0x00ff0000) >> 020;
a[0xe] = (ip & 0x0000ff00) >> 010;
a[0xf] = (ip & 0x000000ff) >> 000;
*error = find_address_in_search_tree(mmdb, a, AF_INET, &result);
return result;
}
static uint8_t record_type(const MMDB_s *const mmdb, uint64_t record) {
uint32_t node_count = mmdb->metadata.node_count;
/* Ideally we'd check to make sure that a record never points to a
* previously seen value, but that's more complicated. For now, we can
* at least check that we don't end up at the top of the tree again. */
if (record == 0) {
DEBUG_MSG("record has a value of 0");
return MMDB_RECORD_TYPE_INVALID;
}
if (record < node_count) return MMDB_RECORD_TYPE_SEARCH_NODE;
if (record == node_count) return MMDB_RECORD_TYPE_EMPTY;
if (record - node_count < mmdb->data_section_size) {
return MMDB_RECORD_TYPE_DATA;
}
DEBUG_MSG("record has a value that points outside of the database");
return MMDB_RECORD_TYPE_INVALID;
}
int MMDB_read_node(const MMDB_s *const mmdb, uint32_t node_number,
MMDB_search_node_s *const node) {
record_info_s record_info = record_info_for_database(mmdb);
if (0 == record_info.right_record_offset) {
return MMDB_UNKNOWN_DATABASE_FORMAT_ERROR;
}
if (node_number > mmdb->metadata.node_count) {
return MMDB_INVALID_NODE_NUMBER_ERROR;
}
const uint8_t *search_tree = mmdb->file_content;
const uint8_t *record_pointer =
&search_tree[node_number * record_info.record_length];
node->left_record = record_info.left_record_getter(record_pointer);
record_pointer += record_info.right_record_offset;
node->right_record = record_info.right_record_getter(record_pointer);
node->left_record_type = record_type(mmdb, node->left_record);
node->right_record_type = record_type(mmdb, node->right_record);
// Note that offset will be invalid if the record type is not
// MMDB_RECORD_TYPE_DATA, but that's ok. Any use of the record entry
// for other data types is a programming error.
node->left_record_entry = (struct MMDB_entry_s){
.mmdb = mmdb,
.offset = data_section_offset_for_record(mmdb, node->left_record),
};
node->right_record_entry = (struct MMDB_entry_s){
.mmdb = mmdb,
.offset = data_section_offset_for_record(mmdb, node->right_record),
};
return MMDB_SUCCESS;
}
int MMDB_get_value(MMDB_entry_s *const start,
MMDB_entry_data_s *const entry_data, ...) {
va_list path;
va_start(path, entry_data);
int status = MMDB_vget_value(start, entry_data, path);
va_end(path);
return status;
}
static int path_length(va_list va_path) {
int i = 0;
va_list path_copy;
const char *ignore;
va_copy(path_copy, va_path);
while ((ignore = va_arg(path_copy, char *))) i++;
va_end(path_copy);
return i;
}
int MMDB_vget_value(MMDB_entry_s *const start,
MMDB_entry_data_s *const entry_data, va_list va_path) {
int length = path_length(va_path);
const char *path_elem;
int i = 0;
MAYBE_CHECK_SIZE_OVERFLOW(length, SIZE_MAX / sizeof(const char *) - 1,
MMDB_INVALID_METADATA_ERROR);
const char **path = calloc(length + 1, sizeof(const char *));
if (!path) return MMDB_OUT_OF_MEMORY_ERROR;
while ((path_elem = va_arg(va_path, char *))) path[i] = path_elem, i++;
path[i] = NULL;
int status = MMDB_aget_value(start, entry_data, path);
free((char **)path);
return status;
}
static int decode_one(const MMDB_s *const mmdb, uint32_t offset,
MMDB_entry_data_s *entry_data) {
const uint8_t *mem = mmdb->data_section;
// We subtract rather than add as it possible that offset + 1
// could overflow for a corrupt database while an underflow
// from data_section_size - 1 should not be possible.
if (offset > mmdb->data_section_size - 1) {
DEBUG_MSGF("Offset (%d) past data section (%d)", offset,
mmdb->data_section_size);
return MMDB_INVALID_DATA_ERROR;
}
entry_data->offset = offset;
entry_data->has_data = true;
DEBUG_NL;
DEBUG_MSGF("Offset: %i", offset);
uint8_t ctrl = mem[offset++];
DEBUG_BINARY("Control byte: %s", ctrl);
int type = (ctrl >> 5) & 7;
DEBUG_MSGF("Type: %i (%s)", type, type_num_to_name(type));
if (type == MMDB_DATA_TYPE_EXTENDED) {
// Subtracting 1 to avoid possible overflow on offset + 1
if (offset > mmdb->data_section_size - 1) {
DEBUG_MSGF("Extended type offset (%d) past data section (%d)", offset,
mmdb->data_section_size);
return MMDB_INVALID_DATA_ERROR;
}
type = get_ext_type(mem[offset++]);
DEBUG_MSGF("Extended type: %i (%s)", type, type_num_to_name(type));
}
entry_data->type = type;
if (type == MMDB_DATA_TYPE_POINTER) {
uint8_t psize = ((ctrl >> 3) & 3) + 1;
DEBUG_MSGF("Pointer size: %i", psize);
// We check that the offset does not extend past the end of the
// database and that the subtraction of psize did not underflow.
if (offset > mmdb->data_section_size - psize ||
mmdb->data_section_size < psize) {
DEBUG_MSGF("Pointer offset (%d) past data section (%d)", offset + psize,
mmdb->data_section_size);
return MMDB_INVALID_DATA_ERROR;
}
entry_data->pointer = get_ptr_from(ctrl, &mem[offset], psize);
DEBUG_MSGF("Pointer to: %i", entry_data->pointer);
entry_data->data_size = psize;
entry_data->offset_to_next = offset + psize;
return MMDB_SUCCESS;
}
uint32_t size = ctrl & 31;
switch (size) {
case 29:
// We subtract when checking offset to avoid possible overflow
if (offset > mmdb->data_section_size - 1) {
DEBUG_MSGF("String end (%d, case 29) past data section (%d)", offset,
mmdb->data_section_size);
return MMDB_INVALID_DATA_ERROR;
}
size = 29 + mem[offset++];
break;
case 30:
// We subtract when checking offset to avoid possible overflow
if (offset > mmdb->data_section_size - 2) {
DEBUG_MSGF("String end (%d, case 30) past data section (%d)", offset,
mmdb->data_section_size);
return MMDB_INVALID_DATA_ERROR;
}
size = 285 + get_uint16(&mem[offset]);
offset += 2;
break;
case 31:
// We subtract when checking offset to avoid possible overflow
if (offset > mmdb->data_section_size - 3) {
DEBUG_MSGF("String end (%d, case 31) past data section (%d)", offset,
mmdb->data_section_size);
return MMDB_INVALID_DATA_ERROR;
}
size = 65821 + get_uint24(&mem[offset]);
offset += 3;
default:
break;
}
DEBUG_MSGF("Size: %i", size);
if (type == MMDB_DATA_TYPE_MAP || type == MMDB_DATA_TYPE_ARRAY) {
entry_data->data_size = size;
entry_data->offset_to_next = offset;
return MMDB_SUCCESS;
}
if (type == MMDB_DATA_TYPE_BOOLEAN) {
entry_data->boolean = size ? true : false;
entry_data->data_size = 0;
entry_data->offset_to_next = offset;
DEBUG_MSGF("boolean value: %s", entry_data->boolean ? "true" : "false");
return MMDB_SUCCESS;
}
// Check that the data doesn't extend past the end of the memory
// buffer and that the calculation in doing this did not underflow.
if (offset > mmdb->data_section_size - size ||
mmdb->data_section_size < size) {
DEBUG_MSGF("Data end (%d) past data section (%d)", offset + size,
mmdb->data_section_size);
return MMDB_INVALID_DATA_ERROR;
}
if (type == MMDB_DATA_TYPE_UINT16) {
if (size > 2) {
DEBUG_MSGF("uint16 of size %d", size);
return MMDB_INVALID_DATA_ERROR;
}
entry_data->uint16 = (uint16_t)get_uintX(&mem[offset], size);
DEBUG_MSGF("uint16 value: %u", entry_data->uint16);
} else if (type == MMDB_DATA_TYPE_UINT32) {
if (size > 4) {
DEBUG_MSGF("uint32 of size %d", size);
return MMDB_INVALID_DATA_ERROR;
}
entry_data->uint32 = (uint32_t)get_uintX(&mem[offset], size);
DEBUG_MSGF("uint32 value: %u", entry_data->uint32);
} else if (type == MMDB_DATA_TYPE_INT32) {
if (size > 4) {
DEBUG_MSGF("int32 of size %d", size);
return MMDB_INVALID_DATA_ERROR;
}
entry_data->int32 = get_sintX(&mem[offset], size);
DEBUG_MSGF("int32 value: %i", entry_data->int32);
} else if (type == MMDB_DATA_TYPE_UINT64) {
if (size > 8) {
DEBUG_MSGF("uint64 of size %d", size);
return MMDB_INVALID_DATA_ERROR;
}
entry_data->uint64 = get_uintX(&mem[offset], size);
DEBUG_MSGF("uint64 value: %" PRIu64, entry_data->uint64);
} else if (type == MMDB_DATA_TYPE_UINT128) {
if (size > 16) {
DEBUG_MSGF("uint128 of size %d", size);
return MMDB_INVALID_DATA_ERROR;
}
entry_data->uint128 = get_uint128(&mem[offset], size);
} else if (type == MMDB_DATA_TYPE_FLOAT) {
if (size != 4) {
DEBUG_MSGF("float of size %d", size);
return MMDB_INVALID_DATA_ERROR;
}
size = 4;
entry_data->float_value = get_ieee754_float(&mem[offset]);
DEBUG_MSGF("float value: %f", entry_data->float_value);
} else if (type == MMDB_DATA_TYPE_DOUBLE) {
if (size != 8) {
DEBUG_MSGF("double of size %d", size);
return MMDB_INVALID_DATA_ERROR;
}
size = 8;
entry_data->double_value = get_ieee754_double(&mem[offset]);
DEBUG_MSGF("double value: %f", entry_data->double_value);
} else if (type == MMDB_DATA_TYPE_UTF8_STRING) {
entry_data->utf8_string = size == 0 ? "" : (char *)&mem[offset];
entry_data->data_size = size;
#ifdef MMDB_DEBUG
char *string = strndup(entry_data->utf8_string, size > 50 ? 50 : size);
if (!string) abort();
DEBUG_MSGF("string value: %s", string);
free(string);
#endif
} else if (type == MMDB_DATA_TYPE_BYTES) {
entry_data->bytes = &mem[offset];
entry_data->data_size = size;
}
entry_data->offset_to_next = offset + size;
return MMDB_SUCCESS;
}
static int skip_map_or_array(const MMDB_s *const mmdb,
MMDB_entry_data_s *entry_data) {
int rc;
uint32_t size;
if (entry_data->type == MMDB_DATA_TYPE_MAP) {
size = entry_data->data_size;
while (size-- > 0) {
CHECKED_DECODE_ONE(mmdb, entry_data->offset_to_next, entry_data); // key
CHECKED_DECODE_ONE(mmdb, entry_data->offset_to_next,
entry_data); // value
if ((rc = skip_map_or_array(mmdb, entry_data))) return rc;
}
} else if (entry_data->type == MMDB_DATA_TYPE_ARRAY) {
size = entry_data->data_size;
while (size-- > 0) {
CHECKED_DECODE_ONE(mmdb, entry_data->offset_to_next,
entry_data); // value
if ((rc = skip_map_or_array(mmdb, entry_data))) return rc;
}
}
return MMDB_SUCCESS;
}
static inline int decode_one_follow(const MMDB_s *const mmdb, uint32_t offset,
MMDB_entry_data_s *entry_data) {
uint32_t next;
CHECKED_DECODE_ONE(mmdb, offset, entry_data);
if (entry_data->type == MMDB_DATA_TYPE_POINTER) {
next = entry_data->offset_to_next;
CHECKED_DECODE_ONE(mmdb, entry_data->pointer, entry_data);
/* Pointers to pointers are illegal under the spec */
if (entry_data->type == MMDB_DATA_TYPE_POINTER) {
DEBUG_MSG("pointer points to another pointer");
return MMDB_INVALID_DATA_ERROR;
}
/* The pointer could point to any part of the data section but the
* next entry for this particular offset may be the one after the
* pointer, not the one after whatever the pointer points to. This
* depends on whether the pointer points to something that is a simple
* value or a compound value. For a compound value, the next one is
* the one after the pointer result, not the one after the pointer. */
if (entry_data->type != MMDB_DATA_TYPE_MAP &&
entry_data->type != MMDB_DATA_TYPE_ARRAY) {
entry_data->offset_to_next = next;
}
}
return MMDB_SUCCESS;
}
static int lookup_path_in_array(const char *path_elem, const MMDB_s *const mmdb,
MMDB_entry_data_s *entry_data) {
uint32_t size;
char *first_invalid;
MMDB_entry_data_s value;
int rc, saved_errno, array_index;
saved_errno = errno;
errno = 0;
size = entry_data->data_size;
array_index = strtol(path_elem, &first_invalid, 10);
if (ERANGE == errno) {
errno = saved_errno;
return MMDB_INVALID_LOOKUP_PATH_ERROR;
}
errno = saved_errno;
if (array_index < 0) {
array_index += size;
if (array_index < 0) return MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR;
}
if (*first_invalid || (uint32_t)array_index >= size) {
return MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR;
}
for (int i = 0; i < array_index; i++) {
/* We don't want to follow a pointer here. If the next element is a
* pointer we simply skip it and keep going */
CHECKED_DECODE_ONE(mmdb, entry_data->offset_to_next, entry_data);
if ((rc = skip_map_or_array(mmdb, entry_data))) return rc;
}
CHECKED_DECODE_ONE_FOLLOW(mmdb, entry_data->offset_to_next, &value);
memcpy(entry_data, &value, sizeof(MMDB_entry_data_s));
return MMDB_SUCCESS;
}
static int lookup_path_in_map(const char *path_elem, const MMDB_s *const mmdb,
MMDB_entry_data_s *entry_data) {
int rc;
size_t path_elem_len;
MMDB_entry_data_s key, value;
uint32_t size, offset, offset_to_value;
size = entry_data->data_size;
offset = entry_data->offset_to_next;
path_elem_len = strlen(path_elem);
while (size-- > 0) {
CHECKED_DECODE_ONE_FOLLOW(mmdb, offset, &key);
offset_to_value = key.offset_to_next;
if (MMDB_DATA_TYPE_UTF8_STRING != key.type) {
return MMDB_INVALID_DATA_ERROR;
}
if (key.data_size == path_elem_len &&
!memcmp(path_elem, key.utf8_string, path_elem_len)) {
DEBUG_MSG("found key matching path elem");
CHECKED_DECODE_ONE_FOLLOW(mmdb, offset_to_value, &value);
memcpy(entry_data, &value, sizeof(MMDB_entry_data_s));
return MMDB_SUCCESS;
} else {
/* We don't want to follow a pointer here. If the next element is
* a pointer we simply skip it and keep going */
CHECKED_DECODE_ONE(mmdb, offset_to_value, &value);
if ((rc = skip_map_or_array(mmdb, &value))) return rc;
offset = value.offset_to_next;
}
}
memset(entry_data, 0, sizeof(MMDB_entry_data_s));
return MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR;
}
int MMDB_aget_value(MMDB_entry_s *const start,
MMDB_entry_data_s *const entry_data,
const char *const *const path) {
int i, status;
uint32_t offset;
const MMDB_s *mmdb;
const char *path_elem;
mmdb = start->mmdb;
offset = start->offset;
memset(entry_data, 0, sizeof(MMDB_entry_data_s));
DEBUG_NL;
DEBUG_MSG("looking up value by path");
CHECKED_DECODE_ONE_FOLLOW(mmdb, offset, entry_data);
DEBUG_NL;
DEBUG_MSGF("top level element is a %s", type_num_to_name(entry_data->type));
/* Can this happen? It'd probably represent a pathological case under
* normal use, but there's nothing preventing someone from passing an
* invalid MMDB_entry_s struct to this function */
if (!entry_data->has_data) return MMDB_INVALID_LOOKUP_PATH_ERROR;
for (i = 0; (path_elem = path[i]); ++i) {
DEBUG_NL;
DEBUG_MSGF("path elem = %s", path_elem);
/* XXX - it'd be good to find a quicker way to skip through these
entries that doesn't involve decoding them
completely. Basically we need to just use the size from the
control byte to advance our pointer rather than calling
decode_one(). */
if (entry_data->type == MMDB_DATA_TYPE_ARRAY) {
if ((status = lookup_path_in_array(path_elem, mmdb, entry_data))) {
memset(entry_data, 0, sizeof(MMDB_entry_data_s));
return status;
}
} else if (entry_data->type == MMDB_DATA_TYPE_MAP) {
if ((status = lookup_path_in_map(path_elem, mmdb, entry_data))) {
memset(entry_data, 0, sizeof(MMDB_entry_data_s));
return status;
}
} else {
/* Once we make the code traverse maps & arrays without calling
* decode_one() we can get rid of this. */
memset(entry_data, 0, sizeof(MMDB_entry_data_s));
return MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR;
}
}
return MMDB_SUCCESS;
}
int MMDB_get_metadata_as_entry_data_list(
const MMDB_s *const mmdb, MMDB_entry_data_list_s **const entry_data_list) {
MMDB_s metadata_db = make_fake_metadata_db(mmdb);
MMDB_entry_s metadata_start = {.mmdb = &metadata_db, .offset = 0};
return MMDB_get_entry_data_list(&metadata_start, entry_data_list);
}
static int get_entry_data_list(const MMDB_s *const mmdb, uint32_t offset,
MMDB_entry_data_list_s *const entry_data_list,
MMDB_data_pool_s *const pool, int depth) {
if (depth >= MAXIMUM_DATA_STRUCTURE_DEPTH) {
DEBUG_MSG("reached the maximum data structure depth");
return MMDB_INVALID_DATA_ERROR;
}
depth++;
CHECKED_DECODE_ONE(mmdb, offset, &entry_data_list->entry_data);
switch (entry_data_list->entry_data.type) {
case MMDB_DATA_TYPE_POINTER: {
uint32_t next_offset = entry_data_list->entry_data.offset_to_next;
uint32_t last_offset;
CHECKED_DECODE_ONE(mmdb,
last_offset = entry_data_list->entry_data.pointer,
&entry_data_list->entry_data);
/* Pointers to pointers are illegal under the spec */
if (entry_data_list->entry_data.type == MMDB_DATA_TYPE_POINTER) {
DEBUG_MSG("pointer points to another pointer");
return MMDB_INVALID_DATA_ERROR;
}
if (entry_data_list->entry_data.type == MMDB_DATA_TYPE_ARRAY ||
entry_data_list->entry_data.type == MMDB_DATA_TYPE_MAP) {
int status = get_entry_data_list(mmdb, last_offset, entry_data_list,
pool, depth);
if (MMDB_SUCCESS != status) {
DEBUG_MSG("get_entry_data_list on pointer failed.");
return status;
}
}
entry_data_list->entry_data.offset_to_next = next_offset;
} break;
case MMDB_DATA_TYPE_ARRAY: {
uint32_t array_size = entry_data_list->entry_data.data_size;
uint32_t array_offset = entry_data_list->entry_data.offset_to_next;
while (array_size-- > 0) {
MMDB_entry_data_list_s *entry_data_list_to = data_pool_alloc(pool);
if (!entry_data_list_to) return MMDB_OUT_OF_MEMORY_ERROR;
int status = get_entry_data_list(mmdb, array_offset, entry_data_list_to,
pool, depth);
if (MMDB_SUCCESS != status) {
DEBUG_MSG("get_entry_data_list on array element failed.");
return status;
}
array_offset = entry_data_list_to->entry_data.offset_to_next;
}
entry_data_list->entry_data.offset_to_next = array_offset;
} break;
case MMDB_DATA_TYPE_MAP: {
uint32_t size = entry_data_list->entry_data.data_size;
offset = entry_data_list->entry_data.offset_to_next;
while (size-- > 0) {
MMDB_entry_data_list_s *list_key = data_pool_alloc(pool);
if (!list_key) return MMDB_OUT_OF_MEMORY_ERROR;
int status = get_entry_data_list(mmdb, offset, list_key, pool, depth);
if (MMDB_SUCCESS != status) {
DEBUG_MSG("get_entry_data_list on map key failed.");
return status;
}
offset = list_key->entry_data.offset_to_next;
MMDB_entry_data_list_s *list_value = data_pool_alloc(pool);
if (!list_value) return MMDB_OUT_OF_MEMORY_ERROR;
status = get_entry_data_list(mmdb, offset, list_value, pool, depth);
if (MMDB_SUCCESS != status) {
DEBUG_MSG("get_entry_data_list on map element failed.");
return status;
}
offset = list_value->entry_data.offset_to_next;
}
entry_data_list->entry_data.offset_to_next = offset;
} break;
default:
break;
}
return MMDB_SUCCESS;
}
int MMDB_get_entry_data_list(MMDB_entry_s *start,
MMDB_entry_data_list_s **const entry_data_list) {
int status;
MMDB_data_pool_s *pool;
MMDB_entry_data_list_s *list;
pool = data_pool_new(MMDB_POOL_INIT_SIZE);
if (!pool) return MMDB_OUT_OF_MEMORY_ERROR;
list = data_pool_alloc(pool);
if (!list) {
data_pool_destroy(pool);
return MMDB_OUT_OF_MEMORY_ERROR;
}
status = get_entry_data_list(start->mmdb, start->offset, list, pool, 0);
*entry_data_list = data_pool_to_list(pool);
if (!*entry_data_list) {
data_pool_destroy(pool);
return MMDB_OUT_OF_MEMORY_ERROR;
}
return status;
}
void MMDB_free_entry_data_list(MMDB_entry_data_list_s *const entry_data_list) {
if (!entry_data_list) return;
data_pool_destroy(entry_data_list->pool);
}
void MMDB_close(MMDB_s *const mmdb) {
free_mmdb_struct(mmdb);
}
const char *MMDB_lib_version(void) {
return "1.6.0";
}
static void print_indentation(FILE *stream, int i) {
char buffer[1024];
int size = i >= 1024 ? 1023 : i;
memset(buffer, 32, size);
buffer[size] = '\0';
fputs(buffer, stream);
}
static char *bytes_to_hex(uint8_t *bytes, uint32_t size) {
char *hex_string;
MAYBE_CHECK_SIZE_OVERFLOW(size, SIZE_MAX / 2 - 1, NULL);
hex_string = calloc((size * 2) + 1, sizeof(char));
if (!hex_string) return NULL;
for (uint32_t i = 0; i < size; i++) {
sprintf(hex_string + (2 * i), "%02X", bytes[i]);
}
return hex_string;
}
static MMDB_entry_data_list_s *dump_entry_data_list(
FILE *stream, MMDB_entry_data_list_s *entry_data_list, int indent,
int *status) {
switch (entry_data_list->entry_data.type) {
case MMDB_DATA_TYPE_MAP: {
uint32_t size = entry_data_list->entry_data.data_size;
print_indentation(stream, indent);
fprintf(stream, "{\n");
indent += 2;
for (entry_data_list = entry_data_list->next; size && entry_data_list;
size--) {
if (MMDB_DATA_TYPE_UTF8_STRING != entry_data_list->entry_data.type) {
*status = MMDB_INVALID_DATA_ERROR;
return NULL;
}
char *key = strndup((char *)entry_data_list->entry_data.utf8_string,
entry_data_list->entry_data.data_size);
if (!key) {
*status = MMDB_OUT_OF_MEMORY_ERROR;
return NULL;
}
print_indentation(stream, indent);
fprintf(stream, "\"%s\": \n", key);
free(key);
entry_data_list = entry_data_list->next;
entry_data_list =
dump_entry_data_list(stream, entry_data_list, indent + 2, status);
if (MMDB_SUCCESS != *status) {
return NULL;
}
}
indent -= 2;
print_indentation(stream, indent);
fprintf(stream, "}\n");
} break;
case MMDB_DATA_TYPE_ARRAY: {
uint32_t size = entry_data_list->entry_data.data_size;
print_indentation(stream, indent);
fprintf(stream, "[\n");
indent += 2;
for (entry_data_list = entry_data_list->next; size && entry_data_list;
size--) {
entry_data_list =
dump_entry_data_list(stream, entry_data_list, indent, status);
if (MMDB_SUCCESS != *status) return NULL;
}
indent -= 2;
print_indentation(stream, indent);
fprintf(stream, "]\n");
} break;
case MMDB_DATA_TYPE_UTF8_STRING: {
char *string = strndup((char *)entry_data_list->entry_data.utf8_string,
entry_data_list->entry_data.data_size);
if (!string) {
*status = MMDB_OUT_OF_MEMORY_ERROR;
return NULL;
}
print_indentation(stream, indent);
fprintf(stream, "\"%s\" <utf8_string>\n", string);
free(string);
entry_data_list = entry_data_list->next;
} break;
case MMDB_DATA_TYPE_BYTES: {
char *hex_string =
bytes_to_hex((uint8_t *)entry_data_list->entry_data.bytes,
entry_data_list->entry_data.data_size);
if (!hex_string) {
*status = MMDB_OUT_OF_MEMORY_ERROR;
return NULL;
}
print_indentation(stream, indent);
fprintf(stream, "%s <bytes>\n", hex_string);
free(hex_string);
entry_data_list = entry_data_list->next;
} break;
case MMDB_DATA_TYPE_DOUBLE:
print_indentation(stream, indent);
fprintf(stream, "%f <double>\n",
entry_data_list->entry_data.double_value);
entry_data_list = entry_data_list->next;
break;
case MMDB_DATA_TYPE_FLOAT:
print_indentation(stream, indent);
fprintf(stream, "%f <float>\n", entry_data_list->entry_data.float_value);
entry_data_list = entry_data_list->next;
break;
case MMDB_DATA_TYPE_UINT16:
print_indentation(stream, indent);
fprintf(stream, "%u <uint16>\n", entry_data_list->entry_data.uint16);
entry_data_list = entry_data_list->next;
break;
case MMDB_DATA_TYPE_UINT32:
print_indentation(stream, indent);
fprintf(stream, "%u <uint32>\n", entry_data_list->entry_data.uint32);
entry_data_list = entry_data_list->next;
break;
case MMDB_DATA_TYPE_BOOLEAN:
print_indentation(stream, indent);
fprintf(stream, "%s <boolean>\n",
entry_data_list->entry_data.boolean ? "true" : "false");
entry_data_list = entry_data_list->next;
break;
case MMDB_DATA_TYPE_UINT64:
print_indentation(stream, indent);
fprintf(stream, "%" PRIu64 " <uint64>\n",
entry_data_list->entry_data.uint64);
entry_data_list = entry_data_list->next;
break;
case MMDB_DATA_TYPE_UINT128:
print_indentation(stream, indent);
uint64_t high = entry_data_list->entry_data.uint128 >> 64;
uint64_t low = (uint64_t)entry_data_list->entry_data.uint128;
fprintf(stream, "0x%016" PRIX64 "%016" PRIX64 " <uint128>\n", high, low);
entry_data_list = entry_data_list->next;
break;
case MMDB_DATA_TYPE_INT32:
print_indentation(stream, indent);
fprintf(stream, "%d <int32>\n", entry_data_list->entry_data.int32);
entry_data_list = entry_data_list->next;
break;
default:
*status = MMDB_INVALID_DATA_ERROR;
return NULL;
}
*status = MMDB_SUCCESS;
return entry_data_list;
}
int MMDB_dump_entry_data_list(FILE *const stream,
MMDB_entry_data_list_s *const entry_data_list,
int indent) {
int status;
dump_entry_data_list(stream, entry_data_list, indent, &status);
return status;
}
const char *MMDB_strerror(int error_code) {
switch (error_code) {
case MMDB_SUCCESS:
return "Success (not an error)";
case MMDB_FILE_OPEN_ERROR:
return "Error opening the specified MaxMind DB file";
case MMDB_CORRUPT_SEARCH_TREE_ERROR:
return "The MaxMind DB file's search tree is corrupt";
case MMDB_INVALID_METADATA_ERROR:
return "The MaxMind DB file contains invalid metadata";
case MMDB_IO_ERROR:
return "An attempt to read data from the MaxMind DB file failed";
case MMDB_OUT_OF_MEMORY_ERROR:
return "A memory allocation call failed";
case MMDB_UNKNOWN_DATABASE_FORMAT_ERROR:
return "The MaxMind DB file is in a format this library can't "
"handle (unknown record size or binary format version)";
case MMDB_INVALID_DATA_ERROR:
return "The MaxMind DB file's data section contains bad data "
"(unknown data type or corrupt data)";
case MMDB_INVALID_LOOKUP_PATH_ERROR:
return "The lookup path contained an invalid value (like a "
"negative integer for an array index)";
case MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR:
return "The lookup path does not match the data (key that doesn't "
"exist, array index bigger than the array, expected array "
"or map where none exists)";
case MMDB_INVALID_NODE_NUMBER_ERROR:
return "The MMDB_read_node function was called with a node number "
"that does not exist in the search tree";
case MMDB_IPV6_LOOKUP_IN_IPV4_DATABASE_ERROR:
return "You attempted to look up an IPv6 address in an IPv4-only "
"database";
default:
return "Unknown error code";
}
}
| 61,306 | 1,620 | jart/cosmopolitan | false |
cosmopolitan/third_party/maxmind/README.cosmo | ORIGIN
[email protected]:maxmind/libmaxminddb.git
commit d918412fe7d514108d01e346a832d51e5ccf83c0
Author: Will Storey <[email protected]>
Date: Thu Apr 29 11:53:54 2021 -0700
Merge pull request #265 from maxmind/greg/release
1.6.0
LOCAL CHANGES
- Added MMDB_lookup()
- Remove Berkeleyisms from API design w.r.t. IPs.
| 333 | 14 | jart/cosmopolitan | false |
cosmopolitan/third_party/maxmind/getmetroname.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¡
â Copyright 2021 Justine Alexandra Roberts Tunney â
â â
â Permission to use, copy, modify, and/or distribute this software for â
â any purpose with or without fee is hereby granted, provided that the â
â above copyright notice and this permission notice appear in all copies. â
â â
â THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL â
â WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED â
â WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE â
â AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL â
â DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR â
â PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER â
â TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR â
â PERFORMANCE OF THIS SOFTWARE. â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/macros.internal.h"
#include "third_party/maxmind/maxminddb.h"
const struct thatispacked MetroName {
short code;
const char *name;
} kMetroNames[] = {
{500, "Portland-Auburn ME"},
{501, "New York NY"},
{502, "Binghamton NY"},
{503, "Macon GA"},
{504, "Philadelphia PA"},
{505, "Detroit MI"},
{506, "Boston MA-Manchester NH"},
{507, "Savannah GA"},
{508, "Pittsburgh PA"},
{509, "Ft. Wayne IN"},
{510, "Cleveland-Akron (Canton) OH"},
{511, "Washington DC (Hagerstown MD)"},
{512, "Baltimore MD"},
{513, "Flint-Saginaw-Bay City MI"},
{514, "Buffalo NY"},
{515, "Cincinnati OH"},
{516, "Erie PA"},
{517, "Charlotte NC"},
{518, "Greensboro-High Point-Winston Salem NC"},
{519, "Charleston SC"},
{520, "Augusta GA"},
{521, "Providence RI-New Bedford MA"},
{522, "Columbus GA"},
{523, "Burlington VT-Plattsburgh NY"},
{524, "Atlanta GA"},
{525, "Albany GA"},
{526, "Utica NY"},
{527, "Indianapolis IN"},
{528, "Miami-Ft. Lauderdale FL"},
{529, "Louisville KY"},
{530, "Tallahassee FL-Thomasville GA"},
{531, "Tri-Cities TN-VA"},
{532, "Albany-Schenectady-Troy NY"},
{533, "Hartford & New Haven CT"},
{534, "Orlando-Daytona Beach-Melbourne FL"},
{535, "Columbus OH"},
{536, "Youngstown OH"},
{537, "Bangor ME"},
{538, "Rochester NY"},
{539, "Tampa-St. Petersburg (Sarasota) FL"},
{540, "Traverse City-Cadillac MI"},
{541, "Lexington KY"},
{542, "Dayton OH"},
{543, "Springfield-Holyoke MA"},
{544, "Norfolk-Portsmouth-Newport News VA"},
{545, "Greenville-New Bern-Washington NC"},
{546, "Columbia SC"},
{547, "Toledo OH"},
{548, "West Palm Beach-Ft. Pierce FL"},
{549, "Watertown NY"},
{550, "Wilmington NC"},
{551, "Lansing MI"},
{552, "Presque Isle ME"},
{553, "Marquette MI"},
{554, "Wheeling WV-Steubenville OH"},
{555, "Syracuse NY"},
{556, "Richmond-Petersburg VA"},
{557, "Knoxville TN"},
{558, "Lima OH"},
{559, "Bluefield-Beckley-Oak Hill WV"},
{560, "Raleigh-Durham (Fayetteville) NC"},
{561, "Jacksonville FL"},
{563, "Grand Rapids-Kalamazoo-Battle Creek MI"},
{564, "Charleston-Huntington WV"},
{565, "Elmira NY"},
{566, "Harrisburg-Lancaster-Lebanon-York PA"},
{567, "Greenville-Spartanburg SC-Asheville NC-Anderson SC"},
{569, "Harrisonburg VA"},
{570, "Florence-Myrtle Beach SC"},
{571, "Ft. Myers-Naples FL"},
{573, "Roanoke-Lynchburg VA"},
{574, "Johnstown-Altoona PA"},
{575, "Chattanooga TN"},
{576, "Salisbury MD"},
{577, "Wilkes Barre-Scranton PA"},
{581, "Terre Haute IN"},
{582, "Lafayette IN"},
{583, "Alpena MI"},
{584, "Charlottesville VA"},
{588, "South Bend-Elkhart IN"},
{592, "Gainesville FL"},
{596, "Zanesville OH"},
{597, "Parkersburg WV"},
{598, "Clarksburg-Weston WV"},
{600, "Corpus Christi TX"},
{602, "Chicago IL"},
{603, "Joplin MO-Pittsburg KS"},
{604, "Columbia-Jefferson City MO"},
{605, "Topeka KS"},
{606, "Dothan AL"},
{609, "St. Louis MO"},
{610, "Rockford IL"},
{611, "Rochester MN-Mason City IA-Austin MN"},
{612, "Shreveport LA"},
{613, "Minneapolis-St. Paul MN"},
{616, "Kansas City MO"},
{617, "Milwaukee WI"},
{618, "Houston TX"},
{619, "Springfield MO"},
{622, "New Orleans LA"},
{623, "Dallas-Ft. Worth TX"},
{624, "Sioux City IA"},
{625, "Waco-Temple-Bryan TX"},
{626, "Victoria TX"},
{627, "Wichita Falls TX & Lawton OK"},
{628, "Monroe LA-El Dorado AR"},
{630, "Birmingham AL"},
{631, "Ottumwa IA-Kirksville MO"},
{632, "Paducah KY-Cape Girardeau MO-Harrisburg-Mount Vernon IL"},
{633, "Odessa-Midland TX"},
{634, "Amarillo TX"},
{635, "Austin TX"},
{636, "Harlingen-Weslaco-Brownsville-McAllen TX"},
{637, "Cedar Rapids-Waterloo-Iowa City & Dubuque IA"},
{638, "St. Joseph MO"},
{639, "Jackson TN"},
{640, "Memphis TN"},
{641, "San Antonio TX"},
{642, "Lafayette LA"},
{643, "Lake Charles LA"},
{644, "Alexandria LA"},
{647, "Greenwood-Greenville MS"},
{648, "Champaign & Springfield-Decatur,IL"},
{649, "Evansville IN"},
{650, "Oklahoma City OK"},
{651, "Lubbock TX"},
{652, "Omaha NE"},
{656, "Panama City FL"},
{657, "Sherman TX-Ada OK"},
{658, "Green Bay-Appleton WI"},
{659, "Nashville TN"},
{661, "San Angelo TX"},
{662, "Abilene-Sweetwater TX"},
{669, "Madison WI"},
{670, "Ft. Smith-Fayetteville-Springdale-Rogers AR"},
{671, "Tulsa OK"},
{673, "Columbus-Tupelo-West Point MS"},
{675, "Peoria-Bloomington IL"},
{676, "Duluth MN-Superior WI"},
{678, "Wichita-Hutchinson KS"},
{679, "Des Moines-Ames IA"},
{682, "Davenport IA-Rock Island-Moline IL"},
{686, "Mobile AL-Pensacola (Ft. Walton Beach) FL"},
{687, "Minot-Bismarck-Dickinson(Williston) ND"},
{691, "Huntsville-Decatur (Florence) AL"},
{692, "Beaumont-Port Arthur TX"},
{693, "Little Rock-Pine Bluff AR"},
{698, "Montgomery (Selma) AL"},
{702, "La Crosse-Eau Claire WI"},
{705, "Wausau-Rhinelander WI"},
{709, "Tyler-Longview(Lufkin & Nacogdoches) TX"},
{710, "Hattiesburg-Laurel MS"},
{711, "Meridian MS"},
{716, "Baton Rouge LA"},
{717, "Quincy IL-Hannibal MO-Keokuk IA"},
{718, "Jackson MS"},
{722, "Lincoln & Hastings-Kearney NE"},
{724, "Fargo-Valley City ND"},
{725, "Sioux Falls(Mitchell) SD"},
{734, "Jonesboro AR"},
{736, "Bowling Green KY"},
{737, "Mankato MN"},
{740, "North Platte NE"},
{743, "Anchorage AK"},
{744, "Honolulu HI"},
{745, "Fairbanks AK"},
{746, "Biloxi-Gulfport MS"},
{747, "Juneau AK"},
{749, "Laredo TX"},
{751, "Denver CO"},
{752, "Colorado Springs-Pueblo CO"},
{753, "Phoenix AZ"},
{754, "Butte-Bozeman MT"},
{755, "Great Falls MT"},
{756, "Billings MT"},
{757, "Boise ID"},
{758, "Idaho Falls-Pocatello ID"},
{759, "Cheyenne WY-Scottsbluff NE"},
{760, "Twin Falls ID"},
{762, "Missoula MT"},
{764, "Rapid City SD"},
{765, "El Paso TX"},
{766, "Helena MT"},
{767, "Casper-Riverton WY"},
{770, "Salt Lake City UT"},
{771, "Yuma AZ-El Centro CA"},
{773, "Grand Junction-Montrose CO"},
{789, "Tucson (Sierra Vista) AZ"},
{790, "Albuquerque-Santa Fe NM"},
{798, "Glendive MT"},
{800, "Bakersfield CA"},
{801, "Eugene OR"},
{802, "Eureka CA"},
{803, "Los Angeles CA"},
{804, "Palm Springs CA"},
{807, "San Francisco-Oakland-San Jose CA"},
{810, "Yakima-Pasco-Richland-Kennewick WA"},
{811, "Reno NV"},
{813, "Medford-Klamath Falls OR"},
{819, "Seattle-Tacoma WA"},
{820, "Portland OR"},
{821, "Bend OR"},
{825, "San Diego CA"},
{828, "Monterey-Salinas CA"},
{839, "Las Vegas NV"},
{855, "Santa Barbara-Santa Maria-San Luis Obispo CA"},
{862, "Sacramento-Stockton-Modesto CA"},
{866, "Fresno-Visalia CA"},
{868, "Chico-Redding CA"},
{881, "Spokane WA"},
};
/**
* Returns U.S. Metropolitan Area name.
* @see Google Adwords c. 2010
*/
const char *GetMetroName(int code) {
int m, l, r;
l = 0;
r = ARRAYLEN(kMetroNames) - 1;
while (l <= r) {
m = (l + r) >> 1;
if (kMetroNames[m].code < code) {
l = m + 1;
} else if (kMetroNames[m].code > code) {
r = m - 1;
} else {
return kMetroNames[m].name;
}
}
return 0;
}
| 9,397 | 258 | jart/cosmopolitan | false |
cosmopolitan/third_party/maxmind/maxmind.mk | #-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-â
#âââvi: set et ft=make ts=8 tw=8 fenc=utf-8 :viââââââââââââââââââââââââ
PKGS += THIRD_PARTY_MAXMIND
THIRD_PARTY_MAXMIND_ARTIFACTS += THIRD_PARTY_MAXMIND_A
THIRD_PARTY_MAXMIND = $(THIRD_PARTY_MAXMIND_A_DEPS) $(THIRD_PARTY_MAXMIND_A)
THIRD_PARTY_MAXMIND_A = o/$(MODE)/third_party/maxmind/maxmind.a
THIRD_PARTY_MAXMIND_A_FILES := $(wildcard third_party/maxmind/*)
THIRD_PARTY_MAXMIND_A_HDRS = $(filter %.h,$(THIRD_PARTY_MAXMIND_A_FILES))
THIRD_PARTY_MAXMIND_A_SRCS = $(filter %.c,$(THIRD_PARTY_MAXMIND_A_FILES))
THIRD_PARTY_MAXMIND_A_OBJS = \
$(THIRD_PARTY_MAXMIND_A_SRCS:%.c=o/$(MODE)/%.o)
THIRD_PARTY_MAXMIND_A_CHECKS = \
$(THIRD_PARTY_MAXMIND_A).pkg \
$(THIRD_PARTY_MAXMIND_A_HDRS:%=o/$(MODE)/%.ok)
THIRD_PARTY_MAXMIND_A_DIRECTDEPS = \
LIBC_CALLS \
LIBC_FMT \
LIBC_INTRIN \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STDIO \
LIBC_STR \
LIBC_STUBS \
LIBC_SYSV
THIRD_PARTY_MAXMIND_A_DEPS := \
$(call uniq,$(foreach x,$(THIRD_PARTY_MAXMIND_A_DIRECTDEPS),$($(x))))
$(THIRD_PARTY_MAXMIND_A): \
third_party/maxmind/ \
$(THIRD_PARTY_MAXMIND_A).pkg \
$(THIRD_PARTY_MAXMIND_A_OBJS)
$(THIRD_PARTY_MAXMIND_A).pkg: \
$(THIRD_PARTY_MAXMIND_A_OBJS) \
$(foreach x,$(THIRD_PARTY_MAXMIND_A_DIRECTDEPS),$($(x)_A).pkg)
$(THIRD_PARTY_MAXMIND_A_OBJS): private \
OVERRIDE_CFLAGS += \
-fdata-sections \
-ffunction-sections
THIRD_PARTY_MAXMIND_LIBS = $(foreach x,$(THIRD_PARTY_MAXMIND_ARTIFACTS),$($(x)))
THIRD_PARTY_MAXMIND_SRCS = $(foreach x,$(THIRD_PARTY_MAXMIND_ARTIFACTS),$($(x)_SRCS))
THIRD_PARTY_MAXMIND_HDRS = $(foreach x,$(THIRD_PARTY_MAXMIND_ARTIFACTS),$($(x)_HDRS))
THIRD_PARTY_MAXMIND_CHECKS = $(foreach x,$(THIRD_PARTY_MAXMIND_ARTIFACTS),$($(x)_CHECKS))
THIRD_PARTY_MAXMIND_OBJS = $(foreach x,$(THIRD_PARTY_MAXMIND_ARTIFACTS),$($(x)_OBJS))
.PHONY: o/$(MODE)/third_party/maxmind
o/$(MODE)/third_party/maxmind: \
$(THIRD_PARTY_MAXMIND_CHECKS)
| 2,122 | 58 | jart/cosmopolitan | false |
cosmopolitan/third_party/vqsort/vqsort_int32.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¡
â Copyright 2023 Justine Alexandra Roberts Tunney â
â â
â Permission to use, copy, modify, and/or distribute this software for â
â any purpose with or without fee is hereby granted, provided that the â
â above copyright notice and this permission notice appear in all copies. â
â â
â THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL â
â WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED â
â WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE â
â AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL â
â DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR â
â PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER â
â TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR â
â PERFORMANCE OF THIS SOFTWARE. â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/mem/alg.h"
#include "libc/nexgen32e/x86feature.h"
#include "third_party/vqsort/vqsort.h"
void vqsort_int32(int32_t *A, size_t n) {
if (X86_HAVE(AVX2)) {
vqsort_int32_avx2(A, n);
} else {
radix_sort_int32(A, n);
}
}
| 2,081 | 30 | jart/cosmopolitan | false |
cosmopolitan/third_party/vqsort/README.cosmo | DESCRIPTION
vqsort implements vectorized quicksort using avx2. this is the fastest
way to sort integers. this goes as fast as djbsort for 32-bit integers
except it supports 64-bit integers too, which go just as fast: about a
gigabyte of memory sorted per second. It's 3x faster than simple radix
sort. It's 5x faster than simple quicksort. It's 10x faster than qsort
LICENSE
Apache 2.o
ORIGIN
https://github.com/google/highway/
commit 50331e0523bbf5f6c94b94263a91680f118e0986
Author: Jan Wassenberg <[email protected]>
Date: Wed Apr 26 11:20:33 2023 -0700
Faster vqsort for small arrays (7x speedup! for N=100)
LOCAL CHANGES
Precompiled beacuse upstream codebase is slow, gigantic, and hairy.
| 726 | 24 | jart/cosmopolitan | false |
cosmopolitan/third_party/vqsort/vqsort.mk | #-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-â
#âââvi: set et ft=make ts=8 tw=8 fenc=utf-8 :viââââââââââââââââââââââââ
PKGS += THIRD_PARTY_VQSORT
THIRD_PARTY_VQSORT_ARTIFACTS += THIRD_PARTY_VQSORT_A
THIRD_PARTY_VQSORT = $(THIRD_PARTY_VQSORT_A_DEPS) $(THIRD_PARTY_VQSORT_A)
THIRD_PARTY_VQSORT_A = o/$(MODE)/third_party/vqsort/vqsort.a
THIRD_PARTY_VQSORT_A_FILES := $(wildcard third_party/vqsort/*)
THIRD_PARTY_VQSORT_A_HDRS = $(filter %.h,$(THIRD_PARTY_VQSORT_A_FILES))
THIRD_PARTY_VQSORT_A_SRCS_C = $(filter %.c,$(THIRD_PARTY_VQSORT_A_FILES))
THIRD_PARTY_VQSORT_A_SRCS_S = $(filter %.S,$(THIRD_PARTY_VQSORT_A_FILES))
THIRD_PARTY_VQSORT_A_SRCS = $(THIRD_PARTY_VQSORT_A_SRCS_C) $(THIRD_PARTY_VQSORT_A_SRCS_S)
THIRD_PARTY_VQSORT_A_OBJS_C = $(THIRD_PARTY_VQSORT_A_SRCS_C:%.c=o/$(MODE)/%.o)
THIRD_PARTY_VQSORT_A_OBJS_S = $(THIRD_PARTY_VQSORT_A_SRCS_S:%.S=o/$(MODE)/%.o)
THIRD_PARTY_VQSORT_A_OBJS = $(THIRD_PARTY_VQSORT_A_OBJS_C) $(THIRD_PARTY_VQSORT_A_OBJS_S)
THIRD_PARTY_VQSORT_A_CHECKS = \
$(THIRD_PARTY_VQSORT_A).pkg \
$(THIRD_PARTY_VQSORT_A_HDRS:%=o/$(MODE)/%.ok)
THIRD_PARTY_VQSORT_A_DIRECTDEPS = \
LIBC_INTRIN \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STDIO \
LIBC_STR \
LIBC_STUBS \
THIRD_PARTY_COMPILER_RT
THIRD_PARTY_VQSORT_A_DEPS := \
$(call uniq,$(foreach x,$(THIRD_PARTY_VQSORT_A_DIRECTDEPS),$($(x))))
$(THIRD_PARTY_VQSORT_A): \
third_party/vqsort/ \
$(THIRD_PARTY_VQSORT_A).pkg \
$(THIRD_PARTY_VQSORT_A_OBJS)
$(THIRD_PARTY_VQSORT_A).pkg: \
$(THIRD_PARTY_VQSORT_A_OBJS) \
$(foreach x,$(THIRD_PARTY_VQSORT_A_DIRECTDEPS),$($(x)_A).pkg)
THIRD_PARTY_VQSORT_LIBS = $(foreach x,$(THIRD_PARTY_VQSORT_ARTIFACTS),$($(x)))
THIRD_PARTY_VQSORT_SRCS = $(foreach x,$(THIRD_PARTY_VQSORT_ARTIFACTS),$($(x)_SRCS))
THIRD_PARTY_VQSORT_HDRS = $(foreach x,$(THIRD_PARTY_VQSORT_ARTIFACTS),$($(x)_HDRS))
THIRD_PARTY_VQSORT_CHECKS = $(foreach x,$(THIRD_PARTY_VQSORT_ARTIFACTS),$($(x)_CHECKS))
THIRD_PARTY_VQSORT_OBJS = $(foreach x,$(THIRD_PARTY_VQSORT_ARTIFACTS),$($(x)_OBJS))
$(THIRD_PARTY_VQSORT_OBJS): $(BUILD_FILES) third_party/vqsort/vqsort.mk
.PHONY: o/$(MODE)/third_party/vqsort
o/$(MODE)/third_party/vqsort: $(THIRD_PARTY_VQSORT_CHECKS)
| 2,279 | 53 | jart/cosmopolitan | false |
cosmopolitan/third_party/vqsort/vqsort_int64.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¡
â Copyright 2023 Justine Alexandra Roberts Tunney â
â â
â Permission to use, copy, modify, and/or distribute this software for â
â any purpose with or without fee is hereby granted, provided that the â
â above copyright notice and this permission notice appear in all copies. â
â â
â THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL â
â WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED â
â WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE â
â AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL â
â DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR â
â PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER â
â TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR â
â PERFORMANCE OF THIS SOFTWARE. â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/mem/alg.h"
#include "libc/nexgen32e/x86feature.h"
#include "third_party/vqsort/vqsort.h"
void vqsort_int64(int64_t *A, size_t n) {
if (X86_HAVE(AVX2)) {
vqsort_int64_avx2(A, n);
} else {
radix_sort_int64(A, n);
}
}
| 2,081 | 30 | jart/cosmopolitan | false |
cosmopolitan/third_party/vqsort/vqsort.h | #ifndef COSMOPOLITAN_THIRD_PARTY_VQSORT_H_
#define COSMOPOLITAN_THIRD_PARTY_VQSORT_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void vqsort_int64(int64_t *, size_t);
void vqsort_int64_avx2(int64_t *, size_t);
void vqsort_int64_sse4(int64_t *, size_t);
void vqsort_int64_ssse3(int64_t *, size_t);
void vqsort_int64_sse2(int64_t *, size_t);
void vqsort_int32(int32_t *, size_t);
void vqsort_int32_avx2(int32_t *, size_t);
void vqsort_int32_sse4(int32_t *, size_t);
void vqsort_int32_ssse3(int32_t *, size_t);
void vqsort_int32_sse2(int32_t *, size_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_THIRD_PARTY_VQSORT_H_ */
| 686 | 21 | jart/cosmopolitan | false |
cosmopolitan/third_party/vqsort/vqsort_i32a.S | .text
.globl __popcountdi2
.section .text._ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18781:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
.cfi_offset 15, -24
.cfi_offset 14, -32
movq %rcx, %r14
pushq %r13
.cfi_offset 13, -40
movq %rsi, %r13
pushq %r12
.cfi_offset 12, -48
movq %rdi, %r12
pushq %rbx
subq $88, %rsp
.cfi_offset 3, -56
movq %rdx, -120(%rbp)
movaps %xmm0, -80(%rbp)
movaps %xmm1, -64(%rbp)
movaps %xmm0, -112(%rbp)
movaps %xmm1, -96(%rbp)
cmpq $3, %rsi
jbe .L32
movl $4, %r15d
xorl %ebx, %ebx
jmp .L11
.p2align 4,,10
.p2align 3
.L3:
movdqa -80(%rbp), %xmm5
movmskps %xmm1, %edi
movups %xmm5, (%r12,%rbx,4)
call __popcountdi2@PLT
cltq
addq %rax, %rbx
leaq 4(%r15), %rax
cmpq %r13, %rax
ja .L88
movq %rax, %r15
.L11:
movdqu -16(%r12,%r15,4), %xmm1
movdqu -16(%r12,%r15,4), %xmm0
leaq -4(%r15), %rdx
pcmpeqd -96(%rbp), %xmm0
pcmpeqd -112(%rbp), %xmm1
movdqa %xmm0, %xmm2
por %xmm1, %xmm0
movmskps %xmm0, %eax
cmpl $15, %eax
je .L3
pcmpeqd %xmm0, %xmm0
pxor %xmm0, %xmm2
pandn %xmm2, %xmm1
movmskps %xmm1, %eax
rep bsfl %eax, %eax
cltq
addq %rdx, %rax
movd (%r12,%rax,4), %xmm3
movq -120(%rbp), %rax
pshufd $0, %xmm3, %xmm0
movaps %xmm0, (%rax)
leaq 4(%rbx), %rax
cmpq %rdx, %rax
ja .L4
.p2align 4,,10
.p2align 3
.L5:
movdqa -64(%rbp), %xmm4
movq %rax, %rbx
movups %xmm4, -16(%r12,%rax,4)
addq $4, %rax
cmpq %rdx, %rax
jbe .L5
.L4:
subq %rbx, %rdx
leaq 0(,%rbx,4), %rcx
movd %edx, %xmm3
pshufd $0, %xmm3, %xmm0
pcmpgtd .LC0(%rip), %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L6
movdqa -64(%rbp), %xmm3
movd %xmm3, (%r12,%rbx,4)
.L6:
pshufd $85, %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L7
pshufd $85, -64(%rbp), %xmm1
movd %xmm1, 4(%r12,%rcx)
.L7:
movdqa %xmm0, %xmm1
punpckhdq %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L8
movdqa -64(%rbp), %xmm3
movdqa %xmm3, %xmm1
punpckhdq %xmm3, %xmm1
movd %xmm1, 8(%r12,%rcx)
.L8:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
jne .L89
.L21:
addq $88, %rsp
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L89:
.cfi_restore_state
pshufd $255, -64(%rbp), %xmm0
movd %xmm0, 12(%r12,%rcx)
jmp .L21
.p2align 4,,10
.p2align 3
.L88:
movq %r13, %r8
leaq 0(,%r15,4), %rsi
leaq 0(,%rbx,4), %r9
subq %r15, %r8
.L2:
testq %r8, %r8
je .L15
leaq 0(,%r8,4), %rdx
addq %r12, %rsi
movq %r14, %rdi
movq %r9, -112(%rbp)
movq %r8, -96(%rbp)
call memcpy@PLT
movq -96(%rbp), %r8
movq -112(%rbp), %r9
.L15:
movd %r8d, %xmm3
movdqa (%r14), %xmm2
movdqa -80(%rbp), %xmm1
pshufd $0, %xmm3, %xmm0
movdqa .LC0(%rip), %xmm3
pcmpeqd %xmm2, %xmm1
pcmpeqd -64(%rbp), %xmm2
pcmpgtd %xmm3, %xmm0
movdqa %xmm0, %xmm5
pand %xmm1, %xmm5
por %xmm2, %xmm1
pcmpeqd %xmm2, %xmm2
movdqa %xmm2, %xmm4
pxor %xmm0, %xmm4
por %xmm4, %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
jne .L90
movd %xmm0, %eax
testl %eax, %eax
je .L22
movdqa -80(%rbp), %xmm4
movd %xmm4, (%r12,%r9)
.L22:
pshufd $85, %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L23
pshufd $85, -80(%rbp), %xmm1
movd %xmm1, 4(%r12,%r9)
.L23:
movdqa %xmm0, %xmm1
punpckhdq %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L24
movdqa -80(%rbp), %xmm7
movdqa %xmm7, %xmm1
punpckhdq %xmm7, %xmm1
movd %xmm1, 8(%r12,%r9)
.L24:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
jne .L91
.L25:
movmskps %xmm5, %edi
call __popcountdi2@PLT
movdqa .LC0(%rip), %xmm3
movslq %eax, %rdx
addq %rbx, %rdx
leaq 4(%rdx), %rax
cmpq %rax, %r13
jb .L26
.p2align 4,,10
.p2align 3
.L27:
movdqa -64(%rbp), %xmm2
movq %rax, %rdx
movups %xmm2, -16(%r12,%rax,4)
addq $4, %rax
cmpq %rax, %r13
jnb .L27
.L26:
subq %rdx, %r13
leaq 0(,%rdx,4), %rcx
movd %r13d, %xmm4
pshufd $0, %xmm4, %xmm0
pcmpgtd %xmm3, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L28
movdqa -64(%rbp), %xmm3
movd %xmm3, (%r12,%rdx,4)
.L28:
pshufd $85, %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L29
pshufd $85, -64(%rbp), %xmm1
movd %xmm1, 4(%r12,%rcx)
.L29:
movdqa %xmm0, %xmm1
punpckhdq %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L30
movdqa -64(%rbp), %xmm3
movdqa %xmm3, %xmm1
punpckhdq %xmm3, %xmm1
movd %xmm1, 8(%r12,%rcx)
.L30:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L31
pshufd $255, -64(%rbp), %xmm0
movd %xmm0, 12(%r12,%rcx)
.L31:
addq $88, %rsp
movl $1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L91:
.cfi_restore_state
pshufd $255, -80(%rbp), %xmm0
movd %xmm0, 12(%r12,%r9)
jmp .L25
.L32:
movq %rsi, %r8
xorl %r9d, %r9d
xorl %esi, %esi
xorl %ebx, %ebx
xorl %r15d, %r15d
jmp .L2
.L90:
pxor %xmm2, %xmm1
movmskps %xmm1, %eax
rep bsfl %eax, %eax
cltq
addq %r15, %rax
movd (%r12,%rax,4), %xmm4
movq -120(%rbp), %rax
pshufd $0, %xmm4, %xmm0
movaps %xmm0, (%rax)
leaq 4(%rbx), %rax
cmpq %rax, %r15
jb .L16
.p2align 4,,10
.p2align 3
.L17:
movdqa -64(%rbp), %xmm6
movq %rax, %rbx
movups %xmm6, -16(%r12,%rax,4)
leaq 4(%rax), %rax
cmpq %r15, %rax
jbe .L17
leaq 0(,%rbx,4), %r9
.L16:
movq %r15, %rcx
subq %rbx, %rcx
movd %ecx, %xmm4
pshufd $0, %xmm4, %xmm0
pcmpgtd %xmm3, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L18
movdqa -64(%rbp), %xmm3
movd %xmm3, (%r12,%r9)
.L18:
pshufd $85, %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L19
pshufd $85, -64(%rbp), %xmm1
movd %xmm1, 4(%r12,%r9)
.L19:
movdqa %xmm0, %xmm1
punpckhdq %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L20
movdqa -64(%rbp), %xmm3
movdqa %xmm3, %xmm1
punpckhdq %xmm3, %xmm1
movd %xmm1, 8(%r12,%r9)
.L20:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L21
pshufd $255, -64(%rbp), %xmm0
movd %xmm0, 12(%r12,%r9)
jmp .L21
.cfi_endproc
.LFE18781:
.size _ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, @function
_ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0:
.LFB18782:
.cfi_startproc
cmpq %rdx, %rsi
jbe .L92
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r10
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rax, %rsi
jbe .L92
movl (%rdi,%rdx,4), %r11d
movd %r11d, %xmm6
pshufd $0, %xmm6, %xmm0
jmp .L95
.p2align 4,,10
.p2align 3
.L96:
cmpq %rcx, %rsi
jbe .L92
movq %rdx, %rax
.L101:
movd (%rdi,%r10,8), %xmm5
pshufd $0, %xmm5, %xmm1
pcmpgtd %xmm3, %xmm1
movmskps %xmm1, %r8d
andl $1, %r8d
jne .L98
.L97:
cmpq %rdx, %rax
je .L92
leaq (%rdi,%rax,4), %rdx
movl (%rdx), %ecx
movl %ecx, (%r9)
movl %r11d, (%rdx)
cmpq %rax, %rsi
jbe .L105
movq %rax, %rdx
.L99:
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r10
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rsi, %rax
jnb .L92
.L95:
movd (%rdi,%rax,4), %xmm4
leaq (%rdi,%rdx,4), %r9
movdqa %xmm0, %xmm3
pshufd $0, %xmm4, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm0, %xmm2
movmskps %xmm2, %r8d
andl $1, %r8d
je .L96
cmpq %rcx, %rsi
jbe .L97
movdqa %xmm1, %xmm3
jmp .L101
.p2align 4,,10
.p2align 3
.L98:
cmpq %rcx, %rdx
je .L106
leaq (%rdi,%rcx,4), %rax
movl (%rax), %edx
movl %edx, (%r9)
movq %rcx, %rdx
movl %r11d, (%rax)
jmp .L99
.p2align 4,,10
.p2align 3
.L92:
ret
.p2align 4,,10
.p2align 3
.L105:
ret
.L106:
ret
.cfi_endproc
.LFE18782:
.size _ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, .-_ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
.section .text._ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, @function
_ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0:
.LFB18783:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %rax
salq $2, %rax
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq (%rdi,%rax), %r15
pushq %r14
.cfi_offset 14, -32
leaq (%r15,%rax), %r14
pushq %r13
.cfi_offset 13, -40
leaq (%r14,%rax), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%rax), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%rax), %rbx
leaq (%rbx,%rax), %r11
leaq (%r11,%rax), %r10
subq $240, %rsp
leaq (%r10,%rax), %r9
leaq (%r9,%rax), %r8
movq %rdi, -264(%rbp)
movq %rsi, -240(%rbp)
movdqu (%r15), %xmm6
movdqu (%rdi), %xmm12
leaq (%r8,%rax), %rdi
leaq (%rdi,%rax), %rsi
movdqu 0(%r13), %xmm5
movdqu (%r14), %xmm14
movdqa %xmm6, %xmm8
leaq (%rsi,%rax), %rcx
movdqu (%rbx), %xmm3
movdqu (%r12), %xmm11
pcmpgtd %xmm12, %xmm8
leaq (%rcx,%rax), %rdx
movdqu (%r10), %xmm2
movdqu (%r11), %xmm10
movdqu (%rdx), %xmm0
movdqu (%rsi), %xmm4
movq %rdx, -248(%rbp)
addq %rax, %rdx
movdqu (%rdx), %xmm15
movdqu (%r8), %xmm1
addq %rdx, %rax
movq %rdx, -256(%rbp)
movdqa %xmm8, %xmm13
movdqu (%r9), %xmm7
movdqu (%rdi), %xmm9
pandn %xmm6, %xmm13
movaps %xmm15, -112(%rbp)
pand %xmm8, %xmm6
movdqa %xmm13, %xmm15
movdqa %xmm12, %xmm13
pand %xmm8, %xmm13
por %xmm15, %xmm13
movdqa %xmm8, %xmm15
pandn %xmm12, %xmm15
movdqa %xmm5, %xmm12
pcmpgtd %xmm14, %xmm12
por %xmm15, %xmm6
movdqa %xmm12, %xmm8
pandn %xmm5, %xmm8
pand %xmm12, %xmm5
movdqa %xmm8, %xmm15
movdqa %xmm14, %xmm8
pand %xmm12, %xmm8
por %xmm15, %xmm8
movdqa %xmm12, %xmm15
pandn %xmm14, %xmm15
movdqa %xmm3, %xmm14
pcmpgtd %xmm11, %xmm14
por %xmm15, %xmm5
movdqa %xmm14, %xmm12
pandn %xmm3, %xmm12
pand %xmm14, %xmm3
movdqa %xmm12, %xmm15
movdqa %xmm11, %xmm12
pand %xmm14, %xmm12
por %xmm15, %xmm12
movdqa %xmm14, %xmm15
pandn %xmm11, %xmm15
movdqa %xmm2, %xmm11
pcmpgtd %xmm10, %xmm11
por %xmm15, %xmm3
movaps %xmm3, -64(%rbp)
movdqa %xmm10, %xmm3
movdqa %xmm11, %xmm14
pand %xmm11, %xmm3
pandn %xmm2, %xmm14
pand %xmm11, %xmm2
por %xmm14, %xmm3
movdqa %xmm11, %xmm14
pandn %xmm10, %xmm14
movdqa %xmm1, %xmm10
pcmpgtd %xmm7, %xmm10
por %xmm14, %xmm2
movdqa %xmm10, %xmm11
pandn %xmm1, %xmm11
pand %xmm10, %xmm1
movdqa %xmm11, %xmm14
movdqa %xmm7, %xmm11
pand %xmm10, %xmm11
por %xmm14, %xmm11
movdqa %xmm10, %xmm14
pandn %xmm7, %xmm14
movdqa %xmm4, %xmm7
pcmpgtd %xmm9, %xmm7
por %xmm14, %xmm1
movaps %xmm1, -80(%rbp)
movdqa %xmm7, %xmm10
movdqa %xmm7, %xmm1
movdqa %xmm9, %xmm7
pandn %xmm4, %xmm10
pand %xmm1, %xmm7
pand %xmm1, %xmm4
por %xmm10, %xmm7
movdqa %xmm1, %xmm10
movdqa %xmm0, %xmm1
pandn %xmm9, %xmm10
por %xmm10, %xmm4
movdqu (%rcx), %xmm10
pcmpgtd %xmm10, %xmm1
movdqu (%rcx), %xmm10
movdqu (%rcx), %xmm15
movdqa %xmm1, %xmm9
pand %xmm1, %xmm10
pandn %xmm0, %xmm9
pand %xmm1, %xmm0
por %xmm9, %xmm10
movdqa %xmm1, %xmm9
movdqu (%rax), %xmm1
pandn %xmm15, %xmm9
movdqa -112(%rbp), %xmm15
por %xmm9, %xmm0
pcmpgtd %xmm15, %xmm1
movaps %xmm0, -96(%rbp)
movdqu (%rax), %xmm0
movdqa %xmm1, %xmm9
pandn %xmm0, %xmm9
movdqa %xmm15, %xmm0
pand %xmm1, %xmm0
por %xmm9, %xmm0
movdqa %xmm1, %xmm9
pandn %xmm15, %xmm9
movdqu (%rax), %xmm15
pand %xmm15, %xmm1
movdqa %xmm13, %xmm15
por %xmm9, %xmm1
movdqa %xmm8, %xmm9
pcmpgtd %xmm13, %xmm9
movdqa %xmm9, %xmm14
pandn %xmm8, %xmm9
pand %xmm14, %xmm15
pand %xmm14, %xmm8
por %xmm15, %xmm9
movdqa %xmm14, %xmm15
movdqa %xmm6, %xmm14
pandn %xmm13, %xmm15
movdqa %xmm5, %xmm13
pcmpgtd %xmm6, %xmm13
por %xmm8, %xmm15
movdqa %xmm13, %xmm8
pand %xmm13, %xmm14
pandn %xmm5, %xmm8
pand %xmm13, %xmm5
por %xmm14, %xmm8
movdqa %xmm13, %xmm14
pandn %xmm6, %xmm14
movdqa %xmm3, %xmm6
pcmpgtd %xmm12, %xmm6
por %xmm14, %xmm5
movdqa -64(%rbp), %xmm14
movaps %xmm5, -112(%rbp)
movdqa %xmm12, %xmm5
movdqa %xmm6, %xmm13
pand %xmm6, %xmm5
pandn %xmm3, %xmm13
pand %xmm6, %xmm3
por %xmm13, %xmm5
movdqa %xmm6, %xmm13
movdqa %xmm14, %xmm6
pandn %xmm12, %xmm13
movdqa %xmm2, %xmm12
pcmpgtd %xmm14, %xmm12
por %xmm13, %xmm3
movdqa %xmm12, %xmm13
pand %xmm12, %xmm6
pandn %xmm2, %xmm13
pand %xmm12, %xmm2
por %xmm13, %xmm6
movdqa %xmm12, %xmm13
pandn %xmm14, %xmm13
movdqa %xmm11, %xmm14
por %xmm13, %xmm2
movdqa %xmm7, %xmm13
pcmpgtd %xmm11, %xmm13
movdqa %xmm13, %xmm12
pand %xmm13, %xmm14
pandn %xmm7, %xmm12
pand %xmm13, %xmm7
por %xmm14, %xmm12
movdqa %xmm13, %xmm14
pandn %xmm11, %xmm14
movdqa %xmm4, %xmm11
por %xmm14, %xmm7
movdqa -80(%rbp), %xmm14
movaps %xmm7, -128(%rbp)
pcmpgtd %xmm14, %xmm11
movdqa %xmm14, %xmm13
movdqa %xmm11, %xmm7
pand %xmm11, %xmm13
pandn %xmm4, %xmm7
pand %xmm11, %xmm4
por %xmm13, %xmm7
movdqa %xmm11, %xmm13
movdqa %xmm0, %xmm11
pcmpgtd %xmm10, %xmm11
pandn %xmm14, %xmm13
movdqa -96(%rbp), %xmm14
por %xmm13, %xmm4
movaps %xmm4, -80(%rbp)
movdqa %xmm10, %xmm4
movdqa %xmm11, %xmm13
pand %xmm11, %xmm4
pandn %xmm0, %xmm13
pand %xmm11, %xmm0
por %xmm13, %xmm4
movdqa %xmm11, %xmm13
movdqa %xmm1, %xmm11
pcmpgtd %xmm14, %xmm11
pandn %xmm10, %xmm13
movdqa %xmm14, %xmm10
por %xmm13, %xmm0
movdqa %xmm11, %xmm13
pand %xmm11, %xmm10
pandn %xmm1, %xmm13
pand %xmm11, %xmm1
por %xmm13, %xmm10
movdqa %xmm11, %xmm13
pandn %xmm14, %xmm13
movdqa %xmm9, %xmm14
por %xmm13, %xmm1
movdqa %xmm5, %xmm13
pcmpgtd %xmm9, %xmm13
movdqa %xmm13, %xmm11
pand %xmm13, %xmm14
pandn %xmm5, %xmm11
pand %xmm13, %xmm5
por %xmm14, %xmm11
movdqa %xmm13, %xmm14
movdqa %xmm8, %xmm13
pandn %xmm9, %xmm14
movdqa %xmm6, %xmm9
pcmpgtd %xmm8, %xmm9
por %xmm5, %xmm14
movdqa %xmm9, %xmm5
pand %xmm9, %xmm13
pandn %xmm6, %xmm5
pand %xmm9, %xmm6
por %xmm13, %xmm5
movdqa %xmm9, %xmm13
movdqa %xmm15, %xmm9
pandn %xmm8, %xmm13
movdqa %xmm3, %xmm8
pcmpgtd %xmm15, %xmm8
por %xmm13, %xmm6
movaps %xmm6, -96(%rbp)
movdqa %xmm8, %xmm6
pand %xmm8, %xmm9
pandn %xmm3, %xmm6
pand %xmm8, %xmm3
por %xmm9, %xmm6
movdqa %xmm8, %xmm9
movdqa %xmm2, %xmm8
pandn %xmm15, %xmm9
movdqa -112(%rbp), %xmm15
por %xmm9, %xmm3
pcmpgtd %xmm15, %xmm8
movaps %xmm3, -144(%rbp)
movdqa %xmm15, %xmm9
movdqa %xmm8, %xmm3
pand %xmm8, %xmm9
pandn %xmm2, %xmm3
pand %xmm8, %xmm2
por %xmm9, %xmm3
movdqa %xmm8, %xmm9
movdqa %xmm12, %xmm8
pandn %xmm15, %xmm9
movdqa -128(%rbp), %xmm15
por %xmm9, %xmm2
movaps %xmm2, -64(%rbp)
movdqa %xmm4, %xmm2
pcmpgtd %xmm12, %xmm2
movdqa %xmm2, %xmm9
pand %xmm2, %xmm8
pandn %xmm4, %xmm9
pand %xmm2, %xmm4
por %xmm9, %xmm8
movdqa %xmm2, %xmm9
movdqa %xmm10, %xmm2
pcmpgtd %xmm7, %xmm2
pandn %xmm12, %xmm9
por %xmm9, %xmm4
movdqa %xmm7, %xmm9
movdqa %xmm2, %xmm12
pand %xmm2, %xmm9
pandn %xmm10, %xmm12
pand %xmm2, %xmm10
por %xmm12, %xmm9
movdqa %xmm2, %xmm12
movdqa %xmm15, %xmm2
pandn %xmm7, %xmm12
movdqa %xmm0, %xmm7
pcmpgtd %xmm15, %xmm7
por %xmm12, %xmm10
movdqa %xmm7, %xmm12
pand %xmm7, %xmm2
pandn %xmm0, %xmm12
pand %xmm7, %xmm0
por %xmm12, %xmm2
movdqa %xmm7, %xmm12
pandn %xmm15, %xmm12
movdqa -80(%rbp), %xmm15
por %xmm12, %xmm0
movdqa %xmm1, %xmm12
pcmpgtd %xmm15, %xmm12
movdqa %xmm12, %xmm7
pandn %xmm1, %xmm7
pand %xmm12, %xmm1
movdqa %xmm7, %xmm13
movdqa %xmm15, %xmm7
pand %xmm12, %xmm7
por %xmm13, %xmm7
movdqa %xmm12, %xmm13
movdqa %xmm8, %xmm12
pcmpgtd %xmm11, %xmm12
pandn %xmm15, %xmm13
por %xmm13, %xmm1
movdqa %xmm12, %xmm15
pandn %xmm8, %xmm15
pand %xmm12, %xmm8
movdqa %xmm15, %xmm13
movdqa %xmm11, %xmm15
pand %xmm12, %xmm15
por %xmm13, %xmm15
movaps %xmm15, -112(%rbp)
movdqa %xmm12, %xmm15
movdqa %xmm5, %xmm12
pandn %xmm11, %xmm15
movdqa %xmm15, %xmm13
movdqa %xmm8, %xmm15
movdqa %xmm9, %xmm8
pcmpgtd %xmm5, %xmm8
por %xmm13, %xmm15
movdqa -96(%rbp), %xmm13
movdqa %xmm8, %xmm11
pand %xmm8, %xmm12
pandn %xmm9, %xmm11
pand %xmm8, %xmm9
por %xmm11, %xmm12
movdqa %xmm8, %xmm11
movdqa %xmm2, %xmm8
pcmpgtd %xmm6, %xmm8
pandn %xmm5, %xmm11
movdqa %xmm6, %xmm5
movaps %xmm12, -128(%rbp)
por %xmm11, %xmm9
movdqa %xmm8, %xmm11
pand %xmm8, %xmm5
pandn %xmm2, %xmm11
pand %xmm8, %xmm2
por %xmm11, %xmm5
movdqa %xmm8, %xmm11
movdqa %xmm7, %xmm8
pcmpgtd %xmm3, %xmm8
pandn %xmm6, %xmm11
movdqa %xmm3, %xmm6
movaps %xmm5, -80(%rbp)
por %xmm11, %xmm2
movdqa %xmm8, %xmm11
pand %xmm8, %xmm6
pandn %xmm7, %xmm11
pand %xmm8, %xmm7
por %xmm11, %xmm6
movdqa %xmm8, %xmm11
movdqa %xmm4, %xmm8
pcmpgtd %xmm14, %xmm8
pandn %xmm3, %xmm11
movdqa %xmm14, %xmm3
por %xmm11, %xmm7
movdqa %xmm8, %xmm11
pand %xmm8, %xmm3
pandn %xmm4, %xmm11
pand %xmm8, %xmm4
por %xmm11, %xmm3
movdqa %xmm8, %xmm11
movdqa %xmm13, %xmm8
pandn %xmm14, %xmm11
movdqa -144(%rbp), %xmm14
por %xmm11, %xmm4
movdqa %xmm10, %xmm11
pcmpgtd %xmm13, %xmm11
movdqa %xmm11, %xmm12
pand %xmm11, %xmm8
pandn %xmm10, %xmm12
pand %xmm11, %xmm10
por %xmm12, %xmm8
movdqa %xmm11, %xmm12
movdqa %xmm0, %xmm11
pcmpgtd %xmm14, %xmm11
pandn %xmm13, %xmm12
por %xmm12, %xmm10
movdqa %xmm14, %xmm12
movdqa %xmm11, %xmm13
pand %xmm11, %xmm12
pandn %xmm0, %xmm13
pand %xmm11, %xmm0
por %xmm13, %xmm12
movdqa %xmm11, %xmm13
pandn %xmm14, %xmm13
movdqa -64(%rbp), %xmm14
por %xmm13, %xmm0
movdqa %xmm1, %xmm13
pcmpgtd %xmm14, %xmm13
movdqa %xmm13, %xmm11
movdqa %xmm13, %xmm5
pandn -64(%rbp), %xmm5
pandn %xmm1, %xmm11
pand %xmm13, %xmm1
pand %xmm13, %xmm14
por %xmm5, %xmm1
por %xmm14, %xmm11
movdqa %xmm8, %xmm13
movaps %xmm1, -192(%rbp)
movdqa %xmm2, %xmm1
pcmpgtd %xmm8, %xmm1
movdqa %xmm1, %xmm14
pand %xmm1, %xmm13
pandn %xmm2, %xmm14
pand %xmm1, %xmm2
por %xmm14, %xmm13
movdqa %xmm1, %xmm14
movdqa %xmm12, %xmm1
pandn %xmm8, %xmm14
movdqa %xmm9, %xmm8
pcmpgtd %xmm12, %xmm8
por %xmm14, %xmm2
movdqa %xmm8, %xmm14
pand %xmm8, %xmm1
pandn %xmm9, %xmm14
pand %xmm8, %xmm9
por %xmm14, %xmm1
movdqa %xmm8, %xmm14
movdqa %xmm4, %xmm8
pcmpgtd %xmm6, %xmm8
pandn %xmm12, %xmm14
por %xmm14, %xmm9
movdqa %xmm6, %xmm14
movdqa %xmm8, %xmm5
pand %xmm8, %xmm14
pandn %xmm4, %xmm5
pand %xmm8, %xmm4
por %xmm5, %xmm14
movdqa %xmm8, %xmm5
movdqa %xmm11, %xmm8
pandn %xmm6, %xmm5
movdqa %xmm7, %xmm6
pcmpgtd %xmm11, %xmm6
por %xmm5, %xmm4
movdqa %xmm6, %xmm5
pand %xmm6, %xmm8
pandn %xmm7, %xmm5
pand %xmm6, %xmm7
por %xmm5, %xmm8
movdqa %xmm6, %xmm5
movdqa %xmm10, %xmm6
pandn %xmm11, %xmm5
movdqa %xmm0, %xmm11
pcmpgtd %xmm10, %xmm11
por %xmm5, %xmm7
movdqa %xmm11, %xmm5
pand %xmm11, %xmm6
pandn %xmm0, %xmm5
pand %xmm11, %xmm0
por %xmm5, %xmm6
movdqa %xmm11, %xmm5
movdqa %xmm15, %xmm11
pcmpgtd %xmm3, %xmm11
pandn %xmm10, %xmm5
movdqa %xmm3, %xmm10
por %xmm5, %xmm0
movaps %xmm0, -64(%rbp)
movdqa -128(%rbp), %xmm0
movdqa %xmm11, %xmm5
pand %xmm11, %xmm10
pandn %xmm15, %xmm5
pand %xmm11, %xmm15
por %xmm5, %xmm10
movdqa %xmm11, %xmm5
pandn %xmm3, %xmm5
movdqa %xmm0, %xmm3
por %xmm5, %xmm15
movdqa -80(%rbp), %xmm5
movdqa %xmm5, %xmm11
pcmpgtd %xmm0, %xmm11
movdqa %xmm11, %xmm12
pand %xmm11, %xmm3
pandn %xmm5, %xmm12
movdqa %xmm11, %xmm5
pandn %xmm0, %xmm5
por %xmm12, %xmm3
movdqa %xmm5, %xmm12
movdqa -80(%rbp), %xmm5
movdqa %xmm3, %xmm0
pand %xmm11, %xmm5
movdqa %xmm10, %xmm11
pcmpgtd %xmm3, %xmm11
por %xmm12, %xmm5
movdqa %xmm11, %xmm12
pand %xmm11, %xmm0
pandn %xmm10, %xmm12
pand %xmm11, %xmm10
por %xmm0, %xmm12
movdqa -64(%rbp), %xmm0
movaps %xmm12, -128(%rbp)
movdqa %xmm11, %xmm12
movdqa %xmm6, %xmm11
pcmpgtd %xmm8, %xmm11
pandn %xmm3, %xmm12
movdqa %xmm8, %xmm3
por %xmm12, %xmm10
movdqa %xmm11, %xmm12
pand %xmm11, %xmm3
pandn %xmm6, %xmm12
pand %xmm11, %xmm6
por %xmm12, %xmm3
movdqa %xmm11, %xmm12
movdqa %xmm15, %xmm11
pcmpgtd %xmm5, %xmm11
pandn %xmm8, %xmm12
movdqa %xmm5, %xmm8
por %xmm12, %xmm6
movdqa %xmm11, %xmm12
pand %xmm11, %xmm8
pandn %xmm15, %xmm12
pand %xmm11, %xmm15
por %xmm12, %xmm8
movdqa %xmm11, %xmm12
movdqa %xmm7, %xmm11
pandn %xmm5, %xmm12
movdqa %xmm0, %xmm5
pcmpgtd %xmm7, %xmm5
por %xmm12, %xmm15
movdqa %xmm5, %xmm12
pand %xmm5, %xmm11
pandn %xmm0, %xmm12
pand %xmm5, %xmm0
por %xmm12, %xmm11
movdqa %xmm5, %xmm12
pandn %xmm7, %xmm12
movdqa %xmm8, %xmm7
por %xmm12, %xmm0
movdqa %xmm1, %xmm12
movaps %xmm0, -208(%rbp)
movdqa %xmm10, %xmm0
pcmpgtd %xmm13, %xmm12
cmpq $1, -240(%rbp)
pcmpgtd %xmm8, %xmm0
movdqa %xmm0, %xmm5
pand %xmm0, %xmm7
pandn %xmm10, %xmm5
pand %xmm0, %xmm10
por %xmm5, %xmm7
movdqa %xmm0, %xmm5
movdqa %xmm12, %xmm0
pandn %xmm8, %xmm5
pandn %xmm1, %xmm0
pand %xmm12, %xmm1
movaps %xmm7, -144(%rbp)
por %xmm5, %xmm10
movdqa %xmm13, %xmm5
movdqa %xmm9, %xmm7
pand %xmm12, %xmm5
movdqa %xmm11, %xmm8
por %xmm0, %xmm5
movdqa %xmm12, %xmm0
pandn %xmm13, %xmm0
movdqa %xmm6, %xmm13
por %xmm0, %xmm1
pcmpgtd %xmm11, %xmm13
movdqa %xmm2, %xmm0
pcmpgtd %xmm9, %xmm0
movdqa %xmm1, %xmm12
pand %xmm13, %xmm8
movdqa %xmm0, %xmm1
pand %xmm0, %xmm7
pandn %xmm2, %xmm1
pand %xmm0, %xmm2
por %xmm1, %xmm7
movdqa %xmm0, %xmm1
movdqa %xmm13, %xmm0
pandn %xmm9, %xmm1
pandn %xmm6, %xmm0
movdqa %xmm14, %xmm9
por %xmm1, %xmm2
movdqa %xmm15, %xmm1
por %xmm0, %xmm8
pcmpgtd %xmm14, %xmm1
movdqa %xmm13, %xmm0
pand %xmm6, %xmm13
pandn %xmm11, %xmm0
movdqa %xmm3, %xmm6
movdqa %xmm7, %xmm11
por %xmm0, %xmm13
movdqa %xmm1, %xmm0
pand %xmm1, %xmm9
pandn %xmm15, %xmm0
pand %xmm1, %xmm15
por %xmm0, %xmm9
movdqa %xmm1, %xmm0
pandn %xmm14, %xmm0
movdqa %xmm9, %xmm14
por %xmm0, %xmm15
movdqa %xmm4, %xmm0
pcmpgtd %xmm3, %xmm0
movdqa %xmm0, %xmm1
pand %xmm0, %xmm6
pandn %xmm4, %xmm1
pand %xmm0, %xmm4
por %xmm1, %xmm6
movdqa %xmm0, %xmm1
movdqa %xmm5, %xmm0
pcmpgtd %xmm9, %xmm0
pcmpgtd %xmm6, %xmm11
pandn %xmm3, %xmm1
por %xmm1, %xmm4
movdqa %xmm12, %xmm3
movdqa %xmm0, %xmm1
pand %xmm0, %xmm14
pandn %xmm5, %xmm1
pand %xmm0, %xmm5
por %xmm1, %xmm14
movdqa %xmm0, %xmm1
pandn %xmm9, %xmm1
movdqa %xmm6, %xmm9
por %xmm1, %xmm5
movdqa %xmm15, %xmm1
pand %xmm11, %xmm9
pcmpgtd %xmm12, %xmm1
movdqa %xmm1, %xmm0
pand %xmm1, %xmm3
pandn %xmm15, %xmm0
por %xmm0, %xmm3
movdqa %xmm1, %xmm0
pand %xmm15, %xmm1
pandn %xmm12, %xmm0
por %xmm0, %xmm1
movdqa %xmm11, %xmm0
pandn %xmm7, %xmm0
pand %xmm11, %xmm7
por %xmm0, %xmm9
movdqa %xmm11, %xmm0
pandn %xmm6, %xmm0
por %xmm0, %xmm7
movdqa %xmm4, %xmm0
pcmpgtd %xmm2, %xmm0
movdqa %xmm7, %xmm11
movdqa %xmm2, %xmm7
movdqa %xmm0, %xmm6
movdqa %xmm0, %xmm12
pand %xmm0, %xmm7
pandn %xmm2, %xmm6
movdqa %xmm10, %xmm2
pand %xmm4, %xmm0
pcmpgtd %xmm14, %xmm2
por %xmm6, %xmm0
pandn %xmm4, %xmm12
movdqa %xmm14, %xmm6
por %xmm12, %xmm7
movdqa %xmm2, %xmm4
pand %xmm2, %xmm6
pandn %xmm10, %xmm4
pand %xmm2, %xmm10
por %xmm4, %xmm6
movdqa %xmm2, %xmm4
movdqa %xmm3, %xmm2
pcmpgtd %xmm5, %xmm2
pandn %xmm14, %xmm4
movaps %xmm6, -160(%rbp)
movdqa %xmm5, %xmm6
por %xmm4, %xmm10
movaps %xmm10, -64(%rbp)
movdqa %xmm8, %xmm10
movdqa %xmm2, %xmm4
pand %xmm2, %xmm6
pandn %xmm3, %xmm4
pand %xmm2, %xmm3
por %xmm4, %xmm6
movdqa %xmm2, %xmm4
movdqa %xmm1, %xmm2
pcmpgtd %xmm9, %xmm2
pandn %xmm5, %xmm4
movaps %xmm6, -80(%rbp)
movdqa %xmm9, %xmm5
por %xmm4, %xmm3
movdqa %xmm7, %xmm6
pcmpgtd %xmm11, %xmm6
movdqa %xmm2, %xmm4
pand %xmm2, %xmm5
pandn %xmm1, %xmm4
pand %xmm2, %xmm1
por %xmm4, %xmm5
movdqa %xmm2, %xmm4
movdqa %xmm11, %xmm2
pandn %xmm9, %xmm4
pand %xmm6, %xmm2
por %xmm4, %xmm1
movdqa %xmm6, %xmm4
pandn %xmm7, %xmm4
pand %xmm6, %xmm7
por %xmm4, %xmm2
movdqa %xmm6, %xmm4
pandn %xmm11, %xmm4
movdqa %xmm2, %xmm9
por %xmm4, %xmm7
pcmpgtd %xmm1, %xmm9
movdqa %xmm0, %xmm4
pcmpgtd %xmm8, %xmm4
movdqa %xmm4, %xmm6
pand %xmm4, %xmm10
pandn %xmm0, %xmm6
pand %xmm4, %xmm0
por %xmm6, %xmm10
movdqa %xmm4, %xmm6
movdqa %xmm5, %xmm4
pcmpgtd %xmm3, %xmm4
pandn %xmm8, %xmm6
movdqa %xmm3, %xmm8
por %xmm6, %xmm0
movdqa %xmm4, %xmm6
pand %xmm4, %xmm8
pandn %xmm5, %xmm6
pand %xmm4, %xmm5
por %xmm6, %xmm8
movdqa %xmm4, %xmm6
movdqa %xmm9, %xmm4
pandn %xmm3, %xmm6
movdqa %xmm1, %xmm3
pandn %xmm2, %xmm4
movaps %xmm8, -96(%rbp)
pand %xmm9, %xmm3
por %xmm6, %xmm5
pand %xmm9, %xmm2
por %xmm4, %xmm3
movdqa %xmm9, %xmm4
movdqa %xmm5, %xmm12
pandn %xmm1, %xmm4
por %xmm4, %xmm2
jbe .L112
movdqa -112(%rbp), %xmm5
pshufd $177, %xmm13, %xmm14
pshufd $177, -192(%rbp), %xmm13
movdqa %xmm13, %xmm8
pshufd $177, %xmm3, %xmm6
pshufd $177, %xmm0, %xmm0
pshufd $177, %xmm7, %xmm7
pshufd $177, -208(%rbp), %xmm15
pcmpgtd %xmm5, %xmm8
movaps %xmm6, -176(%rbp)
movdqa %xmm5, %xmm4
movdqa %xmm15, %xmm9
movdqa -160(%rbp), %xmm3
pshufd $177, %xmm10, %xmm10
pshufd $177, %xmm2, %xmm2
movdqa %xmm8, %xmm6
movdqa %xmm8, %xmm1
pand %xmm8, %xmm4
pandn %xmm5, %xmm6
movdqa -128(%rbp), %xmm5
pandn %xmm13, %xmm1
pand %xmm13, %xmm8
por %xmm1, %xmm4
movaps %xmm6, -208(%rbp)
movdqa -144(%rbp), %xmm6
pcmpgtd %xmm5, %xmm9
movdqa %xmm5, %xmm11
movaps %xmm4, -192(%rbp)
movdqa %xmm6, %xmm4
movdqa %xmm9, %xmm1
pand %xmm9, %xmm11
pandn %xmm15, %xmm1
por %xmm1, %xmm11
movdqa %xmm9, %xmm1
pand %xmm15, %xmm9
pandn %xmm5, %xmm1
movdqa %xmm14, %xmm5
pcmpgtd %xmm6, %xmm5
movaps %xmm1, -224(%rbp)
movdqa %xmm5, %xmm1
pand %xmm5, %xmm4
pandn %xmm14, %xmm1
por %xmm1, %xmm4
movdqa %xmm5, %xmm1
pand %xmm14, %xmm5
pandn %xmm6, %xmm1
movaps %xmm4, -112(%rbp)
movdqa %xmm3, %xmm6
movaps %xmm1, -288(%rbp)
movdqa %xmm0, %xmm1
pcmpgtd %xmm3, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm6
pandn %xmm0, %xmm4
por %xmm4, %xmm6
movdqa %xmm1, %xmm4
pand %xmm0, %xmm1
pandn %xmm3, %xmm4
movaps %xmm6, -128(%rbp)
movdqa -64(%rbp), %xmm6
movaps %xmm4, -304(%rbp)
movdqa %xmm10, %xmm4
por -304(%rbp), %xmm1
pcmpgtd %xmm6, %xmm4
pshufd $177, %xmm1, %xmm1
movdqa %xmm4, %xmm3
pandn %xmm10, %xmm3
pand %xmm4, %xmm10
movaps %xmm3, -320(%rbp)
movdqa %xmm4, %xmm3
pand -64(%rbp), %xmm4
por -320(%rbp), %xmm4
pandn %xmm6, %xmm3
por %xmm3, %xmm10
movdqa %xmm7, %xmm3
pshufd $177, %xmm4, %xmm4
movaps %xmm10, -144(%rbp)
movdqa -80(%rbp), %xmm10
pcmpgtd %xmm10, %xmm3
movdqa %xmm3, %xmm6
pandn %xmm7, %xmm3
movaps %xmm3, -336(%rbp)
movdqa %xmm6, %xmm3
pand %xmm6, %xmm7
pand -80(%rbp), %xmm6
pandn %xmm10, %xmm3
por %xmm3, %xmm7
movdqa %xmm2, %xmm3
movaps %xmm7, -160(%rbp)
movdqa -96(%rbp), %xmm7
pcmpgtd %xmm7, %xmm3
movdqa %xmm3, %xmm10
pandn %xmm2, %xmm3
movaps %xmm3, -352(%rbp)
movdqa %xmm10, %xmm3
pand %xmm10, %xmm2
pandn %xmm7, %xmm3
movdqa -176(%rbp), %xmm7
por %xmm3, %xmm2
pcmpgtd %xmm12, %xmm7
movdqa %xmm7, %xmm3
pandn -176(%rbp), %xmm3
movaps %xmm3, -368(%rbp)
movdqa %xmm7, %xmm3
pandn %xmm12, %xmm3
movaps %xmm3, -384(%rbp)
movdqa -176(%rbp), %xmm3
pand %xmm7, %xmm3
pand %xmm12, %xmm7
por -384(%rbp), %xmm3
por -336(%rbp), %xmm6
por -368(%rbp), %xmm7
movdqa -192(%rbp), %xmm13
pand -96(%rbp), %xmm10
pshufd $177, %xmm7, %xmm7
pshufd $177, %xmm6, %xmm6
por -352(%rbp), %xmm10
movdqa %xmm7, %xmm0
por -288(%rbp), %xmm5
por -224(%rbp), %xmm9
pcmpgtd %xmm13, %xmm0
pshufd $177, %xmm10, %xmm14
por -208(%rbp), %xmm8
pshufd $177, %xmm9, %xmm15
movdqa %xmm13, %xmm9
movaps %xmm14, -64(%rbp)
pshufd $177, %xmm5, %xmm5
pshufd $177, %xmm8, %xmm12
movdqa %xmm3, %xmm8
movdqa %xmm0, %xmm10
pandn %xmm7, %xmm0
pand %xmm10, %xmm9
por %xmm0, %xmm9
movdqa %xmm10, %xmm0
pand %xmm7, %xmm10
pandn %xmm13, %xmm0
movdqa %xmm12, %xmm13
pcmpgtd %xmm3, %xmm13
movaps %xmm0, -80(%rbp)
movdqa %xmm13, %xmm0
pand %xmm13, %xmm8
pandn %xmm12, %xmm0
por %xmm0, %xmm8
movdqa %xmm13, %xmm0
pand %xmm12, %xmm13
pandn %xmm3, %xmm0
movaps %xmm8, -224(%rbp)
movdqa %xmm11, %xmm8
movaps %xmm0, -304(%rbp)
movdqa %xmm14, %xmm0
pcmpgtd %xmm11, %xmm0
movdqa %xmm0, %xmm3
pandn -64(%rbp), %xmm3
pand %xmm0, %xmm8
por %xmm3, %xmm8
movdqa %xmm0, %xmm3
pand -64(%rbp), %xmm0
pandn %xmm11, %xmm3
movdqa %xmm2, %xmm11
movaps %xmm8, -96(%rbp)
movaps %xmm3, -320(%rbp)
movdqa %xmm15, %xmm3
por -320(%rbp), %xmm0
pcmpgtd %xmm2, %xmm3
pshufd $177, %xmm0, %xmm0
movdqa %xmm3, %xmm14
pand %xmm3, %xmm11
pandn %xmm15, %xmm14
por %xmm14, %xmm11
movdqa %xmm3, %xmm14
pand %xmm15, %xmm3
movaps %xmm11, -176(%rbp)
movdqa -112(%rbp), %xmm11
pandn %xmm2, %xmm14
movdqa %xmm6, %xmm2
movaps %xmm14, -336(%rbp)
pcmpgtd %xmm11, %xmm2
movdqa %xmm2, %xmm14
movdqa %xmm2, %xmm8
pandn %xmm6, %xmm14
pand %xmm2, %xmm6
pandn %xmm11, %xmm8
movaps %xmm14, -352(%rbp)
movdqa %xmm6, %xmm14
movdqa %xmm5, %xmm6
pand -112(%rbp), %xmm2
por %xmm8, %xmm14
por -352(%rbp), %xmm2
movdqa -160(%rbp), %xmm8
movaps %xmm14, -192(%rbp)
pcmpgtd %xmm8, %xmm6
pshufd $177, %xmm2, %xmm2
movdqa %xmm6, %xmm14
pandn %xmm5, %xmm6
movaps %xmm6, -368(%rbp)
movdqa %xmm14, %xmm6
pand %xmm14, %xmm5
pandn %xmm8, %xmm6
por %xmm6, %xmm5
movdqa -128(%rbp), %xmm6
movaps %xmm5, -208(%rbp)
movdqa %xmm4, %xmm5
pcmpgtd %xmm6, %xmm5
movdqa %xmm5, %xmm8
pandn %xmm4, %xmm5
movdqa %xmm5, %xmm11
movdqa %xmm8, %xmm5
pand %xmm8, %xmm4
pandn %xmm6, %xmm5
pand -128(%rbp), %xmm8
por %xmm5, %xmm4
movdqa %xmm1, %xmm5
pcmpgtd -144(%rbp), %xmm5
movaps %xmm4, -288(%rbp)
por %xmm11, %xmm8
pshufd $177, %xmm8, %xmm8
movdqa %xmm5, %xmm6
movdqa %xmm5, %xmm4
pandn -144(%rbp), %xmm4
pandn %xmm1, %xmm6
por -80(%rbp), %xmm10
pand %xmm5, %xmm1
movdqa -288(%rbp), %xmm15
pand -144(%rbp), %xmm5
por %xmm4, %xmm1
por -304(%rbp), %xmm13
pshufd $177, %xmm10, %xmm11
movdqa %xmm15, %xmm4
por -336(%rbp), %xmm3
por %xmm6, %xmm5
pshufd $177, %xmm13, %xmm10
movdqa -96(%rbp), %xmm6
movaps %xmm11, -128(%rbp)
pshufd $177, %xmm5, %xmm7
movaps %xmm10, -80(%rbp)
movdqa %xmm9, %xmm10
movdqa -192(%rbp), %xmm5
movaps %xmm7, -64(%rbp)
movdqa %xmm8, %xmm7
pshufd $177, %xmm3, %xmm3
pand -160(%rbp), %xmm14
por -368(%rbp), %xmm14
pcmpgtd %xmm9, %xmm7
pshufd $177, %xmm14, %xmm14
movdqa %xmm7, %xmm13
pand %xmm7, %xmm10
pandn %xmm8, %xmm13
por %xmm13, %xmm10
movdqa %xmm7, %xmm13
pand %xmm8, %xmm7
pandn %xmm9, %xmm13
movdqa %xmm2, %xmm9
movdqa %xmm10, %xmm8
pcmpgtd %xmm6, %xmm9
movaps %xmm13, -304(%rbp)
movdqa %xmm9, %xmm13
pandn %xmm2, %xmm9
movdqa %xmm13, %xmm12
pand %xmm13, %xmm2
movaps %xmm9, -320(%rbp)
pandn %xmm6, %xmm12
por %xmm12, %xmm2
movdqa %xmm11, %xmm12
pcmpgtd %xmm15, %xmm12
movdqa %xmm12, %xmm6
pandn -128(%rbp), %xmm12
pand %xmm6, %xmm4
movdqa %xmm4, %xmm9
por %xmm12, %xmm9
movdqa %xmm6, %xmm12
pandn %xmm15, %xmm12
movdqa -224(%rbp), %xmm15
movaps %xmm12, -288(%rbp)
movdqa %xmm0, %xmm12
pcmpgtd %xmm5, %xmm12
movdqa %xmm12, %xmm4
pandn %xmm0, %xmm4
pand %xmm12, %xmm0
movaps %xmm4, -336(%rbp)
movdqa %xmm12, %xmm4
pandn %xmm5, %xmm4
por %xmm4, %xmm0
movdqa -64(%rbp), %xmm4
movaps %xmm0, -144(%rbp)
movdqa %xmm4, %xmm11
pcmpgtd %xmm15, %xmm11
movdqa %xmm11, %xmm5
pandn -64(%rbp), %xmm11
movdqa %xmm11, %xmm4
movdqa %xmm15, %xmm11
pand %xmm5, %xmm11
por %xmm4, %xmm11
movdqa %xmm5, %xmm4
pandn %xmm15, %xmm4
movaps %xmm11, -160(%rbp)
movdqa -176(%rbp), %xmm15
movdqa %xmm14, %xmm11
movaps %xmm4, -352(%rbp)
pcmpgtd %xmm15, %xmm11
movdqa %xmm11, %xmm4
pandn %xmm14, %xmm4
pand %xmm11, %xmm14
movaps %xmm4, -368(%rbp)
movdqa %xmm11, %xmm4
pandn %xmm15, %xmm4
movdqa -80(%rbp), %xmm15
por %xmm4, %xmm14
movdqa %xmm15, %xmm4
movaps %xmm14, -112(%rbp)
movdqa %xmm1, %xmm15
pcmpgtd %xmm1, %xmm4
movdqa %xmm4, %xmm14
pandn -80(%rbp), %xmm14
pand %xmm4, %xmm15
por %xmm14, %xmm15
movdqa %xmm4, %xmm14
pandn %xmm1, %xmm14
movdqa -208(%rbp), %xmm1
movaps %xmm14, -384(%rbp)
movdqa %xmm3, %xmm14
pcmpgtd %xmm1, %xmm14
movdqa %xmm14, %xmm0
pandn %xmm3, %xmm0
pand %xmm14, %xmm3
movaps %xmm0, -400(%rbp)
movdqa %xmm14, %xmm0
pandn %xmm1, %xmm0
por %xmm0, %xmm3
movaps %xmm3, -224(%rbp)
movdqa -96(%rbp), %xmm3
movdqa -208(%rbp), %xmm1
pand -80(%rbp), %xmm4
pand -64(%rbp), %xmm5
pand %xmm13, %xmm3
por -384(%rbp), %xmm4
por -320(%rbp), %xmm3
movdqa -400(%rbp), %xmm13
pand %xmm14, %xmm1
por -304(%rbp), %xmm7
pshufd $177, %xmm3, %xmm3
pand -128(%rbp), %xmm6
pand -192(%rbp), %xmm12
por %xmm1, %xmm13
pshufd $177, %xmm4, %xmm1
pshufd $177, %xmm7, %xmm7
movdqa -144(%rbp), %xmm4
movaps %xmm1, -64(%rbp)
movdqa %xmm3, %xmm1
por -336(%rbp), %xmm12
por -288(%rbp), %xmm6
pcmpgtd %xmm10, %xmm1
por -352(%rbp), %xmm5
pand -176(%rbp), %xmm11
pshufd $177, %xmm12, %xmm12
pshufd $177, %xmm6, %xmm6
por -368(%rbp), %xmm11
pshufd $177, %xmm5, %xmm5
pshufd $177, %xmm13, %xmm13
movdqa %xmm1, %xmm0
pand %xmm1, %xmm8
pshufd $177, %xmm11, %xmm11
pandn %xmm3, %xmm0
por %xmm0, %xmm8
movdqa %xmm1, %xmm0
pand %xmm3, %xmm1
pandn %xmm10, %xmm0
movdqa %xmm7, %xmm10
pcmpgtd %xmm2, %xmm10
por %xmm0, %xmm1
movdqa %xmm2, %xmm0
movdqa %xmm10, %xmm3
pand %xmm10, %xmm0
pandn %xmm7, %xmm3
por %xmm0, %xmm3
movdqa %xmm10, %xmm0
pand %xmm7, %xmm10
pandn %xmm2, %xmm0
movdqa %xmm12, %xmm2
pcmpgtd %xmm9, %xmm2
movdqa %xmm0, %xmm14
movdqa %xmm4, %xmm0
por %xmm10, %xmm14
movdqa %xmm9, %xmm10
movdqa %xmm2, %xmm7
pand %xmm2, %xmm10
pandn %xmm12, %xmm7
por %xmm7, %xmm10
movdqa %xmm2, %xmm7
pand %xmm12, %xmm2
pandn %xmm9, %xmm7
por %xmm7, %xmm2
movdqa %xmm2, %xmm12
movdqa %xmm6, %xmm2
pcmpgtd %xmm4, %xmm2
pand %xmm2, %xmm0
movdqa %xmm2, %xmm7
pandn %xmm6, %xmm7
movdqa %xmm0, %xmm9
movdqa %xmm11, %xmm0
por %xmm7, %xmm9
movdqa %xmm2, %xmm7
pand %xmm6, %xmm2
pandn %xmm4, %xmm7
movdqa -160(%rbp), %xmm4
por %xmm2, %xmm7
pcmpgtd %xmm4, %xmm0
movdqa %xmm4, %xmm6
movdqa %xmm0, %xmm2
pand %xmm0, %xmm6
pandn %xmm11, %xmm2
por %xmm2, %xmm6
movdqa %xmm0, %xmm2
pand %xmm11, %xmm0
pandn %xmm4, %xmm2
movaps %xmm6, -288(%rbp)
movdqa -112(%rbp), %xmm6
por %xmm2, %xmm0
movdqa %xmm0, %xmm11
movdqa %xmm5, %xmm0
pcmpgtd %xmm6, %xmm0
movdqa %xmm0, %xmm2
pand %xmm0, %xmm6
movdqa %xmm0, %xmm4
pandn %xmm5, %xmm2
pand %xmm5, %xmm0
movdqa %xmm13, %xmm5
pcmpgtd %xmm15, %xmm5
pandn -112(%rbp), %xmm4
por %xmm2, %xmm6
por %xmm4, %xmm0
movaps %xmm0, -304(%rbp)
movdqa %xmm5, %xmm2
movdqa %xmm5, %xmm0
movdqa %xmm15, %xmm5
pandn %xmm13, %xmm2
pand %xmm0, %xmm5
por %xmm2, %xmm5
movdqa %xmm0, %xmm2
pand %xmm13, %xmm0
movaps %xmm5, -320(%rbp)
movdqa -64(%rbp), %xmm5
pandn %xmm15, %xmm2
movdqa -224(%rbp), %xmm15
movdqa %xmm0, %xmm13
movdqa %xmm5, %xmm4
por %xmm2, %xmm13
pcmpgtd %xmm15, %xmm4
movdqa %xmm4, %xmm2
movdqa %xmm4, %xmm0
movdqa %xmm5, %xmm4
pandn %xmm5, %xmm2
movdqa %xmm15, %xmm5
pand %xmm0, %xmm5
por %xmm2, %xmm5
movdqa %xmm0, %xmm2
pand %xmm4, %xmm0
pandn %xmm15, %xmm2
movdqa %xmm0, %xmm15
pshufd $177, %xmm8, %xmm0
movaps %xmm5, -336(%rbp)
por %xmm2, %xmm15
movdqa %xmm0, %xmm2
pcmpgtd %xmm8, %xmm2
movdqa %xmm2, %xmm4
movdqa %xmm2, %xmm5
pandn %xmm0, %xmm4
pandn %xmm8, %xmm5
pand %xmm2, %xmm0
pand %xmm2, %xmm8
por %xmm5, %xmm0
por %xmm4, %xmm8
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm8, %xmm8
punpckldq %xmm0, %xmm8
pshufd $177, %xmm1, %xmm0
movdqa %xmm0, %xmm2
movaps %xmm8, -352(%rbp)
pcmpgtd %xmm1, %xmm2
movaps %xmm8, -112(%rbp)
movdqa %xmm2, %xmm4
movdqa %xmm2, %xmm8
pandn %xmm0, %xmm4
pandn %xmm1, %xmm8
pand %xmm2, %xmm0
pand %xmm2, %xmm1
por %xmm8, %xmm0
por %xmm4, %xmm1
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm1, %xmm1
punpckldq %xmm0, %xmm1
pshufd $177, %xmm3, %xmm0
movaps %xmm1, -368(%rbp)
movaps %xmm1, -128(%rbp)
movdqa %xmm0, %xmm1
pcmpgtd %xmm3, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm4
pandn %xmm0, %xmm2
pandn %xmm3, %xmm4
pand %xmm1, %xmm0
pand %xmm1, %xmm3
por %xmm4, %xmm0
por %xmm2, %xmm3
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm3, %xmm3
punpckldq %xmm0, %xmm3
pshufd $177, %xmm14, %xmm0
movdqa %xmm0, %xmm1
movaps %xmm3, -384(%rbp)
pcmpgtd %xmm14, %xmm1
movaps %xmm3, -144(%rbp)
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm14, %xmm3
pand %xmm1, %xmm0
pand %xmm1, %xmm14
por %xmm3, %xmm0
por %xmm2, %xmm14
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm14, %xmm14
punpckldq %xmm0, %xmm14
pshufd $177, %xmm10, %xmm0
movdqa %xmm0, %xmm1
movaps %xmm14, -160(%rbp)
cmpq $3, -240(%rbp)
pcmpgtd %xmm10, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm10, %xmm3
pand %xmm1, %xmm0
pand %xmm1, %xmm10
por %xmm3, %xmm0
por %xmm2, %xmm10
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm10, %xmm10
punpckldq %xmm0, %xmm10
pshufd $177, %xmm12, %xmm0
movdqa %xmm0, %xmm1
movaps %xmm10, -176(%rbp)
pcmpgtd %xmm12, %xmm1
movaps %xmm10, -64(%rbp)
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm12, %xmm3
pand %xmm1, %xmm0
pand %xmm1, %xmm12
por %xmm3, %xmm0
por %xmm2, %xmm12
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm12, %xmm12
punpckldq %xmm0, %xmm12
pshufd $177, %xmm9, %xmm0
movdqa %xmm0, %xmm1
movaps %xmm12, -192(%rbp)
pcmpgtd %xmm9, %xmm1
movaps %xmm12, -80(%rbp)
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm9, %xmm3
pand %xmm1, %xmm0
pand %xmm1, %xmm9
por %xmm3, %xmm0
por %xmm2, %xmm9
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm9, %xmm9
punpckldq %xmm0, %xmm9
pshufd $177, %xmm7, %xmm0
movdqa %xmm0, %xmm1
movaps %xmm9, -208(%rbp)
pcmpgtd %xmm7, %xmm1
movaps %xmm9, -96(%rbp)
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm7, %xmm3
pand %xmm1, %xmm7
por %xmm2, %xmm7
pand %xmm1, %xmm0
pshufd $136, %xmm7, %xmm7
por %xmm3, %xmm0
movdqa %xmm7, %xmm3
movdqa -288(%rbp), %xmm7
pshufd $221, %xmm0, %xmm0
punpckldq %xmm0, %xmm3
pshufd $177, %xmm7, %xmm0
movaps %xmm3, -224(%rbp)
movdqa %xmm3, %xmm12
movdqa %xmm0, %xmm1
pcmpgtd %xmm7, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm7, %xmm3
pand %xmm1, %xmm0
pand %xmm7, %xmm1
por %xmm3, %xmm0
por %xmm2, %xmm1
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm1, %xmm1
punpckldq %xmm0, %xmm1
pshufd $177, %xmm11, %xmm0
movdqa %xmm1, %xmm8
movdqa %xmm0, %xmm1
pcmpgtd %xmm11, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm11, %xmm3
pand %xmm1, %xmm11
pand %xmm1, %xmm0
por %xmm2, %xmm11
por %xmm3, %xmm0
pshufd $136, %xmm11, %xmm11
pshufd $221, %xmm0, %xmm0
movdqa %xmm11, %xmm7
punpckldq %xmm0, %xmm7
pshufd $177, %xmm6, %xmm0
movdqa %xmm0, %xmm1
pcmpgtd %xmm6, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm6, %xmm3
pand %xmm1, %xmm6
por %xmm2, %xmm6
pand %xmm1, %xmm0
pshufd $136, %xmm6, %xmm6
por %xmm3, %xmm0
movdqa %xmm6, %xmm10
movdqa -304(%rbp), %xmm6
pshufd $221, %xmm0, %xmm0
punpckldq %xmm0, %xmm10
pshufd $177, %xmm6, %xmm0
movdqa %xmm0, %xmm1
pcmpgtd %xmm6, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm6, %xmm3
pand %xmm1, %xmm0
pand %xmm6, %xmm1
por %xmm3, %xmm0
movdqa -320(%rbp), %xmm6
por %xmm2, %xmm1
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm1, %xmm1
punpckldq %xmm0, %xmm1
movdqa %xmm1, %xmm5
pshufd $177, %xmm6, %xmm1
movdqa %xmm1, %xmm0
pcmpgtd %xmm6, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm1, %xmm2
pandn %xmm6, %xmm3
pand %xmm0, %xmm1
pand %xmm6, %xmm0
por %xmm3, %xmm1
movdqa -336(%rbp), %xmm6
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm13, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm13, %xmm2
movdqa %xmm2, %xmm3
movdqa %xmm2, %xmm4
pandn %xmm1, %xmm3
pandn %xmm13, %xmm4
pand %xmm2, %xmm1
pand %xmm2, %xmm13
por %xmm4, %xmm1
pshufd $177, %xmm6, %xmm2
por %xmm3, %xmm13
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm13, %xmm13
punpckldq %xmm1, %xmm13
movdqa %xmm2, %xmm1
pcmpgtd %xmm6, %xmm1
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm4
pandn %xmm2, %xmm3
pandn %xmm6, %xmm4
pand %xmm1, %xmm2
pand %xmm6, %xmm1
por %xmm4, %xmm2
por %xmm3, %xmm1
pshufd $221, %xmm2, %xmm2
pshufd $177, %xmm15, %xmm3
pshufd $136, %xmm1, %xmm1
punpckldq %xmm2, %xmm1
movdqa %xmm3, %xmm2
pcmpgtd %xmm15, %xmm2
movdqa %xmm2, %xmm4
movdqa %xmm2, %xmm6
pandn %xmm3, %xmm4
pandn %xmm15, %xmm6
pand %xmm2, %xmm3
pand %xmm2, %xmm15
por %xmm6, %xmm3
por %xmm4, %xmm15
pshufd $221, %xmm3, %xmm3
pshufd $136, %xmm15, %xmm2
punpckldq %xmm3, %xmm2
jbe .L113
pshufd $27, %xmm2, %xmm2
pshufd $27, %xmm13, %xmm3
pshufd $27, %xmm1, %xmm4
movdqa -352(%rbp), %xmm15
movdqa %xmm2, %xmm9
pshufd $27, %xmm10, %xmm6
movdqa %xmm4, %xmm10
movaps %xmm4, -144(%rbp)
pcmpgtd %xmm15, %xmm9
movdqa %xmm15, %xmm13
movdqa %xmm3, %xmm4
movaps %xmm3, -64(%rbp)
pshufd $27, %xmm0, %xmm0
pshufd $27, %xmm5, %xmm5
pshufd $27, %xmm7, %xmm7
pshufd $27, %xmm8, %xmm8
movdqa %xmm9, %xmm1
pand %xmm9, %xmm13
pandn %xmm2, %xmm1
por %xmm1, %xmm13
movdqa %xmm9, %xmm1
pand %xmm2, %xmm9
pandn %xmm15, %xmm1
movdqa -368(%rbp), %xmm15
movaps %xmm1, -240(%rbp)
pcmpgtd %xmm15, %xmm10
movdqa %xmm15, %xmm12
movdqa %xmm10, %xmm11
movdqa %xmm10, %xmm1
pand %xmm10, %xmm12
pandn %xmm15, %xmm11
pandn -144(%rbp), %xmm1
movaps %xmm11, -288(%rbp)
movdqa -384(%rbp), %xmm11
por %xmm1, %xmm12
pcmpgtd %xmm11, %xmm4
movdqa %xmm11, %xmm15
movdqa %xmm4, %xmm1
pandn -64(%rbp), %xmm1
pand %xmm4, %xmm15
por %xmm1, %xmm15
movdqa %xmm4, %xmm1
pandn %xmm11, %xmm1
movaps %xmm15, -80(%rbp)
movaps %xmm1, -304(%rbp)
movdqa %xmm0, %xmm1
pcmpgtd %xmm14, %xmm1
movdqa %xmm1, %xmm15
movdqa %xmm1, %xmm11
pandn %xmm0, %xmm15
pand %xmm14, %xmm11
por %xmm15, %xmm11
movdqa %xmm1, %xmm15
pand %xmm0, %xmm1
pandn %xmm14, %xmm15
movdqa %xmm5, %xmm14
movaps %xmm11, -96(%rbp)
movaps %xmm15, -320(%rbp)
por -320(%rbp), %xmm1
movdqa -176(%rbp), %xmm15
pcmpgtd %xmm15, %xmm14
pshufd $27, %xmm1, %xmm1
movdqa -192(%rbp), %xmm15
movdqa %xmm14, %xmm3
pandn %xmm5, %xmm14
movdqa %xmm3, %xmm11
pand %xmm3, %xmm5
pandn -176(%rbp), %xmm11
movaps %xmm14, -336(%rbp)
pand -176(%rbp), %xmm3
por -336(%rbp), %xmm3
por %xmm11, %xmm5
movaps %xmm5, -112(%rbp)
movdqa %xmm6, %xmm5
pcmpgtd %xmm15, %xmm5
movdqa -224(%rbp), %xmm15
movdqa %xmm5, %xmm11
pandn %xmm6, %xmm11
pand %xmm5, %xmm6
movaps %xmm11, -352(%rbp)
movdqa %xmm5, %xmm11
pandn -192(%rbp), %xmm11
pand -192(%rbp), %xmm5
por -352(%rbp), %xmm5
por %xmm11, %xmm6
movdqa %xmm7, %xmm11
movaps %xmm6, -128(%rbp)
movdqa -208(%rbp), %xmm6
pshufd $27, %xmm5, %xmm5
pcmpgtd %xmm6, %xmm11
movdqa %xmm8, %xmm6
pcmpgtd %xmm15, %xmm6
pshufd $27, %xmm3, %xmm15
movdqa %xmm11, %xmm14
pandn %xmm7, %xmm14
pand %xmm11, %xmm7
movaps %xmm14, -368(%rbp)
movdqa %xmm11, %xmm14
pandn -208(%rbp), %xmm14
por %xmm14, %xmm7
movdqa %xmm6, %xmm14
pandn %xmm8, %xmm14
movaps %xmm7, -160(%rbp)
pand %xmm6, %xmm8
movdqa %xmm6, %xmm7
pandn -224(%rbp), %xmm7
pand -64(%rbp), %xmm4
pand -224(%rbp), %xmm6
pand -144(%rbp), %xmm10
por -288(%rbp), %xmm10
por %xmm7, %xmm8
por -240(%rbp), %xmm9
por %xmm14, %xmm6
por -304(%rbp), %xmm4
pand -208(%rbp), %xmm11
pshufd $27, %xmm6, %xmm6
pshufd $27, %xmm10, %xmm3
pshufd $27, %xmm9, %xmm2
movdqa -160(%rbp), %xmm14
movdqa %xmm6, %xmm10
movdqa %xmm13, %xmm9
movaps %xmm2, -208(%rbp)
por -368(%rbp), %xmm11
pcmpgtd %xmm13, %xmm10
movaps %xmm3, -64(%rbp)
pshufd $27, %xmm4, %xmm4
pshufd $27, %xmm11, %xmm11
movdqa %xmm10, %xmm7
movdqa %xmm10, %xmm0
pand %xmm10, %xmm9
pandn %xmm13, %xmm7
movdqa %xmm2, %xmm13
pandn %xmm6, %xmm0
pcmpgtd %xmm8, %xmm13
por %xmm0, %xmm9
movdqa %xmm8, %xmm2
movaps %xmm7, -288(%rbp)
movdqa %xmm14, %xmm7
movaps %xmm9, -224(%rbp)
pand %xmm6, %xmm10
movdqa %xmm13, %xmm0
pandn -208(%rbp), %xmm0
pand %xmm13, %xmm2
por %xmm0, %xmm2
movdqa %xmm13, %xmm0
pandn %xmm8, %xmm0
movaps %xmm2, -240(%rbp)
movaps %xmm0, -304(%rbp)
movdqa %xmm11, %xmm0
pcmpgtd %xmm12, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm8
pandn %xmm11, %xmm3
pandn %xmm12, %xmm8
movdqa %xmm3, %xmm2
movdqa %xmm12, %xmm3
movdqa -64(%rbp), %xmm12
movaps %xmm8, -320(%rbp)
pand %xmm0, %xmm3
movdqa -128(%rbp), %xmm8
pand %xmm11, %xmm0
por %xmm2, %xmm3
movaps %xmm3, -144(%rbp)
movdqa %xmm12, %xmm3
pcmpgtd %xmm14, %xmm3
pand %xmm3, %xmm7
movdqa %xmm3, %xmm2
pandn -64(%rbp), %xmm2
movdqa %xmm7, %xmm12
movdqa %xmm3, %xmm7
pandn %xmm14, %xmm7
movdqa -80(%rbp), %xmm14
por %xmm2, %xmm12
movdqa %xmm5, %xmm2
movaps %xmm12, -160(%rbp)
pcmpgtd %xmm14, %xmm2
movaps %xmm7, -336(%rbp)
movdqa %xmm2, %xmm12
movdqa %xmm2, %xmm7
pandn %xmm5, %xmm12
pandn %xmm14, %xmm7
pand %xmm2, %xmm5
por %xmm7, %xmm5
movdqa %xmm4, %xmm7
pand -80(%rbp), %xmm2
pcmpgtd %xmm8, %xmm7
movaps %xmm5, -176(%rbp)
por %xmm12, %xmm2
pshufd $27, %xmm2, %xmm2
movdqa %xmm7, %xmm5
pandn %xmm4, %xmm5
pand %xmm7, %xmm4
movaps %xmm5, -352(%rbp)
movdqa %xmm7, %xmm5
movdqa %xmm4, %xmm14
movdqa %xmm15, %xmm4
pandn %xmm8, %xmm5
por %xmm5, %xmm14
movdqa -96(%rbp), %xmm5
movaps %xmm14, -192(%rbp)
pcmpgtd %xmm5, %xmm4
movdqa %xmm4, %xmm8
pandn %xmm15, %xmm4
movdqa %xmm8, %xmm14
pand %xmm8, %xmm15
pand -96(%rbp), %xmm8
pandn %xmm5, %xmm14
movdqa %xmm1, %xmm5
por %xmm14, %xmm15
movdqa -112(%rbp), %xmm14
por %xmm4, %xmm8
pshufd $27, %xmm8, %xmm8
pcmpgtd %xmm14, %xmm5
movdqa %xmm5, %xmm9
pandn %xmm1, %xmm9
pand %xmm5, %xmm1
movaps %xmm9, -368(%rbp)
por -320(%rbp), %xmm0
movdqa %xmm5, %xmm9
movdqa -128(%rbp), %xmm4
pand -112(%rbp), %xmm5
pandn %xmm14, %xmm9
pand -64(%rbp), %xmm3
pand %xmm7, %xmm4
por -368(%rbp), %xmm5
pand -208(%rbp), %xmm13
por -304(%rbp), %xmm13
por %xmm9, %xmm1
movdqa -224(%rbp), %xmm6
pshufd $27, %xmm0, %xmm0
pshufd $27, %xmm5, %xmm7
por -336(%rbp), %xmm3
por -288(%rbp), %xmm10
movdqa %xmm7, %xmm14
pshufd $27, %xmm13, %xmm7
movdqa %xmm2, %xmm13
movaps %xmm7, -64(%rbp)
movdqa %xmm8, %xmm7
pshufd $27, %xmm10, %xmm10
por -352(%rbp), %xmm4
pcmpgtd %xmm6, %xmm7
movdqa %xmm10, %xmm11
movdqa %xmm6, %xmm10
movaps %xmm14, -224(%rbp)
movaps %xmm11, -208(%rbp)
pshufd $27, %xmm4, %xmm4
pshufd $27, %xmm3, %xmm3
movdqa %xmm7, %xmm9
movdqa %xmm7, %xmm5
pand %xmm7, %xmm10
pandn %xmm6, %xmm9
pandn %xmm8, %xmm5
pand %xmm8, %xmm7
movdqa -144(%rbp), %xmm6
por %xmm5, %xmm10
movaps %xmm9, -288(%rbp)
movdqa %xmm15, %xmm9
pcmpgtd %xmm6, %xmm13
movdqa %xmm13, %xmm5
pandn %xmm2, %xmm5
pand %xmm13, %xmm2
movaps %xmm5, -304(%rbp)
movdqa %xmm13, %xmm5
pandn %xmm6, %xmm5
por %xmm5, %xmm2
movdqa %xmm11, %xmm5
movdqa -176(%rbp), %xmm11
pcmpgtd %xmm15, %xmm5
movdqa %xmm5, %xmm6
pandn -208(%rbp), %xmm5
movdqa %xmm6, %xmm12
pand %xmm6, %xmm9
pandn %xmm15, %xmm12
por %xmm5, %xmm9
movdqa -240(%rbp), %xmm15
movaps %xmm12, -320(%rbp)
movdqa %xmm0, %xmm12
pcmpgtd %xmm11, %xmm12
movdqa %xmm12, %xmm5
pandn %xmm0, %xmm5
pand %xmm12, %xmm0
movaps %xmm5, -336(%rbp)
movdqa %xmm12, %xmm5
pandn %xmm11, %xmm5
por %xmm5, %xmm0
movdqa %xmm14, %xmm5
movdqa %xmm15, %xmm14
pcmpgtd %xmm15, %xmm5
movaps %xmm0, -80(%rbp)
movdqa %xmm5, %xmm11
pand %xmm5, %xmm14
pandn -224(%rbp), %xmm11
por %xmm11, %xmm14
movdqa %xmm5, %xmm11
pandn %xmm15, %xmm11
movaps %xmm14, -96(%rbp)
movdqa -160(%rbp), %xmm15
movaps %xmm11, -240(%rbp)
movdqa %xmm4, %xmm11
pcmpgtd %xmm15, %xmm11
movdqa %xmm11, %xmm14
pandn %xmm4, %xmm14
pand %xmm11, %xmm4
movaps %xmm14, -352(%rbp)
movdqa %xmm11, %xmm14
pandn %xmm15, %xmm14
movdqa -64(%rbp), %xmm15
por %xmm14, %xmm4
movaps %xmm4, -112(%rbp)
movdqa %xmm15, %xmm4
movdqa %xmm1, %xmm15
pcmpgtd %xmm1, %xmm4
movdqa %xmm4, %xmm14
pandn -64(%rbp), %xmm14
pand %xmm4, %xmm15
por %xmm14, %xmm15
movdqa %xmm4, %xmm14
pandn %xmm1, %xmm14
movdqa %xmm3, %xmm1
movaps %xmm14, -368(%rbp)
movdqa -192(%rbp), %xmm14
por -288(%rbp), %xmm7
movdqa -160(%rbp), %xmm8
pand -208(%rbp), %xmm6
pcmpgtd %xmm14, %xmm1
pshufd $27, %xmm7, %xmm7
pand -176(%rbp), %xmm12
pand %xmm11, %xmm8
por -320(%rbp), %xmm6
movdqa -192(%rbp), %xmm11
por -336(%rbp), %xmm12
pand -224(%rbp), %xmm5
movdqa %xmm1, %xmm0
pand %xmm1, %xmm11
pshufd $27, %xmm6, %xmm6
pandn %xmm3, %xmm0
pand %xmm1, %xmm3
pshufd $27, %xmm12, %xmm12
movaps %xmm0, -384(%rbp)
movdqa %xmm1, %xmm0
pand -64(%rbp), %xmm4
por -352(%rbp), %xmm8
pandn %xmm14, %xmm0
por -240(%rbp), %xmm5
por -384(%rbp), %xmm11
por %xmm0, %xmm3
pshufd $27, %xmm8, %xmm8
por -368(%rbp), %xmm4
movaps %xmm3, -128(%rbp)
pshufd $27, %xmm5, %xmm5
pshufd $27, %xmm11, %xmm11
movdqa -144(%rbp), %xmm3
pshufd $27, %xmm4, %xmm4
pand %xmm13, %xmm3
por -304(%rbp), %xmm3
movdqa %xmm10, %xmm13
pshufd $27, %xmm3, %xmm3
movdqa %xmm3, %xmm1
pcmpgtd %xmm10, %xmm1
movdqa %xmm1, %xmm0
pand %xmm1, %xmm13
pandn %xmm3, %xmm0
pand %xmm1, %xmm3
por %xmm0, %xmm13
movdqa %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm2, %xmm1
pandn %xmm10, %xmm0
movdqa %xmm2, %xmm10
por %xmm0, %xmm3
movdqa %xmm1, %xmm0
pand %xmm1, %xmm10
pandn %xmm7, %xmm0
por %xmm0, %xmm10
movdqa %xmm1, %xmm0
pandn %xmm2, %xmm0
movdqa %xmm1, %xmm2
movdqa %xmm12, %xmm1
pcmpgtd %xmm9, %xmm1
pand %xmm7, %xmm2
por %xmm0, %xmm2
movdqa %xmm1, %xmm7
movdqa %xmm1, %xmm0
pandn %xmm12, %xmm7
pandn %xmm9, %xmm0
movdqa %xmm7, %xmm14
movdqa %xmm9, %xmm7
movdqa %xmm1, %xmm9
pand %xmm12, %xmm9
movdqa -80(%rbp), %xmm12
pand %xmm1, %xmm7
movdqa %xmm6, %xmm1
por %xmm0, %xmm9
por %xmm14, %xmm7
pcmpgtd %xmm12, %xmm1
movdqa %xmm1, %xmm0
pandn %xmm6, %xmm0
movdqa %xmm0, %xmm14
movdqa %xmm12, %xmm0
pand %xmm1, %xmm0
movdqa %xmm0, %xmm12
movdqa %xmm1, %xmm0
pandn -80(%rbp), %xmm0
por %xmm14, %xmm12
movdqa %xmm0, %xmm14
movdqa %xmm1, %xmm0
movdqa %xmm8, %xmm1
pand %xmm6, %xmm0
por %xmm14, %xmm0
movdqa -96(%rbp), %xmm14
movaps %xmm0, -64(%rbp)
pcmpgtd %xmm14, %xmm1
movdqa %xmm1, %xmm6
pand %xmm1, %xmm14
movdqa %xmm1, %xmm0
pandn %xmm8, %xmm6
pand %xmm8, %xmm1
movdqa -112(%rbp), %xmm8
pandn -96(%rbp), %xmm0
por %xmm6, %xmm14
movdqa %xmm5, %xmm6
pcmpgtd %xmm8, %xmm6
por %xmm0, %xmm1
movaps %xmm1, -80(%rbp)
movdqa %xmm6, %xmm1
pandn %xmm5, %xmm6
pand %xmm1, %xmm8
movdqa %xmm1, %xmm0
pand %xmm5, %xmm1
por %xmm6, %xmm8
movdqa %xmm11, %xmm6
pandn -112(%rbp), %xmm0
pcmpgtd %xmm15, %xmm6
movdqa %xmm1, %xmm5
por %xmm0, %xmm5
movaps %xmm5, -96(%rbp)
movdqa %xmm6, %xmm1
movdqa %xmm6, %xmm5
movdqa %xmm15, %xmm6
pandn %xmm11, %xmm5
pand %xmm1, %xmm6
por %xmm5, %xmm6
movdqa %xmm1, %xmm5
pand %xmm11, %xmm1
pandn %xmm15, %xmm5
movdqa -128(%rbp), %xmm15
movdqa %xmm1, %xmm11
movdqa %xmm4, %xmm1
movaps %xmm6, -112(%rbp)
por %xmm5, %xmm11
pcmpgtd %xmm15, %xmm1
movdqa %xmm15, %xmm6
pand %xmm1, %xmm6
movdqa %xmm1, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm6, %xmm0
por %xmm5, %xmm0
movdqa %xmm1, %xmm5
pand %xmm4, %xmm1
pshufd $27, %xmm13, %xmm4
movdqa %xmm0, %xmm15
pandn -128(%rbp), %xmm5
movdqa %xmm4, %xmm0
pcmpgtd %xmm13, %xmm0
por %xmm5, %xmm1
movaps %xmm1, -128(%rbp)
movdqa %xmm0, %xmm6
movdqa %xmm0, %xmm1
movdqa %xmm0, %xmm5
pandn %xmm4, %xmm6
pand %xmm4, %xmm1
pshufd $27, %xmm3, %xmm4
pandn %xmm13, %xmm5
pand %xmm0, %xmm13
movdqa %xmm4, %xmm0
pcmpgtd %xmm3, %xmm0
por %xmm5, %xmm1
por %xmm6, %xmm13
shufpd $2, %xmm1, %xmm13
movdqa %xmm0, %xmm5
movdqa %xmm0, %xmm1
movdqa %xmm0, %xmm6
pandn %xmm3, %xmm5
pand %xmm4, %xmm1
pandn %xmm4, %xmm6
por %xmm5, %xmm1
pand %xmm0, %xmm3
por %xmm6, %xmm3
movapd %xmm1, %xmm6
movsd %xmm3, %xmm6
pshufd $27, %xmm10, %xmm3
movdqa %xmm3, %xmm0
pcmpgtd %xmm10, %xmm0
movdqa %xmm0, %xmm1
movdqa %xmm0, %xmm5
pandn %xmm10, %xmm0
pandn %xmm3, %xmm5
pand %xmm1, %xmm10
pand %xmm3, %xmm1
pshufd $27, %xmm2, %xmm3
por %xmm0, %xmm1
por %xmm5, %xmm10
movdqa %xmm3, %xmm0
shufpd $2, %xmm1, %xmm10
pcmpgtd %xmm2, %xmm0
movdqa %xmm0, %xmm1
movdqa %xmm0, %xmm5
pandn %xmm2, %xmm0
pand %xmm1, %xmm2
pand %xmm3, %xmm1
pandn %xmm3, %xmm5
por %xmm0, %xmm1
por %xmm5, %xmm2
movdqa -64(%rbp), %xmm0
movapd %xmm1, %xmm3
movsd %xmm2, %xmm3
pshufd $27, %xmm7, %xmm2
movapd %xmm3, %xmm5
movdqa %xmm2, %xmm3
pcmpgtd %xmm7, %xmm3
movdqa %xmm3, %xmm1
pandn %xmm2, %xmm3
movdqa %xmm3, %xmm4
movdqa %xmm1, %xmm3
pandn %xmm7, %xmm3
pand %xmm1, %xmm7
pand %xmm2, %xmm1
pshufd $27, %xmm9, %xmm2
por %xmm3, %xmm1
por %xmm4, %xmm7
movdqa %xmm2, %xmm3
shufpd $2, %xmm1, %xmm7
pcmpgtd %xmm9, %xmm3
movdqa %xmm3, %xmm1
pandn %xmm2, %xmm3
movdqa %xmm3, %xmm4
movdqa %xmm1, %xmm3
pandn %xmm9, %xmm3
pand %xmm1, %xmm9
pand %xmm2, %xmm1
pshufd $27, %xmm12, %xmm2
por %xmm3, %xmm1
por %xmm4, %xmm9
movdqa %xmm2, %xmm3
shufpd $2, %xmm1, %xmm9
pcmpgtd %xmm12, %xmm3
movdqa %xmm3, %xmm1
pandn %xmm2, %xmm3
movdqa %xmm3, %xmm4
movdqa %xmm1, %xmm3
pandn %xmm12, %xmm3
pand %xmm1, %xmm12
pand %xmm2, %xmm1
pshufd $27, %xmm0, %xmm2
por %xmm3, %xmm1
por %xmm4, %xmm12
movdqa %xmm2, %xmm3
shufpd $2, %xmm1, %xmm12
pcmpgtd %xmm0, %xmm3
movdqa %xmm3, %xmm1
pandn %xmm2, %xmm3
movdqa %xmm3, %xmm4
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm3
pand %xmm1, %xmm0
pand %xmm2, %xmm1
por %xmm3, %xmm1
por %xmm4, %xmm0
movapd %xmm1, %xmm3
pshufd $27, %xmm14, %xmm1
movsd %xmm0, %xmm3
movdqa %xmm1, %xmm0
pcmpgtd %xmm14, %xmm0
movaps %xmm3, -176(%rbp)
movdqa -80(%rbp), %xmm4
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm14, %xmm2
pand %xmm0, %xmm14
pand %xmm1, %xmm0
por %xmm3, %xmm14
pshufd $27, %xmm4, %xmm1
por %xmm2, %xmm0
shufpd $2, %xmm0, %xmm14
movdqa %xmm1, %xmm0
pcmpgtd %xmm4, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm4, %xmm2
pand %xmm0, %xmm4
pand %xmm1, %xmm0
pandn %xmm1, %xmm3
por %xmm2, %xmm0
pshufd $27, %xmm8, %xmm1
movapd %xmm0, %xmm2
movdqa %xmm1, %xmm0
por %xmm3, %xmm4
pcmpgtd %xmm8, %xmm0
movsd %xmm4, %xmm2
movdqa -96(%rbp), %xmm4
movaps %xmm2, -192(%rbp)
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm8, %xmm2
pand %xmm0, %xmm8
pand %xmm1, %xmm0
por %xmm3, %xmm8
pshufd $27, %xmm4, %xmm1
por %xmm2, %xmm0
shufpd $2, %xmm0, %xmm8
movdqa %xmm1, %xmm0
pcmpgtd %xmm4, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm4, %xmm2
pand %xmm0, %xmm4
pand %xmm1, %xmm0
por %xmm3, %xmm4
por %xmm2, %xmm0
movsd %xmm4, %xmm0
movdqa -112(%rbp), %xmm4
movaps %xmm0, -208(%rbp)
pshufd $27, %xmm4, %xmm1
movdqa %xmm1, %xmm0
pcmpgtd %xmm4, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm4, %xmm2
pand %xmm0, %xmm4
pand %xmm1, %xmm0
pandn %xmm1, %xmm3
por %xmm2, %xmm0
pshufd $27, %xmm11, %xmm1
por %xmm3, %xmm4
movapd %xmm0, %xmm3
movdqa %xmm1, %xmm0
pcmpgtd %xmm11, %xmm0
movsd %xmm4, %xmm3
movdqa -128(%rbp), %xmm4
movaps %xmm3, -224(%rbp)
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm1, %xmm3
pandn %xmm11, %xmm2
pand %xmm0, %xmm11
pand %xmm1, %xmm0
por %xmm3, %xmm11
pshufd $27, %xmm15, %xmm1
por %xmm2, %xmm0
shufpd $2, %xmm0, %xmm11
movdqa %xmm1, %xmm0
pcmpgtd %xmm15, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm15, %xmm2
pand %xmm0, %xmm15
pand %xmm1, %xmm0
por %xmm3, %xmm15
pshufd $27, %xmm4, %xmm1
por %xmm2, %xmm0
shufpd $2, %xmm0, %xmm15
movdqa %xmm1, %xmm0
pcmpgtd %xmm4, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm4, %xmm2
pand %xmm0, %xmm4
pand %xmm1, %xmm0
por %xmm3, %xmm4
pshufd $177, %xmm13, %xmm1
por %xmm2, %xmm0
shufpd $2, %xmm0, %xmm4
movdqa %xmm1, %xmm0
pcmpgtd %xmm13, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm1, %xmm2
pandn %xmm13, %xmm3
pand %xmm0, %xmm1
pand %xmm13, %xmm0
por %xmm3, %xmm1
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm6, %xmm1
movaps %xmm0, -112(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm6, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm13
pandn %xmm1, %xmm2
pandn %xmm6, %xmm13
pand %xmm0, %xmm1
pand %xmm6, %xmm0
por %xmm13, %xmm1
movapd -224(%rbp), %xmm6
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm10, %xmm1
movaps %xmm0, -128(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm10, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm13
pandn %xmm1, %xmm2
pandn %xmm10, %xmm13
pand %xmm0, %xmm1
pand %xmm10, %xmm0
por %xmm13, %xmm1
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm5, %xmm1
movaps %xmm0, -144(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm5, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm10
pandn %xmm1, %xmm2
pandn %xmm5, %xmm10
pand %xmm0, %xmm1
pand %xmm5, %xmm0
por %xmm10, %xmm1
movapd -208(%rbp), %xmm5
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm7, %xmm1
movaps %xmm0, -160(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm7, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm10
pandn %xmm1, %xmm2
pandn %xmm7, %xmm10
pand %xmm0, %xmm1
pand %xmm7, %xmm0
por %xmm10, %xmm1
movapd -176(%rbp), %xmm7
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm9, %xmm1
movaps %xmm0, -64(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm9, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm10
pandn %xmm1, %xmm2
pandn %xmm9, %xmm10
pand %xmm0, %xmm1
pand %xmm9, %xmm0
por %xmm10, %xmm1
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm12, %xmm1
movaps %xmm0, -80(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm12, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm10
pandn %xmm1, %xmm2
pandn %xmm12, %xmm10
pand %xmm0, %xmm1
pand %xmm12, %xmm0
por %xmm10, %xmm1
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm7, %xmm1
movaps %xmm0, -96(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm7, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm1, %xmm2
pandn %xmm7, %xmm3
pand %xmm0, %xmm1
pand %xmm7, %xmm0
por %xmm3, %xmm1
movapd -192(%rbp), %xmm7
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
movdqa %xmm0, %xmm12
pshufd $177, %xmm14, %xmm0
movdqa %xmm0, %xmm3
pcmpgtd %xmm14, %xmm3
movdqa %xmm3, %xmm1
movdqa %xmm3, %xmm2
pandn %xmm0, %xmm1
pandn %xmm14, %xmm2
pand %xmm3, %xmm0
pand %xmm14, %xmm3
por %xmm2, %xmm0
por %xmm1, %xmm3
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm3, %xmm3
punpckldq %xmm0, %xmm3
pshufd $177, %xmm7, %xmm0
movdqa %xmm0, %xmm9
pcmpgtd %xmm7, %xmm9
movdqa %xmm9, %xmm1
movdqa %xmm9, %xmm2
pandn %xmm0, %xmm1
pandn %xmm7, %xmm2
pand %xmm9, %xmm0
pand %xmm7, %xmm9
por %xmm2, %xmm0
por %xmm1, %xmm9
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm9, %xmm9
punpckldq %xmm0, %xmm9
pshufd $177, %xmm8, %xmm0
movdqa %xmm0, %xmm7
pcmpgtd %xmm8, %xmm7
movdqa %xmm7, %xmm1
movdqa %xmm7, %xmm2
pandn %xmm0, %xmm1
pandn %xmm8, %xmm2
pand %xmm7, %xmm0
pand %xmm8, %xmm7
por %xmm2, %xmm0
por %xmm1, %xmm7
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm7, %xmm7
punpckldq %xmm0, %xmm7
pshufd $177, %xmm5, %xmm0
movdqa %xmm0, %xmm10
pcmpgtd %xmm5, %xmm10
movdqa %xmm10, %xmm1
movdqa %xmm10, %xmm2
pandn %xmm0, %xmm1
pandn %xmm5, %xmm2
pand %xmm10, %xmm0
pand %xmm5, %xmm10
por %xmm2, %xmm0
por %xmm1, %xmm10
pshufd $221, %xmm0, %xmm0
pshufd $177, %xmm6, %xmm1
pshufd $136, %xmm10, %xmm10
punpckldq %xmm0, %xmm10
movdqa %xmm1, %xmm0
pcmpgtd %xmm6, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm5
pandn %xmm1, %xmm2
pandn %xmm6, %xmm5
pand %xmm0, %xmm1
pand %xmm6, %xmm0
por %xmm5, %xmm1
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm11, %xmm1
movdqa %xmm1, %xmm13
pcmpgtd %xmm11, %xmm13
movdqa %xmm13, %xmm2
movdqa %xmm13, %xmm5
pandn %xmm1, %xmm2
pandn %xmm11, %xmm5
pand %xmm13, %xmm1
pand %xmm11, %xmm13
por %xmm5, %xmm1
por %xmm2, %xmm13
pshufd $221, %xmm1, %xmm1
pshufd $177, %xmm15, %xmm2
pshufd $136, %xmm13, %xmm13
punpckldq %xmm1, %xmm13
movdqa %xmm2, %xmm1
pcmpgtd %xmm15, %xmm1
movdqa %xmm1, %xmm5
movdqa %xmm1, %xmm6
pandn %xmm2, %xmm5
pandn %xmm15, %xmm6
pand %xmm1, %xmm2
pand %xmm15, %xmm1
por %xmm6, %xmm2
por %xmm5, %xmm1
pshufd $221, %xmm2, %xmm2
pshufd $177, %xmm4, %xmm5
pshufd $136, %xmm1, %xmm1
punpckldq %xmm2, %xmm1
movdqa %xmm5, %xmm2
pcmpgtd %xmm4, %xmm2
movdqa %xmm2, %xmm6
movdqa %xmm2, %xmm8
pandn %xmm5, %xmm6
pandn %xmm4, %xmm8
pand %xmm2, %xmm5
pand %xmm4, %xmm2
por %xmm8, %xmm5
por %xmm6, %xmm2
pshufd $221, %xmm5, %xmm5
pshufd $136, %xmm2, %xmm2
punpckldq %xmm5, %xmm2
movdqa %xmm2, %xmm15
.L109:
movdqa -112(%rbp), %xmm4
movq -264(%rbp), %rdx
movups %xmm4, (%rdx)
movdqa -128(%rbp), %xmm4
movups %xmm4, (%r15)
movdqa -144(%rbp), %xmm4
movups %xmm4, (%r14)
movdqa -160(%rbp), %xmm4
movups %xmm4, 0(%r13)
movdqa -64(%rbp), %xmm4
movups %xmm4, (%r12)
movdqa -80(%rbp), %xmm4
movups %xmm4, (%rbx)
movdqa -96(%rbp), %xmm4
movq -248(%rbp), %rbx
movups %xmm4, (%r11)
movups %xmm12, (%r10)
movups %xmm3, (%r9)
movups %xmm9, (%r8)
movups %xmm7, (%rdi)
movups %xmm10, (%rsi)
movups %xmm0, (%rcx)
movq -256(%rbp), %rcx
movups %xmm13, (%rbx)
movups %xmm1, (%rcx)
movups %xmm15, (%rax)
addq $240, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L112:
.cfi_restore_state
movdqa -192(%rbp), %xmm15
movdqa -208(%rbp), %xmm1
movdqa %xmm2, %xmm9
jmp .L109
.p2align 4,,10
.p2align 3
.L113:
movdqa %xmm7, %xmm9
movdqa %xmm8, %xmm3
movdqa %xmm10, %xmm7
movdqa %xmm2, %xmm15
movdqa %xmm5, %xmm10
jmp .L109
.cfi_endproc
.LFE18783:
.size _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, .-_ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
.section .text._ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18784:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %r10
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %rbx
.cfi_offset 3, -24
cmpq $15, %rsi
jbe .L130
vmovdqa32 %zmm0, %zmm2
vmovdqa32 %zmm1, %zmm3
movl $16, %r8d
xorl %esi, %esi
jmp .L121
.p2align 4,,10
.p2align 3
.L116:
vmovdqu64 %zmm0, (%rax)
kmovw %k0, %eax
popcntq %rax, %rax
addq %rax, %rsi
leaq 16(%r8), %rax
cmpq %r10, %rax
ja .L141
movq %rax, %r8
.L121:
vmovdqu32 -64(%rdi,%r8,4), %zmm4
leaq -16(%r8), %r9
leaq (%rdi,%rsi,4), %rax
vpcmpd $0, %zmm2, %zmm4, %k0
vpcmpd $0, %zmm3, %zmm4, %k1
kmovw %k0, %r11d
kmovw %k1, %ebx
korw %k1, %k0, %k1
kortestw %k1, %k1
jc .L116
kmovw %r11d, %k6
kmovw %ebx, %k5
kxnorw %k5, %k6, %k7
kmovw %k7, %eax
tzcntl %eax, %eax
addq %r9, %rax
vpbroadcastd (%rdi,%rax,4), %zmm0
leaq 16(%rsi), %rax
vmovdqa32 %zmm0, (%rdx)
cmpq %r9, %rax
ja .L117
.p2align 4,,10
.p2align 3
.L118:
vmovdqu64 %zmm1, -64(%rdi,%rax,4)
movq %rax, %rsi
addq $16, %rax
cmpq %rax, %r9
jnb .L118
.L117:
subq %rsi, %r9
leaq (%rdi,%rsi,4), %rdx
movl $65535, %eax
cmpq $255, %r9
jbe .L142
.L119:
kmovw %eax, %k4
xorl %eax, %eax
vmovdqu32 %zmm1, (%rdx){%k4}
.L114:
movq -8(%rbp), %rbx
leave
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L142:
.cfi_restore_state
movq $-1, %rax
bzhi %r9, %rax, %rax
movzwl %ax, %eax
jmp .L119
.p2align 4,,10
.p2align 3
.L141:
movq %r10, %r11
leaq (%rdi,%r8,4), %rbx
leaq (%rdi,%rsi,4), %r9
movl $65535, %eax
subq %r8, %r11
kmovd %eax, %k1
cmpq $255, %r11
jbe .L115
.L122:
vmovdqu32 (%rbx), %zmm2{%k1}{z}
knotw %k1, %k3
vmovdqu32 %zmm2, (%rcx){%k1}
vmovdqa32 (%rcx), %zmm2
vpcmpd $0, %zmm0, %zmm2, %k0
vpcmpd $0, %zmm1, %zmm2, %k2
kandw %k1, %k0, %k0
korw %k2, %k0, %k2
korw %k3, %k2, %k2
kortestw %k2, %k2
jnc .L143
kmovw %k0, %edx
popcntq %rdx, %rdx
addq %rsi, %rdx
vmovdqu32 %zmm0, (%r9){%k1}
leaq 16(%rdx), %rax
cmpq %r10, %rax
ja .L127
.p2align 4,,10
.p2align 3
.L128:
vmovdqu64 %zmm1, -64(%rdi,%rax,4)
movq %rax, %rdx
addq $16, %rax
cmpq %rax, %r10
jnb .L128
.L127:
subq %rdx, %r10
leaq (%rdi,%rdx,4), %rcx
movl $65535, %eax
cmpq $255, %r10
ja .L129
movq $-1, %rax
bzhi %r10, %rax, %rax
movzwl %ax, %eax
.L129:
kmovw %eax, %k5
movl $1, %eax
vmovdqu32 %zmm1, (%rcx){%k5}
movq -8(%rbp), %rbx
leave
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.L130:
.cfi_restore_state
movq %rsi, %r11
movq %rdi, %r9
movq %rdi, %rbx
xorl %esi, %esi
xorl %r8d, %r8d
.L115:
movq $-1, %rax
bzhi %r11, %rax, %rax
movzwl %ax, %eax
kmovd %eax, %k1
jmp .L122
.L143:
knotw %k2, %k3
kmovw %k3, %eax
tzcntl %eax, %eax
addq %r8, %rax
vpbroadcastd (%rdi,%rax,4), %zmm0
leaq 16(%rsi), %rax
vmovdqa32 %zmm0, (%rdx)
cmpq %r8, %rax
ja .L124
.p2align 4,,10
.p2align 3
.L125:
vmovdqu64 %zmm1, -64(%rdi,%rax,4)
movq %rax, %rsi
leaq 16(%rax), %rax
cmpq %rax, %r8
jnb .L125
leaq (%rdi,%rsi,4), %r9
.L124:
subq %rsi, %r8
movl $65535, %eax
cmpq $255, %r8
ja .L126
movq $-1, %rax
bzhi %r8, %rax, %rax
movzwl %ax, %eax
.L126:
kmovw %eax, %k6
xorl %eax, %eax
vmovdqu32 %zmm1, (%r9){%k6}
jmp .L114
.cfi_endproc
.LFE18784:
.size _ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, @function
_ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0:
.LFB18785:
.cfi_startproc
movq %rsi, %r8
movq %rdx, %rcx
cmpq %rdx, %rsi
jbe .L154
leaq (%rdx,%rdx), %rdx
leaq 1(%rcx), %r10
leaq 1(%rdx), %rsi
addq $2, %rdx
cmpq %rsi, %r8
jbe .L154
movl (%rdi,%rcx,4), %r11d
vpbroadcastd %r11d, %xmm1
jmp .L147
.p2align 4,,10
.p2align 3
.L157:
movq %rsi, %rax
cmpq %rdx, %r8
ja .L155
.L149:
cmpq %rcx, %rax
je .L154
leaq (%rdi,%rax,4), %rdx
movl (%rdx), %ecx
movl %ecx, (%r9)
movl %r11d, (%rdx)
cmpq %rax, %r8
jbe .L156
leaq (%rax,%rax), %rdx
leaq 1(%rax), %r10
leaq 1(%rdx), %rsi
addq $2, %rdx
cmpq %r8, %rsi
jnb .L154
movq %rax, %rcx
.L147:
vpbroadcastd (%rdi,%rsi,4), %xmm0
leaq (%rdi,%rcx,4), %r9
vpcmpd $6, %xmm1, %xmm0, %k0
kmovb %k0, %eax
testb $1, %al
jne .L157
cmpq %rdx, %r8
jbe .L154
vpbroadcastd (%rdi,%r10,8), %xmm0
vpcmpd $6, %xmm1, %xmm0, %k1
kmovb %k1, %eax
testb $1, %al
je .L154
movq %rdx, %rax
jmp .L149
.p2align 4,,10
.p2align 3
.L154:
ret
.p2align 4,,10
.p2align 3
.L155:
vpbroadcastd (%rdi,%r10,8), %xmm2
vpcmpd $6, %xmm0, %xmm2, %k2
kmovb %k2, %esi
andl $1, %esi
cmovne %rdx, %rax
jmp .L149
.p2align 4,,10
.p2align 3
.L156:
ret
.cfi_endproc
.LFE18785:
.size _ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, .-_ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
.section .text._ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, @function
_ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0:
.LFB18786:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
leaq 0(,%rsi,4), %rax
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq (%rdi,%rax), %r15
pushq %r14
.cfi_offset 14, -32
leaq (%r15,%rax), %r14
pushq %r13
.cfi_offset 13, -40
leaq (%r14,%rax), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%rax), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%rax), %rbx
leaq (%rbx,%rax), %r11
leaq (%r11,%rax), %r10
leaq (%r10,%rax), %r9
andq $-64, %rsp
leaq (%r9,%rax), %r8
subq $8, %rsp
leaq (%r8,%rax), %rdx
leaq (%rdx,%rax), %rcx
vmovq %rdx, %xmm26
leaq (%rcx,%rax), %rdx
vmovq %rcx, %xmm25
vmovdqu32 (%rdi), %zmm7
vpminsd (%r15), %zmm7, %zmm15
vmovq %rdx, %xmm27
addq %rax, %rdx
vpmaxsd (%r15), %zmm7, %zmm0
vmovdqu32 (%r14), %zmm7
leaq (%rdx,%rax), %rcx
vpminsd 0(%r13), %zmm7, %zmm16
addq %rcx, %rax
vmovq %rcx, %xmm24
vmovq %xmm26, %rcx
movq %rax, (%rsp)
vmovq %xmm25, %rax
vpmaxsd 0(%r13), %zmm7, %zmm10
vpminsd %zmm16, %zmm15, %zmm12
vmovdqu32 (%r12), %zmm7
vpminsd (%rbx), %zmm7, %zmm11
vpmaxsd %zmm16, %zmm15, %zmm15
vpmaxsd (%rbx), %zmm7, %zmm2
vmovdqu32 (%r11), %zmm7
vpminsd %zmm10, %zmm0, %zmm16
vpminsd (%r10), %zmm7, %zmm8
vpmaxsd (%r10), %zmm7, %zmm6
vmovdqu32 (%r9), %zmm7
vpminsd (%r8), %zmm7, %zmm1
vpmaxsd %zmm10, %zmm0, %zmm0
vpmaxsd (%r8), %zmm7, %zmm4
vmovdqu32 (%rcx), %zmm7
vpminsd %zmm8, %zmm11, %zmm10
vpminsd (%rax), %zmm7, %zmm9
vpmaxsd (%rax), %zmm7, %zmm13
vmovq %xmm27, %rax
vmovdqu32 (%rax), %zmm7
movq (%rsp), %rax
vpmaxsd %zmm8, %zmm11, %zmm11
vpminsd %zmm6, %zmm2, %zmm8
vpminsd (%rdx), %zmm7, %zmm3
vpmaxsd (%rdx), %zmm7, %zmm5
vmovdqu64 (%rax), %zmm7
vmovq %xmm24, %rax
vpmaxsd %zmm6, %zmm2, %zmm2
vpminsd %zmm9, %zmm1, %zmm6
vpmaxsd %zmm9, %zmm1, %zmm1
vpminsd %zmm13, %zmm4, %zmm9
vmovdqa64 %zmm7, -120(%rsp)
vmovdqa32 -120(%rsp), %zmm7
vpminsd (%rax), %zmm7, %zmm14
vpmaxsd %zmm13, %zmm4, %zmm4
vpmaxsd (%rax), %zmm7, %zmm7
vpminsd %zmm14, %zmm3, %zmm13
vpmaxsd %zmm14, %zmm3, %zmm3
vpminsd %zmm7, %zmm5, %zmm14
vpmaxsd %zmm7, %zmm5, %zmm5
vpminsd %zmm10, %zmm12, %zmm7
vpmaxsd %zmm10, %zmm12, %zmm12
vpminsd %zmm8, %zmm16, %zmm10
vpmaxsd %zmm8, %zmm16, %zmm16
vpminsd %zmm11, %zmm15, %zmm8
vpmaxsd %zmm11, %zmm15, %zmm15
vpminsd %zmm2, %zmm0, %zmm11
vpmaxsd %zmm2, %zmm0, %zmm0
vpminsd %zmm13, %zmm6, %zmm2
vpmaxsd %zmm13, %zmm6, %zmm6
vpminsd %zmm14, %zmm9, %zmm13
vpmaxsd %zmm14, %zmm9, %zmm9
vpminsd %zmm3, %zmm1, %zmm14
vpmaxsd %zmm3, %zmm1, %zmm1
vpminsd %zmm5, %zmm4, %zmm3
vpmaxsd %zmm5, %zmm4, %zmm4
vpminsd %zmm2, %zmm7, %zmm5
vpmaxsd %zmm2, %zmm7, %zmm7
vpminsd %zmm13, %zmm10, %zmm2
vpmaxsd %zmm13, %zmm10, %zmm10
vpminsd %zmm14, %zmm8, %zmm13
vpmaxsd %zmm14, %zmm8, %zmm8
vpminsd %zmm3, %zmm11, %zmm14
vpmaxsd %zmm3, %zmm11, %zmm11
vpminsd %zmm6, %zmm12, %zmm3
vpmaxsd %zmm6, %zmm12, %zmm12
vpminsd %zmm9, %zmm16, %zmm6
vpmaxsd %zmm9, %zmm16, %zmm16
vpminsd %zmm1, %zmm15, %zmm9
vpmaxsd %zmm1, %zmm15, %zmm15
vpminsd %zmm4, %zmm0, %zmm1
vpmaxsd %zmm4, %zmm0, %zmm0
vpminsd %zmm8, %zmm6, %zmm4
vpmaxsd %zmm8, %zmm6, %zmm6
vpminsd %zmm10, %zmm9, %zmm8
vpmaxsd %zmm10, %zmm9, %zmm9
vpminsd %zmm12, %zmm14, %zmm10
vpmaxsd %zmm12, %zmm14, %zmm14
vpminsd %zmm11, %zmm1, %zmm12
vpmaxsd %zmm11, %zmm1, %zmm1
vpminsd %zmm15, %zmm16, %zmm11
vpmaxsd %zmm15, %zmm16, %zmm16
vpminsd %zmm7, %zmm3, %zmm15
vpmaxsd %zmm7, %zmm3, %zmm3
vpminsd %zmm13, %zmm2, %zmm7
vpmaxsd %zmm13, %zmm2, %zmm2
vpminsd %zmm15, %zmm7, %zmm13
vpmaxsd %zmm15, %zmm7, %zmm7
vpminsd %zmm11, %zmm12, %zmm15
vpmaxsd %zmm11, %zmm12, %zmm12
vpminsd %zmm3, %zmm2, %zmm11
vpmaxsd %zmm3, %zmm2, %zmm2
vpminsd %zmm16, %zmm1, %zmm3
vpminsd %zmm7, %zmm11, %zmm18
vpmaxsd %zmm7, %zmm11, %zmm11
vpminsd %zmm8, %zmm4, %zmm7
vpmaxsd %zmm8, %zmm4, %zmm4
vpminsd %zmm6, %zmm9, %zmm8
vpmaxsd %zmm6, %zmm9, %zmm9
vpminsd %zmm12, %zmm3, %zmm6
vpmaxsd %zmm12, %zmm3, %zmm3
vpminsd %zmm2, %zmm10, %zmm12
vpmaxsd %zmm2, %zmm10, %zmm10
vpminsd %zmm14, %zmm15, %zmm2
vpmaxsd %zmm14, %zmm15, %zmm15
vpminsd %zmm7, %zmm12, %zmm14
vpmaxsd %zmm7, %zmm12, %zmm12
vpminsd %zmm10, %zmm4, %zmm7
vpmaxsd %zmm10, %zmm4, %zmm4
vpminsd %zmm8, %zmm2, %zmm10
vpmaxsd %zmm8, %zmm2, %zmm2
vpminsd %zmm15, %zmm9, %zmm8
vpmaxsd %zmm16, %zmm1, %zmm1
vpmaxsd %zmm15, %zmm9, %zmm9
vpminsd %zmm7, %zmm12, %zmm16
vpmaxsd %zmm7, %zmm12, %zmm12
vpminsd %zmm4, %zmm10, %zmm7
vpmaxsd %zmm4, %zmm10, %zmm10
vpminsd %zmm8, %zmm2, %zmm4
vpminsd %zmm7, %zmm12, %zmm15
vpminsd %zmm11, %zmm14, %zmm17
vpmaxsd %zmm8, %zmm2, %zmm2
vpmaxsd %zmm7, %zmm12, %zmm12
vpminsd %zmm9, %zmm6, %zmm8
vpminsd %zmm4, %zmm10, %zmm7
vpmaxsd %zmm11, %zmm14, %zmm14
vpmaxsd %zmm9, %zmm6, %zmm6
vpmaxsd %zmm4, %zmm10, %zmm10
cmpq $1, %rsi
jbe .L160
vpshufd $177, %zmm2, %zmm2
vpshufd $177, %zmm0, %zmm0
vpshufd $177, %zmm8, %zmm8
movl $21845, %eax
vpminsd %zmm0, %zmm5, %zmm22
vpshufd $177, %zmm3, %zmm3
vpmaxsd %zmm0, %zmm5, %zmm9
kmovw %eax, %k1
vpminsd %zmm2, %zmm16, %zmm5
vpshufd $177, %zmm10, %zmm10
vpminsd %zmm3, %zmm18, %zmm20
vpshufd $177, %zmm7, %zmm7
vpshufd $177, %zmm1, %zmm1
vpmaxsd %zmm3, %zmm18, %zmm0
vpminsd %zmm8, %zmm14, %zmm11
vpminsd %zmm10, %zmm15, %zmm4
vpshufd $177, %zmm6, %zmm6
vpshufd $177, %zmm5, %zmm5
vpminsd %zmm1, %zmm13, %zmm21
vpminsd %zmm6, %zmm17, %zmm19
vpmaxsd %zmm2, %zmm16, %zmm16
vpminsd %zmm7, %zmm12, %zmm3
vpshufd $177, %zmm9, %zmm9
vpminsd %zmm5, %zmm20, %zmm2
vpmaxsd %zmm1, %zmm13, %zmm13
vpshufd $177, %zmm11, %zmm11
vpmaxsd %zmm7, %zmm12, %zmm1
vpmaxsd %zmm6, %zmm17, %zmm6
vpshufd $177, %zmm0, %zmm0
vpshufd $177, %zmm4, %zmm4
vpminsd %zmm9, %zmm1, %zmm18
vpmaxsd %zmm8, %zmm14, %zmm14
vpminsd %zmm4, %zmm21, %zmm12
vpmaxsd %zmm10, %zmm15, %zmm10
vpshufd $177, %zmm3, %zmm7
vpshufd $177, %zmm2, %zmm2
vpminsd %zmm11, %zmm19, %zmm3
vpshufd $177, %zmm6, %zmm6
vpshufd $177, %zmm13, %zmm13
vpmaxsd %zmm9, %zmm1, %zmm1
vpmaxsd %zmm4, %zmm21, %zmm4
vpminsd %zmm0, %zmm16, %zmm9
vpminsd %zmm7, %zmm22, %zmm17
vpshufd $177, %zmm4, %zmm4
vpminsd %zmm13, %zmm10, %zmm15
vpmaxsd %zmm5, %zmm20, %zmm5
vpshufd $177, %zmm3, %zmm3
vpmaxsd %zmm0, %zmm16, %zmm0
vpminsd %zmm6, %zmm14, %zmm8
vpshufd $177, %zmm9, %zmm16
vpmaxsd %zmm6, %zmm14, %zmm6
vpminsd %zmm2, %zmm12, %zmm20
vpshufd $177, %zmm1, %zmm1
vpmaxsd %zmm7, %zmm22, %zmm7
vpmaxsd %zmm13, %zmm10, %zmm13
vpshufd $177, %zmm8, %zmm8
vpminsd %zmm3, %zmm17, %zmm14
vpmaxsd %zmm11, %zmm19, %zmm11
vpshufd $177, %zmm13, %zmm13
vpmaxsd %zmm2, %zmm12, %zmm12
vpminsd %zmm1, %zmm6, %zmm19
vpshufd $177, %zmm20, %zmm2
vpminsd %zmm4, %zmm5, %zmm9
vpshufd $177, %zmm7, %zmm7
vpmaxsd %zmm4, %zmm5, %zmm5
vpmaxsd %zmm1, %zmm6, %zmm1
vpminsd %zmm16, %zmm15, %zmm4
vpshufd $177, %zmm9, %zmm9
vpminsd %zmm7, %zmm11, %zmm10
vpshufd $177, %zmm4, %zmm4
vpshufd $177, %zmm1, %zmm1
vpmaxsd %zmm3, %zmm17, %zmm3
vpmaxsd %zmm7, %zmm11, %zmm7
vpminsd %zmm8, %zmm18, %zmm17
vpmaxsd %zmm8, %zmm18, %zmm8
vpshufd $177, %zmm7, %zmm7
vpminsd %zmm13, %zmm0, %zmm18
vpmaxsd %zmm13, %zmm0, %zmm0
vpshufd $177, %zmm3, %zmm3
vpminsd %zmm2, %zmm14, %zmm13
vpminsd %zmm4, %zmm17, %zmm23
vpshufd $177, %zmm18, %zmm18
vpminsd %zmm1, %zmm0, %zmm20
vpmaxsd %zmm16, %zmm15, %zmm16
vpshufd $177, %zmm8, %zmm8
vpminsd %zmm9, %zmm10, %zmm15
vpmaxsd %zmm9, %zmm10, %zmm10
vpmaxsd %zmm4, %zmm17, %zmm9
vpmaxsd %zmm1, %zmm0, %zmm4
vpshufd $177, %zmm13, %zmm0
vpmaxsd %zmm2, %zmm14, %zmm11
vpminsd %zmm3, %zmm12, %zmm14
vpmaxsd %zmm7, %zmm5, %zmm2
vpmaxsd %zmm3, %zmm12, %zmm3
vpminsd %zmm7, %zmm5, %zmm12
vpmaxsd %zmm0, %zmm13, %zmm5
vpminsd %zmm0, %zmm13, %zmm5{%k1}
vpshufd $177, %zmm11, %zmm0
vpminsd %zmm18, %zmm19, %zmm21
vpmaxsd %zmm0, %zmm11, %zmm13
vpmaxsd %zmm18, %zmm19, %zmm19
vpminsd %zmm0, %zmm11, %zmm13{%k1}
vpshufd $177, %zmm14, %zmm0
vpminsd %zmm8, %zmm16, %zmm22
vpmaxsd %zmm0, %zmm14, %zmm18
vpmaxsd %zmm8, %zmm16, %zmm6
vpshufd $177, %zmm22, %zmm1
vpminsd %zmm0, %zmm14, %zmm18{%k1}
vpshufd $177, %zmm3, %zmm0
vpmaxsd %zmm0, %zmm3, %zmm17
vpminsd %zmm0, %zmm3, %zmm17{%k1}
vpshufd $177, %zmm15, %zmm0
vpshufd $177, %zmm4, %zmm3
vpmaxsd %zmm0, %zmm15, %zmm14
vpminsd %zmm0, %zmm15, %zmm14{%k1}
vpshufd $177, %zmm10, %zmm0
vpmaxsd %zmm0, %zmm10, %zmm16
vpminsd %zmm0, %zmm10, %zmm16{%k1}
vpshufd $177, %zmm12, %zmm0
vpmaxsd %zmm0, %zmm12, %zmm15
vpminsd %zmm0, %zmm12, %zmm15{%k1}
vpshufd $177, %zmm2, %zmm0
vpmaxsd %zmm0, %zmm2, %zmm12
vpminsd %zmm0, %zmm2, %zmm12{%k1}
vpshufd $177, %zmm23, %zmm0
vpmaxsd %zmm1, %zmm22, %zmm2
vpmaxsd %zmm0, %zmm23, %zmm7
vpminsd %zmm1, %zmm22, %zmm2{%k1}
vpminsd %zmm0, %zmm23, %zmm7{%k1}
vpshufd $177, %zmm9, %zmm0
vpmaxsd %zmm0, %zmm9, %zmm10
vpminsd %zmm0, %zmm9, %zmm10{%k1}
vpshufd $177, %zmm6, %zmm0
vpmaxsd %zmm0, %zmm6, %zmm8
vpminsd %zmm0, %zmm6, %zmm8{%k1}
vpshufd $177, %zmm21, %zmm0
vpmaxsd %zmm0, %zmm21, %zmm6
vpminsd %zmm0, %zmm21, %zmm6{%k1}
vpshufd $177, %zmm19, %zmm0
vpmaxsd %zmm0, %zmm19, %zmm9
vpminsd %zmm0, %zmm19, %zmm9{%k1}
vpshufd $177, %zmm20, %zmm0
vpmaxsd %zmm0, %zmm20, %zmm1
vpminsd %zmm0, %zmm20, %zmm1{%k1}
vpmaxsd %zmm3, %zmm4, %zmm0
vpminsd %zmm3, %zmm4, %zmm0{%k1}
vmovdqa64 %zmm9, %zmm3
cmpq $3, %rsi
jbe .L160
vpshufd $27, %zmm2, %zmm2
vpshufd $27, %zmm8, %zmm8
vpshufd $27, %zmm9, %zmm9
movl $85, %eax
vpminsd %zmm9, %zmm18, %zmm20
vpshufd $27, %zmm7, %zmm7
vpshufd $27, %zmm10, %zmm10
kmovb %eax, %k2
vpshufd $27, %zmm6, %zmm6
vpshufd $27, %zmm1, %zmm1
vpshufd $27, %zmm0, %zmm0
vpmaxsd %zmm9, %zmm18, %zmm23
vpmaxsd %zmm8, %zmm14, %zmm18
vpminsd %zmm8, %zmm14, %zmm9
vpminsd %zmm2, %zmm16, %zmm8
vpminsd %zmm1, %zmm13, %zmm21
vpminsd %zmm6, %zmm17, %zmm19
vpshufd $27, %zmm8, %zmm8
vpminsd %zmm0, %zmm5, %zmm22
vpmaxsd %zmm0, %zmm5, %zmm4
vpshufd $27, %zmm9, %zmm9
vpmaxsd %zmm1, %zmm13, %zmm13
vpmaxsd %zmm6, %zmm17, %zmm11
vpshufd $27, %zmm4, %zmm4
vpminsd %zmm10, %zmm15, %zmm5
vpminsd %zmm7, %zmm12, %zmm6
vpshufd $27, %zmm11, %zmm11
vpmaxsd %zmm2, %zmm16, %zmm0
vpmaxsd %zmm10, %zmm15, %zmm3
vpshufd $27, %zmm13, %zmm2
vpmaxsd %zmm7, %zmm12, %zmm1
vpshufd $27, %zmm5, %zmm5
vpshufd $27, %zmm23, %zmm12
vpminsd %zmm8, %zmm20, %zmm7
vpshufd $27, %zmm6, %zmm6
vpminsd %zmm4, %zmm1, %zmm14
vpmaxsd %zmm8, %zmm20, %zmm16
vpminsd %zmm2, %zmm3, %zmm17
vpshufd $27, %zmm7, %zmm7
vpminsd %zmm12, %zmm0, %zmm10
vpminsd %zmm6, %zmm22, %zmm13
vpminsd %zmm9, %zmm19, %zmm8
vpmaxsd %zmm4, %zmm1, %zmm1
vpmaxsd %zmm2, %zmm3, %zmm3
vpminsd %zmm5, %zmm21, %zmm4
vpshufd $27, %zmm8, %zmm8
vpmaxsd %zmm5, %zmm21, %zmm5
vpmaxsd %zmm6, %zmm22, %zmm6
vpshufd $27, %zmm3, %zmm3
vpminsd %zmm7, %zmm4, %zmm20
vpmaxsd %zmm12, %zmm0, %zmm0
vpshufd $27, %zmm5, %zmm5
vpmaxsd %zmm9, %zmm19, %zmm9
vpminsd %zmm11, %zmm18, %zmm2
vpshufd $27, %zmm6, %zmm6
vpmaxsd %zmm11, %zmm18, %zmm11
vpshufd $27, %zmm1, %zmm1
vpshufd $27, %zmm10, %zmm18
vpminsd %zmm8, %zmm13, %zmm12
vpminsd %zmm6, %zmm9, %zmm15
vpshufd $27, %zmm2, %zmm2
vpminsd %zmm5, %zmm16, %zmm10
vpmaxsd %zmm8, %zmm13, %zmm13
vpmaxsd %zmm7, %zmm4, %zmm4
vpminsd %zmm18, %zmm17, %zmm19
vpminsd %zmm1, %zmm11, %zmm7
vpmaxsd %zmm18, %zmm17, %zmm17
vpshufd $27, %zmm19, %zmm19
vpminsd %zmm3, %zmm0, %zmm18
vpmaxsd %zmm6, %zmm9, %zmm9
vpmaxsd %zmm1, %zmm11, %zmm1
vpmaxsd %zmm5, %zmm16, %zmm6
vpshufd $27, %zmm20, %zmm5
vpminsd %zmm2, %zmm14, %zmm8
vpshufd $27, %zmm13, %zmm11
vpmaxsd %zmm3, %zmm0, %zmm0
vpminsd %zmm5, %zmm12, %zmm13
vpshufd $27, %zmm10, %zmm3
vpmaxsd %zmm5, %zmm12, %zmm5
vpshufd $27, %zmm9, %zmm9
vpshufd $27, %zmm18, %zmm18
vpshufd $27, %zmm1, %zmm1
vpmaxsd %zmm2, %zmm14, %zmm2
vpminsd %zmm19, %zmm8, %zmm16
vpminsd %zmm3, %zmm15, %zmm12
vpminsd %zmm9, %zmm6, %zmm10
vpshufd $27, %zmm2, %zmm2
vpmaxsd %zmm3, %zmm15, %zmm15
vpminsd %zmm18, %zmm7, %zmm21
vpmaxsd %zmm9, %zmm6, %zmm3
vpmaxsd %zmm19, %zmm8, %zmm8
vpmaxsd %zmm18, %zmm7, %zmm9
vpminsd %zmm1, %zmm0, %zmm19
vpshufd $27, %zmm5, %zmm7
vpmaxsd %zmm1, %zmm0, %zmm0
vpshufd $27, %zmm13, %zmm1
vpminsd %zmm11, %zmm4, %zmm14
vpmaxsd %zmm2, %zmm17, %zmm6
vpmaxsd %zmm11, %zmm4, %zmm4
vpminsd %zmm2, %zmm17, %zmm11
vpminsd %zmm1, %zmm13, %zmm2
vpmaxsd %zmm1, %zmm13, %zmm13
vpminsd %zmm7, %zmm5, %zmm1
vpmaxsd %zmm7, %zmm5, %zmm5
vmovdqa64 %zmm2, %zmm13{%k2}
vpblendmq %zmm1, %zmm5, %zmm7{%k2}
vpshufd $27, %zmm14, %zmm1
vpminsd %zmm1, %zmm14, %zmm2
vpmaxsd %zmm1, %zmm14, %zmm14
vmovdqa64 %zmm2, %zmm14{%k2}
vpshufd $27, %zmm4, %zmm2
vpminsd %zmm2, %zmm4, %zmm1
vpmaxsd %zmm2, %zmm4, %zmm2
vmovdqa64 %zmm1, %zmm2{%k2}
vpshufd $27, %zmm12, %zmm1
vpminsd %zmm1, %zmm12, %zmm4
vpmaxsd %zmm1, %zmm12, %zmm12
vmovdqa64 %zmm4, %zmm12{%k2}
vpshufd $27, %zmm15, %zmm4
vpminsd %zmm4, %zmm15, %zmm1
vpmaxsd %zmm4, %zmm15, %zmm4
vmovdqa64 %zmm1, %zmm4{%k2}
vpshufd $27, %zmm10, %zmm1
vpminsd %zmm1, %zmm10, %zmm5
vpmaxsd %zmm1, %zmm10, %zmm10
vpshufd $27, %zmm3, %zmm1
vmovdqa64 %zmm5, %zmm10{%k2}
vpminsd %zmm1, %zmm3, %zmm5
vpmaxsd %zmm1, %zmm3, %zmm1
vpshufd $27, %zmm16, %zmm3
vmovdqa64 %zmm5, %zmm1{%k2}
vpminsd %zmm3, %zmm16, %zmm5
vpmaxsd %zmm3, %zmm16, %zmm3
vmovdqa64 %zmm5, %zmm3{%k2}
vpshufd $27, %zmm8, %zmm5
vpminsd %zmm5, %zmm8, %zmm15
vpmaxsd %zmm5, %zmm8, %zmm8
vpshufd $27, %zmm11, %zmm5
vmovdqa64 %zmm15, %zmm8{%k2}
vpminsd %zmm5, %zmm11, %zmm15
vpmaxsd %zmm5, %zmm11, %zmm11
vpshufd $27, %zmm6, %zmm5
vmovdqa64 %zmm15, %zmm11{%k2}
vpminsd %zmm5, %zmm6, %zmm15
vpmaxsd %zmm5, %zmm6, %zmm6
vpshufd $27, %zmm21, %zmm5
vmovdqa64 %zmm15, %zmm6{%k2}
vpminsd %zmm5, %zmm21, %zmm15
vpmaxsd %zmm5, %zmm21, %zmm21
vpshufd $27, %zmm9, %zmm5
vmovdqa64 %zmm15, %zmm21{%k2}
vpminsd %zmm5, %zmm9, %zmm15
vpmaxsd %zmm5, %zmm9, %zmm9
vpshufd $27, %zmm19, %zmm5
vmovdqa64 %zmm15, %zmm9{%k2}
vpminsd %zmm5, %zmm19, %zmm15
vpmaxsd %zmm5, %zmm19, %zmm19
vpshufd $27, %zmm0, %zmm5
vmovdqa64 %zmm15, %zmm19{%k2}
vpminsd %zmm5, %zmm0, %zmm20
vpmaxsd %zmm5, %zmm0, %zmm0
vpblendmq %zmm20, %zmm0, %zmm20{%k2}
vpshufd $177, %zmm13, %zmm0
vpmaxsd %zmm13, %zmm0, %zmm5
vpminsd %zmm13, %zmm0, %zmm5{%k1}
vpshufd $177, %zmm7, %zmm0
vpmaxsd %zmm7, %zmm0, %zmm13
vpminsd %zmm7, %zmm0, %zmm13{%k1}
vpshufd $177, %zmm14, %zmm0
vpmaxsd %zmm14, %zmm0, %zmm18
vpminsd %zmm14, %zmm0, %zmm18{%k1}
vpshufd $177, %zmm2, %zmm0
vpmaxsd %zmm2, %zmm0, %zmm17
vpminsd %zmm2, %zmm0, %zmm17{%k1}
vpshufd $177, %zmm12, %zmm0
vpmaxsd %zmm12, %zmm0, %zmm14
vpminsd %zmm12, %zmm0, %zmm14{%k1}
vpshufd $177, %zmm4, %zmm0
vpmaxsd %zmm4, %zmm0, %zmm16
vpminsd %zmm4, %zmm0, %zmm16{%k1}
vpshufd $177, %zmm10, %zmm0
vpshufd $177, %zmm20, %zmm4
vpmaxsd %zmm10, %zmm0, %zmm15
vpminsd %zmm10, %zmm0, %zmm15{%k1}
vpshufd $177, %zmm1, %zmm0
vpmaxsd %zmm1, %zmm0, %zmm12
vpminsd %zmm1, %zmm0, %zmm12{%k1}
vpshufd $177, %zmm3, %zmm0
vpshufd $177, %zmm11, %zmm1
vpmaxsd %zmm3, %zmm0, %zmm7
vpmaxsd %zmm11, %zmm1, %zmm2
vpminsd %zmm3, %zmm0, %zmm7{%k1}
vpshufd $177, %zmm8, %zmm0
vpminsd %zmm11, %zmm1, %zmm2{%k1}
vpmaxsd %zmm8, %zmm0, %zmm10
vpshufd $177, %zmm9, %zmm1
vpminsd %zmm8, %zmm0, %zmm10{%k1}
vpshufd $177, %zmm6, %zmm0
vpmaxsd %zmm9, %zmm1, %zmm3
vpmaxsd %zmm6, %zmm0, %zmm8
vpminsd %zmm9, %zmm1, %zmm3{%k1}
vpminsd %zmm6, %zmm0, %zmm8{%k1}
vpshufd $177, %zmm21, %zmm0
vpmaxsd %zmm21, %zmm0, %zmm6
vpminsd %zmm21, %zmm0, %zmm6{%k1}
vpshufd $177, %zmm19, %zmm0
vpmaxsd %zmm19, %zmm0, %zmm1
vpminsd %zmm19, %zmm0, %zmm1{%k1}
vpmaxsd %zmm20, %zmm4, %zmm0
vpminsd %zmm20, %zmm4, %zmm0{%k1}
cmpq $7, %rsi
jbe .L160
vmovdqa32 .LC1(%rip), %zmm9
movl $51, %eax
kmovb %eax, %k3
vpermd %zmm2, %zmm9, %zmm2
vpermd %zmm1, %zmm9, %zmm1
vpermd %zmm7, %zmm9, %zmm7
vpminsd %zmm1, %zmm13, %zmm21
vpermd %zmm10, %zmm9, %zmm10
vpermd %zmm8, %zmm9, %zmm8
vpermd %zmm6, %zmm9, %zmm6
vpermd %zmm3, %zmm9, %zmm3
vpermd %zmm0, %zmm9, %zmm0
vpminsd %zmm2, %zmm16, %zmm11
vpmaxsd %zmm1, %zmm13, %zmm1
vpminsd %zmm3, %zmm18, %zmm20
vpminsd %zmm6, %zmm17, %zmm19
vpermd %zmm11, %zmm9, %zmm11
vpminsd %zmm0, %zmm5, %zmm22
vpminsd %zmm7, %zmm12, %zmm4
vpermd %zmm1, %zmm9, %zmm1
vpmaxsd %zmm6, %zmm17, %zmm6
vpmaxsd %zmm0, %zmm5, %zmm0
vpminsd %zmm8, %zmm14, %zmm17
vpminsd %zmm10, %zmm15, %zmm5
vpermd %zmm0, %zmm9, %zmm0
vpmaxsd %zmm10, %zmm15, %zmm10
vpmaxsd %zmm3, %zmm18, %zmm3
vpermd %zmm17, %zmm9, %zmm17
vpminsd %zmm1, %zmm10, %zmm13
vpmaxsd %zmm8, %zmm14, %zmm8
vpermd %zmm3, %zmm9, %zmm3
vpmaxsd %zmm2, %zmm16, %zmm2
vpmaxsd %zmm7, %zmm12, %zmm7
vpermd %zmm5, %zmm9, %zmm5
vpermd %zmm6, %zmm9, %zmm12
vpermd %zmm4, %zmm9, %zmm6
vpmaxsd %zmm1, %zmm10, %zmm4
vpminsd %zmm11, %zmm20, %zmm10
vpminsd %zmm5, %zmm21, %zmm18
vpermd %zmm4, %zmm9, %zmm4
vpminsd %zmm0, %zmm7, %zmm16
vpmaxsd %zmm11, %zmm20, %zmm1
vpminsd %zmm6, %zmm22, %zmm14
vpminsd %zmm3, %zmm2, %zmm15
vpminsd %zmm17, %zmm19, %zmm11
vpmaxsd %zmm0, %zmm7, %zmm7
vpermd %zmm15, %zmm9, %zmm15
vpmaxsd %zmm3, %zmm2, %zmm0
vpmaxsd %zmm5, %zmm21, %zmm5
vpermd %zmm11, %zmm9, %zmm11
vpmaxsd %zmm17, %zmm19, %zmm3
vpmaxsd %zmm12, %zmm8, %zmm2
vpermd %zmm5, %zmm9, %zmm5
vpminsd %zmm12, %zmm8, %zmm17
vpmaxsd %zmm6, %zmm22, %zmm6
vpermd %zmm10, %zmm9, %zmm8
vpermd %zmm6, %zmm9, %zmm6
vpermd %zmm17, %zmm9, %zmm17
vpermd %zmm7, %zmm9, %zmm7
vpminsd %zmm8, %zmm18, %zmm19
vpminsd %zmm11, %zmm14, %zmm12
vpmaxsd %zmm8, %zmm18, %zmm10
vpmaxsd %zmm11, %zmm14, %zmm14
vpminsd %zmm6, %zmm3, %zmm8
vpmaxsd %zmm15, %zmm13, %zmm11
vpminsd %zmm5, %zmm1, %zmm18
vpmaxsd %zmm6, %zmm3, %zmm3
vpmaxsd %zmm5, %zmm1, %zmm1
vpminsd %zmm17, %zmm16, %zmm6
vpermd %zmm19, %zmm9, %zmm5
vpmaxsd %zmm17, %zmm16, %zmm16
vpminsd %zmm15, %zmm13, %zmm17
vpermd %zmm18, %zmm9, %zmm18
vpminsd %zmm7, %zmm2, %zmm13
vpmaxsd %zmm7, %zmm2, %zmm2
vpermd %zmm17, %zmm9, %zmm17
vpermd %zmm2, %zmm9, %zmm2
vpminsd %zmm4, %zmm0, %zmm15
vpmaxsd %zmm4, %zmm0, %zmm0
vpermd %zmm14, %zmm9, %zmm4
vpminsd %zmm5, %zmm12, %zmm14
vpminsd %zmm17, %zmm6, %zmm20
vpermd %zmm3, %zmm9, %zmm3
vpermd %zmm15, %zmm9, %zmm15
vpmaxsd %zmm5, %zmm12, %zmm5
vpmaxsd %zmm17, %zmm6, %zmm6
vpminsd %zmm2, %zmm0, %zmm17
vpermd %zmm16, %zmm9, %zmm16
vpmaxsd %zmm2, %zmm0, %zmm0
vpermd %zmm14, %zmm9, %zmm2
vpminsd %zmm4, %zmm10, %zmm12
vpminsd %zmm18, %zmm8, %zmm7
vpmaxsd %zmm4, %zmm10, %zmm4
vpmaxsd %zmm18, %zmm8, %zmm8
vpminsd %zmm3, %zmm1, %zmm10
vpminsd %zmm15, %zmm13, %zmm18
vpmaxsd %zmm3, %zmm1, %zmm1
vpmaxsd %zmm15, %zmm13, %zmm3
vpminsd %zmm2, %zmm14, %zmm13
vpmaxsd %zmm2, %zmm14, %zmm14
vpermd %zmm5, %zmm9, %zmm2
vpminsd %zmm16, %zmm11, %zmm19
vmovdqa64 %zmm13, %zmm14{%k3}
vpminsd %zmm2, %zmm5, %zmm13
vpmaxsd %zmm2, %zmm5, %zmm5
vpermd %zmm12, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm5{%k3}
vpmaxsd %zmm16, %zmm11, %zmm11
vpminsd %zmm2, %zmm12, %zmm13
vpmaxsd %zmm2, %zmm12, %zmm12
vpermd %zmm4, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm12{%k3}
vpminsd %zmm2, %zmm4, %zmm13
vpmaxsd %zmm2, %zmm4, %zmm4
vpermd %zmm7, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm4{%k3}
vpshufd $78, %zmm5, %zmm16
vpminsd %zmm2, %zmm7, %zmm13
vpmaxsd %zmm2, %zmm7, %zmm7
vpermd %zmm8, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm7{%k3}
vpminsd %zmm2, %zmm8, %zmm13
vpmaxsd %zmm2, %zmm8, %zmm8
vpermd %zmm10, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm8{%k3}
vpshufd $78, %zmm12, %zmm15
vpminsd %zmm2, %zmm10, %zmm13
vpmaxsd %zmm2, %zmm10, %zmm10
vpermd %zmm1, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm10{%k3}
vpminsd %zmm2, %zmm1, %zmm13
vpmaxsd %zmm2, %zmm1, %zmm1
vpermd %zmm20, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm1{%k3}
vpminsd %zmm2, %zmm20, %zmm13
vpmaxsd %zmm2, %zmm20, %zmm20
vpermd %zmm6, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm20{%k3}
vpminsd %zmm2, %zmm6, %zmm13
vpmaxsd %zmm2, %zmm6, %zmm6
vpermd %zmm19, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm6{%k3}
vpminsd %zmm2, %zmm19, %zmm13
vpmaxsd %zmm2, %zmm19, %zmm19
vpermd %zmm11, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm19{%k3}
vpminsd %zmm2, %zmm11, %zmm13
vpmaxsd %zmm2, %zmm11, %zmm2
vpermd %zmm18, %zmm9, %zmm11
vmovdqa64 %zmm13, %zmm2{%k3}
vpminsd %zmm11, %zmm18, %zmm13
vpmaxsd %zmm11, %zmm18, %zmm18
vpermd %zmm3, %zmm9, %zmm11
vmovdqa64 %zmm13, %zmm18{%k3}
vpminsd %zmm11, %zmm3, %zmm13
vpmaxsd %zmm11, %zmm3, %zmm3
vpermd %zmm17, %zmm9, %zmm11
vmovdqa64 %zmm13, %zmm3{%k3}
vpermd %zmm0, %zmm9, %zmm9
vpminsd %zmm11, %zmm17, %zmm13
vpmaxsd %zmm11, %zmm17, %zmm17
vpshufd $78, %zmm2, %zmm21
vmovdqa64 %zmm13, %zmm17{%k3}
vpshufd $78, %zmm14, %zmm13
vpminsd %zmm9, %zmm0, %zmm11
vpmaxsd %zmm9, %zmm0, %zmm0
vpminsd %zmm14, %zmm13, %zmm9
vpmaxsd %zmm14, %zmm13, %zmm13
vpshufd $78, %zmm4, %zmm14
vmovdqa64 %zmm11, %zmm0{%k3}
vmovdqa64 %zmm9, %zmm13{%k2}
vpminsd %zmm5, %zmm16, %zmm9
vpmaxsd %zmm5, %zmm16, %zmm16
vpminsd %zmm12, %zmm15, %zmm5
vpmaxsd %zmm12, %zmm15, %zmm15
vpshufd $78, %zmm7, %zmm12
vmovdqa64 %zmm5, %zmm15{%k2}
vpshufd $78, %zmm8, %zmm11
vpminsd %zmm4, %zmm14, %zmm5
vpmaxsd %zmm4, %zmm14, %zmm14
vpminsd %zmm7, %zmm12, %zmm4
vmovdqa64 %zmm9, %zmm16{%k2}
vpmaxsd %zmm7, %zmm12, %zmm12
vpshufd $78, %zmm10, %zmm7
vmovdqa64 %zmm5, %zmm14{%k2}
vmovdqa64 %zmm4, %zmm12{%k2}
vpminsd %zmm8, %zmm11, %zmm4
vpmaxsd %zmm8, %zmm11, %zmm11
vmovdqa64 %zmm4, %zmm11{%k2}
vpminsd %zmm10, %zmm7, %zmm4
vpmaxsd %zmm10, %zmm7, %zmm7
vmovdqa64 %zmm4, %zmm7{%k2}
vpshufd $78, %zmm20, %zmm10
vpshufd $78, %zmm1, %zmm4
vpminsd %zmm1, %zmm4, %zmm5
vpshufd $78, %zmm6, %zmm8
vpmaxsd %zmm1, %zmm4, %zmm1
vpminsd %zmm20, %zmm10, %zmm4
vpmaxsd %zmm20, %zmm10, %zmm10
vpshufd $78, %zmm18, %zmm20
vmovdqa64 %zmm4, %zmm10{%k2}
vpminsd %zmm6, %zmm8, %zmm4
vpmaxsd %zmm6, %zmm8, %zmm8
vpshufd $78, %zmm19, %zmm6
vmovdqa64 %zmm4, %zmm8{%k2}
vpshufd $78, %zmm0, %zmm9
vpminsd %zmm19, %zmm6, %zmm4
vpmaxsd %zmm19, %zmm6, %zmm6
vpshufd $78, %zmm3, %zmm19
vmovdqa64 %zmm4, %zmm6{%k2}
vpminsd %zmm2, %zmm21, %zmm4
vpmaxsd %zmm2, %zmm21, %zmm21
vpminsd %zmm18, %zmm20, %zmm2
vpmaxsd %zmm18, %zmm20, %zmm20
vmovdqa64 %zmm4, %zmm21{%k2}
vmovdqa64 %zmm2, %zmm20{%k2}
vpshufd $78, %zmm17, %zmm4
vpminsd %zmm3, %zmm19, %zmm2
vpmaxsd %zmm3, %zmm19, %zmm19
vmovdqa64 %zmm5, %zmm1{%k2}
vmovdqa64 %zmm2, %zmm19{%k2}
vpminsd %zmm17, %zmm4, %zmm2
vpmaxsd %zmm17, %zmm4, %zmm4
vmovdqa64 %zmm2, %zmm4{%k2}
vpminsd %zmm0, %zmm9, %zmm2
vpmaxsd %zmm0, %zmm9, %zmm9
vpshufd $177, %zmm13, %zmm0
vmovdqa64 %zmm2, %zmm9{%k2}
vpmaxsd %zmm13, %zmm0, %zmm5
vpminsd %zmm13, %zmm0, %zmm5{%k1}
vpshufd $177, %zmm16, %zmm0
vpmaxsd %zmm16, %zmm0, %zmm13
vpminsd %zmm16, %zmm0, %zmm13{%k1}
vpshufd $177, %zmm15, %zmm0
vpmaxsd %zmm15, %zmm0, %zmm18
vpminsd %zmm15, %zmm0, %zmm18{%k1}
vpshufd $177, %zmm14, %zmm0
vpmaxsd %zmm14, %zmm0, %zmm17
vpminsd %zmm14, %zmm0, %zmm17{%k1}
vpshufd $177, %zmm12, %zmm0
vpmaxsd %zmm12, %zmm0, %zmm14
vpminsd %zmm12, %zmm0, %zmm14{%k1}
vpshufd $177, %zmm11, %zmm0
vpmaxsd %zmm11, %zmm0, %zmm16
vpminsd %zmm11, %zmm0, %zmm16{%k1}
vpshufd $177, %zmm7, %zmm0
vpshufd $177, %zmm9, %zmm11
vpmaxsd %zmm7, %zmm0, %zmm15
vpminsd %zmm7, %zmm0, %zmm15{%k1}
vpshufd $177, %zmm1, %zmm0
vpmaxsd %zmm1, %zmm0, %zmm12
vpminsd %zmm1, %zmm0, %zmm12{%k1}
vpshufd $177, %zmm10, %zmm0
vpshufd $177, %zmm19, %zmm1
vpmaxsd %zmm10, %zmm0, %zmm7
vpmaxsd %zmm19, %zmm1, %zmm3
vpminsd %zmm10, %zmm0, %zmm7{%k1}
vpshufd $177, %zmm8, %zmm0
vpminsd %zmm19, %zmm1, %zmm3{%k1}
vpmaxsd %zmm8, %zmm0, %zmm10
vpminsd %zmm8, %zmm0, %zmm10{%k1}
vpshufd $177, %zmm6, %zmm0
vpmaxsd %zmm6, %zmm0, %zmm2
vpminsd %zmm6, %zmm0, %zmm2{%k1}
vpshufd $177, %zmm21, %zmm0
vpmaxsd %zmm21, %zmm0, %zmm8
vpminsd %zmm21, %zmm0, %zmm8{%k1}
vpshufd $177, %zmm20, %zmm0
vpmaxsd %zmm20, %zmm0, %zmm6
vpminsd %zmm20, %zmm0, %zmm6{%k1}
vpshufd $177, %zmm4, %zmm0
vpmaxsd %zmm4, %zmm0, %zmm1
vpminsd %zmm4, %zmm0, %zmm1{%k1}
vpmaxsd %zmm9, %zmm11, %zmm0
vmovdqa32 %zmm0, %zmm4
vpminsd %zmm9, %zmm11, %zmm4{%k1}
vmovdqa64 %zmm4, %zmm0
cmpq $15, %rsi
jbe .L160
vmovdqa32 .LC2(%rip), %zmm0
movl $65535, %eax
kmovd %eax, %k1
movl $51, %eax
vpermd %zmm6, %zmm0, %zmm11
vpermd %zmm10, %zmm0, %zmm10
vpermd %zmm4, %zmm0, %zmm6
vpermd %zmm2, %zmm0, %zmm2
vpermd %zmm1, %zmm0, %zmm1
vpminsd %zmm6, %zmm5, %zmm20
vpminsd %zmm1, %zmm13, %zmm19
vpermd %zmm8, %zmm0, %zmm8
vpermd %zmm7, %zmm0, %zmm7
vpermd %zmm3, %zmm0, %zmm3
vpmaxsd %zmm6, %zmm5, %zmm6
vpmaxsd %zmm1, %zmm13, %zmm1
vpminsd %zmm10, %zmm15, %zmm5
vpminsd %zmm2, %zmm16, %zmm13
vpermd %zmm6, %zmm0, %zmm6
vpminsd %zmm3, %zmm18, %zmm9
vpermd %zmm5, %zmm0, %zmm5
vpminsd %zmm8, %zmm14, %zmm4
vpmaxsd %zmm3, %zmm18, %zmm3
vpminsd %zmm11, %zmm17, %zmm18
vpermd %zmm1, %zmm0, %zmm1
vpmaxsd %zmm11, %zmm17, %zmm11
vpmaxsd %zmm8, %zmm14, %zmm17
vpermd %zmm3, %zmm0, %zmm3
vpminsd %zmm7, %zmm12, %zmm8
vpmaxsd %zmm7, %zmm12, %zmm7
vpermd %zmm13, %zmm0, %zmm12
vpmaxsd %zmm10, %zmm15, %zmm10
vpminsd %zmm6, %zmm7, %zmm13
vpermd %zmm11, %zmm0, %zmm15
vpminsd %zmm5, %zmm19, %zmm14
vpmaxsd %zmm2, %zmm16, %zmm2
vpermd %zmm4, %zmm0, %zmm4
vpermd %zmm8, %zmm0, %zmm8
vpmaxsd %zmm6, %zmm7, %zmm6
vpmaxsd %zmm5, %zmm19, %zmm7
vpminsd %zmm12, %zmm9, %zmm19
vpminsd %zmm8, %zmm20, %zmm16
vpermd %zmm7, %zmm0, %zmm7
vpminsd %zmm1, %zmm10, %zmm11
vpermd %zmm19, %zmm0, %zmm19
vpmaxsd %zmm1, %zmm10, %zmm5
vpmaxsd %zmm8, %zmm20, %zmm8
vpmaxsd %zmm12, %zmm9, %zmm1
vpermd %zmm5, %zmm0, %zmm5
vpminsd %zmm3, %zmm2, %zmm12
vpminsd %zmm4, %zmm18, %zmm9
vpermd %zmm8, %zmm0, %zmm8
vpmaxsd %zmm4, %zmm18, %zmm4
vpminsd %zmm15, %zmm17, %zmm18
vpermd %zmm9, %zmm0, %zmm9
vpermd %zmm12, %zmm0, %zmm12
vpermd %zmm18, %zmm0, %zmm18
vpermd %zmm6, %zmm0, %zmm6
vpmaxsd %zmm3, %zmm2, %zmm2
vpmaxsd %zmm15, %zmm17, %zmm3
vpminsd %zmm19, %zmm14, %zmm17
vpminsd %zmm9, %zmm16, %zmm15
vpmaxsd %zmm9, %zmm16, %zmm10
vpmaxsd %zmm19, %zmm14, %zmm14
vpminsd %zmm8, %zmm4, %zmm9
vpminsd %zmm7, %zmm1, %zmm16
vpminsd %zmm12, %zmm11, %zmm19
vpmaxsd %zmm7, %zmm1, %zmm1
vpermd %zmm16, %zmm0, %zmm16
vpminsd %zmm18, %zmm13, %zmm7
vpmaxsd %zmm12, %zmm11, %zmm11
vpermd %zmm19, %zmm0, %zmm19
vpminsd %zmm5, %zmm2, %zmm12
vpmaxsd %zmm8, %zmm4, %zmm4
vpmaxsd %zmm18, %zmm13, %zmm13
vpminsd %zmm6, %zmm3, %zmm8
vpermd %zmm4, %zmm0, %zmm4
vpmaxsd %zmm6, %zmm3, %zmm3
vpermd %zmm17, %zmm0, %zmm6
vpermd %zmm13, %zmm0, %zmm13
vpermd %zmm12, %zmm0, %zmm12
vpermd %zmm3, %zmm0, %zmm3
vpmaxsd %zmm5, %zmm2, %zmm2
vpermd %zmm10, %zmm0, %zmm5
vpminsd %zmm6, %zmm15, %zmm10
vpminsd %zmm16, %zmm9, %zmm17
vpminsd %zmm5, %zmm14, %zmm18
vpmaxsd %zmm6, %zmm15, %zmm6
vpmaxsd %zmm5, %zmm14, %zmm5
vpmaxsd %zmm16, %zmm9, %zmm9
vpminsd %zmm13, %zmm11, %zmm14
vpminsd %zmm4, %zmm1, %zmm16
vpmaxsd %zmm13, %zmm11, %zmm11
vpmaxsd %zmm4, %zmm1, %zmm1
vpminsd %zmm12, %zmm8, %zmm13
vpmaxsd %zmm12, %zmm8, %zmm4
vpminsd %zmm3, %zmm2, %zmm8
vpmaxsd %zmm3, %zmm2, %zmm2
vpermd %zmm10, %zmm0, %zmm3
vpminsd %zmm3, %zmm10, %zmm12
vpmaxsd %zmm3, %zmm10, %zmm10
vpermd %zmm6, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm10{%k1}
vpminsd %zmm3, %zmm6, %zmm12
vpmaxsd %zmm3, %zmm6, %zmm6
vpermd %zmm18, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm6{%k1}
vpminsd %zmm19, %zmm7, %zmm15
vpminsd %zmm3, %zmm18, %zmm12
vpmaxsd %zmm3, %zmm18, %zmm18
vpermd %zmm5, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm18{%k1}
vpminsd %zmm3, %zmm5, %zmm12
vpmaxsd %zmm3, %zmm5, %zmm5
vpermd %zmm17, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm5{%k1}
vpmaxsd %zmm19, %zmm7, %zmm7
vpminsd %zmm3, %zmm17, %zmm12
vpmaxsd %zmm3, %zmm17, %zmm17
vpermd %zmm9, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm17{%k1}
vpminsd %zmm3, %zmm9, %zmm12
vpmaxsd %zmm3, %zmm9, %zmm9
vpermd %zmm16, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm9{%k1}
vshufi32x4 $177, %zmm5, %zmm5, %zmm22
vpminsd %zmm3, %zmm16, %zmm12
vpmaxsd %zmm3, %zmm16, %zmm16
vpermd %zmm1, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm16{%k1}
vpminsd %zmm3, %zmm1, %zmm12
vpmaxsd %zmm3, %zmm1, %zmm1
vpermd %zmm15, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm1{%k1}
vshufi32x4 $177, %zmm17, %zmm17, %zmm21
vpminsd %zmm3, %zmm15, %zmm12
vpmaxsd %zmm3, %zmm15, %zmm15
vpermd %zmm7, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm15{%k1}
vpminsd %zmm3, %zmm7, %zmm12
vpmaxsd %zmm3, %zmm7, %zmm7
vpermd %zmm14, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm7{%k1}
vshufi32x4 $177, %zmm9, %zmm9, %zmm20
vpminsd %zmm3, %zmm14, %zmm12
vpmaxsd %zmm3, %zmm14, %zmm14
vpermd %zmm11, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm14{%k1}
vpminsd %zmm3, %zmm11, %zmm12
vpmaxsd %zmm3, %zmm11, %zmm3
vpermd %zmm13, %zmm0, %zmm11
vmovdqu16 %zmm12, %zmm3{%k1}
vshufi32x4 $177, %zmm16, %zmm16, %zmm19
vpminsd %zmm11, %zmm13, %zmm12
vpmaxsd %zmm11, %zmm13, %zmm13
vpermd %zmm4, %zmm0, %zmm11
vmovdqu16 %zmm12, %zmm13{%k1}
vpminsd %zmm11, %zmm4, %zmm12
vpmaxsd %zmm11, %zmm4, %zmm4
vpermd %zmm8, %zmm0, %zmm11
vmovdqu16 %zmm12, %zmm4{%k1}
vpermd %zmm2, %zmm0, %zmm0
vpminsd %zmm11, %zmm8, %zmm12
vpmaxsd %zmm11, %zmm8, %zmm8
vmovdqu16 %zmm12, %zmm8{%k1}
vpminsd %zmm0, %zmm2, %zmm11
vshufi32x4 $177, %zmm10, %zmm10, %zmm12
vpmaxsd %zmm0, %zmm2, %zmm0
vpminsd %zmm10, %zmm12, %zmm2
vmovdqu16 %zmm11, %zmm0{%k1}
vpmaxsd %zmm10, %zmm12, %zmm12
kmovb %eax, %k1
vshufi32x4 $177, %zmm6, %zmm6, %zmm11
vmovdqa64 %zmm2, %zmm12{%k1}
vpminsd %zmm6, %zmm11, %zmm2
vpmaxsd %zmm6, %zmm11, %zmm11
movl $85, %eax
vshufi32x4 $177, %zmm18, %zmm18, %zmm10
vmovdqa64 %zmm2, %zmm11{%k1}
vshufi32x4 $177, %zmm14, %zmm14, %zmm6
vpminsd %zmm18, %zmm10, %zmm2
vpmaxsd %zmm18, %zmm10, %zmm10
vshufi32x4 $177, %zmm15, %zmm15, %zmm18
vmovdqa64 %zmm2, %zmm10{%k1}
vpminsd %zmm5, %zmm22, %zmm2
vpmaxsd %zmm5, %zmm22, %zmm22
vmovdqa64 %zmm2, %zmm22{%k1}
vpminsd %zmm17, %zmm21, %zmm2
vpmaxsd %zmm17, %zmm21, %zmm21
vmovdqa64 %zmm2, %zmm21{%k1}
vpminsd %zmm9, %zmm20, %zmm2
vpmaxsd %zmm9, %zmm20, %zmm20
vmovdqa64 %zmm2, %zmm20{%k1}
vpminsd %zmm16, %zmm19, %zmm2
vpmaxsd %zmm16, %zmm19, %zmm19
vmovdqa64 %zmm2, %zmm19{%k1}
vshufi32x4 $177, %zmm1, %zmm1, %zmm2
vshufi32x4 $177, %zmm7, %zmm7, %zmm17
vpminsd %zmm1, %zmm2, %zmm5
vpmaxsd %zmm1, %zmm2, %zmm2
vshufi32x4 $177, %zmm3, %zmm3, %zmm16
vpminsd %zmm15, %zmm18, %zmm1
vpmaxsd %zmm15, %zmm18, %zmm18
vshufi32x4 $177, %zmm13, %zmm13, %zmm15
vmovdqa64 %zmm1, %zmm18{%k1}
vpminsd %zmm7, %zmm17, %zmm1
vpmaxsd %zmm7, %zmm17, %zmm17
vmovdqa64 %zmm1, %zmm17{%k1}
vpminsd %zmm14, %zmm6, %zmm1
vpmaxsd %zmm14, %zmm6, %zmm6
vmovdqa64 %zmm1, %zmm6{%k1}
vpminsd %zmm3, %zmm16, %zmm1
vpmaxsd %zmm3, %zmm16, %zmm16
vmovdqa64 %zmm1, %zmm16{%k1}
vshufi32x4 $177, %zmm4, %zmm4, %zmm14
vpminsd %zmm13, %zmm15, %zmm1
vpmaxsd %zmm13, %zmm15, %zmm15
vshufi32x4 $177, %zmm8, %zmm8, %zmm9
vmovdqa64 %zmm5, %zmm2{%k1}
vmovdqa64 %zmm1, %zmm15{%k1}
vpminsd %zmm4, %zmm14, %zmm1
vpmaxsd %zmm4, %zmm14, %zmm14
vmovdqa64 %zmm1, %zmm14{%k1}
vshufi32x4 $177, %zmm0, %zmm0, %zmm5
vpminsd %zmm8, %zmm9, %zmm1
vpshufd $78, %zmm12, %zmm13
vpmaxsd %zmm8, %zmm9, %zmm9
vpshufd $78, %zmm21, %zmm7
vmovdqa64 %zmm1, %zmm9{%k1}
vpminsd %zmm0, %zmm5, %zmm1
vpmaxsd %zmm0, %zmm5, %zmm5
vpminsd %zmm12, %zmm13, %zmm0
vpmaxsd %zmm12, %zmm13, %zmm13
vpshufd $78, %zmm11, %zmm12
vmovdqa64 %zmm1, %zmm5{%k1}
kmovb %eax, %k1
vmovdqa64 %zmm0, %zmm13{%k1}
vpminsd %zmm11, %zmm12, %zmm0
vpmaxsd %zmm11, %zmm12, %zmm12
vpshufd $78, %zmm10, %zmm11
vpshufd $78, %zmm20, %zmm4
movl $21845, %eax
vmovdqa64 %zmm0, %zmm12{%k1}
vpminsd %zmm10, %zmm11, %zmm0
vpmaxsd %zmm10, %zmm11, %zmm11
vpshufd $78, %zmm22, %zmm10
vmovdqa64 %zmm0, %zmm11{%k1}
vpshufd $78, %zmm19, %zmm3
vpminsd %zmm22, %zmm10, %zmm0
vpmaxsd %zmm22, %zmm10, %zmm10
vpshufd $78, %zmm2, %zmm1
vmovdqa64 %zmm0, %zmm10{%k1}
vpminsd %zmm21, %zmm7, %zmm0
vpmaxsd %zmm21, %zmm7, %zmm7
vmovdqa64 %zmm0, %zmm7{%k1}
vpminsd %zmm20, %zmm4, %zmm0
vpmaxsd %zmm20, %zmm4, %zmm4
vmovdqa64 %zmm0, %zmm4{%k1}
vpminsd %zmm19, %zmm3, %zmm0
vpmaxsd %zmm19, %zmm3, %zmm3
vmovdqa64 %zmm0, %zmm3{%k1}
vpminsd %zmm2, %zmm1, %zmm0
vpmaxsd %zmm2, %zmm1, %zmm1
vpshufd $78, %zmm18, %zmm2
vmovdqa64 %zmm0, %zmm1{%k1}
vpshufd $78, %zmm15, %zmm21
vpminsd %zmm18, %zmm2, %zmm0
vpmaxsd %zmm18, %zmm2, %zmm2
vpshufd $78, %zmm14, %zmm20
vmovdqa64 %zmm0, %zmm2{%k1}
vpshufd $78, %zmm17, %zmm0
vpshufd $78, %zmm9, %zmm19
vpminsd %zmm17, %zmm0, %zmm8
vpmaxsd %zmm17, %zmm0, %zmm0
vmovdqa64 %zmm8, %zmm0{%k1}
vpshufd $78, %zmm6, %zmm8
vpminsd %zmm6, %zmm8, %zmm17
vpmaxsd %zmm6, %zmm8, %zmm8
vpshufd $78, %zmm16, %zmm6
vmovdqa64 %zmm17, %zmm8{%k1}
vpminsd %zmm16, %zmm6, %zmm17
vpmaxsd %zmm16, %zmm6, %zmm6
vpminsd %zmm15, %zmm21, %zmm16
vpmaxsd %zmm15, %zmm21, %zmm21
vmovdqa64 %zmm17, %zmm6{%k1}
vpminsd %zmm14, %zmm20, %zmm15
vpmaxsd %zmm14, %zmm20, %zmm20
vmovdqa64 %zmm16, %zmm21{%k1}
vpminsd %zmm9, %zmm19, %zmm14
vpmaxsd %zmm9, %zmm19, %zmm19
vpshufd $78, %zmm5, %zmm9
vmovdqa64 %zmm14, %zmm19{%k1}
vpminsd %zmm5, %zmm9, %zmm14
vpmaxsd %zmm5, %zmm9, %zmm9
vmovdqa64 %zmm14, %zmm9{%k1}
vpshufd $177, %zmm13, %zmm14
vmovdqa64 %zmm15, %zmm20{%k1}
kmovw %eax, %k1
vpmaxsd %zmm13, %zmm14, %zmm5
vpminsd %zmm13, %zmm14, %zmm5{%k1}
vpshufd $177, %zmm12, %zmm14
vpmaxsd %zmm12, %zmm14, %zmm13
vpminsd %zmm12, %zmm14, %zmm13{%k1}
vpshufd $177, %zmm11, %zmm12
vpmaxsd %zmm11, %zmm12, %zmm18
vpminsd %zmm11, %zmm12, %zmm18{%k1}
vpshufd $177, %zmm10, %zmm11
vpmaxsd %zmm10, %zmm11, %zmm17
vpminsd %zmm10, %zmm11, %zmm17{%k1}
vpshufd $177, %zmm7, %zmm10
vpmaxsd %zmm7, %zmm10, %zmm14
vpminsd %zmm7, %zmm10, %zmm14{%k1}
vpshufd $177, %zmm4, %zmm7
vpmaxsd %zmm4, %zmm7, %zmm16
vpminsd %zmm4, %zmm7, %zmm16{%k1}
vpshufd $177, %zmm3, %zmm4
vpmaxsd %zmm3, %zmm4, %zmm15
vpminsd %zmm3, %zmm4, %zmm15{%k1}
vpshufd $177, %zmm1, %zmm3
vpshufd $177, %zmm9, %zmm4
vpmaxsd %zmm1, %zmm3, %zmm12
vpminsd %zmm1, %zmm3, %zmm12{%k1}
vpshufd $177, %zmm0, %zmm1
vpshufd $177, %zmm2, %zmm3
vpmaxsd %zmm0, %zmm1, %zmm10
vpmaxsd %zmm2, %zmm3, %zmm7
vpminsd %zmm0, %zmm1, %zmm10{%k1}
vpshufd $177, %zmm8, %zmm1
vpshufd $177, %zmm6, %zmm0
vpminsd %zmm2, %zmm3, %zmm7{%k1}
vpmaxsd %zmm8, %zmm1, %zmm2
vpminsd %zmm8, %zmm1, %zmm2{%k1}
vpmaxsd %zmm6, %zmm0, %zmm8
vpshufd $177, %zmm20, %zmm1
vpminsd %zmm6, %zmm0, %zmm8{%k1}
vpshufd $177, %zmm21, %zmm0
vpmaxsd %zmm20, %zmm1, %zmm3
vpmaxsd %zmm21, %zmm0, %zmm6
vpminsd %zmm20, %zmm1, %zmm3{%k1}
vpminsd %zmm21, %zmm0, %zmm6{%k1}
vpshufd $177, %zmm19, %zmm0
vpmaxsd %zmm19, %zmm0, %zmm1
vpminsd %zmm19, %zmm0, %zmm1{%k1}
vpmaxsd %zmm9, %zmm4, %zmm0
vpminsd %zmm9, %zmm4, %zmm0{%k1}
.L160:
vmovq %xmm26, %rax
vmovdqu64 %zmm5, (%rdi)
vmovdqu64 %zmm13, (%r15)
vmovdqu64 %zmm18, (%r14)
vmovdqu64 %zmm17, 0(%r13)
vmovdqu64 %zmm14, (%r12)
vmovdqu64 %zmm16, (%rbx)
vmovdqu64 %zmm15, (%r11)
vmovdqu64 %zmm12, (%r10)
vmovdqu64 %zmm7, (%r9)
vmovdqu64 %zmm10, (%r8)
vmovdqu64 %zmm2, (%rax)
vmovq %xmm25, %rax
vmovdqu64 %zmm8, (%rax)
vmovq %xmm27, %rax
vmovdqu64 %zmm6, (%rax)
vmovq %xmm24, %rax
vmovdqu64 %zmm3, (%rdx)
vmovdqu64 %zmm1, (%rax)
movq (%rsp), %rax
vmovdqu64 %zmm0, (%rax)
vzeroupper
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE18786:
.size _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, .-_ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
.section .text._ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18787:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %r10
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %rbx
.cfi_offset 3, -24
cmpq $15, %rsi
jbe .L181
vmovdqa32 %zmm0, %zmm2
vmovdqa32 %zmm1, %zmm3
movl $16, %r8d
xorl %esi, %esi
jmp .L172
.p2align 4,,10
.p2align 3
.L167:
vmovdqu64 %zmm0, (%rax)
kmovw %k0, %eax
popcntq %rax, %rax
addq %rax, %rsi
leaq 16(%r8), %rax
cmpq %r10, %rax
ja .L192
movq %rax, %r8
.L172:
vmovdqu32 -64(%rdi,%r8,4), %zmm4
leaq -16(%r8), %r9
leaq (%rdi,%rsi,4), %rax
vpcmpd $0, %zmm2, %zmm4, %k0
vpcmpd $0, %zmm3, %zmm4, %k1
kmovw %k0, %r11d
kmovw %k1, %ebx
korw %k1, %k0, %k1
kortestw %k1, %k1
jc .L167
kmovw %r11d, %k6
kmovw %ebx, %k5
kxnorw %k5, %k6, %k7
kmovw %k7, %eax
tzcntl %eax, %eax
addq %r9, %rax
vpbroadcastd (%rdi,%rax,4), %zmm0
leaq 16(%rsi), %rax
vmovdqa32 %zmm0, (%rdx)
cmpq %r9, %rax
ja .L168
.p2align 4,,10
.p2align 3
.L169:
vmovdqu64 %zmm1, -64(%rdi,%rax,4)
movq %rax, %rsi
addq $16, %rax
cmpq %rax, %r9
jnb .L169
.L168:
subq %rsi, %r9
leaq (%rdi,%rsi,4), %rdx
movl $65535, %eax
cmpq $255, %r9
jbe .L193
.L170:
kmovw %eax, %k4
xorl %eax, %eax
vmovdqu32 %zmm1, (%rdx){%k4}
.L165:
movq -8(%rbp), %rbx
leave
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L193:
.cfi_restore_state
movq $-1, %rax
bzhi %r9, %rax, %rax
movzwl %ax, %eax
jmp .L170
.p2align 4,,10
.p2align 3
.L192:
movq %r10, %r11
leaq (%rdi,%r8,4), %rbx
leaq (%rdi,%rsi,4), %r9
movl $65535, %eax
subq %r8, %r11
kmovd %eax, %k1
cmpq $255, %r11
jbe .L166
.L173:
vmovdqu32 (%rbx), %zmm2{%k1}{z}
knotw %k1, %k3
vmovdqu32 %zmm2, (%rcx){%k1}
vmovdqa32 (%rcx), %zmm2
vpcmpd $0, %zmm0, %zmm2, %k0
vpcmpd $0, %zmm1, %zmm2, %k2
kandw %k1, %k0, %k0
korw %k2, %k0, %k2
korw %k3, %k2, %k2
kortestw %k2, %k2
jnc .L194
kmovw %k0, %edx
popcntq %rdx, %rdx
addq %rsi, %rdx
vmovdqu32 %zmm0, (%r9){%k1}
leaq 16(%rdx), %rax
cmpq %r10, %rax
ja .L178
.p2align 4,,10
.p2align 3
.L179:
vmovdqu64 %zmm1, -64(%rdi,%rax,4)
movq %rax, %rdx
addq $16, %rax
cmpq %rax, %r10
jnb .L179
.L178:
subq %rdx, %r10
leaq (%rdi,%rdx,4), %rcx
movl $65535, %eax
cmpq $255, %r10
ja .L180
movq $-1, %rax
bzhi %r10, %rax, %rax
movzwl %ax, %eax
.L180:
kmovw %eax, %k5
movl $1, %eax
vmovdqu32 %zmm1, (%rcx){%k5}
movq -8(%rbp), %rbx
leave
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.L181:
.cfi_restore_state
movq %rsi, %r11
movq %rdi, %r9
movq %rdi, %rbx
xorl %esi, %esi
xorl %r8d, %r8d
.L166:
movq $-1, %rax
bzhi %r11, %rax, %rax
movzwl %ax, %eax
kmovd %eax, %k1
jmp .L173
.L194:
knotw %k2, %k3
kmovw %k3, %eax
tzcntl %eax, %eax
addq %r8, %rax
vpbroadcastd (%rdi,%rax,4), %zmm0
leaq 16(%rsi), %rax
vmovdqa32 %zmm0, (%rdx)
cmpq %r8, %rax
ja .L175
.p2align 4,,10
.p2align 3
.L176:
vmovdqu64 %zmm1, -64(%rdi,%rax,4)
movq %rax, %rsi
leaq 16(%rax), %rax
cmpq %rax, %r8
jnb .L176
leaq (%rdi,%rsi,4), %r9
.L175:
subq %rsi, %r8
movl $65535, %eax
cmpq $255, %r8
ja .L177
movq $-1, %rax
bzhi %r8, %rax, %rax
movzwl %ax, %eax
.L177:
kmovw %eax, %k6
xorl %eax, %eax
vmovdqu32 %zmm1, (%r9){%k6}
jmp .L165
.cfi_endproc
.LFE18787:
.size _ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, @function
_ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0:
.LFB18788:
.cfi_startproc
movq %rsi, %r8
movq %rdx, %rcx
cmpq %rdx, %rsi
jbe .L205
leaq (%rdx,%rdx), %rdx
leaq 1(%rcx), %r10
leaq 1(%rdx), %rsi
addq $2, %rdx
cmpq %rsi, %r8
jbe .L205
movl (%rdi,%rcx,4), %r11d
vpbroadcastd %r11d, %xmm1
jmp .L198
.p2align 4,,10
.p2align 3
.L208:
movq %rsi, %rax
cmpq %rdx, %r8
ja .L206
.L200:
cmpq %rcx, %rax
je .L205
leaq (%rdi,%rax,4), %rdx
movl (%rdx), %ecx
movl %ecx, (%r9)
movl %r11d, (%rdx)
cmpq %rax, %r8
jbe .L207
leaq (%rax,%rax), %rdx
leaq 1(%rax), %r10
leaq 1(%rdx), %rsi
addq $2, %rdx
cmpq %r8, %rsi
jnb .L205
movq %rax, %rcx
.L198:
vpbroadcastd (%rdi,%rsi,4), %xmm0
leaq (%rdi,%rcx,4), %r9
vpcmpd $6, %xmm1, %xmm0, %k0
kmovb %k0, %eax
testb $1, %al
jne .L208
cmpq %rdx, %r8
jbe .L205
vpbroadcastd (%rdi,%r10,8), %xmm0
vpcmpd $6, %xmm1, %xmm0, %k1
kmovb %k1, %eax
testb $1, %al
je .L205
movq %rdx, %rax
jmp .L200
.p2align 4,,10
.p2align 3
.L205:
ret
.p2align 4,,10
.p2align 3
.L206:
vpbroadcastd (%rdi,%r10,8), %xmm2
vpcmpd $6, %xmm0, %xmm2, %k2
kmovb %k2, %esi
andl $1, %esi
cmovne %rdx, %rax
jmp .L200
.p2align 4,,10
.p2align 3
.L207:
ret
.cfi_endproc
.LFE18788:
.size _ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, .-_ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
.section .text._ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, @function
_ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0:
.LFB18789:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
leaq 0(,%rsi,4), %rax
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq (%rdi,%rax), %r15
pushq %r14
.cfi_offset 14, -32
leaq (%r15,%rax), %r14
pushq %r13
.cfi_offset 13, -40
leaq (%r14,%rax), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%rax), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%rax), %rbx
leaq (%rbx,%rax), %r11
leaq (%r11,%rax), %r10
leaq (%r10,%rax), %r9
andq $-64, %rsp
leaq (%r9,%rax), %r8
subq $8, %rsp
leaq (%r8,%rax), %rdx
leaq (%rdx,%rax), %rcx
vmovq %rdx, %xmm26
leaq (%rcx,%rax), %rdx
vmovq %rcx, %xmm25
vmovdqu32 (%rdi), %zmm7
vpminsd (%r15), %zmm7, %zmm15
vmovq %rdx, %xmm27
addq %rax, %rdx
vpmaxsd (%r15), %zmm7, %zmm0
vmovdqu32 (%r14), %zmm7
leaq (%rdx,%rax), %rcx
vpminsd 0(%r13), %zmm7, %zmm16
addq %rcx, %rax
vmovq %rcx, %xmm24
vmovq %xmm26, %rcx
movq %rax, (%rsp)
vmovq %xmm25, %rax
vpmaxsd 0(%r13), %zmm7, %zmm10
vpminsd %zmm16, %zmm15, %zmm12
vmovdqu32 (%r12), %zmm7
vpminsd (%rbx), %zmm7, %zmm11
vpmaxsd %zmm16, %zmm15, %zmm15
vpmaxsd (%rbx), %zmm7, %zmm2
vmovdqu32 (%r11), %zmm7
vpminsd %zmm10, %zmm0, %zmm16
vpminsd (%r10), %zmm7, %zmm8
vpmaxsd (%r10), %zmm7, %zmm6
vmovdqu32 (%r9), %zmm7
vpminsd (%r8), %zmm7, %zmm1
vpmaxsd %zmm10, %zmm0, %zmm0
vpmaxsd (%r8), %zmm7, %zmm4
vmovdqu32 (%rcx), %zmm7
vpminsd %zmm8, %zmm11, %zmm10
vpminsd (%rax), %zmm7, %zmm9
vpmaxsd (%rax), %zmm7, %zmm13
vmovq %xmm27, %rax
vmovdqu32 (%rax), %zmm7
movq (%rsp), %rax
vpmaxsd %zmm8, %zmm11, %zmm11
vpminsd %zmm6, %zmm2, %zmm8
vpminsd (%rdx), %zmm7, %zmm3
vpmaxsd (%rdx), %zmm7, %zmm5
vmovdqu64 (%rax), %zmm7
vmovq %xmm24, %rax
vpmaxsd %zmm6, %zmm2, %zmm2
vpminsd %zmm9, %zmm1, %zmm6
vpmaxsd %zmm9, %zmm1, %zmm1
vpminsd %zmm13, %zmm4, %zmm9
vmovdqa64 %zmm7, -120(%rsp)
vmovdqa32 -120(%rsp), %zmm7
vpminsd (%rax), %zmm7, %zmm14
vpmaxsd %zmm13, %zmm4, %zmm4
vpmaxsd (%rax), %zmm7, %zmm7
vpminsd %zmm14, %zmm3, %zmm13
vpmaxsd %zmm14, %zmm3, %zmm3
vpminsd %zmm7, %zmm5, %zmm14
vpmaxsd %zmm7, %zmm5, %zmm5
vpminsd %zmm10, %zmm12, %zmm7
vpmaxsd %zmm10, %zmm12, %zmm12
vpminsd %zmm8, %zmm16, %zmm10
vpmaxsd %zmm8, %zmm16, %zmm16
vpminsd %zmm11, %zmm15, %zmm8
vpmaxsd %zmm11, %zmm15, %zmm15
vpminsd %zmm2, %zmm0, %zmm11
vpmaxsd %zmm2, %zmm0, %zmm0
vpminsd %zmm13, %zmm6, %zmm2
vpmaxsd %zmm13, %zmm6, %zmm6
vpminsd %zmm14, %zmm9, %zmm13
vpmaxsd %zmm14, %zmm9, %zmm9
vpminsd %zmm3, %zmm1, %zmm14
vpmaxsd %zmm3, %zmm1, %zmm1
vpminsd %zmm5, %zmm4, %zmm3
vpmaxsd %zmm5, %zmm4, %zmm4
vpminsd %zmm2, %zmm7, %zmm5
vpmaxsd %zmm2, %zmm7, %zmm7
vpminsd %zmm13, %zmm10, %zmm2
vpmaxsd %zmm13, %zmm10, %zmm10
vpminsd %zmm14, %zmm8, %zmm13
vpmaxsd %zmm14, %zmm8, %zmm8
vpminsd %zmm3, %zmm11, %zmm14
vpmaxsd %zmm3, %zmm11, %zmm11
vpminsd %zmm6, %zmm12, %zmm3
vpmaxsd %zmm6, %zmm12, %zmm12
vpminsd %zmm9, %zmm16, %zmm6
vpmaxsd %zmm9, %zmm16, %zmm16
vpminsd %zmm1, %zmm15, %zmm9
vpmaxsd %zmm1, %zmm15, %zmm15
vpminsd %zmm4, %zmm0, %zmm1
vpmaxsd %zmm4, %zmm0, %zmm0
vpminsd %zmm8, %zmm6, %zmm4
vpmaxsd %zmm8, %zmm6, %zmm6
vpminsd %zmm10, %zmm9, %zmm8
vpmaxsd %zmm10, %zmm9, %zmm9
vpminsd %zmm12, %zmm14, %zmm10
vpmaxsd %zmm12, %zmm14, %zmm14
vpminsd %zmm11, %zmm1, %zmm12
vpmaxsd %zmm11, %zmm1, %zmm1
vpminsd %zmm15, %zmm16, %zmm11
vpmaxsd %zmm15, %zmm16, %zmm16
vpminsd %zmm7, %zmm3, %zmm15
vpmaxsd %zmm7, %zmm3, %zmm3
vpminsd %zmm13, %zmm2, %zmm7
vpmaxsd %zmm13, %zmm2, %zmm2
vpminsd %zmm15, %zmm7, %zmm13
vpmaxsd %zmm15, %zmm7, %zmm7
vpminsd %zmm11, %zmm12, %zmm15
vpmaxsd %zmm11, %zmm12, %zmm12
vpminsd %zmm3, %zmm2, %zmm11
vpmaxsd %zmm3, %zmm2, %zmm2
vpminsd %zmm16, %zmm1, %zmm3
vpminsd %zmm7, %zmm11, %zmm18
vpmaxsd %zmm7, %zmm11, %zmm11
vpminsd %zmm8, %zmm4, %zmm7
vpmaxsd %zmm8, %zmm4, %zmm4
vpminsd %zmm6, %zmm9, %zmm8
vpmaxsd %zmm6, %zmm9, %zmm9
vpminsd %zmm12, %zmm3, %zmm6
vpmaxsd %zmm12, %zmm3, %zmm3
vpminsd %zmm2, %zmm10, %zmm12
vpmaxsd %zmm2, %zmm10, %zmm10
vpminsd %zmm14, %zmm15, %zmm2
vpmaxsd %zmm14, %zmm15, %zmm15
vpminsd %zmm7, %zmm12, %zmm14
vpmaxsd %zmm7, %zmm12, %zmm12
vpminsd %zmm10, %zmm4, %zmm7
vpmaxsd %zmm10, %zmm4, %zmm4
vpminsd %zmm8, %zmm2, %zmm10
vpmaxsd %zmm8, %zmm2, %zmm2
vpminsd %zmm15, %zmm9, %zmm8
vpmaxsd %zmm16, %zmm1, %zmm1
vpmaxsd %zmm15, %zmm9, %zmm9
vpminsd %zmm7, %zmm12, %zmm16
vpmaxsd %zmm7, %zmm12, %zmm12
vpminsd %zmm4, %zmm10, %zmm7
vpmaxsd %zmm4, %zmm10, %zmm10
vpminsd %zmm8, %zmm2, %zmm4
vpminsd %zmm7, %zmm12, %zmm15
vpminsd %zmm11, %zmm14, %zmm17
vpmaxsd %zmm8, %zmm2, %zmm2
vpmaxsd %zmm7, %zmm12, %zmm12
vpminsd %zmm9, %zmm6, %zmm8
vpminsd %zmm4, %zmm10, %zmm7
vpmaxsd %zmm11, %zmm14, %zmm14
vpmaxsd %zmm9, %zmm6, %zmm6
vpmaxsd %zmm4, %zmm10, %zmm10
cmpq $1, %rsi
jbe .L211
vpshufd $177, %zmm2, %zmm2
vpshufd $177, %zmm0, %zmm0
vpshufd $177, %zmm8, %zmm8
movl $21845, %eax
vpminsd %zmm0, %zmm5, %zmm22
vpshufd $177, %zmm3, %zmm3
vpmaxsd %zmm0, %zmm5, %zmm9
kmovw %eax, %k1
vpminsd %zmm2, %zmm16, %zmm5
vpshufd $177, %zmm10, %zmm10
vpminsd %zmm3, %zmm18, %zmm20
vpshufd $177, %zmm7, %zmm7
vpshufd $177, %zmm1, %zmm1
vpmaxsd %zmm3, %zmm18, %zmm0
vpminsd %zmm8, %zmm14, %zmm11
vpminsd %zmm10, %zmm15, %zmm4
vpshufd $177, %zmm6, %zmm6
vpshufd $177, %zmm5, %zmm5
vpminsd %zmm1, %zmm13, %zmm21
vpminsd %zmm6, %zmm17, %zmm19
vpmaxsd %zmm2, %zmm16, %zmm16
vpminsd %zmm7, %zmm12, %zmm3
vpshufd $177, %zmm9, %zmm9
vpminsd %zmm5, %zmm20, %zmm2
vpmaxsd %zmm1, %zmm13, %zmm13
vpshufd $177, %zmm11, %zmm11
vpmaxsd %zmm7, %zmm12, %zmm1
vpmaxsd %zmm6, %zmm17, %zmm6
vpshufd $177, %zmm0, %zmm0
vpshufd $177, %zmm4, %zmm4
vpminsd %zmm9, %zmm1, %zmm18
vpmaxsd %zmm8, %zmm14, %zmm14
vpminsd %zmm4, %zmm21, %zmm12
vpmaxsd %zmm10, %zmm15, %zmm10
vpshufd $177, %zmm3, %zmm7
vpshufd $177, %zmm2, %zmm2
vpminsd %zmm11, %zmm19, %zmm3
vpshufd $177, %zmm6, %zmm6
vpshufd $177, %zmm13, %zmm13
vpmaxsd %zmm9, %zmm1, %zmm1
vpmaxsd %zmm4, %zmm21, %zmm4
vpminsd %zmm0, %zmm16, %zmm9
vpminsd %zmm7, %zmm22, %zmm17
vpshufd $177, %zmm4, %zmm4
vpminsd %zmm13, %zmm10, %zmm15
vpmaxsd %zmm5, %zmm20, %zmm5
vpshufd $177, %zmm3, %zmm3
vpmaxsd %zmm0, %zmm16, %zmm0
vpminsd %zmm6, %zmm14, %zmm8
vpshufd $177, %zmm9, %zmm16
vpmaxsd %zmm6, %zmm14, %zmm6
vpminsd %zmm2, %zmm12, %zmm20
vpshufd $177, %zmm1, %zmm1
vpmaxsd %zmm7, %zmm22, %zmm7
vpmaxsd %zmm13, %zmm10, %zmm13
vpshufd $177, %zmm8, %zmm8
vpminsd %zmm3, %zmm17, %zmm14
vpmaxsd %zmm11, %zmm19, %zmm11
vpshufd $177, %zmm13, %zmm13
vpmaxsd %zmm2, %zmm12, %zmm12
vpminsd %zmm1, %zmm6, %zmm19
vpshufd $177, %zmm20, %zmm2
vpminsd %zmm4, %zmm5, %zmm9
vpshufd $177, %zmm7, %zmm7
vpmaxsd %zmm4, %zmm5, %zmm5
vpmaxsd %zmm1, %zmm6, %zmm1
vpminsd %zmm16, %zmm15, %zmm4
vpshufd $177, %zmm9, %zmm9
vpminsd %zmm7, %zmm11, %zmm10
vpshufd $177, %zmm4, %zmm4
vpshufd $177, %zmm1, %zmm1
vpmaxsd %zmm3, %zmm17, %zmm3
vpmaxsd %zmm7, %zmm11, %zmm7
vpminsd %zmm8, %zmm18, %zmm17
vpmaxsd %zmm8, %zmm18, %zmm8
vpshufd $177, %zmm7, %zmm7
vpminsd %zmm13, %zmm0, %zmm18
vpmaxsd %zmm13, %zmm0, %zmm0
vpshufd $177, %zmm3, %zmm3
vpminsd %zmm2, %zmm14, %zmm13
vpminsd %zmm4, %zmm17, %zmm23
vpshufd $177, %zmm18, %zmm18
vpminsd %zmm1, %zmm0, %zmm20
vpmaxsd %zmm16, %zmm15, %zmm16
vpshufd $177, %zmm8, %zmm8
vpminsd %zmm9, %zmm10, %zmm15
vpmaxsd %zmm9, %zmm10, %zmm10
vpmaxsd %zmm4, %zmm17, %zmm9
vpmaxsd %zmm1, %zmm0, %zmm4
vpshufd $177, %zmm13, %zmm0
vpmaxsd %zmm2, %zmm14, %zmm11
vpminsd %zmm3, %zmm12, %zmm14
vpmaxsd %zmm7, %zmm5, %zmm2
vpmaxsd %zmm3, %zmm12, %zmm3
vpminsd %zmm7, %zmm5, %zmm12
vpmaxsd %zmm0, %zmm13, %zmm5
vpminsd %zmm0, %zmm13, %zmm5{%k1}
vpshufd $177, %zmm11, %zmm0
vpminsd %zmm18, %zmm19, %zmm21
vpmaxsd %zmm0, %zmm11, %zmm13
vpmaxsd %zmm18, %zmm19, %zmm19
vpminsd %zmm0, %zmm11, %zmm13{%k1}
vpshufd $177, %zmm14, %zmm0
vpminsd %zmm8, %zmm16, %zmm22
vpmaxsd %zmm0, %zmm14, %zmm18
vpmaxsd %zmm8, %zmm16, %zmm6
vpshufd $177, %zmm22, %zmm1
vpminsd %zmm0, %zmm14, %zmm18{%k1}
vpshufd $177, %zmm3, %zmm0
vpmaxsd %zmm0, %zmm3, %zmm17
vpminsd %zmm0, %zmm3, %zmm17{%k1}
vpshufd $177, %zmm15, %zmm0
vpshufd $177, %zmm4, %zmm3
vpmaxsd %zmm0, %zmm15, %zmm14
vpminsd %zmm0, %zmm15, %zmm14{%k1}
vpshufd $177, %zmm10, %zmm0
vpmaxsd %zmm0, %zmm10, %zmm16
vpminsd %zmm0, %zmm10, %zmm16{%k1}
vpshufd $177, %zmm12, %zmm0
vpmaxsd %zmm0, %zmm12, %zmm15
vpminsd %zmm0, %zmm12, %zmm15{%k1}
vpshufd $177, %zmm2, %zmm0
vpmaxsd %zmm0, %zmm2, %zmm12
vpminsd %zmm0, %zmm2, %zmm12{%k1}
vpshufd $177, %zmm23, %zmm0
vpmaxsd %zmm1, %zmm22, %zmm2
vpmaxsd %zmm0, %zmm23, %zmm7
vpminsd %zmm1, %zmm22, %zmm2{%k1}
vpminsd %zmm0, %zmm23, %zmm7{%k1}
vpshufd $177, %zmm9, %zmm0
vpmaxsd %zmm0, %zmm9, %zmm10
vpminsd %zmm0, %zmm9, %zmm10{%k1}
vpshufd $177, %zmm6, %zmm0
vpmaxsd %zmm0, %zmm6, %zmm8
vpminsd %zmm0, %zmm6, %zmm8{%k1}
vpshufd $177, %zmm21, %zmm0
vpmaxsd %zmm0, %zmm21, %zmm6
vpminsd %zmm0, %zmm21, %zmm6{%k1}
vpshufd $177, %zmm19, %zmm0
vpmaxsd %zmm0, %zmm19, %zmm9
vpminsd %zmm0, %zmm19, %zmm9{%k1}
vpshufd $177, %zmm20, %zmm0
vpmaxsd %zmm0, %zmm20, %zmm1
vpminsd %zmm0, %zmm20, %zmm1{%k1}
vpmaxsd %zmm3, %zmm4, %zmm0
vpminsd %zmm3, %zmm4, %zmm0{%k1}
vmovdqa64 %zmm9, %zmm3
cmpq $3, %rsi
jbe .L211
vpshufd $27, %zmm2, %zmm2
vpshufd $27, %zmm8, %zmm8
vpshufd $27, %zmm9, %zmm9
movl $85, %eax
vpminsd %zmm9, %zmm18, %zmm20
vpshufd $27, %zmm7, %zmm7
vpshufd $27, %zmm10, %zmm10
kmovb %eax, %k2
vpshufd $27, %zmm6, %zmm6
vpshufd $27, %zmm1, %zmm1
vpshufd $27, %zmm0, %zmm0
vpmaxsd %zmm9, %zmm18, %zmm23
vpmaxsd %zmm8, %zmm14, %zmm18
vpminsd %zmm8, %zmm14, %zmm9
vpminsd %zmm2, %zmm16, %zmm8
vpminsd %zmm1, %zmm13, %zmm21
vpminsd %zmm6, %zmm17, %zmm19
vpshufd $27, %zmm8, %zmm8
vpminsd %zmm0, %zmm5, %zmm22
vpmaxsd %zmm0, %zmm5, %zmm4
vpshufd $27, %zmm9, %zmm9
vpmaxsd %zmm1, %zmm13, %zmm13
vpmaxsd %zmm6, %zmm17, %zmm11
vpshufd $27, %zmm4, %zmm4
vpminsd %zmm10, %zmm15, %zmm5
vpminsd %zmm7, %zmm12, %zmm6
vpshufd $27, %zmm11, %zmm11
vpmaxsd %zmm2, %zmm16, %zmm0
vpmaxsd %zmm10, %zmm15, %zmm3
vpshufd $27, %zmm13, %zmm2
vpmaxsd %zmm7, %zmm12, %zmm1
vpshufd $27, %zmm5, %zmm5
vpshufd $27, %zmm23, %zmm12
vpminsd %zmm8, %zmm20, %zmm7
vpshufd $27, %zmm6, %zmm6
vpminsd %zmm4, %zmm1, %zmm14
vpmaxsd %zmm8, %zmm20, %zmm16
vpminsd %zmm2, %zmm3, %zmm17
vpshufd $27, %zmm7, %zmm7
vpminsd %zmm12, %zmm0, %zmm10
vpminsd %zmm6, %zmm22, %zmm13
vpminsd %zmm9, %zmm19, %zmm8
vpmaxsd %zmm4, %zmm1, %zmm1
vpmaxsd %zmm2, %zmm3, %zmm3
vpminsd %zmm5, %zmm21, %zmm4
vpshufd $27, %zmm8, %zmm8
vpmaxsd %zmm5, %zmm21, %zmm5
vpmaxsd %zmm6, %zmm22, %zmm6
vpshufd $27, %zmm3, %zmm3
vpminsd %zmm7, %zmm4, %zmm20
vpmaxsd %zmm12, %zmm0, %zmm0
vpshufd $27, %zmm5, %zmm5
vpmaxsd %zmm9, %zmm19, %zmm9
vpminsd %zmm11, %zmm18, %zmm2
vpshufd $27, %zmm6, %zmm6
vpmaxsd %zmm11, %zmm18, %zmm11
vpshufd $27, %zmm1, %zmm1
vpshufd $27, %zmm10, %zmm18
vpminsd %zmm8, %zmm13, %zmm12
vpminsd %zmm6, %zmm9, %zmm15
vpshufd $27, %zmm2, %zmm2
vpminsd %zmm5, %zmm16, %zmm10
vpmaxsd %zmm8, %zmm13, %zmm13
vpmaxsd %zmm7, %zmm4, %zmm4
vpminsd %zmm18, %zmm17, %zmm19
vpminsd %zmm1, %zmm11, %zmm7
vpmaxsd %zmm18, %zmm17, %zmm17
vpshufd $27, %zmm19, %zmm19
vpminsd %zmm3, %zmm0, %zmm18
vpmaxsd %zmm6, %zmm9, %zmm9
vpmaxsd %zmm1, %zmm11, %zmm1
vpmaxsd %zmm5, %zmm16, %zmm6
vpshufd $27, %zmm20, %zmm5
vpminsd %zmm2, %zmm14, %zmm8
vpshufd $27, %zmm13, %zmm11
vpmaxsd %zmm3, %zmm0, %zmm0
vpminsd %zmm5, %zmm12, %zmm13
vpshufd $27, %zmm10, %zmm3
vpmaxsd %zmm5, %zmm12, %zmm5
vpshufd $27, %zmm9, %zmm9
vpshufd $27, %zmm18, %zmm18
vpshufd $27, %zmm1, %zmm1
vpmaxsd %zmm2, %zmm14, %zmm2
vpminsd %zmm19, %zmm8, %zmm16
vpminsd %zmm3, %zmm15, %zmm12
vpminsd %zmm9, %zmm6, %zmm10
vpshufd $27, %zmm2, %zmm2
vpmaxsd %zmm3, %zmm15, %zmm15
vpminsd %zmm18, %zmm7, %zmm21
vpmaxsd %zmm9, %zmm6, %zmm3
vpmaxsd %zmm19, %zmm8, %zmm8
vpmaxsd %zmm18, %zmm7, %zmm9
vpminsd %zmm1, %zmm0, %zmm19
vpshufd $27, %zmm5, %zmm7
vpmaxsd %zmm1, %zmm0, %zmm0
vpshufd $27, %zmm13, %zmm1
vpminsd %zmm11, %zmm4, %zmm14
vpmaxsd %zmm2, %zmm17, %zmm6
vpmaxsd %zmm11, %zmm4, %zmm4
vpminsd %zmm2, %zmm17, %zmm11
vpminsd %zmm1, %zmm13, %zmm2
vpmaxsd %zmm1, %zmm13, %zmm13
vpminsd %zmm7, %zmm5, %zmm1
vpmaxsd %zmm7, %zmm5, %zmm5
vmovdqa64 %zmm2, %zmm13{%k2}
vpblendmq %zmm1, %zmm5, %zmm7{%k2}
vpshufd $27, %zmm14, %zmm1
vpminsd %zmm1, %zmm14, %zmm2
vpmaxsd %zmm1, %zmm14, %zmm14
vmovdqa64 %zmm2, %zmm14{%k2}
vpshufd $27, %zmm4, %zmm2
vpminsd %zmm2, %zmm4, %zmm1
vpmaxsd %zmm2, %zmm4, %zmm2
vmovdqa64 %zmm1, %zmm2{%k2}
vpshufd $27, %zmm12, %zmm1
vpminsd %zmm1, %zmm12, %zmm4
vpmaxsd %zmm1, %zmm12, %zmm12
vmovdqa64 %zmm4, %zmm12{%k2}
vpshufd $27, %zmm15, %zmm4
vpminsd %zmm4, %zmm15, %zmm1
vpmaxsd %zmm4, %zmm15, %zmm4
vmovdqa64 %zmm1, %zmm4{%k2}
vpshufd $27, %zmm10, %zmm1
vpminsd %zmm1, %zmm10, %zmm5
vpmaxsd %zmm1, %zmm10, %zmm10
vpshufd $27, %zmm3, %zmm1
vmovdqa64 %zmm5, %zmm10{%k2}
vpminsd %zmm1, %zmm3, %zmm5
vpmaxsd %zmm1, %zmm3, %zmm1
vpshufd $27, %zmm16, %zmm3
vmovdqa64 %zmm5, %zmm1{%k2}
vpminsd %zmm3, %zmm16, %zmm5
vpmaxsd %zmm3, %zmm16, %zmm3
vmovdqa64 %zmm5, %zmm3{%k2}
vpshufd $27, %zmm8, %zmm5
vpminsd %zmm5, %zmm8, %zmm15
vpmaxsd %zmm5, %zmm8, %zmm8
vpshufd $27, %zmm11, %zmm5
vmovdqa64 %zmm15, %zmm8{%k2}
vpminsd %zmm5, %zmm11, %zmm15
vpmaxsd %zmm5, %zmm11, %zmm11
vpshufd $27, %zmm6, %zmm5
vmovdqa64 %zmm15, %zmm11{%k2}
vpminsd %zmm5, %zmm6, %zmm15
vpmaxsd %zmm5, %zmm6, %zmm6
vpshufd $27, %zmm21, %zmm5
vmovdqa64 %zmm15, %zmm6{%k2}
vpminsd %zmm5, %zmm21, %zmm15
vpmaxsd %zmm5, %zmm21, %zmm21
vpshufd $27, %zmm9, %zmm5
vmovdqa64 %zmm15, %zmm21{%k2}
vpminsd %zmm5, %zmm9, %zmm15
vpmaxsd %zmm5, %zmm9, %zmm9
vpshufd $27, %zmm19, %zmm5
vmovdqa64 %zmm15, %zmm9{%k2}
vpminsd %zmm5, %zmm19, %zmm15
vpmaxsd %zmm5, %zmm19, %zmm19
vpshufd $27, %zmm0, %zmm5
vmovdqa64 %zmm15, %zmm19{%k2}
vpminsd %zmm5, %zmm0, %zmm20
vpmaxsd %zmm5, %zmm0, %zmm0
vpblendmq %zmm20, %zmm0, %zmm20{%k2}
vpshufd $177, %zmm13, %zmm0
vpmaxsd %zmm13, %zmm0, %zmm5
vpminsd %zmm13, %zmm0, %zmm5{%k1}
vpshufd $177, %zmm7, %zmm0
vpmaxsd %zmm7, %zmm0, %zmm13
vpminsd %zmm7, %zmm0, %zmm13{%k1}
vpshufd $177, %zmm14, %zmm0
vpmaxsd %zmm14, %zmm0, %zmm18
vpminsd %zmm14, %zmm0, %zmm18{%k1}
vpshufd $177, %zmm2, %zmm0
vpmaxsd %zmm2, %zmm0, %zmm17
vpminsd %zmm2, %zmm0, %zmm17{%k1}
vpshufd $177, %zmm12, %zmm0
vpmaxsd %zmm12, %zmm0, %zmm14
vpminsd %zmm12, %zmm0, %zmm14{%k1}
vpshufd $177, %zmm4, %zmm0
vpmaxsd %zmm4, %zmm0, %zmm16
vpminsd %zmm4, %zmm0, %zmm16{%k1}
vpshufd $177, %zmm10, %zmm0
vpshufd $177, %zmm20, %zmm4
vpmaxsd %zmm10, %zmm0, %zmm15
vpminsd %zmm10, %zmm0, %zmm15{%k1}
vpshufd $177, %zmm1, %zmm0
vpmaxsd %zmm1, %zmm0, %zmm12
vpminsd %zmm1, %zmm0, %zmm12{%k1}
vpshufd $177, %zmm3, %zmm0
vpshufd $177, %zmm11, %zmm1
vpmaxsd %zmm3, %zmm0, %zmm7
vpmaxsd %zmm11, %zmm1, %zmm2
vpminsd %zmm3, %zmm0, %zmm7{%k1}
vpshufd $177, %zmm8, %zmm0
vpminsd %zmm11, %zmm1, %zmm2{%k1}
vpmaxsd %zmm8, %zmm0, %zmm10
vpshufd $177, %zmm9, %zmm1
vpminsd %zmm8, %zmm0, %zmm10{%k1}
vpshufd $177, %zmm6, %zmm0
vpmaxsd %zmm9, %zmm1, %zmm3
vpmaxsd %zmm6, %zmm0, %zmm8
vpminsd %zmm9, %zmm1, %zmm3{%k1}
vpminsd %zmm6, %zmm0, %zmm8{%k1}
vpshufd $177, %zmm21, %zmm0
vpmaxsd %zmm21, %zmm0, %zmm6
vpminsd %zmm21, %zmm0, %zmm6{%k1}
vpshufd $177, %zmm19, %zmm0
vpmaxsd %zmm19, %zmm0, %zmm1
vpminsd %zmm19, %zmm0, %zmm1{%k1}
vpmaxsd %zmm20, %zmm4, %zmm0
vpminsd %zmm20, %zmm4, %zmm0{%k1}
cmpq $7, %rsi
jbe .L211
vmovdqa32 .LC1(%rip), %zmm9
movl $51, %eax
kmovb %eax, %k3
vpermd %zmm2, %zmm9, %zmm2
vpermd %zmm1, %zmm9, %zmm1
vpermd %zmm7, %zmm9, %zmm7
vpminsd %zmm1, %zmm13, %zmm21
vpermd %zmm10, %zmm9, %zmm10
vpermd %zmm8, %zmm9, %zmm8
vpermd %zmm6, %zmm9, %zmm6
vpermd %zmm3, %zmm9, %zmm3
vpermd %zmm0, %zmm9, %zmm0
vpminsd %zmm2, %zmm16, %zmm11
vpmaxsd %zmm1, %zmm13, %zmm1
vpminsd %zmm3, %zmm18, %zmm20
vpminsd %zmm6, %zmm17, %zmm19
vpermd %zmm11, %zmm9, %zmm11
vpminsd %zmm0, %zmm5, %zmm22
vpminsd %zmm7, %zmm12, %zmm4
vpermd %zmm1, %zmm9, %zmm1
vpmaxsd %zmm6, %zmm17, %zmm6
vpmaxsd %zmm0, %zmm5, %zmm0
vpminsd %zmm8, %zmm14, %zmm17
vpminsd %zmm10, %zmm15, %zmm5
vpermd %zmm0, %zmm9, %zmm0
vpmaxsd %zmm10, %zmm15, %zmm10
vpmaxsd %zmm3, %zmm18, %zmm3
vpermd %zmm17, %zmm9, %zmm17
vpminsd %zmm1, %zmm10, %zmm13
vpmaxsd %zmm8, %zmm14, %zmm8
vpermd %zmm3, %zmm9, %zmm3
vpmaxsd %zmm2, %zmm16, %zmm2
vpmaxsd %zmm7, %zmm12, %zmm7
vpermd %zmm5, %zmm9, %zmm5
vpermd %zmm6, %zmm9, %zmm12
vpermd %zmm4, %zmm9, %zmm6
vpmaxsd %zmm1, %zmm10, %zmm4
vpminsd %zmm11, %zmm20, %zmm10
vpminsd %zmm5, %zmm21, %zmm18
vpermd %zmm4, %zmm9, %zmm4
vpminsd %zmm0, %zmm7, %zmm16
vpmaxsd %zmm11, %zmm20, %zmm1
vpminsd %zmm6, %zmm22, %zmm14
vpminsd %zmm3, %zmm2, %zmm15
vpminsd %zmm17, %zmm19, %zmm11
vpmaxsd %zmm0, %zmm7, %zmm7
vpermd %zmm15, %zmm9, %zmm15
vpmaxsd %zmm3, %zmm2, %zmm0
vpmaxsd %zmm5, %zmm21, %zmm5
vpermd %zmm11, %zmm9, %zmm11
vpmaxsd %zmm17, %zmm19, %zmm3
vpmaxsd %zmm12, %zmm8, %zmm2
vpermd %zmm5, %zmm9, %zmm5
vpminsd %zmm12, %zmm8, %zmm17
vpmaxsd %zmm6, %zmm22, %zmm6
vpermd %zmm10, %zmm9, %zmm8
vpermd %zmm6, %zmm9, %zmm6
vpermd %zmm17, %zmm9, %zmm17
vpermd %zmm7, %zmm9, %zmm7
vpminsd %zmm8, %zmm18, %zmm19
vpminsd %zmm11, %zmm14, %zmm12
vpmaxsd %zmm8, %zmm18, %zmm10
vpmaxsd %zmm11, %zmm14, %zmm14
vpminsd %zmm6, %zmm3, %zmm8
vpmaxsd %zmm15, %zmm13, %zmm11
vpminsd %zmm5, %zmm1, %zmm18
vpmaxsd %zmm6, %zmm3, %zmm3
vpmaxsd %zmm5, %zmm1, %zmm1
vpminsd %zmm17, %zmm16, %zmm6
vpermd %zmm19, %zmm9, %zmm5
vpmaxsd %zmm17, %zmm16, %zmm16
vpminsd %zmm15, %zmm13, %zmm17
vpermd %zmm18, %zmm9, %zmm18
vpminsd %zmm7, %zmm2, %zmm13
vpmaxsd %zmm7, %zmm2, %zmm2
vpermd %zmm17, %zmm9, %zmm17
vpermd %zmm2, %zmm9, %zmm2
vpminsd %zmm4, %zmm0, %zmm15
vpmaxsd %zmm4, %zmm0, %zmm0
vpermd %zmm14, %zmm9, %zmm4
vpminsd %zmm5, %zmm12, %zmm14
vpminsd %zmm17, %zmm6, %zmm20
vpermd %zmm3, %zmm9, %zmm3
vpermd %zmm15, %zmm9, %zmm15
vpmaxsd %zmm5, %zmm12, %zmm5
vpmaxsd %zmm17, %zmm6, %zmm6
vpminsd %zmm2, %zmm0, %zmm17
vpermd %zmm16, %zmm9, %zmm16
vpmaxsd %zmm2, %zmm0, %zmm0
vpermd %zmm14, %zmm9, %zmm2
vpminsd %zmm4, %zmm10, %zmm12
vpminsd %zmm18, %zmm8, %zmm7
vpmaxsd %zmm4, %zmm10, %zmm4
vpmaxsd %zmm18, %zmm8, %zmm8
vpminsd %zmm3, %zmm1, %zmm10
vpminsd %zmm15, %zmm13, %zmm18
vpmaxsd %zmm3, %zmm1, %zmm1
vpmaxsd %zmm15, %zmm13, %zmm3
vpminsd %zmm2, %zmm14, %zmm13
vpmaxsd %zmm2, %zmm14, %zmm14
vpermd %zmm5, %zmm9, %zmm2
vpminsd %zmm16, %zmm11, %zmm19
vmovdqa64 %zmm13, %zmm14{%k3}
vpminsd %zmm2, %zmm5, %zmm13
vpmaxsd %zmm2, %zmm5, %zmm5
vpermd %zmm12, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm5{%k3}
vpmaxsd %zmm16, %zmm11, %zmm11
vpminsd %zmm2, %zmm12, %zmm13
vpmaxsd %zmm2, %zmm12, %zmm12
vpermd %zmm4, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm12{%k3}
vpminsd %zmm2, %zmm4, %zmm13
vpmaxsd %zmm2, %zmm4, %zmm4
vpermd %zmm7, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm4{%k3}
vpshufd $78, %zmm5, %zmm16
vpminsd %zmm2, %zmm7, %zmm13
vpmaxsd %zmm2, %zmm7, %zmm7
vpermd %zmm8, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm7{%k3}
vpminsd %zmm2, %zmm8, %zmm13
vpmaxsd %zmm2, %zmm8, %zmm8
vpermd %zmm10, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm8{%k3}
vpshufd $78, %zmm12, %zmm15
vpminsd %zmm2, %zmm10, %zmm13
vpmaxsd %zmm2, %zmm10, %zmm10
vpermd %zmm1, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm10{%k3}
vpminsd %zmm2, %zmm1, %zmm13
vpmaxsd %zmm2, %zmm1, %zmm1
vpermd %zmm20, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm1{%k3}
vpminsd %zmm2, %zmm20, %zmm13
vpmaxsd %zmm2, %zmm20, %zmm20
vpermd %zmm6, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm20{%k3}
vpminsd %zmm2, %zmm6, %zmm13
vpmaxsd %zmm2, %zmm6, %zmm6
vpermd %zmm19, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm6{%k3}
vpminsd %zmm2, %zmm19, %zmm13
vpmaxsd %zmm2, %zmm19, %zmm19
vpermd %zmm11, %zmm9, %zmm2
vmovdqa64 %zmm13, %zmm19{%k3}
vpminsd %zmm2, %zmm11, %zmm13
vpmaxsd %zmm2, %zmm11, %zmm2
vpermd %zmm18, %zmm9, %zmm11
vmovdqa64 %zmm13, %zmm2{%k3}
vpminsd %zmm11, %zmm18, %zmm13
vpmaxsd %zmm11, %zmm18, %zmm18
vpermd %zmm3, %zmm9, %zmm11
vmovdqa64 %zmm13, %zmm18{%k3}
vpminsd %zmm11, %zmm3, %zmm13
vpmaxsd %zmm11, %zmm3, %zmm3
vpermd %zmm17, %zmm9, %zmm11
vmovdqa64 %zmm13, %zmm3{%k3}
vpermd %zmm0, %zmm9, %zmm9
vpminsd %zmm11, %zmm17, %zmm13
vpmaxsd %zmm11, %zmm17, %zmm17
vpshufd $78, %zmm2, %zmm21
vmovdqa64 %zmm13, %zmm17{%k3}
vpshufd $78, %zmm14, %zmm13
vpminsd %zmm9, %zmm0, %zmm11
vpmaxsd %zmm9, %zmm0, %zmm0
vpminsd %zmm14, %zmm13, %zmm9
vpmaxsd %zmm14, %zmm13, %zmm13
vpshufd $78, %zmm4, %zmm14
vmovdqa64 %zmm11, %zmm0{%k3}
vmovdqa64 %zmm9, %zmm13{%k2}
vpminsd %zmm5, %zmm16, %zmm9
vpmaxsd %zmm5, %zmm16, %zmm16
vpminsd %zmm12, %zmm15, %zmm5
vpmaxsd %zmm12, %zmm15, %zmm15
vpshufd $78, %zmm7, %zmm12
vmovdqa64 %zmm5, %zmm15{%k2}
vpshufd $78, %zmm8, %zmm11
vpminsd %zmm4, %zmm14, %zmm5
vpmaxsd %zmm4, %zmm14, %zmm14
vpminsd %zmm7, %zmm12, %zmm4
vmovdqa64 %zmm9, %zmm16{%k2}
vpmaxsd %zmm7, %zmm12, %zmm12
vpshufd $78, %zmm10, %zmm7
vmovdqa64 %zmm5, %zmm14{%k2}
vmovdqa64 %zmm4, %zmm12{%k2}
vpminsd %zmm8, %zmm11, %zmm4
vpmaxsd %zmm8, %zmm11, %zmm11
vmovdqa64 %zmm4, %zmm11{%k2}
vpminsd %zmm10, %zmm7, %zmm4
vpmaxsd %zmm10, %zmm7, %zmm7
vmovdqa64 %zmm4, %zmm7{%k2}
vpshufd $78, %zmm20, %zmm10
vpshufd $78, %zmm1, %zmm4
vpminsd %zmm1, %zmm4, %zmm5
vpshufd $78, %zmm6, %zmm8
vpmaxsd %zmm1, %zmm4, %zmm1
vpminsd %zmm20, %zmm10, %zmm4
vpmaxsd %zmm20, %zmm10, %zmm10
vpshufd $78, %zmm18, %zmm20
vmovdqa64 %zmm4, %zmm10{%k2}
vpminsd %zmm6, %zmm8, %zmm4
vpmaxsd %zmm6, %zmm8, %zmm8
vpshufd $78, %zmm19, %zmm6
vmovdqa64 %zmm4, %zmm8{%k2}
vpshufd $78, %zmm0, %zmm9
vpminsd %zmm19, %zmm6, %zmm4
vpmaxsd %zmm19, %zmm6, %zmm6
vpshufd $78, %zmm3, %zmm19
vmovdqa64 %zmm4, %zmm6{%k2}
vpminsd %zmm2, %zmm21, %zmm4
vpmaxsd %zmm2, %zmm21, %zmm21
vpminsd %zmm18, %zmm20, %zmm2
vpmaxsd %zmm18, %zmm20, %zmm20
vmovdqa64 %zmm4, %zmm21{%k2}
vmovdqa64 %zmm2, %zmm20{%k2}
vpshufd $78, %zmm17, %zmm4
vpminsd %zmm3, %zmm19, %zmm2
vpmaxsd %zmm3, %zmm19, %zmm19
vmovdqa64 %zmm5, %zmm1{%k2}
vmovdqa64 %zmm2, %zmm19{%k2}
vpminsd %zmm17, %zmm4, %zmm2
vpmaxsd %zmm17, %zmm4, %zmm4
vmovdqa64 %zmm2, %zmm4{%k2}
vpminsd %zmm0, %zmm9, %zmm2
vpmaxsd %zmm0, %zmm9, %zmm9
vpshufd $177, %zmm13, %zmm0
vmovdqa64 %zmm2, %zmm9{%k2}
vpmaxsd %zmm13, %zmm0, %zmm5
vpminsd %zmm13, %zmm0, %zmm5{%k1}
vpshufd $177, %zmm16, %zmm0
vpmaxsd %zmm16, %zmm0, %zmm13
vpminsd %zmm16, %zmm0, %zmm13{%k1}
vpshufd $177, %zmm15, %zmm0
vpmaxsd %zmm15, %zmm0, %zmm18
vpminsd %zmm15, %zmm0, %zmm18{%k1}
vpshufd $177, %zmm14, %zmm0
vpmaxsd %zmm14, %zmm0, %zmm17
vpminsd %zmm14, %zmm0, %zmm17{%k1}
vpshufd $177, %zmm12, %zmm0
vpmaxsd %zmm12, %zmm0, %zmm14
vpminsd %zmm12, %zmm0, %zmm14{%k1}
vpshufd $177, %zmm11, %zmm0
vpmaxsd %zmm11, %zmm0, %zmm16
vpminsd %zmm11, %zmm0, %zmm16{%k1}
vpshufd $177, %zmm7, %zmm0
vpshufd $177, %zmm9, %zmm11
vpmaxsd %zmm7, %zmm0, %zmm15
vpminsd %zmm7, %zmm0, %zmm15{%k1}
vpshufd $177, %zmm1, %zmm0
vpmaxsd %zmm1, %zmm0, %zmm12
vpminsd %zmm1, %zmm0, %zmm12{%k1}
vpshufd $177, %zmm10, %zmm0
vpshufd $177, %zmm19, %zmm1
vpmaxsd %zmm10, %zmm0, %zmm7
vpmaxsd %zmm19, %zmm1, %zmm3
vpminsd %zmm10, %zmm0, %zmm7{%k1}
vpshufd $177, %zmm8, %zmm0
vpminsd %zmm19, %zmm1, %zmm3{%k1}
vpmaxsd %zmm8, %zmm0, %zmm10
vpminsd %zmm8, %zmm0, %zmm10{%k1}
vpshufd $177, %zmm6, %zmm0
vpmaxsd %zmm6, %zmm0, %zmm2
vpminsd %zmm6, %zmm0, %zmm2{%k1}
vpshufd $177, %zmm21, %zmm0
vpmaxsd %zmm21, %zmm0, %zmm8
vpminsd %zmm21, %zmm0, %zmm8{%k1}
vpshufd $177, %zmm20, %zmm0
vpmaxsd %zmm20, %zmm0, %zmm6
vpminsd %zmm20, %zmm0, %zmm6{%k1}
vpshufd $177, %zmm4, %zmm0
vpmaxsd %zmm4, %zmm0, %zmm1
vpminsd %zmm4, %zmm0, %zmm1{%k1}
vpmaxsd %zmm9, %zmm11, %zmm0
vmovdqa32 %zmm0, %zmm4
vpminsd %zmm9, %zmm11, %zmm4{%k1}
vmovdqa64 %zmm4, %zmm0
cmpq $15, %rsi
jbe .L211
vmovdqa32 .LC2(%rip), %zmm0
movl $65535, %eax
kmovd %eax, %k1
movl $51, %eax
vpermd %zmm6, %zmm0, %zmm11
vpermd %zmm10, %zmm0, %zmm10
vpermd %zmm4, %zmm0, %zmm6
vpermd %zmm2, %zmm0, %zmm2
vpermd %zmm1, %zmm0, %zmm1
vpminsd %zmm6, %zmm5, %zmm20
vpminsd %zmm1, %zmm13, %zmm19
vpermd %zmm8, %zmm0, %zmm8
vpermd %zmm7, %zmm0, %zmm7
vpermd %zmm3, %zmm0, %zmm3
vpmaxsd %zmm6, %zmm5, %zmm6
vpmaxsd %zmm1, %zmm13, %zmm1
vpminsd %zmm10, %zmm15, %zmm5
vpminsd %zmm2, %zmm16, %zmm13
vpermd %zmm6, %zmm0, %zmm6
vpminsd %zmm3, %zmm18, %zmm9
vpermd %zmm5, %zmm0, %zmm5
vpminsd %zmm8, %zmm14, %zmm4
vpmaxsd %zmm3, %zmm18, %zmm3
vpminsd %zmm11, %zmm17, %zmm18
vpermd %zmm1, %zmm0, %zmm1
vpmaxsd %zmm11, %zmm17, %zmm11
vpmaxsd %zmm8, %zmm14, %zmm17
vpermd %zmm3, %zmm0, %zmm3
vpminsd %zmm7, %zmm12, %zmm8
vpmaxsd %zmm7, %zmm12, %zmm7
vpermd %zmm13, %zmm0, %zmm12
vpmaxsd %zmm10, %zmm15, %zmm10
vpminsd %zmm6, %zmm7, %zmm13
vpermd %zmm11, %zmm0, %zmm15
vpminsd %zmm5, %zmm19, %zmm14
vpmaxsd %zmm2, %zmm16, %zmm2
vpermd %zmm4, %zmm0, %zmm4
vpermd %zmm8, %zmm0, %zmm8
vpmaxsd %zmm6, %zmm7, %zmm6
vpmaxsd %zmm5, %zmm19, %zmm7
vpminsd %zmm12, %zmm9, %zmm19
vpminsd %zmm8, %zmm20, %zmm16
vpermd %zmm7, %zmm0, %zmm7
vpminsd %zmm1, %zmm10, %zmm11
vpermd %zmm19, %zmm0, %zmm19
vpmaxsd %zmm1, %zmm10, %zmm5
vpmaxsd %zmm8, %zmm20, %zmm8
vpmaxsd %zmm12, %zmm9, %zmm1
vpermd %zmm5, %zmm0, %zmm5
vpminsd %zmm3, %zmm2, %zmm12
vpminsd %zmm4, %zmm18, %zmm9
vpermd %zmm8, %zmm0, %zmm8
vpmaxsd %zmm4, %zmm18, %zmm4
vpminsd %zmm15, %zmm17, %zmm18
vpermd %zmm9, %zmm0, %zmm9
vpermd %zmm12, %zmm0, %zmm12
vpermd %zmm18, %zmm0, %zmm18
vpermd %zmm6, %zmm0, %zmm6
vpmaxsd %zmm3, %zmm2, %zmm2
vpmaxsd %zmm15, %zmm17, %zmm3
vpminsd %zmm19, %zmm14, %zmm17
vpminsd %zmm9, %zmm16, %zmm15
vpmaxsd %zmm9, %zmm16, %zmm10
vpmaxsd %zmm19, %zmm14, %zmm14
vpminsd %zmm8, %zmm4, %zmm9
vpminsd %zmm7, %zmm1, %zmm16
vpminsd %zmm12, %zmm11, %zmm19
vpmaxsd %zmm7, %zmm1, %zmm1
vpermd %zmm16, %zmm0, %zmm16
vpminsd %zmm18, %zmm13, %zmm7
vpmaxsd %zmm12, %zmm11, %zmm11
vpermd %zmm19, %zmm0, %zmm19
vpminsd %zmm5, %zmm2, %zmm12
vpmaxsd %zmm8, %zmm4, %zmm4
vpmaxsd %zmm18, %zmm13, %zmm13
vpminsd %zmm6, %zmm3, %zmm8
vpermd %zmm4, %zmm0, %zmm4
vpmaxsd %zmm6, %zmm3, %zmm3
vpermd %zmm17, %zmm0, %zmm6
vpermd %zmm13, %zmm0, %zmm13
vpermd %zmm12, %zmm0, %zmm12
vpermd %zmm3, %zmm0, %zmm3
vpmaxsd %zmm5, %zmm2, %zmm2
vpermd %zmm10, %zmm0, %zmm5
vpminsd %zmm6, %zmm15, %zmm10
vpminsd %zmm16, %zmm9, %zmm17
vpminsd %zmm5, %zmm14, %zmm18
vpmaxsd %zmm6, %zmm15, %zmm6
vpmaxsd %zmm5, %zmm14, %zmm5
vpmaxsd %zmm16, %zmm9, %zmm9
vpminsd %zmm13, %zmm11, %zmm14
vpminsd %zmm4, %zmm1, %zmm16
vpmaxsd %zmm13, %zmm11, %zmm11
vpmaxsd %zmm4, %zmm1, %zmm1
vpminsd %zmm12, %zmm8, %zmm13
vpmaxsd %zmm12, %zmm8, %zmm4
vpminsd %zmm3, %zmm2, %zmm8
vpmaxsd %zmm3, %zmm2, %zmm2
vpermd %zmm10, %zmm0, %zmm3
vpminsd %zmm3, %zmm10, %zmm12
vpmaxsd %zmm3, %zmm10, %zmm10
vpermd %zmm6, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm10{%k1}
vpminsd %zmm3, %zmm6, %zmm12
vpmaxsd %zmm3, %zmm6, %zmm6
vpermd %zmm18, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm6{%k1}
vpminsd %zmm19, %zmm7, %zmm15
vpminsd %zmm3, %zmm18, %zmm12
vpmaxsd %zmm3, %zmm18, %zmm18
vpermd %zmm5, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm18{%k1}
vpminsd %zmm3, %zmm5, %zmm12
vpmaxsd %zmm3, %zmm5, %zmm5
vpermd %zmm17, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm5{%k1}
vpmaxsd %zmm19, %zmm7, %zmm7
vpminsd %zmm3, %zmm17, %zmm12
vpmaxsd %zmm3, %zmm17, %zmm17
vpermd %zmm9, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm17{%k1}
vpminsd %zmm3, %zmm9, %zmm12
vpmaxsd %zmm3, %zmm9, %zmm9
vpermd %zmm16, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm9{%k1}
vshufi32x4 $177, %zmm5, %zmm5, %zmm22
vpminsd %zmm3, %zmm16, %zmm12
vpmaxsd %zmm3, %zmm16, %zmm16
vpermd %zmm1, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm16{%k1}
vpminsd %zmm3, %zmm1, %zmm12
vpmaxsd %zmm3, %zmm1, %zmm1
vpermd %zmm15, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm1{%k1}
vshufi32x4 $177, %zmm17, %zmm17, %zmm21
vpminsd %zmm3, %zmm15, %zmm12
vpmaxsd %zmm3, %zmm15, %zmm15
vpermd %zmm7, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm15{%k1}
vpminsd %zmm3, %zmm7, %zmm12
vpmaxsd %zmm3, %zmm7, %zmm7
vpermd %zmm14, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm7{%k1}
vshufi32x4 $177, %zmm9, %zmm9, %zmm20
vpminsd %zmm3, %zmm14, %zmm12
vpmaxsd %zmm3, %zmm14, %zmm14
vpermd %zmm11, %zmm0, %zmm3
vmovdqu16 %zmm12, %zmm14{%k1}
vpminsd %zmm3, %zmm11, %zmm12
vpmaxsd %zmm3, %zmm11, %zmm3
vpermd %zmm13, %zmm0, %zmm11
vmovdqu16 %zmm12, %zmm3{%k1}
vshufi32x4 $177, %zmm16, %zmm16, %zmm19
vpminsd %zmm11, %zmm13, %zmm12
vpmaxsd %zmm11, %zmm13, %zmm13
vpermd %zmm4, %zmm0, %zmm11
vmovdqu16 %zmm12, %zmm13{%k1}
vpminsd %zmm11, %zmm4, %zmm12
vpmaxsd %zmm11, %zmm4, %zmm4
vpermd %zmm8, %zmm0, %zmm11
vmovdqu16 %zmm12, %zmm4{%k1}
vpermd %zmm2, %zmm0, %zmm0
vpminsd %zmm11, %zmm8, %zmm12
vpmaxsd %zmm11, %zmm8, %zmm8
vmovdqu16 %zmm12, %zmm8{%k1}
vpminsd %zmm0, %zmm2, %zmm11
vshufi32x4 $177, %zmm10, %zmm10, %zmm12
vpmaxsd %zmm0, %zmm2, %zmm0
vpminsd %zmm10, %zmm12, %zmm2
vmovdqu16 %zmm11, %zmm0{%k1}
vpmaxsd %zmm10, %zmm12, %zmm12
kmovb %eax, %k1
vshufi32x4 $177, %zmm6, %zmm6, %zmm11
vmovdqa64 %zmm2, %zmm12{%k1}
vpminsd %zmm6, %zmm11, %zmm2
vpmaxsd %zmm6, %zmm11, %zmm11
movl $85, %eax
vshufi32x4 $177, %zmm18, %zmm18, %zmm10
vmovdqa64 %zmm2, %zmm11{%k1}
vshufi32x4 $177, %zmm14, %zmm14, %zmm6
vpminsd %zmm18, %zmm10, %zmm2
vpmaxsd %zmm18, %zmm10, %zmm10
vshufi32x4 $177, %zmm15, %zmm15, %zmm18
vmovdqa64 %zmm2, %zmm10{%k1}
vpminsd %zmm5, %zmm22, %zmm2
vpmaxsd %zmm5, %zmm22, %zmm22
vmovdqa64 %zmm2, %zmm22{%k1}
vpminsd %zmm17, %zmm21, %zmm2
vpmaxsd %zmm17, %zmm21, %zmm21
vmovdqa64 %zmm2, %zmm21{%k1}
vpminsd %zmm9, %zmm20, %zmm2
vpmaxsd %zmm9, %zmm20, %zmm20
vmovdqa64 %zmm2, %zmm20{%k1}
vpminsd %zmm16, %zmm19, %zmm2
vpmaxsd %zmm16, %zmm19, %zmm19
vmovdqa64 %zmm2, %zmm19{%k1}
vshufi32x4 $177, %zmm1, %zmm1, %zmm2
vshufi32x4 $177, %zmm7, %zmm7, %zmm17
vpminsd %zmm1, %zmm2, %zmm5
vpmaxsd %zmm1, %zmm2, %zmm2
vshufi32x4 $177, %zmm3, %zmm3, %zmm16
vpminsd %zmm15, %zmm18, %zmm1
vpmaxsd %zmm15, %zmm18, %zmm18
vshufi32x4 $177, %zmm13, %zmm13, %zmm15
vmovdqa64 %zmm1, %zmm18{%k1}
vpminsd %zmm7, %zmm17, %zmm1
vpmaxsd %zmm7, %zmm17, %zmm17
vmovdqa64 %zmm1, %zmm17{%k1}
vpminsd %zmm14, %zmm6, %zmm1
vpmaxsd %zmm14, %zmm6, %zmm6
vmovdqa64 %zmm1, %zmm6{%k1}
vpminsd %zmm3, %zmm16, %zmm1
vpmaxsd %zmm3, %zmm16, %zmm16
vmovdqa64 %zmm1, %zmm16{%k1}
vshufi32x4 $177, %zmm4, %zmm4, %zmm14
vpminsd %zmm13, %zmm15, %zmm1
vpmaxsd %zmm13, %zmm15, %zmm15
vshufi32x4 $177, %zmm8, %zmm8, %zmm9
vmovdqa64 %zmm5, %zmm2{%k1}
vmovdqa64 %zmm1, %zmm15{%k1}
vpminsd %zmm4, %zmm14, %zmm1
vpmaxsd %zmm4, %zmm14, %zmm14
vmovdqa64 %zmm1, %zmm14{%k1}
vshufi32x4 $177, %zmm0, %zmm0, %zmm5
vpminsd %zmm8, %zmm9, %zmm1
vpshufd $78, %zmm12, %zmm13
vpmaxsd %zmm8, %zmm9, %zmm9
vpshufd $78, %zmm21, %zmm7
vmovdqa64 %zmm1, %zmm9{%k1}
vpminsd %zmm0, %zmm5, %zmm1
vpmaxsd %zmm0, %zmm5, %zmm5
vpminsd %zmm12, %zmm13, %zmm0
vpmaxsd %zmm12, %zmm13, %zmm13
vpshufd $78, %zmm11, %zmm12
vmovdqa64 %zmm1, %zmm5{%k1}
kmovb %eax, %k1
vmovdqa64 %zmm0, %zmm13{%k1}
vpminsd %zmm11, %zmm12, %zmm0
vpmaxsd %zmm11, %zmm12, %zmm12
vpshufd $78, %zmm10, %zmm11
vpshufd $78, %zmm20, %zmm4
movl $21845, %eax
vmovdqa64 %zmm0, %zmm12{%k1}
vpminsd %zmm10, %zmm11, %zmm0
vpmaxsd %zmm10, %zmm11, %zmm11
vpshufd $78, %zmm22, %zmm10
vmovdqa64 %zmm0, %zmm11{%k1}
vpshufd $78, %zmm19, %zmm3
vpminsd %zmm22, %zmm10, %zmm0
vpmaxsd %zmm22, %zmm10, %zmm10
vpshufd $78, %zmm2, %zmm1
vmovdqa64 %zmm0, %zmm10{%k1}
vpminsd %zmm21, %zmm7, %zmm0
vpmaxsd %zmm21, %zmm7, %zmm7
vmovdqa64 %zmm0, %zmm7{%k1}
vpminsd %zmm20, %zmm4, %zmm0
vpmaxsd %zmm20, %zmm4, %zmm4
vmovdqa64 %zmm0, %zmm4{%k1}
vpminsd %zmm19, %zmm3, %zmm0
vpmaxsd %zmm19, %zmm3, %zmm3
vmovdqa64 %zmm0, %zmm3{%k1}
vpminsd %zmm2, %zmm1, %zmm0
vpmaxsd %zmm2, %zmm1, %zmm1
vpshufd $78, %zmm18, %zmm2
vmovdqa64 %zmm0, %zmm1{%k1}
vpshufd $78, %zmm15, %zmm21
vpminsd %zmm18, %zmm2, %zmm0
vpmaxsd %zmm18, %zmm2, %zmm2
vpshufd $78, %zmm14, %zmm20
vmovdqa64 %zmm0, %zmm2{%k1}
vpshufd $78, %zmm17, %zmm0
vpshufd $78, %zmm9, %zmm19
vpminsd %zmm17, %zmm0, %zmm8
vpmaxsd %zmm17, %zmm0, %zmm0
vmovdqa64 %zmm8, %zmm0{%k1}
vpshufd $78, %zmm6, %zmm8
vpminsd %zmm6, %zmm8, %zmm17
vpmaxsd %zmm6, %zmm8, %zmm8
vpshufd $78, %zmm16, %zmm6
vmovdqa64 %zmm17, %zmm8{%k1}
vpminsd %zmm16, %zmm6, %zmm17
vpmaxsd %zmm16, %zmm6, %zmm6
vpminsd %zmm15, %zmm21, %zmm16
vpmaxsd %zmm15, %zmm21, %zmm21
vmovdqa64 %zmm17, %zmm6{%k1}
vpminsd %zmm14, %zmm20, %zmm15
vpmaxsd %zmm14, %zmm20, %zmm20
vmovdqa64 %zmm16, %zmm21{%k1}
vpminsd %zmm9, %zmm19, %zmm14
vpmaxsd %zmm9, %zmm19, %zmm19
vpshufd $78, %zmm5, %zmm9
vmovdqa64 %zmm14, %zmm19{%k1}
vpminsd %zmm5, %zmm9, %zmm14
vpmaxsd %zmm5, %zmm9, %zmm9
vmovdqa64 %zmm14, %zmm9{%k1}
vpshufd $177, %zmm13, %zmm14
vmovdqa64 %zmm15, %zmm20{%k1}
kmovw %eax, %k1
vpmaxsd %zmm13, %zmm14, %zmm5
vpminsd %zmm13, %zmm14, %zmm5{%k1}
vpshufd $177, %zmm12, %zmm14
vpmaxsd %zmm12, %zmm14, %zmm13
vpminsd %zmm12, %zmm14, %zmm13{%k1}
vpshufd $177, %zmm11, %zmm12
vpmaxsd %zmm11, %zmm12, %zmm18
vpminsd %zmm11, %zmm12, %zmm18{%k1}
vpshufd $177, %zmm10, %zmm11
vpmaxsd %zmm10, %zmm11, %zmm17
vpminsd %zmm10, %zmm11, %zmm17{%k1}
vpshufd $177, %zmm7, %zmm10
vpmaxsd %zmm7, %zmm10, %zmm14
vpminsd %zmm7, %zmm10, %zmm14{%k1}
vpshufd $177, %zmm4, %zmm7
vpmaxsd %zmm4, %zmm7, %zmm16
vpminsd %zmm4, %zmm7, %zmm16{%k1}
vpshufd $177, %zmm3, %zmm4
vpmaxsd %zmm3, %zmm4, %zmm15
vpminsd %zmm3, %zmm4, %zmm15{%k1}
vpshufd $177, %zmm1, %zmm3
vpshufd $177, %zmm9, %zmm4
vpmaxsd %zmm1, %zmm3, %zmm12
vpminsd %zmm1, %zmm3, %zmm12{%k1}
vpshufd $177, %zmm0, %zmm1
vpshufd $177, %zmm2, %zmm3
vpmaxsd %zmm0, %zmm1, %zmm10
vpmaxsd %zmm2, %zmm3, %zmm7
vpminsd %zmm0, %zmm1, %zmm10{%k1}
vpshufd $177, %zmm8, %zmm1
vpshufd $177, %zmm6, %zmm0
vpminsd %zmm2, %zmm3, %zmm7{%k1}
vpmaxsd %zmm8, %zmm1, %zmm2
vpminsd %zmm8, %zmm1, %zmm2{%k1}
vpmaxsd %zmm6, %zmm0, %zmm8
vpshufd $177, %zmm20, %zmm1
vpminsd %zmm6, %zmm0, %zmm8{%k1}
vpshufd $177, %zmm21, %zmm0
vpmaxsd %zmm20, %zmm1, %zmm3
vpmaxsd %zmm21, %zmm0, %zmm6
vpminsd %zmm20, %zmm1, %zmm3{%k1}
vpminsd %zmm21, %zmm0, %zmm6{%k1}
vpshufd $177, %zmm19, %zmm0
vpmaxsd %zmm19, %zmm0, %zmm1
vpminsd %zmm19, %zmm0, %zmm1{%k1}
vpmaxsd %zmm9, %zmm4, %zmm0
vpminsd %zmm9, %zmm4, %zmm0{%k1}
.L211:
vmovq %xmm26, %rax
vmovdqu64 %zmm5, (%rdi)
vmovdqu64 %zmm13, (%r15)
vmovdqu64 %zmm18, (%r14)
vmovdqu64 %zmm17, 0(%r13)
vmovdqu64 %zmm14, (%r12)
vmovdqu64 %zmm16, (%rbx)
vmovdqu64 %zmm15, (%r11)
vmovdqu64 %zmm12, (%r10)
vmovdqu64 %zmm7, (%r9)
vmovdqu64 %zmm10, (%r8)
vmovdqu64 %zmm2, (%rax)
vmovq %xmm25, %rax
vmovdqu64 %zmm8, (%rax)
vmovq %xmm27, %rax
vmovdqu64 %zmm6, (%rax)
vmovq %xmm24, %rax
vmovdqu64 %zmm3, (%rdx)
vmovdqu64 %zmm1, (%rax)
movq (%rsp), %rax
vmovdqu64 %zmm0, (%rax)
vzeroupper
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE18789:
.size _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, .-_ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
.section .text._ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18790:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
vmovdqa %ymm0, %ymm3
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
movq %rdx, %r15
pushq %r14
.cfi_offset 14, -32
movq %rsi, %r14
pushq %r13
pushq %r12
.cfi_offset 13, -40
.cfi_offset 12, -48
movq %rdi, %r12
pushq %rbx
andq $-32, %rsp
subq $96, %rsp
.cfi_offset 3, -56
cmpq $7, %rsi
jbe .L231
vmovdqa %ymm0, %ymm5
vmovdqa %ymm1, %ymm6
movl $8, %r13d
xorl %ebx, %ebx
jmp .L222
.p2align 4,,10
.p2align 3
.L218:
vmovmskps %ymm2, %eax
vmovdqu %ymm3, (%rsi)
popcntq %rax, %rax
addq %rax, %rbx
leaq 8(%r13), %rax
cmpq %r14, %rax
ja .L239
movq %rax, %r13
.L222:
vpcmpeqd -32(%r12,%r13,4), %ymm6, %ymm0
vpcmpeqd -32(%r12,%r13,4), %ymm5, %ymm2
leaq -8(%r13), %rdx
leaq (%r12,%rbx,4), %rsi
vmovdqa %ymm0, %ymm4
vpor %ymm2, %ymm0, %ymm0
vmovmskps %ymm0, %eax
cmpl $255, %eax
je .L218
vpcmpeqd %ymm0, %ymm0, %ymm0
vpxor %ymm0, %ymm4, %ymm4
vpandn %ymm4, %ymm2, %ymm2
vmovmskps %ymm2, %eax
tzcntl %eax, %eax
addq %rdx, %rax
vpbroadcastd (%r12,%rax,4), %ymm0
leaq 8(%rbx), %rax
vmovdqa %ymm0, (%r15)
cmpq %rdx, %rax
ja .L219
.p2align 4,,10
.p2align 3
.L220:
vmovdqu %ymm1, -32(%r12,%rax,4)
movq %rax, %rbx
addq $8, %rax
cmpq %rax, %rdx
jnb .L220
.L219:
subq %rbx, %rdx
xorl %eax, %eax
vmovd %edx, %xmm0
vpbroadcastd %xmm0, %ymm0
vpcmpgtd .LC3(%rip), %ymm0, %ymm0
vpmaskmovd %ymm1, %ymm0, (%r12,%rbx,4)
.L216:
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L239:
.cfi_restore_state
movq %r14, %r8
leaq 0(,%r13,4), %rsi
leaq (%r12,%rbx,4), %r9
subq %r13, %r8
.L217:
testq %r8, %r8
je .L226
leaq 0(,%r8,4), %rdx
addq %r12, %rsi
movq %rcx, %rdi
movq %r9, 80(%rsp)
movq %r8, 88(%rsp)
vmovdqa %ymm1, (%rsp)
vmovdqa %ymm3, 32(%rsp)
vzeroupper
call memcpy@PLT
movq 88(%rsp), %r8
movq 80(%rsp), %r9
vmovdqa 32(%rsp), %ymm3
vmovdqa (%rsp), %ymm1
movq %rax, %rcx
.L226:
vmovdqa (%rcx), %ymm4
vmovdqa .LC3(%rip), %ymm5
vmovd %r8d, %xmm2
vpbroadcastd %xmm2, %ymm2
vpcmpeqd %ymm3, %ymm4, %ymm0
vpcmpgtd %ymm5, %ymm2, %ymm2
vpcmpeqd %ymm1, %ymm4, %ymm4
vpand %ymm0, %ymm2, %ymm7
vpor %ymm4, %ymm0, %ymm0
vpcmpeqd %ymm4, %ymm4, %ymm4
vpxor %ymm2, %ymm4, %ymm6
vpor %ymm6, %ymm0, %ymm0
vmovmskps %ymm0, %eax
cmpl $255, %eax
jne .L240
vmovmskps %ymm7, %edx
vpmaskmovd %ymm3, %ymm2, (%r9)
popcntq %rdx, %rdx
addq %rbx, %rdx
leaq 8(%rdx), %rax
cmpq %r14, %rax
ja .L229
.p2align 4,,10
.p2align 3
.L230:
vmovdqu %ymm1, -32(%r12,%rax,4)
movq %rax, %rdx
addq $8, %rax
cmpq %rax, %r14
jnb .L230
.L229:
subq %rdx, %r14
movl $1, %eax
vmovd %r14d, %xmm0
vpbroadcastd %xmm0, %ymm0
vpcmpgtd %ymm5, %ymm0, %ymm0
vpmaskmovd %ymm1, %ymm0, (%r12,%rdx,4)
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.L231:
.cfi_restore_state
movq %rsi, %r8
movq %rdi, %r9
xorl %esi, %esi
xorl %ebx, %ebx
xorl %r13d, %r13d
jmp .L217
.L240:
vpxor %ymm4, %ymm0, %ymm0
vmovmskps %ymm0, %eax
tzcntl %eax, %eax
addq %r13, %rax
vpbroadcastd (%r12,%rax,4), %ymm0
leaq 8(%rbx), %rax
vmovdqa %ymm0, (%r15)
cmpq %rax, %r13
jb .L227
.p2align 4,,10
.p2align 3
.L228:
vmovdqu %ymm1, -32(%r12,%rax,4)
movq %rax, %rbx
leaq 8(%rax), %rax
cmpq %rax, %r13
jnb .L228
leaq (%r12,%rbx,4), %r9
.L227:
subq %rbx, %r13
xorl %eax, %eax
vmovd %r13d, %xmm0
vpbroadcastd %xmm0, %ymm0
vpcmpgtd %ymm5, %ymm0, %ymm0
vpmaskmovd %ymm1, %ymm0, (%r9)
jmp .L216
.cfi_endproc
.LFE18790:
.size _ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, @function
_ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0:
.LFB18791:
.cfi_startproc
cmpq %rdx, %rsi
jbe .L254
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r10
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rax, %rsi
jbe .L254
movl (%rdi,%rdx,4), %r11d
vmovd %r11d, %xmm4
vpshufd $0, %xmm4, %xmm0
jmp .L244
.p2align 4,,10
.p2align 3
.L245:
cmpq %rcx, %rsi
jbe .L254
movq %rdx, %rax
.L250:
vbroadcastss (%rdi,%r10,8), %xmm1
vpcmpgtd %xmm3, %xmm1, %xmm1
vmovmskps %xmm1, %r8d
andl $1, %r8d
jne .L247
.L246:
cmpq %rdx, %rax
je .L254
leaq (%rdi,%rax,4), %rdx
movl (%rdx), %ecx
movl %ecx, (%r9)
movl %r11d, (%rdx)
cmpq %rax, %rsi
jbe .L255
movq %rax, %rdx
.L248:
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r10
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rsi, %rax
jnb .L254
.L244:
vbroadcastss (%rdi,%rax,4), %xmm1
leaq (%rdi,%rdx,4), %r9
vmovdqa %xmm0, %xmm3
vpcmpgtd %xmm0, %xmm1, %xmm2
vmovmskps %xmm2, %r8d
andl $1, %r8d
je .L245
cmpq %rcx, %rsi
jbe .L246
vmovdqa %xmm1, %xmm3
jmp .L250
.p2align 4,,10
.p2align 3
.L247:
cmpq %rcx, %rdx
je .L256
leaq (%rdi,%rcx,4), %rax
movl (%rax), %edx
movl %edx, (%r9)
movq %rcx, %rdx
movl %r11d, (%rax)
jmp .L248
.p2align 4,,10
.p2align 3
.L254:
ret
.p2align 4,,10
.p2align 3
.L255:
ret
.L256:
ret
.cfi_endproc
.LFE18791:
.size _ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, .-_ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
.section .text._ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18792:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movdqa %xmm0, %xmm3
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
movq %rdx, %r15
pushq %r14
.cfi_offset 14, -32
movq %rsi, %r14
pushq %r13
pushq %r12
.cfi_offset 13, -40
.cfi_offset 12, -48
movq %rdi, %r12
pushq %rbx
subq $56, %rsp
.cfi_offset 3, -56
cmpq $3, %rsi
jbe .L288
movdqa %xmm0, %xmm6
movdqa %xmm1, %xmm5
movl $4, %r13d
xorl %ebx, %ebx
jmp .L267
.p2align 4,,10
.p2align 3
.L259:
movmskps %xmm2, %eax
movups %xmm3, (%r12,%rbx,4)
popcntq %rax, %rax
addq %rax, %rbx
leaq 4(%r13), %rax
cmpq %r14, %rax
ja .L344
movq %rax, %r13
.L267:
movdqu -16(%r12,%r13,4), %xmm2
movdqu -16(%r12,%r13,4), %xmm0
leaq -4(%r13), %rdx
pcmpeqd %xmm5, %xmm0
pcmpeqd %xmm6, %xmm2
movdqa %xmm0, %xmm4
por %xmm2, %xmm0
movmskps %xmm0, %eax
cmpl $15, %eax
je .L259
pcmpeqd %xmm0, %xmm0
pxor %xmm0, %xmm4
pandn %xmm4, %xmm2
movmskps %xmm2, %eax
rep bsfl %eax, %eax
cltq
addq %rdx, %rax
movd (%r12,%rax,4), %xmm7
leaq 4(%rbx), %rax
pshufd $0, %xmm7, %xmm0
movaps %xmm0, (%r15)
cmpq %rdx, %rax
ja .L260
.p2align 4,,10
.p2align 3
.L261:
movups %xmm1, -16(%r12,%rax,4)
movq %rax, %rbx
addq $4, %rax
cmpq %rdx, %rax
jbe .L261
.L260:
subq %rbx, %rdx
leaq 0(,%rbx,4), %rcx
movd %edx, %xmm7
pshufd $0, %xmm7, %xmm0
pcmpgtd .LC0(%rip), %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L262
movd %xmm1, (%r12,%rbx,4)
.L262:
pextrd $1, %xmm0, %eax
testl %eax, %eax
je .L263
pextrd $1, %xmm1, 4(%r12,%rcx)
.L263:
pextrd $2, %xmm0, %eax
testl %eax, %eax
je .L264
pextrd $2, %xmm1, 8(%r12,%rcx)
.L264:
pextrd $3, %xmm0, %eax
testl %eax, %eax
jne .L345
.L277:
addq $56, %rsp
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L345:
.cfi_restore_state
pextrd $3, %xmm1, 12(%r12,%rcx)
jmp .L277
.p2align 4,,10
.p2align 3
.L344:
movq %r14, %r8
leaq 0(,%r13,4), %rsi
leaq 0(,%rbx,4), %r9
subq %r13, %r8
.L258:
testq %r8, %r8
je .L271
leaq 0(,%r8,4), %rdx
movq %rcx, %rdi
addq %r12, %rsi
movq %r9, -64(%rbp)
movq %r8, -56(%rbp)
movaps %xmm1, -96(%rbp)
movaps %xmm3, -80(%rbp)
call memcpy@PLT
movq -56(%rbp), %r8
movq -64(%rbp), %r9
movdqa -80(%rbp), %xmm3
movdqa -96(%rbp), %xmm1
movq %rax, %rcx
.L271:
movdqa (%rcx), %xmm4
movd %r8d, %xmm7
movdqa .LC0(%rip), %xmm5
pshufd $0, %xmm7, %xmm0
pcmpgtd %xmm5, %xmm0
movdqa %xmm4, %xmm2
pcmpeqd %xmm3, %xmm2
pcmpeqd %xmm1, %xmm4
movdqa %xmm0, %xmm7
pand %xmm2, %xmm7
por %xmm4, %xmm2
pcmpeqd %xmm4, %xmm4
movdqa %xmm4, %xmm6
pxor %xmm0, %xmm6
por %xmm6, %xmm2
movmskps %xmm2, %eax
cmpl $15, %eax
jne .L346
movd %xmm0, %eax
testl %eax, %eax
je .L278
movd %xmm3, (%r12,%r9)
.L278:
pextrd $1, %xmm0, %eax
testl %eax, %eax
je .L279
pextrd $1, %xmm3, 4(%r12,%r9)
.L279:
pextrd $2, %xmm0, %eax
testl %eax, %eax
je .L280
pextrd $2, %xmm3, 8(%r12,%r9)
.L280:
pextrd $3, %xmm0, %eax
testl %eax, %eax
jne .L347
.L281:
movmskps %xmm7, %edx
popcntq %rdx, %rdx
addq %rbx, %rdx
leaq 4(%rdx), %rax
cmpq %rax, %r14
jb .L282
.p2align 4,,10
.p2align 3
.L283:
movups %xmm1, -16(%r12,%rax,4)
movq %rax, %rdx
addq $4, %rax
cmpq %rax, %r14
jnb .L283
.L282:
subq %rdx, %r14
leaq 0(,%rdx,4), %rcx
movd %r14d, %xmm7
pshufd $0, %xmm7, %xmm0
pcmpgtd %xmm5, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L284
movd %xmm1, (%r12,%rdx,4)
.L284:
pextrd $1, %xmm0, %eax
testl %eax, %eax
je .L285
pextrd $1, %xmm1, 4(%r12,%rcx)
.L285:
pextrd $2, %xmm0, %eax
testl %eax, %eax
je .L286
pextrd $2, %xmm1, 8(%r12,%rcx)
.L286:
pextrd $3, %xmm0, %eax
testl %eax, %eax
je .L287
pextrd $3, %xmm1, 12(%r12,%rcx)
.L287:
addq $56, %rsp
movl $1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L347:
.cfi_restore_state
pextrd $3, %xmm3, 12(%r12,%r9)
jmp .L281
.L288:
movq %rsi, %r8
xorl %r9d, %r9d
xorl %esi, %esi
xorl %ebx, %ebx
xorl %r13d, %r13d
jmp .L258
.L346:
pxor %xmm4, %xmm2
movmskps %xmm2, %eax
rep bsfl %eax, %eax
cltq
addq %r13, %rax
movd (%r12,%rax,4), %xmm7
leaq 4(%rbx), %rax
pshufd $0, %xmm7, %xmm0
movaps %xmm0, (%r15)
cmpq %rax, %r13
jb .L272
.p2align 4,,10
.p2align 3
.L273:
movups %xmm1, -16(%r12,%rax,4)
movq %rax, %rbx
leaq 4(%rax), %rax
cmpq %r13, %rax
jbe .L273
leaq 0(,%rbx,4), %r9
.L272:
subq %rbx, %r13
movd %r13d, %xmm7
pshufd $0, %xmm7, %xmm0
pcmpgtd %xmm5, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L274
movd %xmm1, (%r12,%r9)
.L274:
pextrd $1, %xmm0, %eax
testl %eax, %eax
je .L275
pextrd $1, %xmm1, 4(%r12,%r9)
.L275:
pextrd $2, %xmm0, %eax
testl %eax, %eax
je .L276
pextrd $2, %xmm1, 8(%r12,%r9)
.L276:
pextrd $3, %xmm0, %eax
testl %eax, %eax
je .L277
pextrd $3, %xmm1, 12(%r12,%r9)
jmp .L277
.cfi_endproc
.LFE18792:
.size _ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, @function
_ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0:
.LFB18793:
.cfi_startproc
cmpq %rdx, %rsi
jbe .L348
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r10
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rax, %rsi
jbe .L348
movl (%rdi,%rdx,4), %r11d
movd %r11d, %xmm6
pshufd $0, %xmm6, %xmm0
jmp .L351
.p2align 4,,10
.p2align 3
.L352:
cmpq %rcx, %rsi
jbe .L348
movq %rdx, %rax
.L357:
movd (%rdi,%r10,8), %xmm5
pshufd $0, %xmm5, %xmm1
pcmpgtd %xmm3, %xmm1
movmskps %xmm1, %r8d
andl $1, %r8d
jne .L354
.L353:
cmpq %rdx, %rax
je .L348
leaq (%rdi,%rax,4), %rdx
movl (%rdx), %ecx
movl %ecx, (%r9)
movl %r11d, (%rdx)
cmpq %rax, %rsi
jbe .L361
movq %rax, %rdx
.L355:
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r10
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rsi, %rax
jnb .L348
.L351:
movd (%rdi,%rax,4), %xmm4
leaq (%rdi,%rdx,4), %r9
movdqa %xmm0, %xmm3
pshufd $0, %xmm4, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm0, %xmm2
movmskps %xmm2, %r8d
andl $1, %r8d
je .L352
cmpq %rcx, %rsi
jbe .L353
movdqa %xmm1, %xmm3
jmp .L357
.p2align 4,,10
.p2align 3
.L354:
cmpq %rcx, %rdx
je .L362
leaq (%rdi,%rcx,4), %rax
movl (%rax), %edx
movl %edx, (%r9)
movq %rcx, %rdx
movl %r11d, (%rax)
jmp .L355
.p2align 4,,10
.p2align 3
.L348:
ret
.p2align 4,,10
.p2align 3
.L361:
ret
.L362:
ret
.cfi_endproc
.LFE18793:
.size _ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, .-_ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
.section .text._ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, @function
_ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0:
.LFB18794:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %rax
salq $2, %rax
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq (%rdi,%rax), %r15
pushq %r14
.cfi_offset 14, -32
leaq (%r15,%rax), %r14
pushq %r13
.cfi_offset 13, -40
leaq (%r14,%rax), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%rax), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%rax), %rbx
leaq (%rbx,%rax), %r11
leaq (%r11,%rax), %r10
leaq (%r10,%rax), %r9
subq $64, %rsp
leaq (%r9,%rax), %r8
movq %rdi, -56(%rbp)
leaq (%r8,%rax), %rdi
movq %rsi, -128(%rbp)
leaq (%rdi,%rax), %rsi
movdqu (%r15), %xmm4
movdqu (%r14), %xmm14
leaq (%rsi,%rax), %rcx
movdqu (%r14), %xmm8
movdqu (%r11), %xmm3
movdqu (%r12), %xmm13
movdqu (%r12), %xmm1
movq %rcx, -64(%rbp)
addq %rax, %rcx
leaq (%rcx,%rax), %rdx
movdqu (%r11), %xmm7
movdqu (%r9), %xmm12
movq %rcx, -136(%rbp)
addq %rdx, %rax
movq %rdx, -112(%rbp)
movdqu (%r9), %xmm6
movq %rdx, -144(%rbp)
movq -56(%rbp), %rdx
movdqu (%rdi), %xmm11
movdqu (%rdx), %xmm15
movdqu (%rdx), %xmm9
pminsd %xmm4, %xmm15
pmaxsd %xmm4, %xmm9
movdqu 0(%r13), %xmm4
pminsd %xmm4, %xmm14
pmaxsd %xmm4, %xmm8
movdqu (%rbx), %xmm4
pminsd %xmm4, %xmm13
pmaxsd %xmm4, %xmm1
movdqu (%r10), %xmm4
pmaxsd %xmm4, %xmm7
pminsd %xmm4, %xmm3
movdqu (%r8), %xmm4
pmaxsd %xmm4, %xmm6
pminsd %xmm4, %xmm12
movdqu (%rsi), %xmm4
movdqu (%rdi), %xmm5
movdqu (%rax), %xmm10
cmpq $1, -128(%rbp)
pminsd %xmm4, %xmm11
pmaxsd %xmm4, %xmm5
movdqu (%rcx), %xmm4
movq -64(%rbp), %rcx
movaps %xmm4, -80(%rbp)
movdqu (%rcx), %xmm4
movq -112(%rbp), %rcx
movaps %xmm4, -96(%rbp)
movdqa -96(%rbp), %xmm4
pminsd -80(%rbp), %xmm4
movdqu (%rcx), %xmm2
movdqa -96(%rbp), %xmm0
movaps %xmm4, -160(%rbp)
movdqu (%rcx), %xmm4
pmaxsd -80(%rbp), %xmm0
pminsd %xmm10, %xmm2
pmaxsd %xmm10, %xmm4
movdqa %xmm15, %xmm10
pmaxsd %xmm14, %xmm15
pminsd %xmm14, %xmm10
movdqa %xmm9, %xmm14
pmaxsd %xmm8, %xmm9
movaps %xmm9, -80(%rbp)
movdqa %xmm1, %xmm9
pminsd %xmm8, %xmm14
pmaxsd %xmm7, %xmm1
pminsd %xmm7, %xmm9
movdqa %xmm13, %xmm8
movdqa %xmm12, %xmm7
pminsd %xmm3, %xmm8
pminsd %xmm11, %xmm7
pmaxsd %xmm13, %xmm3
pmaxsd %xmm11, %xmm12
movdqa %xmm6, %xmm13
movdqa %xmm6, %xmm11
movdqa -160(%rbp), %xmm6
pmaxsd %xmm5, %xmm13
pminsd %xmm5, %xmm11
movdqa %xmm6, %xmm5
pminsd %xmm2, %xmm5
pmaxsd %xmm6, %xmm2
movdqa %xmm0, %xmm6
pminsd %xmm4, %xmm6
pmaxsd %xmm4, %xmm0
movdqa %xmm10, %xmm4
pminsd %xmm8, %xmm4
pmaxsd %xmm8, %xmm10
movdqa %xmm14, %xmm8
pminsd %xmm9, %xmm8
pmaxsd %xmm9, %xmm14
movdqa %xmm15, %xmm9
pmaxsd %xmm3, %xmm15
pminsd %xmm3, %xmm9
movdqa -80(%rbp), %xmm3
movaps %xmm15, -96(%rbp)
movdqa -80(%rbp), %xmm15
pminsd %xmm1, %xmm3
pmaxsd %xmm1, %xmm15
movdqa %xmm7, %xmm1
pminsd %xmm5, %xmm1
pmaxsd %xmm7, %xmm5
movdqa %xmm11, %xmm7
pminsd %xmm6, %xmm7
pmaxsd %xmm11, %xmm6
movdqa %xmm12, %xmm11
pminsd %xmm2, %xmm11
pmaxsd %xmm2, %xmm12
movdqa %xmm13, %xmm2
pminsd %xmm0, %xmm2
pmaxsd %xmm13, %xmm0
movdqa %xmm4, %xmm13
pminsd %xmm1, %xmm13
pmaxsd %xmm4, %xmm1
movaps %xmm13, -80(%rbp)
movdqa %xmm8, %xmm13
pminsd %xmm7, %xmm13
pmaxsd %xmm8, %xmm7
movdqa %xmm9, %xmm8
pminsd %xmm11, %xmm8
pmaxsd %xmm9, %xmm11
movdqa %xmm3, %xmm9
pminsd %xmm2, %xmm9
pmaxsd %xmm3, %xmm2
movdqa %xmm10, %xmm3
pminsd %xmm5, %xmm3
pmaxsd %xmm10, %xmm5
movdqa %xmm14, %xmm10
pminsd %xmm6, %xmm10
pmaxsd %xmm14, %xmm6
movdqa -96(%rbp), %xmm14
movdqa %xmm14, %xmm4
pminsd %xmm12, %xmm4
pmaxsd %xmm14, %xmm12
movdqa %xmm15, %xmm14
pminsd %xmm0, %xmm14
pmaxsd %xmm15, %xmm0
movdqa %xmm9, %xmm15
movaps %xmm0, -96(%rbp)
movdqa %xmm10, %xmm0
pmaxsd %xmm11, %xmm10
pminsd %xmm5, %xmm15
pminsd %xmm11, %xmm0
movdqa %xmm4, %xmm11
pmaxsd %xmm7, %xmm4
pminsd %xmm7, %xmm11
movdqa %xmm14, %xmm7
pmaxsd %xmm2, %xmm14
pminsd %xmm2, %xmm7
movdqa %xmm3, %xmm2
pmaxsd %xmm1, %xmm3
pminsd %xmm1, %xmm2
movdqa %xmm13, %xmm1
pmaxsd %xmm9, %xmm5
pminsd %xmm8, %xmm1
movdqa %xmm6, %xmm9
pmaxsd %xmm13, %xmm8
pminsd %xmm12, %xmm9
pmaxsd %xmm6, %xmm12
movdqa %xmm1, %xmm6
pminsd %xmm2, %xmm6
pmaxsd %xmm2, %xmm1
movdqa %xmm7, %xmm2
movaps %xmm6, -112(%rbp)
movdqa %xmm8, %xmm6
pminsd %xmm9, %xmm2
pmaxsd %xmm3, %xmm8
pminsd %xmm3, %xmm6
pmaxsd %xmm7, %xmm9
movdqa %xmm2, %xmm13
movdqa %xmm6, %xmm3
movdqa %xmm14, %xmm7
pminsd %xmm5, %xmm13
pminsd %xmm1, %xmm3
pminsd %xmm12, %xmm7
pmaxsd %xmm12, %xmm14
movdqa %xmm0, %xmm12
pmaxsd %xmm1, %xmm6
movaps %xmm3, -176(%rbp)
movdqa %xmm4, %xmm3
pmaxsd %xmm11, %xmm0
movdqa %xmm15, %xmm1
movaps %xmm14, -160(%rbp)
pminsd %xmm10, %xmm3
pminsd %xmm11, %xmm12
movdqa %xmm15, %xmm11
movdqa %xmm13, %xmm15
pmaxsd %xmm10, %xmm4
pmaxsd %xmm2, %xmm5
pminsd %xmm8, %xmm11
pmaxsd %xmm8, %xmm1
movdqa %xmm0, %xmm8
pminsd %xmm3, %xmm15
pminsd %xmm1, %xmm8
movdqa %xmm7, %xmm10
pmaxsd %xmm0, %xmm1
pmaxsd %xmm3, %xmm13
movdqa %xmm4, %xmm0
movdqa %xmm15, %xmm3
pminsd %xmm9, %xmm10
pminsd %xmm5, %xmm0
pminsd %xmm1, %xmm3
pmaxsd %xmm1, %xmm15
movdqa %xmm11, %xmm2
movdqa %xmm13, %xmm1
pmaxsd %xmm5, %xmm4
pmaxsd %xmm12, %xmm11
pminsd %xmm0, %xmm1
movdqa %xmm11, %xmm5
movdqa %xmm15, %xmm14
pminsd %xmm12, %xmm2
pmaxsd %xmm8, %xmm11
pmaxsd %xmm0, %xmm13
movdqa %xmm10, %xmm0
pmaxsd %xmm9, %xmm7
pminsd %xmm4, %xmm0
movdqa %xmm2, %xmm9
pmaxsd %xmm10, %xmm4
movdqa %xmm11, %xmm10
pminsd %xmm6, %xmm9
pmaxsd %xmm6, %xmm2
pminsd %xmm8, %xmm5
pminsd %xmm3, %xmm10
pmaxsd %xmm3, %xmm11
pminsd %xmm1, %xmm14
pmaxsd %xmm1, %xmm15
jbe .L368
movdqa -80(%rbp), %xmm3
pshufd $177, -96(%rbp), %xmm6
pshufd $177, %xmm7, %xmm7
pshufd $177, -160(%rbp), %xmm8
pshufd $177, %xmm4, %xmm4
pshufd $177, %xmm0, %xmm0
pshufd $177, %xmm13, %xmm13
cmpq $3, -128(%rbp)
movdqa %xmm3, %xmm12
pshufd $177, %xmm15, %xmm15
pshufd $177, %xmm14, %xmm14
pminsd %xmm6, %xmm12
pmaxsd %xmm3, %xmm6
movdqa -112(%rbp), %xmm3
movaps %xmm6, -80(%rbp)
movdqa -176(%rbp), %xmm6
movdqa %xmm3, %xmm1
pminsd %xmm8, %xmm1
pmaxsd %xmm3, %xmm8
movdqa %xmm6, %xmm3
pminsd %xmm7, %xmm3
pmaxsd %xmm6, %xmm7
movdqa %xmm9, %xmm6
pminsd %xmm4, %xmm6
pmaxsd %xmm4, %xmm9
movdqa %xmm2, %xmm4
pminsd %xmm0, %xmm4
pmaxsd %xmm0, %xmm2
movdqa %xmm5, %xmm0
movaps %xmm6, -96(%rbp)
pmaxsd %xmm13, %xmm5
pshufd $177, %xmm7, %xmm7
pshufd $177, %xmm4, %xmm4
pshufd $177, -80(%rbp), %xmm6
pminsd %xmm13, %xmm0
movdqa %xmm10, %xmm13
pmaxsd %xmm15, %xmm10
pminsd %xmm15, %xmm13
movdqa %xmm11, %xmm15
pmaxsd %xmm14, %xmm11
pminsd %xmm14, %xmm15
movdqa %xmm12, %xmm14
pshufd $177, %xmm13, %xmm13
pshufd $177, %xmm15, %xmm15
pshufd $177, %xmm8, %xmm8
pshufd $177, %xmm0, %xmm0
pminsd %xmm15, %xmm14
pmaxsd %xmm15, %xmm12
movdqa %xmm11, %xmm15
pminsd %xmm6, %xmm15
pmaxsd %xmm6, %xmm11
movdqa %xmm1, %xmm6
pminsd %xmm13, %xmm6
pmaxsd %xmm13, %xmm1
movdqa %xmm10, %xmm13
movaps %xmm15, -80(%rbp)
pminsd %xmm8, %xmm13
pmaxsd %xmm8, %xmm10
movdqa %xmm3, %xmm8
pminsd %xmm0, %xmm8
pmaxsd %xmm0, %xmm3
movdqa %xmm5, %xmm0
pminsd %xmm7, %xmm0
pmaxsd %xmm7, %xmm5
movdqa -96(%rbp), %xmm7
movdqa %xmm13, %xmm15
pshufd $177, %xmm9, %xmm9
pshufd $177, %xmm8, %xmm8
pshufd $177, %xmm12, %xmm12
movdqa %xmm7, %xmm13
pshufd $177, %xmm1, %xmm1
pshufd $177, %xmm0, %xmm0
pminsd %xmm4, %xmm13
pmaxsd %xmm7, %xmm4
movdqa %xmm2, %xmm7
pshufd $177, %xmm13, %xmm13
pmaxsd %xmm9, %xmm2
pminsd %xmm9, %xmm7
movdqa %xmm14, %xmm9
pmaxsd %xmm13, %xmm14
pshufd $177, %xmm7, %xmm7
pminsd %xmm13, %xmm9
movdqa %xmm6, %xmm13
pmaxsd %xmm8, %xmm6
pminsd %xmm8, %xmm13
movdqa %xmm4, %xmm8
pmaxsd %xmm12, %xmm4
pminsd %xmm12, %xmm8
movaps %xmm13, -96(%rbp)
movdqa -80(%rbp), %xmm12
movdqa %xmm3, %xmm13
pminsd %xmm1, %xmm13
pmaxsd %xmm1, %xmm3
pshufd $177, %xmm11, %xmm11
movdqa %xmm12, %xmm1
pshufd $177, %xmm10, %xmm10
pshufd $177, %xmm4, %xmm4
pminsd %xmm7, %xmm1
pmaxsd %xmm12, %xmm7
movdqa %xmm15, %xmm12
pminsd %xmm0, %xmm12
pmaxsd %xmm15, %xmm0
movdqa %xmm2, %xmm15
pminsd %xmm11, %xmm15
pmaxsd %xmm11, %xmm2
movdqa %xmm5, %xmm11
pminsd %xmm10, %xmm11
movaps %xmm15, -80(%rbp)
pmaxsd %xmm10, %xmm5
movdqa %xmm9, %xmm10
pshufd $177, %xmm14, %xmm14
pshufd $177, %xmm7, %xmm7
pshufd $177, %xmm2, %xmm2
pshufd $177, -96(%rbp), %xmm15
pminsd %xmm15, %xmm10
pmaxsd %xmm15, %xmm9
movdqa %xmm6, %xmm15
pminsd %xmm14, %xmm15
pmaxsd %xmm14, %xmm6
pshufd $177, %xmm13, %xmm13
movdqa %xmm8, %xmm14
pmaxsd %xmm13, %xmm8
pshufd $177, %xmm12, %xmm12
pminsd %xmm13, %xmm14
movdqa %xmm3, %xmm13
pmaxsd %xmm4, %xmm3
pminsd %xmm4, %xmm13
movdqa %xmm1, %xmm4
pmaxsd %xmm12, %xmm1
pminsd %xmm12, %xmm4
movdqa %xmm0, %xmm12
pmaxsd %xmm7, %xmm0
movaps %xmm0, -96(%rbp)
movdqa -80(%rbp), %xmm0
pminsd %xmm7, %xmm12
pshufd $177, %xmm11, %xmm11
movdqa %xmm0, %xmm7
pminsd %xmm11, %xmm7
pmaxsd %xmm0, %xmm11
movdqa %xmm5, %xmm0
pmaxsd %xmm2, %xmm5
pminsd %xmm2, %xmm0
pshufd $177, %xmm10, %xmm2
movaps %xmm5, -112(%rbp)
movdqa %xmm10, %xmm5
pmaxsd %xmm2, %xmm10
pminsd %xmm2, %xmm5
pshufd $177, %xmm9, %xmm2
movaps %xmm0, -80(%rbp)
blendps $5, %xmm5, %xmm10
movdqa %xmm9, %xmm5
pmaxsd %xmm2, %xmm9
pminsd %xmm2, %xmm5
movdqa %xmm15, %xmm2
blendps $5, %xmm5, %xmm9
pshufd $177, %xmm15, %xmm5
pminsd %xmm5, %xmm2
pmaxsd %xmm5, %xmm15
pshufd $177, %xmm6, %xmm5
blendps $5, %xmm2, %xmm15
movdqa %xmm6, %xmm2
pmaxsd %xmm5, %xmm6
pminsd %xmm5, %xmm2
pshufd $177, %xmm14, %xmm5
blendps $5, %xmm2, %xmm6
movdqa %xmm14, %xmm2
pmaxsd %xmm5, %xmm14
pminsd %xmm5, %xmm2
movaps %xmm6, -160(%rbp)
movaps %xmm14, %xmm6
pshufd $177, %xmm8, %xmm5
blendps $5, %xmm2, %xmm6
movdqa %xmm8, %xmm2
pmaxsd %xmm5, %xmm8
pminsd %xmm5, %xmm2
movaps %xmm6, -176(%rbp)
movaps %xmm8, %xmm6
pshufd $177, %xmm13, %xmm5
blendps $5, %xmm2, %xmm6
movdqa %xmm13, %xmm2
pmaxsd %xmm5, %xmm13
pminsd %xmm5, %xmm2
movaps %xmm6, -192(%rbp)
movaps %xmm13, %xmm6
pshufd $177, %xmm3, %xmm5
blendps $5, %xmm2, %xmm6
movdqa %xmm3, %xmm2
pmaxsd %xmm5, %xmm3
pminsd %xmm5, %xmm2
movaps %xmm3, %xmm13
movaps %xmm6, -208(%rbp)
pshufd $177, %xmm4, %xmm6
pshufd $177, %xmm1, %xmm3
blendps $5, %xmm2, %xmm13
movdqa %xmm4, %xmm2
movdqa -96(%rbp), %xmm5
pminsd %xmm6, %xmm2
pmaxsd %xmm4, %xmm6
pshufd $177, %xmm7, %xmm8
blendps $5, %xmm2, %xmm6
movdqa %xmm1, %xmm2
pmaxsd %xmm3, %xmm1
pminsd %xmm3, %xmm2
pshufd $177, %xmm12, %xmm3
pshufd $177, %xmm5, %xmm14
blendps $5, %xmm2, %xmm1
movdqa %xmm12, %xmm2
movdqa %xmm7, %xmm4
pminsd %xmm3, %xmm2
pmaxsd %xmm3, %xmm12
movdqa %xmm11, %xmm3
blendps $5, %xmm2, %xmm12
movdqa %xmm5, %xmm2
pmaxsd %xmm14, %xmm5
pminsd %xmm14, %xmm2
movaps %xmm5, %xmm14
pminsd %xmm8, %xmm4
blendps $5, %xmm2, %xmm14
pshufd $177, %xmm11, %xmm2
pmaxsd %xmm7, %xmm8
movdqa -80(%rbp), %xmm7
pmaxsd %xmm2, %xmm11
movdqa %xmm4, %xmm0
pminsd %xmm2, %xmm3
movaps %xmm8, %xmm4
movaps %xmm11, %xmm2
blendps $5, %xmm0, %xmm4
blendps $5, %xmm3, %xmm2
movdqa %xmm7, %xmm0
pshufd $177, %xmm7, %xmm3
pminsd %xmm3, %xmm0
pmaxsd %xmm7, %xmm3
movdqa -112(%rbp), %xmm7
blendps $5, %xmm0, %xmm3
pshufd $177, %xmm7, %xmm5
movdqa %xmm7, %xmm0
pminsd %xmm5, %xmm0
pmaxsd %xmm7, %xmm5
blendps $5, %xmm0, %xmm5
movaps %xmm5, -224(%rbp)
jbe .L369
pshufd $27, %xmm2, %xmm7
pshufd $27, %xmm3, %xmm2
movaps -160(%rbp), %xmm3
pshufd $27, %xmm12, %xmm0
pshufd $27, %xmm4, %xmm8
pshufd $27, %xmm1, %xmm11
pshufd $27, %xmm6, %xmm6
pshufd $27, -224(%rbp), %xmm5
movdqa %xmm3, %xmm4
movdqa %xmm5, %xmm12
pmaxsd %xmm10, %xmm5
pminsd %xmm10, %xmm12
pminsd %xmm8, %xmm4
movdqa %xmm2, %xmm10
pmaxsd %xmm3, %xmm8
movaps -176(%rbp), %xmm3
pshufd $27, %xmm14, %xmm1
pminsd %xmm9, %xmm10
pmaxsd %xmm2, %xmm9
movdqa %xmm7, %xmm2
movaps %xmm4, -80(%rbp)
movaps -192(%rbp), %xmm14
pminsd %xmm15, %xmm2
pmaxsd %xmm15, %xmm7
movdqa %xmm3, %xmm4
movaps -208(%rbp), %xmm15
pminsd %xmm1, %xmm4
pmaxsd %xmm3, %xmm1
movdqa %xmm14, %xmm3
pminsd %xmm0, %xmm3
pmaxsd %xmm14, %xmm0
movdqa %xmm15, %xmm14
pminsd %xmm11, %xmm14
pmaxsd %xmm15, %xmm11
movdqa %xmm6, %xmm15
pminsd %xmm13, %xmm15
pshufd $27, %xmm5, %xmm5
pmaxsd %xmm13, %xmm6
pshufd $27, %xmm15, %xmm15
movdqa %xmm12, %xmm13
pshufd $27, %xmm3, %xmm3
pminsd %xmm15, %xmm13
pshufd $27, %xmm7, %xmm7
pshufd $27, %xmm4, %xmm4
pmaxsd %xmm15, %xmm12
movdqa %xmm6, %xmm15
pshufd $27, %xmm14, %xmm14
pminsd %xmm5, %xmm15
pmaxsd %xmm5, %xmm6
movdqa %xmm10, %xmm5
pshufd $27, %xmm9, %xmm9
pminsd %xmm14, %xmm5
movaps %xmm15, -96(%rbp)
pmaxsd %xmm14, %xmm10
movdqa %xmm11, %xmm14
pmaxsd %xmm9, %xmm11
pshufd $27, %xmm8, %xmm8
pminsd %xmm9, %xmm14
movdqa %xmm2, %xmm9
pmaxsd %xmm3, %xmm2
pminsd %xmm3, %xmm9
movdqa %xmm0, %xmm3
pmaxsd %xmm7, %xmm0
pminsd %xmm7, %xmm3
movdqa -80(%rbp), %xmm7
movdqa %xmm14, %xmm15
pshufd $27, %xmm9, %xmm9
pshufd $27, %xmm12, %xmm12
pshufd $27, %xmm3, %xmm3
pshufd $27, %xmm6, %xmm6
movdqa %xmm7, %xmm14
pshufd $27, %xmm11, %xmm11
pminsd %xmm4, %xmm14
pmaxsd %xmm7, %xmm4
movdqa %xmm1, %xmm7
pminsd %xmm8, %xmm7
pmaxsd %xmm8, %xmm1
pshufd $27, %xmm14, %xmm14
pshufd $27, %xmm10, %xmm8
movdqa %xmm13, %xmm10
pshufd $27, %xmm7, %xmm7
pminsd %xmm14, %xmm10
pmaxsd %xmm13, %xmm14
movdqa %xmm5, %xmm13
pminsd %xmm9, %xmm13
pmaxsd %xmm9, %xmm5
movdqa %xmm4, %xmm9
pminsd %xmm12, %xmm9
pmaxsd %xmm12, %xmm4
movdqa -96(%rbp), %xmm12
movaps %xmm13, -80(%rbp)
movdqa %xmm2, %xmm13
pmaxsd %xmm8, %xmm2
pshufd $27, %xmm14, %xmm14
pminsd %xmm8, %xmm13
movdqa %xmm12, %xmm8
pshufd $27, %xmm4, %xmm4
pminsd %xmm7, %xmm8
pmaxsd %xmm12, %xmm7
movdqa %xmm15, %xmm12
pminsd %xmm3, %xmm12
pmaxsd %xmm15, %xmm3
movdqa %xmm1, %xmm15
pminsd %xmm6, %xmm15
pmaxsd %xmm6, %xmm1
movdqa %xmm0, %xmm6
pminsd %xmm11, %xmm6
movaps %xmm15, -96(%rbp)
pmaxsd %xmm11, %xmm0
movdqa %xmm10, %xmm11
pshufd $27, %xmm13, %xmm13
pshufd $27, %xmm12, %xmm12
pshufd $27, %xmm7, %xmm7
pshufd $27, -80(%rbp), %xmm15
pminsd %xmm15, %xmm11
pmaxsd %xmm15, %xmm10
movdqa %xmm5, %xmm15
pminsd %xmm14, %xmm15
pmaxsd %xmm14, %xmm5
movdqa %xmm9, %xmm14
pminsd %xmm13, %xmm14
pmaxsd %xmm13, %xmm9
movdqa %xmm2, %xmm13
pmaxsd %xmm4, %xmm2
pminsd %xmm4, %xmm13
movdqa %xmm8, %xmm4
movaps %xmm2, -80(%rbp)
movdqa -96(%rbp), %xmm2
pminsd %xmm12, %xmm4
pmaxsd %xmm12, %xmm8
movdqa %xmm3, %xmm12
pshufd $27, %xmm1, %xmm1
pmaxsd %xmm7, %xmm3
pminsd %xmm7, %xmm12
pshufd $27, %xmm6, %xmm6
movdqa %xmm2, %xmm7
pminsd %xmm6, %xmm7
pmaxsd %xmm2, %xmm6
movdqa %xmm0, %xmm2
pmaxsd %xmm1, %xmm0
pminsd %xmm1, %xmm2
movdqa %xmm11, %xmm1
movaps %xmm0, -112(%rbp)
pshufd $27, %xmm11, %xmm0
pminsd %xmm0, %xmm1
pmaxsd %xmm0, %xmm11
movaps %xmm2, -96(%rbp)
pshufd $27, %xmm10, %xmm0
movsd %xmm1, %xmm11
movdqa %xmm10, %xmm1
pmaxsd %xmm0, %xmm10
movdqa -80(%rbp), %xmm2
pminsd %xmm0, %xmm1
pshufd $27, %xmm15, %xmm0
movsd %xmm1, %xmm10
movdqa %xmm15, %xmm1
pmaxsd %xmm0, %xmm15
pminsd %xmm0, %xmm1
pshufd $27, %xmm5, %xmm0
movsd %xmm1, %xmm15
movdqa %xmm5, %xmm1
pmaxsd %xmm0, %xmm5
pminsd %xmm0, %xmm1
pshufd $27, %xmm14, %xmm0
movsd %xmm1, %xmm5
movdqa %xmm14, %xmm1
pmaxsd %xmm0, %xmm14
pminsd %xmm0, %xmm1
pshufd $27, %xmm9, %xmm0
movsd %xmm1, %xmm14
movdqa %xmm9, %xmm1
pmaxsd %xmm0, %xmm9
pminsd %xmm0, %xmm1
pshufd $27, %xmm13, %xmm0
movsd %xmm1, %xmm9
movdqa %xmm13, %xmm1
pmaxsd %xmm0, %xmm13
pminsd %xmm0, %xmm1
pshufd $27, %xmm2, %xmm0
movsd %xmm1, %xmm13
movdqa %xmm2, %xmm1
pmaxsd %xmm0, %xmm2
pminsd %xmm0, %xmm1
pshufd $27, %xmm4, %xmm0
movsd %xmm1, %xmm2
movdqa %xmm4, %xmm1
pmaxsd %xmm0, %xmm4
pminsd %xmm0, %xmm1
pshufd $27, %xmm8, %xmm0
movsd %xmm1, %xmm4
movdqa %xmm8, %xmm1
pmaxsd %xmm0, %xmm8
pminsd %xmm0, %xmm1
pshufd $27, %xmm12, %xmm0
movsd %xmm1, %xmm8
movdqa %xmm12, %xmm1
pmaxsd %xmm0, %xmm12
pminsd %xmm0, %xmm1
pshufd $27, %xmm3, %xmm0
movsd %xmm1, %xmm12
movdqa %xmm3, %xmm1
pmaxsd %xmm0, %xmm3
pminsd %xmm0, %xmm1
pshufd $27, %xmm7, %xmm0
movsd %xmm1, %xmm3
movdqa %xmm7, %xmm1
pmaxsd %xmm0, %xmm7
pminsd %xmm0, %xmm1
pshufd $27, %xmm6, %xmm0
movsd %xmm1, %xmm7
movdqa %xmm6, %xmm1
pmaxsd %xmm0, %xmm6
pminsd %xmm0, %xmm1
movapd %xmm6, %xmm0
movdqa -96(%rbp), %xmm6
movsd %xmm1, %xmm0
movaps %xmm0, -176(%rbp)
movdqa %xmm6, %xmm1
pshufd $27, %xmm6, %xmm0
pminsd %xmm0, %xmm1
pmaxsd %xmm6, %xmm0
movapd %xmm0, %xmm6
movsd %xmm1, %xmm6
movaps %xmm6, -192(%rbp)
movdqa -112(%rbp), %xmm6
pshufd $27, %xmm6, %xmm0
movdqa %xmm6, %xmm1
pminsd %xmm0, %xmm1
pmaxsd %xmm6, %xmm0
movapd %xmm0, %xmm6
pshufd $177, %xmm11, %xmm0
movsd %xmm1, %xmm6
movdqa %xmm0, %xmm1
pmaxsd %xmm11, %xmm0
pminsd %xmm11, %xmm1
movaps %xmm0, %xmm11
pshufd $177, %xmm10, %xmm0
movaps %xmm6, -208(%rbp)
blendps $5, %xmm1, %xmm11
movdqa %xmm0, %xmm1
pshufd $177, %xmm4, %xmm6
pmaxsd %xmm10, %xmm0
pminsd %xmm10, %xmm1
movaps %xmm11, -80(%rbp)
movaps %xmm0, %xmm10
blendps $5, %xmm1, %xmm10
pshufd $177, %xmm15, %xmm1
movdqa %xmm1, %xmm0
pmaxsd %xmm15, %xmm1
movaps %xmm10, -96(%rbp)
pshufd $177, %xmm13, %xmm10
pminsd %xmm15, %xmm0
pshufd $177, %xmm8, %xmm15
blendps $5, %xmm0, %xmm1
movaps %xmm1, -112(%rbp)
pshufd $177, %xmm5, %xmm1
movdqa %xmm1, %xmm0
pmaxsd %xmm5, %xmm1
pminsd %xmm5, %xmm0
movaps %xmm1, %xmm5
pshufd $177, %xmm14, %xmm1
blendps $5, %xmm0, %xmm5
movaps %xmm5, -128(%rbp)
movdqa %xmm1, %xmm5
pmaxsd %xmm14, %xmm1
pminsd %xmm14, %xmm5
movdqa %xmm5, %xmm0
movaps %xmm1, %xmm5
pshufd $177, %xmm9, %xmm1
blendps $5, %xmm0, %xmm5
movaps %xmm5, -160(%rbp)
movdqa %xmm1, %xmm5
pmaxsd %xmm9, %xmm1
pminsd %xmm9, %xmm5
movdqa %xmm5, %xmm0
movaps %xmm1, %xmm5
blendps $5, %xmm0, %xmm5
movdqa %xmm10, %xmm0
pmaxsd %xmm13, %xmm10
pminsd %xmm13, %xmm0
pshufd $177, %xmm2, %xmm13
blendps $5, %xmm0, %xmm10
movdqa %xmm13, %xmm0
pmaxsd %xmm2, %xmm13
pminsd %xmm2, %xmm0
movaps %xmm13, %xmm1
pshufd $177, %xmm12, %xmm13
movapd -192(%rbp), %xmm2
blendps $5, %xmm0, %xmm1
movdqa %xmm6, %xmm0
pmaxsd %xmm4, %xmm6
pminsd %xmm4, %xmm0
movdqa %xmm15, %xmm4
pmaxsd %xmm8, %xmm15
pminsd %xmm8, %xmm4
blendps $5, %xmm0, %xmm6
movaps %xmm1, %xmm9
pshufd $177, %xmm3, %xmm0
blendps $5, %xmm4, %xmm15
movdqa %xmm13, %xmm1
movdqa %xmm0, %xmm4
pmaxsd %xmm3, %xmm0
pminsd %xmm12, %xmm1
pminsd %xmm3, %xmm4
pmaxsd %xmm12, %xmm13
movapd -176(%rbp), %xmm3
blendps $5, %xmm4, %xmm0
pshufd $177, %xmm7, %xmm4
blendps $5, %xmm1, %xmm13
movdqa %xmm4, %xmm1
pmaxsd %xmm7, %xmm4
pminsd %xmm7, %xmm1
pshufd $177, %xmm3, %xmm7
blendps $5, %xmm1, %xmm4
movdqa %xmm3, %xmm1
pminsd %xmm7, %xmm1
pmaxsd %xmm3, %xmm7
pshufd $177, %xmm2, %xmm3
blendps $5, %xmm1, %xmm7
movdqa %xmm2, %xmm1
pminsd %xmm3, %xmm1
pmaxsd %xmm2, %xmm3
movapd -208(%rbp), %xmm2
blendps $5, %xmm1, %xmm3
pshufd $177, %xmm2, %xmm8
movdqa %xmm2, %xmm1
pminsd %xmm8, %xmm1
pmaxsd %xmm2, %xmm8
blendps $5, %xmm1, %xmm8
.L365:
movdqa -80(%rbp), %xmm2
movups %xmm2, (%rdx)
movdqa -96(%rbp), %xmm2
movq -64(%rbp), %rdx
movups %xmm2, (%r15)
movdqa -112(%rbp), %xmm2
movups %xmm2, (%r14)
movdqa -128(%rbp), %xmm2
movups %xmm2, 0(%r13)
movdqa -160(%rbp), %xmm2
movups %xmm2, (%r12)
movups %xmm5, (%rbx)
movq -136(%rbp), %rbx
movups %xmm10, (%r11)
movups %xmm9, (%r10)
movups %xmm6, (%r9)
movups %xmm15, (%r8)
movups %xmm13, (%rdi)
movups %xmm0, (%rsi)
movups %xmm4, (%rdx)
movups %xmm7, (%rbx)
movq -144(%rbp), %rbx
movups %xmm3, (%rbx)
movups %xmm8, (%rax)
addq $64, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L368:
.cfi_restore_state
movdqa -112(%rbp), %xmm3
movdqa -96(%rbp), %xmm8
movaps %xmm9, -128(%rbp)
movdqa %xmm11, %xmm9
movdqa -176(%rbp), %xmm6
movaps %xmm3, -96(%rbp)
movdqa -160(%rbp), %xmm3
movaps %xmm6, -112(%rbp)
movdqa %xmm14, %xmm6
movaps %xmm2, -160(%rbp)
jmp .L365
.p2align 4,,10
.p2align 3
.L369:
movaps %xmm10, -80(%rbp)
movdqa %xmm14, %xmm0
movdqa %xmm2, %xmm7
movdqa -160(%rbp), %xmm5
movdqa -208(%rbp), %xmm10
movaps %xmm9, -96(%rbp)
movdqa -224(%rbp), %xmm8
movdqa %xmm13, %xmm9
movaps %xmm5, -128(%rbp)
movdqa -176(%rbp), %xmm5
movdqa %xmm12, %xmm13
movaps %xmm15, -112(%rbp)
movdqa %xmm1, %xmm15
movaps %xmm5, -160(%rbp)
movdqa -192(%rbp), %xmm5
jmp .L365
.cfi_endproc
.LFE18794:
.size _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, .-_ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
.section .text._ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18795:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
.cfi_offset 15, -24
.cfi_offset 14, -32
movq %rcx, %r14
pushq %r13
.cfi_offset 13, -40
movq %rsi, %r13
pushq %r12
.cfi_offset 12, -48
movq %rdi, %r12
pushq %rbx
subq $88, %rsp
.cfi_offset 3, -56
movq %rdx, -120(%rbp)
movaps %xmm0, -80(%rbp)
movaps %xmm1, -64(%rbp)
movaps %xmm0, -112(%rbp)
movaps %xmm1, -96(%rbp)
cmpq $3, %rsi
jbe .L401
movl $4, %r15d
xorl %ebx, %ebx
jmp .L380
.p2align 4,,10
.p2align 3
.L372:
movdqa -80(%rbp), %xmm5
movmskps %xmm1, %edi
movups %xmm5, (%r12,%rbx,4)
call __popcountdi2@PLT
cltq
addq %rax, %rbx
leaq 4(%r15), %rax
cmpq %r13, %rax
ja .L457
movq %rax, %r15
.L380:
movdqu -16(%r12,%r15,4), %xmm1
movdqu -16(%r12,%r15,4), %xmm0
leaq -4(%r15), %rdx
pcmpeqd -96(%rbp), %xmm0
pcmpeqd -112(%rbp), %xmm1
movdqa %xmm0, %xmm2
por %xmm1, %xmm0
movmskps %xmm0, %eax
cmpl $15, %eax
je .L372
pcmpeqd %xmm0, %xmm0
pxor %xmm0, %xmm2
pandn %xmm2, %xmm1
movmskps %xmm1, %eax
rep bsfl %eax, %eax
cltq
addq %rdx, %rax
movd (%r12,%rax,4), %xmm3
movq -120(%rbp), %rax
pshufd $0, %xmm3, %xmm0
movaps %xmm0, (%rax)
leaq 4(%rbx), %rax
cmpq %rdx, %rax
ja .L373
.p2align 4,,10
.p2align 3
.L374:
movdqa -64(%rbp), %xmm4
movq %rax, %rbx
movups %xmm4, -16(%r12,%rax,4)
addq $4, %rax
cmpq %rdx, %rax
jbe .L374
.L373:
subq %rbx, %rdx
leaq 0(,%rbx,4), %rcx
movd %edx, %xmm3
pshufd $0, %xmm3, %xmm0
pcmpgtd .LC0(%rip), %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L375
movdqa -64(%rbp), %xmm3
movd %xmm3, (%r12,%rbx,4)
.L375:
pshufd $85, %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L376
pshufd $85, -64(%rbp), %xmm1
movd %xmm1, 4(%r12,%rcx)
.L376:
movdqa %xmm0, %xmm1
punpckhdq %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L377
movdqa -64(%rbp), %xmm3
movdqa %xmm3, %xmm1
punpckhdq %xmm3, %xmm1
movd %xmm1, 8(%r12,%rcx)
.L377:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
jne .L458
.L390:
addq $88, %rsp
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L458:
.cfi_restore_state
pshufd $255, -64(%rbp), %xmm0
movd %xmm0, 12(%r12,%rcx)
jmp .L390
.p2align 4,,10
.p2align 3
.L457:
movq %r13, %r8
leaq 0(,%r15,4), %rsi
leaq 0(,%rbx,4), %r9
subq %r15, %r8
.L371:
testq %r8, %r8
je .L384
leaq 0(,%r8,4), %rdx
addq %r12, %rsi
movq %r14, %rdi
movq %r9, -112(%rbp)
movq %r8, -96(%rbp)
call memcpy@PLT
movq -96(%rbp), %r8
movq -112(%rbp), %r9
.L384:
movd %r8d, %xmm3
movdqa (%r14), %xmm2
movdqa -80(%rbp), %xmm1
pshufd $0, %xmm3, %xmm0
movdqa .LC0(%rip), %xmm3
pcmpeqd %xmm2, %xmm1
pcmpeqd -64(%rbp), %xmm2
pcmpgtd %xmm3, %xmm0
movdqa %xmm0, %xmm5
pand %xmm1, %xmm5
por %xmm2, %xmm1
pcmpeqd %xmm2, %xmm2
movdqa %xmm2, %xmm4
pxor %xmm0, %xmm4
por %xmm4, %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
jne .L459
movd %xmm0, %eax
testl %eax, %eax
je .L391
movdqa -80(%rbp), %xmm4
movd %xmm4, (%r12,%r9)
.L391:
pshufd $85, %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L392
pshufd $85, -80(%rbp), %xmm1
movd %xmm1, 4(%r12,%r9)
.L392:
movdqa %xmm0, %xmm1
punpckhdq %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L393
movdqa -80(%rbp), %xmm7
movdqa %xmm7, %xmm1
punpckhdq %xmm7, %xmm1
movd %xmm1, 8(%r12,%r9)
.L393:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
jne .L460
.L394:
movmskps %xmm5, %edi
call __popcountdi2@PLT
movdqa .LC0(%rip), %xmm3
movslq %eax, %rdx
addq %rbx, %rdx
leaq 4(%rdx), %rax
cmpq %rax, %r13
jb .L395
.p2align 4,,10
.p2align 3
.L396:
movdqa -64(%rbp), %xmm2
movq %rax, %rdx
movups %xmm2, -16(%r12,%rax,4)
addq $4, %rax
cmpq %rax, %r13
jnb .L396
.L395:
subq %rdx, %r13
leaq 0(,%rdx,4), %rcx
movd %r13d, %xmm4
pshufd $0, %xmm4, %xmm0
pcmpgtd %xmm3, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L397
movdqa -64(%rbp), %xmm3
movd %xmm3, (%r12,%rdx,4)
.L397:
pshufd $85, %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L398
pshufd $85, -64(%rbp), %xmm1
movd %xmm1, 4(%r12,%rcx)
.L398:
movdqa %xmm0, %xmm1
punpckhdq %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L399
movdqa -64(%rbp), %xmm3
movdqa %xmm3, %xmm1
punpckhdq %xmm3, %xmm1
movd %xmm1, 8(%r12,%rcx)
.L399:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L400
pshufd $255, -64(%rbp), %xmm0
movd %xmm0, 12(%r12,%rcx)
.L400:
addq $88, %rsp
movl $1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L460:
.cfi_restore_state
pshufd $255, -80(%rbp), %xmm0
movd %xmm0, 12(%r12,%r9)
jmp .L394
.L401:
movq %rsi, %r8
xorl %r9d, %r9d
xorl %esi, %esi
xorl %ebx, %ebx
xorl %r15d, %r15d
jmp .L371
.L459:
pxor %xmm2, %xmm1
movmskps %xmm1, %eax
rep bsfl %eax, %eax
cltq
addq %r15, %rax
movd (%r12,%rax,4), %xmm4
movq -120(%rbp), %rax
pshufd $0, %xmm4, %xmm0
movaps %xmm0, (%rax)
leaq 4(%rbx), %rax
cmpq %rax, %r15
jb .L385
.p2align 4,,10
.p2align 3
.L386:
movdqa -64(%rbp), %xmm6
movq %rax, %rbx
movups %xmm6, -16(%r12,%rax,4)
leaq 4(%rax), %rax
cmpq %r15, %rax
jbe .L386
leaq 0(,%rbx,4), %r9
.L385:
movq %r15, %rcx
subq %rbx, %rcx
movd %ecx, %xmm4
pshufd $0, %xmm4, %xmm0
pcmpgtd %xmm3, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L387
movdqa -64(%rbp), %xmm3
movd %xmm3, (%r12,%r9)
.L387:
pshufd $85, %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L388
pshufd $85, -64(%rbp), %xmm1
movd %xmm1, 4(%r12,%r9)
.L388:
movdqa %xmm0, %xmm1
punpckhdq %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L389
movdqa -64(%rbp), %xmm3
movdqa %xmm3, %xmm1
punpckhdq %xmm3, %xmm1
movd %xmm1, 8(%r12,%r9)
.L389:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L390
pshufd $255, -64(%rbp), %xmm0
movd %xmm0, 12(%r12,%r9)
jmp .L390
.cfi_endproc
.LFE18795:
.size _ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, @function
_ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0:
.LFB18796:
.cfi_startproc
cmpq %rdx, %rsi
jbe .L461
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r10
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rax, %rsi
jbe .L461
movl (%rdi,%rdx,4), %r11d
movd %r11d, %xmm6
pshufd $0, %xmm6, %xmm0
jmp .L464
.p2align 4,,10
.p2align 3
.L465:
cmpq %rcx, %rsi
jbe .L461
movq %rdx, %rax
.L470:
movd (%rdi,%r10,8), %xmm5
pshufd $0, %xmm5, %xmm1
pcmpgtd %xmm3, %xmm1
movmskps %xmm1, %r8d
andl $1, %r8d
jne .L467
.L466:
cmpq %rdx, %rax
je .L461
leaq (%rdi,%rax,4), %rdx
movl (%rdx), %ecx
movl %ecx, (%r9)
movl %r11d, (%rdx)
cmpq %rax, %rsi
jbe .L474
movq %rax, %rdx
.L468:
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r10
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rsi, %rax
jnb .L461
.L464:
movd (%rdi,%rax,4), %xmm4
leaq (%rdi,%rdx,4), %r9
movdqa %xmm0, %xmm3
pshufd $0, %xmm4, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm0, %xmm2
movmskps %xmm2, %r8d
andl $1, %r8d
je .L465
cmpq %rcx, %rsi
jbe .L466
movdqa %xmm1, %xmm3
jmp .L470
.p2align 4,,10
.p2align 3
.L467:
cmpq %rcx, %rdx
je .L475
leaq (%rdi,%rcx,4), %rax
movl (%rax), %edx
movl %edx, (%r9)
movq %rcx, %rdx
movl %r11d, (%rax)
jmp .L468
.p2align 4,,10
.p2align 3
.L461:
ret
.p2align 4,,10
.p2align 3
.L474:
ret
.L475:
ret
.cfi_endproc
.LFE18796:
.size _ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0, .-_ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
.section .text._ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, @function
_ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0:
.LFB18797:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %rax
salq $2, %rax
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq (%rdi,%rax), %r15
pushq %r14
.cfi_offset 14, -32
leaq (%r15,%rax), %r14
pushq %r13
.cfi_offset 13, -40
leaq (%r14,%rax), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%rax), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%rax), %rbx
leaq (%rbx,%rax), %r11
leaq (%r11,%rax), %r10
subq $240, %rsp
leaq (%r10,%rax), %r9
leaq (%r9,%rax), %r8
movq %rdi, -264(%rbp)
movq %rsi, -240(%rbp)
movdqu (%r15), %xmm6
movdqu (%rdi), %xmm12
leaq (%r8,%rax), %rdi
leaq (%rdi,%rax), %rsi
movdqu 0(%r13), %xmm5
movdqu (%r14), %xmm14
movdqa %xmm6, %xmm8
leaq (%rsi,%rax), %rcx
movdqu (%rbx), %xmm3
movdqu (%r12), %xmm11
pcmpgtd %xmm12, %xmm8
leaq (%rcx,%rax), %rdx
movdqu (%r10), %xmm2
movdqu (%r11), %xmm10
movdqu (%rdx), %xmm0
movdqu (%rsi), %xmm4
movq %rdx, -248(%rbp)
addq %rax, %rdx
movdqu (%rdx), %xmm15
movdqu (%r8), %xmm1
addq %rdx, %rax
movq %rdx, -256(%rbp)
movdqa %xmm8, %xmm13
movdqu (%r9), %xmm7
movdqu (%rdi), %xmm9
pandn %xmm6, %xmm13
movaps %xmm15, -112(%rbp)
pand %xmm8, %xmm6
movdqa %xmm13, %xmm15
movdqa %xmm12, %xmm13
pand %xmm8, %xmm13
por %xmm15, %xmm13
movdqa %xmm8, %xmm15
pandn %xmm12, %xmm15
movdqa %xmm5, %xmm12
pcmpgtd %xmm14, %xmm12
por %xmm15, %xmm6
movdqa %xmm12, %xmm8
pandn %xmm5, %xmm8
pand %xmm12, %xmm5
movdqa %xmm8, %xmm15
movdqa %xmm14, %xmm8
pand %xmm12, %xmm8
por %xmm15, %xmm8
movdqa %xmm12, %xmm15
pandn %xmm14, %xmm15
movdqa %xmm3, %xmm14
pcmpgtd %xmm11, %xmm14
por %xmm15, %xmm5
movdqa %xmm14, %xmm12
pandn %xmm3, %xmm12
pand %xmm14, %xmm3
movdqa %xmm12, %xmm15
movdqa %xmm11, %xmm12
pand %xmm14, %xmm12
por %xmm15, %xmm12
movdqa %xmm14, %xmm15
pandn %xmm11, %xmm15
movdqa %xmm2, %xmm11
pcmpgtd %xmm10, %xmm11
por %xmm15, %xmm3
movaps %xmm3, -64(%rbp)
movdqa %xmm10, %xmm3
movdqa %xmm11, %xmm14
pand %xmm11, %xmm3
pandn %xmm2, %xmm14
pand %xmm11, %xmm2
por %xmm14, %xmm3
movdqa %xmm11, %xmm14
pandn %xmm10, %xmm14
movdqa %xmm1, %xmm10
pcmpgtd %xmm7, %xmm10
por %xmm14, %xmm2
movdqa %xmm10, %xmm11
pandn %xmm1, %xmm11
pand %xmm10, %xmm1
movdqa %xmm11, %xmm14
movdqa %xmm7, %xmm11
pand %xmm10, %xmm11
por %xmm14, %xmm11
movdqa %xmm10, %xmm14
pandn %xmm7, %xmm14
movdqa %xmm4, %xmm7
pcmpgtd %xmm9, %xmm7
por %xmm14, %xmm1
movaps %xmm1, -80(%rbp)
movdqa %xmm7, %xmm10
movdqa %xmm7, %xmm1
movdqa %xmm9, %xmm7
pandn %xmm4, %xmm10
pand %xmm1, %xmm7
pand %xmm1, %xmm4
por %xmm10, %xmm7
movdqa %xmm1, %xmm10
movdqa %xmm0, %xmm1
pandn %xmm9, %xmm10
por %xmm10, %xmm4
movdqu (%rcx), %xmm10
pcmpgtd %xmm10, %xmm1
movdqu (%rcx), %xmm10
movdqu (%rcx), %xmm15
movdqa %xmm1, %xmm9
pand %xmm1, %xmm10
pandn %xmm0, %xmm9
pand %xmm1, %xmm0
por %xmm9, %xmm10
movdqa %xmm1, %xmm9
movdqu (%rax), %xmm1
pandn %xmm15, %xmm9
movdqa -112(%rbp), %xmm15
por %xmm9, %xmm0
pcmpgtd %xmm15, %xmm1
movaps %xmm0, -96(%rbp)
movdqu (%rax), %xmm0
movdqa %xmm1, %xmm9
pandn %xmm0, %xmm9
movdqa %xmm15, %xmm0
pand %xmm1, %xmm0
por %xmm9, %xmm0
movdqa %xmm1, %xmm9
pandn %xmm15, %xmm9
movdqu (%rax), %xmm15
pand %xmm15, %xmm1
movdqa %xmm13, %xmm15
por %xmm9, %xmm1
movdqa %xmm8, %xmm9
pcmpgtd %xmm13, %xmm9
movdqa %xmm9, %xmm14
pandn %xmm8, %xmm9
pand %xmm14, %xmm15
pand %xmm14, %xmm8
por %xmm15, %xmm9
movdqa %xmm14, %xmm15
movdqa %xmm6, %xmm14
pandn %xmm13, %xmm15
movdqa %xmm5, %xmm13
pcmpgtd %xmm6, %xmm13
por %xmm8, %xmm15
movdqa %xmm13, %xmm8
pand %xmm13, %xmm14
pandn %xmm5, %xmm8
pand %xmm13, %xmm5
por %xmm14, %xmm8
movdqa %xmm13, %xmm14
pandn %xmm6, %xmm14
movdqa %xmm3, %xmm6
pcmpgtd %xmm12, %xmm6
por %xmm14, %xmm5
movdqa -64(%rbp), %xmm14
movaps %xmm5, -112(%rbp)
movdqa %xmm12, %xmm5
movdqa %xmm6, %xmm13
pand %xmm6, %xmm5
pandn %xmm3, %xmm13
pand %xmm6, %xmm3
por %xmm13, %xmm5
movdqa %xmm6, %xmm13
movdqa %xmm14, %xmm6
pandn %xmm12, %xmm13
movdqa %xmm2, %xmm12
pcmpgtd %xmm14, %xmm12
por %xmm13, %xmm3
movdqa %xmm12, %xmm13
pand %xmm12, %xmm6
pandn %xmm2, %xmm13
pand %xmm12, %xmm2
por %xmm13, %xmm6
movdqa %xmm12, %xmm13
pandn %xmm14, %xmm13
movdqa %xmm11, %xmm14
por %xmm13, %xmm2
movdqa %xmm7, %xmm13
pcmpgtd %xmm11, %xmm13
movdqa %xmm13, %xmm12
pand %xmm13, %xmm14
pandn %xmm7, %xmm12
pand %xmm13, %xmm7
por %xmm14, %xmm12
movdqa %xmm13, %xmm14
pandn %xmm11, %xmm14
movdqa %xmm4, %xmm11
por %xmm14, %xmm7
movdqa -80(%rbp), %xmm14
movaps %xmm7, -128(%rbp)
pcmpgtd %xmm14, %xmm11
movdqa %xmm14, %xmm13
movdqa %xmm11, %xmm7
pand %xmm11, %xmm13
pandn %xmm4, %xmm7
pand %xmm11, %xmm4
por %xmm13, %xmm7
movdqa %xmm11, %xmm13
movdqa %xmm0, %xmm11
pcmpgtd %xmm10, %xmm11
pandn %xmm14, %xmm13
movdqa -96(%rbp), %xmm14
por %xmm13, %xmm4
movaps %xmm4, -80(%rbp)
movdqa %xmm10, %xmm4
movdqa %xmm11, %xmm13
pand %xmm11, %xmm4
pandn %xmm0, %xmm13
pand %xmm11, %xmm0
por %xmm13, %xmm4
movdqa %xmm11, %xmm13
movdqa %xmm1, %xmm11
pcmpgtd %xmm14, %xmm11
pandn %xmm10, %xmm13
movdqa %xmm14, %xmm10
por %xmm13, %xmm0
movdqa %xmm11, %xmm13
pand %xmm11, %xmm10
pandn %xmm1, %xmm13
pand %xmm11, %xmm1
por %xmm13, %xmm10
movdqa %xmm11, %xmm13
pandn %xmm14, %xmm13
movdqa %xmm9, %xmm14
por %xmm13, %xmm1
movdqa %xmm5, %xmm13
pcmpgtd %xmm9, %xmm13
movdqa %xmm13, %xmm11
pand %xmm13, %xmm14
pandn %xmm5, %xmm11
pand %xmm13, %xmm5
por %xmm14, %xmm11
movdqa %xmm13, %xmm14
movdqa %xmm8, %xmm13
pandn %xmm9, %xmm14
movdqa %xmm6, %xmm9
pcmpgtd %xmm8, %xmm9
por %xmm5, %xmm14
movdqa %xmm9, %xmm5
pand %xmm9, %xmm13
pandn %xmm6, %xmm5
pand %xmm9, %xmm6
por %xmm13, %xmm5
movdqa %xmm9, %xmm13
movdqa %xmm15, %xmm9
pandn %xmm8, %xmm13
movdqa %xmm3, %xmm8
pcmpgtd %xmm15, %xmm8
por %xmm13, %xmm6
movaps %xmm6, -96(%rbp)
movdqa %xmm8, %xmm6
pand %xmm8, %xmm9
pandn %xmm3, %xmm6
pand %xmm8, %xmm3
por %xmm9, %xmm6
movdqa %xmm8, %xmm9
movdqa %xmm2, %xmm8
pandn %xmm15, %xmm9
movdqa -112(%rbp), %xmm15
por %xmm9, %xmm3
pcmpgtd %xmm15, %xmm8
movaps %xmm3, -144(%rbp)
movdqa %xmm15, %xmm9
movdqa %xmm8, %xmm3
pand %xmm8, %xmm9
pandn %xmm2, %xmm3
pand %xmm8, %xmm2
por %xmm9, %xmm3
movdqa %xmm8, %xmm9
movdqa %xmm12, %xmm8
pandn %xmm15, %xmm9
movdqa -128(%rbp), %xmm15
por %xmm9, %xmm2
movaps %xmm2, -64(%rbp)
movdqa %xmm4, %xmm2
pcmpgtd %xmm12, %xmm2
movdqa %xmm2, %xmm9
pand %xmm2, %xmm8
pandn %xmm4, %xmm9
pand %xmm2, %xmm4
por %xmm9, %xmm8
movdqa %xmm2, %xmm9
movdqa %xmm10, %xmm2
pcmpgtd %xmm7, %xmm2
pandn %xmm12, %xmm9
por %xmm9, %xmm4
movdqa %xmm7, %xmm9
movdqa %xmm2, %xmm12
pand %xmm2, %xmm9
pandn %xmm10, %xmm12
pand %xmm2, %xmm10
por %xmm12, %xmm9
movdqa %xmm2, %xmm12
movdqa %xmm15, %xmm2
pandn %xmm7, %xmm12
movdqa %xmm0, %xmm7
pcmpgtd %xmm15, %xmm7
por %xmm12, %xmm10
movdqa %xmm7, %xmm12
pand %xmm7, %xmm2
pandn %xmm0, %xmm12
pand %xmm7, %xmm0
por %xmm12, %xmm2
movdqa %xmm7, %xmm12
pandn %xmm15, %xmm12
movdqa -80(%rbp), %xmm15
por %xmm12, %xmm0
movdqa %xmm1, %xmm12
pcmpgtd %xmm15, %xmm12
movdqa %xmm12, %xmm7
pandn %xmm1, %xmm7
pand %xmm12, %xmm1
movdqa %xmm7, %xmm13
movdqa %xmm15, %xmm7
pand %xmm12, %xmm7
por %xmm13, %xmm7
movdqa %xmm12, %xmm13
movdqa %xmm8, %xmm12
pcmpgtd %xmm11, %xmm12
pandn %xmm15, %xmm13
por %xmm13, %xmm1
movdqa %xmm12, %xmm15
pandn %xmm8, %xmm15
pand %xmm12, %xmm8
movdqa %xmm15, %xmm13
movdqa %xmm11, %xmm15
pand %xmm12, %xmm15
por %xmm13, %xmm15
movaps %xmm15, -112(%rbp)
movdqa %xmm12, %xmm15
movdqa %xmm5, %xmm12
pandn %xmm11, %xmm15
movdqa %xmm15, %xmm13
movdqa %xmm8, %xmm15
movdqa %xmm9, %xmm8
pcmpgtd %xmm5, %xmm8
por %xmm13, %xmm15
movdqa -96(%rbp), %xmm13
movdqa %xmm8, %xmm11
pand %xmm8, %xmm12
pandn %xmm9, %xmm11
pand %xmm8, %xmm9
por %xmm11, %xmm12
movdqa %xmm8, %xmm11
movdqa %xmm2, %xmm8
pcmpgtd %xmm6, %xmm8
pandn %xmm5, %xmm11
movdqa %xmm6, %xmm5
movaps %xmm12, -128(%rbp)
por %xmm11, %xmm9
movdqa %xmm8, %xmm11
pand %xmm8, %xmm5
pandn %xmm2, %xmm11
pand %xmm8, %xmm2
por %xmm11, %xmm5
movdqa %xmm8, %xmm11
movdqa %xmm7, %xmm8
pcmpgtd %xmm3, %xmm8
pandn %xmm6, %xmm11
movdqa %xmm3, %xmm6
movaps %xmm5, -80(%rbp)
por %xmm11, %xmm2
movdqa %xmm8, %xmm11
pand %xmm8, %xmm6
pandn %xmm7, %xmm11
pand %xmm8, %xmm7
por %xmm11, %xmm6
movdqa %xmm8, %xmm11
movdqa %xmm4, %xmm8
pcmpgtd %xmm14, %xmm8
pandn %xmm3, %xmm11
movdqa %xmm14, %xmm3
por %xmm11, %xmm7
movdqa %xmm8, %xmm11
pand %xmm8, %xmm3
pandn %xmm4, %xmm11
pand %xmm8, %xmm4
por %xmm11, %xmm3
movdqa %xmm8, %xmm11
movdqa %xmm13, %xmm8
pandn %xmm14, %xmm11
movdqa -144(%rbp), %xmm14
por %xmm11, %xmm4
movdqa %xmm10, %xmm11
pcmpgtd %xmm13, %xmm11
movdqa %xmm11, %xmm12
pand %xmm11, %xmm8
pandn %xmm10, %xmm12
pand %xmm11, %xmm10
por %xmm12, %xmm8
movdqa %xmm11, %xmm12
movdqa %xmm0, %xmm11
pcmpgtd %xmm14, %xmm11
pandn %xmm13, %xmm12
por %xmm12, %xmm10
movdqa %xmm14, %xmm12
movdqa %xmm11, %xmm13
pand %xmm11, %xmm12
pandn %xmm0, %xmm13
pand %xmm11, %xmm0
por %xmm13, %xmm12
movdqa %xmm11, %xmm13
pandn %xmm14, %xmm13
movdqa -64(%rbp), %xmm14
por %xmm13, %xmm0
movdqa %xmm1, %xmm13
pcmpgtd %xmm14, %xmm13
movdqa %xmm13, %xmm11
movdqa %xmm13, %xmm5
pandn -64(%rbp), %xmm5
pandn %xmm1, %xmm11
pand %xmm13, %xmm1
pand %xmm13, %xmm14
por %xmm5, %xmm1
por %xmm14, %xmm11
movdqa %xmm8, %xmm13
movaps %xmm1, -192(%rbp)
movdqa %xmm2, %xmm1
pcmpgtd %xmm8, %xmm1
movdqa %xmm1, %xmm14
pand %xmm1, %xmm13
pandn %xmm2, %xmm14
pand %xmm1, %xmm2
por %xmm14, %xmm13
movdqa %xmm1, %xmm14
movdqa %xmm12, %xmm1
pandn %xmm8, %xmm14
movdqa %xmm9, %xmm8
pcmpgtd %xmm12, %xmm8
por %xmm14, %xmm2
movdqa %xmm8, %xmm14
pand %xmm8, %xmm1
pandn %xmm9, %xmm14
pand %xmm8, %xmm9
por %xmm14, %xmm1
movdqa %xmm8, %xmm14
movdqa %xmm4, %xmm8
pcmpgtd %xmm6, %xmm8
pandn %xmm12, %xmm14
por %xmm14, %xmm9
movdqa %xmm6, %xmm14
movdqa %xmm8, %xmm5
pand %xmm8, %xmm14
pandn %xmm4, %xmm5
pand %xmm8, %xmm4
por %xmm5, %xmm14
movdqa %xmm8, %xmm5
movdqa %xmm11, %xmm8
pandn %xmm6, %xmm5
movdqa %xmm7, %xmm6
pcmpgtd %xmm11, %xmm6
por %xmm5, %xmm4
movdqa %xmm6, %xmm5
pand %xmm6, %xmm8
pandn %xmm7, %xmm5
pand %xmm6, %xmm7
por %xmm5, %xmm8
movdqa %xmm6, %xmm5
movdqa %xmm10, %xmm6
pandn %xmm11, %xmm5
movdqa %xmm0, %xmm11
pcmpgtd %xmm10, %xmm11
por %xmm5, %xmm7
movdqa %xmm11, %xmm5
pand %xmm11, %xmm6
pandn %xmm0, %xmm5
pand %xmm11, %xmm0
por %xmm5, %xmm6
movdqa %xmm11, %xmm5
movdqa %xmm15, %xmm11
pcmpgtd %xmm3, %xmm11
pandn %xmm10, %xmm5
movdqa %xmm3, %xmm10
por %xmm5, %xmm0
movaps %xmm0, -64(%rbp)
movdqa -128(%rbp), %xmm0
movdqa %xmm11, %xmm5
pand %xmm11, %xmm10
pandn %xmm15, %xmm5
pand %xmm11, %xmm15
por %xmm5, %xmm10
movdqa %xmm11, %xmm5
pandn %xmm3, %xmm5
movdqa %xmm0, %xmm3
por %xmm5, %xmm15
movdqa -80(%rbp), %xmm5
movdqa %xmm5, %xmm11
pcmpgtd %xmm0, %xmm11
movdqa %xmm11, %xmm12
pand %xmm11, %xmm3
pandn %xmm5, %xmm12
movdqa %xmm11, %xmm5
pandn %xmm0, %xmm5
por %xmm12, %xmm3
movdqa %xmm5, %xmm12
movdqa -80(%rbp), %xmm5
movdqa %xmm3, %xmm0
pand %xmm11, %xmm5
movdqa %xmm10, %xmm11
pcmpgtd %xmm3, %xmm11
por %xmm12, %xmm5
movdqa %xmm11, %xmm12
pand %xmm11, %xmm0
pandn %xmm10, %xmm12
pand %xmm11, %xmm10
por %xmm0, %xmm12
movdqa -64(%rbp), %xmm0
movaps %xmm12, -128(%rbp)
movdqa %xmm11, %xmm12
movdqa %xmm6, %xmm11
pcmpgtd %xmm8, %xmm11
pandn %xmm3, %xmm12
movdqa %xmm8, %xmm3
por %xmm12, %xmm10
movdqa %xmm11, %xmm12
pand %xmm11, %xmm3
pandn %xmm6, %xmm12
pand %xmm11, %xmm6
por %xmm12, %xmm3
movdqa %xmm11, %xmm12
movdqa %xmm15, %xmm11
pcmpgtd %xmm5, %xmm11
pandn %xmm8, %xmm12
movdqa %xmm5, %xmm8
por %xmm12, %xmm6
movdqa %xmm11, %xmm12
pand %xmm11, %xmm8
pandn %xmm15, %xmm12
pand %xmm11, %xmm15
por %xmm12, %xmm8
movdqa %xmm11, %xmm12
movdqa %xmm7, %xmm11
pandn %xmm5, %xmm12
movdqa %xmm0, %xmm5
pcmpgtd %xmm7, %xmm5
por %xmm12, %xmm15
movdqa %xmm5, %xmm12
pand %xmm5, %xmm11
pandn %xmm0, %xmm12
pand %xmm5, %xmm0
por %xmm12, %xmm11
movdqa %xmm5, %xmm12
pandn %xmm7, %xmm12
movdqa %xmm8, %xmm7
por %xmm12, %xmm0
movdqa %xmm1, %xmm12
movaps %xmm0, -208(%rbp)
movdqa %xmm10, %xmm0
pcmpgtd %xmm13, %xmm12
cmpq $1, -240(%rbp)
pcmpgtd %xmm8, %xmm0
movdqa %xmm0, %xmm5
pand %xmm0, %xmm7
pandn %xmm10, %xmm5
pand %xmm0, %xmm10
por %xmm5, %xmm7
movdqa %xmm0, %xmm5
movdqa %xmm12, %xmm0
pandn %xmm8, %xmm5
pandn %xmm1, %xmm0
pand %xmm12, %xmm1
movaps %xmm7, -144(%rbp)
por %xmm5, %xmm10
movdqa %xmm13, %xmm5
movdqa %xmm9, %xmm7
pand %xmm12, %xmm5
movdqa %xmm11, %xmm8
por %xmm0, %xmm5
movdqa %xmm12, %xmm0
pandn %xmm13, %xmm0
movdqa %xmm6, %xmm13
por %xmm0, %xmm1
pcmpgtd %xmm11, %xmm13
movdqa %xmm2, %xmm0
pcmpgtd %xmm9, %xmm0
movdqa %xmm1, %xmm12
pand %xmm13, %xmm8
movdqa %xmm0, %xmm1
pand %xmm0, %xmm7
pandn %xmm2, %xmm1
pand %xmm0, %xmm2
por %xmm1, %xmm7
movdqa %xmm0, %xmm1
movdqa %xmm13, %xmm0
pandn %xmm9, %xmm1
pandn %xmm6, %xmm0
movdqa %xmm14, %xmm9
por %xmm1, %xmm2
movdqa %xmm15, %xmm1
por %xmm0, %xmm8
pcmpgtd %xmm14, %xmm1
movdqa %xmm13, %xmm0
pand %xmm6, %xmm13
pandn %xmm11, %xmm0
movdqa %xmm3, %xmm6
movdqa %xmm7, %xmm11
por %xmm0, %xmm13
movdqa %xmm1, %xmm0
pand %xmm1, %xmm9
pandn %xmm15, %xmm0
pand %xmm1, %xmm15
por %xmm0, %xmm9
movdqa %xmm1, %xmm0
pandn %xmm14, %xmm0
movdqa %xmm9, %xmm14
por %xmm0, %xmm15
movdqa %xmm4, %xmm0
pcmpgtd %xmm3, %xmm0
movdqa %xmm0, %xmm1
pand %xmm0, %xmm6
pandn %xmm4, %xmm1
pand %xmm0, %xmm4
por %xmm1, %xmm6
movdqa %xmm0, %xmm1
movdqa %xmm5, %xmm0
pcmpgtd %xmm9, %xmm0
pcmpgtd %xmm6, %xmm11
pandn %xmm3, %xmm1
por %xmm1, %xmm4
movdqa %xmm12, %xmm3
movdqa %xmm0, %xmm1
pand %xmm0, %xmm14
pandn %xmm5, %xmm1
pand %xmm0, %xmm5
por %xmm1, %xmm14
movdqa %xmm0, %xmm1
pandn %xmm9, %xmm1
movdqa %xmm6, %xmm9
por %xmm1, %xmm5
movdqa %xmm15, %xmm1
pand %xmm11, %xmm9
pcmpgtd %xmm12, %xmm1
movdqa %xmm1, %xmm0
pand %xmm1, %xmm3
pandn %xmm15, %xmm0
por %xmm0, %xmm3
movdqa %xmm1, %xmm0
pand %xmm15, %xmm1
pandn %xmm12, %xmm0
por %xmm0, %xmm1
movdqa %xmm11, %xmm0
pandn %xmm7, %xmm0
pand %xmm11, %xmm7
por %xmm0, %xmm9
movdqa %xmm11, %xmm0
pandn %xmm6, %xmm0
por %xmm0, %xmm7
movdqa %xmm4, %xmm0
pcmpgtd %xmm2, %xmm0
movdqa %xmm7, %xmm11
movdqa %xmm2, %xmm7
movdqa %xmm0, %xmm6
movdqa %xmm0, %xmm12
pand %xmm0, %xmm7
pandn %xmm2, %xmm6
movdqa %xmm10, %xmm2
pand %xmm4, %xmm0
pcmpgtd %xmm14, %xmm2
por %xmm6, %xmm0
pandn %xmm4, %xmm12
movdqa %xmm14, %xmm6
por %xmm12, %xmm7
movdqa %xmm2, %xmm4
pand %xmm2, %xmm6
pandn %xmm10, %xmm4
pand %xmm2, %xmm10
por %xmm4, %xmm6
movdqa %xmm2, %xmm4
movdqa %xmm3, %xmm2
pcmpgtd %xmm5, %xmm2
pandn %xmm14, %xmm4
movaps %xmm6, -160(%rbp)
movdqa %xmm5, %xmm6
por %xmm4, %xmm10
movaps %xmm10, -64(%rbp)
movdqa %xmm8, %xmm10
movdqa %xmm2, %xmm4
pand %xmm2, %xmm6
pandn %xmm3, %xmm4
pand %xmm2, %xmm3
por %xmm4, %xmm6
movdqa %xmm2, %xmm4
movdqa %xmm1, %xmm2
pcmpgtd %xmm9, %xmm2
pandn %xmm5, %xmm4
movaps %xmm6, -80(%rbp)
movdqa %xmm9, %xmm5
por %xmm4, %xmm3
movdqa %xmm7, %xmm6
pcmpgtd %xmm11, %xmm6
movdqa %xmm2, %xmm4
pand %xmm2, %xmm5
pandn %xmm1, %xmm4
pand %xmm2, %xmm1
por %xmm4, %xmm5
movdqa %xmm2, %xmm4
movdqa %xmm11, %xmm2
pandn %xmm9, %xmm4
pand %xmm6, %xmm2
por %xmm4, %xmm1
movdqa %xmm6, %xmm4
pandn %xmm7, %xmm4
pand %xmm6, %xmm7
por %xmm4, %xmm2
movdqa %xmm6, %xmm4
pandn %xmm11, %xmm4
movdqa %xmm2, %xmm9
por %xmm4, %xmm7
pcmpgtd %xmm1, %xmm9
movdqa %xmm0, %xmm4
pcmpgtd %xmm8, %xmm4
movdqa %xmm4, %xmm6
pand %xmm4, %xmm10
pandn %xmm0, %xmm6
pand %xmm4, %xmm0
por %xmm6, %xmm10
movdqa %xmm4, %xmm6
movdqa %xmm5, %xmm4
pcmpgtd %xmm3, %xmm4
pandn %xmm8, %xmm6
movdqa %xmm3, %xmm8
por %xmm6, %xmm0
movdqa %xmm4, %xmm6
pand %xmm4, %xmm8
pandn %xmm5, %xmm6
pand %xmm4, %xmm5
por %xmm6, %xmm8
movdqa %xmm4, %xmm6
movdqa %xmm9, %xmm4
pandn %xmm3, %xmm6
movdqa %xmm1, %xmm3
pandn %xmm2, %xmm4
movaps %xmm8, -96(%rbp)
pand %xmm9, %xmm3
por %xmm6, %xmm5
pand %xmm9, %xmm2
por %xmm4, %xmm3
movdqa %xmm9, %xmm4
movdqa %xmm5, %xmm12
pandn %xmm1, %xmm4
por %xmm4, %xmm2
jbe .L481
movdqa -112(%rbp), %xmm5
pshufd $177, %xmm13, %xmm14
pshufd $177, -192(%rbp), %xmm13
movdqa %xmm13, %xmm8
pshufd $177, %xmm3, %xmm6
pshufd $177, %xmm0, %xmm0
pshufd $177, %xmm7, %xmm7
pshufd $177, -208(%rbp), %xmm15
pcmpgtd %xmm5, %xmm8
movaps %xmm6, -176(%rbp)
movdqa %xmm5, %xmm4
movdqa %xmm15, %xmm9
movdqa -160(%rbp), %xmm3
pshufd $177, %xmm10, %xmm10
pshufd $177, %xmm2, %xmm2
movdqa %xmm8, %xmm6
movdqa %xmm8, %xmm1
pand %xmm8, %xmm4
pandn %xmm5, %xmm6
movdqa -128(%rbp), %xmm5
pandn %xmm13, %xmm1
pand %xmm13, %xmm8
por %xmm1, %xmm4
movaps %xmm6, -208(%rbp)
movdqa -144(%rbp), %xmm6
pcmpgtd %xmm5, %xmm9
movdqa %xmm5, %xmm11
movaps %xmm4, -192(%rbp)
movdqa %xmm6, %xmm4
movdqa %xmm9, %xmm1
pand %xmm9, %xmm11
pandn %xmm15, %xmm1
por %xmm1, %xmm11
movdqa %xmm9, %xmm1
pand %xmm15, %xmm9
pandn %xmm5, %xmm1
movdqa %xmm14, %xmm5
pcmpgtd %xmm6, %xmm5
movaps %xmm1, -224(%rbp)
movdqa %xmm5, %xmm1
pand %xmm5, %xmm4
pandn %xmm14, %xmm1
por %xmm1, %xmm4
movdqa %xmm5, %xmm1
pand %xmm14, %xmm5
pandn %xmm6, %xmm1
movaps %xmm4, -112(%rbp)
movdqa %xmm3, %xmm6
movaps %xmm1, -288(%rbp)
movdqa %xmm0, %xmm1
pcmpgtd %xmm3, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm6
pandn %xmm0, %xmm4
por %xmm4, %xmm6
movdqa %xmm1, %xmm4
pand %xmm0, %xmm1
pandn %xmm3, %xmm4
movaps %xmm6, -128(%rbp)
movdqa -64(%rbp), %xmm6
movaps %xmm4, -304(%rbp)
movdqa %xmm10, %xmm4
por -304(%rbp), %xmm1
pcmpgtd %xmm6, %xmm4
pshufd $177, %xmm1, %xmm1
movdqa %xmm4, %xmm3
pandn %xmm10, %xmm3
pand %xmm4, %xmm10
movaps %xmm3, -320(%rbp)
movdqa %xmm4, %xmm3
pand -64(%rbp), %xmm4
por -320(%rbp), %xmm4
pandn %xmm6, %xmm3
por %xmm3, %xmm10
movdqa %xmm7, %xmm3
pshufd $177, %xmm4, %xmm4
movaps %xmm10, -144(%rbp)
movdqa -80(%rbp), %xmm10
pcmpgtd %xmm10, %xmm3
movdqa %xmm3, %xmm6
pandn %xmm7, %xmm3
movaps %xmm3, -336(%rbp)
movdqa %xmm6, %xmm3
pand %xmm6, %xmm7
pand -80(%rbp), %xmm6
pandn %xmm10, %xmm3
por %xmm3, %xmm7
movdqa %xmm2, %xmm3
movaps %xmm7, -160(%rbp)
movdqa -96(%rbp), %xmm7
pcmpgtd %xmm7, %xmm3
movdqa %xmm3, %xmm10
pandn %xmm2, %xmm3
movaps %xmm3, -352(%rbp)
movdqa %xmm10, %xmm3
pand %xmm10, %xmm2
pandn %xmm7, %xmm3
movdqa -176(%rbp), %xmm7
por %xmm3, %xmm2
pcmpgtd %xmm12, %xmm7
movdqa %xmm7, %xmm3
pandn -176(%rbp), %xmm3
movaps %xmm3, -368(%rbp)
movdqa %xmm7, %xmm3
pandn %xmm12, %xmm3
movaps %xmm3, -384(%rbp)
movdqa -176(%rbp), %xmm3
pand %xmm7, %xmm3
pand %xmm12, %xmm7
por -384(%rbp), %xmm3
por -336(%rbp), %xmm6
por -368(%rbp), %xmm7
movdqa -192(%rbp), %xmm13
pand -96(%rbp), %xmm10
pshufd $177, %xmm7, %xmm7
pshufd $177, %xmm6, %xmm6
por -352(%rbp), %xmm10
movdqa %xmm7, %xmm0
por -288(%rbp), %xmm5
por -224(%rbp), %xmm9
pcmpgtd %xmm13, %xmm0
pshufd $177, %xmm10, %xmm14
por -208(%rbp), %xmm8
pshufd $177, %xmm9, %xmm15
movdqa %xmm13, %xmm9
movaps %xmm14, -64(%rbp)
pshufd $177, %xmm5, %xmm5
pshufd $177, %xmm8, %xmm12
movdqa %xmm3, %xmm8
movdqa %xmm0, %xmm10
pandn %xmm7, %xmm0
pand %xmm10, %xmm9
por %xmm0, %xmm9
movdqa %xmm10, %xmm0
pand %xmm7, %xmm10
pandn %xmm13, %xmm0
movdqa %xmm12, %xmm13
pcmpgtd %xmm3, %xmm13
movaps %xmm0, -80(%rbp)
movdqa %xmm13, %xmm0
pand %xmm13, %xmm8
pandn %xmm12, %xmm0
por %xmm0, %xmm8
movdqa %xmm13, %xmm0
pand %xmm12, %xmm13
pandn %xmm3, %xmm0
movaps %xmm8, -224(%rbp)
movdqa %xmm11, %xmm8
movaps %xmm0, -304(%rbp)
movdqa %xmm14, %xmm0
pcmpgtd %xmm11, %xmm0
movdqa %xmm0, %xmm3
pandn -64(%rbp), %xmm3
pand %xmm0, %xmm8
por %xmm3, %xmm8
movdqa %xmm0, %xmm3
pand -64(%rbp), %xmm0
pandn %xmm11, %xmm3
movdqa %xmm2, %xmm11
movaps %xmm8, -96(%rbp)
movaps %xmm3, -320(%rbp)
movdqa %xmm15, %xmm3
por -320(%rbp), %xmm0
pcmpgtd %xmm2, %xmm3
pshufd $177, %xmm0, %xmm0
movdqa %xmm3, %xmm14
pand %xmm3, %xmm11
pandn %xmm15, %xmm14
por %xmm14, %xmm11
movdqa %xmm3, %xmm14
pand %xmm15, %xmm3
movaps %xmm11, -176(%rbp)
movdqa -112(%rbp), %xmm11
pandn %xmm2, %xmm14
movdqa %xmm6, %xmm2
movaps %xmm14, -336(%rbp)
pcmpgtd %xmm11, %xmm2
movdqa %xmm2, %xmm14
movdqa %xmm2, %xmm8
pandn %xmm6, %xmm14
pand %xmm2, %xmm6
pandn %xmm11, %xmm8
movaps %xmm14, -352(%rbp)
movdqa %xmm6, %xmm14
movdqa %xmm5, %xmm6
pand -112(%rbp), %xmm2
por %xmm8, %xmm14
por -352(%rbp), %xmm2
movdqa -160(%rbp), %xmm8
movaps %xmm14, -192(%rbp)
pcmpgtd %xmm8, %xmm6
pshufd $177, %xmm2, %xmm2
movdqa %xmm6, %xmm14
pandn %xmm5, %xmm6
movaps %xmm6, -368(%rbp)
movdqa %xmm14, %xmm6
pand %xmm14, %xmm5
pandn %xmm8, %xmm6
por %xmm6, %xmm5
movdqa -128(%rbp), %xmm6
movaps %xmm5, -208(%rbp)
movdqa %xmm4, %xmm5
pcmpgtd %xmm6, %xmm5
movdqa %xmm5, %xmm8
pandn %xmm4, %xmm5
movdqa %xmm5, %xmm11
movdqa %xmm8, %xmm5
pand %xmm8, %xmm4
pandn %xmm6, %xmm5
pand -128(%rbp), %xmm8
por %xmm5, %xmm4
movdqa %xmm1, %xmm5
pcmpgtd -144(%rbp), %xmm5
movaps %xmm4, -288(%rbp)
por %xmm11, %xmm8
pshufd $177, %xmm8, %xmm8
movdqa %xmm5, %xmm6
movdqa %xmm5, %xmm4
pandn -144(%rbp), %xmm4
pandn %xmm1, %xmm6
por -80(%rbp), %xmm10
pand %xmm5, %xmm1
movdqa -288(%rbp), %xmm15
pand -144(%rbp), %xmm5
por %xmm4, %xmm1
por -304(%rbp), %xmm13
pshufd $177, %xmm10, %xmm11
movdqa %xmm15, %xmm4
por -336(%rbp), %xmm3
por %xmm6, %xmm5
pshufd $177, %xmm13, %xmm10
movdqa -96(%rbp), %xmm6
movaps %xmm11, -128(%rbp)
pshufd $177, %xmm5, %xmm7
movaps %xmm10, -80(%rbp)
movdqa %xmm9, %xmm10
movdqa -192(%rbp), %xmm5
movaps %xmm7, -64(%rbp)
movdqa %xmm8, %xmm7
pshufd $177, %xmm3, %xmm3
pand -160(%rbp), %xmm14
por -368(%rbp), %xmm14
pcmpgtd %xmm9, %xmm7
pshufd $177, %xmm14, %xmm14
movdqa %xmm7, %xmm13
pand %xmm7, %xmm10
pandn %xmm8, %xmm13
por %xmm13, %xmm10
movdqa %xmm7, %xmm13
pand %xmm8, %xmm7
pandn %xmm9, %xmm13
movdqa %xmm2, %xmm9
movdqa %xmm10, %xmm8
pcmpgtd %xmm6, %xmm9
movaps %xmm13, -304(%rbp)
movdqa %xmm9, %xmm13
pandn %xmm2, %xmm9
movdqa %xmm13, %xmm12
pand %xmm13, %xmm2
movaps %xmm9, -320(%rbp)
pandn %xmm6, %xmm12
por %xmm12, %xmm2
movdqa %xmm11, %xmm12
pcmpgtd %xmm15, %xmm12
movdqa %xmm12, %xmm6
pandn -128(%rbp), %xmm12
pand %xmm6, %xmm4
movdqa %xmm4, %xmm9
por %xmm12, %xmm9
movdqa %xmm6, %xmm12
pandn %xmm15, %xmm12
movdqa -224(%rbp), %xmm15
movaps %xmm12, -288(%rbp)
movdqa %xmm0, %xmm12
pcmpgtd %xmm5, %xmm12
movdqa %xmm12, %xmm4
pandn %xmm0, %xmm4
pand %xmm12, %xmm0
movaps %xmm4, -336(%rbp)
movdqa %xmm12, %xmm4
pandn %xmm5, %xmm4
por %xmm4, %xmm0
movdqa -64(%rbp), %xmm4
movaps %xmm0, -144(%rbp)
movdqa %xmm4, %xmm11
pcmpgtd %xmm15, %xmm11
movdqa %xmm11, %xmm5
pandn -64(%rbp), %xmm11
movdqa %xmm11, %xmm4
movdqa %xmm15, %xmm11
pand %xmm5, %xmm11
por %xmm4, %xmm11
movdqa %xmm5, %xmm4
pandn %xmm15, %xmm4
movaps %xmm11, -160(%rbp)
movdqa -176(%rbp), %xmm15
movdqa %xmm14, %xmm11
movaps %xmm4, -352(%rbp)
pcmpgtd %xmm15, %xmm11
movdqa %xmm11, %xmm4
pandn %xmm14, %xmm4
pand %xmm11, %xmm14
movaps %xmm4, -368(%rbp)
movdqa %xmm11, %xmm4
pandn %xmm15, %xmm4
movdqa -80(%rbp), %xmm15
por %xmm4, %xmm14
movdqa %xmm15, %xmm4
movaps %xmm14, -112(%rbp)
movdqa %xmm1, %xmm15
pcmpgtd %xmm1, %xmm4
movdqa %xmm4, %xmm14
pandn -80(%rbp), %xmm14
pand %xmm4, %xmm15
por %xmm14, %xmm15
movdqa %xmm4, %xmm14
pandn %xmm1, %xmm14
movdqa -208(%rbp), %xmm1
movaps %xmm14, -384(%rbp)
movdqa %xmm3, %xmm14
pcmpgtd %xmm1, %xmm14
movdqa %xmm14, %xmm0
pandn %xmm3, %xmm0
pand %xmm14, %xmm3
movaps %xmm0, -400(%rbp)
movdqa %xmm14, %xmm0
pandn %xmm1, %xmm0
por %xmm0, %xmm3
movaps %xmm3, -224(%rbp)
movdqa -96(%rbp), %xmm3
movdqa -208(%rbp), %xmm1
pand -80(%rbp), %xmm4
pand -64(%rbp), %xmm5
pand %xmm13, %xmm3
por -384(%rbp), %xmm4
por -320(%rbp), %xmm3
movdqa -400(%rbp), %xmm13
pand %xmm14, %xmm1
por -304(%rbp), %xmm7
pshufd $177, %xmm3, %xmm3
pand -128(%rbp), %xmm6
pand -192(%rbp), %xmm12
por %xmm1, %xmm13
pshufd $177, %xmm4, %xmm1
pshufd $177, %xmm7, %xmm7
movdqa -144(%rbp), %xmm4
movaps %xmm1, -64(%rbp)
movdqa %xmm3, %xmm1
por -336(%rbp), %xmm12
por -288(%rbp), %xmm6
pcmpgtd %xmm10, %xmm1
por -352(%rbp), %xmm5
pand -176(%rbp), %xmm11
pshufd $177, %xmm12, %xmm12
pshufd $177, %xmm6, %xmm6
por -368(%rbp), %xmm11
pshufd $177, %xmm5, %xmm5
pshufd $177, %xmm13, %xmm13
movdqa %xmm1, %xmm0
pand %xmm1, %xmm8
pshufd $177, %xmm11, %xmm11
pandn %xmm3, %xmm0
por %xmm0, %xmm8
movdqa %xmm1, %xmm0
pand %xmm3, %xmm1
pandn %xmm10, %xmm0
movdqa %xmm7, %xmm10
pcmpgtd %xmm2, %xmm10
por %xmm0, %xmm1
movdqa %xmm2, %xmm0
movdqa %xmm10, %xmm3
pand %xmm10, %xmm0
pandn %xmm7, %xmm3
por %xmm0, %xmm3
movdqa %xmm10, %xmm0
pand %xmm7, %xmm10
pandn %xmm2, %xmm0
movdqa %xmm12, %xmm2
pcmpgtd %xmm9, %xmm2
movdqa %xmm0, %xmm14
movdqa %xmm4, %xmm0
por %xmm10, %xmm14
movdqa %xmm9, %xmm10
movdqa %xmm2, %xmm7
pand %xmm2, %xmm10
pandn %xmm12, %xmm7
por %xmm7, %xmm10
movdqa %xmm2, %xmm7
pand %xmm12, %xmm2
pandn %xmm9, %xmm7
por %xmm7, %xmm2
movdqa %xmm2, %xmm12
movdqa %xmm6, %xmm2
pcmpgtd %xmm4, %xmm2
pand %xmm2, %xmm0
movdqa %xmm2, %xmm7
pandn %xmm6, %xmm7
movdqa %xmm0, %xmm9
movdqa %xmm11, %xmm0
por %xmm7, %xmm9
movdqa %xmm2, %xmm7
pand %xmm6, %xmm2
pandn %xmm4, %xmm7
movdqa -160(%rbp), %xmm4
por %xmm2, %xmm7
pcmpgtd %xmm4, %xmm0
movdqa %xmm4, %xmm6
movdqa %xmm0, %xmm2
pand %xmm0, %xmm6
pandn %xmm11, %xmm2
por %xmm2, %xmm6
movdqa %xmm0, %xmm2
pand %xmm11, %xmm0
pandn %xmm4, %xmm2
movaps %xmm6, -288(%rbp)
movdqa -112(%rbp), %xmm6
por %xmm2, %xmm0
movdqa %xmm0, %xmm11
movdqa %xmm5, %xmm0
pcmpgtd %xmm6, %xmm0
movdqa %xmm0, %xmm2
pand %xmm0, %xmm6
movdqa %xmm0, %xmm4
pandn %xmm5, %xmm2
pand %xmm5, %xmm0
movdqa %xmm13, %xmm5
pcmpgtd %xmm15, %xmm5
pandn -112(%rbp), %xmm4
por %xmm2, %xmm6
por %xmm4, %xmm0
movaps %xmm0, -304(%rbp)
movdqa %xmm5, %xmm2
movdqa %xmm5, %xmm0
movdqa %xmm15, %xmm5
pandn %xmm13, %xmm2
pand %xmm0, %xmm5
por %xmm2, %xmm5
movdqa %xmm0, %xmm2
pand %xmm13, %xmm0
movaps %xmm5, -320(%rbp)
movdqa -64(%rbp), %xmm5
pandn %xmm15, %xmm2
movdqa -224(%rbp), %xmm15
movdqa %xmm0, %xmm13
movdqa %xmm5, %xmm4
por %xmm2, %xmm13
pcmpgtd %xmm15, %xmm4
movdqa %xmm4, %xmm2
movdqa %xmm4, %xmm0
movdqa %xmm5, %xmm4
pandn %xmm5, %xmm2
movdqa %xmm15, %xmm5
pand %xmm0, %xmm5
por %xmm2, %xmm5
movdqa %xmm0, %xmm2
pand %xmm4, %xmm0
pandn %xmm15, %xmm2
movdqa %xmm0, %xmm15
pshufd $177, %xmm8, %xmm0
movaps %xmm5, -336(%rbp)
por %xmm2, %xmm15
movdqa %xmm0, %xmm2
pcmpgtd %xmm8, %xmm2
movdqa %xmm2, %xmm4
movdqa %xmm2, %xmm5
pandn %xmm0, %xmm4
pandn %xmm8, %xmm5
pand %xmm2, %xmm0
pand %xmm2, %xmm8
por %xmm5, %xmm0
por %xmm4, %xmm8
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm8, %xmm8
punpckldq %xmm0, %xmm8
pshufd $177, %xmm1, %xmm0
movdqa %xmm0, %xmm2
movaps %xmm8, -352(%rbp)
pcmpgtd %xmm1, %xmm2
movaps %xmm8, -112(%rbp)
movdqa %xmm2, %xmm4
movdqa %xmm2, %xmm8
pandn %xmm0, %xmm4
pandn %xmm1, %xmm8
pand %xmm2, %xmm0
pand %xmm2, %xmm1
por %xmm8, %xmm0
por %xmm4, %xmm1
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm1, %xmm1
punpckldq %xmm0, %xmm1
pshufd $177, %xmm3, %xmm0
movaps %xmm1, -368(%rbp)
movaps %xmm1, -128(%rbp)
movdqa %xmm0, %xmm1
pcmpgtd %xmm3, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm4
pandn %xmm0, %xmm2
pandn %xmm3, %xmm4
pand %xmm1, %xmm0
pand %xmm1, %xmm3
por %xmm4, %xmm0
por %xmm2, %xmm3
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm3, %xmm3
punpckldq %xmm0, %xmm3
pshufd $177, %xmm14, %xmm0
movdqa %xmm0, %xmm1
movaps %xmm3, -384(%rbp)
pcmpgtd %xmm14, %xmm1
movaps %xmm3, -144(%rbp)
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm14, %xmm3
pand %xmm1, %xmm0
pand %xmm1, %xmm14
por %xmm3, %xmm0
por %xmm2, %xmm14
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm14, %xmm14
punpckldq %xmm0, %xmm14
pshufd $177, %xmm10, %xmm0
movdqa %xmm0, %xmm1
movaps %xmm14, -160(%rbp)
cmpq $3, -240(%rbp)
pcmpgtd %xmm10, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm10, %xmm3
pand %xmm1, %xmm0
pand %xmm1, %xmm10
por %xmm3, %xmm0
por %xmm2, %xmm10
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm10, %xmm10
punpckldq %xmm0, %xmm10
pshufd $177, %xmm12, %xmm0
movdqa %xmm0, %xmm1
movaps %xmm10, -176(%rbp)
pcmpgtd %xmm12, %xmm1
movaps %xmm10, -64(%rbp)
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm12, %xmm3
pand %xmm1, %xmm0
pand %xmm1, %xmm12
por %xmm3, %xmm0
por %xmm2, %xmm12
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm12, %xmm12
punpckldq %xmm0, %xmm12
pshufd $177, %xmm9, %xmm0
movdqa %xmm0, %xmm1
movaps %xmm12, -192(%rbp)
pcmpgtd %xmm9, %xmm1
movaps %xmm12, -80(%rbp)
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm9, %xmm3
pand %xmm1, %xmm0
pand %xmm1, %xmm9
por %xmm3, %xmm0
por %xmm2, %xmm9
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm9, %xmm9
punpckldq %xmm0, %xmm9
pshufd $177, %xmm7, %xmm0
movdqa %xmm0, %xmm1
movaps %xmm9, -208(%rbp)
pcmpgtd %xmm7, %xmm1
movaps %xmm9, -96(%rbp)
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm7, %xmm3
pand %xmm1, %xmm7
por %xmm2, %xmm7
pand %xmm1, %xmm0
pshufd $136, %xmm7, %xmm7
por %xmm3, %xmm0
movdqa %xmm7, %xmm3
movdqa -288(%rbp), %xmm7
pshufd $221, %xmm0, %xmm0
punpckldq %xmm0, %xmm3
pshufd $177, %xmm7, %xmm0
movaps %xmm3, -224(%rbp)
movdqa %xmm3, %xmm12
movdqa %xmm0, %xmm1
pcmpgtd %xmm7, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm7, %xmm3
pand %xmm1, %xmm0
pand %xmm7, %xmm1
por %xmm3, %xmm0
por %xmm2, %xmm1
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm1, %xmm1
punpckldq %xmm0, %xmm1
pshufd $177, %xmm11, %xmm0
movdqa %xmm1, %xmm8
movdqa %xmm0, %xmm1
pcmpgtd %xmm11, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm11, %xmm3
pand %xmm1, %xmm11
pand %xmm1, %xmm0
por %xmm2, %xmm11
por %xmm3, %xmm0
pshufd $136, %xmm11, %xmm11
pshufd $221, %xmm0, %xmm0
movdqa %xmm11, %xmm7
punpckldq %xmm0, %xmm7
pshufd $177, %xmm6, %xmm0
movdqa %xmm0, %xmm1
pcmpgtd %xmm6, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm6, %xmm3
pand %xmm1, %xmm6
por %xmm2, %xmm6
pand %xmm1, %xmm0
pshufd $136, %xmm6, %xmm6
por %xmm3, %xmm0
movdqa %xmm6, %xmm10
movdqa -304(%rbp), %xmm6
pshufd $221, %xmm0, %xmm0
punpckldq %xmm0, %xmm10
pshufd $177, %xmm6, %xmm0
movdqa %xmm0, %xmm1
pcmpgtd %xmm6, %xmm1
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm2
pandn %xmm6, %xmm3
pand %xmm1, %xmm0
pand %xmm6, %xmm1
por %xmm3, %xmm0
movdqa -320(%rbp), %xmm6
por %xmm2, %xmm1
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm1, %xmm1
punpckldq %xmm0, %xmm1
movdqa %xmm1, %xmm5
pshufd $177, %xmm6, %xmm1
movdqa %xmm1, %xmm0
pcmpgtd %xmm6, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm1, %xmm2
pandn %xmm6, %xmm3
pand %xmm0, %xmm1
pand %xmm6, %xmm0
por %xmm3, %xmm1
movdqa -336(%rbp), %xmm6
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm13, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm13, %xmm2
movdqa %xmm2, %xmm3
movdqa %xmm2, %xmm4
pandn %xmm1, %xmm3
pandn %xmm13, %xmm4
pand %xmm2, %xmm1
pand %xmm2, %xmm13
por %xmm4, %xmm1
pshufd $177, %xmm6, %xmm2
por %xmm3, %xmm13
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm13, %xmm13
punpckldq %xmm1, %xmm13
movdqa %xmm2, %xmm1
pcmpgtd %xmm6, %xmm1
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm4
pandn %xmm2, %xmm3
pandn %xmm6, %xmm4
pand %xmm1, %xmm2
pand %xmm6, %xmm1
por %xmm4, %xmm2
por %xmm3, %xmm1
pshufd $221, %xmm2, %xmm2
pshufd $177, %xmm15, %xmm3
pshufd $136, %xmm1, %xmm1
punpckldq %xmm2, %xmm1
movdqa %xmm3, %xmm2
pcmpgtd %xmm15, %xmm2
movdqa %xmm2, %xmm4
movdqa %xmm2, %xmm6
pandn %xmm3, %xmm4
pandn %xmm15, %xmm6
pand %xmm2, %xmm3
pand %xmm2, %xmm15
por %xmm6, %xmm3
por %xmm4, %xmm15
pshufd $221, %xmm3, %xmm3
pshufd $136, %xmm15, %xmm2
punpckldq %xmm3, %xmm2
jbe .L482
pshufd $27, %xmm2, %xmm2
pshufd $27, %xmm13, %xmm3
pshufd $27, %xmm1, %xmm4
movdqa -352(%rbp), %xmm15
movdqa %xmm2, %xmm9
pshufd $27, %xmm10, %xmm6
movdqa %xmm4, %xmm10
movaps %xmm4, -144(%rbp)
pcmpgtd %xmm15, %xmm9
movdqa %xmm15, %xmm13
movdqa %xmm3, %xmm4
movaps %xmm3, -64(%rbp)
pshufd $27, %xmm0, %xmm0
pshufd $27, %xmm5, %xmm5
pshufd $27, %xmm7, %xmm7
pshufd $27, %xmm8, %xmm8
movdqa %xmm9, %xmm1
pand %xmm9, %xmm13
pandn %xmm2, %xmm1
por %xmm1, %xmm13
movdqa %xmm9, %xmm1
pand %xmm2, %xmm9
pandn %xmm15, %xmm1
movdqa -368(%rbp), %xmm15
movaps %xmm1, -240(%rbp)
pcmpgtd %xmm15, %xmm10
movdqa %xmm15, %xmm12
movdqa %xmm10, %xmm11
movdqa %xmm10, %xmm1
pand %xmm10, %xmm12
pandn %xmm15, %xmm11
pandn -144(%rbp), %xmm1
movaps %xmm11, -288(%rbp)
movdqa -384(%rbp), %xmm11
por %xmm1, %xmm12
pcmpgtd %xmm11, %xmm4
movdqa %xmm11, %xmm15
movdqa %xmm4, %xmm1
pandn -64(%rbp), %xmm1
pand %xmm4, %xmm15
por %xmm1, %xmm15
movdqa %xmm4, %xmm1
pandn %xmm11, %xmm1
movaps %xmm15, -80(%rbp)
movaps %xmm1, -304(%rbp)
movdqa %xmm0, %xmm1
pcmpgtd %xmm14, %xmm1
movdqa %xmm1, %xmm15
movdqa %xmm1, %xmm11
pandn %xmm0, %xmm15
pand %xmm14, %xmm11
por %xmm15, %xmm11
movdqa %xmm1, %xmm15
pand %xmm0, %xmm1
pandn %xmm14, %xmm15
movdqa %xmm5, %xmm14
movaps %xmm11, -96(%rbp)
movaps %xmm15, -320(%rbp)
por -320(%rbp), %xmm1
movdqa -176(%rbp), %xmm15
pcmpgtd %xmm15, %xmm14
pshufd $27, %xmm1, %xmm1
movdqa -192(%rbp), %xmm15
movdqa %xmm14, %xmm3
pandn %xmm5, %xmm14
movdqa %xmm3, %xmm11
pand %xmm3, %xmm5
pandn -176(%rbp), %xmm11
movaps %xmm14, -336(%rbp)
pand -176(%rbp), %xmm3
por -336(%rbp), %xmm3
por %xmm11, %xmm5
movaps %xmm5, -112(%rbp)
movdqa %xmm6, %xmm5
pcmpgtd %xmm15, %xmm5
movdqa -224(%rbp), %xmm15
movdqa %xmm5, %xmm11
pandn %xmm6, %xmm11
pand %xmm5, %xmm6
movaps %xmm11, -352(%rbp)
movdqa %xmm5, %xmm11
pandn -192(%rbp), %xmm11
pand -192(%rbp), %xmm5
por -352(%rbp), %xmm5
por %xmm11, %xmm6
movdqa %xmm7, %xmm11
movaps %xmm6, -128(%rbp)
movdqa -208(%rbp), %xmm6
pshufd $27, %xmm5, %xmm5
pcmpgtd %xmm6, %xmm11
movdqa %xmm8, %xmm6
pcmpgtd %xmm15, %xmm6
pshufd $27, %xmm3, %xmm15
movdqa %xmm11, %xmm14
pandn %xmm7, %xmm14
pand %xmm11, %xmm7
movaps %xmm14, -368(%rbp)
movdqa %xmm11, %xmm14
pandn -208(%rbp), %xmm14
por %xmm14, %xmm7
movdqa %xmm6, %xmm14
pandn %xmm8, %xmm14
movaps %xmm7, -160(%rbp)
pand %xmm6, %xmm8
movdqa %xmm6, %xmm7
pandn -224(%rbp), %xmm7
pand -64(%rbp), %xmm4
pand -224(%rbp), %xmm6
pand -144(%rbp), %xmm10
por -288(%rbp), %xmm10
por %xmm7, %xmm8
por -240(%rbp), %xmm9
por %xmm14, %xmm6
por -304(%rbp), %xmm4
pand -208(%rbp), %xmm11
pshufd $27, %xmm6, %xmm6
pshufd $27, %xmm10, %xmm3
pshufd $27, %xmm9, %xmm2
movdqa -160(%rbp), %xmm14
movdqa %xmm6, %xmm10
movdqa %xmm13, %xmm9
movaps %xmm2, -208(%rbp)
por -368(%rbp), %xmm11
pcmpgtd %xmm13, %xmm10
movaps %xmm3, -64(%rbp)
pshufd $27, %xmm4, %xmm4
pshufd $27, %xmm11, %xmm11
movdqa %xmm10, %xmm7
movdqa %xmm10, %xmm0
pand %xmm10, %xmm9
pandn %xmm13, %xmm7
movdqa %xmm2, %xmm13
pandn %xmm6, %xmm0
pcmpgtd %xmm8, %xmm13
por %xmm0, %xmm9
movdqa %xmm8, %xmm2
movaps %xmm7, -288(%rbp)
movdqa %xmm14, %xmm7
movaps %xmm9, -224(%rbp)
pand %xmm6, %xmm10
movdqa %xmm13, %xmm0
pandn -208(%rbp), %xmm0
pand %xmm13, %xmm2
por %xmm0, %xmm2
movdqa %xmm13, %xmm0
pandn %xmm8, %xmm0
movaps %xmm2, -240(%rbp)
movaps %xmm0, -304(%rbp)
movdqa %xmm11, %xmm0
pcmpgtd %xmm12, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm8
pandn %xmm11, %xmm3
pandn %xmm12, %xmm8
movdqa %xmm3, %xmm2
movdqa %xmm12, %xmm3
movdqa -64(%rbp), %xmm12
movaps %xmm8, -320(%rbp)
pand %xmm0, %xmm3
movdqa -128(%rbp), %xmm8
pand %xmm11, %xmm0
por %xmm2, %xmm3
movaps %xmm3, -144(%rbp)
movdqa %xmm12, %xmm3
pcmpgtd %xmm14, %xmm3
pand %xmm3, %xmm7
movdqa %xmm3, %xmm2
pandn -64(%rbp), %xmm2
movdqa %xmm7, %xmm12
movdqa %xmm3, %xmm7
pandn %xmm14, %xmm7
movdqa -80(%rbp), %xmm14
por %xmm2, %xmm12
movdqa %xmm5, %xmm2
movaps %xmm12, -160(%rbp)
pcmpgtd %xmm14, %xmm2
movaps %xmm7, -336(%rbp)
movdqa %xmm2, %xmm12
movdqa %xmm2, %xmm7
pandn %xmm5, %xmm12
pandn %xmm14, %xmm7
pand %xmm2, %xmm5
por %xmm7, %xmm5
movdqa %xmm4, %xmm7
pand -80(%rbp), %xmm2
pcmpgtd %xmm8, %xmm7
movaps %xmm5, -176(%rbp)
por %xmm12, %xmm2
pshufd $27, %xmm2, %xmm2
movdqa %xmm7, %xmm5
pandn %xmm4, %xmm5
pand %xmm7, %xmm4
movaps %xmm5, -352(%rbp)
movdqa %xmm7, %xmm5
movdqa %xmm4, %xmm14
movdqa %xmm15, %xmm4
pandn %xmm8, %xmm5
por %xmm5, %xmm14
movdqa -96(%rbp), %xmm5
movaps %xmm14, -192(%rbp)
pcmpgtd %xmm5, %xmm4
movdqa %xmm4, %xmm8
pandn %xmm15, %xmm4
movdqa %xmm8, %xmm14
pand %xmm8, %xmm15
pand -96(%rbp), %xmm8
pandn %xmm5, %xmm14
movdqa %xmm1, %xmm5
por %xmm14, %xmm15
movdqa -112(%rbp), %xmm14
por %xmm4, %xmm8
pshufd $27, %xmm8, %xmm8
pcmpgtd %xmm14, %xmm5
movdqa %xmm5, %xmm9
pandn %xmm1, %xmm9
pand %xmm5, %xmm1
movaps %xmm9, -368(%rbp)
por -320(%rbp), %xmm0
movdqa %xmm5, %xmm9
movdqa -128(%rbp), %xmm4
pand -112(%rbp), %xmm5
pandn %xmm14, %xmm9
pand -64(%rbp), %xmm3
pand %xmm7, %xmm4
por -368(%rbp), %xmm5
pand -208(%rbp), %xmm13
por -304(%rbp), %xmm13
por %xmm9, %xmm1
movdqa -224(%rbp), %xmm6
pshufd $27, %xmm0, %xmm0
pshufd $27, %xmm5, %xmm7
por -336(%rbp), %xmm3
por -288(%rbp), %xmm10
movdqa %xmm7, %xmm14
pshufd $27, %xmm13, %xmm7
movdqa %xmm2, %xmm13
movaps %xmm7, -64(%rbp)
movdqa %xmm8, %xmm7
pshufd $27, %xmm10, %xmm10
por -352(%rbp), %xmm4
pcmpgtd %xmm6, %xmm7
movdqa %xmm10, %xmm11
movdqa %xmm6, %xmm10
movaps %xmm14, -224(%rbp)
movaps %xmm11, -208(%rbp)
pshufd $27, %xmm4, %xmm4
pshufd $27, %xmm3, %xmm3
movdqa %xmm7, %xmm9
movdqa %xmm7, %xmm5
pand %xmm7, %xmm10
pandn %xmm6, %xmm9
pandn %xmm8, %xmm5
pand %xmm8, %xmm7
movdqa -144(%rbp), %xmm6
por %xmm5, %xmm10
movaps %xmm9, -288(%rbp)
movdqa %xmm15, %xmm9
pcmpgtd %xmm6, %xmm13
movdqa %xmm13, %xmm5
pandn %xmm2, %xmm5
pand %xmm13, %xmm2
movaps %xmm5, -304(%rbp)
movdqa %xmm13, %xmm5
pandn %xmm6, %xmm5
por %xmm5, %xmm2
movdqa %xmm11, %xmm5
movdqa -176(%rbp), %xmm11
pcmpgtd %xmm15, %xmm5
movdqa %xmm5, %xmm6
pandn -208(%rbp), %xmm5
movdqa %xmm6, %xmm12
pand %xmm6, %xmm9
pandn %xmm15, %xmm12
por %xmm5, %xmm9
movdqa -240(%rbp), %xmm15
movaps %xmm12, -320(%rbp)
movdqa %xmm0, %xmm12
pcmpgtd %xmm11, %xmm12
movdqa %xmm12, %xmm5
pandn %xmm0, %xmm5
pand %xmm12, %xmm0
movaps %xmm5, -336(%rbp)
movdqa %xmm12, %xmm5
pandn %xmm11, %xmm5
por %xmm5, %xmm0
movdqa %xmm14, %xmm5
movdqa %xmm15, %xmm14
pcmpgtd %xmm15, %xmm5
movaps %xmm0, -80(%rbp)
movdqa %xmm5, %xmm11
pand %xmm5, %xmm14
pandn -224(%rbp), %xmm11
por %xmm11, %xmm14
movdqa %xmm5, %xmm11
pandn %xmm15, %xmm11
movaps %xmm14, -96(%rbp)
movdqa -160(%rbp), %xmm15
movaps %xmm11, -240(%rbp)
movdqa %xmm4, %xmm11
pcmpgtd %xmm15, %xmm11
movdqa %xmm11, %xmm14
pandn %xmm4, %xmm14
pand %xmm11, %xmm4
movaps %xmm14, -352(%rbp)
movdqa %xmm11, %xmm14
pandn %xmm15, %xmm14
movdqa -64(%rbp), %xmm15
por %xmm14, %xmm4
movaps %xmm4, -112(%rbp)
movdqa %xmm15, %xmm4
movdqa %xmm1, %xmm15
pcmpgtd %xmm1, %xmm4
movdqa %xmm4, %xmm14
pandn -64(%rbp), %xmm14
pand %xmm4, %xmm15
por %xmm14, %xmm15
movdqa %xmm4, %xmm14
pandn %xmm1, %xmm14
movdqa %xmm3, %xmm1
movaps %xmm14, -368(%rbp)
movdqa -192(%rbp), %xmm14
por -288(%rbp), %xmm7
movdqa -160(%rbp), %xmm8
pand -208(%rbp), %xmm6
pcmpgtd %xmm14, %xmm1
pshufd $27, %xmm7, %xmm7
pand -176(%rbp), %xmm12
pand %xmm11, %xmm8
por -320(%rbp), %xmm6
movdqa -192(%rbp), %xmm11
por -336(%rbp), %xmm12
pand -224(%rbp), %xmm5
movdqa %xmm1, %xmm0
pand %xmm1, %xmm11
pshufd $27, %xmm6, %xmm6
pandn %xmm3, %xmm0
pand %xmm1, %xmm3
pshufd $27, %xmm12, %xmm12
movaps %xmm0, -384(%rbp)
movdqa %xmm1, %xmm0
pand -64(%rbp), %xmm4
por -352(%rbp), %xmm8
pandn %xmm14, %xmm0
por -240(%rbp), %xmm5
por -384(%rbp), %xmm11
por %xmm0, %xmm3
pshufd $27, %xmm8, %xmm8
por -368(%rbp), %xmm4
movaps %xmm3, -128(%rbp)
pshufd $27, %xmm5, %xmm5
pshufd $27, %xmm11, %xmm11
movdqa -144(%rbp), %xmm3
pshufd $27, %xmm4, %xmm4
pand %xmm13, %xmm3
por -304(%rbp), %xmm3
movdqa %xmm10, %xmm13
pshufd $27, %xmm3, %xmm3
movdqa %xmm3, %xmm1
pcmpgtd %xmm10, %xmm1
movdqa %xmm1, %xmm0
pand %xmm1, %xmm13
pandn %xmm3, %xmm0
pand %xmm1, %xmm3
por %xmm0, %xmm13
movdqa %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm2, %xmm1
pandn %xmm10, %xmm0
movdqa %xmm2, %xmm10
por %xmm0, %xmm3
movdqa %xmm1, %xmm0
pand %xmm1, %xmm10
pandn %xmm7, %xmm0
por %xmm0, %xmm10
movdqa %xmm1, %xmm0
pandn %xmm2, %xmm0
movdqa %xmm1, %xmm2
movdqa %xmm12, %xmm1
pcmpgtd %xmm9, %xmm1
pand %xmm7, %xmm2
por %xmm0, %xmm2
movdqa %xmm1, %xmm7
movdqa %xmm1, %xmm0
pandn %xmm12, %xmm7
pandn %xmm9, %xmm0
movdqa %xmm7, %xmm14
movdqa %xmm9, %xmm7
movdqa %xmm1, %xmm9
pand %xmm12, %xmm9
movdqa -80(%rbp), %xmm12
pand %xmm1, %xmm7
movdqa %xmm6, %xmm1
por %xmm0, %xmm9
por %xmm14, %xmm7
pcmpgtd %xmm12, %xmm1
movdqa %xmm1, %xmm0
pandn %xmm6, %xmm0
movdqa %xmm0, %xmm14
movdqa %xmm12, %xmm0
pand %xmm1, %xmm0
movdqa %xmm0, %xmm12
movdqa %xmm1, %xmm0
pandn -80(%rbp), %xmm0
por %xmm14, %xmm12
movdqa %xmm0, %xmm14
movdqa %xmm1, %xmm0
movdqa %xmm8, %xmm1
pand %xmm6, %xmm0
por %xmm14, %xmm0
movdqa -96(%rbp), %xmm14
movaps %xmm0, -64(%rbp)
pcmpgtd %xmm14, %xmm1
movdqa %xmm1, %xmm6
pand %xmm1, %xmm14
movdqa %xmm1, %xmm0
pandn %xmm8, %xmm6
pand %xmm8, %xmm1
movdqa -112(%rbp), %xmm8
pandn -96(%rbp), %xmm0
por %xmm6, %xmm14
movdqa %xmm5, %xmm6
pcmpgtd %xmm8, %xmm6
por %xmm0, %xmm1
movaps %xmm1, -80(%rbp)
movdqa %xmm6, %xmm1
pandn %xmm5, %xmm6
pand %xmm1, %xmm8
movdqa %xmm1, %xmm0
pand %xmm5, %xmm1
por %xmm6, %xmm8
movdqa %xmm11, %xmm6
pandn -112(%rbp), %xmm0
pcmpgtd %xmm15, %xmm6
movdqa %xmm1, %xmm5
por %xmm0, %xmm5
movaps %xmm5, -96(%rbp)
movdqa %xmm6, %xmm1
movdqa %xmm6, %xmm5
movdqa %xmm15, %xmm6
pandn %xmm11, %xmm5
pand %xmm1, %xmm6
por %xmm5, %xmm6
movdqa %xmm1, %xmm5
pand %xmm11, %xmm1
pandn %xmm15, %xmm5
movdqa -128(%rbp), %xmm15
movdqa %xmm1, %xmm11
movdqa %xmm4, %xmm1
movaps %xmm6, -112(%rbp)
por %xmm5, %xmm11
pcmpgtd %xmm15, %xmm1
movdqa %xmm15, %xmm6
pand %xmm1, %xmm6
movdqa %xmm1, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm6, %xmm0
por %xmm5, %xmm0
movdqa %xmm1, %xmm5
pand %xmm4, %xmm1
pshufd $27, %xmm13, %xmm4
movdqa %xmm0, %xmm15
pandn -128(%rbp), %xmm5
movdqa %xmm4, %xmm0
pcmpgtd %xmm13, %xmm0
por %xmm5, %xmm1
movaps %xmm1, -128(%rbp)
movdqa %xmm0, %xmm6
movdqa %xmm0, %xmm1
movdqa %xmm0, %xmm5
pandn %xmm4, %xmm6
pand %xmm4, %xmm1
pshufd $27, %xmm3, %xmm4
pandn %xmm13, %xmm5
pand %xmm0, %xmm13
movdqa %xmm4, %xmm0
pcmpgtd %xmm3, %xmm0
por %xmm5, %xmm1
por %xmm6, %xmm13
shufpd $2, %xmm1, %xmm13
movdqa %xmm0, %xmm5
movdqa %xmm0, %xmm1
movdqa %xmm0, %xmm6
pandn %xmm3, %xmm5
pand %xmm4, %xmm1
pandn %xmm4, %xmm6
por %xmm5, %xmm1
pand %xmm0, %xmm3
por %xmm6, %xmm3
movapd %xmm1, %xmm6
movsd %xmm3, %xmm6
pshufd $27, %xmm10, %xmm3
movdqa %xmm3, %xmm0
pcmpgtd %xmm10, %xmm0
movdqa %xmm0, %xmm1
movdqa %xmm0, %xmm5
pandn %xmm10, %xmm0
pandn %xmm3, %xmm5
pand %xmm1, %xmm10
pand %xmm3, %xmm1
pshufd $27, %xmm2, %xmm3
por %xmm0, %xmm1
por %xmm5, %xmm10
movdqa %xmm3, %xmm0
shufpd $2, %xmm1, %xmm10
pcmpgtd %xmm2, %xmm0
movdqa %xmm0, %xmm1
movdqa %xmm0, %xmm5
pandn %xmm2, %xmm0
pand %xmm1, %xmm2
pand %xmm3, %xmm1
pandn %xmm3, %xmm5
por %xmm0, %xmm1
por %xmm5, %xmm2
movdqa -64(%rbp), %xmm0
movapd %xmm1, %xmm3
movsd %xmm2, %xmm3
pshufd $27, %xmm7, %xmm2
movapd %xmm3, %xmm5
movdqa %xmm2, %xmm3
pcmpgtd %xmm7, %xmm3
movdqa %xmm3, %xmm1
pandn %xmm2, %xmm3
movdqa %xmm3, %xmm4
movdqa %xmm1, %xmm3
pandn %xmm7, %xmm3
pand %xmm1, %xmm7
pand %xmm2, %xmm1
pshufd $27, %xmm9, %xmm2
por %xmm3, %xmm1
por %xmm4, %xmm7
movdqa %xmm2, %xmm3
shufpd $2, %xmm1, %xmm7
pcmpgtd %xmm9, %xmm3
movdqa %xmm3, %xmm1
pandn %xmm2, %xmm3
movdqa %xmm3, %xmm4
movdqa %xmm1, %xmm3
pandn %xmm9, %xmm3
pand %xmm1, %xmm9
pand %xmm2, %xmm1
pshufd $27, %xmm12, %xmm2
por %xmm3, %xmm1
por %xmm4, %xmm9
movdqa %xmm2, %xmm3
shufpd $2, %xmm1, %xmm9
pcmpgtd %xmm12, %xmm3
movdqa %xmm3, %xmm1
pandn %xmm2, %xmm3
movdqa %xmm3, %xmm4
movdqa %xmm1, %xmm3
pandn %xmm12, %xmm3
pand %xmm1, %xmm12
pand %xmm2, %xmm1
pshufd $27, %xmm0, %xmm2
por %xmm3, %xmm1
por %xmm4, %xmm12
movdqa %xmm2, %xmm3
shufpd $2, %xmm1, %xmm12
pcmpgtd %xmm0, %xmm3
movdqa %xmm3, %xmm1
pandn %xmm2, %xmm3
movdqa %xmm3, %xmm4
movdqa %xmm1, %xmm3
pandn %xmm0, %xmm3
pand %xmm1, %xmm0
pand %xmm2, %xmm1
por %xmm3, %xmm1
por %xmm4, %xmm0
movapd %xmm1, %xmm3
pshufd $27, %xmm14, %xmm1
movsd %xmm0, %xmm3
movdqa %xmm1, %xmm0
pcmpgtd %xmm14, %xmm0
movaps %xmm3, -176(%rbp)
movdqa -80(%rbp), %xmm4
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm14, %xmm2
pand %xmm0, %xmm14
pand %xmm1, %xmm0
por %xmm3, %xmm14
pshufd $27, %xmm4, %xmm1
por %xmm2, %xmm0
shufpd $2, %xmm0, %xmm14
movdqa %xmm1, %xmm0
pcmpgtd %xmm4, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm4, %xmm2
pand %xmm0, %xmm4
pand %xmm1, %xmm0
pandn %xmm1, %xmm3
por %xmm2, %xmm0
pshufd $27, %xmm8, %xmm1
movapd %xmm0, %xmm2
movdqa %xmm1, %xmm0
por %xmm3, %xmm4
pcmpgtd %xmm8, %xmm0
movsd %xmm4, %xmm2
movdqa -96(%rbp), %xmm4
movaps %xmm2, -192(%rbp)
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm8, %xmm2
pand %xmm0, %xmm8
pand %xmm1, %xmm0
por %xmm3, %xmm8
pshufd $27, %xmm4, %xmm1
por %xmm2, %xmm0
shufpd $2, %xmm0, %xmm8
movdqa %xmm1, %xmm0
pcmpgtd %xmm4, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm4, %xmm2
pand %xmm0, %xmm4
pand %xmm1, %xmm0
por %xmm3, %xmm4
por %xmm2, %xmm0
movsd %xmm4, %xmm0
movdqa -112(%rbp), %xmm4
movaps %xmm0, -208(%rbp)
pshufd $27, %xmm4, %xmm1
movdqa %xmm1, %xmm0
pcmpgtd %xmm4, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm4, %xmm2
pand %xmm0, %xmm4
pand %xmm1, %xmm0
pandn %xmm1, %xmm3
por %xmm2, %xmm0
pshufd $27, %xmm11, %xmm1
por %xmm3, %xmm4
movapd %xmm0, %xmm3
movdqa %xmm1, %xmm0
pcmpgtd %xmm11, %xmm0
movsd %xmm4, %xmm3
movdqa -128(%rbp), %xmm4
movaps %xmm3, -224(%rbp)
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm1, %xmm3
pandn %xmm11, %xmm2
pand %xmm0, %xmm11
pand %xmm1, %xmm0
por %xmm3, %xmm11
pshufd $27, %xmm15, %xmm1
por %xmm2, %xmm0
shufpd $2, %xmm0, %xmm11
movdqa %xmm1, %xmm0
pcmpgtd %xmm15, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm15, %xmm2
pand %xmm0, %xmm15
pand %xmm1, %xmm0
por %xmm3, %xmm15
pshufd $27, %xmm4, %xmm1
por %xmm2, %xmm0
shufpd $2, %xmm0, %xmm15
movdqa %xmm1, %xmm0
pcmpgtd %xmm4, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm4, %xmm2
pand %xmm0, %xmm4
pand %xmm1, %xmm0
por %xmm3, %xmm4
pshufd $177, %xmm13, %xmm1
por %xmm2, %xmm0
shufpd $2, %xmm0, %xmm4
movdqa %xmm1, %xmm0
pcmpgtd %xmm13, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm1, %xmm2
pandn %xmm13, %xmm3
pand %xmm0, %xmm1
pand %xmm13, %xmm0
por %xmm3, %xmm1
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm6, %xmm1
movaps %xmm0, -112(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm6, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm13
pandn %xmm1, %xmm2
pandn %xmm6, %xmm13
pand %xmm0, %xmm1
pand %xmm6, %xmm0
por %xmm13, %xmm1
movapd -224(%rbp), %xmm6
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm10, %xmm1
movaps %xmm0, -128(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm10, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm13
pandn %xmm1, %xmm2
pandn %xmm10, %xmm13
pand %xmm0, %xmm1
pand %xmm10, %xmm0
por %xmm13, %xmm1
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm5, %xmm1
movaps %xmm0, -144(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm5, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm10
pandn %xmm1, %xmm2
pandn %xmm5, %xmm10
pand %xmm0, %xmm1
pand %xmm5, %xmm0
por %xmm10, %xmm1
movapd -208(%rbp), %xmm5
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm7, %xmm1
movaps %xmm0, -160(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm7, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm10
pandn %xmm1, %xmm2
pandn %xmm7, %xmm10
pand %xmm0, %xmm1
pand %xmm7, %xmm0
por %xmm10, %xmm1
movapd -176(%rbp), %xmm7
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm9, %xmm1
movaps %xmm0, -64(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm9, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm10
pandn %xmm1, %xmm2
pandn %xmm9, %xmm10
pand %xmm0, %xmm1
pand %xmm9, %xmm0
por %xmm10, %xmm1
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm12, %xmm1
movaps %xmm0, -80(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm12, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm10
pandn %xmm1, %xmm2
pandn %xmm12, %xmm10
pand %xmm0, %xmm1
pand %xmm12, %xmm0
por %xmm10, %xmm1
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm7, %xmm1
movaps %xmm0, -96(%rbp)
movdqa %xmm1, %xmm0
pcmpgtd %xmm7, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm1, %xmm2
pandn %xmm7, %xmm3
pand %xmm0, %xmm1
pand %xmm7, %xmm0
por %xmm3, %xmm1
movapd -192(%rbp), %xmm7
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
movdqa %xmm0, %xmm12
pshufd $177, %xmm14, %xmm0
movdqa %xmm0, %xmm3
pcmpgtd %xmm14, %xmm3
movdqa %xmm3, %xmm1
movdqa %xmm3, %xmm2
pandn %xmm0, %xmm1
pandn %xmm14, %xmm2
pand %xmm3, %xmm0
pand %xmm14, %xmm3
por %xmm2, %xmm0
por %xmm1, %xmm3
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm3, %xmm3
punpckldq %xmm0, %xmm3
pshufd $177, %xmm7, %xmm0
movdqa %xmm0, %xmm9
pcmpgtd %xmm7, %xmm9
movdqa %xmm9, %xmm1
movdqa %xmm9, %xmm2
pandn %xmm0, %xmm1
pandn %xmm7, %xmm2
pand %xmm9, %xmm0
pand %xmm7, %xmm9
por %xmm2, %xmm0
por %xmm1, %xmm9
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm9, %xmm9
punpckldq %xmm0, %xmm9
pshufd $177, %xmm8, %xmm0
movdqa %xmm0, %xmm7
pcmpgtd %xmm8, %xmm7
movdqa %xmm7, %xmm1
movdqa %xmm7, %xmm2
pandn %xmm0, %xmm1
pandn %xmm8, %xmm2
pand %xmm7, %xmm0
pand %xmm8, %xmm7
por %xmm2, %xmm0
por %xmm1, %xmm7
pshufd $221, %xmm0, %xmm0
pshufd $136, %xmm7, %xmm7
punpckldq %xmm0, %xmm7
pshufd $177, %xmm5, %xmm0
movdqa %xmm0, %xmm10
pcmpgtd %xmm5, %xmm10
movdqa %xmm10, %xmm1
movdqa %xmm10, %xmm2
pandn %xmm0, %xmm1
pandn %xmm5, %xmm2
pand %xmm10, %xmm0
pand %xmm5, %xmm10
por %xmm2, %xmm0
por %xmm1, %xmm10
pshufd $221, %xmm0, %xmm0
pshufd $177, %xmm6, %xmm1
pshufd $136, %xmm10, %xmm10
punpckldq %xmm0, %xmm10
movdqa %xmm1, %xmm0
pcmpgtd %xmm6, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm5
pandn %xmm1, %xmm2
pandn %xmm6, %xmm5
pand %xmm0, %xmm1
pand %xmm6, %xmm0
por %xmm5, %xmm1
por %xmm2, %xmm0
pshufd $221, %xmm1, %xmm1
pshufd $136, %xmm0, %xmm0
punpckldq %xmm1, %xmm0
pshufd $177, %xmm11, %xmm1
movdqa %xmm1, %xmm13
pcmpgtd %xmm11, %xmm13
movdqa %xmm13, %xmm2
movdqa %xmm13, %xmm5
pandn %xmm1, %xmm2
pandn %xmm11, %xmm5
pand %xmm13, %xmm1
pand %xmm11, %xmm13
por %xmm5, %xmm1
por %xmm2, %xmm13
pshufd $221, %xmm1, %xmm1
pshufd $177, %xmm15, %xmm2
pshufd $136, %xmm13, %xmm13
punpckldq %xmm1, %xmm13
movdqa %xmm2, %xmm1
pcmpgtd %xmm15, %xmm1
movdqa %xmm1, %xmm5
movdqa %xmm1, %xmm6
pandn %xmm2, %xmm5
pandn %xmm15, %xmm6
pand %xmm1, %xmm2
pand %xmm15, %xmm1
por %xmm6, %xmm2
por %xmm5, %xmm1
pshufd $221, %xmm2, %xmm2
pshufd $177, %xmm4, %xmm5
pshufd $136, %xmm1, %xmm1
punpckldq %xmm2, %xmm1
movdqa %xmm5, %xmm2
pcmpgtd %xmm4, %xmm2
movdqa %xmm2, %xmm6
movdqa %xmm2, %xmm8
pandn %xmm5, %xmm6
pandn %xmm4, %xmm8
pand %xmm2, %xmm5
pand %xmm4, %xmm2
por %xmm8, %xmm5
por %xmm6, %xmm2
pshufd $221, %xmm5, %xmm5
pshufd $136, %xmm2, %xmm2
punpckldq %xmm5, %xmm2
movdqa %xmm2, %xmm15
.L478:
movdqa -112(%rbp), %xmm4
movq -264(%rbp), %rdx
movups %xmm4, (%rdx)
movdqa -128(%rbp), %xmm4
movups %xmm4, (%r15)
movdqa -144(%rbp), %xmm4
movups %xmm4, (%r14)
movdqa -160(%rbp), %xmm4
movups %xmm4, 0(%r13)
movdqa -64(%rbp), %xmm4
movups %xmm4, (%r12)
movdqa -80(%rbp), %xmm4
movups %xmm4, (%rbx)
movdqa -96(%rbp), %xmm4
movq -248(%rbp), %rbx
movups %xmm4, (%r11)
movups %xmm12, (%r10)
movups %xmm3, (%r9)
movups %xmm9, (%r8)
movups %xmm7, (%rdi)
movups %xmm10, (%rsi)
movups %xmm0, (%rcx)
movq -256(%rbp), %rcx
movups %xmm13, (%rbx)
movups %xmm1, (%rcx)
movups %xmm15, (%rax)
addq $240, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L481:
.cfi_restore_state
movdqa -192(%rbp), %xmm15
movdqa -208(%rbp), %xmm1
movdqa %xmm2, %xmm9
jmp .L478
.p2align 4,,10
.p2align 3
.L482:
movdqa %xmm7, %xmm9
movdqa %xmm8, %xmm3
movdqa %xmm10, %xmm7
movdqa %xmm2, %xmm15
movdqa %xmm5, %xmm10
jmp .L478
.cfi_endproc
.LFE18797:
.size _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, .-_ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
.section .text._ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18798:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $6072, %rsp
.cfi_offset 15, -24
.cfi_offset 14, -32
.cfi_offset 13, -40
.cfi_offset 12, -48
.cfi_offset 3, -56
movq %rdi, -5768(%rbp)
movq %rsi, -5960(%rbp)
movq %rdx, -5896(%rbp)
movq %rcx, -5880(%rbp)
movq %r8, -5904(%rbp)
movq %r9, -5944(%rbp)
cmpq $64, %rdx
jbe .L769
movq %rdi, %r13
movq %rdi, %r14
shrq $2, %r13
movq %r13, %rax
andl $15, %eax
jne .L770
movq %rdx, %r11
movq %rdi, %r12
movq %r8, %r15
.L496:
movq 8(%r15), %rdx
movq 16(%r15), %r9
movq %rdx, %rax
leaq 1(%r9), %rdi
movq %rdx, %rsi
xorq (%r15), %rdi
rolq $24, %rax
shrq $11, %rsi
leaq (%rdx,%rdx,8), %rcx
leaq 2(%r9), %rdx
addq %rdi, %rax
xorq %rsi, %rcx
movq %rax, %rsi
xorq %rdx, %rcx
leaq (%rax,%rax,8), %rdx
movq %rax, %r8
rolq $24, %rsi
shrq $11, %r8
leaq 3(%r9), %rax
addq %rcx, %rsi
xorq %r8, %rdx
movq %rsi, %r10
xorq %rax, %rdx
leaq (%rsi,%rsi,8), %rax
movq %rsi, %r8
rolq $24, %r10
shrq $11, %r8
leaq 4(%r9), %rsi
addq $5, %r9
addq %rdx, %r10
xorq %r8, %rax
movq %r9, 16(%r15)
movq %r10, %r8
movq %r10, %rbx
xorq %rsi, %rax
shrq $11, %rbx
rolq $24, %r8
leaq (%r10,%r10,8), %rsi
addq %rax, %r8
xorq %rbx, %rsi
xorq %r9, %rsi
leaq (%r8,%r8,8), %r10
movq %r8, %rbx
rolq $24, %r8
addq %rsi, %r8
shrq $11, %rbx
movl %edx, %r9d
movl %esi, %esi
xorq %rbx, %r10
movq %r8, %xmm5
movq %r11, %rbx
movabsq $68719476719, %r8
shrq $4, %rbx
cmpq %r8, %r11
movl $4294967295, %r8d
movl %edi, %r11d
cmova %r8, %rbx
movq %r10, %xmm0
shrq $32, %rdi
movl %ecx, %r10d
shrq $32, %rdx
movl %eax, %r8d
punpcklqdq %xmm5, %xmm0
shrq $32, %rcx
imulq %rbx, %r11
shrq $32, %rax
movups %xmm0, (%r15)
imulq %rbx, %rdi
imulq %rbx, %r10
imulq %rbx, %rcx
shrq $32, %r11
imulq %rbx, %r9
shrq $32, %rdi
salq $6, %r11
imulq %rbx, %rdx
shrq $32, %r10
salq $6, %rdi
addq %r12, %r11
imulq %rbx, %r8
shrq $32, %rcx
salq $6, %r10
addq %r12, %rdi
shrq $32, %r9
salq $6, %rcx
addq %r12, %r10
shrq $32, %rdx
salq $6, %r9
addq %r12, %rcx
shrq $32, %r8
salq $6, %rdx
addq %r12, %r9
salq $6, %r8
addq %r12, %rdx
addq %r12, %r8
imulq %rbx, %rax
imulq %rbx, %rsi
shrq $32, %rax
shrq $32, %rsi
salq $6, %rax
salq $6, %rsi
addq %r12, %rax
leaq (%r12,%rsi), %rbx
movq -5880(%rbp), %r12
xorl %esi, %esi
.L498:
movdqa (%r10,%rsi,4), %xmm0
movdqa (%r11,%rsi,4), %xmm3
movdqa %xmm0, %xmm1
movdqa %xmm3, %xmm2
pcmpgtd %xmm3, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm2
pandn %xmm0, %xmm4
pand %xmm1, %xmm0
por %xmm4, %xmm2
movdqa %xmm1, %xmm4
movdqa %xmm0, %xmm1
movdqa (%rdi,%rsi,4), %xmm0
pandn %xmm3, %xmm4
pcmpgtd %xmm2, %xmm0
por %xmm4, %xmm1
movdqa %xmm0, %xmm3
pand (%rdi,%rsi,4), %xmm0
pandn %xmm2, %xmm3
movdqa %xmm1, %xmm2
por %xmm3, %xmm0
pcmpgtd %xmm0, %xmm2
movdqa %xmm2, %xmm3
pand %xmm2, %xmm0
pandn %xmm1, %xmm3
por %xmm3, %xmm0
movdqa (%rcx,%rsi,4), %xmm3
movaps %xmm0, (%r12,%rsi,4)
movdqa (%rdx,%rsi,4), %xmm0
movdqa %xmm3, %xmm2
movdqa %xmm0, %xmm1
pcmpgtd %xmm3, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm2
pandn %xmm0, %xmm4
pand %xmm1, %xmm0
por %xmm4, %xmm2
movdqa %xmm1, %xmm4
movdqa %xmm0, %xmm1
movdqa (%r9,%rsi,4), %xmm0
pandn %xmm3, %xmm4
pcmpgtd %xmm2, %xmm0
por %xmm4, %xmm1
movdqa %xmm0, %xmm3
pand (%r9,%rsi,4), %xmm0
pandn %xmm2, %xmm3
movdqa %xmm1, %xmm2
por %xmm3, %xmm0
pcmpgtd %xmm0, %xmm2
movdqa %xmm2, %xmm3
pand %xmm2, %xmm0
pandn %xmm1, %xmm3
por %xmm3, %xmm0
movdqa (%r8,%rsi,4), %xmm3
movaps %xmm0, 64(%r12,%rsi,4)
movdqa (%rbx,%rsi,4), %xmm0
movdqa %xmm3, %xmm2
movdqa %xmm0, %xmm1
pcmpgtd %xmm3, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm2
pandn %xmm0, %xmm4
pand %xmm1, %xmm0
por %xmm4, %xmm2
movdqa %xmm1, %xmm4
movdqa %xmm0, %xmm1
movdqa (%rax,%rsi,4), %xmm0
pandn %xmm3, %xmm4
pcmpgtd %xmm2, %xmm0
por %xmm4, %xmm1
movdqa %xmm0, %xmm3
pand (%rax,%rsi,4), %xmm0
pandn %xmm2, %xmm3
movdqa %xmm1, %xmm2
por %xmm3, %xmm0
pcmpgtd %xmm0, %xmm2
movdqa %xmm2, %xmm3
pand %xmm2, %xmm0
pandn %xmm1, %xmm3
por %xmm3, %xmm0
movaps %xmm0, 128(%r12,%rsi,4)
addq $4, %rsi
cmpq $16, %rsi
jne .L498
movq -5880(%rbp), %rbx
movd (%rbx), %xmm5
movdqa 16(%rbx), %xmm1
movdqa (%rbx), %xmm3
pshufd $0, %xmm5, %xmm0
pxor %xmm0, %xmm3
pxor %xmm0, %xmm1
movdqa %xmm0, %xmm2
por %xmm3, %xmm1
movdqa 32(%rbx), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 48(%rbx), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 64(%rbx), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 80(%rbx), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 96(%rbx), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 112(%rbx), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 128(%rbx), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 144(%rbx), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 160(%rbx), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 176(%rbx), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
pxor %xmm3, %xmm3
pcmpeqd %xmm3, %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
je .L499
movdqa .LC4(%rip), %xmm0
movl $4, %esi
movq %rbx, %rdi
leaq 192(%rbx), %r12
movups %xmm0, 192(%rbx)
movups %xmm0, 208(%rbx)
movups %xmm0, 224(%rbx)
movups %xmm0, 240(%rbx)
movups %xmm0, 256(%rbx)
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
movd (%rbx), %xmm5
pcmpeqd %xmm2, %xmm2
pshufd $0, %xmm5, %xmm0
movd 188(%rbx), %xmm5
pshufd $0, %xmm5, %xmm1
paddd %xmm1, %xmm2
pcmpeqd %xmm0, %xmm2
movmskps %xmm2, %eax
cmpl $15, %eax
jne .L501
movq -5896(%rbp), %rsi
movq -5768(%rbp), %rdi
leaq -64(%rbp), %rdx
movq %r12, %rcx
call _ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L483
.L501:
movq -5880(%rbp), %rbx
movl $23, %eax
movl $24, %edx
movl 96(%rbx), %ecx
movq %rbx, %rdi
cmpl %ecx, 92(%rbx)
je .L543
jmp .L548
.p2align 4,,10
.p2align 3
.L546:
testq %rax, %rax
je .L771
.L543:
movq %rax, %rdx
subq $1, %rax
movl (%rdi,%rax,4), %esi
cmpl %ecx, %esi
je .L546
movq -5880(%rbp), %rbx
movq %rbx, %rdi
cmpl %ecx, (%rbx,%rdx,4)
je .L548
movl %esi, %ecx
jmp .L545
.p2align 4,,10
.p2align 3
.L549:
cmpq $47, %rdx
je .L767
.L548:
movq %rdx, %rsi
addq $1, %rdx
cmpl %ecx, (%rdi,%rdx,4)
je .L549
movl $24, %edx
subq $23, %rsi
subq %rax, %rdx
cmpq %rdx, %rsi
jb .L545
.L767:
movq -5880(%rbp), %rbx
movl (%rbx,%rax,4), %ecx
.L545:
movd %ecx, %xmm6
pshufd $0, %xmm6, %xmm3
.L768:
movl $1, -5948(%rbp)
.L542:
cmpq $0, -5944(%rbp)
je .L772
movq -5896(%rbp), %rax
movq -5768(%rbp), %rsi
movaps %xmm3, -5728(%rbp)
subq $4, %rax
movdqu (%rsi,%rax,4), %xmm5
movq %rax, %rbx
movq %rax, -5760(%rbp)
andl $15, %ebx
movq %rbx, -5776(%rbp)
movaps %xmm5, -5936(%rbp)
andl $12, %eax
je .L615
movdqu (%rsi), %xmm1
pcmpeqd %xmm0, %xmm0
movdqa %xmm1, %xmm4
movaps %xmm1, -5696(%rbp)
pcmpgtd %xmm3, %xmm4
pxor %xmm4, %xmm0
movaps %xmm4, -5808(%rbp)
movmskps %xmm0, %ebx
movq %rbx, %rdi
salq $4, %rbx
call __popcountdi2@PLT
leaq _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rcx
movdqa -5696(%rbp), %xmm1
movdqa (%rcx,%rbx), %xmm0
movq %rcx, -5888(%rbp)
movslq %eax, %r15
movl %eax, -5712(%rbp)
movaps %xmm0, -528(%rbp)
movzbl -520(%rbp), %edx
movd %xmm0, %r9d
movaps %xmm0, -544(%rbp)
andl $15, %r9d
movq %rdx, %rcx
movzbl -535(%rbp), %edx
movaps %xmm0, -512(%rbp)
movzbl -505(%rbp), %eax
movaps %xmm0, -560(%rbp)
andl $15, %ecx
movq %rdx, %rdi
movzbl -550(%rbp), %edx
movaps %xmm0, -496(%rbp)
movzbl -490(%rbp), %r14d
andl $15, %edi
andl $15, %eax
movaps %xmm0, -416(%rbp)
movzbl -415(%rbp), %r10d
andl $15, %edx
movaps %xmm0, -432(%rbp)
andl $15, %r14d
movzbl -430(%rbp), %r11d
movaps %xmm0, -448(%rbp)
movzbl -445(%rbp), %ebx
andl $15, %r10d
movaps %xmm0, -464(%rbp)
movzbl -460(%rbp), %r12d
andl $15, %r11d
movaps %xmm0, -480(%rbp)
movzbl -475(%rbp), %r13d
andl $15, %ebx
movaps %xmm0, -576(%rbp)
andl $15, %r12d
movq %rcx, -5696(%rbp)
andl $15, %r13d
movq %rdi, -5744(%rbp)
movq %rdx, -5784(%rbp)
movzbl -565(%rbp), %edx
movaps %xmm1, -400(%rbp)
movaps %xmm0, -592(%rbp)
movzbl -580(%rbp), %ecx
andl $15, %edx
movd -5712(%rbp), %xmm7
movaps %xmm0, -608(%rbp)
movzbl -595(%rbp), %esi
movaps %xmm0, -624(%rbp)
movzbl -610(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -640(%rbp)
andl $15, %esi
pshufd $0, %xmm7, %xmm0
movzbl -400(%rbp,%rax), %eax
movzbl -400(%rbp,%r14), %r14d
movzbl -400(%rbp,%rbx), %ebx
andl $15, %edi
salq $8, %rax
movzbl -625(%rbp), %r8d
movzbl -400(%rbp,%r13), %r13d
orq %r14, %rax
movzbl -400(%rbp,%r12), %r12d
movzbl -400(%rbp,%r11), %r11d
salq $8, %rax
andl $15, %r8d
movzbl -400(%rbp,%r10), %r10d
movzbl -400(%rbp,%rdi), %edi
orq %r13, %rax
movzbl -400(%rbp,%rsi), %esi
movzbl -400(%rbp,%r8), %r8d
salq $8, %rax
movzbl -400(%rbp,%rcx), %ecx
movzbl -400(%rbp,%rdx), %edx
orq %r12, %rax
salq $8, %r8
movdqa .LC0(%rip), %xmm7
movzbl -400(%rbp,%r9), %r9d
salq $8, %rax
orq %rbx, %rax
pcmpgtd %xmm7, %xmm0
movaps %xmm7, -5920(%rbp)
salq $8, %rax
orq %r11, %rax
salq $8, %rax
orq %r10, %rax
salq $8, %rax
orq %rdi, %r8
movq -5744(%rbp), %rdi
salq $8, %r8
movq %rax, %rbx
movd %xmm0, %eax
orq %rsi, %r8
orq %r9, %rbx
salq $8, %r8
orq %rcx, %r8
movq -5696(%rbp), %rcx
movq %rbx, -5696(%rbp)
salq $8, %r8
orq %rdx, %r8
movq -5784(%rbp), %rdx
salq $8, %r8
movzbl -400(%rbp,%rdx), %edx
orq %rdx, %r8
movzbl -400(%rbp,%rdi), %edx
salq $8, %r8
orq %rdx, %r8
movzbl -400(%rbp,%rcx), %edx
salq $8, %r8
orq %rdx, %r8
testl %eax, %eax
movq %r8, -5688(%rbp)
movdqa -5808(%rbp), %xmm4
je .L553
movq -5768(%rbp), %rsi
movdqa -5696(%rbp), %xmm6
movd %xmm6, (%rsi)
.L553:
pshufd $85, %xmm0, %xmm2
movd %xmm2, %eax
testl %eax, %eax
je .L554
pshufd $85, -5696(%rbp), %xmm2
movq -5768(%rbp), %rax
movd %xmm2, 4(%rax)
.L554:
movdqa %xmm0, %xmm2
punpckhdq %xmm0, %xmm2
movd %xmm2, %eax
testl %eax, %eax
je .L555
movdqa -5696(%rbp), %xmm2
movq -5768(%rbp), %rax
punpckhdq %xmm2, %xmm2
movd %xmm2, 8(%rax)
.L555:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L556
pshufd $255, -5696(%rbp), %xmm0
movq -5768(%rbp), %rax
movd %xmm0, 12(%rax)
.L556:
movq -5768(%rbp), %rax
movaps %xmm1, -5744(%rbp)
leaq (%rax,%r15,4), %rbx
movq %rbx, -5696(%rbp)
movmskps %xmm4, %ebx
movq %rbx, %rdi
salq $4, %rbx
call __popcountdi2@PLT
movdqa -5744(%rbp), %xmm1
movslq %eax, %rsi
movq %rsi, -5712(%rbp)
movq -5888(%rbp), %rsi
movaps %xmm1, -384(%rbp)
movdqa (%rsi,%rbx), %xmm0
movaps %xmm0, -768(%rbp)
movzbl -760(%rbp), %edx
movd %xmm0, %r8d
movaps %xmm0, -784(%rbp)
andl $15, %r8d
movq %rdx, %rcx
movzbl -775(%rbp), %edx
movaps %xmm0, -800(%rbp)
movaps %xmm0, -752(%rbp)
movzbl -745(%rbp), %eax
andl $15, %ecx
movq %rdx, %rdi
movzbl -790(%rbp), %edx
movaps %xmm0, -736(%rbp)
movzbl -730(%rbp), %r13d
movaps %xmm0, -816(%rbp)
andl $15, %edi
andl $15, %eax
movq %rdx, %r15
movzbl -805(%rbp), %edx
movq %rcx, -5744(%rbp)
andl $15, %r13d
movq %rdi, -5784(%rbp)
andl $15, %r15d
movaps %xmm0, -656(%rbp)
movq %rdx, %r14
movzbl -655(%rbp), %r9d
movaps %xmm0, -672(%rbp)
movzbl -670(%rbp), %r10d
andl $15, %r14d
movaps %xmm0, -688(%rbp)
movzbl -685(%rbp), %r11d
andl $15, %r9d
movaps %xmm0, -704(%rbp)
movzbl -700(%rbp), %ebx
andl $15, %r10d
movaps %xmm0, -720(%rbp)
movzbl -715(%rbp), %r12d
andl $15, %r11d
movaps %xmm0, -832(%rbp)
movzbl -820(%rbp), %edx
andl $15, %ebx
movaps %xmm0, -848(%rbp)
andl $15, %r12d
movzbl -835(%rbp), %ecx
movaps %xmm0, -864(%rbp)
movzbl -850(%rbp), %esi
andl $15, %edx
movaps %xmm0, -880(%rbp)
movzbl -384(%rbp,%rax), %eax
andl $15, %ecx
movzbl -384(%rbp,%r13), %r13d
movzbl -384(%rbp,%r12), %r12d
movzbl -384(%rbp,%rbx), %ebx
andl $15, %esi
salq $8, %rax
movzbl -865(%rbp), %edi
movzbl -384(%rbp,%r11), %r11d
orq %r13, %rax
movzbl -384(%rbp,%rsi), %esi
movzbl -384(%rbp,%r10), %r10d
salq $8, %rax
andl $15, %edi
movzbl -384(%rbp,%r9), %r9d
movzbl -384(%rbp,%rcx), %ecx
orq %r12, %rax
movzbl -384(%rbp,%rdi), %edi
movzbl -384(%rbp,%rdx), %edx
movzbl -384(%rbp,%r8), %r8d
salq $8, %rax
orq %rbx, %rax
salq $8, %rdi
movq -5784(%rbp), %rbx
salq $8, %rax
orq %r11, %rax
salq $8, %rax
orq %r10, %rax
salq $8, %rax
orq %r9, %rax
salq $8, %rax
orq %rsi, %rdi
salq $8, %rdi
orq %r8, %rax
orq %rcx, %rdi
movq -5744(%rbp), %rcx
movq %rax, -5744(%rbp)
salq $8, %rdi
orq %rdx, %rdi
movzbl -384(%rbp,%r14), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -384(%rbp,%r15), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -384(%rbp,%rbx), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -384(%rbp,%rcx), %edx
movq -5880(%rbp), %rcx
salq $8, %rdi
orq %rdx, %rdi
movq %rdi, -5736(%rbp)
movdqa -5744(%rbp), %xmm6
movups %xmm6, (%rcx)
testb $8, -5760(%rbp)
je .L557
movq -5768(%rbp), %rax
pcmpeqd %xmm0, %xmm0
movdqu 16(%rax), %xmm1
movdqa %xmm1, %xmm3
movaps %xmm1, -5744(%rbp)
pcmpgtd -5728(%rbp), %xmm3
pxor %xmm3, %xmm0
movaps %xmm3, -5824(%rbp)
movmskps %xmm0, %ebx
movq %rbx, %rdi
salq $4, %rbx
call __popcountdi2@PLT
movq -5888(%rbp), %rsi
movdqa -5744(%rbp), %xmm1
movl %eax, -5784(%rbp)
movslq %eax, %r14
movdqa (%rsi,%rbx), %xmm0
movaps %xmm1, -368(%rbp)
movaps %xmm0, -896(%rbp)
movzbl -895(%rbp), %eax
movd %xmm0, %r13d
movaps %xmm0, -1008(%rbp)
movzbl -1000(%rbp), %edx
andl $15, %r13d
movaps %xmm0, -912(%rbp)
movq %rax, %rbx
movzbl -910(%rbp), %eax
movaps %xmm0, -1024(%rbp)
movq %rdx, %rsi
andl $15, %ebx
movzbl -1015(%rbp), %edx
movaps %xmm0, -992(%rbp)
movq %rax, %r15
movzbl -985(%rbp), %eax
andl $15, %esi
movaps %xmm0, -976(%rbp)
movq %rdx, %rcx
andl $15, %r15d
movzbl -970(%rbp), %r12d
andl $15, %ecx
andl $15, %eax
movaps %xmm0, -928(%rbp)
movzbl -925(%rbp), %r10d
movaps %xmm0, -944(%rbp)
andl $15, %r12d
movzbl -940(%rbp), %r11d
movaps %xmm0, -960(%rbp)
andl $15, %r10d
movaps %xmm0, -1040(%rbp)
movzbl -1030(%rbp), %edx
andl $15, %r11d
movq %rbx, -5744(%rbp)
movzbl -955(%rbp), %ebx
movq %rsi, -5808(%rbp)
andl $15, %edx
movq %rcx, -5792(%rbp)
andl $15, %ebx
movaps %xmm0, -1056(%rbp)
movzbl -1045(%rbp), %ecx
movd -5784(%rbp), %xmm5
movaps %xmm0, -1072(%rbp)
movzbl -1060(%rbp), %esi
movaps %xmm0, -1088(%rbp)
movzbl -1075(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -1104(%rbp)
movzbl -1090(%rbp), %r8d
andl $15, %esi
movaps %xmm0, -1120(%rbp)
andl $15, %edi
pshufd $0, %xmm5, %xmm0
movzbl -368(%rbp,%rax), %eax
movzbl -368(%rbp,%r12), %r12d
andl $15, %r8d
movzbl -368(%rbp,%rbx), %ebx
salq $8, %rax
movzbl -1105(%rbp), %r9d
movzbl -368(%rbp,%r11), %r11d
orq %r12, %rax
movzbl -368(%rbp,%rdi), %edi
movzbl -368(%rbp,%r10), %r10d
salq $8, %rax
andl $15, %r9d
movzbl -368(%rbp,%r8), %r8d
movzbl -368(%rbp,%rsi), %esi
orq %rbx, %rax
movq -5744(%rbp), %rbx
movzbl -368(%rbp,%r9), %r9d
salq $8, %rax
movzbl -368(%rbp,%rcx), %ecx
movzbl -368(%rbp,%rdx), %edx
orq %r11, %rax
salq $8, %r9
salq $8, %rax
orq %r10, %rax
movzbl -368(%rbp,%r15), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -368(%rbp,%rbx), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -368(%rbp,%r13), %r10d
salq $8, %rax
orq %r8, %r9
salq $8, %r9
movq %rax, %rbx
orq %rdi, %r9
orq %r10, %rbx
salq $8, %r9
movq %rbx, -5744(%rbp)
orq %rsi, %r9
movq -5808(%rbp), %rsi
salq $8, %r9
orq %rcx, %r9
movq -5792(%rbp), %rcx
salq $8, %r9
orq %rdx, %r9
movzbl -368(%rbp,%rcx), %edx
salq $8, %r9
orq %rdx, %r9
movzbl -368(%rbp,%rsi), %edx
salq $8, %r9
orq %rdx, %r9
movq %r9, -5736(%rbp)
pcmpgtd -5920(%rbp), %xmm0
movdqa -5824(%rbp), %xmm3
movd %xmm0, %eax
testl %eax, %eax
je .L558
movq -5696(%rbp), %rbx
movdqa -5744(%rbp), %xmm7
movd %xmm7, (%rbx)
.L558:
pshufd $85, %xmm0, %xmm2
movd %xmm2, %eax
testl %eax, %eax
je .L559
pshufd $85, -5744(%rbp), %xmm2
movq -5696(%rbp), %rax
movd %xmm2, 4(%rax)
.L559:
movdqa %xmm0, %xmm2
punpckhdq %xmm0, %xmm2
movd %xmm2, %eax
testl %eax, %eax
je .L560
movdqa -5744(%rbp), %xmm2
movq -5696(%rbp), %rax
punpckhdq %xmm2, %xmm2
movd %xmm2, 8(%rax)
.L560:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L561
pshufd $255, -5744(%rbp), %xmm0
movq -5696(%rbp), %rax
movd %xmm0, 12(%rax)
.L561:
movq -5696(%rbp), %rax
movmskps %xmm3, %ebx
movaps %xmm1, -5744(%rbp)
movq %rbx, %rdi
salq $4, %rbx
leaq (%rax,%r14,4), %rax
movq %rax, -5696(%rbp)
call __popcountdi2@PLT
movdqa -5744(%rbp), %xmm1
movslq %eax, %r13
movq -5888(%rbp), %rax
movaps %xmm1, -352(%rbp)
movdqa (%rax,%rbx), %xmm0
movaps %xmm0, -1136(%rbp)
movzbl -1135(%rbp), %eax
movd %xmm0, %r14d
movaps %xmm0, -1248(%rbp)
movzbl -1240(%rbp), %edx
andl $15, %r14d
andl $15, %eax
movaps %xmm0, -1152(%rbp)
movq %rax, -5744(%rbp)
movzbl -1150(%rbp), %eax
movq %rdx, %rsi
movaps %xmm0, -1264(%rbp)
movzbl -1255(%rbp), %edx
andl $15, %esi
movq %rax, %r15
movaps %xmm0, -1232(%rbp)
movzbl -1225(%rbp), %eax
movaps %xmm0, -1216(%rbp)
movq %rdx, %rdi
andl $15, %r15d
movzbl -1210(%rbp), %r12d
andl $15, %edi
andl $15, %eax
movaps %xmm0, -1168(%rbp)
movzbl -1165(%rbp), %r10d
movq %rdi, -5808(%rbp)
andl $15, %r12d
movaps %xmm0, -1184(%rbp)
movzbl -1180(%rbp), %r11d
andl $15, %r10d
movaps %xmm0, -1200(%rbp)
movzbl -1195(%rbp), %ebx
movaps %xmm0, -1280(%rbp)
movzbl -1270(%rbp), %edx
andl $15, %r11d
movaps %xmm0, -1296(%rbp)
movzbl -1285(%rbp), %ecx
andl $15, %ebx
movq %rsi, -5784(%rbp)
andl $15, %edx
movaps %xmm0, -1312(%rbp)
movzbl -1300(%rbp), %esi
andl $15, %ecx
movaps %xmm0, -1328(%rbp)
movzbl -1315(%rbp), %edi
movaps %xmm0, -1344(%rbp)
movzbl -1330(%rbp), %r8d
andl $15, %esi
movaps %xmm0, -1360(%rbp)
movzbl -352(%rbp,%rax), %eax
andl $15, %edi
movzbl -352(%rbp,%r12), %r12d
movzbl -352(%rbp,%rbx), %ebx
movzbl -1345(%rbp), %r9d
andl $15, %r8d
salq $8, %rax
movzbl -352(%rbp,%r11), %r11d
movzbl -352(%rbp,%r10), %r10d
orq %r12, %rax
andl $15, %r9d
movzbl -352(%rbp,%r8), %r8d
movzbl -352(%rbp,%rdi), %edi
salq $8, %rax
movzbl -352(%rbp,%rsi), %esi
movzbl -352(%rbp,%r9), %r9d
orq %rbx, %rax
movq -5744(%rbp), %rbx
movzbl -352(%rbp,%rcx), %ecx
salq $8, %rax
salq $8, %r9
movzbl -352(%rbp,%rdx), %edx
orq %r11, %rax
salq $8, %rax
orq %r10, %rax
movzbl -352(%rbp,%r15), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -352(%rbp,%rbx), %r10d
movq -5880(%rbp), %rbx
salq $8, %rax
orq %r10, %rax
movzbl -352(%rbp,%r14), %r10d
salq $8, %rax
orq %r8, %r9
salq $8, %r9
orq %r10, %rax
orq %rdi, %r9
movq -5808(%rbp), %rdi
movq %rax, -5744(%rbp)
salq $8, %r9
movq -5712(%rbp), %rax
orq %rsi, %r9
movq -5784(%rbp), %rsi
salq $8, %r9
orq %rcx, %r9
salq $8, %r9
orq %rdx, %r9
movzbl -352(%rbp,%rdi), %edx
salq $8, %r9
orq %rdx, %r9
movzbl -352(%rbp,%rsi), %edx
salq $8, %r9
orq %rdx, %r9
movq %r9, -5736(%rbp)
movdqa -5744(%rbp), %xmm5
movups %xmm5, (%rbx,%rax,4)
addq %r13, %rax
cmpq $11, -5776(%rbp)
movq %rax, -5712(%rbp)
jbe .L557
movq -5768(%rbp), %rbx
pcmpeqd %xmm0, %xmm0
movdqu 32(%rbx), %xmm1
movdqa %xmm1, %xmm3
movaps %xmm1, -5744(%rbp)
pcmpgtd -5728(%rbp), %xmm3
pxor %xmm3, %xmm0
movaps %xmm3, -5824(%rbp)
movmskps %xmm0, %ebx
movq %rbx, %rdi
salq $4, %rbx
call __popcountdi2@PLT
movdqa -5744(%rbp), %xmm1
movslq %eax, %r12
movq -5888(%rbp), %rax
movl %r12d, -5784(%rbp)
movdqa (%rax,%rbx), %xmm0
movaps %xmm1, -336(%rbp)
movaps %xmm0, -1376(%rbp)
movzbl -1375(%rbp), %eax
movd %xmm0, %r9d
movaps %xmm0, -1392(%rbp)
andl $15, %r9d
movaps %xmm0, -1488(%rbp)
movq %rax, %r15
movzbl -1480(%rbp), %edx
movzbl -1390(%rbp), %eax
movaps %xmm0, -1408(%rbp)
andl $15, %r15d
movaps %xmm0, -1504(%rbp)
movq %rax, %r14
movq %rdx, %rcx
movzbl -1405(%rbp), %eax
movzbl -1495(%rbp), %edx
andl $15, %ecx
andl $15, %r14d
movaps %xmm0, -1472(%rbp)
movaps %xmm0, -1520(%rbp)
movq %rax, %r13
movzbl -1465(%rbp), %eax
movq %rdx, %rdi
movzbl -1510(%rbp), %edx
movaps %xmm0, -1456(%rbp)
movzbl -1450(%rbp), %ebx
andl $15, %edi
andl $15, %eax
movaps %xmm0, -1424(%rbp)
movzbl -1420(%rbp), %r10d
andl $15, %edx
andl $15, %ebx
andl $15, %r13d
movaps %xmm0, -1440(%rbp)
movq %rcx, -5744(%rbp)
movzbl -1435(%rbp), %r11d
andl $15, %r10d
movq %rdi, -5808(%rbp)
movq %rdx, -5792(%rbp)
andl $15, %r11d
movaps %xmm0, -1536(%rbp)
movzbl -1525(%rbp), %edx
movd -5784(%rbp), %xmm5
movaps %xmm0, -1552(%rbp)
movzbl -1540(%rbp), %ecx
movaps %xmm0, -1568(%rbp)
movzbl -1555(%rbp), %esi
andl $15, %edx
movaps %xmm0, -1584(%rbp)
movzbl -1570(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -1600(%rbp)
andl $15, %esi
pshufd $0, %xmm5, %xmm0
movzbl -336(%rbp,%rax), %eax
movzbl -336(%rbp,%rbx), %ebx
movzbl -1585(%rbp), %r8d
andl $15, %edi
salq $8, %rax
movzbl -336(%rbp,%rdi), %edi
movzbl -336(%rbp,%r11), %r11d
orq %rbx, %rax
andl $15, %r8d
movzbl -336(%rbp,%r10), %r10d
movzbl -336(%rbp,%rsi), %esi
salq $8, %rax
movzbl -336(%rbp,%rcx), %ecx
movzbl -336(%rbp,%r8), %r8d
orq %r11, %rax
movzbl -336(%rbp,%rdx), %edx
movzbl -336(%rbp,%r9), %r9d
salq $8, %rax
salq $8, %r8
orq %r10, %rax
movzbl -336(%rbp,%r13), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -336(%rbp,%r14), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -336(%rbp,%r15), %r10d
salq $8, %rax
orq %r10, %rax
salq $8, %rax
orq %rdi, %r8
movq -5808(%rbp), %rdi
salq $8, %r8
orq %r9, %rax
orq %rsi, %r8
salq $8, %r8
orq %rcx, %r8
movq -5744(%rbp), %rcx
movq %rax, -5744(%rbp)
salq $8, %r8
orq %rdx, %r8
movq -5792(%rbp), %rdx
salq $8, %r8
movzbl -336(%rbp,%rdx), %edx
orq %rdx, %r8
movzbl -336(%rbp,%rdi), %edx
salq $8, %r8
orq %rdx, %r8
movzbl -336(%rbp,%rcx), %edx
salq $8, %r8
orq %rdx, %r8
movq %r8, -5736(%rbp)
pcmpgtd -5920(%rbp), %xmm0
movdqa -5824(%rbp), %xmm3
movd %xmm0, %eax
testl %eax, %eax
je .L562
movq -5696(%rbp), %rax
movdqa -5744(%rbp), %xmm5
movd %xmm5, (%rax)
.L562:
pshufd $85, %xmm0, %xmm2
movd %xmm2, %eax
testl %eax, %eax
je .L563
pshufd $85, -5744(%rbp), %xmm2
movq -5696(%rbp), %rax
movd %xmm2, 4(%rax)
.L563:
movdqa %xmm0, %xmm2
punpckhdq %xmm0, %xmm2
movd %xmm2, %eax
testl %eax, %eax
je .L564
movdqa -5744(%rbp), %xmm2
movq -5696(%rbp), %rax
punpckhdq %xmm2, %xmm2
movd %xmm2, 8(%rax)
.L564:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L565
pshufd $255, -5744(%rbp), %xmm0
movq -5696(%rbp), %rax
movd %xmm0, 12(%rax)
.L565:
movq -5696(%rbp), %rax
movmskps %xmm3, %ebx
movaps %xmm1, -5744(%rbp)
movq %rbx, %rdi
salq $4, %rbx
leaq (%rax,%r12,4), %rax
movq %rax, -5696(%rbp)
call __popcountdi2@PLT
movdqa -5744(%rbp), %xmm1
movslq %eax, %r8
movq -5888(%rbp), %rax
movaps %xmm1, -320(%rbp)
movdqa (%rax,%rbx), %xmm0
movaps %xmm0, -1616(%rbp)
movzbl -1615(%rbp), %eax
movd %xmm0, %r12d
movaps %xmm0, -1728(%rbp)
movzbl -1720(%rbp), %edx
andl $15, %r12d
movq %rax, %r15
movaps %xmm0, -1632(%rbp)
movzbl -1630(%rbp), %eax
movq %rdx, %rsi
movaps %xmm0, -1744(%rbp)
movzbl -1735(%rbp), %edx
andl $15, %r15d
movq %rax, %r14
movaps %xmm0, -1648(%rbp)
movzbl -1645(%rbp), %eax
andl $15, %esi
movq %rdx, %rcx
movaps %xmm0, -1760(%rbp)
movzbl -1750(%rbp), %edx
andl $15, %r14d
movq %rax, %r13
movaps %xmm0, -1712(%rbp)
andl $15, %ecx
movzbl -1705(%rbp), %eax
movaps %xmm0, -1696(%rbp)
movq %rdx, %rdi
andl $15, %r13d
movzbl -1690(%rbp), %ebx
andl $15, %edi
andl $15, %eax
movq %rsi, -5744(%rbp)
movq %rdi, -5808(%rbp)
andl $15, %ebx
movaps %xmm0, -1664(%rbp)
movzbl -1660(%rbp), %r10d
movaps %xmm0, -1680(%rbp)
movzbl -1675(%rbp), %r11d
movaps %xmm0, -1776(%rbp)
movzbl -1765(%rbp), %edx
andl $15, %r10d
movq %rcx, -5784(%rbp)
andl $15, %r11d
movaps %xmm0, -1792(%rbp)
movzbl -1780(%rbp), %ecx
andl $15, %edx
movaps %xmm0, -1808(%rbp)
movzbl -1795(%rbp), %esi
movaps %xmm0, -1824(%rbp)
movzbl -1810(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -1840(%rbp)
movzbl -320(%rbp,%rax), %eax
andl $15, %esi
movzbl -320(%rbp,%rbx), %ebx
movzbl -320(%rbp,%r11), %r11d
movzbl -1825(%rbp), %r9d
andl $15, %edi
salq $8, %rax
movzbl -320(%rbp,%rdi), %edi
movzbl -320(%rbp,%r10), %r10d
orq %rbx, %rax
andl $15, %r9d
movzbl -320(%rbp,%rsi), %esi
movzbl -320(%rbp,%rcx), %ecx
salq $8, %rax
movzbl -320(%rbp,%rdx), %edx
movzbl -320(%rbp,%r9), %r9d
orq %r11, %rax
movq -5880(%rbp), %rbx
salq $8, %rax
salq $8, %r9
orq %r10, %rax
movzbl -320(%rbp,%r13), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -320(%rbp,%r14), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -320(%rbp,%r15), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -320(%rbp,%r12), %r10d
salq $8, %rax
orq %rdi, %r9
movq -5808(%rbp), %rdi
salq $8, %r9
orq %r10, %rax
orq %rsi, %r9
movq -5744(%rbp), %rsi
movq %rax, -5744(%rbp)
salq $8, %r9
movq -5712(%rbp), %rax
orq %rcx, %r9
movq -5784(%rbp), %rcx
salq $8, %r9
orq %rdx, %r9
movzbl -320(%rbp,%rdi), %edx
salq $8, %r9
orq %rdx, %r9
movzbl -320(%rbp,%rcx), %edx
salq $8, %r9
orq %rdx, %r9
movzbl -320(%rbp,%rsi), %edx
salq $8, %r9
orq %rdx, %r9
movq %r9, -5736(%rbp)
movdqa -5744(%rbp), %xmm5
movups %xmm5, (%rbx,%rax,4)
addq %r8, %rax
movq %rax, -5712(%rbp)
.L557:
movq -5776(%rbp), %rbx
leaq -4(%rbx), %rax
leaq 1(%rbx), %rdx
movq -5712(%rbp), %rbx
andq $-4, %rax
addq $4, %rax
cmpq $4, %rdx
movl $4, %edx
cmovbe %rdx, %rax
salq $2, %rbx
.L552:
movq -5776(%rbp), %rcx
cmpq %rax, %rcx
je .L566
movq -5768(%rbp), %rsi
subq %rax, %rcx
movq %rcx, %xmm1
movdqu (%rsi,%rax,4), %xmm3
pshufd $0, %xmm1, %xmm1
pcmpgtd -5920(%rbp), %xmm1
movdqa %xmm3, %xmm2
movaps %xmm3, -5744(%rbp)
pcmpgtd -5728(%rbp), %xmm2
movaps %xmm1, -5824(%rbp)
movdqa %xmm2, %xmm0
movaps %xmm2, -5840(%rbp)
pandn %xmm1, %xmm0
movmskps %xmm0, %r12d
movq %r12, %rdi
salq $4, %r12
call __popcountdi2@PLT
movq -5888(%rbp), %rsi
movdqa -5744(%rbp), %xmm3
movl %eax, -5776(%rbp)
movslq %eax, %r14
movdqa (%rsi,%r12), %xmm0
movaps %xmm3, -304(%rbp)
movaps %xmm0, -1968(%rbp)
movzbl -1960(%rbp), %edx
movd %xmm0, %r8d
movaps %xmm0, -1856(%rbp)
movzbl -1855(%rbp), %eax
andl $15, %r8d
movaps %xmm0, -1984(%rbp)
movq %rdx, %rcx
movzbl -1975(%rbp), %edx
movaps %xmm0, -1952(%rbp)
movq %rax, %rsi
movzbl -1945(%rbp), %eax
andl $15, %ecx
movaps %xmm0, -1936(%rbp)
movq %rdx, %rdi
andl $15, %esi
movzbl -1930(%rbp), %r13d
andl $15, %edi
andl $15, %eax
movaps %xmm0, -1872(%rbp)
movzbl -1870(%rbp), %r9d
movaps %xmm0, -1888(%rbp)
andl $15, %r13d
movzbl -1885(%rbp), %r10d
movaps %xmm0, -1904(%rbp)
movzbl -1900(%rbp), %r11d
andl $15, %r9d
movaps %xmm0, -1920(%rbp)
movzbl -1915(%rbp), %r12d
andl $15, %r10d
movq %rsi, -5744(%rbp)
andl $15, %r11d
movq %rcx, -5784(%rbp)
andl $15, %r12d
movq %rdi, -5808(%rbp)
movaps %xmm0, -2000(%rbp)
movzbl -1990(%rbp), %edx
movaps %xmm0, -2016(%rbp)
movaps %xmm0, -2032(%rbp)
andl $15, %edx
movaps %xmm0, -2048(%rbp)
movzbl -2035(%rbp), %ecx
movaps %xmm0, -2064(%rbp)
movzbl -2050(%rbp), %esi
movaps %xmm0, -2080(%rbp)
movzbl -304(%rbp,%rax), %eax
movzbl -2065(%rbp), %edi
andl $15, %ecx
movzbl -304(%rbp,%r13), %r13d
movq %rdx, -5792(%rbp)
andl $15, %esi
salq $8, %rax
movzbl -2005(%rbp), %edx
andl $15, %edi
movzbl -304(%rbp,%r12), %r12d
orq %r13, %rax
movzbl -304(%rbp,%r11), %r11d
movzbl -304(%rbp,%r10), %r10d
salq $8, %rax
movzbl -304(%rbp,%rdi), %edi
movq %rdx, %r15
movzbl -304(%rbp,%r9), %r9d
orq %r12, %rax
movzbl -2020(%rbp), %edx
andl $15, %r15d
movzbl -304(%rbp,%rsi), %esi
salq $8, %rax
movzbl -304(%rbp,%rcx), %ecx
movzbl -304(%rbp,%r8), %r8d
orq %r11, %rax
movq -5744(%rbp), %r11
andl $15, %edx
salq $8, %rax
movzbl -304(%rbp,%rdx), %edx
orq %r10, %rax
salq $8, %rax
orq %r9, %rax
movzbl -304(%rbp,%r11), %r9d
salq $8, %rax
orq %r9, %rax
salq $8, %rax
salq $8, %rdi
orq %rsi, %rdi
movq -5808(%rbp), %rsi
salq $8, %rdi
orq %rcx, %rdi
movq -5784(%rbp), %rcx
salq $8, %rdi
orq %rdx, %rdi
movzbl -304(%rbp,%r15), %edx
salq $8, %rdi
orq %rdx, %rdi
movq -5792(%rbp), %rdx
salq $8, %rdi
movzbl -304(%rbp,%rdx), %edx
orq %rdx, %rdi
movzbl -304(%rbp,%rsi), %edx
movq %rax, %rsi
salq $8, %rdi
orq %r8, %rsi
orq %rdx, %rdi
movzbl -304(%rbp,%rcx), %edx
movd -5776(%rbp), %xmm7
movq %rsi, -5744(%rbp)
salq $8, %rdi
movdqa -5824(%rbp), %xmm1
movdqa -5840(%rbp), %xmm2
pshufd $0, %xmm7, %xmm0
orq %rdx, %rdi
pcmpgtd -5920(%rbp), %xmm0
movq %rdi, -5736(%rbp)
movd %xmm0, %eax
testl %eax, %eax
je .L567
movq -5696(%rbp), %rax
movdqa -5744(%rbp), %xmm7
movd %xmm7, (%rax)
.L567:
pshufd $85, %xmm0, %xmm4
movd %xmm4, %eax
testl %eax, %eax
je .L568
pshufd $85, -5744(%rbp), %xmm4
movq -5696(%rbp), %rax
movd %xmm4, 4(%rax)
.L568:
movdqa %xmm0, %xmm4
punpckhdq %xmm0, %xmm4
movd %xmm4, %eax
testl %eax, %eax
je .L569
movdqa -5744(%rbp), %xmm4
movq -5696(%rbp), %rax
punpckhdq %xmm4, %xmm4
movd %xmm4, 8(%rax)
.L569:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L570
pshufd $255, -5744(%rbp), %xmm0
movq -5696(%rbp), %rax
movd %xmm0, 12(%rax)
.L570:
movq -5696(%rbp), %rax
pand %xmm1, %xmm2
movaps %xmm3, -5744(%rbp)
movmskps %xmm2, %r12d
leaq (%rax,%r14,4), %rax
movq %r12, %rdi
salq $4, %r12
movq %rax, -5696(%rbp)
call __popcountdi2@PLT
movdqa -5744(%rbp), %xmm3
movslq %eax, %r8
movq -5888(%rbp), %rax
movaps %xmm3, -288(%rbp)
movdqa (%rax,%r12), %xmm0
movaps %xmm0, -2208(%rbp)
movzbl -2200(%rbp), %edx
movd %xmm0, %r9d
movaps %xmm0, -2224(%rbp)
andl $15, %r9d
movq %rdx, %rsi
movzbl -2215(%rbp), %edx
movaps %xmm0, -2096(%rbp)
movzbl -2095(%rbp), %eax
movaps %xmm0, -2240(%rbp)
andl $15, %esi
movq %rdx, %rcx
movzbl -2230(%rbp), %edx
movq %rax, %r15
movaps %xmm0, -2112(%rbp)
movzbl -2110(%rbp), %eax
andl $15, %ecx
andl $15, %r15d
movaps %xmm0, -2256(%rbp)
movq %rdx, %rdi
movzbl -2245(%rbp), %edx
movaps %xmm0, -2192(%rbp)
andl $15, %edi
movq %rax, %r14
movzbl -2185(%rbp), %eax
movaps %xmm0, -2176(%rbp)
movq %rdi, -5784(%rbp)
movq %rdx, %rdi
andl $15, %r14d
movzbl -2170(%rbp), %r13d
andl $15, %edi
andl $15, %eax
movq %rsi, -5744(%rbp)
movq %rcx, -5776(%rbp)
andl $15, %r13d
movq %rdi, -5808(%rbp)
movaps %xmm0, -2128(%rbp)
movzbl -2125(%rbp), %r10d
movaps %xmm0, -2144(%rbp)
movzbl -2140(%rbp), %r11d
movaps %xmm0, -2160(%rbp)
movzbl -2155(%rbp), %r12d
andl $15, %r10d
movaps %xmm0, -2272(%rbp)
andl $15, %r11d
movzbl -2260(%rbp), %edx
movaps %xmm0, -2288(%rbp)
andl $15, %r12d
movzbl -2275(%rbp), %ecx
movaps %xmm0, -2304(%rbp)
movzbl -2290(%rbp), %esi
andl $15, %edx
movaps %xmm0, -2320(%rbp)
movzbl -288(%rbp,%rax), %eax
movzbl -288(%rbp,%r13), %r13d
andl $15, %ecx
movzbl -288(%rbp,%r12), %r12d
movzbl -2305(%rbp), %edi
andl $15, %esi
salq $8, %rax
movzbl -288(%rbp,%rsi), %esi
movzbl -288(%rbp,%r11), %r11d
orq %r13, %rax
andl $15, %edi
movzbl -288(%rbp,%r10), %r10d
movzbl -288(%rbp,%rcx), %ecx
salq $8, %rax
movzbl -288(%rbp,%rdi), %edi
movzbl -288(%rbp,%rdx), %edx
movzbl -288(%rbp,%r9), %r9d
orq %r12, %rax
salq $8, %rax
salq $8, %rdi
orq %r11, %rax
salq $8, %rax
orq %r10, %rax
movzbl -288(%rbp,%r14), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -288(%rbp,%r15), %r10d
movq -5808(%rbp), %r15
salq $8, %rax
orq %r10, %rax
salq $8, %rax
orq %rsi, %rdi
movq -5744(%rbp), %rsi
salq $8, %rdi
orq %r9, %rax
orq %rcx, %rdi
movq -5776(%rbp), %rcx
movq %rax, -5744(%rbp)
salq $8, %rdi
movq -5880(%rbp), %rax
orq %rdx, %rdi
movzbl -288(%rbp,%r15), %edx
salq $8, %rdi
orq %rdx, %rdi
movq -5784(%rbp), %rdx
salq $8, %rdi
movzbl -288(%rbp,%rdx), %edx
orq %rdx, %rdi
movzbl -288(%rbp,%rcx), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -288(%rbp,%rsi), %edx
salq $8, %rdi
orq %rdx, %rdi
movq %rdi, -5736(%rbp)
movdqa -5744(%rbp), %xmm6
movups %xmm6, (%rax,%rbx)
addq %r8, -5712(%rbp)
movq -5712(%rbp), %rax
leaq 0(,%rax,4), %rbx
.L566:
movq -5768(%rbp), %rax
movq -5760(%rbp), %rdx
movl %ebx, %ecx
subq -5712(%rbp), %rdx
leaq (%rax,%rdx,4), %rax
cmpl $8, %ebx
jnb .L571
testb $4, %bl
jne .L773
testl %ecx, %ecx
jne .L774
.L572:
movl %ebx, %ecx
cmpl $8, %ebx
jnb .L575
andl $4, %ebx
jne .L775
testl %ecx, %ecx
jne .L776
.L576:
movq -5696(%rbp), %rbx
movq -5760(%rbp), %rdi
movq %rbx, %rax
subq -5768(%rbp), %rax
sarq $2, %rax
subq %rax, %rdi
movq %rax, -5976(%rbp)
movq %rdi, -5968(%rbp)
movq %rdx, %rdi
subq %rax, %rdi
movq %rdi, -5712(%rbp)
leaq (%rbx,%rdi,4), %rax
je .L616
movdqu (%rbx), %xmm5
movdqu 16(%rbx), %xmm7
leaq -64(%rax), %rsi
addq $64, %rbx
movdqu -32(%rbx), %xmm6
movq %rsi, -5784(%rbp)
movaps %xmm5, -6000(%rbp)
movdqu -16(%rbx), %xmm5
movaps %xmm7, -6016(%rbp)
movdqu -64(%rax), %xmm7
movaps %xmm6, -6032(%rbp)
movdqu -48(%rax), %xmm6
movaps %xmm5, -6048(%rbp)
movdqu -32(%rax), %xmm5
movaps %xmm7, -6064(%rbp)
movdqu -16(%rax), %xmm7
movq %rbx, -5776(%rbp)
movaps %xmm6, -6080(%rbp)
movaps %xmm5, -6096(%rbp)
movaps %xmm7, -6112(%rbp)
cmpq %rsi, %rbx
je .L617
leaq _ZZN3hwy6N_SSE26detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rax
xorl %r15d, %r15d
movq %rax, -5744(%rbp)
jmp .L583
.p2align 4,,10
.p2align 3
.L778:
movq -5784(%rbp), %rax
movdqu -64(%rax), %xmm4
movdqu -48(%rax), %xmm3
prefetcht0 -256(%rax)
subq $64, %rax
movdqu 32(%rax), %xmm2
movdqu 48(%rax), %xmm1
movq %rax, -5784(%rbp)
.L582:
movdqa %xmm4, %xmm0
movq -5744(%rbp), %rbx
movaps %xmm1, -5872(%rbp)
pcmpgtd -5728(%rbp), %xmm0
movaps %xmm4, -272(%rbp)
movaps %xmm2, -5856(%rbp)
movaps %xmm3, -5840(%rbp)
movmskps %xmm0, %r14d
movq %r14, %rax
salq $4, %rax
movdqa (%rbx,%rax), %xmm0
movaps %xmm0, -2336(%rbp)
movzbl -2335(%rbp), %eax
movd %xmm0, %esi
movaps %xmm0, -2448(%rbp)
movzbl -2440(%rbp), %edx
andl $15, %esi
andl $15, %eax
movaps %xmm0, -2432(%rbp)
movaps %xmm0, -2464(%rbp)
movq %rdx, %rcx
movzbl -2455(%rbp), %edx
movq %rax, -5808(%rbp)
movzbl -2425(%rbp), %eax
andl $15, %ecx
movaps %xmm0, -2416(%rbp)
movzbl -2410(%rbp), %r13d
andl $15, %edx
andl $15, %eax
movaps %xmm0, -2352(%rbp)
movzbl -2350(%rbp), %r10d
movaps %xmm0, -2368(%rbp)
andl $15, %r13d
movzbl -2365(%rbp), %r11d
movaps %xmm0, -2384(%rbp)
movzbl -2380(%rbp), %ebx
andl $15, %r10d
movaps %xmm0, -2400(%rbp)
movzbl -2395(%rbp), %r12d
andl $15, %r11d
movaps %xmm0, -2480(%rbp)
andl $15, %ebx
movaps %xmm0, -2496(%rbp)
andl $15, %r12d
movq %rsi, -5760(%rbp)
movq %rdx, -5824(%rbp)
movzbl -2470(%rbp), %edx
movq %rcx, -5792(%rbp)
movzbl -2485(%rbp), %ecx
movaps %xmm0, -2512(%rbp)
movzbl -2500(%rbp), %esi
andl $15, %edx
movaps %xmm0, -2528(%rbp)
movzbl -2515(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -2544(%rbp)
movzbl -2530(%rbp), %r8d
andl $15, %esi
movaps %xmm0, -2560(%rbp)
movzbl -272(%rbp,%rax), %eax
andl $15, %edi
movzbl -272(%rbp,%r13), %r13d
movzbl -272(%rbp,%r12), %r12d
andl $15, %r8d
movzbl -272(%rbp,%rbx), %ebx
salq $8, %rax
movzbl -2545(%rbp), %r9d
movzbl -272(%rbp,%r11), %r11d
orq %r13, %rax
movzbl -272(%rbp,%rdi), %edi
movzbl -272(%rbp,%r10), %r10d
salq $8, %rax
andl $15, %r9d
movzbl -272(%rbp,%r8), %r8d
movzbl -272(%rbp,%rsi), %esi
orq %r12, %rax
movzbl -272(%rbp,%rcx), %ecx
movzbl -272(%rbp,%r9), %r9d
salq $8, %rax
movzbl -272(%rbp,%rdx), %edx
orq %rbx, %rax
salq $8, %r9
salq $8, %rax
orq %r8, %r9
orq %r11, %rax
movq -5760(%rbp), %r11
salq $8, %rax
orq %r10, %rax
movq -5808(%rbp), %r10
salq $8, %rax
movzbl -272(%rbp,%r10), %r10d
orq %r10, %rax
movzbl -272(%rbp,%r11), %r10d
salq $8, %rax
salq $8, %r9
orq %rdi, %r9
orq %r10, %rax
movq %r14, %rdi
salq $8, %r9
movq %rax, -5760(%rbp)
orq %rsi, %r9
salq $8, %r9
orq %rcx, %r9
movq -5792(%rbp), %rcx
salq $8, %r9
orq %rdx, %r9
movq -5824(%rbp), %rdx
salq $8, %r9
movzbl -272(%rbp,%rdx), %edx
orq %rdx, %r9
movzbl -272(%rbp,%rcx), %edx
salq $8, %r9
orq %rdx, %r9
movq %r9, -5752(%rbp)
call __popcountdi2@PLT
movdqa -5840(%rbp), %xmm3
movdqa -5760(%rbp), %xmm6
movq -5696(%rbp), %rcx
movq -5712(%rbp), %rsi
cltq
movdqa %xmm3, %xmm0
movq -5744(%rbp), %rbx
movaps %xmm3, -256(%rbp)
pcmpgtd -5728(%rbp), %xmm0
movups %xmm6, (%rcx,%r15,4)
leaq -4(%rsi,%r15), %rdx
addq $4, %r15
subq %rax, %r15
movups %xmm6, (%rcx,%rdx,4)
movmskps %xmm0, %eax
movq %rax, -5808(%rbp)
salq $4, %rax
movdqa (%rbx,%rax), %xmm0
movd %xmm0, %edx
movaps %xmm0, -2576(%rbp)
movzbl -2575(%rbp), %eax
andl $15, %edx
movaps %xmm0, -2688(%rbp)
movq %rdx, -5760(%rbp)
movzbl -2680(%rbp), %edx
movq %rax, %r11
movaps %xmm0, -2672(%rbp)
movzbl -2665(%rbp), %eax
andl $15, %r11d
movaps %xmm0, -2656(%rbp)
movq %rdx, %r8
movzbl -2650(%rbp), %r14d
andl $15, %r8d
andl $15, %eax
movaps %xmm0, -2592(%rbp)
movaps %xmm0, -2608(%rbp)
andl $15, %r14d
movzbl -2605(%rbp), %ebx
movaps %xmm0, -2624(%rbp)
movzbl -2620(%rbp), %r12d
movaps %xmm0, -2640(%rbp)
movzbl -2635(%rbp), %r13d
andl $15, %ebx
movaps %xmm0, -2704(%rbp)
andl $15, %r12d
movq %r11, -5792(%rbp)
movzbl -2590(%rbp), %r11d
andl $15, %r13d
movq %r8, -5824(%rbp)
movzbl -2695(%rbp), %edx
movaps %xmm0, -2720(%rbp)
movzbl -2710(%rbp), %ecx
andl $15, %r11d
movaps %xmm0, -2736(%rbp)
movzbl -2725(%rbp), %esi
andl $15, %edx
movaps %xmm0, -2752(%rbp)
movzbl -2740(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -2768(%rbp)
movzbl -2755(%rbp), %r8d
andl $15, %esi
movaps %xmm0, -2784(%rbp)
movzbl -2770(%rbp), %r9d
andl $15, %edi
movaps %xmm0, -2800(%rbp)
movzbl -2785(%rbp), %r10d
movzbl -256(%rbp,%rax), %eax
andl $15, %r8d
movzbl -256(%rbp,%r14), %r14d
andl $15, %r9d
movzbl -256(%rbp,%r13), %r13d
andl $15, %r10d
salq $8, %rax
movzbl -256(%rbp,%r9), %r9d
movzbl -256(%rbp,%r12), %r12d
orq %r14, %rax
movzbl -256(%rbp,%rbx), %ebx
movzbl -256(%rbp,%r10), %r10d
salq $8, %rax
movq -5760(%rbp), %r14
movzbl -256(%rbp,%r8), %r8d
orq %r13, %rax
salq $8, %r10
movzbl -256(%rbp,%rdi), %edi
movzbl -256(%rbp,%r11), %r11d
orq %r9, %r10
salq $8, %rax
movzbl -256(%rbp,%rsi), %esi
movzbl -256(%rbp,%rcx), %ecx
orq %r12, %rax
salq $8, %r10
movzbl -256(%rbp,%rdx), %edx
orq %r8, %r10
salq $8, %rax
movq -5824(%rbp), %r8
orq %rbx, %rax
salq $8, %r10
orq %rdi, %r10
salq $8, %rax
orq %r11, %rax
salq $8, %r10
movq -5792(%rbp), %r11
orq %rsi, %r10
salq $8, %rax
movzbl -256(%rbp,%r11), %r11d
salq $8, %r10
orq %rcx, %r10
orq %r11, %rax
salq $8, %r10
movzbl -256(%rbp,%r14), %r11d
salq $8, %rax
orq %rdx, %r10
movzbl -256(%rbp,%r8), %edx
movq -5808(%rbp), %rdi
salq $8, %r10
movq %rax, %r14
orq %r11, %r14
orq %rdx, %r10
movq %r14, -5760(%rbp)
movq %r10, -5752(%rbp)
call __popcountdi2@PLT
movdqa -5856(%rbp), %xmm2
movq -5712(%rbp), %rsi
movq -5696(%rbp), %rcx
cltq
movdqa -5760(%rbp), %xmm6
leaq -8(%rsi,%r15), %rdx
movdqa %xmm2, %xmm0
movq -5744(%rbp), %rdi
movaps %xmm2, -240(%rbp)
movups %xmm6, (%rcx,%r15,4)
pcmpgtd -5728(%rbp), %xmm0
movups %xmm6, (%rcx,%rdx,4)
movl $4, %edx
subq %rax, %rdx
movq %rdx, %rbx
addq %r15, %rbx
movmskps %xmm0, %r15d
movq %r15, %rax
salq $4, %rax
movdqa (%rdi,%rax), %xmm0
movaps %xmm0, -2816(%rbp)
movd %xmm0, %edx
movzbl -2815(%rbp), %eax
andl $15, %edx
movaps %xmm0, -2928(%rbp)
andl $15, %eax
movq %rdx, -5760(%rbp)
movzbl -2920(%rbp), %edx
movaps %xmm0, -2912(%rbp)
movq %rax, -5808(%rbp)
movzbl -2905(%rbp), %eax
movq %rdx, %r8
movaps %xmm0, -2896(%rbp)
movzbl -2890(%rbp), %r14d
andl $15, %r8d
andl $15, %eax
movaps %xmm0, -2832(%rbp)
movzbl -2830(%rbp), %r10d
movaps %xmm0, -2848(%rbp)
andl $15, %r14d
movzbl -2845(%rbp), %r11d
movaps %xmm0, -2864(%rbp)
movzbl -2860(%rbp), %r12d
andl $15, %r10d
movaps %xmm0, -2880(%rbp)
movzbl -2875(%rbp), %r13d
andl $15, %r11d
movaps %xmm0, -2944(%rbp)
andl $15, %r12d
movq %r8, -5792(%rbp)
movzbl -2935(%rbp), %edx
andl $15, %r13d
movaps %xmm0, -2960(%rbp)
movaps %xmm0, -2976(%rbp)
movq %rdx, %r9
movzbl -2965(%rbp), %ecx
movzbl -2950(%rbp), %edx
movaps %xmm0, -2992(%rbp)
andl $15, %r9d
movzbl -2980(%rbp), %esi
movaps %xmm0, -3008(%rbp)
andl $15, %edx
andl $15, %ecx
movzbl -2995(%rbp), %edi
movaps %xmm0, -3024(%rbp)
movzbl -3010(%rbp), %r8d
andl $15, %esi
movaps %xmm0, -3040(%rbp)
movzbl -240(%rbp,%rax), %eax
andl $15, %edi
movzbl -240(%rbp,%r14), %r14d
movzbl -240(%rbp,%r13), %r13d
movq %r9, -5824(%rbp)
andl $15, %r8d
salq $8, %rax
movzbl -3025(%rbp), %r9d
movzbl -240(%rbp,%r12), %r12d
orq %r14, %rax
movq -5760(%rbp), %r14
movzbl -240(%rbp,%r11), %r11d
salq $8, %rax
andl $15, %r9d
movzbl -240(%rbp,%r10), %r10d
movzbl -240(%rbp,%r8), %r8d
orq %r13, %rax
movzbl -240(%rbp,%rdi), %edi
movzbl -240(%rbp,%r9), %r9d
salq $8, %rax
movzbl -240(%rbp,%rsi), %esi
movzbl -240(%rbp,%rcx), %ecx
orq %r12, %rax
salq $8, %r9
movzbl -240(%rbp,%rdx), %edx
salq $8, %rax
orq %r8, %r9
orq %r11, %rax
movq -5808(%rbp), %r11
salq $8, %rax
orq %r10, %rax
movzbl -240(%rbp,%r11), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -240(%rbp,%r14), %r10d
salq $8, %rax
salq $8, %r9
orq %rdi, %r9
orq %r10, %rax
movq %r15, %rdi
salq $8, %r9
orq %rsi, %r9
salq $8, %r9
orq %rcx, %r9
salq $8, %r9
orq %rdx, %r9
movq -5824(%rbp), %rdx
salq $8, %r9
movzbl -240(%rbp,%rdx), %edx
movq -5792(%rbp), %r8
movq %rax, -5760(%rbp)
orq %rdx, %r9
movzbl -240(%rbp,%r8), %edx
salq $8, %r9
orq %rdx, %r9
movq %r9, -5752(%rbp)
call __popcountdi2@PLT
movdqa -5872(%rbp), %xmm1
movq -5712(%rbp), %rsi
movq -5696(%rbp), %rcx
cltq
movdqa -5760(%rbp), %xmm6
movdqa %xmm1, %xmm0
leaq -12(%rsi,%rbx), %rdx
movq -5744(%rbp), %rdi
subq $16, %rsi
pcmpgtd -5728(%rbp), %xmm0
movups %xmm6, (%rcx,%rbx,4)
movups %xmm6, (%rcx,%rdx,4)
movl $4, %edx
subq %rax, %rdx
movq %rsi, -5712(%rbp)
movmskps %xmm0, %r15d
addq %rdx, %rbx
movaps %xmm1, -224(%rbp)
movq %r15, %rax
salq $4, %rax
movdqa (%rdi,%rax), %xmm0
movaps %xmm0, -3056(%rbp)
movzbl -3055(%rbp), %eax
movd %xmm0, %edi
movaps %xmm0, -3168(%rbp)
movzbl -3160(%rbp), %edx
andl $15, %edi
andl $15, %eax
movaps %xmm0, -3072(%rbp)
movzbl -3070(%rbp), %r10d
andl $15, %edx
movaps %xmm0, -3088(%rbp)
movzbl -3085(%rbp), %r11d
movaps %xmm0, -3104(%rbp)
movzbl -3100(%rbp), %r12d
andl $15, %r10d
movaps %xmm0, -3120(%rbp)
movzbl -3115(%rbp), %r13d
andl $15, %r11d
movaps %xmm0, -3136(%rbp)
movzbl -3130(%rbp), %r14d
andl $15, %r12d
movaps %xmm0, -3152(%rbp)
andl $15, %r13d
movq %rdi, -5760(%rbp)
andl $15, %r14d
movq %rax, -5808(%rbp)
movzbl -3145(%rbp), %eax
movq %rdx, -5792(%rbp)
movaps %xmm0, -3184(%rbp)
movzbl -3175(%rbp), %edx
andl $15, %eax
movaps %xmm0, -3200(%rbp)
movq %rdx, %r8
movaps %xmm0, -3216(%rbp)
movzbl -3190(%rbp), %edx
movzbl -3205(%rbp), %ecx
andl $15, %r8d
movaps %xmm0, -3232(%rbp)
movzbl -3220(%rbp), %esi
movaps %xmm0, -3248(%rbp)
andl $15, %edx
andl $15, %ecx
movzbl -3235(%rbp), %edi
movaps %xmm0, -3264(%rbp)
andl $15, %esi
movaps %xmm0, -3280(%rbp)
movzbl -3265(%rbp), %r9d
andl $15, %edi
movzbl -224(%rbp,%rax), %eax
movq %r8, -5824(%rbp)
movzbl -3250(%rbp), %r8d
movzbl -224(%rbp,%rdi), %edi
movzbl -224(%rbp,%r14), %r14d
andl $15, %r8d
andl $15, %r9d
salq $8, %rax
movzbl -224(%rbp,%r13), %r13d
movzbl -224(%rbp,%r9), %r9d
orq %r14, %rax
movzbl -224(%rbp,%r8), %r8d
salq $8, %rax
movq -5760(%rbp), %r14
movzbl -224(%rbp,%r12), %r12d
salq $8, %r9
orq %r13, %rax
movzbl -224(%rbp,%rsi), %esi
movzbl -224(%rbp,%r11), %r11d
orq %r8, %r9
salq $8, %rax
movzbl -224(%rbp,%rcx), %ecx
movzbl -224(%rbp,%r10), %r10d
salq $8, %r9
orq %r12, %rax
movzbl -224(%rbp,%rdx), %edx
movq -5824(%rbp), %r8
orq %rdi, %r9
salq $8, %rax
movq %r15, %rdi
movl $4, %r15d
salq $8, %r9
orq %r11, %rax
movq -5808(%rbp), %r11
orq %rsi, %r9
salq $8, %rax
salq $8, %r9
orq %r10, %rax
movzbl -224(%rbp,%r11), %r10d
orq %rcx, %r9
salq $8, %rax
salq $8, %r9
orq %r10, %rax
movzbl -224(%rbp,%r14), %r10d
orq %rdx, %r9
salq $8, %rax
movzbl -224(%rbp,%r8), %edx
salq $8, %r9
orq %r10, %rax
orq %rdx, %r9
movq -5792(%rbp), %rdx
movq %rax, -5760(%rbp)
salq $8, %r9
movzbl -224(%rbp,%rdx), %edx
orq %rdx, %r9
movq %r9, -5752(%rbp)
call __popcountdi2@PLT
movq -5712(%rbp), %rsi
movq -5696(%rbp), %rcx
movdqa -5760(%rbp), %xmm7
cltq
leaq (%rbx,%rsi), %rdx
subq %rax, %r15
movups %xmm7, (%rcx,%rbx,4)
addq %rbx, %r15
movq -5784(%rbp), %rbx
movups %xmm7, (%rcx,%rdx,4)
cmpq %rbx, -5776(%rbp)
je .L777
.L583:
movq -5776(%rbp), %rax
subq -5696(%rbp), %rax
sarq $2, %rax
subq %r15, %rax
cmpq $16, %rax
ja .L778
movq -5776(%rbp), %rax
movdqu (%rax), %xmm4
movdqu 16(%rax), %xmm3
prefetcht0 256(%rax)
addq $64, %rax
movdqu -32(%rax), %xmm2
movdqu -16(%rax), %xmm1
movq %rax, -5776(%rbp)
jmp .L582
.p2align 4,,10
.p2align 3
.L770:
movq -5896(%rbp), %rbx
movl $16, %edx
movq %r8, %r15
subq %rax, %rdx
leaq (%rdi,%rdx,4), %r12
leaq -16(%rax,%rbx), %r11
jmp .L496
.p2align 4,,10
.p2align 3
.L777:
leaq (%rsi,%r15), %r13
leaq (%rcx,%r15,4), %r14
leaq 4(%r15), %rbx
.L580:
movdqa -6000(%rbp), %xmm6
movq -5744(%rbp), %rdi
movdqa %xmm6, %xmm0
movaps %xmm6, -208(%rbp)
pcmpgtd -5728(%rbp), %xmm0
movmskps %xmm0, %r12d
movq %r12, %rax
salq $4, %rax
movdqa (%rdi,%rax), %xmm0
movaps %xmm0, -3296(%rbp)
movzbl -3295(%rbp), %eax
movd %xmm0, %r8d
movaps %xmm0, -3408(%rbp)
movzbl -3400(%rbp), %edx
andl $15, %r8d
andl $15, %eax
movaps %xmm0, -3312(%rbp)
andl $15, %edx
movq %rax, -5760(%rbp)
movzbl -3310(%rbp), %eax
movaps %xmm0, -3424(%rbp)
movq %rdx, -5808(%rbp)
movzbl -3415(%rbp), %edx
movq %rax, %rcx
movaps %xmm0, -3328(%rbp)
movzbl -3325(%rbp), %eax
andl $15, %ecx
movaps %xmm0, -3440(%rbp)
movq %rdx, %r15
movzbl -3430(%rbp), %edx
movaps %xmm0, -3392(%rbp)
movq %rax, %rsi
andl $15, %r15d
movzbl -3385(%rbp), %eax
movaps %xmm0, -3376(%rbp)
movzbl -3370(%rbp), %r11d
andl $15, %esi
movq %rcx, -5776(%rbp)
movq %rdx, %rcx
andl $15, %eax
andl $15, %ecx
movaps %xmm0, -3344(%rbp)
andl $15, %r11d
movzbl -3340(%rbp), %r9d
movaps %xmm0, -3360(%rbp)
movzbl -3355(%rbp), %r10d
movaps %xmm0, -3456(%rbp)
andl $15, %r9d
movq %rsi, -5784(%rbp)
andl $15, %r10d
movq %r15, -5792(%rbp)
movq %rcx, -5824(%rbp)
movzbl -3445(%rbp), %edx
movaps %xmm0, -3472(%rbp)
movaps %xmm0, -3488(%rbp)
movq %rdx, %rsi
movzbl -3475(%rbp), %ecx
movzbl -3460(%rbp), %edx
movaps %xmm0, -3504(%rbp)
andl $15, %esi
movaps %xmm0, -3520(%rbp)
movq %rsi, %r15
andl $15, %ecx
andl $15, %edx
movzbl -208(%rbp,%rax), %eax
movzbl -3505(%rbp), %edi
movzbl -208(%rbp,%r11), %r11d
movzbl -3490(%rbp), %esi
salq $8, %rax
andl $15, %edi
movzbl -208(%rbp,%r10), %r10d
movzbl -208(%rbp,%r9), %r9d
orq %r11, %rax
movq -5760(%rbp), %r11
movzbl -208(%rbp,%rdi), %edi
andl $15, %esi
salq $8, %rax
movzbl -208(%rbp,%rsi), %esi
movzbl -208(%rbp,%rcx), %ecx
orq %r10, %rax
movq -5776(%rbp), %r10
salq $8, %rdi
movzbl -208(%rbp,%rdx), %edx
movzbl -208(%rbp,%r8), %r8d
salq $8, %rax
orq %rsi, %rdi
orq %r9, %rax
movq -5784(%rbp), %r9
salq $8, %rax
movzbl -208(%rbp,%r9), %r9d
orq %r9, %rax
movzbl -208(%rbp,%r10), %r9d
salq $8, %rax
orq %r9, %rax
movzbl -208(%rbp,%r11), %r9d
salq $8, %rax
orq %r9, %rax
salq $8, %rax
salq $8, %rdi
orq %rcx, %rdi
movq -5824(%rbp), %rcx
orq %r8, %rax
salq $8, %rdi
orq %rdx, %rdi
movzbl -208(%rbp,%r15), %edx
movq -5792(%rbp), %r15
salq $8, %rdi
orq %rdx, %rdi
movzbl -208(%rbp,%rcx), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -208(%rbp,%r15), %edx
salq $8, %rdi
orq %rdx, %rdi
movq -5808(%rbp), %rdx
salq $8, %rdi
movzbl -208(%rbp,%rdx), %edx
movq %rax, -5760(%rbp)
movq %rdi, %rax
movq %r12, %rdi
orq %rdx, %rax
movq %rax, -5752(%rbp)
call __popcountdi2@PLT
movdqa -6016(%rbp), %xmm7
movq -5744(%rbp), %rdi
cltq
movdqa -5760(%rbp), %xmm6
movq -5696(%rbp), %rsi
movdqa %xmm7, %xmm0
subq %rax, %rbx
movaps %xmm7, -192(%rbp)
pcmpgtd -5728(%rbp), %xmm0
movups %xmm6, (%r14)
movups %xmm6, -16(%rsi,%r13,4)
movmskps %xmm0, %r11d
movq %r11, %rax
salq $4, %rax
movdqa (%rdi,%rax), %xmm0
movaps %xmm0, -3648(%rbp)
movzbl -3640(%rbp), %edx
movd %xmm0, %r8d
movaps %xmm0, -3536(%rbp)
movzbl -3535(%rbp), %eax
andl $15, %r8d
movaps %xmm0, -3664(%rbp)
movq %rdx, %rcx
movzbl -3655(%rbp), %edx
movaps %xmm0, -3552(%rbp)
movq %rax, %r15
andl $15, %ecx
movzbl -3550(%rbp), %eax
andl $15, %edx
movaps %xmm0, -3568(%rbp)
andl $15, %r15d
movaps %xmm0, -3680(%rbp)
movq %rax, %r14
movzbl -3565(%rbp), %eax
movq %rdx, -5776(%rbp)
movzbl -3670(%rbp), %edx
andl $15, %r14d
movaps %xmm0, -3584(%rbp)
movq %rax, %r13
movzbl -3580(%rbp), %eax
movq %rcx, -5760(%rbp)
movq %rdx, %rcx
andl $15, %r13d
andl $15, %ecx
movaps %xmm0, -3600(%rbp)
movq %rax, %r12
movzbl -3595(%rbp), %r9d
movaps %xmm0, -3616(%rbp)
movzbl -3610(%rbp), %r10d
andl $15, %r12d
movaps %xmm0, -3632(%rbp)
movzbl -3625(%rbp), %eax
andl $15, %r9d
movq %rcx, -5784(%rbp)
andl $15, %r10d
movaps %xmm0, -3696(%rbp)
movzbl -3685(%rbp), %edx
andl $15, %eax
movaps %xmm0, -3712(%rbp)
andl $15, %edx
movaps %xmm0, -3728(%rbp)
movzbl -3715(%rbp), %ecx
movaps %xmm0, -3744(%rbp)
movzbl -3730(%rbp), %esi
movaps %xmm0, -3760(%rbp)
movzbl -3745(%rbp), %edi
movzbl -192(%rbp,%rax), %eax
andl $15, %ecx
movq %rdx, -5808(%rbp)
movzbl -3700(%rbp), %edx
andl $15, %esi
movzbl -192(%rbp,%r10), %r10d
andl $15, %edi
movzbl -192(%rbp,%r9), %r9d
andl $15, %edx
salq $8, %rax
movzbl -192(%rbp,%rdi), %edi
movzbl -192(%rbp,%rsi), %esi
orq %r10, %rax
movzbl -192(%rbp,%rcx), %ecx
movzbl -192(%rbp,%rdx), %edx
salq $8, %rax
salq $8, %rdi
movzbl -192(%rbp,%r8), %r8d
orq %r9, %rax
orq %rsi, %rdi
movzbl -192(%rbp,%r12), %r9d
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
orq %rcx, %rdi
movq -5760(%rbp), %rcx
movzbl -192(%rbp,%r13), %r9d
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
orq %rdx, %rdi
movzbl -192(%rbp,%r14), %r9d
movq -5808(%rbp), %r14
salq $8, %rax
salq $8, %rdi
movzbl -192(%rbp,%r14), %edx
orq %r9, %rax
movzbl -192(%rbp,%r15), %r9d
movq -5784(%rbp), %r15
salq $8, %rax
orq %rdx, %rdi
orq %r9, %rax
movzbl -192(%rbp,%r15), %edx
salq $8, %rdi
salq $8, %rax
orq %r8, %rax
orq %rdx, %rdi
movq -5776(%rbp), %rdx
salq $8, %rdi
movzbl -192(%rbp,%rdx), %edx
orq %rdx, %rdi
movzbl -192(%rbp,%rcx), %edx
movq %rax, -5760(%rbp)
salq $8, %rdi
movq %rdi, %rax
movq %r11, %rdi
orq %rdx, %rax
movq %rax, -5752(%rbp)
call __popcountdi2@PLT
movq -5712(%rbp), %rcx
movdqa -5760(%rbp), %xmm6
movq -5696(%rbp), %rsi
cltq
movq -5744(%rbp), %rdi
leaq -8(%rcx,%rbx), %rdx
movups %xmm6, (%rsi,%rbx,4)
subq %rax, %rbx
movups %xmm6, (%rsi,%rdx,4)
movdqa -6032(%rbp), %xmm6
addq $4, %rbx
movdqa %xmm6, %xmm0
movaps %xmm6, -176(%rbp)
pcmpgtd -5728(%rbp), %xmm0
movmskps %xmm0, %r11d
movq %r11, %rax
salq $4, %rax
movdqa (%rdi,%rax), %xmm0
movaps %xmm0, -3776(%rbp)
movzbl -3775(%rbp), %eax
movd %xmm0, %r8d
movaps %xmm0, -3792(%rbp)
andl $15, %r8d
movq %rax, %r15
movzbl -3790(%rbp), %eax
movaps %xmm0, -3888(%rbp)
movzbl -3880(%rbp), %edx
movaps %xmm0, -3808(%rbp)
andl $15, %r15d
movq %rax, %r14
movzbl -3805(%rbp), %eax
andl $15, %edx
movaps %xmm0, -3824(%rbp)
movaps %xmm0, -3904(%rbp)
andl $15, %r14d
movq %rdx, -5760(%rbp)
movq %rax, %r13
movzbl -3895(%rbp), %edx
movzbl -3820(%rbp), %eax
movaps %xmm0, -3872(%rbp)
andl $15, %r13d
movq %rdx, %rcx
movaps %xmm0, -3856(%rbp)
movzbl -3850(%rbp), %r10d
movq %rax, %r12
movzbl -3865(%rbp), %eax
andl $15, %ecx
movaps %xmm0, -3840(%rbp)
movaps %xmm0, -3920(%rbp)
movzbl -3835(%rbp), %r9d
andl $15, %r10d
andl $15, %r12d
movq %rcx, -5776(%rbp)
andl $15, %eax
movzbl -3910(%rbp), %edx
movaps %xmm0, -3936(%rbp)
andl $15, %r9d
movaps %xmm0, -3952(%rbp)
andl $15, %edx
movaps %xmm0, -3968(%rbp)
movzbl -3955(%rbp), %ecx
movaps %xmm0, -3984(%rbp)
movzbl -3970(%rbp), %esi
movaps %xmm0, -4000(%rbp)
movzbl -176(%rbp,%rax), %eax
andl $15, %ecx
movzbl -176(%rbp,%r10), %r10d
movq %rdx, -5784(%rbp)
movzbl -3925(%rbp), %edx
andl $15, %esi
salq $8, %rax
movzbl -176(%rbp,%rsi), %esi
movzbl -176(%rbp,%r9), %r9d
orq %r10, %rax
movq %rdx, %rdi
movzbl -3940(%rbp), %edx
movzbl -176(%rbp,%rcx), %ecx
movzbl -176(%rbp,%r8), %r8d
salq $8, %rax
andl $15, %edi
orq %r9, %rax
movq %rdi, -5808(%rbp)
andl $15, %edx
movzbl -176(%rbp,%r12), %r9d
movzbl -3985(%rbp), %edi
salq $8, %rax
movq -5808(%rbp), %r10
orq %r9, %rax
movzbl -176(%rbp,%rdx), %edx
movzbl -176(%rbp,%r13), %r9d
andl $15, %edi
salq $8, %rax
orq %r9, %rax
movzbl -176(%rbp,%rdi), %edi
movzbl -176(%rbp,%r14), %r9d
salq $8, %rax
movq -5784(%rbp), %r14
orq %r9, %rax
salq $8, %rdi
movzbl -176(%rbp,%r15), %r9d
movq -5776(%rbp), %r15
orq %rsi, %rdi
salq $8, %rax
orq %r9, %rax
salq $8, %rdi
salq $8, %rax
orq %rcx, %rdi
salq $8, %rdi
orq %r8, %rax
orq %rdx, %rdi
movzbl -176(%rbp,%r10), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -176(%rbp,%r14), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -176(%rbp,%r15), %edx
salq $8, %rdi
orq %rdx, %rdi
movq -5760(%rbp), %rdx
salq $8, %rdi
movzbl -176(%rbp,%rdx), %edx
movq %rax, -5760(%rbp)
movq %rdi, %rax
movq %r11, %rdi
orq %rdx, %rax
movq %rax, -5752(%rbp)
call __popcountdi2@PLT
movdqa -6048(%rbp), %xmm7
movq -5712(%rbp), %rcx
movq -5696(%rbp), %rsi
cltq
movdqa -5760(%rbp), %xmm6
movdqa %xmm7, %xmm0
leaq -12(%rcx,%rbx), %rdx
movq -5744(%rbp), %rdi
movaps %xmm7, -160(%rbp)
pcmpgtd -5728(%rbp), %xmm0
movups %xmm6, (%rsi,%rbx,4)
movups %xmm6, (%rsi,%rdx,4)
movl $4, %edx
subq %rax, %rdx
movmskps %xmm0, %r11d
addq %rdx, %rbx
movq %r11, %rax
salq $4, %rax
movdqa (%rdi,%rax), %xmm0
movaps %xmm0, -4016(%rbp)
movzbl -4015(%rbp), %eax
movd %xmm0, %r8d
movaps %xmm0, -4032(%rbp)
andl $15, %r8d
movaps %xmm0, -4128(%rbp)
movq %rax, %r15
movzbl -4120(%rbp), %edx
movzbl -4030(%rbp), %eax
movaps %xmm0, -4048(%rbp)
andl $15, %r15d
andl $15, %edx
movq %rax, %r14
movzbl -4045(%rbp), %eax
movaps %xmm0, -4144(%rbp)
movq %rdx, -5760(%rbp)
movzbl -4135(%rbp), %edx
andl $15, %r14d
movaps %xmm0, -4064(%rbp)
movq %rax, %r13
movzbl -4060(%rbp), %eax
andl $15, %edx
movaps %xmm0, -4080(%rbp)
andl $15, %r13d
movzbl -4075(%rbp), %r9d
movaps %xmm0, -4096(%rbp)
movq %rax, %r12
movzbl -4090(%rbp), %r10d
movaps %xmm0, -4112(%rbp)
movzbl -4105(%rbp), %eax
andl $15, %r12d
andl $15, %r9d
movq %rdx, -5776(%rbp)
andl $15, %r10d
movaps %xmm0, -4160(%rbp)
movzbl -4150(%rbp), %edx
andl $15, %eax
movaps %xmm0, -4176(%rbp)
movq %rdx, %rcx
movzbl -4165(%rbp), %edx
movaps %xmm0, -4240(%rbp)
andl $15, %ecx
movaps %xmm0, -4192(%rbp)
movq %rdx, %rdi
movaps %xmm0, -4208(%rbp)
movzbl -4180(%rbp), %edx
andl $15, %edi
movaps %xmm0, -4224(%rbp)
movzbl -4210(%rbp), %esi
movzbl -160(%rbp,%rax), %eax
movq %rdi, -5808(%rbp)
movzbl -4225(%rbp), %edi
andl $15, %edx
movq %rcx, -5784(%rbp)
movzbl -4195(%rbp), %ecx
andl $15, %esi
movzbl -160(%rbp,%r10), %r10d
andl $15, %edi
movzbl -160(%rbp,%rsi), %esi
movzbl -160(%rbp,%rdi), %edi
andl $15, %ecx
salq $8, %rax
movzbl -160(%rbp,%r9), %r9d
orq %r10, %rax
movq -5808(%rbp), %r10
movzbl -160(%rbp,%rcx), %ecx
salq $8, %rax
salq $8, %rdi
movzbl -160(%rbp,%rdx), %edx
movzbl -160(%rbp,%r8), %r8d
orq %rsi, %rdi
orq %r9, %rax
movzbl -160(%rbp,%r12), %r9d
salq $8, %rax
salq $8, %rdi
orq %rcx, %rdi
orq %r9, %rax
movzbl -160(%rbp,%r13), %r9d
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
orq %rdx, %rdi
movzbl -160(%rbp,%r14), %r9d
movq -5784(%rbp), %r14
movzbl -160(%rbp,%r10), %edx
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
movzbl -160(%rbp,%r15), %r9d
movq -5776(%rbp), %r15
orq %rdx, %rdi
salq $8, %rax
movzbl -160(%rbp,%r14), %edx
salq $8, %rdi
orq %r9, %rax
orq %rdx, %rdi
salq $8, %rax
movzbl -160(%rbp,%r15), %edx
salq $8, %rdi
orq %r8, %rax
orq %rdx, %rdi
movq -5760(%rbp), %rdx
salq $8, %rdi
movzbl -160(%rbp,%rdx), %edx
movq %rax, -5760(%rbp)
movq %rdi, %rax
movq %r11, %rdi
orq %rdx, %rax
movq %rax, -5752(%rbp)
call __popcountdi2@PLT
movq -5712(%rbp), %rcx
movdqa -5760(%rbp), %xmm6
movq -5696(%rbp), %rsi
cltq
movq -5744(%rbp), %rdi
leaq -16(%rcx,%rbx), %rdx
movups %xmm6, (%rsi,%rbx,4)
movups %xmm6, (%rsi,%rdx,4)
movdqa -6064(%rbp), %xmm6
movl $4, %edx
subq %rax, %rdx
movdqa %xmm6, %xmm0
addq %rdx, %rbx
movaps %xmm6, -144(%rbp)
pcmpgtd -5728(%rbp), %xmm0
movmskps %xmm0, %r11d
movq %r11, %rax
salq $4, %rax
movdqa (%rdi,%rax), %xmm0
movaps %xmm0, -4256(%rbp)
movzbl -4255(%rbp), %eax
movd %xmm0, %r8d
movaps %xmm0, -4272(%rbp)
andl $15, %r8d
movq %rax, %r15
movzbl -4270(%rbp), %eax
movaps %xmm0, -4288(%rbp)
movaps %xmm0, -4368(%rbp)
movzbl -4360(%rbp), %edx
andl $15, %r15d
movq %rax, %r14
movzbl -4285(%rbp), %eax
movaps %xmm0, -4304(%rbp)
andl $15, %edx
movaps %xmm0, -4352(%rbp)
andl $15, %r14d
movq %rax, %r13
movzbl -4300(%rbp), %eax
movaps %xmm0, -4384(%rbp)
movq %rdx, -5760(%rbp)
movzbl -4375(%rbp), %edx
andl $15, %r13d
movq %rax, %r12
movzbl -4345(%rbp), %eax
movaps %xmm0, -4336(%rbp)
movzbl -4330(%rbp), %r10d
andl $15, %edx
movaps %xmm0, -4320(%rbp)
andl $15, %r12d
movzbl -4315(%rbp), %r9d
andl $15, %eax
movq %rdx, -5776(%rbp)
andl $15, %r10d
movaps %xmm0, -4400(%rbp)
movzbl -4390(%rbp), %edx
andl $15, %r9d
movaps %xmm0, -4416(%rbp)
movaps %xmm0, -4432(%rbp)
movq %rdx, %rcx
movzbl -4405(%rbp), %edx
movaps %xmm0, -4448(%rbp)
andl $15, %ecx
movaps %xmm0, -4464(%rbp)
movq %rdx, %rdi
movzbl -4450(%rbp), %esi
movzbl -4420(%rbp), %edx
movaps %xmm0, -4480(%rbp)
movzbl -144(%rbp,%rax), %eax
andl $15, %edi
movzbl -144(%rbp,%r10), %r10d
movzbl -144(%rbp,%r9), %r9d
movq %rdi, -5808(%rbp)
andl $15, %esi
andl $15, %edx
salq $8, %rax
movzbl -4465(%rbp), %edi
movq %rcx, -5784(%rbp)
orq %r10, %rax
movzbl -4435(%rbp), %ecx
movzbl -144(%rbp,%rsi), %esi
salq $8, %rax
andl $15, %edi
movq -5808(%rbp), %r10
movzbl -144(%rbp,%rdx), %edx
orq %r9, %rax
andl $15, %ecx
movzbl -144(%rbp,%r12), %r9d
movzbl -144(%rbp,%rdi), %edi
salq $8, %rax
movzbl -144(%rbp,%rcx), %ecx
movzbl -144(%rbp,%r8), %r8d
orq %r9, %rax
salq $8, %rdi
movzbl -144(%rbp,%r13), %r9d
salq $8, %rax
orq %rsi, %rdi
orq %r9, %rax
salq $8, %rdi
movzbl -144(%rbp,%r14), %r9d
movq -5784(%rbp), %r14
salq $8, %rax
orq %r9, %rax
movzbl -144(%rbp,%r15), %r9d
movq -5776(%rbp), %r15
salq $8, %rax
orq %r9, %rax
salq $8, %rax
orq %rcx, %rdi
salq $8, %rdi
orq %r8, %rax
orq %rdx, %rdi
movzbl -144(%rbp,%r10), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -144(%rbp,%r14), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -144(%rbp,%r15), %edx
salq $8, %rdi
orq %rdx, %rdi
movq -5760(%rbp), %rdx
salq $8, %rdi
movzbl -144(%rbp,%rdx), %edx
movq %rax, -5760(%rbp)
movq %rdi, %rax
movq %r11, %rdi
orq %rdx, %rax
movq %rax, -5752(%rbp)
call __popcountdi2@PLT
movdqa -6080(%rbp), %xmm7
movq -5712(%rbp), %rcx
movq -5696(%rbp), %rsi
cltq
movdqa -5760(%rbp), %xmm6
movdqa %xmm7, %xmm0
leaq -20(%rcx,%rbx), %rdx
movq -5744(%rbp), %rdi
movaps %xmm7, -128(%rbp)
pcmpgtd -5728(%rbp), %xmm0
movups %xmm6, (%rsi,%rbx,4)
movups %xmm6, (%rsi,%rdx,4)
movl $4, %edx
subq %rax, %rdx
movmskps %xmm0, %r11d
addq %rdx, %rbx
movq %r11, %rax
salq $4, %rax
movdqa (%rdi,%rax), %xmm0
movaps %xmm0, -4496(%rbp)
movzbl -4495(%rbp), %eax
movd %xmm0, %r8d
movaps %xmm0, -4512(%rbp)
andl $15, %r8d
movaps %xmm0, -4608(%rbp)
movq %rax, %r15
movzbl -4600(%rbp), %edx
movzbl -4510(%rbp), %eax
movaps %xmm0, -4528(%rbp)
andl $15, %r15d
andl $15, %edx
movq %rax, %r14
movzbl -4525(%rbp), %eax
movaps %xmm0, -4624(%rbp)
movq %rdx, -5760(%rbp)
movzbl -4615(%rbp), %edx
andl $15, %r14d
movaps %xmm0, -4544(%rbp)
movq %rax, %r13
movzbl -4540(%rbp), %eax
andl $15, %edx
movaps %xmm0, -4560(%rbp)
andl $15, %r13d
movzbl -4555(%rbp), %r9d
movaps %xmm0, -4576(%rbp)
movq %rax, %r12
movzbl -4570(%rbp), %r10d
movaps %xmm0, -4592(%rbp)
movzbl -4585(%rbp), %eax
andl $15, %r12d
andl $15, %r9d
movq %rdx, -5776(%rbp)
andl $15, %r10d
movaps %xmm0, -4640(%rbp)
movzbl -4630(%rbp), %edx
andl $15, %eax
movaps %xmm0, -4656(%rbp)
movq %rdx, %rcx
movzbl -4645(%rbp), %edx
movaps %xmm0, -4720(%rbp)
andl $15, %ecx
movaps %xmm0, -4672(%rbp)
movq %rdx, %rdi
movaps %xmm0, -4688(%rbp)
movzbl -4660(%rbp), %edx
andl $15, %edi
movaps %xmm0, -4704(%rbp)
movzbl -4690(%rbp), %esi
movzbl -128(%rbp,%rax), %eax
movq %rdi, -5808(%rbp)
movzbl -4705(%rbp), %edi
andl $15, %edx
movq %rcx, -5784(%rbp)
movzbl -4675(%rbp), %ecx
andl $15, %esi
movzbl -128(%rbp,%r10), %r10d
andl $15, %edi
movzbl -128(%rbp,%rsi), %esi
movzbl -128(%rbp,%rdi), %edi
andl $15, %ecx
salq $8, %rax
movzbl -128(%rbp,%r9), %r9d
orq %r10, %rax
movzbl -128(%rbp,%rcx), %ecx
movq -5808(%rbp), %r10
salq $8, %rax
salq $8, %rdi
movzbl -128(%rbp,%rdx), %edx
movzbl -128(%rbp,%r8), %r8d
orq %rsi, %rdi
orq %r9, %rax
movzbl -128(%rbp,%r12), %r9d
salq $8, %rax
salq $8, %rdi
orq %rcx, %rdi
orq %r9, %rax
movzbl -128(%rbp,%r13), %r9d
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
orq %rdx, %rdi
movzbl -128(%rbp,%r14), %r9d
movzbl -128(%rbp,%r10), %edx
movq -5784(%rbp), %r14
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
orq %rdx, %rdi
movzbl -128(%rbp,%r15), %r9d
movq -5776(%rbp), %r15
movzbl -128(%rbp,%r14), %edx
salq $8, %rdi
salq $8, %rax
orq %r9, %rax
orq %rdx, %rdi
movzbl -128(%rbp,%r15), %edx
salq $8, %rax
salq $8, %rdi
orq %r8, %rax
orq %rdx, %rdi
movq -5760(%rbp), %rdx
salq $8, %rdi
movzbl -128(%rbp,%rdx), %edx
movq %rax, -5760(%rbp)
movq %rdi, %rax
movq %r11, %rdi
orq %rdx, %rax
movq %rax, -5752(%rbp)
call __popcountdi2@PLT
movq -5712(%rbp), %rcx
movdqa -5760(%rbp), %xmm6
movq -5696(%rbp), %rsi
cltq
movq -5744(%rbp), %rdi
leaq -24(%rcx,%rbx), %rdx
movups %xmm6, (%rsi,%rbx,4)
movups %xmm6, (%rsi,%rdx,4)
movdqa -6096(%rbp), %xmm6
movl $4, %edx
subq %rax, %rdx
movdqa %xmm6, %xmm0
addq %rdx, %rbx
movaps %xmm6, -112(%rbp)
pcmpgtd -5728(%rbp), %xmm0
movmskps %xmm0, %r11d
movq %r11, %rax
salq $4, %rax
movdqa (%rdi,%rax), %xmm0
movaps %xmm0, -4736(%rbp)
movzbl -4735(%rbp), %eax
movd %xmm0, %r8d
movaps %xmm0, -4752(%rbp)
andl $15, %r8d
movq %rax, %r15
movzbl -4750(%rbp), %eax
movaps %xmm0, -4768(%rbp)
movaps %xmm0, -4848(%rbp)
movzbl -4840(%rbp), %edx
andl $15, %r15d
movq %rax, %r14
movzbl -4765(%rbp), %eax
movaps %xmm0, -4784(%rbp)
andl $15, %edx
movaps %xmm0, -4832(%rbp)
andl $15, %r14d
movq %rax, %r13
movzbl -4780(%rbp), %eax
movaps %xmm0, -4864(%rbp)
movq %rdx, -5760(%rbp)
movzbl -4855(%rbp), %edx
andl $15, %r13d
movq %rax, %r12
movzbl -4825(%rbp), %eax
movaps %xmm0, -4816(%rbp)
movzbl -4810(%rbp), %r10d
andl $15, %edx
movaps %xmm0, -4800(%rbp)
andl $15, %r12d
movzbl -4795(%rbp), %r9d
andl $15, %eax
movq %rdx, -5776(%rbp)
andl $15, %r10d
movaps %xmm0, -4880(%rbp)
movzbl -4870(%rbp), %edx
andl $15, %r9d
movaps %xmm0, -4896(%rbp)
movaps %xmm0, -4912(%rbp)
movq %rdx, %rcx
movzbl -4885(%rbp), %edx
movaps %xmm0, -4928(%rbp)
andl $15, %ecx
movaps %xmm0, -4944(%rbp)
movq %rdx, %rdi
movzbl -4930(%rbp), %esi
movzbl -4900(%rbp), %edx
movaps %xmm0, -4960(%rbp)
movzbl -112(%rbp,%rax), %eax
movzbl -112(%rbp,%r10), %r10d
andl $15, %edi
movzbl -112(%rbp,%r9), %r9d
movq %rdi, -5808(%rbp)
andl $15, %esi
andl $15, %edx
salq $8, %rax
movzbl -112(%rbp,%rsi), %esi
movzbl -112(%rbp,%rdx), %edx
movq %rcx, -5784(%rbp)
orq %r10, %rax
movzbl -4945(%rbp), %edi
movzbl -4915(%rbp), %ecx
salq $8, %rax
movq -5808(%rbp), %r10
movzbl -112(%rbp,%r8), %r8d
orq %r9, %rax
movzbl -112(%rbp,%r12), %r9d
andl $15, %edi
andl $15, %ecx
salq $8, %rax
movzbl -112(%rbp,%rdi), %edi
movzbl -112(%rbp,%rcx), %ecx
orq %r9, %rax
movzbl -112(%rbp,%r13), %r9d
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
movzbl -112(%rbp,%r14), %r9d
orq %rsi, %rdi
movq -5784(%rbp), %r14
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
movzbl -112(%rbp,%r15), %r9d
movq -5776(%rbp), %r15
salq $8, %rax
orq %r9, %rax
salq $8, %rax
orq %rcx, %rdi
salq $8, %rdi
orq %r8, %rax
orq %rdx, %rdi
movzbl -112(%rbp,%r10), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -112(%rbp,%r14), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -112(%rbp,%r15), %edx
salq $8, %rdi
orq %rdx, %rdi
movq -5760(%rbp), %rdx
salq $8, %rdi
movzbl -112(%rbp,%rdx), %edx
movq %rax, -5760(%rbp)
movq %rdi, %rax
movq %r11, %rdi
orq %rdx, %rax
movq %rax, -5752(%rbp)
call __popcountdi2@PLT
movdqa -6112(%rbp), %xmm7
movq -5712(%rbp), %rcx
movq -5696(%rbp), %rsi
cltq
movdqa -5760(%rbp), %xmm6
movdqa %xmm7, %xmm0
leaq -28(%rcx,%rbx), %rdx
movq -5744(%rbp), %rdi
movaps %xmm7, -96(%rbp)
pcmpgtd -5728(%rbp), %xmm0
movups %xmm6, (%rsi,%rbx,4)
movups %xmm6, (%rsi,%rdx,4)
movl $4, %edx
subq %rax, %rdx
movmskps %xmm0, %r11d
addq %rdx, %rbx
movq %r11, %rax
salq $4, %rax
movdqa (%rdi,%rax), %xmm0
movaps %xmm0, -4976(%rbp)
movzbl -4975(%rbp), %eax
movd %xmm0, %r8d
movaps %xmm0, -5088(%rbp)
movzbl -5080(%rbp), %edx
andl $15, %r8d
movaps %xmm0, -4992(%rbp)
movq %rax, %r15
movzbl -4990(%rbp), %eax
movaps %xmm0, -5104(%rbp)
movq %rdx, %rdi
andl $15, %r15d
movzbl -5095(%rbp), %edx
andl $15, %edi
movaps %xmm0, -5008(%rbp)
movq %rax, %r14
movzbl -5005(%rbp), %eax
movq %rdi, -5744(%rbp)
movq %rdx, %rdi
andl $15, %r14d
andl $15, %edi
movaps %xmm0, -5024(%rbp)
movq %rax, %r13
movzbl -5020(%rbp), %r9d
movaps %xmm0, -5040(%rbp)
movzbl -5035(%rbp), %r10d
andl $15, %r13d
movaps %xmm0, -5056(%rbp)
movzbl -5050(%rbp), %r12d
andl $15, %r9d
movaps %xmm0, -5072(%rbp)
movzbl -5065(%rbp), %eax
andl $15, %r10d
movq %rdi, -5760(%rbp)
andl $15, %r12d
movaps %xmm0, -5120(%rbp)
movzbl -5110(%rbp), %edx
andl $15, %eax
movaps %xmm0, -5136(%rbp)
andl $15, %edx
movaps %xmm0, -5200(%rbp)
movq %rdx, -5776(%rbp)
movzbl -5125(%rbp), %edx
movaps %xmm0, -5152(%rbp)
movq %rdx, %rdi
movaps %xmm0, -5168(%rbp)
movzbl -5140(%rbp), %edx
movzbl -5155(%rbp), %ecx
andl $15, %edi
movaps %xmm0, -5184(%rbp)
movzbl -96(%rbp,%rax), %eax
movzbl -5170(%rbp), %esi
movq %rdi, -5784(%rbp)
movzbl -5185(%rbp), %edi
andl $15, %edx
andl $15, %ecx
movzbl -96(%rbp,%r12), %r12d
andl $15, %esi
movzbl -96(%rbp,%rcx), %ecx
andl $15, %edi
salq $8, %rax
movzbl -96(%rbp,%rsi), %esi
movzbl -96(%rbp,%r10), %r10d
movzbl -96(%rbp,%rdi), %edi
orq %r12, %rax
movzbl -96(%rbp,%rdx), %edx
salq $8, %rax
movzbl -96(%rbp,%r9), %r9d
movzbl -96(%rbp,%r8), %r8d
salq $8, %rdi
orq %r10, %rax
movq -5784(%rbp), %r10
orq %rsi, %rdi
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
movzbl -96(%rbp,%r13), %r9d
orq %rcx, %rdi
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
movzbl -96(%rbp,%r14), %r9d
movq -5776(%rbp), %r14
orq %rdx, %rdi
movzbl -96(%rbp,%r10), %edx
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
movzbl -96(%rbp,%r15), %r9d
movq -5760(%rbp), %r15
orq %rdx, %rdi
movzbl -96(%rbp,%r14), %edx
salq $8, %rax
salq $8, %rdi
orq %r9, %rax
orq %rdx, %rdi
movzbl -96(%rbp,%r15), %edx
salq $8, %rax
salq $8, %rdi
orq %r8, %rax
orq %rdx, %rdi
movq -5744(%rbp), %rdx
salq $8, %rdi
movzbl -96(%rbp,%rdx), %edx
movq %rax, -5744(%rbp)
orq %rdx, %rdi
movq %rdi, -5736(%rbp)
movq %r11, %rdi
call __popcountdi2@PLT
movq -5712(%rbp), %rcx
movq -5696(%rbp), %rsi
movdqa -5744(%rbp), %xmm5
cltq
leaq -32(%rcx,%rbx), %rdx
movq %rsi, %rcx
movups %xmm5, (%rsi,%rbx,4)
movups %xmm5, (%rsi,%rdx,4)
movl $4, %edx
subq %rax, %rdx
leaq (%rdx,%rbx), %rax
movq -5968(%rbp), %rdx
movq %rax, -5712(%rbp)
leaq 0(,%rax,4), %rbx
subq %rax, %rdx
.L579:
movq -5968(%rbp), %rsi
movdqa -5936(%rbp), %xmm2
cmpq $4, %rdx
pcmpeqd %xmm0, %xmm0
pcmpgtd -5728(%rbp), %xmm2
leaq -16(,%rsi,4), %rax
cmovnb %rbx, %rax
pxor %xmm2, %xmm0
movdqu (%rcx,%rax), %xmm7
movaps %xmm2, -5808(%rbp)
movmskps %xmm0, %r12d
movups %xmm7, (%rcx,%rsi,4)
movq %r12, %rdi
salq $4, %r12
movaps %xmm7, -5744(%rbp)
call __popcountdi2@PLT
movdqa -5936(%rbp), %xmm7
movslq %eax, %rsi
movl %esi, -5760(%rbp)
movq %rsi, -5744(%rbp)
movq -5888(%rbp), %rsi
movaps %xmm7, -80(%rbp)
movdqa (%rsi,%r12), %xmm0
movaps %xmm0, -5216(%rbp)
movzbl -5215(%rbp), %eax
movd %xmm0, %r8d
movaps %xmm0, -5232(%rbp)
andl $15, %r8d
movaps %xmm0, -5328(%rbp)
movq %rax, %r14
movzbl -5320(%rbp), %edx
movzbl -5230(%rbp), %eax
movaps %xmm0, -5312(%rbp)
andl $15, %r14d
movaps %xmm0, -5344(%rbp)
movq %rax, %r13
movq %rdx, %rsi
movzbl -5305(%rbp), %eax
movzbl -5335(%rbp), %edx
andl $15, %esi
movaps %xmm0, -5296(%rbp)
movzbl -5290(%rbp), %r12d
andl $15, %eax
movaps %xmm0, -5248(%rbp)
movzbl -5245(%rbp), %r9d
andl $15, %r13d
andl $15, %edx
movaps %xmm0, -5264(%rbp)
andl $15, %r12d
movzbl -5260(%rbp), %r10d
movaps %xmm0, -5280(%rbp)
movzbl -5275(%rbp), %r11d
andl $15, %r9d
movq %rsi, -5728(%rbp)
andl $15, %r10d
movaps %xmm0, -5360(%rbp)
andl $15, %r11d
movq %rdx, -5776(%rbp)
movzbl -5350(%rbp), %edx
movaps %xmm0, -5376(%rbp)
movaps %xmm0, -5392(%rbp)
movq %rdx, %r15
movzbl -5365(%rbp), %edx
movaps %xmm0, -5408(%rbp)
andl $15, %r15d
movaps %xmm0, -5424(%rbp)
movq %rdx, %rcx
movzbl -5410(%rbp), %esi
movzbl -5380(%rbp), %edx
movaps %xmm0, -5440(%rbp)
movzbl -80(%rbp,%rax), %eax
andl $15, %ecx
movzbl -80(%rbp,%r12), %r12d
movzbl -80(%rbp,%r11), %r11d
movzbl -80(%rbp,%r10), %r10d
movq %r15, -5784(%rbp)
andl $15, %esi
salq $8, %rax
movzbl -80(%rbp,%r9), %r9d
movq %rcx, %r15
andl $15, %edx
orq %r12, %rax
movzbl -80(%rbp,%rsi), %esi
movzbl -80(%rbp,%rdx), %edx
salq $8, %rax
movzbl -5425(%rbp), %edi
movzbl -5395(%rbp), %ecx
orq %r11, %rax
movzbl -80(%rbp,%r8), %r8d
salq $8, %rax
andl $15, %edi
andl $15, %ecx
orq %r10, %rax
movzbl -80(%rbp,%rdi), %edi
movzbl -80(%rbp,%rcx), %ecx
salq $8, %rax
orq %r9, %rax
movzbl -80(%rbp,%r13), %r9d
salq $8, %rdi
salq $8, %rax
orq %r9, %rax
movzbl -80(%rbp,%r14), %r9d
salq $8, %rax
orq %r9, %rax
salq $8, %rax
orq %rsi, %rdi
movq -5728(%rbp), %rsi
salq $8, %rdi
orq %rcx, %rdi
salq $8, %rdi
orq %rdx, %rdi
movzbl -80(%rbp,%r15), %edx
movq -5784(%rbp), %r15
salq $8, %rdi
orq %rdx, %rdi
movzbl -80(%rbp,%r15), %edx
salq $8, %rdi
orq %rdx, %rdi
movq -5776(%rbp), %rdx
salq $8, %rdi
movzbl -80(%rbp,%rdx), %edx
orq %rdx, %rdi
movzbl -80(%rbp,%rsi), %edx
movq %rax, %rsi
orq %r8, %rsi
salq $8, %rdi
movq %rsi, -5728(%rbp)
movd -5760(%rbp), %xmm6
movq %rdi, %rsi
orq %rdx, %rsi
movdqa -5808(%rbp), %xmm2
pshufd $0, %xmm6, %xmm0
movq %rsi, -5720(%rbp)
pcmpgtd -5920(%rbp), %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L585
movq -5696(%rbp), %rax
movdqa -5728(%rbp), %xmm6
movd %xmm6, (%rax,%rbx)
.L585:
pshufd $85, %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L586
pshufd $85, -5728(%rbp), %xmm1
movq -5696(%rbp), %rax
movd %xmm1, 4(%rax,%rbx)
.L586:
movdqa %xmm0, %xmm1
punpckhdq %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L587
movdqa -5728(%rbp), %xmm1
movq -5696(%rbp), %rax
punpckhdq %xmm1, %xmm1
movd %xmm1, 8(%rax,%rbx)
.L587:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L588
pshufd $255, -5728(%rbp), %xmm0
movq -5696(%rbp), %rax
movd %xmm0, 12(%rax,%rbx)
.L588:
movmskps %xmm2, %r13d
movq -5712(%rbp), %rbx
addq -5744(%rbp), %rbx
movq %r13, %rdi
salq $4, %r13
leaq 0(,%rbx,4), %r12
call __popcountdi2@PLT
movq -5888(%rbp), %rsi
movdqa -5936(%rbp), %xmm7
movl %eax, -5776(%rbp)
movdqa (%rsi,%r13), %xmm0
movaps %xmm7, -64(%rbp)
movaps %xmm0, -5456(%rbp)
movzbl -5455(%rbp), %eax
movd %xmm0, %r8d
movaps %xmm0, -5568(%rbp)
movzbl -5560(%rbp), %edx
andl $15, %r8d
movaps %xmm0, -5472(%rbp)
movq %rax, %r15
movzbl -5470(%rbp), %eax
movaps %xmm0, -5584(%rbp)
movq %rdx, %rcx
andl $15, %r15d
movzbl -5575(%rbp), %edx
movaps %xmm0, -5552(%rbp)
movq %rax, %r14
andl $15, %ecx
movzbl -5545(%rbp), %eax
movaps %xmm0, -5600(%rbp)
movq %rdx, %rdi
andl $15, %r14d
movzbl -5590(%rbp), %edx
movaps %xmm0, -5536(%rbp)
andl $15, %edi
andl $15, %eax
movzbl -5530(%rbp), %r13d
andl $15, %edx
movaps %xmm0, -5488(%rbp)
movzbl -5485(%rbp), %r9d
movaps %xmm0, -5504(%rbp)
andl $15, %r13d
movzbl -5500(%rbp), %r10d
movaps %xmm0, -5520(%rbp)
movzbl -5515(%rbp), %r11d
andl $15, %r9d
movq %rcx, -5712(%rbp)
andl $15, %r10d
movq %rdi, -5728(%rbp)
andl $15, %r11d
movaps %xmm0, -5616(%rbp)
movq %rdx, -5744(%rbp)
movzbl -5605(%rbp), %edx
movaps %xmm0, -5632(%rbp)
movaps %xmm0, -5648(%rbp)
movq %rdx, %rdi
movzbl -5635(%rbp), %ecx
movzbl -5620(%rbp), %edx
movaps %xmm0, -5664(%rbp)
andl $15, %edi
movzbl -5650(%rbp), %esi
movaps %xmm0, -5680(%rbp)
movzbl -64(%rbp,%rax), %eax
movzbl -64(%rbp,%r13), %r13d
andl $15, %edx
movzbl -64(%rbp,%r11), %r11d
movzbl -64(%rbp,%r10), %r10d
andl $15, %esi
andl $15, %ecx
salq $8, %rax
movzbl -64(%rbp,%r9), %r9d
movzbl -64(%rbp,%rsi), %esi
movq %rdi, -5760(%rbp)
orq %r13, %rax
movzbl -64(%rbp,%rcx), %ecx
movzbl -64(%rbp,%rdx), %edx
salq $8, %rax
movzbl -5665(%rbp), %edi
movzbl -64(%rbp,%r8), %r8d
orq %r11, %rax
salq $8, %rax
andl $15, %edi
orq %r10, %rax
movzbl -64(%rbp,%rdi), %edi
salq $8, %rax
orq %r9, %rax
movzbl -64(%rbp,%r14), %r9d
salq $8, %rax
orq %r9, %rax
movzbl -64(%rbp,%r15), %r9d
movq -5760(%rbp), %r15
salq $8, %rax
orq %r9, %rax
salq $8, %rax
salq $8, %rdi
orq %rsi, %rdi
movq -5728(%rbp), %rsi
orq %r8, %rax
salq $8, %rdi
orq %rcx, %rdi
movq -5712(%rbp), %rcx
movq %rax, -5712(%rbp)
salq $8, %rdi
orq %rdx, %rdi
movzbl -64(%rbp,%r15), %edx
salq $8, %rdi
orq %rdx, %rdi
movq -5744(%rbp), %rdx
salq $8, %rdi
movzbl -64(%rbp,%rdx), %edx
orq %rdx, %rdi
movzbl -64(%rbp,%rsi), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -64(%rbp,%rcx), %edx
salq $8, %rdi
orq %rdx, %rdi
movq %rdi, -5704(%rbp)
movd -5776(%rbp), %xmm6
pshufd $0, %xmm6, %xmm0
pcmpgtd -5920(%rbp), %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L589
movq -5696(%rbp), %rax
movdqa -5712(%rbp), %xmm7
movd %xmm7, (%rax,%rbx,4)
.L589:
pshufd $85, %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L590
pshufd $85, -5712(%rbp), %xmm1
movq -5696(%rbp), %rax
movd %xmm1, 4(%rax,%r12)
.L590:
movdqa %xmm0, %xmm1
punpckhdq %xmm0, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L591
movdqa -5712(%rbp), %xmm1
movq -5696(%rbp), %rax
punpckhdq %xmm1, %xmm1
movd %xmm1, 8(%rax,%r12)
.L591:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L592
pshufd $255, -5712(%rbp), %xmm0
movq -5696(%rbp), %rax
movd %xmm0, 12(%rax,%r12)
.L592:
movq -5944(%rbp), %r12
addq -5976(%rbp), %rbx
subq $1, %r12
cmpl $2, -5948(%rbp)
je .L594
movq -5904(%rbp), %r8
movq %r12, %r9
movq %rbx, %rdx
movq -5880(%rbp), %rcx
movq -5960(%rbp), %rsi
movq -5768(%rbp), %rdi
call _ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -5948(%rbp)
je .L483
.L594:
movq -5896(%rbp), %rdx
movq -5768(%rbp), %rax
movq %r12, %r9
movq -5904(%rbp), %r8
movq -5880(%rbp), %rcx
movq -5960(%rbp), %rsi
subq %rbx, %rdx
leaq (%rax,%rbx,4), %rdi
call _ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L483:
addq $6072, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L575:
.cfi_restore_state
movq -5880(%rbp), %r15
leaq 8(%rax), %rdi
andq $-8, %rdi
movq (%r15), %rcx
movq %rcx, (%rax)
movl %ebx, %ecx
movq -8(%r15,%rcx), %rsi
movq %rsi, -8(%rax,%rcx)
subq %rdi, %rax
movq %r15, %rsi
leal (%rbx,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
jmp .L576
.p2align 4,,10
.p2align 3
.L571:
movq -5696(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, (%rdi)
movl %ebx, %ecx
movq -8(%rax,%rcx), %rsi
movq %rsi, -8(%rdi,%rcx)
movq %rdi, %rcx
leaq 8(%rdi), %rdi
movq %rax, %rsi
andq $-8, %rdi
subq %rdi, %rcx
subq %rcx, %rsi
addl %ebx, %ecx
shrl $3, %ecx
rep movsq
jmp .L572
.L771:
movq -5880(%rbp), %rax
movl (%rax), %ecx
jmp .L545
.L776:
movq -5880(%rbp), %rbx
movzbl (%rbx), %esi
movb %sil, (%rax)
testb $2, %cl
je .L576
movq -5880(%rbp), %rbx
movzwl -2(%rbx,%rcx), %esi
movw %si, -2(%rax,%rcx)
jmp .L576
.L774:
movzbl (%rax), %esi
movq -5696(%rbp), %rdi
movb %sil, (%rdi)
testb $2, %cl
je .L572
movzwl -2(%rax,%rcx), %esi
movq -5696(%rbp), %rdi
movw %si, -2(%rdi,%rcx)
jmp .L572
.L769:
cmpq $1, %rdx
jbe .L483
movq %rdi, %rax
addq $256, %rax
cmpq %rax, %rsi
jb .L779
movl $4, %esi
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L483
.L499:
movq -5768(%rbp), %rax
andl $3, %r13d
movl $4, %edi
movdqa .LC0(%rip), %xmm7
subq %r13, %rdi
movdqu (%rax), %xmm6
movaps %xmm7, -5920(%rbp)
movaps %xmm6, -5696(%rbp)
movd %edi, %xmm6
movdqa -5696(%rbp), %xmm1
pshufd $0, %xmm6, %xmm3
pcmpeqd %xmm0, %xmm1
pcmpgtd %xmm7, %xmm3
pandn %xmm3, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L780
movq -5768(%rbp), %rax
pxor %xmm3, %xmm3
movq -5896(%rbp), %r8
pxor %xmm5, %xmm5
movdqa %xmm3, %xmm1
leaq 256(%rax,%rdi,4), %rsi
.p2align 4,,10
.p2align 3
.L505:
movq %rdi, %rcx
leaq 64(%rdi), %rdi
cmpq %rdi, %r8
jb .L781
leaq -256(%rsi), %rax
.L504:
movdqa (%rax), %xmm4
leaq 32(%rax), %rdx
pxor %xmm2, %xmm4
por %xmm4, %xmm1
movdqa 16(%rax), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm3
movdqa 32(%rax), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm1
movdqa 48(%rax), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm3
movdqa 64(%rax), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm1
movdqa 80(%rax), %xmm4
leaq 96(%rdx), %rax
pxor %xmm2, %xmm4
por %xmm4, %xmm3
movdqa 64(%rdx), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm1
movdqa 80(%rdx), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm3
cmpq %rsi, %rax
jne .L504
movdqa %xmm1, %xmm4
leaq 352(%rdx), %rsi
por %xmm3, %xmm4
pcmpeqd %xmm5, %xmm4
movmskps %xmm4, %eax
cmpl $15, %eax
je .L505
movq -5768(%rbp), %rax
movdqa %xmm0, %xmm1
pcmpeqd %xmm2, %xmm2
movq -5768(%rbp), %rdx
pcmpeqd (%rax,%rcx,4), %xmm1
pxor %xmm2, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L507
.p2align 4,,10
.p2align 3
.L506:
addq $4, %rcx
movdqa %xmm0, %xmm1
pcmpeqd (%rdx,%rcx,4), %xmm1
pxor %xmm2, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
je .L506
.L507:
rep bsfl %eax, %eax
cltq
addq %rcx, %rax
.L503:
movq -5768(%rbp), %rcx
leaq (%rcx,%rax,4), %rdi
movl (%rdi), %r12d
movd %r12d, %xmm7
pshufd $0, %xmm7, %xmm2
movdqa %xmm2, %xmm1
movaps %xmm2, -5696(%rbp)
pcmpgtd %xmm0, %xmm1
movmskps %xmm1, %edx
testl %edx, %edx
jne .L512
movq -5896(%rbp), %r15
movl %r12d, -5760(%rbp)
xorl %ebx, %ebx
movq %rcx, %r12
movaps %xmm0, -5744(%rbp)
leaq -4(%r15), %r13
movaps %xmm0, -5712(%rbp)
movaps %xmm2, -5728(%rbp)
jmp .L521
.p2align 4,,10
.p2align 3
.L513:
movdqa -5744(%rbp), %xmm5
movmskps %xmm1, %edi
movups %xmm5, (%r12,%r13,4)
call __popcountdi2@PLT
cltq
addq %rax, %rbx
leaq -4(%r13), %rax
cmpq %rax, %r15
jbe .L782
movq %rax, %r13
.L521:
movdqu (%r12,%r13,4), %xmm1
movdqu (%r12,%r13,4), %xmm4
pcmpeqd -5712(%rbp), %xmm1
pcmpeqd -5728(%rbp), %xmm4
movdqa %xmm1, %xmm5
movdqa %xmm1, %xmm6
por %xmm4, %xmm5
movmskps %xmm5, %eax
cmpl $15, %eax
je .L513
pcmpeqd %xmm1, %xmm1
movq -5768(%rbp), %rsi
movq -5896(%rbp), %rdx
leaq 4(%r13), %rcx
pxor %xmm1, %xmm6
movdqa -5744(%rbp), %xmm3
movdqa -5712(%rbp), %xmm0
pandn %xmm6, %xmm4
subq %rbx, %rdx
movl -5760(%rbp), %r12d
movdqa -5728(%rbp), %xmm2
movmskps %xmm4, %eax
rep bsfl %eax, %eax
cltq
addq %r13, %rax
movd (%rsi,%rax,4), %xmm7
leaq 8(%r13), %rax
pshufd $0, %xmm7, %xmm1
movdqa %xmm1, %xmm4
movaps %xmm1, -64(%rbp)
cmpq %rax, %rdx
jb .L514
.L515:
movdqa -5696(%rbp), %xmm6
movq %rax, %rcx
movups %xmm6, -16(%rsi,%rax,4)
addq $4, %rax
cmpq %rax, %rdx
jnb .L515
.L514:
subq %rcx, %rdx
leaq 0(,%rcx,4), %rsi
movq %rdx, %xmm1
pshufd $0, %xmm1, %xmm1
pcmpgtd -5920(%rbp), %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L516
movq -5768(%rbp), %rax
movl %r12d, (%rax,%rcx,4)
.L516:
pshufd $85, %xmm1, %xmm5
movd %xmm5, %eax
testl %eax, %eax
je .L517
movq -5768(%rbp), %rax
pshufd $85, %xmm2, %xmm5
movd %xmm5, 4(%rax,%rsi)
.L517:
movdqa %xmm1, %xmm5
punpckhdq %xmm1, %xmm5
movd %xmm5, %eax
testl %eax, %eax
je .L518
movq -5768(%rbp), %rax
movdqa %xmm2, %xmm5
punpckhdq %xmm2, %xmm5
movd %xmm5, 8(%rax,%rsi)
.L518:
pshufd $255, %xmm1, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L520
movq -5768(%rbp), %rax
pshufd $255, %xmm2, %xmm1
movd %xmm1, 12(%rax,%rsi)
.L520:
movdqa %xmm0, %xmm1
pcmpeqd .LC5(%rip), %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
je .L612
movdqa %xmm0, %xmm1
pcmpeqd .LC6(%rip), %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
je .L538
movdqa %xmm4, %xmm1
pcmpgtd %xmm2, %xmm1
movdqa %xmm1, %xmm6
movdqa %xmm1, %xmm5
pandn %xmm4, %xmm6
pand %xmm2, %xmm5
por %xmm6, %xmm5
movdqa %xmm0, %xmm6
pcmpgtd %xmm5, %xmm6
movmskps %xmm6, %eax
testl %eax, %eax
jne .L783
movdqa %xmm3, %xmm1
movl $64, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L533:
movq -5768(%rbp), %rbx
leaq (%rcx,%rax,4), %rdx
addq $1, %rax
movdqu (%rbx,%rdx,4), %xmm4
movdqa %xmm4, %xmm2
pcmpgtd %xmm1, %xmm2
movdqa %xmm2, %xmm5
pand %xmm2, %xmm1
pandn %xmm4, %xmm5
por %xmm5, %xmm1
cmpq $16, %rax
jne .L533
movdqa %xmm0, %xmm2
pcmpgtd %xmm1, %xmm2
movmskps %xmm2, %eax
testl %eax, %eax
jne .L768
leaq 64(%rsi), %rax
cmpq %rax, -5896(%rbp)
jb .L784
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L533
.L615:
leaq _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rdi
movq %rsi, -5696(%rbp)
xorl %ebx, %ebx
movdqa .LC0(%rip), %xmm5
movq $0, -5712(%rbp)
movq %rdi, -5888(%rbp)
movaps %xmm5, -5920(%rbp)
jmp .L552
.L616:
movq -5968(%rbp), %rdx
movq -5696(%rbp), %rcx
xorl %ebx, %ebx
jmp .L579
.L617:
leaq _ZZN3hwy6N_SSE26detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rax
movq -5696(%rbp), %r14
movq %rdi, %r13
movl $4, %ebx
movq %rax, -5744(%rbp)
jmp .L580
.L772:
movq -5896(%rbp), %rsi
movq -5768(%rbp), %rdi
leaq -1(%rsi), %rbx
movq %rbx, %r12
shrq %r12
.p2align 4,,10
.p2align 3
.L550:
movq %r12, %rdx
call _ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %r12
jnb .L550
.p2align 4,,10
.p2align 3
.L551:
movl (%rdi,%rbx,4), %edx
movl (%rdi), %eax
movq %rbx, %rsi
movl %edx, (%rdi)
xorl %edx, %edx
movl %eax, (%rdi,%rbx,4)
call _ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L551
jmp .L483
.L775:
movq -5880(%rbp), %rbx
movl (%rbx), %esi
movl %esi, (%rax)
movl -4(%rbx,%rcx), %esi
movl %esi, -4(%rax,%rcx)
jmp .L576
.L773:
movl (%rax), %esi
movq -5696(%rbp), %rdi
movl %esi, (%rdi)
movl -4(%rax,%rcx), %esi
movl %esi, -4(%rdi,%rcx)
jmp .L572
.L781:
movq -5768(%rbp), %rsi
movq -5896(%rbp), %rdi
pcmpeqd %xmm2, %xmm2
.L509:
movq %rcx, %rdx
addq $4, %rcx
cmpq %rcx, %rdi
jb .L785
movdqa %xmm0, %xmm1
pcmpeqd -16(%rsi,%rcx,4), %xmm1
pxor %xmm2, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
je .L509
.L766:
rep bsfl %eax, %eax
cltq
addq %rdx, %rax
jmp .L503
.L512:
movq -5896(%rbp), %rsi
movq -5880(%rbp), %rbx
leaq -64(%rbp), %rdx
movdqa %xmm2, %xmm1
movaps %xmm2, -5696(%rbp)
subq %rax, %rsi
movq %rbx, %rcx
call _ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L483
movd (%rbx), %xmm7
movdqa -64(%rbp), %xmm4
movdqa -5696(%rbp), %xmm2
pshufd $0, %xmm7, %xmm0
movdqa %xmm0, %xmm3
jmp .L520
.L782:
movq -5768(%rbp), %rax
movdqa -5712(%rbp), %xmm0
movdqa -5728(%rbp), %xmm2
movq -5896(%rbp), %r15
movdqu (%rax), %xmm7
movdqa -5744(%rbp), %xmm3
movl -5760(%rbp), %r12d
subq %rbx, %r15
movaps %xmm7, -5712(%rbp)
movd %r13d, %xmm7
movdqa -5712(%rbp), %xmm1
movdqa -5712(%rbp), %xmm5
pshufd $0, %xmm7, %xmm4
pcmpgtd -5920(%rbp), %xmm4
pcmpeqd %xmm0, %xmm1
pcmpeqd %xmm2, %xmm5
movdqa %xmm4, %xmm6
pand %xmm1, %xmm6
por %xmm5, %xmm1
pcmpeqd %xmm5, %xmm5
pxor %xmm5, %xmm4
por %xmm4, %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
jne .L786
movmskps %xmm6, %edi
movaps %xmm2, -5728(%rbp)
movaps %xmm3, -5712(%rbp)
call __popcountdi2@PLT
movq -5768(%rbp), %rbx
movdqa -5712(%rbp), %xmm3
movslq %eax, %rdx
movq %r15, %rax
movdqa -5728(%rbp), %xmm2
subq %rdx, %rax
movups %xmm3, (%rbx)
cmpq $3, %rax
jbe .L601
leaq -4(%rax), %rdx
movq %rdx, %rcx
shrq $2, %rcx
salq $4, %rcx
leaq 16(%rbx,%rcx), %rcx
.L530:
movdqa -5696(%rbp), %xmm6
addq $16, %r14
movups %xmm6, -16(%r14)
cmpq %rcx, %r14
jne .L530
andq $-4, %rdx
addq $4, %rdx
leaq 0(,%rdx,4), %rcx
subq %rdx, %rax
.L529:
movq -5880(%rbp), %rsi
movaps %xmm2, (%rsi)
testq %rax, %rax
je .L483
movq -5768(%rbp), %rdi
leaq 0(,%rax,4), %rdx
addq %rcx, %rdi
call memcpy@PLT
jmp .L483
.L784:
movq -5896(%rbp), %rcx
movq %rbx, %rdx
jmp .L540
.L541:
movdqu -16(%rdx,%rsi,4), %xmm5
movdqa %xmm0, %xmm1
pcmpgtd %xmm5, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L768
.L540:
movq %rsi, %rax
addq $4, %rsi
cmpq %rsi, %rcx
jnb .L541
movq -5896(%rbp), %rbx
cmpq %rax, %rbx
je .L612
movq -5768(%rbp), %rax
movdqu -16(%rax,%rbx,4), %xmm7
movaps %xmm7, -5696(%rbp)
pcmpgtd -5696(%rbp), %xmm0
movmskps %xmm0, %eax
cmpl $1, %eax
movl $1, %eax
adcl $0, %eax
movl %eax, -5948(%rbp)
jmp .L542
.L785:
movq -5896(%rbp), %rax
pcmpeqd %xmm2, %xmm2
leaq -4(%rax), %rdx
movq -5768(%rbp), %rax
movdqu (%rax,%rdx,4), %xmm7
movaps %xmm7, -5696(%rbp)
movdqa -5696(%rbp), %xmm1
pcmpeqd %xmm0, %xmm1
pxor %xmm2, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
je .L483
jmp .L766
.L788:
movq %rbx, %rdx
jmp .L536
.L537:
movdqu -16(%rdx,%rsi,4), %xmm1
pcmpgtd %xmm0, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L768
.L536:
movq %rsi, %rax
addq $4, %rsi
cmpq %rsi, -5896(%rbp)
jnb .L537
movq -5896(%rbp), %rbx
cmpq %rax, %rbx
je .L538
movq -5768(%rbp), %rax
movdqu -16(%rax,%rbx,4), %xmm6
movaps %xmm6, -5696(%rbp)
movdqa -5696(%rbp), %xmm1
pcmpgtd %xmm0, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L768
.L538:
movl $3, -5948(%rbp)
pcmpeqd %xmm3, %xmm3
paddd %xmm0, %xmm3
jmp .L542
.L612:
movl $2, -5948(%rbp)
jmp .L542
.L780:
rep bsfl %eax, %eax
cltq
jmp .L503
.L779:
cmpq $3, %rdx
jbe .L787
movq %rdx, %r14
leaq -4(%rdx), %rdx
movq %rcx, %rbx
movq (%rdi), %rcx
movq %rdx, %rax
movq %rdi, %r15
shrq $2, %rax
movq %rcx, (%rbx)
addq $1, %rax
salq $4, %rax
movl %eax, %ecx
movq -8(%rdi,%rcx), %rsi
leaq 8(%rbx), %rdi
andq $-8, %rdi
movq %rsi, -8(%rbx,%rcx)
subq %rdi, %rbx
movq %r15, %rsi
movq %rbx, %rcx
subq %rbx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-4, %rax
shrl $3, %ecx
rep movsq
addq $4, %rax
movq %r14, %rcx
subq %rax, %rcx
je .L492
.L489:
movq -5880(%rbp), %rbx
salq $2, %rax
leaq 0(,%rcx,4), %rdx
testq %rcx, %rcx
movl $4, %ecx
leaq (%rbx,%rax), %rdi
movq -5768(%rbp), %rbx
cmove %rcx, %rdx
leaq (%rbx,%rax), %rsi
call memcpy@PLT
.L492:
movq -5896(%rbp), %rbx
movl $32, %ecx
movl %ebx, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $4, %rdx
cmpq %rdx, %rbx
jnb .L491
movdqa .LC4(%rip), %xmm0
movq -5880(%rbp), %rcx
movq %rbx, %rax
.L490:
movups %xmm0, (%rcx,%rax,4)
addq $4, %rax
cmpq %rdx, %rax
jb .L490
.L491:
movq -5880(%rbp), %rdi
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
xorl %eax, %eax
cmpq $3, -5896(%rbp)
jbe .L494
movq -5896(%rbp), %r14
movq -5880(%rbp), %r15
movq -5768(%rbp), %rbx
leaq -4(%r14), %rdx
movq (%r15), %rcx
movq %rdx, %rax
leaq 8(%rbx), %rdi
shrq $2, %rax
movq %rcx, (%rbx)
andq $-8, %rdi
addq $1, %rax
salq $4, %rax
movl %eax, %ecx
movq -8(%r15,%rcx), %rsi
movq %rsi, -8(%rbx,%rcx)
subq %rdi, %rbx
movq %r15, %rsi
movq %rbx, %rcx
subq %rbx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-4, %rax
shrl $3, %ecx
rep movsq
addq $4, %rax
subq %rax, %r14
movq %r14, -5896(%rbp)
je .L483
.L494:
movq -5896(%rbp), %rbx
salq $2, %rax
movq -5768(%rbp), %rdi
movl $4, %ecx
movq -5880(%rbp), %rsi
addq %rax, %rdi
leaq 0(,%rbx,4), %rdx
testq %rbx, %rbx
cmove %rcx, %rdx
addq %rax, %rsi
call memcpy@PLT
jmp .L483
.L783:
movdqa %xmm1, %xmm5
pand %xmm4, %xmm1
pandn %xmm2, %xmm5
por %xmm5, %xmm1
pcmpgtd %xmm0, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L768
movdqa %xmm3, %xmm1
movl $64, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L534:
movq -5768(%rbp), %rbx
leaq (%rcx,%rax,4), %rdx
addq $1, %rax
movdqu (%rbx,%rdx,4), %xmm2
movdqa %xmm2, %xmm4
pcmpgtd %xmm1, %xmm4
movdqa %xmm4, %xmm5
pand %xmm4, %xmm2
pandn %xmm1, %xmm5
movdqa %xmm2, %xmm1
por %xmm5, %xmm1
cmpq $16, %rax
jne .L534
movdqa %xmm1, %xmm2
pcmpgtd %xmm0, %xmm2
movmskps %xmm2, %eax
testl %eax, %eax
jne .L768
leaq 64(%rsi), %rax
cmpq %rax, -5896(%rbp)
jb .L788
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L534
.L601:
xorl %ecx, %ecx
jmp .L529
.L786:
pxor %xmm5, %xmm1
movq -5768(%rbp), %rbx
movmskps %xmm1, %eax
rep bsfl %eax, %eax
cltq
movd (%rbx,%rax,4), %xmm6
leaq 4(%r13), %rax
pshufd $0, %xmm6, %xmm1
movdqa %xmm1, %xmm4
movaps %xmm1, -64(%rbp)
cmpq %r15, %rax
ja .L523
.L524:
movq -5768(%rbp), %rbx
movdqa -5696(%rbp), %xmm7
movq %rax, %r13
movups %xmm7, -16(%rbx,%rax,4)
addq $4, %rax
cmpq %r15, %rax
jbe .L524
.L523:
subq %r13, %r15
leaq 0(,%r13,4), %rdx
movq %r15, %xmm1
pshufd $0, %xmm1, %xmm1
pcmpgtd -5920(%rbp), %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L525
movq -5768(%rbp), %rax
movl %r12d, (%rax,%r13,4)
.L525:
pshufd $85, %xmm1, %xmm5
movd %xmm5, %eax
testl %eax, %eax
je .L526
movq -5768(%rbp), %rax
pshufd $85, %xmm2, %xmm5
movd %xmm5, 4(%rax,%rdx)
.L526:
movdqa %xmm1, %xmm5
punpckhdq %xmm1, %xmm5
movd %xmm5, %eax
testl %eax, %eax
je .L527
movq -5768(%rbp), %rax
movdqa %xmm2, %xmm5
punpckhdq %xmm2, %xmm5
movd %xmm5, 8(%rax,%rdx)
.L527:
pshufd $255, %xmm1, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L520
movq -5768(%rbp), %rax
pshufd $255, %xmm2, %xmm1
movd %xmm1, 12(%rax,%rdx)
jmp .L520
.L787:
movq %rdx, %rcx
xorl %eax, %eax
jmp .L489
.cfi_endproc
.LFE18798:
.size _ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18800:
.cfi_startproc
leaq 8(%rsp), %r10
.cfi_def_cfa 10, 0
andq $-64, %rsp
pushq -8(%r10)
pushq %rbp
movq %rsp, %rbp
.cfi_escape 0x10,0x6,0x2,0x76,0
pushq %r15
.cfi_escape 0x10,0xf,0x2,0x76,0x78
movq %rdx, %r15
pushq %r14
pushq %r13
.cfi_escape 0x10,0xe,0x2,0x76,0x70
.cfi_escape 0x10,0xd,0x2,0x76,0x68
movq %rdi, %r13
pushq %r12
.cfi_escape 0x10,0xc,0x2,0x76,0x60
movq %rcx, %r12
pushq %r10
.cfi_escape 0xf,0x3,0x76,0x58,0x6
pushq %rbx
addq $-128, %rsp
.cfi_escape 0x10,0x3,0x2,0x76,0x50
movq %rsi, -128(%rbp)
movq %r9, -120(%rbp)
cmpq $256, %rdx
jbe .L956
movq %rdi, %r11
movq %rdi, -152(%rbp)
movq %r8, %rbx
shrq $2, %r11
movq %r11, %rdi
andl $15, %edi
movq %rdi, -144(%rbp)
jne .L957
movq %rdx, -136(%rbp)
movq %r13, %r11
.L801:
movq 8(%rbx), %rdx
movq 16(%rbx), %r9
movq %rdx, %rsi
leaq 1(%r9), %rdi
leaq (%rdx,%rdx,8), %rcx
xorq (%rbx), %rdi
shrq $11, %rsi
rorx $40, %rdx, %rax
leaq 2(%r9), %rdx
addq %rdi, %rax
xorq %rsi, %rcx
movq %rax, %r8
rorx $40, %rax, %rsi
xorq %rdx, %rcx
shrq $11, %r8
leaq (%rax,%rax,8), %rdx
leaq 3(%r9), %rax
addq %rcx, %rsi
xorq %r8, %rdx
movq %rsi, %r8
xorq %rax, %rdx
leaq (%rsi,%rsi,8), %rax
rorx $40, %rsi, %r10
shrq $11, %r8
addq %rdx, %r10
leaq 4(%r9), %rsi
addq $5, %r9
xorq %r8, %rax
rorx $40, %r10, %r8
movq %r9, 16(%rbx)
xorq %rsi, %rax
movq %r10, %rsi
shrq $11, %rsi
addq %rax, %r8
movq %rsi, %r14
leaq (%r10,%r10,8), %rsi
leaq (%r8,%r8,8), %r10
xorq %r14, %rsi
movq %r8, %r14
rorx $40, %r8, %r8
shrq $11, %r14
xorq %r9, %rsi
movabsq $68719476719, %r9
xorq %r14, %r10
addq %rsi, %r8
movl %esi, %esi
vmovq %r10, %xmm7
movq -136(%rbp), %r10
vpinsrq $1, %r8, %xmm7, %xmm1
movq %r10, %r14
vmovdqu %xmm1, (%rbx)
shrq $4, %r14
cmpq %r9, %r10
movl $4294967295, %r9d
movq %r14, %r8
leaq 192(%r12), %r14
cmova %r9, %r8
movl %ecx, %r9d
shrq $32, %rcx
imulq %r8, %r9
imulq %r8, %rcx
imulq %r8, %rsi
shrq $32, %r9
salq $6, %r9
shrq $32, %rcx
vmovdqa32 (%r11,%r9), %zmm3
movl %edi, %r9d
shrq $32, %rdi
imulq %r8, %r9
salq $6, %rcx
shrq $32, %rsi
imulq %r8, %rdi
salq $6, %rsi
vmovdqa32 (%r11,%rsi), %zmm5
shrq $32, %r9
salq $6, %r9
shrq $32, %rdi
vmovdqa32 (%r11,%r9), %zmm2
salq $6, %rdi
vpminsd %zmm3, %zmm2, %zmm1
vpmaxsd (%r11,%rdi), %zmm1, %zmm1
movq %rdx, %rdi
movl %edx, %edx
shrq $32, %rdi
imulq %r8, %rdx
vpmaxsd %zmm3, %zmm2, %zmm2
imulq %r8, %rdi
vpminsd %zmm2, %zmm1, %zmm1
vmovdqa32 (%r11,%rcx), %zmm2
vpbroadcastd %xmm1, %zmm0
vmovdqa32 %zmm1, (%r12)
shrq $32, %rdx
vpxord %zmm0, %zmm1, %zmm1
shrq $32, %rdi
salq $6, %rdx
salq $6, %rdi
vmovdqa32 (%r11,%rdi), %zmm4
vpminsd %zmm4, %zmm2, %zmm3
vpmaxsd (%r11,%rdx), %zmm3, %zmm3
movl %eax, %edx
shrq $32, %rax
imulq %r8, %rdx
vpmaxsd %zmm4, %zmm2, %zmm2
imulq %r8, %rax
vpminsd %zmm2, %zmm3, %zmm3
vmovdqa32 %zmm3, 64(%r12)
vpxord %zmm0, %zmm3, %zmm3
shrq $32, %rdx
vpord %zmm3, %zmm1, %zmm1
salq $6, %rdx
shrq $32, %rax
vmovdqa32 (%r11,%rdx), %zmm4
salq $6, %rax
vpminsd %zmm5, %zmm4, %zmm2
vpmaxsd (%r11,%rax), %zmm2, %zmm2
vpmaxsd %zmm5, %zmm4, %zmm4
vpminsd %zmm4, %zmm2, %zmm2
vmovdqa32 %zmm2, 128(%r12)
vpxord %zmm0, %zmm2, %zmm2
vpord %zmm2, %zmm1, %zmm1
vptestnmd %zmm1, %zmm1, %k0
kortestw %k0, %k0
jc .L803
vpbroadcastq .LC10(%rip), %zmm0
movl $4, %esi
movq %r12, %rdi
vmovdqu64 %zmm0, 192(%r12)
vmovdqu64 %zmm0, 256(%r12)
vzeroupper
call _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
vpbroadcastd (%r12), %zmm0
vpbroadcastd 188(%r12), %zmm1
vpternlogd $0xFF, %zmm2, %zmm2, %zmm2
vpaddd %zmm2, %zmm1, %zmm2
vpcmpd $0, %zmm2, %zmm0, %k0
kortestw %k0, %k0
jnc .L805
leaq -112(%rbp), %rdx
movq %r14, %rcx
movq %r15, %rsi
movq %r13, %rdi
call _ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L951
.L805:
movl 96(%r12), %ecx
movl $23, %eax
movl $24, %edx
cmpl %ecx, 92(%r12)
je .L845
jmp .L850
.p2align 4,,10
.p2align 3
.L848:
testq %rax, %rax
je .L958
.L845:
movq %rax, %rdx
subq $1, %rax
movl (%r12,%rax,4), %esi
cmpl %esi, %ecx
je .L848
cmpl (%r12,%rdx,4), %ecx
je .L850
movl %esi, %ecx
jmp .L847
.p2align 4,,10
.p2align 3
.L851:
cmpq $47, %rdx
je .L954
.L850:
movq %rdx, %rsi
addq $1, %rdx
cmpl (%r12,%rdx,4), %ecx
je .L851
movl $24, %edx
subq $23, %rsi
subq %rax, %rdx
cmpq %rdx, %rsi
jb .L847
.L954:
movl (%r12,%rax,4), %ecx
.L847:
vpbroadcastd %ecx, %zmm1
.L955:
movl $1, -136(%rbp)
.L843:
cmpq $0, -120(%rbp)
je .L959
leaq -16(%r15), %rdx
vmovdqa32 %zmm1, %zmm0
leaq 0(%r13,%rdx,4), %r10
movq %rdx, %r9
movq %rdx, %rcx
vmovdqu64 (%r10), %zmm6
andl $63, %r9d
andl $48, %ecx
je .L854
vmovdqu64 0(%r13), %zmm2
movq $-1, %rdi
vpcmpd $6, %zmm1, %zmm2, %k1
knotw %k1, %k2
vpcompressd %zmm2, %zmm1{%k2}{z}
kmovw %k2, %eax
popcntq %rax, %rax
bzhi %rax, %rdi, %rcx
kmovw %ecx, %k7
vmovdqu32 %zmm1, 0(%r13){%k7}
vpcompressd %zmm2, %zmm1{%k1}{z}
kmovw %k1, %ecx
leaq 0(%r13,%rax,4), %rax
vmovdqu64 %zmm1, (%r12)
popcntq %rcx, %rcx
testb $32, %dl
je .L855
vmovdqu64 64(%r13), %zmm1
vpcmpd $6, %zmm0, %zmm1, %k1
knotw %k1, %k2
vpcompressd %zmm1, %zmm2{%k2}{z}
kmovw %k2, %esi
popcntq %rsi, %rsi
bzhi %rsi, %rdi, %r8
kmovw %r8d, %k4
vmovdqu32 %zmm2, (%rax){%k4}
vpcompressd %zmm1, %zmm2{%k1}{z}
leaq (%rax,%rsi,4), %rax
vmovdqu64 %zmm2, (%r12,%rcx,4)
kmovw %k1, %esi
popcntq %rsi, %rsi
addq %rsi, %rcx
cmpq $47, %r9
jbe .L855
vmovdqu64 128(%r13), %zmm1
vpcmpd $6, %zmm0, %zmm1, %k1
knotw %k1, %k2
vpcompressd %zmm1, %zmm2{%k2}{z}
kmovw %k2, %esi
popcntq %rsi, %rsi
bzhi %rsi, %rdi, %rdi
kmovw %edi, %k7
vmovdqu32 %zmm2, (%rax){%k7}
vpcompressd %zmm1, %zmm2{%k1}{z}
leaq (%rax,%rsi,4), %rax
vmovdqu64 %zmm2, (%r12,%rcx,4)
kmovw %k1, %esi
popcntq %rsi, %rsi
addq %rsi, %rcx
leaq 1(%r9), %rsi
cmpq $17, %rsi
leaq 0(,%rcx,4), %r8
sbbq %rsi, %rsi
andq $-32, %rsi
addq $48, %rsi
cmpq %rsi, %r9
jne .L960
.L857:
movq %rax, %r9
movq %rdx, %rsi
subq %r13, %r9
subq %rcx, %rsi
sarq $2, %r9
leaq 0(%r13,%rsi,4), %r11
subq %r9, %rdx
subq %r9, %rsi
movq %rdx, %r14
leaq (%rax,%rsi,4), %r10
movq %rsi, %rdx
leaq (%rax,%r14,4), %rdi
vmovq %rdi, %xmm8
.p2align 4,,10
.p2align 3
.L859:
movl %r8d, %ecx
cmpl $8, %r8d
jnb .L861
testb $4, %r8b
jne .L961
testl %ecx, %ecx
jne .L962
.L862:
movl %r8d, %ecx
cmpl $8, %r8d
jnb .L865
andl $4, %r8d
jne .L963
testl %ecx, %ecx
jne .L964
.L866:
testq %rdx, %rdx
je .L905
.L880:
leaq 256(%rax), %rsi
leaq -256(%r10), %rdi
vmovdqu64 (%rax), %zmm15
vmovdqu64 64(%rax), %zmm14
vmovdqu64 128(%rax), %zmm13
vmovdqu64 192(%rax), %zmm12
vmovdqu64 -128(%r10), %zmm9
vmovdqu64 -64(%r10), %zmm7
vmovdqu64 -256(%r10), %zmm11
vmovdqu64 -192(%r10), %zmm10
cmpq %rdi, %rsi
je .L906
xorl %ecx, %ecx
movq $-1, %r8
jmp .L873
.p2align 4,,10
.p2align 3
.L966:
vmovdqu64 -128(%rdi), %zmm2
vmovdqu64 -64(%rdi), %zmm1
prefetcht0 -1024(%rdi)
subq $256, %rdi
vmovdqu64 (%rdi), %zmm4
vmovdqu64 64(%rdi), %zmm3
.L872:
vpcmpd $6, %zmm0, %zmm4, %k1
knotw %k1, %k2
vpcompressd %zmm4, %zmm5{%k2}{z}
kmovw %k2, %r10d
popcntq %r10, %r10
vmovdqu64 %zmm5, (%rax,%rcx,4)
addq %rcx, %r10
vpcompressd %zmm4, %zmm5{%k1}{z}
kmovw %k1, %ecx
vpcmpd $6, %zmm0, %zmm3, %k1
leaq -16(%rdx,%r10), %r11
popcntq %rcx, %rcx
bzhi %rcx, %r8, %rcx
kmovw %ecx, %k3
vmovdqu32 %zmm5, (%rax,%r11,4){%k3}
knotw %k1, %k2
vpcompressd %zmm3, %zmm4{%k2}{z}
kmovw %k2, %ecx
popcntq %rcx, %rcx
vmovdqu64 %zmm4, (%rax,%r10,4)
addq %r10, %rcx
vpcompressd %zmm3, %zmm4{%k1}{z}
kmovw %k1, %r10d
vpcmpd $6, %zmm0, %zmm2, %k1
leaq -32(%rdx,%rcx), %r11
popcntq %r10, %r10
bzhi %r10, %r8, %r10
kmovw %r10d, %k5
vmovdqu32 %zmm4, (%rax,%r11,4){%k5}
knotw %k1, %k2
vpcompressd %zmm2, %zmm3{%k2}{z}
kmovw %k2, %r10d
popcntq %r10, %r10
vmovdqu64 %zmm3, (%rax,%rcx,4)
addq %rcx, %r10
vpcompressd %zmm2, %zmm3{%k1}{z}
kmovw %k1, %ecx
vpcmpd $6, %zmm0, %zmm1, %k1
leaq -48(%rdx,%r10), %r11
popcntq %rcx, %rcx
subq $64, %rdx
bzhi %rcx, %r8, %rcx
kmovw %ecx, %k6
vmovdqu32 %zmm3, (%rax,%r11,4){%k6}
knotw %k1, %k2
vpcompressd %zmm1, %zmm2{%k2}{z}
kmovw %k2, %ecx
popcntq %rcx, %rcx
addq %r10, %rcx
vmovdqu64 %zmm2, (%rax,%r10,4)
vpcompressd %zmm1, %zmm2{%k1}{z}
kmovw %k1, %r10d
leaq (%rdx,%rcx), %r11
popcntq %r10, %r10
bzhi %r10, %r8, %r10
kmovw %r10d, %k7
vmovdqu32 %zmm2, (%rax,%r11,4){%k7}
cmpq %rdi, %rsi
je .L965
.L873:
movq %rsi, %r10
subq %rax, %r10
sarq $2, %r10
subq %rcx, %r10
cmpq $64, %r10
ja .L966
vmovdqu64 (%rsi), %zmm4
vmovdqu64 64(%rsi), %zmm3
prefetcht0 1024(%rsi)
addq $256, %rsi
vmovdqu64 -128(%rsi), %zmm2
vmovdqu64 -64(%rsi), %zmm1
jmp .L872
.p2align 4,,10
.p2align 3
.L957:
movl $16, %eax
subq %rdi, %rax
leaq 0(%r13,%rax,4), %r11
leaq -16(%rdi,%rdx), %rax
movq %rax, -136(%rbp)
jmp .L801
.p2align 4,,10
.p2align 3
.L965:
leaq (%rax,%rcx,4), %rsi
.L870:
vpcmpd $6, %zmm0, %zmm15, %k1
knotw %k1, %k2
vpcompressd %zmm15, %zmm1{%k2}{z}
kmovw %k2, %edi
popcntq %rdi, %rdi
vmovdqu64 %zmm1, (%rsi)
vpcompressd %zmm15, %zmm1{%k1}{z}
kmovw %k1, %esi
addq %rcx, %rdi
vpcmpd $6, %zmm0, %zmm14, %k1
leaq -16(%rdx,%rdi), %r8
popcntq %rsi, %rsi
movq $-1, %rcx
bzhi %rsi, %rcx, %rsi
kmovw %esi, %k4
vmovdqu32 %zmm1, (%rax,%r8,4){%k4}
knotw %k1, %k2
vpcompressd %zmm14, %zmm1{%k2}{z}
kmovw %k2, %esi
popcntq %rsi, %rsi
vmovdqu64 %zmm1, (%rax,%rdi,4)
addq %rdi, %rsi
vpcompressd %zmm14, %zmm1{%k1}{z}
kmovw %k1, %edi
vpcmpd $6, %zmm0, %zmm13, %k1
leaq -32(%rdx,%rsi), %r8
popcntq %rdi, %rdi
bzhi %rdi, %rcx, %rdi
kmovw %edi, %k4
vmovdqu32 %zmm1, (%rax,%r8,4){%k4}
knotw %k1, %k2
vpcompressd %zmm13, %zmm1{%k2}{z}
kmovw %k2, %edi
popcntq %rdi, %rdi
vmovdqu64 %zmm1, (%rax,%rsi,4)
addq %rsi, %rdi
vpcompressd %zmm13, %zmm1{%k1}{z}
kmovw %k1, %esi
vpcmpd $6, %zmm0, %zmm12, %k1
leaq -48(%rdx,%rdi), %r8
popcntq %rsi, %rsi
bzhi %rsi, %rcx, %rsi
kmovw %esi, %k4
vmovdqu32 %zmm1, (%rax,%r8,4){%k4}
knotw %k1, %k2
vpcompressd %zmm12, %zmm1{%k2}{z}
kmovw %k2, %esi
popcntq %rsi, %rsi
vmovdqu64 %zmm1, (%rax,%rdi,4)
addq %rdi, %rsi
vpcompressd %zmm12, %zmm1{%k1}{z}
kmovw %k1, %edi
vpcmpd $6, %zmm0, %zmm11, %k1
leaq -64(%rdx,%rsi), %r8
popcntq %rdi, %rdi
bzhi %rdi, %rcx, %rdi
kmovw %edi, %k4
vmovdqu32 %zmm1, (%rax,%r8,4){%k4}
knotw %k1, %k2
vpcompressd %zmm11, %zmm1{%k2}{z}
kmovw %k2, %edi
popcntq %rdi, %rdi
vmovdqu64 %zmm1, (%rax,%rsi,4)
addq %rsi, %rdi
vpcompressd %zmm11, %zmm1{%k1}{z}
kmovw %k1, %esi
vpcmpd $6, %zmm0, %zmm10, %k1
leaq -80(%rdx,%rdi), %r8
popcntq %rsi, %rsi
bzhi %rsi, %rcx, %rsi
kmovw %esi, %k4
vmovdqu32 %zmm1, (%rax,%r8,4){%k4}
knotw %k1, %k2
vpcompressd %zmm10, %zmm1{%k2}{z}
kmovw %k2, %esi
popcntq %rsi, %rsi
vmovdqu64 %zmm1, (%rax,%rdi,4)
addq %rdi, %rsi
vpcompressd %zmm10, %zmm1{%k1}{z}
kmovw %k1, %edi
vpcmpd $6, %zmm0, %zmm9, %k1
leaq -96(%rdx,%rsi), %r8
popcntq %rdi, %rdi
bzhi %rdi, %rcx, %rdi
kmovw %edi, %k3
vmovdqu32 %zmm1, (%rax,%r8,4){%k3}
knotw %k1, %k2
vpcompressd %zmm9, %zmm1{%k2}{z}
kmovw %k2, %edi
popcntq %rdi, %rdi
vmovdqu64 %zmm1, (%rax,%rsi,4)
addq %rsi, %rdi
vpcompressd %zmm9, %zmm1{%k1}{z}
kmovw %k1, %esi
vpcmpd $6, %zmm0, %zmm7, %k1
leaq -112(%rdx,%rdi), %r8
popcntq %rsi, %rsi
bzhi %rsi, %rcx, %rsi
kmovw %esi, %k5
leaq -128(%rdx), %rsi
vmovdqu32 %zmm1, (%rax,%r8,4){%k5}
knotw %k1, %k2
vpcompressd %zmm7, %zmm1{%k2}{z}
kmovw %k2, %edx
popcntq %rdx, %rdx
addq %rdi, %rdx
vmovdqu64 %zmm1, (%rax,%rdi,4)
vpcompressd %zmm7, %zmm1{%k1}{z}
kmovw %k1, %edi
popcntq %rdi, %rdi
bzhi %rdi, %rcx, %rcx
addq %rdx, %rsi
kmovw %ecx, %k6
movq %r14, %rcx
vmovdqu32 %zmm1, (%rax,%rsi,4){%k6}
leaq (%rax,%rdx,4), %rdi
subq %rdx, %rcx
.L869:
movq %rdi, %rsi
cmpq $15, %rcx
ja .L874
leaq -64(%rax,%r14,4), %rsi
.L874:
vpcmpd $6, %zmm0, %zmm6, %k1
vmovdqu64 (%rsi), %zmm7
vmovq %xmm8, %rcx
movq $-1, %rsi
vmovdqu64 %zmm7, (%rcx)
knotw %k1, %k2
vpcompressd %zmm6, %zmm0{%k2}{z}
kmovw %k2, %ecx
popcntq %rcx, %rcx
addq %rcx, %rdx
bzhi %rcx, %rsi, %r8
kmovw %r8d, %k4
kmovw %k1, %ecx
vmovdqu32 %zmm0, (%rdi){%k4}
vpcompressd %zmm6, %zmm0{%k1}{z}
popcntq %rcx, %rcx
leaq (%rdx,%r9), %r14
bzhi %rcx, %rsi, %rsi
kmovw %esi, %k4
vmovdqu32 %zmm0, (%rax,%rdx,4){%k4}
movq -120(%rbp), %r9
subq $1, %r9
cmpl $2, -136(%rbp)
je .L967
movq -128(%rbp), %rsi
movq %rbx, %r8
movq %r12, %rcx
movq %r14, %rdx
movq %r13, %rdi
movq %r9, -120(%rbp)
vzeroupper
call _ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -136(%rbp)
movq -120(%rbp), %r9
je .L951
.L876:
movq %r15, %rdx
movq -128(%rbp), %rsi
leaq 0(%r13,%r14,4), %rdi
movq %rbx, %r8
subq %r14, %rdx
movq %r12, %rcx
call _ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L951:
subq $-128, %rsp
popq %rbx
popq %r10
.cfi_remember_state
.cfi_def_cfa 10, 0
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
leaq -8(%r10), %rsp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L865:
.cfi_restore_state
movq (%r12), %rcx
leaq 8(%r11), %rdi
andq $-8, %rdi
movq %rcx, (%r11)
movl %r8d, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r11,%rcx)
movq %r11, %rcx
movq %r12, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L866
.p2align 4,,10
.p2align 3
.L861:
movq (%r11), %rcx
leaq 8(%rax), %rdi
andq $-8, %rdi
movq %rcx, (%rax)
movl %r8d, %ecx
movq -8(%r11,%rcx), %rsi
movq %rsi, -8(%rax,%rcx)
movq %rax, %rcx
movq %r11, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L862
.p2align 4,,10
.p2align 3
.L958:
movl (%r12), %ecx
jmp .L847
.p2align 4,,10
.p2align 3
.L960:
subq %rsi, %r9
leaq 0(%r13,%rsi,4), %r11
leaq (%r12,%r8), %rsi
.L879:
movq $-1, %rdi
bzhi %r9, %rdi, %rdi
movzwl %di, %edi
kmovd %edi, %k0
.L860:
vmovdqu64 (%r11), %zmm1
movq $-1, %r8
vpcmpd $6, %zmm0, %zmm1, %k1
kandnw %k0, %k1, %k2
vpcompressd %zmm1, %zmm2{%k2}{z}
kmovw %k2, %edi
kandw %k0, %k1, %k1
popcntq %rdi, %rdi
bzhi %rdi, %r8, %r8
kmovw %r8d, %k4
vmovdqu32 %zmm2, (%rax){%k4}
leaq (%rax,%rdi,4), %rax
kmovw %k1, %r8d
popcntq %r8, %r8
addq %rcx, %r8
movq %rax, %r9
movq %rdx, %rcx
vpcompressd %zmm1, %zmm2{%k1}{z}
subq %r13, %r9
subq %r8, %rcx
vmovdqu64 %zmm2, (%rsi)
salq $2, %r8
sarq $2, %r9
leaq 0(%r13,%rcx,4), %r11
subq %r9, %rdx
movq %rdx, %r14
movq %rcx, %rdx
subq %r9, %rdx
leaq (%rax,%r14,4), %rdi
leaq (%rax,%rdx,4), %r10
vmovq %rdi, %xmm8
jmp .L859
.p2align 4,,10
.p2align 3
.L964:
movzbl (%r12), %esi
movb %sil, (%r11)
testb $2, %cl
je .L866
movzwl -2(%r12,%rcx), %esi
movw %si, -2(%r11,%rcx)
jmp .L866
.p2align 4,,10
.p2align 3
.L962:
movzbl (%r11), %esi
movb %sil, (%rax)
testb $2, %cl
je .L862
movzwl -2(%r11,%rcx), %esi
movw %si, -2(%rax,%rcx)
jmp .L862
.p2align 4,,10
.p2align 3
.L855:
leaq -16(%r9), %rsi
leaq 1(%r9), %rdi
andq $-16, %rsi
leaq 0(,%rcx,4), %r8
addq $16, %rsi
cmpq $16, %rdi
movl $16, %edi
cmovbe %rdi, %rsi
cmpq %r9, %rsi
je .L857
subq %rsi, %r9
leaq 0(%r13,%rsi,4), %r11
leaq (%r12,%r8), %rsi
cmpq $255, %r9
jbe .L879
movl $65535, %edi
kmovd %edi, %k0
jmp .L860
.p2align 4,,10
.p2align 3
.L956:
cmpq $1, %rdx
jbe .L951
leaq 1024(%rdi), %rax
cmpq %rax, %rsi
jb .L968
movl $16, %esi
call _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L951
.p2align 4,,10
.p2align 3
.L803:
vmovdqu32 0(%r13), %zmm6
movl $16, %esi
movq $-1, %rax
subq -144(%rbp), %rsi
bzhi %rsi, %rax, %rax
kmovw %eax, %k6
vpcmpd $4, %zmm0, %zmm6, %k0
kandw %k6, %k0, %k0
kmovw %k0, %eax
kortestw %k0, %k0
jne .L969
vpxor %xmm4, %xmm4, %xmm4
leaq 1024(%r13,%rsi,4), %rdi
vmovdqa64 %zmm4, %zmm3
.p2align 4,,10
.p2align 3
.L809:
movq %rsi, %rcx
addq $256, %rsi
cmpq %rsi, %r15
jb .L813
leaq -1024(%rdi), %rax
.L808:
vpxord (%rax), %zmm0, %zmm1
vpxord 64(%rax), %zmm0, %zmm2
leaq 128(%rax), %rdx
vpord %zmm3, %zmm1, %zmm3
vpord %zmm4, %zmm2, %zmm4
vpxord 128(%rax), %zmm0, %zmm1
vpxord 192(%rax), %zmm0, %zmm2
vpord %zmm3, %zmm1, %zmm3
vpxord 256(%rax), %zmm0, %zmm1
vpord %zmm4, %zmm2, %zmm4
vpxord 320(%rax), %zmm0, %zmm2
leaq 384(%rdx), %rax
vpord %zmm3, %zmm1, %zmm3
vpxord 256(%rdx), %zmm0, %zmm1
vpord %zmm4, %zmm2, %zmm4
vpxord 320(%rdx), %zmm0, %zmm2
vpord %zmm3, %zmm1, %zmm1
vpord %zmm4, %zmm2, %zmm2
vmovdqa64 %zmm1, %zmm3
vmovdqa64 %zmm2, %zmm4
cmpq %rax, %rdi
jne .L808
vpord %zmm2, %zmm1, %zmm1
leaq 1408(%rdx), %rdi
vptestnmd %zmm1, %zmm1, %k0
kortestw %k0, %k0
setc %al
testb %al, %al
jne .L809
vmovdqa32 0(%r13,%rcx,4), %zmm6
vpcmpd $4, %zmm0, %zmm6, %k0
kortestw %k0, %k0
jne .L811
.p2align 4,,10
.p2align 3
.L810:
addq $16, %rcx
vmovdqa32 0(%r13,%rcx,4), %zmm6
vpcmpd $4, %zmm0, %zmm6, %k0
kortestw %k0, %k0
je .L810
.L811:
kmovw %k0, %eax
tzcntl %eax, %eax
addq %rcx, %rax
.L807:
vpbroadcastd 0(%r13,%rax,4), %zmm5
vmovdqa64 %zmm0, %zmm2
leaq 0(%r13,%rax,4), %rdi
vpcmpd $6, %zmm0, %zmm5, %k0
vmovdqa64 %zmm5, %zmm1
kortestw %k0, %k0
jne .L816
leaq -16(%r15), %rax
xorl %ecx, %ecx
jmp .L822
.p2align 4,,10
.p2align 3
.L817:
kmovw %k0, %edx
popcntq %rdx, %rdx
addq %rdx, %rcx
leaq -16(%rax), %rdx
vmovdqu64 %zmm2, 0(%r13,%rax,4)
cmpq %rdx, %r15
jbe .L970
movq %rdx, %rax
.L822:
vmovdqu32 0(%r13,%rax,4), %zmm6
vpcmpd $0, %zmm5, %zmm6, %k1
vpcmpd $0, %zmm0, %zmm6, %k0
kmovw %k1, %edx
kmovw %k0, %esi
korw %k0, %k1, %k1
kortestw %k1, %k1
jc .L817
kmovw %edx, %k0
kmovw %esi, %k5
kxnorw %k5, %k0, %k0
kmovw %k0, %edx
tzcntl %edx, %edx
leaq 16(%rax), %rsi
addq %rax, %rdx
addq $32, %rax
vpbroadcastd 0(%r13,%rdx,4), %zmm2
movq %r15, %rdx
subq %rcx, %rdx
vmovdqa64 %zmm2, %zmm0
vmovdqa64 %zmm2, -112(%rbp)
cmpq %rdx, %rax
ja .L818
.p2align 4,,10
.p2align 3
.L819:
vmovdqu64 %zmm1, -64(%r13,%rax,4)
movq %rax, %rsi
addq $16, %rax
cmpq %rax, %rdx
jnb .L819
.L818:
subq %rsi, %rdx
leaq 0(%r13,%rsi,4), %rcx
movl $65535, %eax
cmpq $255, %rdx
ja .L820
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzwl %ax, %eax
.L820:
kmovw %eax, %k3
vmovdqu32 %zmm5, (%rcx){%k3}
.L821:
vpbroadcastd (%r12), %zmm3
vpcmpd $0, .LC8(%rip), %zmm3, %k0
vmovdqa64 %zmm3, %zmm1
kortestw %k0, %k0
jc .L901
vpcmpd $0, .LC9(%rip), %zmm3, %k0
kortestw %k0, %k0
jc .L839
vpminsd %zmm0, %zmm5, %zmm2
vpcmpd $6, %zmm2, %zmm3, %k0
kortestw %k0, %k0
jne .L971
vmovdqa64 %zmm3, %zmm2
movl $256, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L834:
movq %rax, %rdx
addq $1, %rax
salq $4, %rdx
addq %rcx, %rdx
vpminsd 0(%r13,%rdx,4), %zmm2, %zmm0
vmovdqa64 %zmm0, %zmm2
cmpq $16, %rax
jne .L834
vpcmpd $6, %zmm0, %zmm3, %k0
kortestw %k0, %k0
jne .L955
leaq 256(%rsi), %rax
cmpq %rax, %r15
jb .L841
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L834
.p2align 4,,10
.p2align 3
.L813:
movq %rcx, %rdx
addq $16, %rcx
cmpq %rcx, %r15
jb .L972
vmovdqa32 -64(%r13,%rcx,4), %zmm6
vpcmpd $4, %zmm0, %zmm6, %k0
kmovw %k0, %eax
kortestw %k0, %k0
je .L813
.L953:
tzcntl %eax, %eax
addq %rdx, %rax
jmp .L807
.p2align 4,,10
.p2align 3
.L854:
movq %r12, %rsi
movq %r13, %r11
movq %r13, %rax
movq %rdx, %r14
vmovq %r10, %xmm8
testq %r9, %r9
jne .L879
jmp .L880
.L967:
vzeroupper
jmp .L876
.L906:
movq %rax, %rsi
xorl %ecx, %ecx
jmp .L870
.L905:
movq %rax, %rdi
movq %r14, %rcx
jmp .L869
.L959:
leaq -1(%r15), %rbx
movq %rbx, %r12
shrq %r12
.p2align 4,,10
.p2align 3
.L852:
movq %r12, %rdx
movq %r15, %rsi
movq %r13, %rdi
call _ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %r12
jnb .L852
.p2align 4,,10
.p2align 3
.L853:
movl 0(%r13,%rbx,4), %edx
movl 0(%r13), %eax
movq %rbx, %rsi
movq %r13, %rdi
movl %edx, 0(%r13)
xorl %edx, %edx
movl %eax, 0(%r13,%rbx,4)
call _ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L853
jmp .L951
.p2align 4,,10
.p2align 3
.L842:
vpcmpd $6, -64(%r13,%rsi,4), %zmm3, %k0
kortestw %k0, %k0
jne .L955
.L841:
movq %rsi, %rax
addq $16, %rsi
cmpq %rsi, %r15
jnb .L842
cmpq %rax, %r15
je .L901
vpcmpd $6, -64(%r13,%r15,4), %zmm3, %k0
xorl %eax, %eax
kortestw %k0, %k0
sete %al
addl $1, %eax
movl %eax, -136(%rbp)
jmp .L843
.L961:
movl (%r11), %esi
movl %esi, (%rax)
movl -4(%r11,%rcx), %esi
movl %esi, -4(%rax,%rcx)
jmp .L862
.L963:
movl (%r12), %esi
movl %esi, (%r11)
movl -4(%r12,%rcx), %esi
movl %esi, -4(%r11,%rcx)
jmp .L866
.L816:
movq %r15, %rsi
leaq -112(%rbp), %rdx
movq %r12, %rcx
subq %rax, %rsi
call _ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L951
vmovdqa64 -112(%rbp), %zmm0
jmp .L821
.L970:
movl $65535, %edi
vmovdqu64 0(%r13), %zmm2
kmovd %edi, %k2
cmpq $255, %rax
ja .L823
movq $-1, %rdx
bzhi %rax, %rdx, %rdx
movzwl %dx, %edi
kmovd %edi, %k2
.L823:
vpcmpd $0, %zmm5, %zmm2, %k0
vpcmpd $0, %zmm0, %zmm2, %k1
movq %r15, %rdx
kandw %k2, %k1, %k1
knotw %k2, %k2
korw %k1, %k0, %k0
korw %k2, %k0, %k0
kortestw %k0, %k0
setc %sil
subq %rcx, %rdx
testb %sil, %sil
je .L973
xorl %ecx, %ecx
kmovw %k1, %eax
vmovdqu64 %zmm0, 0(%r13)
popcntq %rax, %rcx
movq %rdx, %rax
subq %rcx, %rax
cmpq $15, %rax
jbe .L828
leaq -16(%rax), %rcx
movq -152(%rbp), %rsi
movq %rcx, %rdx
shrq $4, %rdx
salq $6, %rdx
leaq 64(%r13,%rdx), %rdx
.p2align 4,,10
.p2align 3
.L829:
vmovdqu64 %zmm1, (%rsi)
addq $64, %rsi
cmpq %rsi, %rdx
jne .L829
andq $-16, %rcx
movl $65535, %ebx
vmovdqa64 %zmm5, (%r12)
leaq 16(%rcx), %rdx
kmovd %ebx, %k1
subq %rdx, %rax
leaq 0(%r13,%rdx,4), %r13
cmpq $255, %rax
jbe .L881
.L830:
vmovdqu32 (%r12), %zmm0{%k1}{z}
vmovdqu32 %zmm0, 0(%r13){%k1}
vzeroupper
jmp .L951
.L838:
vmovdqu32 -64(%r13,%rsi,4), %zmm6
vpcmpd $6, %zmm3, %zmm6, %k0
kortestw %k0, %k0
jne .L955
.L837:
movq %rsi, %rax
addq $16, %rsi
cmpq %rsi, %r15
jnb .L838
cmpq %rax, %r15
je .L839
vmovdqu32 -64(%r13,%r15,4), %zmm6
vpcmpd $6, %zmm3, %zmm6, %k0
kortestw %k0, %k0
jne .L955
.L839:
movl $3, -136(%rbp)
vpternlogd $0xFF, %zmm1, %zmm1, %zmm1
vpaddd %zmm1, %zmm3, %zmm1
jmp .L843
.L972:
leaq -16(%r15), %rdx
vmovdqu32 0(%r13,%rdx,4), %zmm6
vpcmpd $4, %zmm0, %zmm6, %k0
kmovw %k0, %eax
kortestw %k0, %k0
jne .L953
vzeroupper
jmp .L951
.L969:
tzcntl %eax, %eax
jmp .L807
.L968:
xorl %eax, %eax
cmpq $15, %rdx
jbe .L795
leaq -16(%rdx), %rdx
movq (%rdi), %rcx
movq %rdx, %rax
shrq $4, %rax
movq %rcx, (%r12)
addq $1, %rax
salq $6, %rax
movl %eax, %ecx
movq -8(%rdi,%rcx), %rsi
leaq 8(%r12), %rdi
andq $-8, %rdi
movq %rsi, -8(%r12,%rcx)
movq %r12, %rcx
movq %r13, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
shrl $3, %ecx
andq $-16, %rax
rep movsq
addq $16, %rax
.L795:
movq %r15, %rdx
leaq 0(,%rax,4), %rbx
subq %rax, %rdx
movl $65535, %eax
leaq (%r12,%rbx), %r14
addq %r13, %rbx
kmovd %eax, %k4
cmpq $255, %rdx
ja .L796
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzwl %ax, %eax
kmovd %eax, %k4
.L796:
leal -1(%r15), %eax
movl $32, %edx
movl $1, %esi
vmovdqu32 (%rbx), %zmm0{%k4}{z}
bsrl %eax, %eax
xorl $31, %eax
vmovdqu32 %zmm0, (%r14){%k4}
vpbroadcastq .LC10(%rip), %zmm0
subl %eax, %edx
movl $1, %eax
shlx %rdx, %rsi, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %r15, %rax
leaq 1(%rsi), %rdx
salq $4, %rdx
cmpq %rdx, %r15
jnb .L800
.L797:
vmovdqu64 %zmm0, (%r12,%rax,4)
addq $16, %rax
cmpq %rdx, %rax
jb .L797
.L800:
movq %r12, %rdi
vzeroupper
call _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
cmpq $15, %r15
jbe .L799
leaq -16(%r15), %rax
movq (%r12), %rdx
leaq 8(%r13), %rdi
movq %r12, %rsi
shrq $4, %rax
andq $-8, %rdi
addq $1, %rax
movq %rdx, 0(%r13)
salq $6, %rax
movl %eax, %edx
movq -8(%r12,%rdx), %rcx
movq %rcx, -8(%r13,%rdx)
subq %rdi, %r13
leal (%rax,%r13), %ecx
subq %r13, %rsi
shrl $3, %ecx
rep movsq
.L799:
vmovdqu32 (%r14), %zmm0{%k4}{z}
vmovdqu32 %zmm0, (%rbx){%k4}
vzeroupper
jmp .L951
.L828:
vmovdqa64 %zmm5, (%r12)
.L881:
movq $-1, %rdx
bzhi %rax, %rdx, %rax
movzwl %ax, %eax
kmovd %eax, %k1
jmp .L830
.L901:
movl $2, -136(%rbp)
jmp .L843
.L971:
vpmaxsd %zmm0, %zmm5, %zmm5
vpcmpd $6, %zmm3, %zmm5, %k0
kortestw %k0, %k0
jne .L955
vmovdqa64 %zmm3, %zmm2
movl $256, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L835:
movq %rax, %rdx
addq $1, %rax
salq $4, %rdx
addq %rcx, %rdx
vpmaxsd 0(%r13,%rdx,4), %zmm2, %zmm0
vmovdqa64 %zmm0, %zmm2
cmpq $16, %rax
jne .L835
vpcmpd $6, %zmm3, %zmm0, %k0
kortestw %k0, %k0
jne .L955
leaq 256(%rsi), %rax
cmpq %rax, %r15
jb .L837
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L835
.L973:
knotw %k0, %k0
kmovw %k0, %ecx
tzcntl %ecx, %ecx
vpbroadcastd 0(%r13,%rcx,4), %zmm2
leaq 16(%rax), %rcx
vmovdqa64 %zmm2, %zmm0
vmovdqa64 %zmm2, -112(%rbp)
cmpq %rdx, %rcx
ja .L825
.L826:
vmovdqu64 %zmm1, -64(%r13,%rcx,4)
movq %rcx, %rax
addq $16, %rcx
cmpq %rdx, %rcx
jbe .L826
.L825:
subq %rax, %rdx
leaq 0(%r13,%rax,4), %rsi
movl $-1, %ecx
cmpq $255, %rdx
ja .L827
orq $-1, %rcx
bzhi %rdx, %rcx, %rcx
.L827:
kmovw %ecx, %k5
vmovdqu32 %zmm5, (%rsi){%k5}
jmp .L821
.cfi_endproc
.LFE18800:
.size _ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18802:
.cfi_startproc
leaq 8(%rsp), %r10
.cfi_def_cfa 10, 0
andq $-64, %rsp
pushq -8(%r10)
pushq %rbp
movq %rsp, %rbp
.cfi_escape 0x10,0x6,0x2,0x76,0
pushq %r15
pushq %r14
pushq %r13
.cfi_escape 0x10,0xf,0x2,0x76,0x78
.cfi_escape 0x10,0xe,0x2,0x76,0x70
.cfi_escape 0x10,0xd,0x2,0x76,0x68
movq %rdi, %r13
pushq %r12
.cfi_escape 0x10,0xc,0x2,0x76,0x60
movq %rcx, %r12
pushq %r10
.cfi_escape 0xf,0x3,0x76,0x58,0x6
pushq %rbx
.cfi_escape 0x10,0x3,0x2,0x76,0x50
movq %rdx, %rbx
addq $-128, %rsp
movq %rsi, -128(%rbp)
movq %r9, -120(%rbp)
cmpq $256, %rdx
jbe .L1141
movq %rdi, %rax
movq %rdi, -152(%rbp)
movq %r8, %r14
shrq $2, %rax
movq %rax, %rdi
andl $15, %edi
movq %rdi, -144(%rbp)
jne .L1142
movq %rdx, -136(%rbp)
movq %r13, %r11
.L986:
movq 8(%r14), %rdx
movq 16(%r14), %r9
movq %rdx, %rsi
leaq 1(%r9), %rdi
leaq (%rdx,%rdx,8), %rcx
xorq (%r14), %rdi
shrq $11, %rsi
rorx $40, %rdx, %rax
leaq 2(%r9), %rdx
addq %rdi, %rax
xorq %rsi, %rcx
movq %rax, %r8
rorx $40, %rax, %rsi
xorq %rdx, %rcx
shrq $11, %r8
leaq (%rax,%rax,8), %rdx
leaq 3(%r9), %rax
addq %rcx, %rsi
xorq %r8, %rdx
movq %rsi, %r8
xorq %rax, %rdx
leaq (%rsi,%rsi,8), %rax
rorx $40, %rsi, %r10
shrq $11, %r8
addq %rdx, %r10
leaq 4(%r9), %rsi
addq $5, %r9
xorq %r8, %rax
movq %r10, %r15
rorx $40, %r10, %r8
movq %r9, 16(%r14)
xorq %rsi, %rax
shrq $11, %r15
leaq (%r10,%r10,8), %rsi
addq %rax, %r8
xorq %r15, %rsi
movq %r8, %r15
leaq (%r8,%r8,8), %r10
xorq %r9, %rsi
rorx $40, %r8, %r8
shrq $11, %r15
addq %rsi, %r8
movl %esi, %esi
movabsq $68719476719, %r9
xorq %r15, %r10
movq -136(%rbp), %r15
vmovq %r10, %xmm6
vpinsrq $1, %r8, %xmm6, %xmm1
movq %r15, %r8
shrq $4, %r8
cmpq %r9, %r15
movl $4294967295, %r9d
vmovdqu %xmm1, (%r14)
cmova %r9, %r8
movl %ecx, %r9d
shrq $32, %rcx
leaq 192(%r12), %r15
imulq %r8, %r9
imulq %r8, %rcx
imulq %r8, %rsi
shrq $32, %r9
salq $6, %r9
shrq $32, %rcx
vmovdqa32 (%r11,%r9), %zmm3
movl %edi, %r9d
shrq $32, %rdi
imulq %r8, %r9
salq $6, %rcx
shrq $32, %rsi
imulq %r8, %rdi
salq $6, %rsi
vmovdqa32 (%r11,%rsi), %zmm5
shrq $32, %r9
salq $6, %r9
shrq $32, %rdi
vmovdqa32 (%r11,%r9), %zmm2
salq $6, %rdi
vpminsd %zmm3, %zmm2, %zmm1
vpmaxsd (%r11,%rdi), %zmm1, %zmm1
movq %rdx, %rdi
movl %edx, %edx
shrq $32, %rdi
imulq %r8, %rdx
vpmaxsd %zmm3, %zmm2, %zmm2
imulq %r8, %rdi
vpminsd %zmm2, %zmm1, %zmm1
vmovdqa32 (%r11,%rcx), %zmm2
vpbroadcastd %xmm1, %zmm0
vmovdqa32 %zmm1, (%r12)
shrq $32, %rdx
vpxord %zmm0, %zmm1, %zmm1
shrq $32, %rdi
salq $6, %rdx
salq $6, %rdi
vmovdqa32 (%r11,%rdi), %zmm4
vpminsd %zmm4, %zmm2, %zmm3
vpmaxsd (%r11,%rdx), %zmm3, %zmm3
movl %eax, %edx
shrq $32, %rax
imulq %r8, %rdx
vpmaxsd %zmm4, %zmm2, %zmm2
imulq %r8, %rax
vpminsd %zmm2, %zmm3, %zmm3
vmovdqa32 %zmm3, 64(%r12)
vpxord %zmm0, %zmm3, %zmm3
shrq $32, %rdx
vpord %zmm3, %zmm1, %zmm1
salq $6, %rdx
shrq $32, %rax
vmovdqa32 (%r11,%rdx), %zmm4
salq $6, %rax
vpminsd %zmm5, %zmm4, %zmm2
vpmaxsd (%r11,%rax), %zmm2, %zmm2
vpmaxsd %zmm5, %zmm4, %zmm4
vpminsd %zmm4, %zmm2, %zmm2
vmovdqa32 %zmm2, 128(%r12)
vpxord %zmm0, %zmm2, %zmm2
vpord %zmm2, %zmm1, %zmm1
vptestnmd %zmm1, %zmm1, %k0
kortestw %k0, %k0
jc .L988
vpbroadcastq .LC10(%rip), %zmm0
movl $4, %esi
movq %r12, %rdi
vmovdqu64 %zmm0, 192(%r12)
vmovdqu64 %zmm0, 256(%r12)
vzeroupper
call _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
vpbroadcastd (%r12), %zmm0
vpbroadcastd 188(%r12), %zmm1
vpternlogd $0xFF, %zmm2, %zmm2, %zmm2
vpaddd %zmm2, %zmm1, %zmm2
vpcmpd $0, %zmm2, %zmm0, %k0
kortestw %k0, %k0
jnc .L990
leaq -112(%rbp), %rdx
movq %r15, %rcx
movq %rbx, %rsi
movq %r13, %rdi
call _ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1136
.L990:
movl 96(%r12), %ecx
movl $23, %eax
movl $24, %edx
cmpl %ecx, 92(%r12)
je .L1030
jmp .L1035
.p2align 4,,10
.p2align 3
.L1033:
testq %rax, %rax
je .L1143
.L1030:
movq %rax, %rdx
subq $1, %rax
movl (%r12,%rax,4), %esi
cmpl %esi, %ecx
je .L1033
cmpl (%r12,%rdx,4), %ecx
je .L1035
movl %esi, %ecx
jmp .L1032
.p2align 4,,10
.p2align 3
.L1036:
cmpq $47, %rdx
je .L1139
.L1035:
movq %rdx, %rsi
addq $1, %rdx
cmpl (%r12,%rdx,4), %ecx
je .L1036
movl $24, %edx
subq $23, %rsi
subq %rax, %rdx
cmpq %rdx, %rsi
jb .L1032
.L1139:
movl (%r12,%rax,4), %ecx
.L1032:
vpbroadcastd %ecx, %zmm1
.L1140:
movl $1, -136(%rbp)
.L1028:
cmpq $0, -120(%rbp)
je .L1144
leaq -16(%rbx), %rdx
vmovdqa32 %zmm1, %zmm0
leaq 0(%r13,%rdx,4), %r10
movq %rdx, %r9
movq %rdx, %rcx
vmovdqu64 (%r10), %zmm13
andl $63, %r9d
andl $48, %ecx
je .L1039
vmovdqu64 0(%r13), %zmm2
vpcmpd $6, %zmm1, %zmm2, %k2
knotw %k2, %k1
vpcompressd %zmm2, 0(%r13){%k1}
kmovw %k1, %eax
kmovw %k2, %ecx
popcntq %rax, %rax
popcntq %rcx, %rcx
leaq 0(%r13,%rax,4), %rax
vpcompressd %zmm2, (%r12){%k2}
testb $32, %dl
je .L1040
vmovdqu64 64(%r13), %zmm1
vpcmpd $6, %zmm0, %zmm1, %k1
knotw %k1, %k2
vpcompressd %zmm1, (%rax){%k2}
kmovw %k2, %esi
popcntq %rsi, %rsi
vpcompressd %zmm1, (%r12,%rcx,4){%k1}
leaq (%rax,%rsi,4), %rax
kmovw %k1, %esi
popcntq %rsi, %rsi
addq %rsi, %rcx
cmpq $47, %r9
jbe .L1040
vmovdqu64 128(%r13), %zmm1
vpcmpd $6, %zmm0, %zmm1, %k1
knotw %k1, %k2
vpcompressd %zmm1, (%rax){%k2}
kmovw %k2, %esi
popcntq %rsi, %rsi
vpcompressd %zmm1, (%r12,%rcx,4){%k1}
leaq (%rax,%rsi,4), %rax
kmovw %k1, %esi
popcntq %rsi, %rsi
addq %rsi, %rcx
leaq 1(%r9), %rsi
cmpq $17, %rsi
leaq 0(,%rcx,4), %r8
sbbq %rsi, %rsi
andq $-32, %rsi
addq $48, %rsi
cmpq %rsi, %r9
jne .L1145
.L1042:
movq %rax, %r9
movq %rdx, %rsi
subq %r13, %r9
subq %rcx, %rsi
sarq $2, %r9
leaq 0(%r13,%rsi,4), %r11
subq %r9, %rdx
subq %r9, %rsi
movq %rdx, %r15
leaq (%rax,%rsi,4), %r10
movq %rsi, %rdx
leaq (%rax,%r15,4), %rdi
vmovq %rdi, %xmm14
.p2align 4,,10
.p2align 3
.L1044:
movl %r8d, %ecx
cmpl $8, %r8d
jnb .L1046
testb $4, %r8b
jne .L1146
testl %ecx, %ecx
jne .L1147
.L1047:
movl %r8d, %ecx
cmpl $8, %r8d
jnb .L1050
andl $4, %r8d
jne .L1148
testl %ecx, %ecx
jne .L1149
.L1051:
testq %rdx, %rdx
je .L1090
.L1065:
leaq 256(%rax), %rsi
leaq -256(%r10), %rdi
vmovdqu64 (%rax), %zmm12
vmovdqu64 64(%rax), %zmm11
vmovdqu64 128(%rax), %zmm10
vmovdqu64 192(%rax), %zmm9
vmovdqu64 -128(%r10), %zmm6
vmovdqu64 -64(%r10), %zmm5
vmovdqu64 -256(%r10), %zmm8
vmovdqu64 -192(%r10), %zmm7
cmpq %rdi, %rsi
je .L1091
xorl %ecx, %ecx
jmp .L1058
.p2align 4,,10
.p2align 3
.L1151:
vmovdqu64 -128(%rdi), %zmm2
vmovdqu64 -64(%rdi), %zmm1
prefetcht0 -1024(%rdi)
subq $256, %rdi
vmovdqu64 (%rdi), %zmm4
vmovdqu64 64(%rdi), %zmm3
.L1057:
vpcmpd $6, %zmm0, %zmm4, %k2
knotw %k2, %k1
kmovw %k1, %r8d
popcntq %r8, %r8
addq %rcx, %r8
vpcompressd %zmm4, (%rax,%rcx,4){%k1}
leaq -16(%rdx,%r8), %rcx
vpcompressd %zmm4, (%rax,%rcx,4){%k2}
vpcmpd $6, %zmm0, %zmm3, %k2
knotw %k2, %k1
kmovw %k1, %ecx
popcntq %rcx, %rcx
addq %r8, %rcx
vpcompressd %zmm3, (%rax,%r8,4){%k1}
leaq -32(%rdx,%rcx), %r8
vpcompressd %zmm3, (%rax,%r8,4){%k2}
vpcmpd $6, %zmm0, %zmm2, %k2
knotw %k2, %k1
kmovw %k1, %r8d
popcntq %r8, %r8
addq %rcx, %r8
vpcompressd %zmm2, (%rax,%rcx,4){%k1}
leaq -48(%rdx,%r8), %rcx
subq $64, %rdx
vpcompressd %zmm2, (%rax,%rcx,4){%k2}
vpcmpd $6, %zmm0, %zmm1, %k2
knotw %k2, %k1
kmovw %k1, %ecx
popcntq %rcx, %rcx
addq %r8, %rcx
vpcompressd %zmm1, (%rax,%r8,4){%k1}
leaq (%rdx,%rcx), %r8
vpcompressd %zmm1, (%rax,%r8,4){%k2}
cmpq %rdi, %rsi
je .L1150
.L1058:
movq %rsi, %r8
subq %rax, %r8
sarq $2, %r8
subq %rcx, %r8
cmpq $64, %r8
ja .L1151
vmovdqu64 (%rsi), %zmm4
vmovdqu64 64(%rsi), %zmm3
prefetcht0 1024(%rsi)
addq $256, %rsi
vmovdqu64 -128(%rsi), %zmm2
vmovdqu64 -64(%rsi), %zmm1
jmp .L1057
.p2align 4,,10
.p2align 3
.L1142:
movl $16, %eax
subq %rdi, %rax
leaq 0(%r13,%rax,4), %r11
leaq -16(%rdi,%rdx), %rax
movq %rax, -136(%rbp)
jmp .L986
.p2align 4,,10
.p2align 3
.L1150:
leaq (%rax,%rcx,4), %rsi
.L1055:
vpcmpd $6, %zmm0, %zmm12, %k1
movq %r15, %rdi
knotw %k1, %k2
vpcompressd %zmm12, (%rsi){%k2}
kmovw %k2, %esi
popcntq %rsi, %rsi
addq %rsi, %rcx
leaq -16(%rdx,%rcx), %rsi
vpcompressd %zmm12, (%rax,%rsi,4){%k1}
vpcmpd $6, %zmm0, %zmm11, %k1
knotw %k1, %k2
kmovw %k2, %esi
popcntq %rsi, %rsi
addq %rcx, %rsi
vpcompressd %zmm11, (%rax,%rcx,4){%k2}
leaq -32(%rdx,%rsi), %rcx
vpcompressd %zmm11, (%rax,%rcx,4){%k1}
vpcmpd $6, %zmm0, %zmm10, %k1
knotw %k1, %k2
kmovw %k2, %ecx
popcntq %rcx, %rcx
addq %rsi, %rcx
vpcompressd %zmm10, (%rax,%rsi,4){%k2}
leaq -48(%rdx,%rcx), %rsi
vpcompressd %zmm10, (%rax,%rsi,4){%k1}
vpcmpd $6, %zmm0, %zmm9, %k1
knotw %k1, %k2
kmovw %k2, %esi
popcntq %rsi, %rsi
addq %rcx, %rsi
vpcompressd %zmm9, (%rax,%rcx,4){%k2}
leaq -64(%rdx,%rsi), %rcx
vpcompressd %zmm9, (%rax,%rcx,4){%k1}
vpcmpd $6, %zmm0, %zmm8, %k1
knotw %k1, %k2
kmovw %k2, %ecx
popcntq %rcx, %rcx
addq %rsi, %rcx
vpcompressd %zmm8, (%rax,%rsi,4){%k2}
leaq -80(%rdx,%rcx), %rsi
vpcompressd %zmm8, (%rax,%rsi,4){%k1}
vpcmpd $6, %zmm0, %zmm7, %k1
knotw %k1, %k2
kmovw %k2, %esi
popcntq %rsi, %rsi
addq %rcx, %rsi
vpcompressd %zmm7, (%rax,%rcx,4){%k2}
leaq -96(%rdx,%rsi), %rcx
vpcompressd %zmm7, (%rax,%rcx,4){%k1}
vpcmpd $6, %zmm0, %zmm6, %k1
knotw %k1, %k2
kmovw %k2, %ecx
popcntq %rcx, %rcx
addq %rsi, %rcx
vpcompressd %zmm6, (%rax,%rsi,4){%k2}
leaq -112(%rdx,%rcx), %rsi
vpcompressd %zmm6, (%rax,%rsi,4){%k1}
vpcmpd $6, %zmm0, %zmm5, %k1
leaq -128(%rdx), %rsi
knotw %k1, %k2
kmovw %k2, %edx
popcntq %rdx, %rdx
addq %rcx, %rdx
vpcompressd %zmm5, (%rax,%rcx,4){%k2}
leaq (%rsi,%rdx), %rcx
subq %rdx, %rdi
vpcompressd %zmm5, (%rax,%rcx,4){%k1}
leaq (%rax,%rdx,4), %rcx
.L1054:
movq %rcx, %rsi
cmpq $15, %rdi
ja .L1059
leaq -64(%rax,%r15,4), %rsi
.L1059:
vmovdqu64 (%rsi), %zmm7
vpcmpd $6, %zmm0, %zmm13, %k2
vmovq %xmm14, %rdi
vmovdqu64 %zmm7, (%rdi)
knotw %k2, %k1
vpcompressd %zmm13, (%rcx){%k1}
kmovw %k1, %ecx
popcntq %rcx, %rcx
addq %rcx, %rdx
vpcompressd %zmm13, (%rax,%rdx,4){%k2}
leaq (%rdx,%r9), %r15
movq -120(%rbp), %r9
subq $1, %r9
cmpl $2, -136(%rbp)
je .L1152
movq -128(%rbp), %rsi
movq %r14, %r8
movq %r12, %rcx
movq %r15, %rdx
movq %r13, %rdi
movq %r9, -120(%rbp)
vzeroupper
call _ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -136(%rbp)
movq -120(%rbp), %r9
je .L1136
.L1061:
subq %r15, %rbx
movq -128(%rbp), %rsi
leaq 0(%r13,%r15,4), %rdi
movq %r14, %r8
movq %rbx, %rdx
movq %r12, %rcx
call _ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1136:
subq $-128, %rsp
popq %rbx
popq %r10
.cfi_remember_state
.cfi_def_cfa 10, 0
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
leaq -8(%r10), %rsp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1050:
.cfi_restore_state
movq (%r12), %rcx
leaq 8(%r11), %rdi
andq $-8, %rdi
movq %rcx, (%r11)
movl %r8d, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r11,%rcx)
movq %r11, %rcx
movq %r12, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L1051
.p2align 4,,10
.p2align 3
.L1046:
movq (%r11), %rcx
leaq 8(%rax), %rdi
andq $-8, %rdi
movq %rcx, (%rax)
movl %r8d, %ecx
movq -8(%r11,%rcx), %rsi
movq %rsi, -8(%rax,%rcx)
movq %rax, %rcx
movq %r11, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L1047
.p2align 4,,10
.p2align 3
.L1143:
movl (%r12), %ecx
jmp .L1032
.p2align 4,,10
.p2align 3
.L1145:
subq %rsi, %r9
leaq 0(%r13,%rsi,4), %r11
leaq (%r12,%r8), %rsi
.L1064:
movq $-1, %rdi
bzhi %r9, %rdi, %rdi
movzwl %di, %edi
kmovd %edi, %k0
.L1045:
vmovdqu64 (%r11), %zmm1
vpcmpd $6, %zmm0, %zmm1, %k1
kandnw %k0, %k1, %k2
vpcompressd %zmm1, (%rax){%k2}
kmovw %k2, %edi
kandw %k0, %k1, %k1
popcntq %rdi, %rdi
leaq (%rax,%rdi,4), %rax
kmovw %k1, %r8d
popcntq %r8, %r8
movq %rax, %r9
addq %rcx, %r8
movq %rdx, %rcx
vpcompressd %zmm1, (%rsi){%k1}
subq %r13, %r9
subq %r8, %rcx
salq $2, %r8
sarq $2, %r9
leaq 0(%r13,%rcx,4), %r11
subq %r9, %rdx
movq %rdx, %r15
movq %rcx, %rdx
subq %r9, %rdx
leaq (%rax,%r15,4), %rdi
leaq (%rax,%rdx,4), %r10
vmovq %rdi, %xmm14
jmp .L1044
.p2align 4,,10
.p2align 3
.L1149:
movzbl (%r12), %esi
movb %sil, (%r11)
testb $2, %cl
je .L1051
movzwl -2(%r12,%rcx), %esi
movw %si, -2(%r11,%rcx)
jmp .L1051
.p2align 4,,10
.p2align 3
.L1147:
movzbl (%r11), %esi
movb %sil, (%rax)
testb $2, %cl
je .L1047
movzwl -2(%r11,%rcx), %esi
movw %si, -2(%rax,%rcx)
jmp .L1047
.p2align 4,,10
.p2align 3
.L1040:
leaq -16(%r9), %rsi
leaq 1(%r9), %rdi
andq $-16, %rsi
leaq 0(,%rcx,4), %r8
addq $16, %rsi
cmpq $16, %rdi
movl $16, %edi
cmovbe %rdi, %rsi
cmpq %r9, %rsi
je .L1042
subq %rsi, %r9
leaq 0(%r13,%rsi,4), %r11
leaq (%r12,%r8), %rsi
cmpq $255, %r9
jbe .L1064
movl $65535, %edi
kmovd %edi, %k0
jmp .L1045
.p2align 4,,10
.p2align 3
.L1141:
cmpq $1, %rdx
jbe .L1136
leaq 1024(%rdi), %rax
cmpq %rax, %rsi
jb .L1153
movl $16, %esi
call _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L1136
.p2align 4,,10
.p2align 3
.L988:
vmovdqu32 0(%r13), %zmm6
movl $16, %edi
movq $-1, %rax
subq -144(%rbp), %rdi
bzhi %rdi, %rax, %rax
kmovw %eax, %k6
vpcmpd $4, %zmm0, %zmm6, %k0
kandw %k6, %k0, %k0
kmovw %k0, %eax
kortestw %k0, %k0
jne .L1154
vpxor %xmm4, %xmm4, %xmm4
leaq 1024(%r13,%rdi,4), %rsi
vmovdqa64 %zmm4, %zmm3
.p2align 4,,10
.p2align 3
.L994:
movq %rdi, %rcx
addq $256, %rdi
cmpq %rdi, %rbx
jb .L998
leaq -1024(%rsi), %rax
.L993:
vpxord (%rax), %zmm0, %zmm1
vpxord 64(%rax), %zmm0, %zmm2
leaq 128(%rax), %rdx
vpord %zmm3, %zmm1, %zmm3
vpord %zmm4, %zmm2, %zmm4
vpxord 128(%rax), %zmm0, %zmm1
vpxord 192(%rax), %zmm0, %zmm2
vpord %zmm3, %zmm1, %zmm3
vpxord 256(%rax), %zmm0, %zmm1
vpord %zmm4, %zmm2, %zmm4
vpxord 320(%rax), %zmm0, %zmm2
leaq 384(%rdx), %rax
vpord %zmm3, %zmm1, %zmm3
vpxord 256(%rdx), %zmm0, %zmm1
vpord %zmm4, %zmm2, %zmm4
vpxord 320(%rdx), %zmm0, %zmm2
vpord %zmm3, %zmm1, %zmm1
vpord %zmm4, %zmm2, %zmm2
vmovdqa64 %zmm1, %zmm3
vmovdqa64 %zmm2, %zmm4
cmpq %rax, %rsi
jne .L993
vpord %zmm2, %zmm1, %zmm1
leaq 1408(%rdx), %rsi
vptestnmd %zmm1, %zmm1, %k0
kortestw %k0, %k0
setc %al
testb %al, %al
jne .L994
vmovdqa32 0(%r13,%rcx,4), %zmm6
vpcmpd $4, %zmm0, %zmm6, %k0
kortestw %k0, %k0
jne .L996
.p2align 4,,10
.p2align 3
.L995:
addq $16, %rcx
vmovdqa32 0(%r13,%rcx,4), %zmm7
vpcmpd $4, %zmm0, %zmm7, %k0
kortestw %k0, %k0
je .L995
.L996:
kmovw %k0, %eax
tzcntl %eax, %eax
addq %rcx, %rax
.L992:
vpbroadcastd 0(%r13,%rax,4), %zmm5
vmovdqa64 %zmm0, %zmm2
leaq 0(%r13,%rax,4), %rdi
vpcmpd $6, %zmm0, %zmm5, %k0
vmovdqa64 %zmm5, %zmm1
kortestw %k0, %k0
jne .L1001
leaq -16(%rbx), %rax
xorl %ecx, %ecx
jmp .L1007
.p2align 4,,10
.p2align 3
.L1002:
kmovw %k0, %edx
popcntq %rdx, %rdx
addq %rdx, %rcx
leaq -16(%rax), %rdx
vmovdqu64 %zmm2, 0(%r13,%rax,4)
cmpq %rdx, %rbx
jbe .L1155
movq %rdx, %rax
.L1007:
vmovdqu32 0(%r13,%rax,4), %zmm6
vpcmpd $0, %zmm5, %zmm6, %k1
vpcmpd $0, %zmm0, %zmm6, %k0
kmovw %k1, %edx
kmovw %k0, %esi
korw %k0, %k1, %k1
kortestw %k1, %k1
jc .L1002
kmovw %edx, %k5
kmovw %esi, %k3
kxnorw %k3, %k5, %k7
kmovw %k7, %edx
tzcntl %edx, %edx
leaq 16(%rax), %rsi
addq %rax, %rdx
addq $32, %rax
vpbroadcastd 0(%r13,%rdx,4), %zmm2
movq %rbx, %rdx
subq %rcx, %rdx
vmovdqa64 %zmm2, %zmm0
vmovdqa64 %zmm2, -112(%rbp)
cmpq %rdx, %rax
ja .L1003
.p2align 4,,10
.p2align 3
.L1004:
vmovdqu64 %zmm1, -64(%r13,%rax,4)
movq %rax, %rsi
addq $16, %rax
cmpq %rdx, %rax
jbe .L1004
.L1003:
subq %rsi, %rdx
leaq 0(%r13,%rsi,4), %rcx
movl $65535, %eax
cmpq $255, %rdx
ja .L1005
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzwl %ax, %eax
.L1005:
kmovw %eax, %k3
vmovdqu32 %zmm5, (%rcx){%k3}
.L1006:
vpbroadcastd (%r12), %zmm3
vpcmpd $0, .LC8(%rip), %zmm3, %k0
vmovdqa64 %zmm3, %zmm1
kortestw %k0, %k0
jc .L1086
vpcmpd $0, .LC9(%rip), %zmm3, %k0
kortestw %k0, %k0
jc .L1024
vpminsd %zmm0, %zmm5, %zmm2
vpcmpd $6, %zmm2, %zmm3, %k0
kortestw %k0, %k0
jne .L1156
vmovdqa64 %zmm3, %zmm2
movl $256, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1019:
movq %rax, %rdx
addq $1, %rax
salq $4, %rdx
addq %rcx, %rdx
vpminsd 0(%r13,%rdx,4), %zmm2, %zmm0
vmovdqa64 %zmm0, %zmm2
cmpq $16, %rax
jne .L1019
vpcmpd $6, %zmm0, %zmm3, %k0
kortestw %k0, %k0
jne .L1140
leaq 256(%rsi), %rax
cmpq %rax, %rbx
jb .L1026
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1019
.p2align 4,,10
.p2align 3
.L998:
movq %rcx, %rdx
addq $16, %rcx
cmpq %rcx, %rbx
jb .L1157
vmovdqa32 -64(%r13,%rcx,4), %zmm6
vpcmpd $4, %zmm0, %zmm6, %k0
kmovw %k0, %eax
kortestw %k0, %k0
je .L998
.L1138:
tzcntl %eax, %eax
addq %rdx, %rax
jmp .L992
.p2align 4,,10
.p2align 3
.L1039:
movq %r12, %rsi
movq %r13, %r11
movq %r13, %rax
movq %rdx, %r15
vmovq %r10, %xmm14
testq %r9, %r9
jne .L1064
jmp .L1065
.L1152:
vzeroupper
jmp .L1061
.L1091:
movq %rax, %rsi
xorl %ecx, %ecx
jmp .L1055
.L1090:
movq %rax, %rcx
movq %r15, %rdi
jmp .L1054
.L1144:
leaq -1(%rbx), %r12
movq %r12, %r14
shrq %r14
.p2align 4,,10
.p2align 3
.L1037:
movq %r14, %rdx
movq %rbx, %rsi
movq %r13, %rdi
call _ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %r14
jnb .L1037
.p2align 4,,10
.p2align 3
.L1038:
movl 0(%r13,%r12,4), %edx
movl 0(%r13), %eax
movq %r12, %rsi
movq %r13, %rdi
movl %edx, 0(%r13)
xorl %edx, %edx
movl %eax, 0(%r13,%r12,4)
call _ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %r12
jne .L1038
jmp .L1136
.p2align 4,,10
.p2align 3
.L1027:
vpcmpd $6, -64(%r13,%rsi,4), %zmm3, %k0
kortestw %k0, %k0
jne .L1140
.L1026:
movq %rsi, %rax
addq $16, %rsi
cmpq %rsi, %rbx
jnb .L1027
cmpq %rax, %rbx
je .L1086
vpcmpd $6, -64(%r13,%rbx,4), %zmm3, %k0
xorl %eax, %eax
kortestw %k0, %k0
sete %al
addl $1, %eax
movl %eax, -136(%rbp)
jmp .L1028
.L1146:
movl (%r11), %esi
movl %esi, (%rax)
movl -4(%r11,%rcx), %esi
movl %esi, -4(%rax,%rcx)
jmp .L1047
.L1148:
movl (%r12), %esi
movl %esi, (%r11)
movl -4(%r12,%rcx), %esi
movl %esi, -4(%r11,%rcx)
jmp .L1051
.L1001:
movq %rbx, %rsi
leaq -112(%rbp), %rdx
movq %r12, %rcx
subq %rax, %rsi
call _ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1136
vmovdqa64 -112(%rbp), %zmm0
jmp .L1006
.L1155:
movl $65535, %edi
vmovdqu64 0(%r13), %zmm2
kmovd %edi, %k2
cmpq $255, %rax
ja .L1008
movq $-1, %rdx
bzhi %rax, %rdx, %rdx
movzwl %dx, %edi
kmovd %edi, %k2
.L1008:
vpcmpd $0, %zmm5, %zmm2, %k0
vpcmpd $0, %zmm0, %zmm2, %k1
movq %rbx, %rdx
kandw %k2, %k1, %k1
knotw %k2, %k2
korw %k1, %k0, %k0
korw %k2, %k0, %k0
kortestw %k0, %k0
setc %sil
subq %rcx, %rdx
testb %sil, %sil
je .L1158
xorl %ecx, %ecx
kmovw %k1, %eax
vmovdqu64 %zmm0, 0(%r13)
popcntq %rax, %rcx
movq %rdx, %rax
subq %rcx, %rax
cmpq $15, %rax
jbe .L1013
leaq -16(%rax), %rcx
movq -152(%rbp), %rsi
movq %rcx, %rdx
shrq $4, %rdx
salq $6, %rdx
leaq 64(%r13,%rdx), %rdx
.p2align 4,,10
.p2align 3
.L1014:
vmovdqu64 %zmm1, (%rsi)
addq $64, %rsi
cmpq %rdx, %rsi
jne .L1014
andq $-16, %rcx
movl $65535, %ebx
vmovdqa64 %zmm5, (%r12)
leaq 16(%rcx), %rdx
kmovd %ebx, %k1
subq %rdx, %rax
leaq 0(%r13,%rdx,4), %r13
cmpq $255, %rax
jbe .L1066
.L1015:
vmovdqu32 (%r12), %zmm0{%k1}{z}
vmovdqu32 %zmm0, 0(%r13){%k1}
vzeroupper
jmp .L1136
.L1023:
vmovdqu32 -64(%r13,%rsi,4), %zmm7
vpcmpd $6, %zmm3, %zmm7, %k0
kortestw %k0, %k0
jne .L1140
.L1022:
movq %rsi, %rax
addq $16, %rsi
cmpq %rsi, %rbx
jnb .L1023
cmpq %rax, %rbx
je .L1024
vmovdqu32 -64(%r13,%rbx,4), %zmm7
vpcmpd $6, %zmm3, %zmm7, %k0
kortestw %k0, %k0
jne .L1140
.L1024:
movl $3, -136(%rbp)
vpternlogd $0xFF, %zmm1, %zmm1, %zmm1
vpaddd %zmm1, %zmm3, %zmm1
jmp .L1028
.L1157:
leaq -16(%rbx), %rdx
vmovdqu32 0(%r13,%rdx,4), %zmm7
vpcmpd $4, %zmm0, %zmm7, %k0
kmovw %k0, %eax
kortestw %k0, %k0
jne .L1138
vzeroupper
jmp .L1136
.L1154:
tzcntl %eax, %eax
jmp .L992
.L1153:
xorl %eax, %eax
cmpq $15, %rdx
jbe .L980
leaq -16(%rdx), %rdx
movq (%rdi), %rcx
movq %rdx, %rax
shrq $4, %rax
movq %rcx, (%r12)
addq $1, %rax
salq $6, %rax
movl %eax, %ecx
movq -8(%rdi,%rcx), %rsi
leaq 8(%r12), %rdi
andq $-8, %rdi
movq %rsi, -8(%r12,%rcx)
movq %r12, %rcx
movq %r13, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
shrl $3, %ecx
andq $-16, %rax
rep movsq
addq $16, %rax
.L980:
movq %rbx, %rdx
leaq 0(,%rax,4), %r14
subq %rax, %rdx
movl $65535, %eax
leaq (%r12,%r14), %r15
addq %r13, %r14
kmovd %eax, %k4
cmpq $255, %rdx
ja .L981
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzwl %ax, %eax
kmovd %eax, %k4
.L981:
leal -1(%rbx), %eax
movl $32, %edx
movl $1, %esi
vmovdqu32 (%r14), %zmm0{%k4}{z}
bsrl %eax, %eax
xorl $31, %eax
vmovdqu32 %zmm0, (%r15){%k4}
vpbroadcastq .LC10(%rip), %zmm0
subl %eax, %edx
movl $1, %eax
shlx %rdx, %rsi, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %rbx, %rax
leaq 1(%rsi), %rdx
salq $4, %rdx
cmpq %rdx, %rbx
jnb .L985
.L982:
vmovdqu64 %zmm0, (%r12,%rax,4)
addq $16, %rax
cmpq %rdx, %rax
jb .L982
.L985:
movq %r12, %rdi
vzeroupper
call _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
cmpq $15, %rbx
jbe .L984
leaq -16(%rbx), %rax
movq (%r12), %rdx
leaq 8(%r13), %rdi
movq %r12, %rsi
shrq $4, %rax
andq $-8, %rdi
addq $1, %rax
movq %rdx, 0(%r13)
salq $6, %rax
movl %eax, %edx
movq -8(%r12,%rdx), %rcx
movq %rcx, -8(%r13,%rdx)
subq %rdi, %r13
leal (%rax,%r13), %ecx
subq %r13, %rsi
shrl $3, %ecx
rep movsq
.L984:
vmovdqu32 (%r15), %zmm0{%k4}{z}
vmovdqu32 %zmm0, (%r14){%k4}
vzeroupper
jmp .L1136
.L1013:
vmovdqa64 %zmm5, (%r12)
.L1066:
movq $-1, %rdx
bzhi %rax, %rdx, %rax
movzwl %ax, %eax
kmovd %eax, %k1
jmp .L1015
.L1086:
movl $2, -136(%rbp)
jmp .L1028
.L1156:
vpmaxsd %zmm0, %zmm5, %zmm5
vpcmpd $6, %zmm3, %zmm5, %k0
kortestw %k0, %k0
jne .L1140
vmovdqa64 %zmm3, %zmm2
movl $256, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1020:
movq %rax, %rdx
addq $1, %rax
salq $4, %rdx
addq %rcx, %rdx
vpmaxsd 0(%r13,%rdx,4), %zmm2, %zmm0
vmovdqa64 %zmm0, %zmm2
cmpq $16, %rax
jne .L1020
vpcmpd $6, %zmm3, %zmm0, %k0
kortestw %k0, %k0
jne .L1140
leaq 256(%rsi), %rax
cmpq %rax, %rbx
jb .L1022
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1020
.L1158:
knotw %k0, %k7
kmovw %k7, %ecx
tzcntl %ecx, %ecx
vpbroadcastd 0(%r13,%rcx,4), %zmm2
leaq 16(%rax), %rcx
vmovdqa64 %zmm2, %zmm0
vmovdqa64 %zmm2, -112(%rbp)
cmpq %rdx, %rcx
ja .L1010
.L1011:
vmovdqu64 %zmm1, -64(%r13,%rcx,4)
movq %rcx, %rax
addq $16, %rcx
cmpq %rdx, %rcx
jbe .L1011
.L1010:
subq %rax, %rdx
leaq 0(%r13,%rax,4), %rsi
movl $-1, %ecx
cmpq $255, %rdx
ja .L1012
orq $-1, %rcx
bzhi %rdx, %rcx, %rcx
.L1012:
kmovw %ecx, %k5
vmovdqu32 %zmm5, (%rsi){%k5}
jmp .L1006
.cfi_endproc
.LFE18802:
.size _ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18804:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
pushq %r13
.cfi_offset 15, -24
.cfi_offset 14, -32
.cfi_offset 13, -40
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -48
movq %rcx, %r12
pushq %rbx
subq $88, %rsp
.cfi_offset 3, -56
movq %rsi, -96(%rbp)
movq %rdx, -72(%rbp)
movq %r8, -80(%rbp)
movq %r9, -88(%rbp)
cmpq $64, %rdx
jbe .L1449
movq %rdi, %rax
movq %rdi, -120(%rbp)
shrq $2, %rax
movq %rax, %rdx
movq %rax, -112(%rbp)
andl $15, %edx
jne .L1450
movq -72(%rbp), %r14
movq %rdi, %rax
movq %r8, %r15
.L1172:
movq 8(%r15), %rcx
movq 16(%r15), %r10
movq %rcx, %rsi
leaq 1(%r10), %r8
movq %rcx, %rdi
xorq (%r15), %r8
rolq $24, %rsi
shrq $11, %rdi
leaq (%rcx,%rcx,8), %rdx
leaq 2(%r10), %rcx
addq %r8, %rsi
xorq %rdi, %rdx
movq %rsi, %rdi
xorq %rcx, %rdx
leaq (%rsi,%rsi,8), %rcx
movq %rsi, %r9
rolq $24, %rdi
shrq $11, %r9
leaq 3(%r10), %rsi
addq %rdx, %rdi
xorq %r9, %rcx
movq %rdi, %r11
xorq %rsi, %rcx
leaq (%rdi,%rdi,8), %rsi
movq %rdi, %r9
rolq $24, %r11
shrq $11, %r9
leaq 4(%r10), %rdi
addq $5, %r10
addq %rcx, %r11
xorq %r9, %rsi
movq %r10, 16(%r15)
movq %r11, %r9
xorq %rdi, %rsi
leaq (%r11,%r11,8), %rdi
movq %r11, %rbx
rolq $24, %r9
shrq $11, %rbx
addq %rsi, %r9
xorq %rbx, %rdi
movq %r9, %rbx
leaq (%r9,%r9,8), %r11
xorq %r10, %rdi
rolq $24, %r9
shrq $11, %rbx
addq %rdi, %r9
movl %r8d, %r10d
movl %edi, %edi
xorq %rbx, %r11
movq %r14, %rbx
movq %r11, %xmm0
shrq $4, %rbx
movl %ecx, %r11d
pinsrq $1, %r9, %xmm0
movabsq $68719476719, %r9
cmpq %r9, %r14
movl $4294967295, %r9d
movups %xmm0, (%r15)
movl %edx, %r15d
cmova %r9, %rbx
shrq $32, %r8
movl %esi, %r9d
shrq $32, %rdx
imulq %rbx, %r15
shrq $32, %rcx
shrq $32, %rsi
imulq %rbx, %r10
imulq %rbx, %r8
shrq $32, %r15
imulq %rbx, %rdx
imulq %rbx, %r11
shrq $32, %r10
imulq %rbx, %rcx
shrq $32, %r8
imulq %rbx, %r9
shrq $32, %rdx
imulq %rbx, %rsi
shrq $32, %r11
imulq %rbx, %rdi
movq %r15, %rbx
shrq $32, %rcx
salq $6, %rbx
shrq $32, %r9
movdqa (%rax,%rbx), %xmm1
movq %r10, %rbx
shrq $32, %rsi
salq $6, %rbx
shrq $32, %rdi
movdqa (%rax,%rbx), %xmm0
movq %r8, %rbx
salq $4, %r10
salq $6, %rbx
movdqa %xmm0, %xmm4
pmaxsd %xmm1, %xmm0
pminsd %xmm1, %xmm4
pmaxsd (%rax,%rbx), %xmm4
movq %rcx, %rbx
salq $6, %rbx
movdqa (%rax,%rbx), %xmm1
movq %rdx, %rbx
pminsd %xmm0, %xmm4
salq $6, %rbx
movaps %xmm4, (%r12)
movdqa (%rax,%rbx), %xmm0
movq %r11, %rbx
salq $6, %rbx
movdqa %xmm0, %xmm12
pmaxsd %xmm1, %xmm0
pminsd %xmm1, %xmm12
pmaxsd (%rax,%rbx), %xmm12
movq %rdi, %rbx
salq $6, %rbx
movdqa (%rax,%rbx), %xmm1
movq %r9, %rbx
pminsd %xmm0, %xmm12
salq $6, %rbx
movaps %xmm12, 64(%r12)
movdqa (%rax,%rbx), %xmm0
movq %rsi, %rbx
salq $6, %rbx
addq $4, %r10
salq $4, %r15
movdqa %xmm0, %xmm8
addq $4, %r15
pmaxsd %xmm1, %xmm0
salq $4, %r8
pminsd %xmm1, %xmm8
movdqa (%rax,%r10,4), %xmm1
salq $4, %rdx
salq $4, %rcx
pmaxsd (%rax,%rbx), %xmm8
addq $4, %rdx
addq $4, %rcx
salq $4, %r11
movdqa (%rax,%r15,4), %xmm2
salq $4, %r9
salq $4, %rdi
leaq 0(,%r15,4), %r14
pminsd %xmm0, %xmm8
movdqa %xmm1, %xmm0
addq $4, %r9
addq $4, %rdi
pminsd %xmm2, %xmm0
pmaxsd 16(%rax,%r8,4), %xmm0
salq $4, %rsi
movaps %xmm8, 128(%r12)
pmaxsd %xmm2, %xmm1
movdqa (%rax,%rcx,4), %xmm2
leaq 0(,%r10,4), %rbx
pminsd %xmm1, %xmm0
movdqa (%rax,%rdx,4), %xmm1
movdqa 16(%rax,%rbx), %xmm14
leaq 0(,%rdx,4), %r10
pminsd 16(%rax,%r14), %xmm14
movaps %xmm0, 16(%r12)
leaq 0(,%rcx,4), %r15
movdqa %xmm1, %xmm11
pmaxsd %xmm2, %xmm1
leaq 0(,%r9,4), %rdx
pminsd %xmm2, %xmm11
pmaxsd 16(%rax,%r11,4), %xmm11
movdqa (%rax,%rdi,4), %xmm2
leaq 0(,%rdi,4), %rcx
pminsd %xmm1, %xmm11
movdqa (%rax,%r9,4), %xmm1
movaps %xmm11, 80(%r12)
movdqa %xmm1, %xmm7
pmaxsd %xmm2, %xmm1
pminsd %xmm2, %xmm7
pmaxsd 16(%rax,%rsi,4), %xmm7
pminsd %xmm1, %xmm7
movdqa 16(%rax,%rbx), %xmm1
movaps %xmm7, 144(%r12)
pmaxsd 16(%rax,%r14), %xmm1
movdqa 16(%rax,%r10), %xmm10
pmaxsd 32(%rax,%r8,4), %xmm14
pminsd 16(%rax,%r15), %xmm10
pmaxsd 32(%rax,%r11,4), %xmm10
movdqa 16(%rax,%rdx), %xmm6
pminsd %xmm1, %xmm14
movdqa 16(%rax,%r10), %xmm1
pmaxsd 16(%rax,%r15), %xmm1
pminsd 16(%rax,%rcx), %xmm6
pmaxsd 32(%rax,%rsi,4), %xmm6
movaps %xmm14, 32(%r12)
pminsd %xmm1, %xmm10
movdqa 16(%rax,%rdx), %xmm1
pmaxsd 16(%rax,%rcx), %xmm1
movdqa 32(%rax,%r14), %xmm2
movaps %xmm10, 96(%r12)
leaq 192(%r12), %r14
pminsd %xmm1, %xmm6
movdqa 32(%rax,%rbx), %xmm1
movaps %xmm6, 160(%r12)
movdqa %xmm1, %xmm13
pmaxsd %xmm2, %xmm1
pminsd %xmm2, %xmm13
pmaxsd 48(%rax,%r8,4), %xmm13
movdqa 32(%rax,%r15), %xmm2
pminsd %xmm1, %xmm13
movdqa 32(%rax,%r10), %xmm1
movaps %xmm13, 48(%r12)
movdqa %xmm1, %xmm9
pmaxsd %xmm2, %xmm1
pminsd %xmm2, %xmm9
pmaxsd 48(%rax,%r11,4), %xmm9
movdqa 32(%rax,%rcx), %xmm2
pminsd %xmm1, %xmm9
movdqa 32(%rax,%rdx), %xmm1
movaps %xmm9, 112(%r12)
movdqa %xmm1, %xmm5
pmaxsd %xmm2, %xmm1
pminsd %xmm2, %xmm5
pmaxsd 48(%rax,%rsi,4), %xmm5
pshufd $0, %xmm4, %xmm2
pxor %xmm2, %xmm4
pxor %xmm2, %xmm14
pxor %xmm2, %xmm13
pminsd %xmm1, %xmm5
movdqa %xmm0, %xmm1
pxor %xmm2, %xmm12
pxor %xmm2, %xmm1
pxor %xmm2, %xmm11
pxor %xmm2, %xmm10
movaps %xmm5, 176(%r12)
por %xmm4, %xmm1
pxor %xmm2, %xmm9
pxor %xmm2, %xmm8
movdqa 192(%r12), %xmm4
por %xmm14, %xmm1
pxor %xmm2, %xmm7
pxor %xmm2, %xmm6
por %xmm13, %xmm1
pxor %xmm2, %xmm5
pxor %xmm2, %xmm4
por %xmm12, %xmm1
pxor %xmm0, %xmm0
movdqa %xmm2, %xmm3
por %xmm11, %xmm1
por %xmm10, %xmm1
por %xmm9, %xmm1
por %xmm8, %xmm1
por %xmm7, %xmm1
por %xmm6, %xmm1
por %xmm5, %xmm1
por %xmm1, %xmm4
pblendvb %xmm0, %xmm4, %xmm1
pxor %xmm0, %xmm0
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
je .L1174
movdqa .LC4(%rip), %xmm0
movl $4, %esi
movq %r12, %rdi
movups %xmm0, 192(%r12)
movups %xmm0, 208(%r12)
movups %xmm0, 224(%r12)
movups %xmm0, 240(%r12)
movups %xmm0, 256(%r12)
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
movd (%r12), %xmm6
pcmpeqd %xmm2, %xmm2
movd 188(%r12), %xmm5
pshufd $0, %xmm5, %xmm1
pshufd $0, %xmm6, %xmm0
paddd %xmm1, %xmm2
pcmpeqd %xmm0, %xmm2
movmskps %xmm2, %eax
cmpl $15, %eax
jne .L1176
movq -72(%rbp), %rsi
leaq -64(%rbp), %rdx
movq %r14, %rcx
movq %r13, %rdi
call _ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1159
.L1176:
movl 96(%r12), %ecx
movl $23, %eax
movl $24, %edx
cmpl %ecx, 92(%r12)
je .L1218
jmp .L1223
.p2align 4,,10
.p2align 3
.L1221:
testq %rax, %rax
je .L1451
.L1218:
movq %rax, %rdx
subq $1, %rax
movl (%r12,%rax,4), %esi
cmpl %esi, %ecx
je .L1221
cmpl (%r12,%rdx,4), %ecx
je .L1223
movl %esi, %ecx
jmp .L1220
.p2align 4,,10
.p2align 3
.L1224:
cmpq $47, %rdx
je .L1442
.L1223:
movq %rdx, %rsi
addq $1, %rdx
cmpl (%r12,%rdx,4), %ecx
je .L1224
movl $24, %edx
subq $23, %rsi
subq %rax, %rdx
cmpq %rdx, %rsi
jb .L1220
.L1442:
movl (%r12,%rax,4), %ecx
.L1220:
movd %ecx, %xmm6
pshufd $0, %xmm6, %xmm1
.L1443:
movl $1, -112(%rbp)
.L1217:
cmpq $0, -88(%rbp)
je .L1452
movq -72(%rbp), %rax
movdqa %xmm1, %xmm4
leaq -4(%rax), %r10
movq %r10, %rdx
movq %r10, %rcx
movdqu 0(%r13,%r10,4), %xmm6
andl $15, %edx
andl $12, %ecx
je .L1290
movdqu 0(%r13), %xmm2
pcmpeqd %xmm0, %xmm0
xorl %edi, %edi
movdqa .LC0(%rip), %xmm5
leaq _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %r9
movdqa %xmm2, %xmm3
pcmpgtd %xmm1, %xmm3
movdqa %xmm2, %xmm1
pxor %xmm3, %xmm0
movmskps %xmm0, %eax
popcntq %rax, %rdi
movq %rdi, %xmm0
salq $4, %rax
movq %rdi, %rcx
pshufd $0, %xmm0, %xmm0
pshufb (%r9,%rax), %xmm1
pcmpgtd %xmm5, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L1228
movd %xmm1, 0(%r13)
.L1228:
pextrd $1, %xmm0, %eax
testl %eax, %eax
je .L1229
pextrd $1, %xmm1, 4(%r13)
.L1229:
pextrd $2, %xmm0, %eax
testl %eax, %eax
je .L1230
pextrd $2, %xmm1, 8(%r13)
.L1230:
pextrd $3, %xmm0, %eax
testl %eax, %eax
je .L1231
pextrd $3, %xmm1, 12(%r13)
.L1231:
leaq 0(%r13,%rcx,4), %rax
xorl %esi, %esi
movmskps %xmm3, %ecx
popcntq %rcx, %rsi
salq $4, %rcx
pshufb (%r9,%rcx), %xmm2
movups %xmm2, (%r12)
testb $8, %r10b
je .L1232
movdqu 16(%r13), %xmm1
pcmpeqd %xmm0, %xmm0
xorl %edi, %edi
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pcmpgtd %xmm4, %xmm2
pxor %xmm2, %xmm0
movmskps %xmm0, %ecx
popcntq %rcx, %rdi
movq %rdi, %xmm0
salq $4, %rcx
pshufd $0, %xmm0, %xmm0
pshufb (%r9,%rcx), %xmm3
pcmpgtd %xmm5, %xmm0
movd %xmm0, %ecx
testl %ecx, %ecx
je .L1233
movd %xmm3, (%rax)
.L1233:
pextrd $1, %xmm0, %ecx
testl %ecx, %ecx
je .L1234
pextrd $1, %xmm3, 4(%rax)
.L1234:
pextrd $2, %xmm0, %ecx
testl %ecx, %ecx
je .L1235
pextrd $2, %xmm3, 8(%rax)
.L1235:
pextrd $3, %xmm0, %ecx
testl %ecx, %ecx
je .L1236
pextrd $3, %xmm3, 12(%rax)
.L1236:
movmskps %xmm2, %ecx
leaq (%rax,%rdi,4), %rax
movq %rcx, %rdi
popcntq %rcx, %rcx
salq $4, %rdi
pshufb (%r9,%rdi), %xmm1
movups %xmm1, (%r12,%rsi,4)
addq %rcx, %rsi
cmpq $11, %rdx
jbe .L1232
movdqu 32(%r13), %xmm1
pcmpeqd %xmm0, %xmm0
xorl %edi, %edi
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm3
pcmpgtd %xmm4, %xmm2
pxor %xmm2, %xmm0
movmskps %xmm0, %ecx
popcntq %rcx, %rdi
movq %rdi, %xmm0
salq $4, %rcx
pshufd $0, %xmm0, %xmm0
pshufb (%r9,%rcx), %xmm3
pcmpgtd %xmm5, %xmm0
movd %xmm0, %ecx
testl %ecx, %ecx
je .L1237
movd %xmm3, (%rax)
.L1237:
pextrd $1, %xmm0, %ecx
testl %ecx, %ecx
je .L1238
pextrd $1, %xmm3, 4(%rax)
.L1238:
pextrd $2, %xmm0, %ecx
testl %ecx, %ecx
je .L1239
pextrd $2, %xmm3, 8(%rax)
.L1239:
pextrd $3, %xmm0, %ecx
testl %ecx, %ecx
je .L1240
pextrd $3, %xmm3, 12(%rax)
.L1240:
movmskps %xmm2, %ecx
leaq (%rax,%rdi,4), %rax
movq %rcx, %rdi
popcntq %rcx, %rcx
salq $4, %rdi
pshufb (%r9,%rdi), %xmm1
movups %xmm1, (%r12,%rsi,4)
addq %rcx, %rsi
.L1232:
leaq -4(%rdx), %rcx
leaq 1(%rdx), %rdi
andq $-4, %rcx
leaq 0(,%rsi,4), %r8
addq $4, %rcx
cmpq $4, %rdi
movl $4, %edi
cmovbe %rdi, %rcx
.L1227:
cmpq %rdx, %rcx
je .L1241
movdqu 0(%r13,%rcx,4), %xmm2
subq %rcx, %rdx
xorl %edi, %edi
movd %edx, %xmm7
movdqa %xmm2, %xmm3
pshufd $0, %xmm7, %xmm0
movdqa %xmm2, %xmm7
pcmpgtd %xmm4, %xmm3
pcmpgtd %xmm5, %xmm0
movdqa %xmm3, %xmm1
pandn %xmm0, %xmm1
movmskps %xmm1, %edx
popcntq %rdx, %rdi
movq %rdi, %xmm1
salq $4, %rdx
movq %rdi, %rcx
pshufd $0, %xmm1, %xmm1
pshufb (%r9,%rdx), %xmm7
pcmpgtd %xmm5, %xmm1
movd %xmm1, %edx
testl %edx, %edx
je .L1242
movd %xmm7, (%rax)
.L1242:
pextrd $1, %xmm1, %edx
testl %edx, %edx
je .L1243
pextrd $1, %xmm7, 4(%rax)
.L1243:
pextrd $2, %xmm1, %edx
testl %edx, %edx
je .L1244
pextrd $2, %xmm7, 8(%rax)
.L1244:
pextrd $3, %xmm1, %edx
testl %edx, %edx
je .L1245
pextrd $3, %xmm7, 12(%rax)
.L1245:
pand %xmm0, %xmm3
leaq (%rax,%rcx,4), %rax
movmskps %xmm3, %edx
movq %rdx, %rcx
popcntq %rdx, %rdx
addq %rdx, %rsi
salq $4, %rcx
pshufb (%r9,%rcx), %xmm2
movups %xmm2, (%r12,%r8)
leaq 0(,%rsi,4), %r8
.L1241:
movq %r10, %rdx
movl %r8d, %ecx
subq %rsi, %rdx
leaq 0(%r13,%rdx,4), %r11
cmpl $8, %r8d
jnb .L1246
testb $4, %r8b
jne .L1453
testl %ecx, %ecx
jne .L1454
.L1247:
movl %r8d, %ecx
cmpl $8, %r8d
jnb .L1250
andl $4, %r8d
jne .L1455
testl %ecx, %ecx
jne .L1456
.L1251:
movq %rax, %rcx
movq %r10, %r14
subq %r13, %rcx
sarq $2, %rcx
subq %rcx, %r14
subq %rcx, %rdx
movq %rcx, %r15
leaq (%rax,%rdx,4), %rcx
je .L1291
leaq 64(%rax), %rsi
leaq -64(%rcx), %r10
movdqu (%rax), %xmm14
movdqu 16(%rax), %xmm13
movdqu 32(%rax), %xmm12
movdqu 48(%rax), %xmm11
movdqu -64(%rcx), %xmm10
movdqu -48(%rcx), %xmm9
movdqu -32(%rcx), %xmm8
movdqu -16(%rcx), %xmm7
cmpq %r10, %rsi
je .L1292
xorl %ecx, %ecx
leaq _ZZN3hwy6N_SSE46detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rdi
movl $4, %r11d
jmp .L1258
.p2align 4,,10
.p2align 3
.L1458:
movdqu -64(%r10), %xmm3
movdqu -48(%r10), %xmm2
prefetcht0 -256(%r10)
subq $64, %r10
movdqu 32(%r10), %xmm1
movdqu 48(%r10), %xmm0
.L1257:
movdqa %xmm3, %xmm15
pcmpgtd %xmm4, %xmm15
movmskps %xmm15, %r8d
movq %r8, %rbx
popcntq %r8, %r8
salq $4, %rbx
pshufb (%rdi,%rbx), %xmm3
leaq -4(%rcx,%rdx), %rbx
movups %xmm3, (%rax,%rcx,4)
addq $4, %rcx
movups %xmm3, (%rax,%rbx,4)
movdqa %xmm2, %xmm3
subq %r8, %rcx
pcmpgtd %xmm4, %xmm3
movmskps %xmm3, %r8d
movq %r8, %rbx
popcntq %r8, %r8
salq $4, %rbx
pshufb (%rdi,%rbx), %xmm2
leaq -8(%rcx,%rdx), %rbx
movups %xmm2, (%rax,%rcx,4)
movups %xmm2, (%rax,%rbx,4)
movdqa %xmm1, %xmm2
movq %r11, %rbx
pcmpgtd %xmm4, %xmm2
subq %r8, %rbx
addq %rbx, %rcx
movmskps %xmm2, %r8d
movq %r8, %rbx
popcntq %r8, %r8
salq $4, %rbx
pshufb (%rdi,%rbx), %xmm1
leaq -12(%rcx,%rdx), %rbx
subq $16, %rdx
movups %xmm1, (%rax,%rcx,4)
movups %xmm1, (%rax,%rbx,4)
movdqa %xmm0, %xmm1
movq %r11, %rbx
pcmpgtd %xmm4, %xmm1
subq %r8, %rbx
leaq (%rbx,%rcx), %r8
movmskps %xmm1, %ecx
movq %rcx, %rbx
popcntq %rcx, %rcx
salq $4, %rbx
pshufb (%rdi,%rbx), %xmm0
leaq (%r8,%rdx), %rbx
movups %xmm0, (%rax,%r8,4)
movups %xmm0, (%rax,%rbx,4)
movq %r11, %rbx
subq %rcx, %rbx
leaq (%rbx,%r8), %rcx
cmpq %r10, %rsi
je .L1457
.L1258:
movq %rsi, %r8
subq %rax, %r8
sarq $2, %r8
subq %rcx, %r8
cmpq $16, %r8
ja .L1458
movdqu (%rsi), %xmm3
movdqu 16(%rsi), %xmm2
prefetcht0 256(%rsi)
addq $64, %rsi
movdqu -32(%rsi), %xmm1
movdqu -16(%rsi), %xmm0
jmp .L1257
.p2align 4,,10
.p2align 3
.L1450:
movl $16, %eax
movq %r8, %r15
subq %rdx, %rax
leaq (%rdi,%rax,4), %rax
movq -72(%rbp), %rdi
leaq -16(%rdx,%rdi), %r14
jmp .L1172
.p2align 4,,10
.p2align 3
.L1457:
leaq (%rax,%rcx,4), %r10
leaq (%rdx,%rcx), %r8
addq $4, %rcx
.L1255:
movdqa %xmm14, %xmm0
pcmpgtd %xmm4, %xmm0
movmskps %xmm0, %esi
movdqa %xmm13, %xmm0
pcmpgtd %xmm4, %xmm0
movq %rsi, %r11
popcntq %rsi, %rsi
subq %rsi, %rcx
salq $4, %r11
pshufb (%rdi,%r11), %xmm14
movmskps %xmm0, %esi
movdqa %xmm12, %xmm0
movups %xmm14, (%r10)
pcmpgtd %xmm4, %xmm0
movups %xmm14, -16(%rax,%r8,4)
movq %rsi, %r8
popcntq %rsi, %rsi
salq $4, %r8
pshufb (%rdi,%r8), %xmm13
leaq -8(%rdx,%rcx), %r8
movups %xmm13, (%rax,%rcx,4)
subq %rsi, %rcx
movups %xmm13, (%rax,%r8,4)
movmskps %xmm0, %r8d
addq $4, %rcx
movdqa %xmm11, %xmm0
movq %r8, %rsi
pcmpgtd %xmm4, %xmm0
popcntq %r8, %r8
salq $4, %rsi
pshufb (%rdi,%rsi), %xmm12
leaq -12(%rdx,%rcx), %rsi
movups %xmm12, (%rax,%rcx,4)
movups %xmm12, (%rax,%rsi,4)
movl $4, %esi
movq %rsi, %r10
subq %r8, %r10
movmskps %xmm0, %r8d
movdqa %xmm10, %xmm0
addq %r10, %rcx
pcmpgtd %xmm4, %xmm0
movq %r8, %r10
popcntq %r8, %r8
salq $4, %r10
pshufb (%rdi,%r10), %xmm11
leaq -16(%rdx,%rcx), %r10
movups %xmm11, (%rax,%rcx,4)
movups %xmm11, (%rax,%r10,4)
movq %rsi, %r10
subq %r8, %r10
leaq (%r10,%rcx), %r8
movmskps %xmm0, %ecx
movdqa %xmm9, %xmm0
movq %rcx, %r10
pcmpgtd %xmm4, %xmm0
popcntq %rcx, %rcx
salq $4, %r10
pshufb (%rdi,%r10), %xmm10
leaq -20(%rdx,%r8), %r10
movups %xmm10, (%rax,%r8,4)
movups %xmm10, (%rax,%r10,4)
movq %rsi, %r10
subq %rcx, %r10
leaq (%r10,%r8), %rcx
movmskps %xmm0, %r8d
movdqa %xmm8, %xmm0
movq %r8, %r10
pcmpgtd %xmm4, %xmm0
popcntq %r8, %r8
salq $4, %r10
pshufb (%rdi,%r10), %xmm9
leaq -24(%rdx,%rcx), %r10
movups %xmm9, (%rax,%rcx,4)
movups %xmm9, (%rax,%r10,4)
movq %rsi, %r10
subq %r8, %r10
leaq (%r10,%rcx), %r8
movmskps %xmm0, %ecx
movdqa %xmm7, %xmm0
movq %rcx, %r10
pcmpgtd %xmm4, %xmm0
salq $4, %r10
pshufb (%rdi,%r10), %xmm8
leaq -28(%rdx,%r8), %r10
movups %xmm8, (%rax,%r8,4)
movups %xmm8, (%rax,%r10,4)
xorl %r10d, %r10d
popcntq %rcx, %r10
movq %rsi, %rcx
subq %r10, %rcx
addq %r8, %rcx
movmskps %xmm0, %r8d
movq %r8, %r10
leaq -32(%rdx,%rcx), %rdx
popcntq %r8, %r8
subq %r8, %rsi
salq $4, %r10
pshufb (%rdi,%r10), %xmm7
movq %r14, %rdi
movups %xmm7, (%rax,%rcx,4)
movups %xmm7, (%rax,%rdx,4)
leaq (%rsi,%rcx), %rdx
subq %rdx, %rdi
leaq 0(,%rdx,4), %rcx
.L1254:
movdqa %xmm6, %xmm1
pcmpeqd %xmm0, %xmm0
movdqa %xmm6, %xmm2
cmpq $4, %rdi
pcmpgtd %xmm4, %xmm1
leaq -16(,%r14,4), %rsi
cmovnb %rcx, %rsi
xorl %edi, %edi
pxor %xmm1, %xmm0
movdqu (%rax,%rsi), %xmm7
movmskps %xmm0, %esi
popcntq %rsi, %rdi
movq %rdi, %xmm0
salq $4, %rsi
movups %xmm7, (%rax,%r14,4)
pshufd $0, %xmm0, %xmm0
pshufb (%r9,%rsi), %xmm2
pcmpgtd %xmm5, %xmm0
movd %xmm0, %esi
testl %esi, %esi
je .L1260
movd %xmm2, (%rax,%rcx)
.L1260:
pextrd $1, %xmm0, %esi
testl %esi, %esi
je .L1261
pextrd $1, %xmm2, 4(%rax,%rcx)
.L1261:
pextrd $2, %xmm0, %esi
testl %esi, %esi
je .L1262
pextrd $2, %xmm2, 8(%rax,%rcx)
.L1262:
pextrd $3, %xmm0, %esi
testl %esi, %esi
je .L1263
pextrd $3, %xmm2, 12(%rax,%rcx)
.L1263:
addq %rdx, %rdi
xorl %esi, %esi
movmskps %xmm1, %edx
popcntq %rdx, %rsi
movq %rsi, %xmm0
salq $4, %rdx
leaq 0(,%rdi,4), %rcx
pshufd $0, %xmm0, %xmm0
pshufb (%r9,%rdx), %xmm6
pcmpgtd %xmm5, %xmm0
movd %xmm0, %edx
testl %edx, %edx
je .L1264
movd %xmm6, (%rax,%rdi,4)
.L1264:
pextrd $1, %xmm0, %edx
testl %edx, %edx
je .L1265
pextrd $1, %xmm6, 4(%rax,%rcx)
.L1265:
pextrd $2, %xmm0, %edx
testl %edx, %edx
je .L1266
pextrd $2, %xmm6, 8(%rax,%rcx)
.L1266:
pextrd $3, %xmm0, %edx
testl %edx, %edx
je .L1267
pextrd $3, %xmm6, 12(%rax,%rcx)
.L1267:
movq -88(%rbp), %r14
addq %rdi, %r15
subq $1, %r14
cmpl $2, -112(%rbp)
je .L1269
movq -80(%rbp), %r8
movq -96(%rbp), %rsi
movq %r14, %r9
movq %r12, %rcx
movq %r15, %rdx
movq %r13, %rdi
call _ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -112(%rbp)
je .L1159
.L1269:
movq -72(%rbp), %rdx
movq -80(%rbp), %r8
leaq 0(%r13,%r15,4), %rdi
movq %r14, %r9
movq -96(%rbp), %rsi
movq %r12, %rcx
subq %r15, %rdx
call _ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1159:
addq $88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1250:
.cfi_restore_state
movq (%r12), %rcx
leaq 8(%r11), %rdi
andq $-8, %rdi
movq %rcx, (%r11)
movl %r8d, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r11,%rcx)
subq %rdi, %r11
movq %r12, %rsi
leal (%r8,%r11), %ecx
subq %r11, %rsi
shrl $3, %ecx
rep movsq
jmp .L1251
.p2align 4,,10
.p2align 3
.L1246:
movq (%r11), %rcx
leaq 8(%rax), %rdi
andq $-8, %rdi
movq %rcx, (%rax)
movl %r8d, %ecx
movq -8(%r11,%rcx), %rsi
movq %rsi, -8(%rax,%rcx)
movq %rax, %rcx
movq %r11, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L1247
.L1451:
movl (%r12), %ecx
jmp .L1220
.L1456:
movzbl (%r12), %esi
movb %sil, (%r11)
testb $2, %cl
je .L1251
movzwl -2(%r12,%rcx), %esi
movw %si, -2(%r11,%rcx)
jmp .L1251
.L1454:
movzbl (%r11), %esi
movb %sil, (%rax)
testb $2, %cl
je .L1247
movzwl -2(%r11,%rcx), %esi
movw %si, -2(%rax,%rcx)
jmp .L1247
.L1449:
cmpq $1, %rdx
jbe .L1159
leaq 256(%rdi), %rax
cmpq %rax, %rsi
jb .L1459
movl $4, %esi
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L1159
.L1174:
movq -112(%rbp), %rax
movl $4, %edi
movdqu 0(%r13), %xmm0
andl $3, %eax
pcmpeqd %xmm2, %xmm0
subq %rax, %rdi
movd %edi, %xmm5
pshufd $0, %xmm5, %xmm1
movdqa .LC0(%rip), %xmm5
pcmpgtd %xmm5, %xmm1
pandn %xmm1, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
jne .L1460
pxor %xmm1, %xmm1
movq -72(%rbp), %r8
leaq 256(%r13,%rdi,4), %rsi
pxor %xmm6, %xmm6
movdqa %xmm1, %xmm0
.p2align 4,,10
.p2align 3
.L1180:
movq %rdi, %rcx
leaq 64(%rdi), %rdi
cmpq %rdi, %r8
jb .L1461
leaq -256(%rsi), %rax
.L1179:
movdqa (%rax), %xmm4
leaq 32(%rax), %rdx
pxor %xmm3, %xmm4
por %xmm4, %xmm0
movdqa 16(%rax), %xmm4
pxor %xmm3, %xmm4
por %xmm4, %xmm1
movdqa 32(%rax), %xmm4
pxor %xmm3, %xmm4
por %xmm4, %xmm0
movdqa 48(%rax), %xmm4
pxor %xmm3, %xmm4
por %xmm4, %xmm1
movdqa 64(%rax), %xmm4
pxor %xmm3, %xmm4
por %xmm4, %xmm0
movdqa 80(%rax), %xmm4
leaq 96(%rdx), %rax
pxor %xmm3, %xmm4
por %xmm4, %xmm1
movdqa 64(%rdx), %xmm4
pxor %xmm3, %xmm4
por %xmm4, %xmm0
movdqa 80(%rdx), %xmm4
pxor %xmm3, %xmm4
por %xmm4, %xmm1
cmpq %rsi, %rax
jne .L1179
movdqa %xmm0, %xmm4
leaq 352(%rdx), %rsi
por %xmm1, %xmm4
pcmpeqd %xmm6, %xmm4
movmskps %xmm4, %eax
cmpl $15, %eax
je .L1180
movdqa %xmm2, %xmm0
pcmpeqd %xmm1, %xmm1
pcmpeqd 0(%r13,%rcx,4), %xmm0
pxor %xmm1, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
jne .L1182
.p2align 4,,10
.p2align 3
.L1181:
addq $4, %rcx
movdqa %xmm2, %xmm0
pcmpeqd 0(%r13,%rcx,4), %xmm0
pxor %xmm1, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
je .L1181
.L1182:
rep bsfl %eax, %eax
cltq
addq %rcx, %rax
.L1178:
leaq 0(%r13,%rax,4), %rdi
movdqa %xmm2, %xmm1
movl (%rdi), %ecx
movd %ecx, %xmm6
pshufd $0, %xmm6, %xmm3
movdqa %xmm3, %xmm0
movdqa %xmm3, %xmm8
pcmpgtd %xmm2, %xmm0
movmskps %xmm0, %edx
testl %edx, %edx
jne .L1187
movq -72(%rbp), %rdi
xorl %esi, %esi
leaq -4(%rdi), %rax
jmp .L1196
.p2align 4,,10
.p2align 3
.L1188:
movmskps %xmm0, %edx
movups %xmm1, 0(%r13,%rax,4)
popcntq %rdx, %rdx
addq %rdx, %rsi
leaq -4(%rax), %rdx
cmpq %rdx, %rdi
jbe .L1462
movq %rdx, %rax
.L1196:
movdqu 0(%r13,%rax,4), %xmm0
movdqu 0(%r13,%rax,4), %xmm4
pcmpeqd %xmm2, %xmm0
pcmpeqd %xmm3, %xmm4
movdqa %xmm0, %xmm6
movdqa %xmm0, %xmm7
por %xmm4, %xmm6
movmskps %xmm6, %edx
cmpl $15, %edx
je .L1188
pcmpeqd %xmm0, %xmm0
leaq 4(%rax), %rdi
pxor %xmm0, %xmm7
pandn %xmm7, %xmm4
movmskps %xmm4, %edx
rep bsfl %edx, %edx
movslq %edx, %rdx
addq %rax, %rdx
addq $8, %rax
movd 0(%r13,%rdx,4), %xmm6
movq -72(%rbp), %rdx
pshufd $0, %xmm6, %xmm0
subq %rsi, %rdx
movdqa %xmm0, %xmm4
movaps %xmm0, -64(%rbp)
cmpq %rax, %rdx
jb .L1189
.L1190:
movups %xmm8, -16(%r13,%rax,4)
movq %rax, %rdi
addq $4, %rax
cmpq %rdx, %rax
jbe .L1190
.L1189:
subq %rdi, %rdx
leaq 0(,%rdi,4), %rsi
movq %rdx, %xmm0
pshufd $0, %xmm0, %xmm0
pcmpgtd %xmm5, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L1200
movl %ecx, 0(%r13,%rdi,4)
.L1200:
pextrd $1, %xmm0, %eax
testl %eax, %eax
je .L1201
movl %ecx, 4(%r13,%rsi)
.L1201:
pextrd $2, %xmm0, %eax
testl %eax, %eax
je .L1202
movl %ecx, 8(%r13,%rsi)
.L1202:
pextrd $3, %xmm0, %eax
testl %eax, %eax
je .L1195
movl %ecx, 12(%r13,%rsi)
.L1195:
movdqa %xmm2, %xmm0
pcmpeqd .LC5(%rip), %xmm0
movmskps %xmm0, %eax
cmpl $15, %eax
je .L1287
movdqa %xmm2, %xmm0
pcmpeqd .LC6(%rip), %xmm0
movmskps %xmm0, %eax
cmpl $15, %eax
je .L1213
movdqa %xmm3, %xmm5
movdqa %xmm2, %xmm0
pminsd %xmm4, %xmm5
pcmpgtd %xmm5, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
jne .L1463
movdqa %xmm1, %xmm3
movl $64, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1208:
leaq (%rcx,%rax,4), %rdx
addq $1, %rax
movdqu 0(%r13,%rdx,4), %xmm0
pminsd %xmm3, %xmm0
movdqa %xmm0, %xmm3
cmpq $16, %rax
jne .L1208
movdqa %xmm2, %xmm4
pcmpgtd %xmm0, %xmm4
movmskps %xmm4, %eax
testl %eax, %eax
jne .L1443
leaq 64(%rsi), %rax
cmpq %rax, -72(%rbp)
jb .L1464
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1208
.L1290:
movdqa .LC0(%rip), %xmm5
xorl %r8d, %r8d
xorl %esi, %esi
movq %r13, %rax
leaq _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %r9
jmp .L1227
.L1291:
xorl %ecx, %ecx
movq %r14, %rdi
jmp .L1254
.L1292:
movq %rdx, %r8
movq %rax, %r10
movl $4, %ecx
leaq _ZZN3hwy6N_SSE46detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rdi
jmp .L1255
.L1452:
movq -72(%rbp), %rsi
leaq -1(%rsi), %rbx
movq %rbx, %r12
shrq %r12
.p2align 4,,10
.p2align 3
.L1225:
movq %r12, %rdx
movq %r13, %rdi
call _ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %r12
jnb .L1225
.p2align 4,,10
.p2align 3
.L1226:
movl 0(%r13,%rbx,4), %edx
movl 0(%r13), %eax
movq %rbx, %rsi
movq %r13, %rdi
movl %edx, 0(%r13)
xorl %edx, %edx
movl %eax, 0(%r13,%rbx,4)
call _ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L1226
jmp .L1159
.L1455:
movl (%r12), %esi
movl %esi, (%r11)
movl -4(%r12,%rcx), %esi
movl %esi, -4(%r11,%rcx)
jmp .L1251
.L1453:
movl (%r11), %esi
movl %esi, (%rax)
movl -4(%r11,%rcx), %esi
movl %esi, -4(%rax,%rcx)
jmp .L1247
.L1461:
movq -72(%rbp), %rsi
pcmpeqd %xmm1, %xmm1
.L1184:
movq %rcx, %rdx
addq $4, %rcx
cmpq %rcx, %rsi
jb .L1465
movdqa %xmm2, %xmm0
pcmpeqd -16(%r13,%rcx,4), %xmm0
pxor %xmm1, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
je .L1184
.L1440:
rep bsfl %eax, %eax
cltq
addq %rdx, %rax
jmp .L1178
.L1187:
movq -72(%rbp), %rsi
leaq -64(%rbp), %rdx
movq %r12, %rcx
movdqa %xmm3, %xmm1
movdqa %xmm2, %xmm0
movaps %xmm3, -112(%rbp)
subq %rax, %rsi
call _ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1159
movd (%r12), %xmm5
movdqa -64(%rbp), %xmm4
movdqa -112(%rbp), %xmm3
pshufd $0, %xmm5, %xmm2
movdqa %xmm2, %xmm1
jmp .L1195
.L1462:
movd %eax, %xmm6
movdqu 0(%r13), %xmm0
movq -72(%rbp), %rdx
pshufd $0, %xmm6, %xmm4
movdqu 0(%r13), %xmm6
pcmpgtd %xmm5, %xmm4
pcmpeqd %xmm2, %xmm0
subq %rsi, %rdx
pcmpeqd %xmm3, %xmm6
movdqa %xmm4, %xmm7
pand %xmm0, %xmm7
por %xmm6, %xmm0
pcmpeqd %xmm6, %xmm6
pxor %xmm6, %xmm4
por %xmm4, %xmm0
movmskps %xmm0, %edi
cmpl $15, %edi
jne .L1466
movmskps %xmm7, %ecx
movq %rdx, %rax
movups %xmm1, 0(%r13)
popcntq %rcx, %rcx
subq %rcx, %rax
cmpq $3, %rax
jbe .L1276
leaq -4(%rax), %rdx
movq -120(%rbp), %rsi
movq %rdx, %rcx
shrq $2, %rcx
salq $4, %rcx
leaq 16(%r13,%rcx), %rcx
.L1205:
movups %xmm8, (%rsi)
addq $16, %rsi
cmpq %rcx, %rsi
jne .L1205
andq $-4, %rdx
addq $4, %rdx
leaq 0(,%rdx,4), %rcx
subq %rdx, %rax
.L1204:
movaps %xmm3, (%r12)
testq %rax, %rax
je .L1159
leaq 0(%r13,%rcx), %rdi
leaq 0(,%rax,4), %rdx
movq %r12, %rsi
call memcpy@PLT
jmp .L1159
.L1464:
movq -72(%rbp), %rdx
jmp .L1215
.L1216:
movdqu -16(%r13,%rsi,4), %xmm5
movdqa %xmm2, %xmm0
pcmpgtd %xmm5, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
jne .L1443
.L1215:
movq %rsi, %rax
addq $4, %rsi
cmpq %rsi, %rdx
jnb .L1216
movq -72(%rbp), %rdi
cmpq %rax, %rdi
je .L1287
movdqu -16(%r13,%rdi,4), %xmm5
movaps %xmm5, -112(%rbp)
pcmpgtd -112(%rbp), %xmm2
movmskps %xmm2, %eax
cmpl $1, %eax
movl $1, %eax
adcl $0, %eax
movl %eax, -112(%rbp)
jmp .L1217
.L1465:
movq -72(%rbp), %rax
pcmpeqd %xmm1, %xmm1
leaq -4(%rax), %rdx
movdqu 0(%r13,%rdx,4), %xmm0
pcmpeqd %xmm2, %xmm0
pxor %xmm1, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
je .L1159
jmp .L1440
.p2align 4,,10
.p2align 3
.L1212:
movdqu -16(%r13,%rsi,4), %xmm0
pcmpgtd %xmm2, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
jne .L1443
.L1211:
movq %rsi, %rax
addq $4, %rsi
cmpq %rsi, -72(%rbp)
jnb .L1212
movq -72(%rbp), %rdi
cmpq %rax, %rdi
je .L1213
movdqu -16(%r13,%rdi,4), %xmm5
movaps %xmm5, -112(%rbp)
movdqa -112(%rbp), %xmm0
pcmpgtd %xmm2, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
jne .L1443
.L1213:
pcmpeqd %xmm1, %xmm1
movl $3, -112(%rbp)
paddd %xmm2, %xmm1
jmp .L1217
.L1287:
movl $2, -112(%rbp)
jmp .L1217
.L1460:
rep bsfl %eax, %eax
cltq
jmp .L1178
.L1459:
movq %rdx, %rcx
xorl %eax, %eax
cmpq $3, %rdx
jbe .L1165
movq %rdx, %rbx
leaq -4(%rdx), %rdx
movq (%rdi), %rcx
movq %rdx, %rax
shrq $2, %rax
movq %rcx, (%r12)
addq $1, %rax
salq $4, %rax
movl %eax, %ecx
movq -8(%rdi,%rcx), %rsi
leaq 8(%r12), %rdi
andq $-8, %rdi
movq %rsi, -8(%r12,%rcx)
movq %r12, %rcx
movq %r13, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-4, %rax
shrl $3, %ecx
rep movsq
addq $4, %rax
movq %rbx, %rcx
subq %rax, %rcx
je .L1168
.L1165:
salq $2, %rax
leaq 0(,%rcx,4), %rdx
testq %rcx, %rcx
movl $4, %ecx
cmove %rcx, %rdx
leaq (%r12,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
.L1168:
movq -72(%rbp), %rdi
movl $32, %ecx
movl %edi, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $4, %rdx
cmpq %rdx, %rdi
jnb .L1167
movdqa .LC4(%rip), %xmm0
movq %rdi, %rax
.L1166:
movups %xmm0, (%r12,%rax,4)
addq $4, %rax
cmpq %rdx, %rax
jb .L1166
.L1167:
movq %r12, %rdi
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
xorl %eax, %eax
cmpq $3, -72(%rbp)
jbe .L1170
movq -72(%rbp), %rbx
movq (%r12), %rcx
leaq 8(%r13), %rdi
andq $-8, %rdi
leaq -4(%rbx), %rdx
movq %rcx, 0(%r13)
movq %rdx, %rax
shrq $2, %rax
addq $1, %rax
salq $4, %rax
movl %eax, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %r12, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-4, %rax
shrl $3, %ecx
rep movsq
addq $4, %rax
subq %rax, %rbx
movq %rbx, -72(%rbp)
je .L1159
.L1170:
movq -72(%rbp), %rsi
salq $2, %rax
movl $4, %ecx
leaq 0(%r13,%rax), %rdi
testq %rsi, %rsi
leaq 0(,%rsi,4), %rdx
leaq (%r12,%rax), %rsi
cmove %rcx, %rdx
call memcpy@PLT
jmp .L1159
.L1463:
pmaxsd %xmm4, %xmm3
movdqa %xmm3, %xmm0
pcmpgtd %xmm2, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
jne .L1443
movdqa %xmm1, %xmm3
movl $64, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1209:
leaq (%rcx,%rax,4), %rdx
addq $1, %rax
movdqu 0(%r13,%rdx,4), %xmm0
pmaxsd %xmm3, %xmm0
movdqa %xmm0, %xmm3
cmpq $16, %rax
jne .L1209
pcmpgtd %xmm2, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
jne .L1443
leaq 64(%rsi), %rax
cmpq %rax, -72(%rbp)
jb .L1211
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1209
.L1466:
pxor %xmm6, %xmm0
movmskps %xmm0, %esi
rep bsfl %esi, %esi
movslq %esi, %rsi
movd 0(%r13,%rsi,4), %xmm6
leaq 4(%rax), %rsi
pshufd $0, %xmm6, %xmm0
movdqa %xmm0, %xmm4
movaps %xmm0, -64(%rbp)
cmpq %rdx, %rsi
ja .L1198
.L1199:
movups %xmm8, -16(%r13,%rsi,4)
movq %rsi, %rax
addq $4, %rsi
cmpq %rdx, %rsi
jbe .L1199
.L1198:
subq %rax, %rdx
leaq 0(,%rax,4), %rsi
movq %rdx, %xmm0
pshufd $0, %xmm0, %xmm0
pcmpgtd %xmm5, %xmm0
movd %xmm0, %edx
testl %edx, %edx
je .L1200
movl %ecx, 0(%r13,%rax,4)
jmp .L1200
.L1276:
xorl %ecx, %ecx
jmp .L1204
.cfi_endproc
.LFE18804:
.size _ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18806:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
pushq %r13
.cfi_offset 15, -24
.cfi_offset 14, -32
.cfi_offset 13, -40
movq %rcx, %r13
pushq %r12
pushq %rbx
subq $360, %rsp
.cfi_offset 12, -48
.cfi_offset 3, -56
movq %rdi, -88(%rbp)
movq %rsi, -240(%rbp)
movq %rdx, -176(%rbp)
movq %r8, -184(%rbp)
movq %r9, -192(%rbp)
cmpq $64, %rdx
jbe .L1753
movq %rdi, %r15
movq %rdi, %r10
shrq $2, %r15
movq %r15, %rax
andl $15, %eax
jne .L1754
movq %rdx, %rbx
movq %rdi, %r14
movq %r8, %rax
.L1480:
movq 8(%rax), %rdx
movq 16(%rax), %r9
movq %rdx, %rcx
leaq 1(%r9), %rdi
movq %rdx, %rsi
xorq (%rax), %rdi
rolq $24, %rcx
shrq $11, %rsi
movq %rcx, %rax
leaq (%rdx,%rdx,8), %rcx
leaq 2(%r9), %rdx
addq %rdi, %rax
xorq %rsi, %rcx
movq %rax, %rsi
xorq %rdx, %rcx
leaq (%rax,%rax,8), %rdx
movq %rax, %r8
rolq $24, %rsi
shrq $11, %r8
leaq 3(%r9), %rax
addq %rcx, %rsi
xorq %r8, %rdx
movq %rsi, %r8
xorq %rax, %rdx
leaq (%rsi,%rsi,8), %rax
rolq $24, %r8
movq %r8, %r11
movq %rsi, %r8
leaq 4(%r9), %rsi
addq $5, %r9
addq %rdx, %r11
shrq $11, %r8
xorq %r8, %rax
movq %r11, %r12
movq %r11, %r8
shrq $11, %r12
xorq %rsi, %rax
rolq $24, %r8
leaq (%r11,%r11,8), %rsi
addq %rax, %r8
xorq %r12, %rsi
xorq %r9, %rsi
leaq (%r8,%r8,8), %r11
movq %r8, %r12
rolq $24, %r8
addq %rsi, %r8
shrq $11, %r12
movl %esi, %esi
xorq %r12, %r11
movq %r8, %xmm6
movq %rbx, %r12
movabsq $68719476719, %r8
movq %r11, %xmm0
shrq $4, %r12
movq -184(%rbp), %r11
cmpq %r8, %rbx
movl $4294967295, %r8d
punpcklqdq %xmm6, %xmm0
movl %edi, %ebx
cmova %r8, %r12
movq %r9, 16(%r11)
shrq $32, %rdi
movl %edx, %r9d
movl %eax, %r8d
shrq $32, %rdx
movups %xmm0, (%r11)
movl %ecx, %r11d
shrq $32, %rcx
imulq %r12, %rbx
shrq $32, %rax
imulq %r12, %rdi
imulq %r12, %r11
imulq %r12, %rcx
shrq $32, %rbx
imulq %r12, %r9
shrq $32, %rdi
salq $6, %rbx
imulq %r12, %rdx
shrq $32, %r11
salq $6, %rdi
addq %r14, %rbx
imulq %r12, %r8
shrq $32, %rcx
salq $6, %r11
addq %r14, %rdi
shrq $32, %r9
salq $6, %rcx
addq %r14, %r11
shrq $32, %rdx
salq $6, %r9
addq %r14, %rcx
shrq $32, %r8
salq $6, %rdx
addq %r14, %r9
salq $6, %r8
addq %r14, %rdx
addq %r14, %r8
imulq %r12, %rax
imulq %r12, %rsi
shrq $32, %rax
shrq $32, %rsi
salq $6, %rax
salq $6, %rsi
addq %r14, %rax
leaq (%r14,%rsi), %r12
xorl %esi, %esi
.L1482:
movdqa (%r11,%rsi,4), %xmm0
movdqa (%rbx,%rsi,4), %xmm3
movdqa %xmm0, %xmm1
movdqa %xmm3, %xmm2
pcmpgtd %xmm3, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm2
pandn %xmm0, %xmm4
pand %xmm1, %xmm0
por %xmm4, %xmm2
movdqa %xmm1, %xmm4
movdqa %xmm0, %xmm1
movdqa (%rdi,%rsi,4), %xmm0
pandn %xmm3, %xmm4
pcmpgtd %xmm2, %xmm0
por %xmm4, %xmm1
movdqa %xmm0, %xmm3
pand (%rdi,%rsi,4), %xmm0
pandn %xmm2, %xmm3
movdqa %xmm1, %xmm2
por %xmm3, %xmm0
pcmpgtd %xmm0, %xmm2
movdqa %xmm2, %xmm3
pand %xmm2, %xmm0
pandn %xmm1, %xmm3
por %xmm3, %xmm0
movdqa (%rcx,%rsi,4), %xmm3
movaps %xmm0, 0(%r13,%rsi,4)
movdqa (%rdx,%rsi,4), %xmm0
movdqa %xmm3, %xmm2
movdqa %xmm0, %xmm1
pcmpgtd %xmm3, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm2
pandn %xmm0, %xmm4
pand %xmm1, %xmm0
por %xmm4, %xmm2
movdqa %xmm1, %xmm4
movdqa %xmm0, %xmm1
movdqa (%r9,%rsi,4), %xmm0
pandn %xmm3, %xmm4
pcmpgtd %xmm2, %xmm0
por %xmm4, %xmm1
movdqa %xmm0, %xmm3
pand (%r9,%rsi,4), %xmm0
pandn %xmm2, %xmm3
movdqa %xmm1, %xmm2
por %xmm3, %xmm0
pcmpgtd %xmm0, %xmm2
movdqa %xmm2, %xmm3
pand %xmm2, %xmm0
pandn %xmm1, %xmm3
por %xmm3, %xmm0
movdqa (%r8,%rsi,4), %xmm3
movaps %xmm0, 64(%r13,%rsi,4)
movdqa (%r12,%rsi,4), %xmm0
movdqa %xmm3, %xmm2
movdqa %xmm0, %xmm1
pcmpgtd %xmm3, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm2
pandn %xmm0, %xmm4
pand %xmm1, %xmm0
por %xmm4, %xmm2
movdqa %xmm1, %xmm4
movdqa %xmm0, %xmm1
movdqa (%rax,%rsi,4), %xmm0
pandn %xmm3, %xmm4
pcmpgtd %xmm2, %xmm0
por %xmm4, %xmm1
movdqa %xmm0, %xmm3
pand (%rax,%rsi,4), %xmm0
pandn %xmm2, %xmm3
movdqa %xmm1, %xmm2
por %xmm3, %xmm0
pcmpgtd %xmm0, %xmm2
movdqa %xmm2, %xmm3
pand %xmm2, %xmm0
pandn %xmm1, %xmm3
por %xmm3, %xmm0
movaps %xmm0, 128(%r13,%rsi,4)
addq $4, %rsi
cmpq $16, %rsi
jne .L1482
movd 0(%r13), %xmm6
movdqa 16(%r13), %xmm1
movdqa 0(%r13), %xmm3
pshufd $0, %xmm6, %xmm0
pxor %xmm0, %xmm3
pxor %xmm0, %xmm1
movdqa %xmm0, %xmm2
por %xmm3, %xmm1
movdqa 32(%r13), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 48(%r13), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 64(%r13), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 80(%r13), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 96(%r13), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 112(%r13), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 128(%r13), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 144(%r13), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 160(%r13), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
movdqa 176(%r13), %xmm3
pxor %xmm0, %xmm3
por %xmm3, %xmm1
pxor %xmm3, %xmm3
pcmpeqd %xmm3, %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
je .L1483
movdqa .LC4(%rip), %xmm0
movl $4, %esi
movq %r13, %rdi
leaq 192(%r13), %r12
movups %xmm0, 192(%r13)
movups %xmm0, 208(%r13)
movups %xmm0, 224(%r13)
movups %xmm0, 240(%r13)
movups %xmm0, 256(%r13)
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
movd 0(%r13), %xmm6
pcmpeqd %xmm2, %xmm2
pshufd $0, %xmm6, %xmm0
movd 188(%r13), %xmm6
pshufd $0, %xmm6, %xmm1
paddd %xmm1, %xmm2
pcmpeqd %xmm0, %xmm2
movmskps %xmm2, %eax
cmpl $15, %eax
jne .L1485
movq -176(%rbp), %rsi
movq -88(%rbp), %rdi
leaq -64(%rbp), %rdx
movq %r12, %rcx
call _ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1467
.L1485:
movl 96(%r13), %ecx
movl $23, %eax
movl $24, %edx
cmpl %ecx, 92(%r13)
je .L1527
jmp .L1532
.p2align 4,,10
.p2align 3
.L1530:
testq %rax, %rax
je .L1755
.L1527:
movq %rax, %rdx
subq $1, %rax
movl 0(%r13,%rax,4), %esi
cmpl %ecx, %esi
je .L1530
cmpl %ecx, 0(%r13,%rdx,4)
je .L1532
movl %esi, %ecx
jmp .L1529
.p2align 4,,10
.p2align 3
.L1533:
cmpq $47, %rdx
je .L1751
.L1532:
movq %rdx, %rsi
addq $1, %rdx
cmpl %ecx, 0(%r13,%rdx,4)
je .L1533
movl $24, %edx
subq $23, %rsi
subq %rax, %rdx
cmpq %rdx, %rsi
jb .L1529
.L1751:
movl 0(%r13,%rax,4), %ecx
.L1529:
movd %ecx, %xmm6
pshufd $0, %xmm6, %xmm3
.L1752:
movl $1, -228(%rbp)
.L1526:
cmpq $0, -192(%rbp)
je .L1756
movq -176(%rbp), %rax
movq -88(%rbp), %r14
movaps %xmm3, -80(%rbp)
subq $4, %rax
movdqu (%r14,%rax,4), %xmm6
movq %rax, %rbx
movq %rax, -112(%rbp)
andl $15, %ebx
movaps %xmm6, -224(%rbp)
andl $12, %eax
je .L1599
movdqu (%r14), %xmm1
pcmpeqd %xmm0, %xmm0
movdqa %xmm1, %xmm4
movaps %xmm1, -144(%rbp)
pcmpgtd %xmm3, %xmm4
pxor %xmm4, %xmm0
movaps %xmm4, -128(%rbp)
movmskps %xmm0, %r12d
movq %r12, %rdi
salq $4, %r12
call __popcountdi2@PLT
movdqa -144(%rbp), %xmm1
movdqa -128(%rbp), %xmm4
leaq _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rcx
movd %eax, %xmm6
movslq %eax, %rdx
movq %rcx, -168(%rbp)
pshufd $0, %xmm6, %xmm0
movdqa .LC0(%rip), %xmm6
movdqa %xmm1, %xmm2
pshufb (%rcx,%r12), %xmm2
pcmpgtd %xmm6, %xmm0
movaps %xmm6, -208(%rbp)
movd %xmm0, %eax
testl %eax, %eax
je .L1537
movd %xmm2, (%r14)
.L1537:
pshufd $85, %xmm0, %xmm3
movd %xmm3, %eax
testl %eax, %eax
je .L1538
movq -88(%rbp), %rax
pshufd $85, %xmm2, %xmm3
movd %xmm3, 4(%rax)
.L1538:
movdqa %xmm0, %xmm3
punpckhdq %xmm0, %xmm3
movd %xmm3, %eax
testl %eax, %eax
je .L1539
movq -88(%rbp), %rax
movdqa %xmm2, %xmm3
punpckhdq %xmm2, %xmm3
movd %xmm3, 8(%rax)
.L1539:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L1540
movq -88(%rbp), %rax
pshufd $255, %xmm2, %xmm2
movd %xmm2, 12(%rax)
.L1540:
movmskps %xmm4, %r15d
movq -88(%rbp), %rax
movaps %xmm1, -128(%rbp)
movq %r15, %rdi
salq $4, %r15
leaq (%rax,%rdx,4), %r14
call __popcountdi2@PLT
movq -168(%rbp), %rcx
movdqa -128(%rbp), %xmm1
movslq %eax, %r12
pshufb (%rcx,%r15), %xmm1
movups %xmm1, 0(%r13)
testb $8, -112(%rbp)
je .L1541
movq -88(%rbp), %rax
pcmpeqd %xmm0, %xmm0
movdqu 16(%rax), %xmm1
movdqa %xmm1, %xmm4
movaps %xmm1, -144(%rbp)
pcmpgtd -80(%rbp), %xmm4
pxor %xmm4, %xmm0
movaps %xmm4, -128(%rbp)
movmskps %xmm0, %r15d
movq %r15, %rdi
salq $4, %r15
call __popcountdi2@PLT
movdqa -144(%rbp), %xmm1
movdqa -128(%rbp), %xmm4
movd %eax, %xmm6
movq -168(%rbp), %rsi
movslq %eax, %rcx
pshufd $0, %xmm6, %xmm0
movdqa %xmm1, %xmm2
pcmpgtd -208(%rbp), %xmm0
pshufb (%rsi,%r15), %xmm2
movd %xmm0, %eax
testl %eax, %eax
je .L1542
movd %xmm2, (%r14)
.L1542:
pshufd $85, %xmm0, %xmm3
movd %xmm3, %eax
testl %eax, %eax
je .L1543
pshufd $85, %xmm2, %xmm3
movd %xmm3, 4(%r14)
.L1543:
movdqa %xmm0, %xmm3
punpckhdq %xmm0, %xmm3
movd %xmm3, %eax
testl %eax, %eax
je .L1544
movdqa %xmm2, %xmm3
punpckhdq %xmm2, %xmm3
movd %xmm3, 8(%r14)
.L1544:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L1545
pshufd $255, %xmm2, %xmm2
movd %xmm2, 12(%r14)
.L1545:
movmskps %xmm4, %r15d
movaps %xmm1, -128(%rbp)
leaq (%r14,%rcx,4), %r14
movq %r15, %rdi
salq $4, %r15
call __popcountdi2@PLT
movq -168(%rbp), %rcx
movdqa -128(%rbp), %xmm1
cltq
pshufb (%rcx,%r15), %xmm1
movups %xmm1, 0(%r13,%r12,4)
addq %rax, %r12
cmpq $11, %rbx
jbe .L1541
movq -88(%rbp), %rax
pcmpeqd %xmm0, %xmm0
movdqu 32(%rax), %xmm1
movdqa %xmm1, %xmm4
movaps %xmm1, -144(%rbp)
pcmpgtd -80(%rbp), %xmm4
pxor %xmm4, %xmm0
movaps %xmm4, -128(%rbp)
movmskps %xmm0, %r15d
movq %r15, %rdi
salq $4, %r15
call __popcountdi2@PLT
movdqa -144(%rbp), %xmm1
movdqa -128(%rbp), %xmm4
movd %eax, %xmm6
movq -168(%rbp), %rsi
movslq %eax, %rcx
pshufd $0, %xmm6, %xmm0
movdqa %xmm1, %xmm2
pcmpgtd -208(%rbp), %xmm0
pshufb (%rsi,%r15), %xmm2
movd %xmm0, %eax
testl %eax, %eax
je .L1546
movd %xmm2, (%r14)
.L1546:
pshufd $85, %xmm0, %xmm3
movd %xmm3, %eax
testl %eax, %eax
je .L1547
pshufd $85, %xmm2, %xmm3
movd %xmm3, 4(%r14)
.L1547:
movdqa %xmm0, %xmm3
punpckhdq %xmm0, %xmm3
movd %xmm3, %eax
testl %eax, %eax
je .L1548
movdqa %xmm2, %xmm3
punpckhdq %xmm2, %xmm3
movd %xmm3, 8(%r14)
.L1548:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L1549
pshufd $255, %xmm2, %xmm2
movd %xmm2, 12(%r14)
.L1549:
movmskps %xmm4, %r15d
movaps %xmm1, -128(%rbp)
leaq (%r14,%rcx,4), %r14
movq %r15, %rdi
salq $4, %r15
call __popcountdi2@PLT
movq -168(%rbp), %rcx
movdqa -128(%rbp), %xmm1
cltq
pshufb (%rcx,%r15), %xmm1
movups %xmm1, 0(%r13,%r12,4)
addq %rax, %r12
.L1541:
leaq -4(%rbx), %rax
leaq 1(%rbx), %rcx
andq $-4, %rax
leaq 0(,%r12,4), %r15
addq $4, %rax
cmpq $4, %rcx
movl $4, %ecx
cmovbe %rcx, %rax
.L1536:
cmpq %rax, %rbx
je .L1550
subq %rax, %rbx
movd %ebx, %xmm6
movq -88(%rbp), %rbx
pshufd $0, %xmm6, %xmm1
movdqu (%rbx,%rax,4), %xmm2
pcmpgtd -208(%rbp), %xmm1
movdqa %xmm2, %xmm3
movaps %xmm2, -160(%rbp)
pcmpgtd -80(%rbp), %xmm3
movaps %xmm1, -128(%rbp)
movdqa %xmm3, %xmm0
movaps %xmm3, -144(%rbp)
pandn %xmm1, %xmm0
movmskps %xmm0, %ebx
movq %rbx, %rdi
salq $4, %rbx
call __popcountdi2@PLT
movdqa -160(%rbp), %xmm2
movq -168(%rbp), %rsi
movd %eax, %xmm7
movslq %eax, %rcx
movdqa -128(%rbp), %xmm1
movdqa -144(%rbp), %xmm3
pshufd $0, %xmm7, %xmm0
movdqa %xmm2, %xmm4
pcmpgtd -208(%rbp), %xmm0
pshufb (%rsi,%rbx), %xmm4
movd %xmm0, %eax
testl %eax, %eax
je .L1551
movd %xmm4, (%r14)
.L1551:
pshufd $85, %xmm0, %xmm5
movd %xmm5, %eax
testl %eax, %eax
je .L1552
pshufd $85, %xmm4, %xmm5
movd %xmm5, 4(%r14)
.L1552:
movdqa %xmm0, %xmm5
punpckhdq %xmm0, %xmm5
movd %xmm5, %eax
testl %eax, %eax
je .L1553
movdqa %xmm4, %xmm5
punpckhdq %xmm4, %xmm5
movd %xmm5, 8(%r14)
.L1553:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L1554
pshufd $255, %xmm4, %xmm4
movd %xmm4, 12(%r14)
.L1554:
pand %xmm1, %xmm3
movaps %xmm2, -128(%rbp)
leaq (%r14,%rcx,4), %r14
movmskps %xmm3, %ebx
movq %rbx, %rdi
salq $4, %rbx
call __popcountdi2@PLT
movq -168(%rbp), %rcx
movdqa -128(%rbp), %xmm2
cltq
pshufb (%rcx,%rbx), %xmm2
addq %rax, %r12
movups %xmm2, 0(%r13,%r15)
leaq 0(,%r12,4), %r15
.L1550:
movq -112(%rbp), %rbx
movq -88(%rbp), %rax
movl %r15d, %ecx
subq %r12, %rbx
leaq (%rax,%rbx,4), %rax
cmpl $8, %r15d
jnb .L1555
testb $4, %r15b
jne .L1757
testl %ecx, %ecx
jne .L1758
.L1556:
movl %r15d, %ecx
cmpl $8, %r15d
jnb .L1559
andl $4, %r15d
jne .L1759
testl %ecx, %ecx
jne .L1760
.L1560:
movq -112(%rbp), %rcx
movq %r14, %rax
subq -88(%rbp), %rax
sarq $2, %rax
subq %rax, %rcx
subq %rax, %rbx
movq %rax, -256(%rbp)
movq %rcx, -248(%rbp)
leaq (%r14,%rbx,4), %rax
je .L1600
movdqu (%r14), %xmm6
movdqu -16(%rax), %xmm7
leaq 64(%r14), %rsi
leaq -64(%rax), %r8
movaps %xmm6, -272(%rbp)
movdqu 16(%r14), %xmm6
movaps %xmm7, -384(%rbp)
movaps %xmm6, -288(%rbp)
movdqu 32(%r14), %xmm6
movaps %xmm6, -304(%rbp)
movdqu 48(%r14), %xmm6
movaps %xmm6, -320(%rbp)
movdqu -64(%rax), %xmm6
movaps %xmm6, -336(%rbp)
movdqu -48(%rax), %xmm6
movaps %xmm6, -352(%rbp)
movdqu -32(%rax), %xmm6
movaps %xmm6, -368(%rbp)
cmpq %r8, %rsi
je .L1601
movq %r13, -392(%rbp)
xorl %r15d, %r15d
movq %rsi, %r13
leaq _ZZN3hwy7N_SSSE36detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %r12
jmp .L1567
.p2align 4,,10
.p2align 3
.L1762:
movdqu -64(%r8), %xmm3
movdqu -48(%r8), %xmm2
prefetcht0 -256(%r8)
subq $64, %r8
movdqu 32(%r8), %xmm1
movdqu 48(%r8), %xmm0
.L1566:
movdqa %xmm3, %xmm4
movq %r8, -96(%rbp)
pcmpgtd -80(%rbp), %xmm4
movaps %xmm0, -160(%rbp)
movaps %xmm1, -144(%rbp)
movaps %xmm2, -128(%rbp)
movmskps %xmm4, %edi
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm3
movaps %xmm3, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm3
movdqa -128(%rbp), %xmm2
leaq -4(%rbx,%r15), %rdx
cltq
movups %xmm3, (%r14,%r15,4)
addq $4, %r15
movups %xmm3, (%r14,%rdx,4)
movdqa %xmm2, %xmm3
subq %rax, %r15
pcmpgtd -80(%rbp), %xmm3
movmskps %xmm3, %edi
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm2
movaps %xmm2, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm2
leaq -8(%rbx,%r15), %rdx
movdqa -144(%rbp), %xmm1
cltq
movups %xmm2, (%r14,%r15,4)
movups %xmm2, (%r14,%rdx,4)
movdqa %xmm1, %xmm2
movl $4, %edx
pcmpgtd -80(%rbp), %xmm2
subq %rax, %rdx
addq %rdx, %r15
movmskps %xmm2, %edi
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm1
movaps %xmm1, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm1
leaq -12(%rbx,%r15), %rdx
movdqa -160(%rbp), %xmm0
cltq
subq $16, %rbx
movups %xmm1, (%r14,%r15,4)
movups %xmm1, (%r14,%rdx,4)
movdqa %xmm0, %xmm1
movl $4, %edx
pcmpgtd -80(%rbp), %xmm1
subq %rax, %rdx
addq %rdx, %r15
movmskps %xmm1, %edi
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm0
movaps %xmm0, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm0
movl $4, %edx
movq -96(%rbp), %r8
cltq
leaq (%r15,%rbx), %rcx
subq %rax, %rdx
movups %xmm0, (%r14,%r15,4)
movups %xmm0, (%r14,%rcx,4)
addq %rdx, %r15
cmpq %r8, %r13
je .L1761
.L1567:
movq %r13, %rax
subq %r14, %rax
sarq $2, %rax
subq %r15, %rax
cmpq $16, %rax
ja .L1762
movdqu 0(%r13), %xmm3
movdqu 16(%r13), %xmm2
prefetcht0 256(%r13)
addq $64, %r13
movdqu -32(%r13), %xmm1
movdqu -16(%r13), %xmm0
jmp .L1566
.p2align 4,,10
.p2align 3
.L1754:
movq -176(%rbp), %rbx
movl $16, %edx
subq %rax, %rdx
leaq -16(%rax,%rbx), %rbx
leaq (%rdi,%rdx,4), %r14
movq %r8, %rax
jmp .L1480
.p2align 4,,10
.p2align 3
.L1761:
leaq (%rbx,%r15), %rax
movq -392(%rbp), %r13
movq %rax, -128(%rbp)
leaq (%r14,%r15,4), %rax
addq $4, %r15
movq %rax, -144(%rbp)
.L1564:
movdqa -272(%rbp), %xmm5
movdqa %xmm5, %xmm0
pcmpgtd -80(%rbp), %xmm0
movmskps %xmm0, %edi
movdqa %xmm5, %xmm0
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm0
movaps %xmm0, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm0
movq -144(%rbp), %rcx
movdqa -288(%rbp), %xmm7
cltq
movups %xmm0, (%rcx)
movq -128(%rbp), %rcx
subq %rax, %r15
movups %xmm0, -16(%r14,%rcx,4)
movdqa %xmm7, %xmm0
pcmpgtd -80(%rbp), %xmm0
movmskps %xmm0, %edi
movdqa %xmm7, %xmm0
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm0
movaps %xmm0, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm0
leaq -8(%rbx,%r15), %rcx
movdqa -304(%rbp), %xmm5
cltq
movups %xmm0, (%r14,%r15,4)
subq %rax, %r15
movups %xmm0, (%r14,%rcx,4)
movdqa %xmm5, %xmm0
addq $4, %r15
pcmpgtd -80(%rbp), %xmm0
movmskps %xmm0, %edi
movdqa %xmm5, %xmm0
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm0
movaps %xmm0, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm0
leaq -12(%rbx,%r15), %rcx
movdqa -320(%rbp), %xmm7
cltq
movups %xmm0, (%r14,%r15,4)
movups %xmm0, (%r14,%rcx,4)
movdqa %xmm7, %xmm0
movl $4, %ecx
pcmpgtd -80(%rbp), %xmm0
subq %rax, %rcx
addq %rcx, %r15
movmskps %xmm0, %edi
movdqa %xmm7, %xmm0
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm0
movaps %xmm0, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm0
leaq -16(%rbx,%r15), %rcx
movdqa -336(%rbp), %xmm5
cltq
movups %xmm0, (%r14,%r15,4)
movups %xmm0, (%r14,%rcx,4)
movdqa %xmm5, %xmm0
movl $4, %ecx
pcmpgtd -80(%rbp), %xmm0
subq %rax, %rcx
addq %rcx, %r15
movmskps %xmm0, %edi
movdqa %xmm5, %xmm0
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm0
movaps %xmm0, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm0
leaq -20(%rbx,%r15), %rcx
movdqa -352(%rbp), %xmm5
cltq
movups %xmm0, (%r14,%r15,4)
movups %xmm0, (%r14,%rcx,4)
movdqa %xmm5, %xmm0
movl $4, %ecx
pcmpgtd -80(%rbp), %xmm0
subq %rax, %rcx
addq %rcx, %r15
movmskps %xmm0, %edi
movdqa %xmm5, %xmm0
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm0
movaps %xmm0, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm0
leaq -24(%rbx,%r15), %rcx
movdqa -368(%rbp), %xmm5
cltq
movups %xmm0, (%r14,%r15,4)
movups %xmm0, (%r14,%rcx,4)
movdqa %xmm5, %xmm0
movl $4, %ecx
pcmpgtd -80(%rbp), %xmm0
subq %rax, %rcx
addq %rcx, %r15
movmskps %xmm0, %edi
movdqa %xmm5, %xmm0
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm0
movaps %xmm0, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm0
leaq -28(%rbx,%r15), %rcx
movdqa -384(%rbp), %xmm5
cltq
movups %xmm0, (%r14,%r15,4)
movups %xmm0, (%r14,%rcx,4)
movdqa %xmm5, %xmm0
movl $4, %ecx
pcmpgtd -80(%rbp), %xmm0
subq %rax, %rcx
addq %rcx, %r15
movmskps %xmm0, %edi
movdqa %xmm5, %xmm0
movq %rdi, %rax
salq $4, %rax
pshufb (%r12,%rax), %xmm0
movaps %xmm0, -112(%rbp)
call __popcountdi2@PLT
movdqa -112(%rbp), %xmm0
leaq -32(%rbx,%r15), %rcx
movl $4, %edx
cltq
movups %xmm0, (%r14,%r15,4)
subq %rax, %rdx
movups %xmm0, (%r14,%rcx,4)
movq -248(%rbp), %rcx
leaq (%rdx,%r15), %rbx
leaq 0(,%rbx,4), %r15
subq %rbx, %rcx
.L1563:
movq -248(%rbp), %rsi
movdqa -224(%rbp), %xmm3
cmpq $4, %rcx
pcmpeqd %xmm0, %xmm0
pcmpgtd -80(%rbp), %xmm3
leaq -16(,%rsi,4), %rax
cmovnb %r15, %rax
pxor %xmm3, %xmm0
movdqu (%r14,%rax), %xmm6
movaps %xmm3, -80(%rbp)
movmskps %xmm0, %r12d
movups %xmm6, (%r14,%rsi,4)
movq %r12, %rdi
salq $4, %r12
movaps %xmm6, -112(%rbp)
call __popcountdi2@PLT
movq -168(%rbp), %rsi
movdqa -80(%rbp), %xmm3
movd %eax, %xmm6
movdqa -224(%rbp), %xmm1
movslq %eax, %rcx
pshufd $0, %xmm6, %xmm0
pcmpgtd -208(%rbp), %xmm0
pshufb (%rsi,%r12), %xmm1
movd %xmm0, %eax
testl %eax, %eax
je .L1569
movd %xmm1, (%r14,%r15)
.L1569:
pshufd $85, %xmm0, %xmm2
movd %xmm2, %eax
testl %eax, %eax
je .L1570
pshufd $85, %xmm1, %xmm2
movd %xmm2, 4(%r14,%r15)
.L1570:
movdqa %xmm0, %xmm2
punpckhdq %xmm0, %xmm2
movd %xmm2, %eax
testl %eax, %eax
je .L1571
movdqa %xmm1, %xmm2
punpckhdq %xmm1, %xmm2
movd %xmm2, 8(%r14,%r15)
.L1571:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L1572
pshufd $255, %xmm1, %xmm1
movd %xmm1, 12(%r14,%r15)
.L1572:
movmskps %xmm3, %r12d
addq %rcx, %rbx
movq %r12, %rdi
salq $4, %r12
leaq 0(,%rbx,4), %r15
call __popcountdi2@PLT
movq -168(%rbp), %rcx
movdqa -224(%rbp), %xmm1
movd %eax, %xmm6
pshufd $0, %xmm6, %xmm0
pshufb (%rcx,%r12), %xmm1
pcmpgtd -208(%rbp), %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L1573
movd %xmm1, (%r14,%rbx,4)
.L1573:
pshufd $85, %xmm0, %xmm2
movd %xmm2, %eax
testl %eax, %eax
je .L1574
pshufd $85, %xmm1, %xmm2
movd %xmm2, 4(%r14,%r15)
.L1574:
movdqa %xmm0, %xmm2
punpckhdq %xmm0, %xmm2
movd %xmm2, %eax
testl %eax, %eax
je .L1575
movdqa %xmm1, %xmm2
punpckhdq %xmm1, %xmm2
movd %xmm2, 8(%r14,%r15)
.L1575:
pshufd $255, %xmm0, %xmm0
movd %xmm0, %eax
testl %eax, %eax
je .L1576
pshufd $255, %xmm1, %xmm1
movd %xmm1, 12(%r14,%r15)
.L1576:
movq -192(%rbp), %r12
addq -256(%rbp), %rbx
subq $1, %r12
cmpl $2, -228(%rbp)
je .L1578
movq -184(%rbp), %r8
movq %r12, %r9
movq %r13, %rcx
movq %rbx, %rdx
movq -240(%rbp), %rsi
movq -88(%rbp), %rdi
call _ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -228(%rbp)
je .L1467
.L1578:
movq -176(%rbp), %rdx
movq -88(%rbp), %rax
movq %r12, %r9
movq %r13, %rcx
movq -184(%rbp), %r8
movq -240(%rbp), %rsi
subq %rbx, %rdx
leaq (%rax,%rbx,4), %rdi
call _ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1467:
addq $360, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1559:
.cfi_restore_state
movq 0(%r13), %rcx
leaq 8(%rax), %rdi
andq $-8, %rdi
movq %rcx, (%rax)
movl %r15d, %ecx
movq -8(%r13,%rcx), %rsi
movq %rsi, -8(%rax,%rcx)
subq %rdi, %rax
movq %r13, %rsi
leal (%r15,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
jmp .L1560
.p2align 4,,10
.p2align 3
.L1555:
movq (%rax), %rcx
leaq 8(%r14), %rdi
andq $-8, %rdi
movq %rcx, (%r14)
movl %r15d, %ecx
movq -8(%rax,%rcx), %rsi
movq %rsi, -8(%r14,%rcx)
movq %r14, %rcx
movq %rax, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r15d, %ecx
shrl $3, %ecx
rep movsq
jmp .L1556
.L1755:
movl 0(%r13), %ecx
jmp .L1529
.L1760:
movzbl 0(%r13), %esi
movb %sil, (%rax)
testb $2, %cl
je .L1560
movzwl -2(%r13,%rcx), %esi
movw %si, -2(%rax,%rcx)
jmp .L1560
.L1758:
movzbl (%rax), %esi
movb %sil, (%r14)
testb $2, %cl
je .L1556
movzwl -2(%rax,%rcx), %esi
movw %si, -2(%r14,%rcx)
jmp .L1556
.L1753:
cmpq $1, %rdx
jbe .L1467
movq %rdi, %rax
addq $256, %rax
cmpq %rax, %rsi
jb .L1763
movl $4, %esi
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L1467
.L1483:
movq -88(%rbp), %rax
andl $3, %r15d
movl $4, %edi
movdqa .LC0(%rip), %xmm7
subq %r15, %rdi
movdqu (%rax), %xmm5
movaps %xmm7, -208(%rbp)
movaps %xmm5, -80(%rbp)
movd %edi, %xmm5
movdqa -80(%rbp), %xmm1
pshufd $0, %xmm5, %xmm3
pcmpeqd %xmm0, %xmm1
pcmpgtd %xmm7, %xmm3
pandn %xmm3, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L1764
movq -88(%rbp), %rax
pxor %xmm3, %xmm3
movq -176(%rbp), %r8
pxor %xmm5, %xmm5
movdqa %xmm3, %xmm1
leaq 256(%rax,%rdi,4), %rsi
.p2align 4,,10
.p2align 3
.L1489:
movq %rdi, %rcx
leaq 64(%rdi), %rdi
cmpq %rdi, %r8
jb .L1765
leaq -256(%rsi), %rax
.L1488:
movdqa (%rax), %xmm4
leaq 32(%rax), %rdx
pxor %xmm2, %xmm4
por %xmm4, %xmm1
movdqa 16(%rax), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm3
movdqa 32(%rax), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm1
movdqa 48(%rax), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm3
movdqa 64(%rax), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm1
movdqa 80(%rax), %xmm4
leaq 96(%rdx), %rax
pxor %xmm2, %xmm4
por %xmm4, %xmm3
movdqa 64(%rdx), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm1
movdqa 80(%rdx), %xmm4
pxor %xmm2, %xmm4
por %xmm4, %xmm3
cmpq %rsi, %rax
jne .L1488
movdqa %xmm1, %xmm4
leaq 352(%rdx), %rsi
por %xmm3, %xmm4
pcmpeqd %xmm5, %xmm4
movmskps %xmm4, %eax
cmpl $15, %eax
je .L1489
movq -88(%rbp), %rax
movdqa %xmm0, %xmm1
pcmpeqd %xmm2, %xmm2
movq -88(%rbp), %rdx
pcmpeqd (%rax,%rcx,4), %xmm1
pxor %xmm2, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L1491
.p2align 4,,10
.p2align 3
.L1490:
addq $4, %rcx
movdqa %xmm0, %xmm1
pcmpeqd (%rdx,%rcx,4), %xmm1
pxor %xmm2, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
je .L1490
.L1491:
rep bsfl %eax, %eax
cltq
addq %rcx, %rax
.L1487:
movq -88(%rbp), %rcx
leaq (%rcx,%rax,4), %rdi
movl (%rdi), %r12d
movd %r12d, %xmm7
pshufd $0, %xmm7, %xmm2
movdqa %xmm2, %xmm1
movaps %xmm2, -80(%rbp)
pcmpgtd %xmm0, %xmm1
movmskps %xmm1, %edx
testl %edx, %edx
jne .L1496
movq -176(%rbp), %r15
movl %r12d, -160(%rbp)
xorl %ebx, %ebx
movq %r10, -96(%rbp)
leaq -4(%r15), %r14
movaps %xmm0, -144(%rbp)
movq %r14, %r12
movaps %xmm0, -112(%rbp)
movq %r13, %r14
movq %rcx, %r13
movaps %xmm2, -128(%rbp)
jmp .L1505
.p2align 4,,10
.p2align 3
.L1497:
movdqa -144(%rbp), %xmm7
movmskps %xmm1, %edi
movups %xmm7, 0(%r13,%r12,4)
call __popcountdi2@PLT
cltq
addq %rax, %rbx
leaq -4(%r12), %rax
cmpq %rax, %r15
jbe .L1766
movq %rax, %r12
.L1505:
movdqu 0(%r13,%r12,4), %xmm1
movdqu 0(%r13,%r12,4), %xmm4
pcmpeqd -112(%rbp), %xmm1
pcmpeqd -128(%rbp), %xmm4
movdqa %xmm1, %xmm5
movdqa %xmm1, %xmm6
por %xmm4, %xmm5
movmskps %xmm5, %eax
cmpl $15, %eax
je .L1497
pcmpeqd %xmm1, %xmm1
movq -88(%rbp), %rsi
movq %r14, %r13
movq %r12, %r14
pxor %xmm1, %xmm6
movq -176(%rbp), %rdx
movdqa -112(%rbp), %xmm0
leaq 4(%r14), %rcx
pandn %xmm6, %xmm4
movdqa -144(%rbp), %xmm3
movdqa -128(%rbp), %xmm2
movmskps %xmm4, %eax
subq %rbx, %rdx
movl -160(%rbp), %r12d
rep bsfl %eax, %eax
cltq
addq %r14, %rax
movd (%rsi,%rax,4), %xmm7
leaq 8(%r14), %rax
pshufd $0, %xmm7, %xmm1
movdqa %xmm1, %xmm4
movaps %xmm1, -64(%rbp)
cmpq %rax, %rdx
jb .L1498
.L1499:
movdqa -80(%rbp), %xmm6
movq %rax, %rcx
movups %xmm6, -16(%rsi,%rax,4)
addq $4, %rax
cmpq %rax, %rdx
jnb .L1499
.L1498:
subq %rcx, %rdx
leaq 0(,%rcx,4), %rsi
movq %rdx, %xmm1
pshufd $0, %xmm1, %xmm1
pcmpgtd -208(%rbp), %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L1500
movq -88(%rbp), %rax
movl %r12d, (%rax,%rcx,4)
.L1500:
pshufd $85, %xmm1, %xmm5
movd %xmm5, %eax
testl %eax, %eax
je .L1501
movq -88(%rbp), %rax
pshufd $85, %xmm2, %xmm5
movd %xmm5, 4(%rax,%rsi)
.L1501:
movdqa %xmm1, %xmm5
punpckhdq %xmm1, %xmm5
movd %xmm5, %eax
testl %eax, %eax
je .L1502
movq -88(%rbp), %rax
movdqa %xmm2, %xmm5
punpckhdq %xmm2, %xmm5
movd %xmm5, 8(%rax,%rsi)
.L1502:
pshufd $255, %xmm1, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L1504
movq -88(%rbp), %rax
pshufd $255, %xmm2, %xmm1
movd %xmm1, 12(%rax,%rsi)
.L1504:
movdqa %xmm0, %xmm1
pcmpeqd .LC5(%rip), %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
je .L1596
movdqa %xmm0, %xmm1
pcmpeqd .LC6(%rip), %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
je .L1522
movdqa %xmm4, %xmm1
pcmpgtd %xmm2, %xmm1
movdqa %xmm1, %xmm6
movdqa %xmm1, %xmm5
pandn %xmm4, %xmm6
pand %xmm2, %xmm5
por %xmm6, %xmm5
movdqa %xmm0, %xmm6
pcmpgtd %xmm5, %xmm6
movmskps %xmm6, %eax
testl %eax, %eax
jne .L1767
movdqa %xmm3, %xmm1
movl $64, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1517:
movq -88(%rbp), %rbx
leaq (%rcx,%rax,4), %rdx
addq $1, %rax
movdqu (%rbx,%rdx,4), %xmm4
movdqa %xmm4, %xmm2
pcmpgtd %xmm1, %xmm2
movdqa %xmm2, %xmm5
pand %xmm2, %xmm1
pandn %xmm4, %xmm5
por %xmm5, %xmm1
cmpq $16, %rax
jne .L1517
movdqa %xmm0, %xmm2
pcmpgtd %xmm1, %xmm2
movmskps %xmm2, %eax
testl %eax, %eax
jne .L1752
leaq 64(%rsi), %rax
cmpq %rax, -176(%rbp)
jb .L1768
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1517
.L1599:
movdqa .LC0(%rip), %xmm7
leaq _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rcx
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %rcx, -168(%rbp)
movaps %xmm7, -208(%rbp)
jmp .L1536
.L1600:
xorl %r15d, %r15d
jmp .L1563
.L1601:
movq %r14, -144(%rbp)
movl $4, %r15d
leaq _ZZN3hwy7N_SSSE36detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %r12
movq %rbx, -128(%rbp)
jmp .L1564
.L1756:
movq -176(%rbp), %rsi
movq -88(%rbp), %rdi
leaq -1(%rsi), %rbx
movq %rbx, %r12
shrq %r12
.p2align 4,,10
.p2align 3
.L1534:
movq %r12, %rdx
call _ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %r12
jnb .L1534
.p2align 4,,10
.p2align 3
.L1535:
movl (%rdi,%rbx,4), %edx
movl (%rdi), %eax
movq %rbx, %rsi
movl %edx, (%rdi)
xorl %edx, %edx
movl %eax, (%rdi,%rbx,4)
call _ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L1535
jmp .L1467
.L1759:
movl 0(%r13), %esi
movl %esi, (%rax)
movl -4(%r13,%rcx), %esi
movl %esi, -4(%rax,%rcx)
jmp .L1560
.L1757:
movl (%rax), %esi
movl %esi, (%r14)
movl -4(%rax,%rcx), %esi
movl %esi, -4(%r14,%rcx)
jmp .L1556
.L1765:
movq -88(%rbp), %rsi
movq -176(%rbp), %rdi
pcmpeqd %xmm2, %xmm2
.L1493:
movq %rcx, %rdx
addq $4, %rcx
cmpq %rcx, %rdi
jb .L1769
movdqa %xmm0, %xmm1
pcmpeqd -16(%rsi,%rcx,4), %xmm1
pxor %xmm2, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
je .L1493
.L1750:
rep bsfl %eax, %eax
cltq
addq %rdx, %rax
jmp .L1487
.L1496:
leaq -64(%rbp), %rdx
movq %r13, %rcx
movdqa %xmm2, %xmm1
movaps %xmm2, -80(%rbp)
movq -176(%rbp), %rsi
subq %rax, %rsi
call _ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1467
movd 0(%r13), %xmm7
movdqa -64(%rbp), %xmm4
movdqa -80(%rbp), %xmm2
pshufd $0, %xmm7, %xmm0
movdqa %xmm0, %xmm3
jmp .L1504
.L1766:
movq -88(%rbp), %rax
movq %r14, %r13
movq %r12, %r14
movdqa -112(%rbp), %xmm0
movd %r14d, %xmm6
movdqa -128(%rbp), %xmm2
movq -96(%rbp), %r10
movdqu (%rax), %xmm7
pshufd $0, %xmm6, %xmm4
movq -176(%rbp), %r15
pcmpgtd -208(%rbp), %xmm4
movdqa -144(%rbp), %xmm3
movl -160(%rbp), %r12d
movaps %xmm7, -112(%rbp)
movdqa -112(%rbp), %xmm1
movdqa -112(%rbp), %xmm5
subq %rbx, %r15
pcmpeqd %xmm0, %xmm1
pcmpeqd %xmm2, %xmm5
movdqa %xmm4, %xmm6
pand %xmm1, %xmm6
por %xmm5, %xmm1
pcmpeqd %xmm5, %xmm5
pxor %xmm5, %xmm4
por %xmm4, %xmm1
movmskps %xmm1, %eax
cmpl $15, %eax
jne .L1770
movmskps %xmm6, %edi
movaps %xmm2, -128(%rbp)
movaps %xmm3, -112(%rbp)
movq %r10, -144(%rbp)
call __popcountdi2@PLT
movq -88(%rbp), %rbx
movdqa -112(%rbp), %xmm3
movslq %eax, %rdx
movq %r15, %rax
movdqa -128(%rbp), %xmm2
subq %rdx, %rax
movups %xmm3, (%rbx)
cmpq $3, %rax
jbe .L1585
leaq -4(%rax), %rdx
movq -144(%rbp), %r10
movq %rdx, %rcx
shrq $2, %rcx
salq $4, %rcx
leaq 16(%rbx,%rcx), %rcx
.L1514:
movdqa -80(%rbp), %xmm7
addq $16, %r10
movups %xmm7, -16(%r10)
cmpq %rcx, %r10
jne .L1514
andq $-4, %rdx
addq $4, %rdx
leaq 0(,%rdx,4), %rcx
subq %rdx, %rax
.L1513:
movaps %xmm2, 0(%r13)
testq %rax, %rax
je .L1467
movq -88(%rbp), %rdi
leaq 0(,%rax,4), %rdx
movq %r13, %rsi
addq %rcx, %rdi
call memcpy@PLT
jmp .L1467
.L1768:
movq -176(%rbp), %rcx
movq %rbx, %rdx
jmp .L1524
.L1525:
movdqu -16(%rdx,%rsi,4), %xmm6
movdqa %xmm0, %xmm1
pcmpgtd %xmm6, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L1752
.L1524:
movq %rsi, %rax
addq $4, %rsi
cmpq %rsi, %rcx
jnb .L1525
movq -176(%rbp), %rbx
cmpq %rax, %rbx
je .L1596
movq -88(%rbp), %rax
movdqu -16(%rax,%rbx,4), %xmm7
movaps %xmm7, -80(%rbp)
pcmpgtd -80(%rbp), %xmm0
movmskps %xmm0, %eax
cmpl $1, %eax
movl $1, %eax
adcl $0, %eax
movl %eax, -228(%rbp)
jmp .L1526
.L1769:
movq -176(%rbp), %rax
pcmpeqd %xmm2, %xmm2
leaq -4(%rax), %rdx
movq -88(%rbp), %rax
movdqu (%rax,%rdx,4), %xmm6
movaps %xmm6, -80(%rbp)
movdqa -80(%rbp), %xmm1
pcmpeqd %xmm0, %xmm1
pxor %xmm2, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
je .L1467
jmp .L1750
.L1771:
movq %rbx, %rdx
jmp .L1520
.L1521:
movdqu -16(%rdx,%rsi,4), %xmm1
pcmpgtd %xmm0, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L1752
.L1520:
movq %rsi, %rax
addq $4, %rsi
cmpq %rsi, -176(%rbp)
jnb .L1521
movq -176(%rbp), %rbx
cmpq %rax, %rbx
je .L1522
movq -88(%rbp), %rax
movdqu -16(%rax,%rbx,4), %xmm6
movaps %xmm6, -80(%rbp)
movdqa -80(%rbp), %xmm1
pcmpgtd %xmm0, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L1752
.L1522:
movl $3, -228(%rbp)
pcmpeqd %xmm3, %xmm3
paddd %xmm0, %xmm3
jmp .L1526
.L1596:
movl $2, -228(%rbp)
jmp .L1526
.L1764:
rep bsfl %eax, %eax
cltq
jmp .L1487
.L1763:
movq %rdx, %rcx
xorl %eax, %eax
cmpq $3, %rdx
jbe .L1473
movq %rdx, %r10
leaq -4(%rdx), %rdx
movq (%rdi), %rcx
movq %rdi, %rbx
movq %rdx, %rax
shrq $2, %rax
movq %rcx, 0(%r13)
addq $1, %rax
salq $4, %rax
movl %eax, %ecx
movq -8(%rdi,%rcx), %rsi
leaq 8(%r13), %rdi
andq $-8, %rdi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
subq %rdi, %rcx
subq %rcx, %rbx
addl %eax, %ecx
movq %rdx, %rax
andq $-4, %rax
movq %rbx, %rsi
shrl $3, %ecx
rep movsq
addq $4, %rax
movq %r10, %rcx
subq %rax, %rcx
je .L1476
.L1473:
salq $2, %rax
leaq 0(,%rcx,4), %rdx
testq %rcx, %rcx
movq -88(%rbp), %rbx
movl $4, %ecx
leaq 0(%r13,%rax), %rdi
cmove %rcx, %rdx
leaq (%rbx,%rax), %rsi
call memcpy@PLT
.L1476:
movq -176(%rbp), %rbx
movl $32, %ecx
movl %ebx, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $4, %rdx
cmpq %rdx, %rbx
jnb .L1475
movdqa .LC4(%rip), %xmm0
movq %rbx, %rax
.L1474:
movups %xmm0, 0(%r13,%rax,4)
addq $4, %rax
cmpq %rdx, %rax
jb .L1474
.L1475:
movq %r13, %rdi
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
xorl %eax, %eax
cmpq $3, -176(%rbp)
jbe .L1478
movq -176(%rbp), %r10
movq 0(%r13), %rcx
movq -88(%rbp), %rbx
leaq -4(%r10), %rdx
movq %rdx, %rax
movq %rcx, (%rbx)
leaq 8(%rbx), %rdi
shrq $2, %rax
andq $-8, %rdi
addq $1, %rax
salq $4, %rax
movl %eax, %ecx
movq -8(%r13,%rcx), %rsi
movq %rsi, -8(%rbx,%rcx)
subq %rdi, %rbx
movq %r13, %rsi
movq %rbx, %rcx
subq %rbx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-4, %rax
shrl $3, %ecx
rep movsq
addq $4, %rax
subq %rax, %r10
movq %r10, -176(%rbp)
je .L1467
.L1478:
movq -176(%rbp), %rbx
movq -88(%rbp), %rdi
salq $2, %rax
movl $4, %ecx
leaq 0(%r13,%rax), %rsi
addq %rax, %rdi
leaq 0(,%rbx,4), %rdx
testq %rbx, %rbx
cmove %rcx, %rdx
call memcpy@PLT
jmp .L1467
.L1767:
movdqa %xmm1, %xmm5
pand %xmm4, %xmm1
pandn %xmm2, %xmm5
por %xmm5, %xmm1
pcmpgtd %xmm0, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
jne .L1752
movdqa %xmm3, %xmm1
movl $64, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1518:
movq -88(%rbp), %rbx
leaq (%rcx,%rax,4), %rdx
addq $1, %rax
movdqu (%rbx,%rdx,4), %xmm2
movdqa %xmm2, %xmm4
pcmpgtd %xmm1, %xmm4
movdqa %xmm4, %xmm5
pand %xmm4, %xmm2
pandn %xmm1, %xmm5
movdqa %xmm2, %xmm1
por %xmm5, %xmm1
cmpq $16, %rax
jne .L1518
movdqa %xmm1, %xmm2
pcmpgtd %xmm0, %xmm2
movmskps %xmm2, %eax
testl %eax, %eax
jne .L1752
leaq 64(%rsi), %rax
cmpq %rax, -176(%rbp)
jb .L1771
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1518
.L1770:
pxor %xmm5, %xmm1
movq -88(%rbp), %rbx
movmskps %xmm1, %eax
rep bsfl %eax, %eax
cltq
movd (%rbx,%rax,4), %xmm6
leaq 4(%r14), %rax
pshufd $0, %xmm6, %xmm1
movdqa %xmm1, %xmm4
movaps %xmm1, -64(%rbp)
cmpq %r15, %rax
ja .L1507
.L1508:
movq -88(%rbp), %rbx
movdqa -80(%rbp), %xmm7
movq %rax, %r14
movups %xmm7, -16(%rbx,%rax,4)
addq $4, %rax
cmpq %r15, %rax
jbe .L1508
.L1507:
subq %r14, %r15
leaq 0(,%r14,4), %rdx
movq %r15, %xmm1
pshufd $0, %xmm1, %xmm1
pcmpgtd -208(%rbp), %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L1509
movq -88(%rbp), %rax
movl %r12d, (%rax,%r14,4)
.L1509:
pshufd $85, %xmm1, %xmm5
movd %xmm5, %eax
testl %eax, %eax
je .L1510
movq -88(%rbp), %rax
pshufd $85, %xmm2, %xmm5
movd %xmm5, 4(%rax,%rdx)
.L1510:
movdqa %xmm1, %xmm5
punpckhdq %xmm1, %xmm5
movd %xmm5, %eax
testl %eax, %eax
je .L1511
movq -88(%rbp), %rax
movdqa %xmm2, %xmm5
punpckhdq %xmm2, %xmm5
movd %xmm5, 8(%rax,%rdx)
.L1511:
pshufd $255, %xmm1, %xmm1
movd %xmm1, %eax
testl %eax, %eax
je .L1504
movq -88(%rbp), %rax
pshufd $255, %xmm2, %xmm1
movd %xmm1, 12(%rax,%rdx)
jmp .L1504
.L1585:
xorl %ecx, %ecx
jmp .L1513
.cfi_endproc
.LFE18806:
.size _ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, @function
_ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0:
.LFB18808:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %rax
salq $2, %rax
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq (%rdi,%rax), %r15
pushq %r14
.cfi_offset 14, -32
leaq (%r15,%rax), %r14
pushq %r13
.cfi_offset 13, -40
leaq (%r14,%rax), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%rax), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%rax), %rbx
leaq (%rbx,%rax), %r11
leaq (%r11,%rax), %r10
leaq (%r10,%rax), %r9
andq $-32, %rsp
subq $200, %rsp
leaq (%r9,%rax), %r8
movq %rdi, 176(%rsp)
leaq (%r8,%rax), %rdi
movq %rsi, 136(%rsp)
leaq (%rdi,%rax), %rsi
leaq (%rsi,%rax), %rcx
leaq (%rcx,%rax), %rdx
movq %rdx, 184(%rsp)
addq %rax, %rdx
addq %rdx, %rax
movq %rdx, 192(%rsp)
movq 176(%rsp), %rdx
vmovdqu (%rdx), %ymm5
vpmaxsd (%r15), %ymm5, %ymm9
vpminsd (%r15), %ymm5, %ymm15
vmovdqu (%r14), %ymm5
vpminsd 0(%r13), %ymm5, %ymm14
vpmaxsd 0(%r13), %ymm5, %ymm8
vmovdqu (%r12), %ymm5
vpminsd (%rbx), %ymm5, %ymm13
vpmaxsd (%rbx), %ymm5, %ymm1
vmovdqu (%r11), %ymm5
vpmaxsd (%r10), %ymm5, %ymm7
vpminsd (%r10), %ymm5, %ymm3
vmovdqu (%r9), %ymm5
vpmaxsd (%r8), %ymm5, %ymm6
vpminsd (%r8), %ymm5, %ymm12
vmovdqu (%rdi), %ymm5
vpminsd (%rsi), %ymm5, %ymm11
vpmaxsd (%rsi), %ymm5, %ymm5
movq 184(%rsp), %rdx
cmpq $1, 136(%rsp)
vmovdqu (%rdx), %ymm2
movq 192(%rsp), %rdx
vmovdqa %ymm2, 104(%rsp)
vmovdqa 104(%rsp), %ymm2
vpminsd (%rcx), %ymm2, %ymm4
vpmaxsd (%rcx), %ymm2, %ymm0
vmovdqu (%rdx), %ymm2
vmovdqa %ymm4, 72(%rsp)
vmovdqa %ymm2, 104(%rsp)
vmovdqa 104(%rsp), %ymm10
vpmaxsd (%rax), %ymm10, %ymm4
vpminsd %ymm14, %ymm15, %ymm10
vpmaxsd %ymm14, %ymm15, %ymm15
vpminsd %ymm8, %ymm9, %ymm14
vmovdqa 104(%rsp), %ymm2
vpmaxsd %ymm8, %ymm9, %ymm8
vpminsd (%rax), %ymm2, %ymm2
vmovdqa %ymm8, 104(%rsp)
vpminsd %ymm7, %ymm1, %ymm9
vpminsd %ymm3, %ymm13, %ymm8
vpmaxsd %ymm7, %ymm1, %ymm1
vpmaxsd %ymm3, %ymm13, %ymm3
vpminsd %ymm11, %ymm12, %ymm7
vpmaxsd %ymm5, %ymm6, %ymm13
vpmaxsd %ymm11, %ymm12, %ymm12
vpminsd %ymm5, %ymm6, %ymm11
vmovdqa 72(%rsp), %ymm6
vpminsd %ymm6, %ymm2, %ymm5
vpmaxsd %ymm6, %ymm2, %ymm2
vpminsd %ymm4, %ymm0, %ymm6
vpmaxsd %ymm4, %ymm0, %ymm0
vpminsd %ymm8, %ymm10, %ymm4
vpmaxsd %ymm8, %ymm10, %ymm10
vpminsd %ymm9, %ymm14, %ymm8
vpmaxsd %ymm9, %ymm14, %ymm14
vpminsd %ymm3, %ymm15, %ymm9
vpmaxsd %ymm3, %ymm15, %ymm15
vpminsd 104(%rsp), %ymm1, %ymm3
vpmaxsd 104(%rsp), %ymm1, %ymm1
vmovdqa %ymm1, 104(%rsp)
vpminsd %ymm5, %ymm7, %ymm1
vpmaxsd %ymm5, %ymm7, %ymm5
vpminsd %ymm6, %ymm11, %ymm7
vpmaxsd %ymm6, %ymm11, %ymm6
vpminsd %ymm2, %ymm12, %ymm11
vpmaxsd %ymm2, %ymm12, %ymm12
vpminsd %ymm0, %ymm13, %ymm2
vpmaxsd %ymm0, %ymm13, %ymm0
vpminsd %ymm1, %ymm4, %ymm13
vpmaxsd %ymm1, %ymm4, %ymm1
vpminsd %ymm12, %ymm15, %ymm4
vpmaxsd %ymm12, %ymm15, %ymm12
vmovdqa 104(%rsp), %ymm15
vmovdqa %ymm13, 72(%rsp)
vpminsd %ymm7, %ymm8, %ymm13
vpmaxsd %ymm7, %ymm8, %ymm7
vpminsd %ymm11, %ymm9, %ymm8
vpmaxsd %ymm11, %ymm9, %ymm11
vpminsd %ymm2, %ymm3, %ymm9
vpmaxsd %ymm2, %ymm3, %ymm2
vpminsd %ymm5, %ymm10, %ymm3
vpmaxsd %ymm5, %ymm10, %ymm5
vpminsd %ymm6, %ymm14, %ymm10
vpmaxsd %ymm6, %ymm14, %ymm6
vpminsd %ymm15, %ymm0, %ymm14
vpmaxsd %ymm15, %ymm0, %ymm0
vmovdqa %ymm0, 104(%rsp)
vpminsd %ymm11, %ymm10, %ymm0
vpmaxsd %ymm11, %ymm10, %ymm10
vpminsd %ymm7, %ymm4, %ymm11
vpmaxsd %ymm7, %ymm4, %ymm4
vpminsd %ymm2, %ymm14, %ymm7
vpmaxsd %ymm2, %ymm14, %ymm14
vpminsd %ymm1, %ymm3, %ymm2
vpmaxsd %ymm1, %ymm3, %ymm3
vpminsd %ymm8, %ymm13, %ymm1
vpminsd %ymm5, %ymm9, %ymm15
vpmaxsd %ymm8, %ymm13, %ymm8
vpmaxsd %ymm5, %ymm9, %ymm5
vpminsd %ymm12, %ymm6, %ymm9
vpmaxsd %ymm12, %ymm6, %ymm12
vpminsd %ymm2, %ymm1, %ymm6
vpmaxsd %ymm2, %ymm1, %ymm1
vmovdqa %ymm6, 40(%rsp)
vpminsd %ymm3, %ymm8, %ymm6
vpmaxsd %ymm3, %ymm8, %ymm8
vpmaxsd %ymm12, %ymm14, %ymm3
vpminsd %ymm9, %ymm7, %ymm2
vmovdqa %ymm3, 8(%rsp)
vpminsd %ymm1, %ymm6, %ymm3
vpmaxsd %ymm9, %ymm7, %ymm9
vpminsd %ymm5, %ymm2, %ymm13
vpminsd %ymm12, %ymm14, %ymm7
vmovdqa %ymm3, -24(%rsp)
vpminsd %ymm11, %ymm0, %ymm12
vpmaxsd %ymm11, %ymm0, %ymm14
vpminsd %ymm10, %ymm4, %ymm3
vpminsd %ymm8, %ymm15, %ymm11
vpmaxsd %ymm5, %ymm2, %ymm5
vpmaxsd %ymm1, %ymm6, %ymm6
vpmaxsd %ymm10, %ymm4, %ymm4
vpmaxsd %ymm8, %ymm15, %ymm1
vpminsd %ymm12, %ymm11, %ymm2
vpminsd %ymm5, %ymm4, %ymm8
vpmaxsd %ymm12, %ymm11, %ymm11
vpminsd %ymm3, %ymm13, %ymm15
vpminsd %ymm1, %ymm14, %ymm12
vpmaxsd %ymm3, %ymm13, %ymm13
vpmaxsd %ymm1, %ymm14, %ymm1
vpminsd %ymm9, %ymm7, %ymm10
vpminsd %ymm1, %ymm15, %ymm3
vpmaxsd %ymm5, %ymm4, %ymm4
vpmaxsd %ymm1, %ymm15, %ymm15
vpminsd %ymm8, %ymm13, %ymm0
vpminsd %ymm12, %ymm11, %ymm5
vpmaxsd %ymm12, %ymm11, %ymm11
vpminsd %ymm4, %ymm10, %ymm1
vpmaxsd %ymm9, %ymm7, %ymm7
vpmaxsd %ymm4, %ymm10, %ymm4
vpminsd %ymm6, %ymm2, %ymm9
vpminsd %ymm3, %ymm11, %ymm10
vpminsd %ymm0, %ymm15, %ymm14
vpmaxsd %ymm6, %ymm2, %ymm2
vpmaxsd %ymm8, %ymm13, %ymm13
vpmaxsd %ymm3, %ymm11, %ymm11
vpmaxsd %ymm0, %ymm15, %ymm15
jbe .L1778
vmovdqa 72(%rsp), %ymm3
vpshufd $177, %ymm14, %ymm14
vpshufd $177, %ymm15, %ymm15
vpshufd $177, 104(%rsp), %ymm6
vpshufd $177, %ymm13, %ymm13
vpshufd $177, %ymm1, %ymm1
vpshufd $177, %ymm4, %ymm4
vpshufd $177, 8(%rsp), %ymm8
vpminsd %ymm3, %ymm6, %ymm12
vpmaxsd %ymm3, %ymm6, %ymm6
vmovdqa 40(%rsp), %ymm3
vpshufd $177, %ymm7, %ymm7
cmpq $3, 136(%rsp)
vmovdqa %ymm6, 104(%rsp)
vpminsd %ymm3, %ymm8, %ymm0
vpmaxsd %ymm3, %ymm8, %ymm8
vmovdqa -24(%rsp), %ymm3
vpshufd $177, %ymm8, %ymm8
vpminsd %ymm3, %ymm7, %ymm6
vpmaxsd %ymm3, %ymm7, %ymm7
vpminsd %ymm4, %ymm9, %ymm3
vpmaxsd %ymm4, %ymm9, %ymm9
vmovdqa %ymm6, 72(%rsp)
vpshufd $177, %ymm7, %ymm7
vpminsd %ymm1, %ymm2, %ymm4
vpmaxsd %ymm1, %ymm2, %ymm2
vmovdqa %ymm3, 40(%rsp)
vmovdqa 72(%rsp), %ymm3
vpminsd %ymm13, %ymm5, %ymm1
vpmaxsd %ymm13, %ymm5, %ymm5
vpshufd $177, %ymm4, %ymm4
vpshufd $177, 104(%rsp), %ymm6
vpminsd %ymm15, %ymm10, %ymm13
vpmaxsd %ymm15, %ymm10, %ymm10
vpshufd $177, %ymm1, %ymm1
vpminsd %ymm14, %ymm11, %ymm15
vpmaxsd %ymm14, %ymm11, %ymm11
vpshufd $177, %ymm13, %ymm13
vpshufd $177, %ymm15, %ymm15
vpshufd $177, %ymm9, %ymm9
vpminsd %ymm15, %ymm12, %ymm14
vpmaxsd %ymm15, %ymm12, %ymm12
vpminsd %ymm6, %ymm11, %ymm15
vpmaxsd %ymm6, %ymm11, %ymm11
vpshufd $177, %ymm12, %ymm12
vmovdqa %ymm15, 104(%rsp)
vpminsd %ymm8, %ymm10, %ymm15
vpmaxsd %ymm8, %ymm10, %ymm10
vpshufd $177, %ymm11, %ymm11
vpminsd %ymm3, %ymm1, %ymm8
vpmaxsd %ymm3, %ymm1, %ymm3
vpshufd $177, %ymm10, %ymm10
vpminsd %ymm7, %ymm5, %ymm1
vpmaxsd %ymm7, %ymm5, %ymm5
vmovdqa 40(%rsp), %ymm7
vpshufd $177, %ymm8, %ymm8
vpminsd %ymm13, %ymm0, %ymm6
vpmaxsd %ymm13, %ymm0, %ymm0
vpshufd $177, %ymm1, %ymm1
vpminsd %ymm7, %ymm4, %ymm13
vpmaxsd %ymm7, %ymm4, %ymm4
vpshufd $177, %ymm0, %ymm0
vpshufd $177, %ymm13, %ymm13
vpminsd %ymm9, %ymm2, %ymm7
vpmaxsd %ymm9, %ymm2, %ymm2
vpminsd %ymm13, %ymm14, %ymm9
vpmaxsd %ymm13, %ymm14, %ymm14
vpshufd $177, %ymm7, %ymm7
vpminsd %ymm8, %ymm6, %ymm13
vpmaxsd %ymm8, %ymm6, %ymm6
vpshufd $177, %ymm14, %ymm14
vpminsd %ymm12, %ymm4, %ymm8
vpmaxsd %ymm12, %ymm4, %ymm4
vmovdqa 104(%rsp), %ymm12
vmovdqa %ymm13, 72(%rsp)
vpminsd %ymm0, %ymm3, %ymm13
vpmaxsd %ymm0, %ymm3, %ymm3
vpshufd $177, %ymm4, %ymm4
vpminsd %ymm12, %ymm7, %ymm0
vpmaxsd %ymm12, %ymm7, %ymm7
vpshufd $177, %ymm13, %ymm13
vpminsd %ymm1, %ymm15, %ymm12
vpmaxsd %ymm1, %ymm15, %ymm1
vpshufd $177, %ymm7, %ymm7
vpminsd %ymm11, %ymm2, %ymm15
vpshufd $177, %ymm12, %ymm12
vpmaxsd %ymm11, %ymm2, %ymm2
vmovdqa %ymm15, 104(%rsp)
vpminsd %ymm10, %ymm5, %ymm11
vpmaxsd %ymm10, %ymm5, %ymm5
vpshufd $177, 72(%rsp), %ymm15
vpminsd %ymm15, %ymm9, %ymm10
vpmaxsd %ymm15, %ymm9, %ymm9
vpshufd $177, %ymm2, %ymm2
vpminsd %ymm14, %ymm6, %ymm15
vpmaxsd %ymm14, %ymm6, %ymm6
vpshufd $177, %ymm11, %ymm11
vpminsd %ymm13, %ymm8, %ymm14
vpmaxsd %ymm13, %ymm8, %ymm8
vpminsd %ymm4, %ymm3, %ymm13
vpmaxsd %ymm4, %ymm3, %ymm3
vpminsd %ymm12, %ymm0, %ymm4
vpmaxsd %ymm12, %ymm0, %ymm0
vmovdqa %ymm4, 72(%rsp)
vmovdqa 104(%rsp), %ymm4
vpminsd %ymm7, %ymm1, %ymm12
vpmaxsd %ymm7, %ymm1, %ymm1
vpminsd %ymm4, %ymm11, %ymm7
vpmaxsd %ymm4, %ymm11, %ymm11
vpminsd %ymm2, %ymm5, %ymm4
vpmaxsd %ymm2, %ymm5, %ymm5
vpshufd $177, %ymm10, %ymm2
vmovdqa %ymm5, 40(%rsp)
vpminsd %ymm2, %ymm10, %ymm5
vpmaxsd %ymm2, %ymm10, %ymm10
vpshufd $177, %ymm9, %ymm2
vpblendd $85, %ymm5, %ymm10, %ymm10
vpminsd %ymm2, %ymm9, %ymm5
vpmaxsd %ymm2, %ymm9, %ymm9
vmovdqa %ymm4, 104(%rsp)
vpblendd $85, %ymm5, %ymm9, %ymm2
vmovdqa %ymm2, 8(%rsp)
vpshufd $177, %ymm15, %ymm2
vpminsd %ymm2, %ymm15, %ymm5
vpmaxsd %ymm2, %ymm15, %ymm15
vpshufd $177, %ymm6, %ymm2
vpblendd $85, %ymm5, %ymm15, %ymm15
vpminsd %ymm2, %ymm6, %ymm5
vpmaxsd %ymm2, %ymm6, %ymm6
vpshufd $177, %ymm14, %ymm2
vpblendd $85, %ymm5, %ymm6, %ymm6
vpminsd %ymm2, %ymm14, %ymm5
vpmaxsd %ymm2, %ymm14, %ymm14
vpshufd $177, %ymm8, %ymm2
vmovdqa %ymm6, -24(%rsp)
vpblendd $85, %ymm5, %ymm14, %ymm14
vpminsd %ymm2, %ymm8, %ymm5
vpmaxsd %ymm2, %ymm8, %ymm8
vpshufd $177, %ymm13, %ymm2
vpblendd $85, %ymm5, %ymm8, %ymm6
vpshufd $177, %ymm7, %ymm8
vpminsd %ymm2, %ymm13, %ymm5
vpmaxsd %ymm2, %ymm13, %ymm13
vpshufd $177, %ymm3, %ymm2
vmovdqa %ymm6, -56(%rsp)
vpblendd $85, %ymm5, %ymm13, %ymm6
vpminsd %ymm2, %ymm3, %ymm5
vpmaxsd %ymm2, %ymm3, %ymm3
vpblendd $85, %ymm5, %ymm3, %ymm13
vmovdqa 72(%rsp), %ymm5
vmovdqa %ymm6, -88(%rsp)
vpshufd $177, %ymm5, %ymm6
vpminsd %ymm5, %ymm6, %ymm2
vpmaxsd %ymm5, %ymm6, %ymm6
vpblendd $85, %ymm2, %ymm6, %ymm6
vpshufd $177, %ymm0, %ymm2
vpminsd %ymm2, %ymm0, %ymm3
vpmaxsd %ymm2, %ymm0, %ymm0
vpblendd $85, %ymm3, %ymm0, %ymm2
vpshufd $177, %ymm12, %ymm0
vpminsd %ymm0, %ymm12, %ymm3
vpmaxsd %ymm0, %ymm12, %ymm0
vpblendd $85, %ymm3, %ymm0, %ymm0
vpshufd $177, %ymm1, %ymm3
vpminsd %ymm3, %ymm1, %ymm4
vpmaxsd %ymm3, %ymm1, %ymm1
vpblendd $85, %ymm4, %ymm1, %ymm1
vmovdqa 104(%rsp), %ymm4
vpminsd %ymm8, %ymm7, %ymm3
vpmaxsd %ymm8, %ymm7, %ymm8
vpshufd $177, %ymm11, %ymm7
vpblendd $85, %ymm3, %ymm8, %ymm8
vpshufd $177, %ymm4, %ymm9
vpminsd %ymm7, %ymm11, %ymm3
vpmaxsd %ymm7, %ymm11, %ymm7
vpblendd $85, %ymm3, %ymm7, %ymm7
vpminsd %ymm4, %ymm9, %ymm3
vpmaxsd %ymm4, %ymm9, %ymm9
vmovdqa 40(%rsp), %ymm4
vpblendd $85, %ymm3, %ymm9, %ymm9
vpshufd $177, %ymm4, %ymm5
vpminsd %ymm4, %ymm5, %ymm3
vpmaxsd %ymm4, %ymm5, %ymm5
vpblendd $85, %ymm3, %ymm5, %ymm5
jbe .L1779
vmovdqa 8(%rsp), %ymm3
vmovdqa -24(%rsp), %ymm4
vpshufd $27, %ymm1, %ymm1
vpshufd $27, %ymm8, %ymm8
vpshufd $27, %ymm7, %ymm7
vpshufd $27, %ymm9, %ymm9
vpshufd $27, %ymm5, %ymm5
cmpq $7, 136(%rsp)
vpminsd %ymm5, %ymm10, %ymm12
vpshufd $27, %ymm2, %ymm11
vpmaxsd %ymm5, %ymm10, %ymm5
vpminsd %ymm7, %ymm15, %ymm2
vpminsd %ymm3, %ymm9, %ymm10
vpshufd $27, %ymm6, %ymm6
vpmaxsd %ymm3, %ymm9, %ymm9
vpmaxsd %ymm7, %ymm15, %ymm7
vmovdqa -88(%rsp), %ymm15
vpshufd $27, %ymm0, %ymm0
vpminsd %ymm4, %ymm8, %ymm3
vpmaxsd %ymm4, %ymm8, %ymm8
vpshufd $27, %ymm5, %ymm5
vpminsd %ymm1, %ymm14, %ymm4
vpmaxsd %ymm1, %ymm14, %ymm1
vmovdqa -56(%rsp), %ymm14
vmovdqa %ymm3, 104(%rsp)
vpshufd $27, %ymm7, %ymm7
vpshufd $27, %ymm9, %ymm9
vpshufd $27, %ymm4, %ymm4
vpminsd %ymm14, %ymm0, %ymm3
vpmaxsd %ymm14, %ymm0, %ymm0
vpshufd $27, %ymm8, %ymm8
vpminsd %ymm15, %ymm11, %ymm14
vpmaxsd %ymm15, %ymm11, %ymm11
vpshufd $27, %ymm3, %ymm3
vpminsd %ymm6, %ymm13, %ymm15
vpmaxsd %ymm6, %ymm13, %ymm6
vpshufd $27, %ymm14, %ymm14
vpshufd $27, %ymm15, %ymm15
vpminsd %ymm15, %ymm12, %ymm13
vpmaxsd %ymm15, %ymm12, %ymm12
vpminsd %ymm5, %ymm6, %ymm15
vpmaxsd %ymm5, %ymm6, %ymm6
vpshufd $27, %ymm12, %ymm12
vmovdqa %ymm15, 72(%rsp)
vpminsd %ymm9, %ymm11, %ymm15
vpmaxsd %ymm9, %ymm11, %ymm11
vpshufd $27, %ymm6, %ymm6
vpminsd %ymm3, %ymm2, %ymm9
vpmaxsd %ymm3, %ymm2, %ymm2
vpshufd $27, %ymm11, %ymm11
vpminsd %ymm7, %ymm0, %ymm3
vpmaxsd %ymm7, %ymm0, %ymm0
vmovdqa 104(%rsp), %ymm7
vpshufd $27, %ymm9, %ymm9
vpminsd %ymm14, %ymm10, %ymm5
vpmaxsd %ymm14, %ymm10, %ymm10
vpshufd $27, %ymm3, %ymm3
vpminsd %ymm7, %ymm4, %ymm14
vpmaxsd %ymm7, %ymm4, %ymm4
vpshufd $27, %ymm14, %ymm14
vpminsd %ymm8, %ymm1, %ymm7
vpmaxsd %ymm8, %ymm1, %ymm1
vpshufd $27, %ymm10, %ymm8
vpminsd %ymm14, %ymm13, %ymm10
vpmaxsd %ymm14, %ymm13, %ymm14
vpminsd %ymm9, %ymm5, %ymm13
vpmaxsd %ymm9, %ymm5, %ymm5
vpshufd $27, %ymm7, %ymm7
vpminsd %ymm12, %ymm4, %ymm9
vpmaxsd %ymm12, %ymm4, %ymm4
vmovdqa 72(%rsp), %ymm12
vmovdqa %ymm13, 104(%rsp)
vpminsd %ymm8, %ymm2, %ymm13
vpshufd $27, %ymm14, %ymm14
vpmaxsd %ymm8, %ymm2, %ymm2
vpshufd $27, %ymm13, %ymm13
vpminsd %ymm12, %ymm7, %ymm8
vpshufd $27, %ymm4, %ymm4
vpmaxsd %ymm12, %ymm7, %ymm7
vpminsd %ymm3, %ymm15, %ymm12
vpmaxsd %ymm3, %ymm15, %ymm3
vpminsd %ymm6, %ymm1, %ymm15
vpshufd $27, %ymm12, %ymm12
vmovdqa %ymm15, 72(%rsp)
vpmaxsd %ymm6, %ymm1, %ymm1
vpminsd %ymm11, %ymm0, %ymm6
vpshufd $27, 104(%rsp), %ymm15
vpmaxsd %ymm11, %ymm0, %ymm0
vpminsd %ymm15, %ymm10, %ymm11
vpshufd $27, %ymm7, %ymm7
vpmaxsd %ymm15, %ymm10, %ymm10
vpminsd %ymm14, %ymm5, %ymm15
vpshufd $27, %ymm1, %ymm1
vpmaxsd %ymm14, %ymm5, %ymm5
vpminsd %ymm13, %ymm9, %ymm14
vpshufd $27, %ymm6, %ymm6
vpmaxsd %ymm13, %ymm9, %ymm9
vpminsd %ymm4, %ymm2, %ymm13
vpmaxsd %ymm4, %ymm2, %ymm2
vpminsd %ymm12, %ymm8, %ymm4
vmovdqa %ymm2, 40(%rsp)
vmovdqa 72(%rsp), %ymm2
vpmaxsd %ymm12, %ymm8, %ymm8
vpminsd %ymm7, %ymm3, %ymm12
vpmaxsd %ymm7, %ymm3, %ymm3
vpminsd %ymm2, %ymm6, %ymm7
vpmaxsd %ymm2, %ymm6, %ymm6
vpminsd %ymm1, %ymm0, %ymm2
vpmaxsd %ymm1, %ymm0, %ymm0
vmovdqa %ymm0, 72(%rsp)
vpshufd $27, %ymm11, %ymm0
vpminsd %ymm0, %ymm11, %ymm1
vpmaxsd %ymm0, %ymm11, %ymm11
vpshufd $27, %ymm10, %ymm0
vmovdqa %ymm2, 104(%rsp)
vpblendd $51, %ymm1, %ymm11, %ymm11
vpminsd %ymm0, %ymm10, %ymm1
vpmaxsd %ymm0, %ymm10, %ymm10
vmovdqa 40(%rsp), %ymm2
vpshufd $27, %ymm15, %ymm0
vpblendd $51, %ymm1, %ymm10, %ymm10
vpminsd %ymm0, %ymm15, %ymm1
vpmaxsd %ymm0, %ymm15, %ymm15
vpshufd $27, %ymm5, %ymm0
vpblendd $51, %ymm1, %ymm15, %ymm15
vpminsd %ymm0, %ymm5, %ymm1
vpmaxsd %ymm0, %ymm5, %ymm5
vpshufd $27, %ymm14, %ymm0
vpblendd $51, %ymm1, %ymm5, %ymm5
vpminsd %ymm0, %ymm14, %ymm1
vpmaxsd %ymm0, %ymm14, %ymm14
vpshufd $27, %ymm9, %ymm0
vpblendd $51, %ymm1, %ymm14, %ymm14
vpminsd %ymm0, %ymm9, %ymm1
vpmaxsd %ymm0, %ymm9, %ymm9
vpshufd $27, %ymm13, %ymm0
vpblendd $51, %ymm1, %ymm9, %ymm9
vpminsd %ymm0, %ymm13, %ymm1
vpmaxsd %ymm0, %ymm13, %ymm13
vpshufd $27, %ymm2, %ymm0
vpblendd $51, %ymm1, %ymm13, %ymm13
vpminsd %ymm2, %ymm0, %ymm1
vpmaxsd %ymm2, %ymm0, %ymm2
vpshufd $27, %ymm4, %ymm0
vpblendd $51, %ymm1, %ymm2, %ymm2
vpminsd %ymm0, %ymm4, %ymm1
vpmaxsd %ymm0, %ymm4, %ymm4
vpshufd $27, %ymm8, %ymm0
vpblendd $51, %ymm1, %ymm4, %ymm4
vpminsd %ymm0, %ymm8, %ymm1
vpmaxsd %ymm0, %ymm8, %ymm8
vpshufd $27, %ymm12, %ymm0
vpblendd $51, %ymm1, %ymm8, %ymm8
vpminsd %ymm0, %ymm12, %ymm1
vpmaxsd %ymm0, %ymm12, %ymm12
vpshufd $27, %ymm3, %ymm0
vpblendd $51, %ymm1, %ymm12, %ymm12
vpminsd %ymm0, %ymm3, %ymm1
vpmaxsd %ymm0, %ymm3, %ymm3
vpshufd $27, %ymm7, %ymm0
vpblendd $51, %ymm1, %ymm3, %ymm3
vpminsd %ymm0, %ymm7, %ymm1
vpmaxsd %ymm0, %ymm7, %ymm7
vpshufd $27, %ymm6, %ymm0
vpblendd $51, %ymm1, %ymm7, %ymm7
vpminsd %ymm0, %ymm6, %ymm1
vpmaxsd %ymm0, %ymm6, %ymm6
vpblendd $51, %ymm1, %ymm6, %ymm6
vmovdqa 104(%rsp), %ymm1
vpshufd $27, %ymm1, %ymm0
vpminsd %ymm1, %ymm0, %ymm1
vpmaxsd 104(%rsp), %ymm0, %ymm0
vpblendd $51, %ymm1, %ymm0, %ymm1
vmovdqa %ymm1, 104(%rsp)
vmovdqa 72(%rsp), %ymm1
vpshufd $27, %ymm1, %ymm0
vpminsd %ymm1, %ymm0, %ymm1
vpmaxsd 72(%rsp), %ymm0, %ymm0
vpblendd $51, %ymm1, %ymm0, %ymm0
vmovdqa %ymm0, 72(%rsp)
vpshufd $177, %ymm11, %ymm0
vpminsd %ymm0, %ymm11, %ymm1
vpmaxsd %ymm0, %ymm11, %ymm11
vpshufd $177, %ymm10, %ymm0
vpblendd $85, %ymm1, %ymm11, %ymm11
vpminsd %ymm0, %ymm10, %ymm1
vpmaxsd %ymm0, %ymm10, %ymm10
vpshufd $177, %ymm15, %ymm0
vpblendd $85, %ymm1, %ymm10, %ymm10
vmovdqa %ymm11, 40(%rsp)
vpminsd %ymm0, %ymm15, %ymm1
vpmaxsd %ymm0, %ymm15, %ymm15
vpshufd $177, %ymm5, %ymm0
vpblendd $85, %ymm1, %ymm15, %ymm11
vpminsd %ymm0, %ymm5, %ymm1
vpmaxsd %ymm0, %ymm5, %ymm5
vpshufd $177, %ymm14, %ymm0
vpblendd $85, %ymm1, %ymm5, %ymm5
vmovdqa %ymm11, 8(%rsp)
vpshufd $177, %ymm8, %ymm15
vpminsd %ymm0, %ymm14, %ymm1
vpmaxsd %ymm0, %ymm14, %ymm14
vpshufd $177, %ymm9, %ymm0
vpblendd $85, %ymm1, %ymm14, %ymm11
vpminsd %ymm0, %ymm9, %ymm1
vpmaxsd %ymm0, %ymm9, %ymm9
vpshufd $177, %ymm13, %ymm0
vmovdqa %ymm11, -24(%rsp)
vpshufd $177, %ymm4, %ymm14
vpblendd $85, %ymm1, %ymm9, %ymm11
vpminsd %ymm0, %ymm13, %ymm1
vpmaxsd %ymm0, %ymm13, %ymm13
vpshufd $177, %ymm2, %ymm0
vmovdqa %ymm11, -56(%rsp)
vpblendd $85, %ymm1, %ymm13, %ymm11
vpminsd %ymm0, %ymm2, %ymm1
vpmaxsd %ymm0, %ymm2, %ymm2
vpshufd $177, %ymm12, %ymm13
vmovdqa %ymm11, -88(%rsp)
vpminsd %ymm14, %ymm4, %ymm0
vpblendd $85, %ymm1, %ymm2, %ymm11
vpminsd %ymm15, %ymm8, %ymm1
vpmaxsd %ymm15, %ymm8, %ymm15
vpblendd $85, %ymm1, %ymm15, %ymm15
vpminsd %ymm13, %ymm12, %ymm1
vpmaxsd %ymm13, %ymm12, %ymm13
vpmaxsd %ymm14, %ymm4, %ymm14
vpblendd $85, %ymm1, %ymm13, %ymm13
vpshufd $177, %ymm3, %ymm1
vpshufd $177, %ymm7, %ymm4
vpblendd $85, %ymm0, %ymm14, %ymm14
vpminsd %ymm1, %ymm3, %ymm0
vpmaxsd %ymm1, %ymm3, %ymm1
vmovdqa 72(%rsp), %ymm3
vpblendd $85, %ymm0, %ymm1, %ymm1
vpminsd %ymm4, %ymm7, %ymm0
vpmaxsd %ymm4, %ymm7, %ymm4
vpshufd $177, %ymm6, %ymm7
vpblendd $85, %ymm0, %ymm4, %ymm4
vpshufd $177, %ymm3, %ymm12
vpminsd %ymm7, %ymm6, %ymm0
vpmaxsd %ymm7, %ymm6, %ymm7
vmovdqa 104(%rsp), %ymm6
vpblendd $85, %ymm0, %ymm7, %ymm7
vpshufd $177, %ymm6, %ymm9
vpminsd %ymm6, %ymm9, %ymm0
vpmaxsd %ymm6, %ymm9, %ymm9
vpblendd $85, %ymm0, %ymm9, %ymm9
vpminsd %ymm3, %ymm12, %ymm0
vpmaxsd %ymm3, %ymm12, %ymm12
vpblendd $85, %ymm0, %ymm12, %ymm12
jbe .L1780
vmovdqa .LC13(%rip), %ymm2
vmovdqa 40(%rsp), %ymm3
vpermd %ymm12, %ymm2, %ymm12
vpermd %ymm15, %ymm2, %ymm0
vpermd %ymm13, %ymm2, %ymm6
vpmaxsd %ymm3, %ymm12, %ymm15
vpminsd %ymm3, %ymm12, %ymm13
vpermd %ymm14, %ymm2, %ymm14
vmovdqa 8(%rsp), %ymm3
vmovdqa %ymm14, 136(%rsp)
vpermd %ymm7, %ymm2, %ymm7
vpermd %ymm1, %ymm2, %ymm14
vpermd %ymm4, %ymm2, %ymm1
vmovdqa -24(%rsp), %ymm4
vpminsd %ymm3, %ymm7, %ymm8
vpmaxsd %ymm3, %ymm7, %ymm7
vmovdqa %ymm6, 104(%rsp)
vpminsd %ymm1, %ymm5, %ymm3
vpermd %ymm9, %ymm2, %ymm6
vpmaxsd %ymm1, %ymm5, %ymm1
vmovdqa 104(%rsp), %ymm5
vmovdqa %ymm3, 72(%rsp)
vpminsd %ymm4, %ymm14, %ymm3
vpermd %ymm7, %ymm2, %ymm7
vpermd %ymm1, %ymm2, %ymm1
vpmaxsd %ymm4, %ymm14, %ymm4
vpminsd %ymm6, %ymm10, %ymm12
vpermd %ymm3, %ymm2, %ymm3
vmovdqa 136(%rsp), %ymm14
vmovdqa %ymm4, 40(%rsp)
vpmaxsd %ymm6, %ymm10, %ymm6
vmovdqa -88(%rsp), %ymm4
vmovdqa -56(%rsp), %ymm10
vpermd %ymm6, %ymm2, %ymm6
vpminsd %ymm10, %ymm5, %ymm9
vpmaxsd %ymm5, %ymm10, %ymm5
vpminsd %ymm4, %ymm0, %ymm10
vpmaxsd %ymm4, %ymm0, %ymm0
vpermd %ymm9, %ymm2, %ymm9
vpminsd %ymm14, %ymm11, %ymm4
vpmaxsd %ymm14, %ymm11, %ymm11
vpermd %ymm15, %ymm2, %ymm14
vpermd %ymm4, %ymm2, %ymm4
vpermd %ymm10, %ymm2, %ymm10
vpminsd %ymm4, %ymm13, %ymm15
vpmaxsd %ymm4, %ymm13, %ymm13
vpminsd %ymm14, %ymm11, %ymm4
vpmaxsd %ymm14, %ymm11, %ymm11
vpermd %ymm13, %ymm2, %ymm13
vmovdqa %ymm4, 136(%rsp)
vpmaxsd %ymm7, %ymm5, %ymm14
vpminsd %ymm10, %ymm12, %ymm4
vpermd %ymm11, %ymm2, %ymm11
vpmaxsd %ymm10, %ymm12, %ymm12
vpminsd %ymm6, %ymm0, %ymm10
vpmaxsd %ymm6, %ymm0, %ymm0
vpminsd %ymm9, %ymm8, %ymm6
vmovdqa %ymm10, 104(%rsp)
vpermd %ymm12, %ymm2, %ymm12
vpmaxsd %ymm9, %ymm8, %ymm8
vpminsd %ymm7, %ymm5, %ymm9
vmovdqa 72(%rsp), %ymm7
vpermd %ymm6, %ymm2, %ymm6
vpermd %ymm9, %ymm2, %ymm9
vpermd %ymm0, %ymm2, %ymm0
vpminsd %ymm7, %ymm3, %ymm10
vpmaxsd %ymm7, %ymm3, %ymm3
vmovdqa 40(%rsp), %ymm7
vpermd %ymm10, %ymm2, %ymm10
vpminsd %ymm7, %ymm1, %ymm5
vpmaxsd %ymm7, %ymm1, %ymm1
vpminsd %ymm10, %ymm15, %ymm7
vpmaxsd %ymm10, %ymm15, %ymm15
vpermd %ymm5, %ymm2, %ymm5
vpminsd %ymm6, %ymm4, %ymm10
vpmaxsd %ymm6, %ymm4, %ymm4
vpermd %ymm15, %ymm2, %ymm15
vpminsd %ymm13, %ymm3, %ymm6
vpmaxsd %ymm13, %ymm3, %ymm3
vpermd %ymm10, %ymm2, %ymm10
vpminsd %ymm12, %ymm8, %ymm13
vpmaxsd %ymm12, %ymm8, %ymm8
vpermd %ymm3, %ymm2, %ymm3
vmovdqa %ymm13, 72(%rsp)
vmovdqa 136(%rsp), %ymm13
vpminsd %ymm13, %ymm5, %ymm12
vpmaxsd %ymm13, %ymm5, %ymm5
vmovdqa %ymm12, 40(%rsp)
vmovdqa 104(%rsp), %ymm12
vpermd %ymm5, %ymm2, %ymm5
vpminsd %ymm12, %ymm9, %ymm13
vpmaxsd %ymm12, %ymm9, %ymm9
vpminsd %ymm11, %ymm1, %ymm12
vpermd %ymm13, %ymm2, %ymm13
vpmaxsd %ymm11, %ymm1, %ymm1
vmovdqa %ymm12, 104(%rsp)
vpminsd %ymm0, %ymm14, %ymm12
vpmaxsd %ymm0, %ymm14, %ymm0
vpermd 72(%rsp), %ymm2, %ymm14
vpminsd %ymm10, %ymm7, %ymm11
vpmaxsd %ymm10, %ymm7, %ymm7
vpermd %ymm12, %ymm2, %ymm12
vmovdqa %ymm0, 136(%rsp)
vmovdqa 40(%rsp), %ymm0
vpminsd %ymm15, %ymm4, %ymm10
vpmaxsd %ymm15, %ymm4, %ymm4
vpermd %ymm1, %ymm2, %ymm1
vpminsd %ymm14, %ymm6, %ymm15
vpmaxsd %ymm14, %ymm6, %ymm6
vpminsd %ymm3, %ymm8, %ymm14
vpmaxsd %ymm3, %ymm8, %ymm3
vpminsd %ymm0, %ymm13, %ymm8
vpmaxsd %ymm0, %ymm13, %ymm13
vpminsd %ymm5, %ymm9, %ymm0
vpmaxsd %ymm5, %ymm9, %ymm5
vmovdqa %ymm0, 72(%rsp)
vmovdqa 104(%rsp), %ymm0
vpminsd %ymm0, %ymm12, %ymm9
vpmaxsd %ymm0, %ymm12, %ymm12
vpminsd 136(%rsp), %ymm1, %ymm0
vpmaxsd 136(%rsp), %ymm1, %ymm1
vmovdqa %ymm0, 104(%rsp)
vpermd %ymm11, %ymm2, %ymm0
vmovdqa %ymm1, 40(%rsp)
vpminsd %ymm0, %ymm11, %ymm1
vpmaxsd %ymm0, %ymm11, %ymm11
vpermd %ymm7, %ymm2, %ymm0
vpblendd $15, %ymm1, %ymm11, %ymm11
vpminsd %ymm0, %ymm7, %ymm1
vpmaxsd %ymm0, %ymm7, %ymm7
vpermd %ymm10, %ymm2, %ymm0
vpblendd $15, %ymm1, %ymm7, %ymm7
vpminsd %ymm0, %ymm10, %ymm1
vpmaxsd %ymm0, %ymm10, %ymm10
vpermd %ymm4, %ymm2, %ymm0
vpblendd $15, %ymm1, %ymm10, %ymm10
vpminsd %ymm0, %ymm4, %ymm1
vpmaxsd %ymm0, %ymm4, %ymm4
vpermd %ymm15, %ymm2, %ymm0
vpblendd $15, %ymm1, %ymm4, %ymm4
vmovdqa %ymm10, 8(%rsp)
vpminsd %ymm0, %ymm15, %ymm1
vpmaxsd %ymm0, %ymm15, %ymm15
vpermd %ymm6, %ymm2, %ymm0
vpblendd $15, %ymm1, %ymm15, %ymm15
vpminsd %ymm0, %ymm6, %ymm1
vpmaxsd %ymm0, %ymm6, %ymm6
vpermd %ymm14, %ymm2, %ymm0
vpblendd $15, %ymm1, %ymm6, %ymm10
vpminsd %ymm0, %ymm14, %ymm1
vpmaxsd %ymm0, %ymm14, %ymm14
vpermd %ymm3, %ymm2, %ymm0
vpblendd $15, %ymm1, %ymm14, %ymm14
vpminsd %ymm0, %ymm3, %ymm1
vpmaxsd %ymm0, %ymm3, %ymm3
vpermd %ymm8, %ymm2, %ymm0
vmovdqa %ymm14, -24(%rsp)
vpblendd $15, %ymm1, %ymm3, %ymm14
vpminsd %ymm0, %ymm8, %ymm1
vpmaxsd %ymm0, %ymm8, %ymm8
vpermd %ymm13, %ymm2, %ymm0
vpblendd $15, %ymm1, %ymm8, %ymm8
vpminsd %ymm0, %ymm13, %ymm1
vpmaxsd %ymm0, %ymm13, %ymm13
vmovdqa %ymm8, -56(%rsp)
vmovdqa 72(%rsp), %ymm3
vpblendd $15, %ymm1, %ymm13, %ymm13
vmovdqa 40(%rsp), %ymm6
vpermd %ymm3, %ymm2, %ymm0
vpminsd %ymm3, %ymm0, %ymm1
vpmaxsd %ymm3, %ymm0, %ymm0
vpblendd $15, %ymm1, %ymm0, %ymm3
vpermd %ymm5, %ymm2, %ymm0
vpminsd %ymm0, %ymm5, %ymm1
vpmaxsd %ymm0, %ymm5, %ymm5
vpermd %ymm9, %ymm2, %ymm0
vmovdqa %ymm3, 72(%rsp)
vpblendd $15, %ymm1, %ymm5, %ymm8
vmovdqa 104(%rsp), %ymm5
vpminsd %ymm0, %ymm9, %ymm1
vpmaxsd %ymm0, %ymm9, %ymm9
vpermd %ymm12, %ymm2, %ymm0
vpblendd $15, %ymm1, %ymm9, %ymm9
vpminsd %ymm0, %ymm12, %ymm1
vpmaxsd %ymm0, %ymm12, %ymm12
vpermd %ymm5, %ymm2, %ymm0
vmovdqa %ymm9, -88(%rsp)
vpblendd $15, %ymm1, %ymm12, %ymm12
vpermd %ymm6, %ymm2, %ymm2
vpminsd %ymm5, %ymm0, %ymm1
vpmaxsd %ymm5, %ymm0, %ymm0
vpshufd $78, %ymm10, %ymm9
vmovdqa %ymm12, 136(%rsp)
vpblendd $15, %ymm1, %ymm0, %ymm5
vpminsd %ymm6, %ymm2, %ymm0
vpmaxsd %ymm6, %ymm2, %ymm2
vpblendd $15, %ymm0, %ymm2, %ymm3
vpshufd $78, %ymm11, %ymm0
vpshufd $78, %ymm7, %ymm6
vmovdqa %ymm5, 104(%rsp)
vpminsd %ymm0, %ymm11, %ymm1
vpmaxsd %ymm0, %ymm11, %ymm0
vpshufd $78, %ymm15, %ymm5
vpblendd $51, %ymm1, %ymm0, %ymm0
vpminsd %ymm6, %ymm7, %ymm1
vpmaxsd %ymm6, %ymm7, %ymm6
vmovdqa 8(%rsp), %ymm7
vpblendd $51, %ymm1, %ymm6, %ymm6
vpshufd $78, %ymm14, %ymm11
vpshufd $78, %ymm7, %ymm12
vpminsd %ymm7, %ymm12, %ymm1
vpmaxsd %ymm7, %ymm12, %ymm12
vpshufd $78, %ymm4, %ymm7
vpblendd $51, %ymm1, %ymm12, %ymm12
vpminsd %ymm7, %ymm4, %ymm1
vpmaxsd %ymm7, %ymm4, %ymm7
vmovdqa -24(%rsp), %ymm4
vpblendd $51, %ymm1, %ymm7, %ymm7
vpminsd %ymm5, %ymm15, %ymm1
vpmaxsd %ymm5, %ymm15, %ymm5
vpblendd $51, %ymm1, %ymm5, %ymm5
vpminsd %ymm9, %ymm10, %ymm1
vpmaxsd %ymm9, %ymm10, %ymm9
vpshufd $78, %ymm4, %ymm10
vpblendd $51, %ymm1, %ymm9, %ymm9
vpshufd $78, %ymm13, %ymm15
vpminsd %ymm4, %ymm10, %ymm1
vpmaxsd %ymm4, %ymm10, %ymm10
vmovdqa -56(%rsp), %ymm4
vpblendd $51, %ymm1, %ymm10, %ymm10
vpminsd %ymm11, %ymm14, %ymm1
vpmaxsd %ymm11, %ymm14, %ymm11
vpshufd $78, %ymm4, %ymm14
vpblendd $51, %ymm1, %ymm11, %ymm11
vpminsd %ymm4, %ymm14, %ymm1
vpmaxsd %ymm4, %ymm14, %ymm14
vmovdqa 72(%rsp), %ymm4
vpblendd $51, %ymm1, %ymm14, %ymm14
vpminsd %ymm15, %ymm13, %ymm1
vpmaxsd %ymm15, %ymm13, %ymm15
vpshufd $78, %ymm4, %ymm13
vpblendd $51, %ymm1, %ymm15, %ymm15
vpminsd %ymm4, %ymm13, %ymm1
vpmaxsd %ymm4, %ymm13, %ymm13
vmovdqa -88(%rsp), %ymm4
vpblendd $51, %ymm1, %ymm13, %ymm13
vpshufd $78, %ymm8, %ymm1
vpminsd %ymm1, %ymm8, %ymm2
vpmaxsd %ymm1, %ymm8, %ymm1
vpshufd $78, %ymm4, %ymm8
vpblendd $51, %ymm2, %ymm1, %ymm1
vpminsd %ymm4, %ymm8, %ymm2
vpmaxsd %ymm4, %ymm8, %ymm8
vmovdqa 136(%rsp), %ymm4
vpblendd $51, %ymm2, %ymm8, %ymm8
vpshufd $78, %ymm4, %ymm2
vpminsd %ymm4, %ymm2, %ymm4
vpmaxsd 136(%rsp), %ymm2, %ymm2
vpblendd $51, %ymm4, %ymm2, %ymm2
vmovdqa 104(%rsp), %ymm4
vmovdqa %ymm2, -56(%rsp)
vpshufd $78, %ymm4, %ymm2
vpminsd %ymm4, %ymm2, %ymm4
vpmaxsd 104(%rsp), %ymm2, %ymm2
vpblendd $51, %ymm4, %ymm2, %ymm4
vpshufd $78, %ymm3, %ymm2
vmovdqa %ymm4, -88(%rsp)
vpminsd %ymm2, %ymm3, %ymm4
vpmaxsd %ymm2, %ymm3, %ymm3
vpblendd $51, %ymm4, %ymm3, %ymm2
vpshufd $177, %ymm8, %ymm4
vmovdqa %ymm2, -120(%rsp)
vpshufd $177, %ymm0, %ymm2
vpminsd %ymm2, %ymm0, %ymm3
vpmaxsd %ymm2, %ymm0, %ymm0
vpblendd $85, %ymm3, %ymm0, %ymm0
vmovdqa %ymm0, 136(%rsp)
vpshufd $177, %ymm6, %ymm0
vpminsd %ymm0, %ymm6, %ymm2
vpmaxsd %ymm0, %ymm6, %ymm6
vpblendd $85, %ymm2, %ymm6, %ymm0
vpshufd $177, %ymm14, %ymm6
vmovdqa %ymm0, 104(%rsp)
vpshufd $177, %ymm12, %ymm0
vpminsd %ymm0, %ymm12, %ymm2
vpmaxsd %ymm0, %ymm12, %ymm12
vpblendd $85, %ymm2, %ymm12, %ymm0
vmovdqa %ymm0, 72(%rsp)
vpshufd $177, %ymm7, %ymm0
vpminsd %ymm0, %ymm7, %ymm2
vpmaxsd %ymm0, %ymm7, %ymm7
vpshufd $177, %ymm5, %ymm0
vpblendd $85, %ymm2, %ymm7, %ymm7
vpminsd %ymm0, %ymm5, %ymm2
vpmaxsd %ymm0, %ymm5, %ymm5
vpshufd $177, %ymm9, %ymm0
vmovdqa %ymm7, 40(%rsp)
vpblendd $85, %ymm2, %ymm5, %ymm7
vmovdqa -56(%rsp), %ymm5
vpminsd %ymm0, %ymm9, %ymm2
vpmaxsd %ymm0, %ymm9, %ymm9
vpshufd $177, %ymm10, %ymm0
vmovdqa %ymm7, 8(%rsp)
vpblendd $85, %ymm2, %ymm9, %ymm7
vpminsd %ymm0, %ymm10, %ymm2
vpmaxsd %ymm0, %ymm10, %ymm10
vpshufd $177, %ymm11, %ymm0
vpblendd $85, %ymm2, %ymm10, %ymm10
vmovdqa %ymm7, -24(%rsp)
vpshufd $177, %ymm5, %ymm7
vpminsd %ymm0, %ymm11, %ymm2
vpmaxsd %ymm0, %ymm11, %ymm11
vpblendd $85, %ymm2, %ymm11, %ymm11
vpminsd %ymm6, %ymm14, %ymm0
vpshufd $177, %ymm15, %ymm2
vpmaxsd %ymm6, %ymm14, %ymm14
vpminsd %ymm2, %ymm15, %ymm3
vmovdqa -120(%rsp), %ymm6
vpmaxsd %ymm2, %ymm15, %ymm15
vpblendd $85, %ymm0, %ymm14, %ymm14
vpshufd $177, %ymm13, %ymm0
vpminsd %ymm0, %ymm13, %ymm2
vpblendd $85, %ymm3, %ymm15, %ymm15
vpmaxsd %ymm0, %ymm13, %ymm13
vmovdqa -88(%rsp), %ymm3
vpshufd $177, %ymm1, %ymm0
vpblendd $85, %ymm2, %ymm13, %ymm13
vpminsd %ymm0, %ymm1, %ymm2
vpmaxsd %ymm0, %ymm1, %ymm1
vpshufd $177, %ymm3, %ymm9
vpminsd %ymm4, %ymm8, %ymm0
vpmaxsd %ymm4, %ymm8, %ymm4
vpblendd $85, %ymm2, %ymm1, %ymm1
vpblendd $85, %ymm0, %ymm4, %ymm4
vpminsd %ymm5, %ymm7, %ymm0
vpmaxsd %ymm5, %ymm7, %ymm7
vpblendd $85, %ymm0, %ymm7, %ymm7
vpshufd $177, %ymm6, %ymm5
vpminsd %ymm3, %ymm9, %ymm0
vpmaxsd %ymm3, %ymm9, %ymm9
vpblendd $85, %ymm0, %ymm9, %ymm3
vpminsd %ymm6, %ymm5, %ymm0
vpmaxsd %ymm6, %ymm5, %ymm5
vpblendd $85, %ymm0, %ymm5, %ymm12
.L1774:
vmovdqa 136(%rsp), %ymm6
vmovdqa 104(%rsp), %ymm5
movq 176(%rsp), %rdx
vmovdqu %ymm6, (%rdx)
vmovdqa 72(%rsp), %ymm6
vmovdqu %ymm5, (%r15)
vmovdqa 40(%rsp), %ymm5
vmovdqu %ymm6, (%r14)
vmovdqa 8(%rsp), %ymm6
vmovdqu %ymm5, 0(%r13)
vmovdqa -24(%rsp), %ymm5
vmovdqu %ymm6, (%r12)
vmovdqu %ymm5, (%rbx)
movq 192(%rsp), %rbx
vmovdqu %ymm10, (%r11)
vmovdqu %ymm11, (%r10)
vmovdqu %ymm14, (%r9)
vmovdqu %ymm15, (%r8)
vmovdqu %ymm13, (%rdi)
vmovdqu %ymm1, (%rsi)
vmovdqu %ymm4, (%rcx)
movq 184(%rsp), %rcx
vmovdqu %ymm7, (%rcx)
vmovdqu %ymm3, (%rbx)
vmovdqu %ymm12, (%rax)
vzeroupper
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1778:
.cfi_restore_state
vmovdqa 72(%rsp), %ymm6
vmovdqa 104(%rsp), %ymm12
vmovdqa 8(%rsp), %ymm3
vmovdqa %ymm2, 8(%rsp)
vmovdqa %ymm6, 136(%rsp)
vmovdqa 40(%rsp), %ymm6
vmovdqa %ymm9, 40(%rsp)
vmovdqa %ymm6, 104(%rsp)
vmovdqa -24(%rsp), %ymm6
vmovdqa %ymm5, -24(%rsp)
vmovdqa %ymm6, 72(%rsp)
jmp .L1774
.p2align 4,,10
.p2align 3
.L1779:
vmovdqa 8(%rsp), %ymm3
vmovdqa %ymm13, %ymm11
vmovdqa %ymm8, %ymm4
vmovdqa %ymm0, %ymm13
vmovdqa %ymm10, 136(%rsp)
vmovdqa %ymm5, %ymm12
vmovdqa -88(%rsp), %ymm10
vmovdqa %ymm3, 104(%rsp)
vmovdqa -24(%rsp), %ymm3
vmovdqa %ymm15, 72(%rsp)
vmovdqa %ymm2, %ymm15
vmovdqa %ymm3, 40(%rsp)
vmovdqa -56(%rsp), %ymm3
vmovdqa %ymm14, 8(%rsp)
vmovdqa %ymm6, %ymm14
vmovdqa %ymm3, -24(%rsp)
vmovdqa %ymm9, %ymm3
jmp .L1774
.p2align 4,,10
.p2align 3
.L1780:
vmovdqa 40(%rsp), %ymm6
vmovdqa %ymm5, 40(%rsp)
vmovdqa -24(%rsp), %ymm5
vmovdqa %ymm9, %ymm3
vmovdqa %ymm10, 104(%rsp)
vmovdqa -88(%rsp), %ymm10
vmovdqa %ymm6, 136(%rsp)
vmovdqa 8(%rsp), %ymm6
vmovdqa %ymm5, 8(%rsp)
vmovdqa -56(%rsp), %ymm5
vmovdqa %ymm6, 72(%rsp)
vmovdqa %ymm5, -24(%rsp)
jmp .L1774
.cfi_endproc
.LFE18808:
.size _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0, .-_ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
.section .text._ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18809:
.cfi_startproc
leaq 8(%rsp), %r10
.cfi_def_cfa 10, 0
andq $-32, %rsp
pushq -8(%r10)
pushq %rbp
movq %rsp, %rbp
.cfi_escape 0x10,0x6,0x2,0x76,0
pushq %r15
pushq %r14
pushq %r13
.cfi_escape 0x10,0xf,0x2,0x76,0x78
.cfi_escape 0x10,0xe,0x2,0x76,0x70
.cfi_escape 0x10,0xd,0x2,0x76,0x68
movq %rdi, %r13
pushq %r12
.cfi_escape 0x10,0xc,0x2,0x76,0x60
movq %rcx, %r12
pushq %r10
.cfi_escape 0xf,0x3,0x76,0x58,0x6
pushq %rbx
addq $-128, %rsp
.cfi_escape 0x10,0x3,0x2,0x76,0x50
movq %rsi, -104(%rbp)
movq %rdx, -88(%rbp)
movq %r9, -96(%rbp)
cmpq $128, %rdx
jbe .L1942
movq %rdi, %rax
movq %rdi, -112(%rbp)
movq %r8, %rbx
shrq $2, %rax
movq %rax, %rdx
movq %rax, -144(%rbp)
andl $15, %edx
jne .L1943
movq -88(%rbp), %r14
movq %rdi, %rax
.L1794:
movq 8(%rbx), %rsi
movq 16(%rbx), %r11
movq %rsi, %rdi
leaq 1(%r11), %r9
leaq (%rsi,%rsi,8), %rcx
xorq (%rbx), %r9
shrq $11, %rdi
rorx $40, %rsi, %rdx
leaq 2(%r11), %rsi
addq %r9, %rdx
xorq %rdi, %rcx
movq %rdx, %r8
rorx $40, %rdx, %rdi
xorq %rsi, %rcx
shrq $11, %r8
leaq (%rdx,%rdx,8), %rsi
leaq 3(%r11), %rdx
addq %rcx, %rdi
xorq %r8, %rsi
movq %rdi, %r8
xorq %rdx, %rsi
leaq (%rdi,%rdi,8), %rdx
rorx $40, %rdi, %r15
shrq $11, %r8
leaq 4(%r11), %rdi
addq %rsi, %r15
addq $5, %r11
xorq %r8, %rdx
rorx $40, %r15, %r10
leaq (%r15,%r15,8), %r8
movq %r11, 16(%rbx)
xorq %rdi, %rdx
movq %r15, %rdi
addq %rdx, %r10
shrq $11, %rdi
movq %r10, %r15
xorq %rdi, %r8
leaq (%r10,%r10,8), %rdi
rorx $40, %r10, %r10
shrq $11, %r15
xorq %r11, %r8
movl %esi, %r11d
xorq %r15, %rdi
addq %r8, %r10
movl %ecx, %r15d
movl %r8d, %r8d
vmovq %rdi, %xmm5
movq %r14, %rdi
vpinsrq $1, %r10, %xmm5, %xmm0
shrq $4, %rdi
movabsq $68719476719, %r10
cmpq %r10, %r14
movl $4294967295, %r10d
movl %r9d, %r14d
vmovdqu %xmm0, (%rbx)
cmova %r10, %rdi
shrq $32, %r9
movl %edx, %r10d
shrq $32, %rcx
imulq %rdi, %r15
shrq $32, %rsi
shrq $32, %rdx
imulq %rdi, %r8
imulq %rdi, %r14
shrq $32, %r15
imulq %rdi, %r9
imulq %rdi, %rcx
imulq %rdi, %r11
shrq $32, %r14
imulq %rdi, %rsi
shrq $32, %r9
imulq %rdi, %r10
shrq $32, %rcx
imulq %rdi, %rdx
movq %r8, %rdi
movq %r15, %r8
shrq $32, %r11
salq $6, %r8
shrq $32, %rsi
vmovdqa (%rax,%r8), %ymm1
shrq $32, %rdi
movq %r14, %r8
shrq $32, %r10
salq $6, %r8
shrq $32, %rdx
vmovdqa (%rax,%r8), %ymm0
movq %r9, %r8
salq $4, %r15
salq $6, %r8
vmovdqa 32(%rax,%r15,4), %ymm3
vpminsd %ymm1, %ymm0, %ymm2
vpmaxsd (%rax,%r8), %ymm2, %ymm2
movq %rsi, %r8
salq $6, %r8
vpmaxsd %ymm1, %ymm0, %ymm0
vmovdqa (%rax,%r8), %ymm1
movq %rcx, %r8
vpminsd %ymm0, %ymm2, %ymm2
salq $6, %r8
vmovdqa %ymm2, (%r12)
vmovdqa (%rax,%r8), %ymm0
movq %r11, %r8
salq $6, %r8
vpminsd %ymm1, %ymm0, %ymm7
vpmaxsd (%rax,%r8), %ymm7, %ymm7
movq %rdi, %r8
salq $6, %r8
vpmaxsd %ymm1, %ymm0, %ymm0
vmovdqa (%rax,%r8), %ymm1
movq %r10, %r8
vpminsd %ymm0, %ymm7, %ymm7
salq $6, %r8
vmovdqa %ymm7, 64(%r12)
vmovdqa (%rax,%r8), %ymm0
movq %rdx, %r8
salq $6, %r8
salq $4, %r14
vpminsd %ymm1, %ymm0, %ymm6
vpmaxsd (%rax,%r8), %ymm6, %ymm6
salq $4, %r9
salq $4, %rsi
vpmaxsd %ymm1, %ymm0, %ymm0
salq $4, %rcx
vmovdqa 32(%rax,%rsi,4), %ymm4
salq $4, %r11
vpminsd %ymm0, %ymm6, %ymm6
vmovdqa 32(%rax,%r14,4), %ymm0
salq $4, %rdi
salq $4, %r10
salq $4, %rdx
leaq 192(%r12), %r14
vmovdqa %ymm6, 128(%r12)
vpminsd %ymm3, %ymm0, %ymm1
vpmaxsd 32(%rax,%r9,4), %ymm1, %ymm1
vpmaxsd %ymm3, %ymm0, %ymm0
vpminsd %ymm0, %ymm1, %ymm1
vmovdqa 32(%rax,%rcx,4), %ymm0
vmovdqa %ymm1, 32(%r12)
vpminsd %ymm4, %ymm0, %ymm3
vpmaxsd 32(%rax,%r11,4), %ymm3, %ymm3
vpmaxsd %ymm4, %ymm0, %ymm0
vmovdqa 32(%rax,%rdi,4), %ymm4
vpminsd %ymm0, %ymm3, %ymm3
vmovdqa 32(%rax,%r10,4), %ymm0
vmovdqa %ymm3, 96(%r12)
vpminsd %ymm4, %ymm0, %ymm5
vpmaxsd 32(%rax,%rdx,4), %ymm5, %ymm5
vpmaxsd %ymm4, %ymm0, %ymm0
vpminsd %ymm0, %ymm5, %ymm5
vpbroadcastd %xmm2, %ymm0
vpxor %ymm2, %ymm0, %ymm2
vpxor %ymm1, %ymm0, %ymm1
vpxor %ymm7, %ymm0, %ymm7
vmovdqa %ymm5, 160(%r12)
vpor %ymm2, %ymm1, %ymm1
vpxor %ymm3, %ymm0, %ymm3
vpxor %ymm6, %ymm0, %ymm6
vpor %ymm7, %ymm1, %ymm1
vpxor %ymm5, %ymm0, %ymm5
vmovdqa %ymm0, %ymm4
vpxor 192(%r12), %ymm0, %ymm2
vpor %ymm3, %ymm1, %ymm1
vpxor %xmm3, %xmm3, %xmm3
vpor %ymm6, %ymm1, %ymm1
vpor %ymm5, %ymm1, %ymm1
vpor %ymm1, %ymm2, %ymm2
vpblendvb %ymm3, %ymm2, %ymm1, %ymm1
vpxor %xmm2, %xmm2, %xmm2
vpcmpeqd %ymm2, %ymm1, %ymm1
vmovmskps %ymm1, %eax
cmpl $255, %eax
je .L1796
vmovdqa .LC14(%rip), %ymm0
movl $4, %esi
movq %r12, %rdi
vmovdqu %ymm0, 192(%r12)
vmovdqu %ymm0, 224(%r12)
vmovdqu %ymm0, 256(%r12)
vzeroupper
call _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
vpbroadcastd (%r12), %ymm0
vpcmpeqd %ymm2, %ymm2, %ymm2
vpbroadcastd 188(%r12), %ymm1
vpaddd %ymm2, %ymm1, %ymm2
vpcmpeqd %ymm0, %ymm2, %ymm2
vmovmskps %ymm2, %eax
cmpl $255, %eax
jne .L1798
movq -88(%rbp), %rsi
leaq -80(%rbp), %rdx
movq %r14, %rcx
movq %r13, %rdi
call _ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1937
.L1798:
movl 96(%r12), %ecx
movl $23, %eax
movl $24, %edx
cmpl 92(%r12), %ecx
je .L1832
jmp .L1837
.p2align 4,,10
.p2align 3
.L1835:
testq %rax, %rax
je .L1944
.L1832:
movq %rax, %rdx
subq $1, %rax
movl (%r12,%rax,4), %esi
cmpl %esi, %ecx
je .L1835
cmpl %ecx, (%r12,%rdx,4)
je .L1837
movl %esi, %ecx
jmp .L1834
.p2align 4,,10
.p2align 3
.L1838:
cmpq $47, %rdx
je .L1940
.L1837:
movq %rdx, %rsi
addq $1, %rdx
cmpl (%r12,%rdx,4), %ecx
je .L1838
movl $24, %edx
subq $23, %rsi
subq %rax, %rdx
cmpq %rdx, %rsi
jb .L1834
.L1940:
movl (%r12,%rax,4), %ecx
.L1834:
vmovd %ecx, %xmm0
vpbroadcastd %xmm0, %ymm0
.L1941:
movl $1, -112(%rbp)
.L1831:
cmpq $0, -96(%rbp)
je .L1945
movq -88(%rbp), %rax
vmovdqa %ymm0, %ymm1
leaq -8(%rax), %r10
movq %r10, %rdx
movq %r10, %rsi
vmovdqu 0(%r13,%r10,4), %ymm5
andl $31, %edx
andl $24, %esi
je .L1880
vmovdqu 0(%r13), %ymm3
vpcmpeqd %ymm4, %ymm4, %ymm4
leaq _ZZN3hwy6N_AVX26detail18IndicesFromBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array(%rip), %r9
xorl %ecx, %ecx
vpcmpgtd %ymm0, %ymm3, %ymm6
vpxor %ymm4, %ymm6, %ymm0
vmovmskps %ymm6, %esi
vmovmskps %ymm0, %eax
vmovdqa .LC17(%rip), %ymm0
popcntq %rsi, %rcx
vpbroadcastd (%r9,%rax,4), %ymm2
popcntq %rax, %rax
leaq 0(%r13,%rax,4), %rax
vpsrlvd %ymm0, %ymm2, %ymm2
vpslld $28, %ymm2, %ymm7
vpermd %ymm3, %ymm2, %ymm2
vpmaskmovd %ymm2, %ymm7, 0(%r13)
vpbroadcastd (%r9,%rsi,4), %ymm2
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm3, %ymm2, %ymm3
vmovdqu %ymm3, (%r12)
testb $16, %r10b
je .L1842
vmovdqu 32(%r13), %ymm3
vpcmpgtd %ymm1, %ymm3, %ymm6
vpxor %ymm4, %ymm6, %ymm2
vmovmskps %ymm2, %esi
vpbroadcastd (%r9,%rsi,4), %ymm2
popcntq %rsi, %rsi
vpsrlvd %ymm0, %ymm2, %ymm2
vpslld $28, %ymm2, %ymm7
vpermd %ymm3, %ymm2, %ymm2
vpmaskmovd %ymm2, %ymm7, (%rax)
leaq (%rax,%rsi,4), %rax
vmovmskps %ymm6, %esi
vpbroadcastd (%r9,%rsi,4), %ymm2
popcntq %rsi, %rsi
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm3, %ymm2, %ymm3
vmovdqu %ymm3, (%r12,%rcx,4)
addq %rsi, %rcx
cmpq $23, %rdx
jbe .L1842
vmovdqu 64(%r13), %ymm3
vpcmpgtd %ymm1, %ymm3, %ymm6
vpxor %ymm4, %ymm6, %ymm2
vmovmskps %ymm2, %esi
vpbroadcastd (%r9,%rsi,4), %ymm2
popcntq %rsi, %rsi
vpsrlvd %ymm0, %ymm2, %ymm2
vpslld $28, %ymm2, %ymm4
vpermd %ymm3, %ymm2, %ymm2
vpmaskmovd %ymm2, %ymm4, (%rax)
leaq (%rax,%rsi,4), %rax
vmovmskps %ymm6, %esi
vpbroadcastd (%r9,%rsi,4), %ymm2
popcntq %rsi, %rsi
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm3, %ymm2, %ymm3
vmovdqu %ymm3, (%r12,%rcx,4)
addq %rsi, %rcx
.L1842:
leaq -8(%rdx), %rsi
leaq 1(%rdx), %rdi
andq $-8, %rsi
leaq 0(,%rcx,4), %r8
addq $8, %rsi
cmpq $8, %rdi
movl $8, %edi
cmovbe %rdi, %rsi
.L1841:
cmpq %rdx, %rsi
je .L1843
subq %rsi, %rdx
vmovdqu 0(%r13,%rsi,4), %ymm4
vmovd %edx, %xmm2
vpbroadcastd %xmm2, %ymm2
vpcmpgtd %ymm1, %ymm4, %ymm6
vpcmpgtd .LC3(%rip), %ymm2, %ymm2
vpandn %ymm2, %ymm6, %ymm3
vpand %ymm2, %ymm6, %ymm6
vmovmskps %ymm3, %edx
vpbroadcastd (%r9,%rdx,4), %ymm3
popcntq %rdx, %rdx
vpsrlvd %ymm0, %ymm3, %ymm3
vpslld $28, %ymm3, %ymm7
vpermd %ymm4, %ymm3, %ymm3
vpmaskmovd %ymm3, %ymm7, (%rax)
leaq (%rax,%rdx,4), %rax
vmovmskps %ymm6, %edx
vpbroadcastd (%r9,%rdx,4), %ymm2
popcntq %rdx, %rdx
addq %rdx, %rcx
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm4, %ymm2, %ymm4
vmovdqu %ymm4, (%r12,%r8)
leaq 0(,%rcx,4), %r8
.L1843:
movq %r10, %rdx
subq %rcx, %rdx
movl %r8d, %ecx
leaq 0(%r13,%rdx,4), %r11
cmpl $8, %r8d
jnb .L1844
testb $4, %r8b
jne .L1946
testl %ecx, %ecx
jne .L1947
.L1845:
movl %r8d, %ecx
cmpl $8, %r8d
jnb .L1848
andl $4, %r8d
jne .L1948
testl %ecx, %ecx
jne .L1949
.L1849:
movq %rax, %rcx
subq %r13, %rcx
sarq $2, %rcx
subq %rcx, %r10
subq %rcx, %rdx
movq %rcx, %r15
movq %r10, -144(%rbp)
leaq (%rax,%rdx,4), %rcx
je .L1881
leaq 128(%rax), %rsi
leaq -128(%rcx), %r8
vmovdqu (%rax), %ymm13
vmovdqu 32(%rax), %ymm12
vmovdqu 64(%rax), %ymm11
vmovdqu 96(%rax), %ymm10
vmovdqu -128(%rcx), %ymm9
vmovdqu -96(%rcx), %ymm8
vmovdqu -64(%rcx), %ymm7
vmovdqu -32(%rcx), %ymm6
cmpq %r8, %rsi
je .L1882
xorl %ecx, %ecx
leaq _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array(%rip), %rdi
movl $8, %r10d
jmp .L1856
.p2align 4,,10
.p2align 3
.L1951:
vmovdqu -128(%r8), %ymm14
vmovdqu -96(%r8), %ymm4
prefetcht0 -512(%r8)
addq $-128, %r8
vmovdqu 64(%r8), %ymm3
vmovdqu 96(%r8), %ymm2
.L1855:
vpcmpgtd %ymm1, %ymm14, %ymm15
leaq -8(%rdx,%rcx), %r14
vmovmskps %ymm15, %r11d
vpbroadcastd (%rdi,%r11,4), %ymm15
popcntq %r11, %r11
vpsrlvd %ymm0, %ymm15, %ymm15
vpermd %ymm14, %ymm15, %ymm14
vmovdqu %ymm14, (%rax,%rcx,4)
addq $8, %rcx
vmovdqu %ymm14, (%rax,%r14,4)
vpcmpgtd %ymm1, %ymm4, %ymm14
subq %r11, %rcx
leaq -16(%rdx,%rcx), %r14
vmovmskps %ymm14, %r11d
vpbroadcastd (%rdi,%r11,4), %ymm14
popcntq %r11, %r11
vpsrlvd %ymm0, %ymm14, %ymm14
vpermd %ymm4, %ymm14, %ymm4
vmovdqu %ymm4, (%rax,%rcx,4)
vmovdqu %ymm4, (%rax,%r14,4)
vpcmpgtd %ymm1, %ymm3, %ymm4
movq %r10, %r14
subq %r11, %r14
addq %r14, %rcx
vmovmskps %ymm4, %r11d
leaq -24(%rdx,%rcx), %r14
subq $32, %rdx
vpbroadcastd (%rdi,%r11,4), %ymm4
popcntq %r11, %r11
vpsrlvd %ymm0, %ymm4, %ymm4
vpermd %ymm3, %ymm4, %ymm3
vmovdqu %ymm3, (%rax,%rcx,4)
vmovdqu %ymm3, (%rax,%r14,4)
vpcmpgtd %ymm1, %ymm2, %ymm3
movq %r10, %r14
subq %r11, %r14
leaq (%r14,%rcx), %r11
vmovmskps %ymm3, %ecx
leaq (%r11,%rdx), %r14
vpbroadcastd (%rdi,%rcx,4), %ymm3
popcntq %rcx, %rcx
vpsrlvd %ymm0, %ymm3, %ymm3
vpermd %ymm2, %ymm3, %ymm2
vmovdqu %ymm2, (%rax,%r11,4)
vmovdqu %ymm2, (%rax,%r14,4)
movq %r10, %r14
subq %rcx, %r14
leaq (%r14,%r11), %rcx
cmpq %r8, %rsi
je .L1950
.L1856:
movq %rsi, %r11
subq %rax, %r11
sarq $2, %r11
subq %rcx, %r11
cmpq $32, %r11
ja .L1951
vmovdqu (%rsi), %ymm14
vmovdqu 32(%rsi), %ymm4
prefetcht0 512(%rsi)
subq $-128, %rsi
vmovdqu -64(%rsi), %ymm3
vmovdqu -32(%rsi), %ymm2
jmp .L1855
.p2align 4,,10
.p2align 3
.L1943:
movl $16, %eax
subq %rdx, %rax
leaq (%rdi,%rax,4), %rax
movq -88(%rbp), %rdi
leaq -16(%rdx,%rdi), %r14
jmp .L1794
.p2align 4,,10
.p2align 3
.L1950:
leaq (%rdx,%rcx), %rsi
leaq (%rax,%rcx,4), %r8
addq $8, %rcx
.L1853:
vpcmpgtd %ymm1, %ymm13, %ymm2
vmovmskps %ymm2, %r10d
vpbroadcastd (%rdi,%r10,4), %ymm2
popcntq %r10, %r10
subq %r10, %rcx
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm13, %ymm2, %ymm13
vpcmpgtd %ymm1, %ymm12, %ymm2
vmovdqu %ymm13, (%r8)
leaq -16(%rdx,%rcx), %r8
vmovdqu %ymm13, -32(%rax,%rsi,4)
vmovmskps %ymm2, %esi
vpbroadcastd (%rdi,%rsi,4), %ymm2
popcntq %rsi, %rsi
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm12, %ymm2, %ymm12
vpcmpgtd %ymm1, %ymm11, %ymm2
vmovdqu %ymm12, (%rax,%rcx,4)
subq %rsi, %rcx
vmovdqu %ymm12, (%rax,%r8,4)
addq $8, %rcx
vmovmskps %ymm2, %r8d
leaq -24(%rdx,%rcx), %rsi
vpbroadcastd (%rdi,%r8,4), %ymm2
popcntq %r8, %r8
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm11, %ymm2, %ymm11
vpcmpgtd %ymm1, %ymm10, %ymm2
vmovdqu %ymm11, (%rax,%rcx,4)
vmovdqu %ymm11, (%rax,%rsi,4)
movl $8, %esi
movq %rsi, %r10
subq %r8, %r10
vmovmskps %ymm2, %r8d
vpbroadcastd (%rdi,%r8,4), %ymm2
addq %r10, %rcx
popcntq %r8, %r8
leaq -32(%rdx,%rcx), %r10
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm10, %ymm2, %ymm10
vpcmpgtd %ymm1, %ymm9, %ymm2
vmovdqu %ymm10, (%rax,%rcx,4)
vmovdqu %ymm10, (%rax,%r10,4)
movq %rsi, %r10
subq %r8, %r10
leaq (%r10,%rcx), %r8
vmovmskps %ymm2, %ecx
vpbroadcastd (%rdi,%rcx,4), %ymm2
leaq -40(%rdx,%r8), %r10
popcntq %rcx, %rcx
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm9, %ymm2, %ymm9
vpcmpgtd %ymm1, %ymm8, %ymm2
vmovdqu %ymm9, (%rax,%r8,4)
vmovdqu %ymm9, (%rax,%r10,4)
movq %rsi, %r10
subq %rcx, %r10
leaq (%r10,%r8), %rcx
vmovmskps %ymm2, %r8d
vpbroadcastd (%rdi,%r8,4), %ymm2
leaq -48(%rdx,%rcx), %r10
popcntq %r8, %r8
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm8, %ymm2, %ymm8
vpcmpgtd %ymm1, %ymm7, %ymm2
vmovdqu %ymm8, (%rax,%rcx,4)
vmovdqu %ymm8, (%rax,%r10,4)
movq %rsi, %r10
subq %r8, %r10
leaq (%r10,%rcx), %r8
vmovmskps %ymm2, %ecx
vpbroadcastd (%rdi,%rcx,4), %ymm2
leaq -56(%rdx,%r8), %r10
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm7, %ymm2, %ymm7
vpcmpgtd %ymm1, %ymm6, %ymm2
vmovdqu %ymm7, (%rax,%r8,4)
vmovdqu %ymm7, (%rax,%r10,4)
xorl %r10d, %r10d
popcntq %rcx, %r10
movq %rsi, %rcx
subq %r10, %rcx
addq %r8, %rcx
vmovmskps %ymm2, %r8d
vpbroadcastd (%rdi,%r8,4), %ymm2
leaq -64(%rdx,%rcx), %rdx
popcntq %r8, %r8
movq -144(%rbp), %rdi
subq %r8, %rsi
vpsrlvd %ymm0, %ymm2, %ymm2
vpermd %ymm6, %ymm2, %ymm6
vmovdqu %ymm6, (%rax,%rcx,4)
vmovdqu %ymm6, (%rax,%rdx,4)
leaq (%rsi,%rcx), %rdx
subq %rdx, %rdi
leaq (%rax,%rdx,4), %rcx
.L1852:
movq %rcx, %rsi
cmpq $7, %rdi
ja .L1857
movq -144(%rbp), %rdi
leaq -32(%rax,%rdi,4), %rsi
.L1857:
vpcmpgtd %ymm1, %ymm5, %ymm1
vpcmpeqd %ymm2, %ymm2, %ymm2
vmovdqu (%rsi), %ymm7
movq -144(%rbp), %rdi
vmovdqa %ymm7, -176(%rbp)
vpxor %ymm2, %ymm1, %ymm2
vmovdqu %ymm7, (%rax,%rdi,4)
vmovmskps %ymm2, %esi
vpbroadcastd (%r9,%rsi,4), %ymm2
popcntq %rsi, %rsi
addq %rsi, %rdx
leaq (%r15,%rdx), %r14
vpsrlvd %ymm0, %ymm2, %ymm2
vpslld $28, %ymm2, %ymm3
vpermd %ymm5, %ymm2, %ymm2
vpmaskmovd %ymm2, %ymm3, (%rcx)
vmovmskps %ymm1, %ecx
vpbroadcastd (%r9,%rcx,4), %ymm1
vpsrlvd %ymm0, %ymm1, %ymm0
vpslld $28, %ymm0, %ymm1
vpermd %ymm5, %ymm0, %ymm5
vpmaskmovd %ymm5, %ymm1, (%rax,%rdx,4)
movq -96(%rbp), %r15
subq $1, %r15
cmpl $2, -112(%rbp)
je .L1952
movq -104(%rbp), %rsi
movq %r15, %r9
movq %rbx, %r8
movq %r12, %rcx
movq %r14, %rdx
movq %r13, %rdi
vzeroupper
call _ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -112(%rbp)
je .L1937
.L1859:
movq -88(%rbp), %rdx
movq -104(%rbp), %rsi
leaq 0(%r13,%r14,4), %rdi
movq %r15, %r9
movq %rbx, %r8
movq %r12, %rcx
subq %r14, %rdx
call _ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1937:
subq $-128, %rsp
popq %rbx
popq %r10
.cfi_remember_state
.cfi_def_cfa 10, 0
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
leaq -8(%r10), %rsp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1848:
.cfi_restore_state
movq (%r12), %rcx
leaq 8(%r11), %rdi
andq $-8, %rdi
movq %rcx, (%r11)
movl %r8d, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r11,%rcx)
subq %rdi, %r11
movq %r12, %rsi
leal (%r8,%r11), %ecx
subq %r11, %rsi
shrl $3, %ecx
rep movsq
jmp .L1849
.p2align 4,,10
.p2align 3
.L1844:
movq (%r11), %rcx
leaq 8(%rax), %rdi
andq $-8, %rdi
movq %rcx, (%rax)
movl %r8d, %ecx
movq -8(%r11,%rcx), %rsi
movq %rsi, -8(%rax,%rcx)
movq %rax, %rcx
movq %r11, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L1845
.p2align 4,,10
.p2align 3
.L1944:
movl (%r12), %ecx
jmp .L1834
.p2align 4,,10
.p2align 3
.L1949:
movzbl (%r12), %esi
movb %sil, (%r11)
testb $2, %cl
je .L1849
movzwl -2(%r12,%rcx), %esi
movw %si, -2(%r11,%rcx)
jmp .L1849
.p2align 4,,10
.p2align 3
.L1947:
movzbl (%r11), %esi
movb %sil, (%rax)
testb $2, %cl
je .L1845
movzwl -2(%r11,%rcx), %esi
movw %si, -2(%rax,%rcx)
jmp .L1845
.p2align 4,,10
.p2align 3
.L1942:
cmpq $1, %rdx
jbe .L1937
leaq 512(%rdi), %rax
cmpq %rax, %rsi
jb .L1953
movl $8, %esi
call _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L1937
.p2align 4,,10
.p2align 3
.L1796:
movq -144(%rbp), %rax
movl $8, %edi
vmovdqa .LC3(%rip), %ymm5
vpcmpeqd 0(%r13), %ymm0, %ymm1
andl $7, %eax
subq %rax, %rdi
vmovd %edi, %xmm2
vpbroadcastd %xmm2, %ymm2
vpcmpgtd %ymm5, %ymm2, %ymm2
vpandn %ymm2, %ymm1, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
jne .L1954
vpxor %xmm2, %xmm2, %xmm2
movq -88(%rbp), %r8
leaq 512(%r13,%rdi,4), %rsi
vpxor %xmm6, %xmm6, %xmm6
vmovdqa %ymm2, %ymm1
.p2align 4,,10
.p2align 3
.L1802:
movq %rdi, %rcx
leaq 128(%rdi), %rdi
cmpq %rdi, %r8
jb .L1955
leaq -512(%rsi), %rax
.L1801:
vpxor (%rax), %ymm4, %ymm3
leaq 64(%rax), %rdx
vpor %ymm1, %ymm3, %ymm1
vpxor 32(%rax), %ymm4, %ymm3
vpor %ymm2, %ymm3, %ymm2
vpxor 64(%rax), %ymm4, %ymm3
vpor %ymm1, %ymm3, %ymm1
vpxor 96(%rax), %ymm4, %ymm3
vpor %ymm2, %ymm3, %ymm2
vpxor 128(%rax), %ymm4, %ymm3
vpor %ymm1, %ymm3, %ymm1
vpxor 160(%rax), %ymm4, %ymm3
leaq 192(%rdx), %rax
vpor %ymm2, %ymm3, %ymm2
vpxor 128(%rdx), %ymm4, %ymm3
vpor %ymm1, %ymm3, %ymm1
vpxor 160(%rdx), %ymm4, %ymm3
vpor %ymm2, %ymm3, %ymm2
cmpq %rsi, %rax
jne .L1801
vpor %ymm2, %ymm1, %ymm3
leaq 704(%rdx), %rsi
vpcmpeqd %ymm6, %ymm3, %ymm3
vmovmskps %ymm3, %eax
cmpl $255, %eax
je .L1802
vpcmpeqd 0(%r13,%rcx,4), %ymm0, %ymm1
vpcmpeqd %ymm2, %ymm2, %ymm2
vpxor %ymm2, %ymm1, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
jne .L1804
.p2align 4,,10
.p2align 3
.L1803:
addq $8, %rcx
vpcmpeqd 0(%r13,%rcx,4), %ymm0, %ymm1
vpxor %ymm1, %ymm2, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
je .L1803
.L1804:
tzcntl %eax, %eax
addq %rcx, %rax
.L1800:
vpbroadcastd 0(%r13,%rax,4), %ymm2
vmovdqa %ymm0, %ymm8
leaq 0(%r13,%rax,4), %rdi
vpcmpgtd %ymm0, %ymm2, %ymm1
vmovdqa %ymm2, %ymm6
vmovmskps %ymm1, %edx
testl %edx, %edx
jne .L1809
movq -88(%rbp), %rsi
xorl %ecx, %ecx
leaq -8(%rsi), %rax
jmp .L1814
.p2align 4,,10
.p2align 3
.L1810:
vmovmskps %ymm1, %edx
vmovdqu %ymm8, 0(%r13,%rax,4)
popcntq %rdx, %rdx
addq %rdx, %rcx
leaq -8(%rax), %rdx
cmpq %rdx, %rsi
jbe .L1956
movq %rdx, %rax
.L1814:
vpcmpeqd 0(%r13,%rax,4), %ymm2, %ymm3
vpcmpeqd 0(%r13,%rax,4), %ymm0, %ymm1
vpor %ymm3, %ymm1, %ymm4
vmovmskps %ymm4, %edx
cmpl $255, %edx
je .L1810
vpcmpeqd %ymm0, %ymm0, %ymm0
leaq 8(%rax), %rsi
vpxor %ymm0, %ymm1, %ymm7
vpandn %ymm7, %ymm3, %ymm3
vmovmskps %ymm3, %edx
tzcntl %edx, %edx
addq %rax, %rdx
addq $16, %rax
vpbroadcastd 0(%r13,%rdx,4), %ymm0
movq -88(%rbp), %rdx
subq %rcx, %rdx
vmovdqa %ymm0, %ymm4
vmovdqa %ymm0, -80(%rbp)
cmpq %rax, %rdx
jb .L1811
.p2align 4,,10
.p2align 3
.L1812:
vmovdqu %ymm6, -32(%r13,%rax,4)
movq %rax, %rsi
addq $8, %rax
cmpq %rdx, %rax
jbe .L1812
.L1811:
subq %rsi, %rdx
vmovd %edx, %xmm0
vpbroadcastd %xmm0, %ymm0
vpcmpgtd %ymm5, %ymm0, %ymm0
vpmaskmovd %ymm2, %ymm0, 0(%r13,%rsi,4)
.L1813:
vpbroadcastd (%r12), %ymm3
vpcmpeqd .LC15(%rip), %ymm3, %ymm1
vmovdqa %ymm3, %ymm0
vmovmskps %ymm1, %eax
cmpl $255, %eax
je .L1877
vpcmpeqd .LC16(%rip), %ymm3, %ymm1
vmovmskps %ymm1, %eax
cmpl $255, %eax
je .L1827
vpminsd %ymm4, %ymm2, %ymm1
vpcmpgtd %ymm1, %ymm3, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
jne .L1957
vmovdqa %ymm3, %ymm2
movl $128, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1822:
leaq (%rcx,%rax,8), %rdx
addq $1, %rax
vpminsd 0(%r13,%rdx,4), %ymm2, %ymm1
vmovdqa %ymm1, %ymm2
cmpq $16, %rax
jne .L1822
vpcmpgtd %ymm1, %ymm3, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
jne .L1941
leaq 128(%rsi), %rax
cmpq %rax, -88(%rbp)
jb .L1958
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1822
.L1880:
vmovdqa .LC17(%rip), %ymm0
xorl %r8d, %r8d
xorl %ecx, %ecx
movq %r13, %rax
leaq _ZZN3hwy6N_AVX26detail18IndicesFromBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array(%rip), %r9
jmp .L1841
.L1952:
vzeroupper
jmp .L1859
.L1881:
movq %r10, %rdi
movq %rax, %rcx
jmp .L1852
.L1882:
movq %rax, %r8
movq %rdx, %rsi
movl $8, %ecx
leaq _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array(%rip), %rdi
jmp .L1853
.L1945:
movq -88(%rbp), %rsi
leaq -1(%rsi), %rbx
movq %rbx, %r12
shrq %r12
.p2align 4,,10
.p2align 3
.L1839:
movq %r12, %rdx
movq %r13, %rdi
call _ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %r12
jnb .L1839
.p2align 4,,10
.p2align 3
.L1840:
movl 0(%r13,%rbx,4), %edx
movl 0(%r13), %eax
movq %rbx, %rsi
movq %r13, %rdi
movl %edx, 0(%r13)
xorl %edx, %edx
movl %eax, 0(%r13,%rbx,4)
call _ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L1840
jmp .L1937
.L1946:
movl (%r11), %esi
movl %esi, (%rax)
movl -4(%r11,%rcx), %esi
movl %esi, -4(%rax,%rcx)
jmp .L1845
.L1948:
movl (%r12), %esi
movl %esi, (%r11)
movl -4(%r12,%rcx), %esi
movl %esi, -4(%r11,%rcx)
jmp .L1849
.L1955:
movq -88(%rbp), %rsi
vpcmpeqd %ymm2, %ymm2, %ymm2
.p2align 4,,10
.p2align 3
.L1806:
movq %rcx, %rdx
addq $8, %rcx
cmpq %rcx, %rsi
jb .L1959
vpcmpeqd -32(%r13,%rcx,4), %ymm0, %ymm1
vpxor %ymm2, %ymm1, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
je .L1806
.L1939:
tzcntl %eax, %eax
addq %rdx, %rax
jmp .L1800
.L1809:
movq -88(%rbp), %rsi
leaq -80(%rbp), %rdx
movq %r12, %rcx
vmovdqa %ymm2, %ymm1
vmovdqa %ymm2, -144(%rbp)
subq %rax, %rsi
call _ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1937
vmovdqa -80(%rbp), %ymm4
vmovdqa -144(%rbp), %ymm2
jmp .L1813
.L1956:
vmovd %eax, %xmm3
vpcmpeqd 0(%r13), %ymm0, %ymm1
movq -88(%rbp), %rdx
vpbroadcastd %xmm3, %ymm3
vpcmpeqd 0(%r13), %ymm2, %ymm4
vpcmpgtd %ymm5, %ymm3, %ymm3
subq %rcx, %rdx
vpand %ymm1, %ymm3, %ymm7
vpor %ymm4, %ymm1, %ymm1
vpcmpeqd %ymm4, %ymm4, %ymm4
vpxor %ymm3, %ymm4, %ymm3
vpor %ymm3, %ymm1, %ymm1
vmovmskps %ymm1, %esi
cmpl $255, %esi
jne .L1960
vmovmskps %ymm7, %ecx
movq %rdx, %rax
vmovdqu %ymm0, 0(%r13)
popcntq %rcx, %rcx
subq %rcx, %rax
cmpq $7, %rax
jbe .L1866
leaq -8(%rax), %rcx
movq -112(%rbp), %rsi
movq %rcx, %rdx
shrq $3, %rdx
salq $5, %rdx
leaq 32(%r13,%rdx), %rdx
.p2align 4,,10
.p2align 3
.L1819:
vmovdqu %ymm6, (%rsi)
addq $32, %rsi
cmpq %rdx, %rsi
jne .L1819
andq $-8, %rcx
leaq 8(%rcx), %rdx
leaq 0(,%rdx,4), %rcx
subq %rdx, %rax
.L1818:
vmovdqa %ymm2, (%r12)
testq %rax, %rax
je .L1936
leaq 0(%r13,%rcx), %rdi
leaq 0(,%rax,4), %rdx
movq %r12, %rsi
vzeroupper
call memcpy@PLT
jmp .L1937
.L1958:
movq -88(%rbp), %rdx
jmp .L1829
.p2align 4,,10
.p2align 3
.L1830:
vpcmpgtd -32(%r13,%rsi,4), %ymm3, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
jne .L1941
.L1829:
movq %rsi, %rax
addq $8, %rsi
cmpq %rsi, %rdx
jnb .L1830
movq -88(%rbp), %rdi
cmpq %rax, %rdi
je .L1877
vpcmpgtd -32(%r13,%rdi,4), %ymm3, %ymm3
vmovmskps %ymm3, %eax
cmpl $1, %eax
movl $1, %eax
adcl $0, %eax
movl %eax, -112(%rbp)
jmp .L1831
.L1959:
movq -88(%rbp), %rax
vpcmpeqd %ymm2, %ymm2, %ymm2
vpcmpeqd -32(%r13,%rax,4), %ymm0, %ymm1
leaq -8(%rax), %rdx
vpxor %ymm2, %ymm1, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
jne .L1939
.L1936:
vzeroupper
jmp .L1937
.L1826:
vmovdqu -32(%r13,%rsi,4), %ymm5
vpcmpgtd %ymm3, %ymm5, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
jne .L1941
.L1825:
movq %rsi, %rax
addq $8, %rsi
cmpq %rsi, -88(%rbp)
jnb .L1826
movq -88(%rbp), %rdi
cmpq %rax, %rdi
je .L1827
vmovdqu -32(%r13,%rdi,4), %ymm5
vmovdqa %ymm5, -144(%rbp)
vmovdqa -144(%rbp), %ymm5
vpcmpgtd %ymm3, %ymm5, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
jne .L1941
.L1827:
vpcmpeqd %ymm0, %ymm0, %ymm0
movl $3, -112(%rbp)
vpaddd %ymm0, %ymm3, %ymm0
jmp .L1831
.L1954:
tzcntl %eax, %eax
jmp .L1800
.L1953:
movq %rdx, %rcx
xorl %eax, %eax
cmpq $7, %rdx
jbe .L1787
movq %rdx, %rbx
leaq -8(%rdx), %rdx
movq (%rdi), %rcx
movq %rdx, %rax
shrq $3, %rax
movq %rcx, (%r12)
addq $1, %rax
salq $5, %rax
movl %eax, %ecx
movq -8(%rdi,%rcx), %rsi
leaq 8(%r12), %rdi
andq $-8, %rdi
movq %rsi, -8(%r12,%rcx)
movq %r12, %rcx
movq %r13, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-8, %rax
shrl $3, %ecx
rep movsq
addq $8, %rax
subq %rax, %rbx
movq %rbx, %rcx
je .L1790
.L1787:
salq $2, %rax
leaq 0(,%rcx,4), %rdx
testq %rcx, %rcx
movl $4, %ecx
cmove %rcx, %rdx
leaq (%r12,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
.L1790:
movq -88(%rbp), %rbx
movl $32, %edx
movl $1, %esi
movl %ebx, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %edx
movl $1, %eax
shlx %rdx, %rsi, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $8, %rdx
cmpq %rdx, %rbx
jnb .L1789
vmovdqa .LC14(%rip), %ymm0
movq %rbx, %rax
.L1788:
vmovdqu %ymm0, (%r12,%rax,4)
addq $8, %rax
cmpq %rdx, %rax
jb .L1788
vzeroupper
.L1789:
movq %r12, %rdi
call _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
xorl %eax, %eax
cmpq $7, -88(%rbp)
jbe .L1792
movq -88(%rbp), %rbx
movq (%r12), %rcx
leaq 8(%r13), %rdi
andq $-8, %rdi
leaq -8(%rbx), %rdx
movq %rcx, 0(%r13)
movq %rdx, %rax
shrq $3, %rax
addq $1, %rax
salq $5, %rax
movl %eax, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %r12, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-8, %rax
shrl $3, %ecx
rep movsq
addq $8, %rax
subq %rax, %rbx
movq %rbx, -88(%rbp)
je .L1937
.L1792:
movq -88(%rbp), %rbx
salq $2, %rax
movl $4, %ecx
leaq 0(%r13,%rax), %rdi
leaq (%r12,%rax), %rsi
leaq 0(,%rbx,4), %rdx
testq %rbx, %rbx
cmove %rcx, %rdx
call memcpy@PLT
jmp .L1937
.L1877:
movl $2, -112(%rbp)
jmp .L1831
.L1957:
vpmaxsd %ymm4, %ymm2, %ymm1
vpcmpgtd %ymm3, %ymm1, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
jne .L1941
vmovdqa %ymm3, %ymm2
movl $128, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1823:
leaq (%rcx,%rax,8), %rdx
addq $1, %rax
vpmaxsd 0(%r13,%rdx,4), %ymm2, %ymm1
vmovdqa %ymm1, %ymm2
cmpq $16, %rax
jne .L1823
vpcmpgtd %ymm3, %ymm1, %ymm1
vmovmskps %ymm1, %eax
testl %eax, %eax
jne .L1941
leaq 128(%rsi), %rax
cmpq %rax, -88(%rbp)
jb .L1825
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1823
.L1960:
vpxor %ymm4, %ymm1, %ymm1
vmovmskps %ymm1, %ecx
tzcntl %ecx, %ecx
vpbroadcastd 0(%r13,%rcx,4), %ymm0
leaq 8(%rax), %rcx
vmovdqa %ymm0, %ymm4
vmovdqa %ymm0, -80(%rbp)
cmpq %rdx, %rcx
ja .L1816
.L1817:
vmovdqu %ymm6, -32(%r13,%rcx,4)
movq %rcx, %rax
addq $8, %rcx
cmpq %rdx, %rcx
jbe .L1817
.L1816:
subq %rax, %rdx
vmovd %edx, %xmm0
vpbroadcastd %xmm0, %ymm0
vpcmpgtd %ymm5, %ymm0, %ymm0
vpmaskmovd %ymm2, %ymm0, 0(%r13,%rax,4)
jmp .L1813
.L1866:
xorl %ecx, %ecx
jmp .L1818
.cfi_endproc
.LFE18809:
.size _ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy7N_SSSE310SortI32AscEPim,"ax",@progbits
.p2align 4
.globl _ZN3hwy7N_SSSE310SortI32AscEPim
.hidden _ZN3hwy7N_SSSE310SortI32AscEPim
.type _ZN3hwy7N_SSSE310SortI32AscEPim, @function
_ZN3hwy7N_SSSE310SortI32AscEPim:
.LFB2946:
.cfi_startproc
cmpq $1, %rsi
jbe .L1983
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r14
.cfi_offset 14, -24
leaq (%rdi,%rsi,4), %r14
pushq %r13
.cfi_offset 13, -32
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -40
movq %rsi, %r12
subq $296, %rsp
cmpq $64, %rsi
jbe .L1986
call _ZN3hwy17GetGeneratorStateEv@PLT
movq %r12, %rdx
movq %r14, %rsi
movq %r13, %rdi
movq %rax, %r8
leaq -320(%rbp), %rcx
movl $50, %r9d
call _ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1961:
addq $296, %rsp
popq %r12
popq %r13
popq %r14
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1983:
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
.cfi_restore 14
ret
.p2align 4,,10
.p2align 3
.L1986:
.cfi_def_cfa 6, 16
.cfi_offset 6, -16
.cfi_offset 12, -40
.cfi_offset 13, -32
.cfi_offset 14, -24
leaq 256(%rdi), %rax
cmpq %rax, %r14
jb .L1987
movl $4, %esi
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L1961
.L1987:
movq %rsi, %rcx
xorl %eax, %eax
leaq -320(%rbp), %r14
cmpq $3, %rsi
jbe .L1967
leaq -4(%rsi), %rax
leaq -320(%rbp), %r14
movq %r13, %rsi
movq %rax, %rdx
andq $-4, %rax
movq %r14, %rdi
shrq $2, %rdx
addq $4, %rax
leal 2(%rdx,%rdx), %ecx
andl $536870910, %ecx
rep movsq
movq %r12, %rcx
subq %rax, %rcx
je .L1973
.L1967:
salq $2, %rax
leaq 0(,%rcx,4), %rdx
testq %rcx, %rcx
movl $4, %ecx
cmove %rcx, %rdx
leaq (%r14,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
.L1973:
leal -1(%r12), %eax
movl $32, %ecx
movl $1, %esi
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $4, %rdx
cmpq %rdx, %r12
jnb .L1972
movdqa .LC4(%rip), %xmm0
movq %r12, %rax
.p2align 4,,10
.p2align 3
.L1971:
movups %xmm0, (%r14,%rax,4)
addq $4, %rax
cmpq %rdx, %rax
jb .L1971
.L1972:
movq %r14, %rdi
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
xorl %eax, %eax
cmpq $3, %r12
jbe .L1975
leaq -4(%r12), %rdx
movq -320(%rbp), %rcx
leaq 8(%r13), %rdi
movq %rdx, %rax
andq $-8, %rdi
andq $-4, %rdx
shrq $2, %rax
movq %rcx, 0(%r13)
addq $1, %rax
salq $4, %rax
movl %eax, %ecx
movq -8(%r14,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %r14, %rsi
subq %rdi, %rcx
addl %ecx, %eax
subq %rcx, %rsi
shrl $3, %eax
movl %eax, %ecx
leaq 4(%rdx), %rax
rep movsq
subq %rax, %r12
je .L1961
.L1975:
salq $2, %rax
leaq 0(,%r12,4), %rdx
testq %r12, %r12
movl $4, %ecx
cmove %rcx, %rdx
leaq 0(%r13,%rax), %rdi
leaq (%r14,%rax), %rsi
call memcpy@PLT
jmp .L1961
.cfi_endproc
.LFE2946:
.size _ZN3hwy7N_SSSE310SortI32AscEPim, .-_ZN3hwy7N_SSSE310SortI32AscEPim
.section .text._ZN3hwy6N_SSE410SortI32AscEPim,"ax",@progbits
.p2align 4
.globl _ZN3hwy6N_SSE410SortI32AscEPim
.hidden _ZN3hwy6N_SSE410SortI32AscEPim
.type _ZN3hwy6N_SSE410SortI32AscEPim, @function
_ZN3hwy6N_SSE410SortI32AscEPim:
.LFB4014:
.cfi_startproc
cmpq $1, %rsi
jbe .L2010
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r14
.cfi_offset 14, -24
leaq (%rdi,%rsi,4), %r14
pushq %r13
.cfi_offset 13, -32
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -40
movq %rsi, %r12
subq $296, %rsp
cmpq $64, %rsi
jbe .L2013
call _ZN3hwy17GetGeneratorStateEv@PLT
movq %r12, %rdx
movq %r14, %rsi
movq %r13, %rdi
movq %rax, %r8
leaq -320(%rbp), %rcx
movl $50, %r9d
call _ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1988:
addq $296, %rsp
popq %r12
popq %r13
popq %r14
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L2010:
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
.cfi_restore 14
ret
.p2align 4,,10
.p2align 3
.L2013:
.cfi_def_cfa 6, 16
.cfi_offset 6, -16
.cfi_offset 12, -40
.cfi_offset 13, -32
.cfi_offset 14, -24
leaq 256(%rdi), %rax
cmpq %rax, %r14
jb .L2014
movl $4, %esi
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L1988
.L2014:
movq %rsi, %rcx
xorl %eax, %eax
leaq -320(%rbp), %r14
cmpq $3, %rsi
jbe .L1994
leaq -4(%rsi), %rax
leaq -320(%rbp), %r14
movq %r13, %rsi
movq %rax, %rdx
andq $-4, %rax
movq %r14, %rdi
shrq $2, %rdx
addq $4, %rax
leal 2(%rdx,%rdx), %ecx
andl $536870910, %ecx
rep movsq
movq %r12, %rcx
subq %rax, %rcx
je .L2000
.L1994:
salq $2, %rax
leaq 0(,%rcx,4), %rdx
testq %rcx, %rcx
movl $4, %ecx
cmove %rcx, %rdx
leaq (%r14,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
.L2000:
leal -1(%r12), %eax
movl $32, %ecx
movl $1, %esi
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $4, %rdx
cmpq %rdx, %r12
jnb .L1999
movdqa .LC4(%rip), %xmm0
movq %r12, %rax
.p2align 4,,10
.p2align 3
.L1998:
movups %xmm0, (%r14,%rax,4)
addq $4, %rax
cmpq %rdx, %rax
jb .L1998
.L1999:
movq %r14, %rdi
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
xorl %eax, %eax
cmpq $3, %r12
jbe .L2002
leaq -4(%r12), %rdx
movq -320(%rbp), %rcx
leaq 8(%r13), %rdi
movq %rdx, %rax
andq $-8, %rdi
andq $-4, %rdx
shrq $2, %rax
movq %rcx, 0(%r13)
addq $1, %rax
salq $4, %rax
movl %eax, %ecx
movq -8(%r14,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %r14, %rsi
subq %rdi, %rcx
addl %ecx, %eax
subq %rcx, %rsi
shrl $3, %eax
movl %eax, %ecx
leaq 4(%rdx), %rax
rep movsq
subq %rax, %r12
je .L1988
.L2002:
salq $2, %rax
leaq 0(,%r12,4), %rdx
testq %r12, %r12
movl $4, %ecx
cmove %rcx, %rdx
leaq 0(%r13,%rax), %rdi
leaq (%r14,%rax), %rsi
call memcpy@PLT
jmp .L1988
.cfi_endproc
.LFE4014:
.size _ZN3hwy6N_SSE410SortI32AscEPim, .-_ZN3hwy6N_SSE410SortI32AscEPim
.section .text._ZN3hwy6N_AVX210SortI32AscEPim,"ax",@progbits
.p2align 4
.globl _ZN3hwy6N_AVX210SortI32AscEPim
.hidden _ZN3hwy6N_AVX210SortI32AscEPim
.type _ZN3hwy6N_AVX210SortI32AscEPim, @function
_ZN3hwy6N_AVX210SortI32AscEPim:
.LFB10439:
.cfi_startproc
cmpq $1, %rsi
jbe .L2038
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r14
.cfi_offset 14, -24
leaq (%rdi,%rsi,4), %r14
pushq %r13
.cfi_offset 13, -32
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -40
movq %rsi, %r12
andq $-32, %rsp
subq $576, %rsp
cmpq $128, %rsi
jbe .L2041
call _ZN3hwy17GetGeneratorStateEv@PLT
movq %rsp, %rcx
movq %r12, %rdx
movq %r14, %rsi
movq %rax, %r8
movl $50, %r9d
movq %r13, %rdi
call _ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIiLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L2036:
leaq -24(%rbp), %rsp
popq %r12
popq %r13
popq %r14
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L2038:
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
.cfi_restore 14
ret
.p2align 4,,10
.p2align 3
.L2041:
.cfi_def_cfa 6, 16
.cfi_offset 6, -16
.cfi_offset 12, -40
.cfi_offset 13, -32
.cfi_offset 14, -24
leaq 512(%rdi), %rax
cmpq %rax, %r14
jb .L2042
movl $8, %esi
call _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L2036
.L2042:
movq %rsi, %rcx
xorl %eax, %eax
movq %rsp, %r14
cmpq $7, %rsi
jbe .L2021
leaq -8(%rsi), %rax
movq %rsp, %r14
movq %r13, %rsi
movq %rax, %rdx
andq $-8, %rax
movq %r14, %rdi
shrq $3, %rdx
addq $8, %rax
leal 4(,%rdx,4), %ecx
andl $536870908, %ecx
rep movsq
movq %r12, %rcx
subq %rax, %rcx
je .L2027
.L2021:
salq $2, %rax
leaq 0(,%rcx,4), %rdx
testq %rcx, %rcx
movl $4, %ecx
cmove %rcx, %rdx
leaq (%r14,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
.L2027:
leal -1(%r12), %eax
movl $32, %edx
movl $1, %esi
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %edx
movl $1, %eax
shlx %rdx, %rsi, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $8, %rdx
cmpq %rdx, %r12
jnb .L2026
vmovdqa .LC14(%rip), %ymm0
movq %r12, %rax
.p2align 4,,10
.p2align 3
.L2025:
vmovdqu %ymm0, (%r14,%rax,4)
addq $8, %rax
cmpq %rdx, %rax
jb .L2025
vzeroupper
.L2026:
movq %r14, %rdi
call _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
xorl %eax, %eax
cmpq $7, %r12
jbe .L2029
leaq -8(%r12), %rdx
movq (%rsp), %rcx
leaq 8(%r13), %rdi
movq %rdx, %rax
andq $-8, %rdi
andq $-8, %rdx
shrq $3, %rax
movq %rcx, 0(%r13)
addq $1, %rax
salq $5, %rax
movl %eax, %ecx
movq -8(%r14,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %r14, %rsi
subq %rdi, %rcx
addl %ecx, %eax
subq %rcx, %rsi
shrl $3, %eax
movl %eax, %ecx
leaq 8(%rdx), %rax
rep movsq
subq %rax, %r12
je .L2036
.L2029:
salq $2, %rax
leaq 0(,%r12,4), %rdx
testq %r12, %r12
movl $4, %ecx
cmove %rcx, %rdx
leaq 0(%r13,%rax), %rdi
leaq (%r14,%rax), %rsi
call memcpy@PLT
jmp .L2036
.cfi_endproc
.LFE10439:
.size _ZN3hwy6N_AVX210SortI32AscEPim, .-_ZN3hwy6N_AVX210SortI32AscEPim
.section .text._ZN3hwy6N_AVX310SortI32AscEPim,"ax",@progbits
.p2align 4
.globl _ZN3hwy6N_AVX310SortI32AscEPim
.hidden _ZN3hwy6N_AVX310SortI32AscEPim
.type _ZN3hwy6N_AVX310SortI32AscEPim, @function
_ZN3hwy6N_AVX310SortI32AscEPim:
.LFB12848:
.cfi_startproc
cmpq $1, %rsi
jbe .L2062
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
.cfi_offset 15, -24
.cfi_offset 14, -32
leaq (%rdi,%rsi,4), %r14
pushq %r13
.cfi_offset 13, -40
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -48
movq %rsi, %r12
pushq %rbx
andq $-64, %rsp
subq $1152, %rsp
.cfi_offset 3, -56
cmpq $256, %rsi
jbe .L2065
call _ZN3hwy17GetGeneratorStateEv@PLT
movq %rsp, %rcx
movq %r12, %rdx
movq %r14, %rsi
movq %rax, %r8
movl $50, %r9d
movq %r13, %rdi
call _ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L2060:
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L2062:
.cfi_restore 3
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
.cfi_restore 14
.cfi_restore 15
ret
.p2align 4,,10
.p2align 3
.L2065:
.cfi_def_cfa 6, 16
.cfi_offset 3, -56
.cfi_offset 6, -16
.cfi_offset 12, -48
.cfi_offset 13, -40
.cfi_offset 14, -32
.cfi_offset 15, -24
leaq 1024(%rdi), %rax
cmpq %rax, %r14
jb .L2066
movl $16, %esi
call _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L2060
.L2066:
xorl %eax, %eax
movq %rsp, %r14
cmpq $15, %rsi
jbe .L2048
leaq -16(%rsi), %rax
movq %rsp, %r14
movq %r13, %rsi
movq %rax, %rdx
movq %r14, %rdi
andq $-16, %rax
shrq $4, %rdx
addq $16, %rax
leal 8(,%rdx,8), %ecx
andl $536870904, %ecx
rep movsq
.L2048:
movq %r12, %rdx
leaq 0(,%rax,4), %rbx
subq %rax, %rdx
movl $65535, %eax
leaq (%r14,%rbx), %r15
addq %r13, %rbx
kmovd %eax, %k4
cmpq $255, %rdx
ja .L2052
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzwl %ax, %eax
kmovd %eax, %k4
.L2052:
leal -1(%r12), %eax
movl $32, %edx
movl $1, %esi
vmovdqu32 (%rbx), %zmm0{%k4}{z}
bsrl %eax, %eax
xorl $31, %eax
vmovdqa32 %zmm0, (%r15){%k4}
vpbroadcastq .LC10(%rip), %zmm0
subl %eax, %edx
movl $1, %eax
shlx %rdx, %rsi, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %r12, %rax
leaq 1(%rsi), %rdx
salq $4, %rdx
cmpq %rdx, %r12
jnb .L2056
.p2align 4,,10
.p2align 3
.L2053:
vmovdqu64 %zmm0, (%r14,%rax,4)
addq $16, %rax
cmpq %rax, %rdx
ja .L2053
.L2056:
movq %r14, %rdi
vzeroupper
call _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
cmpq $15, %r12
jbe .L2055
leaq -16(%r12), %rax
movq (%rsp), %rdx
leaq 8(%r13), %rdi
movq %r14, %rsi
shrq $4, %rax
andq $-8, %rdi
addq $1, %rax
movq %rdx, 0(%r13)
salq $6, %rax
movl %eax, %edx
movq -8(%r14,%rdx), %rcx
movq %rcx, -8(%r13,%rdx)
subq %rdi, %r13
addl %r13d, %eax
subq %r13, %rsi
shrl $3, %eax
movl %eax, %ecx
rep movsq
.L2055:
vmovdqa32 (%r15), %zmm0{%k4}{z}
vmovdqu32 %zmm0, (%rbx){%k4}
vzeroupper
jmp .L2060
.cfi_endproc
.LFE12848:
.size _ZN3hwy6N_AVX310SortI32AscEPim, .-_ZN3hwy6N_AVX310SortI32AscEPim
.section .text._ZN3hwy11N_AVX3_ZEN410SortI32AscEPim,"ax",@progbits
.p2align 4
.globl _ZN3hwy11N_AVX3_ZEN410SortI32AscEPim
.hidden _ZN3hwy11N_AVX3_ZEN410SortI32AscEPim
.type _ZN3hwy11N_AVX3_ZEN410SortI32AscEPim, @function
_ZN3hwy11N_AVX3_ZEN410SortI32AscEPim:
.LFB15264:
.cfi_startproc
cmpq $1, %rsi
jbe .L2086
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
.cfi_offset 15, -24
.cfi_offset 14, -32
leaq (%rdi,%rsi,4), %r14
pushq %r13
.cfi_offset 13, -40
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -48
movq %rsi, %r12
pushq %rbx
andq $-64, %rsp
subq $1152, %rsp
.cfi_offset 3, -56
cmpq $256, %rsi
jbe .L2089
call _ZN3hwy17GetGeneratorStateEv@PLT
movq %rsp, %rcx
movq %r12, %rdx
movq %r14, %rsi
movq %rax, %r8
movl $50, %r9d
movq %r13, %rdi
call _ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIiLm16ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L2084:
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L2086:
.cfi_restore 3
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
.cfi_restore 14
.cfi_restore 15
ret
.p2align 4,,10
.p2align 3
.L2089:
.cfi_def_cfa 6, 16
.cfi_offset 3, -56
.cfi_offset 6, -16
.cfi_offset 12, -48
.cfi_offset 13, -40
.cfi_offset 14, -32
.cfi_offset 15, -24
leaq 1024(%rdi), %rax
cmpq %rax, %r14
jb .L2090
movl $16, %esi
call _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L2084
.L2090:
xorl %eax, %eax
movq %rsp, %r14
cmpq $15, %rsi
jbe .L2072
leaq -16(%rsi), %rax
movq %rsp, %r14
movq %r13, %rsi
movq %rax, %rdx
movq %r14, %rdi
andq $-16, %rax
shrq $4, %rdx
addq $16, %rax
leal 8(,%rdx,8), %ecx
andl $536870904, %ecx
rep movsq
.L2072:
movq %r12, %rdx
leaq 0(,%rax,4), %rbx
subq %rax, %rdx
movl $65535, %eax
leaq (%r14,%rbx), %r15
addq %r13, %rbx
kmovd %eax, %k4
cmpq $255, %rdx
ja .L2076
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzwl %ax, %eax
kmovd %eax, %k4
.L2076:
leal -1(%r12), %eax
movl $32, %edx
movl $1, %esi
vmovdqu32 (%rbx), %zmm0{%k4}{z}
bsrl %eax, %eax
xorl $31, %eax
vmovdqa32 %zmm0, (%r15){%k4}
vpbroadcastq .LC10(%rip), %zmm0
subl %eax, %edx
movl $1, %eax
shlx %rdx, %rsi, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %r12, %rax
leaq 1(%rsi), %rdx
salq $4, %rdx
cmpq %rdx, %r12
jnb .L2080
.p2align 4,,10
.p2align 3
.L2077:
vmovdqu64 %zmm0, (%r14,%rax,4)
addq $16, %rax
cmpq %rax, %rdx
ja .L2077
.L2080:
movq %r14, %rdi
vzeroupper
call _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
cmpq $15, %r12
jbe .L2079
leaq -16(%r12), %rax
movq (%rsp), %rdx
leaq 8(%r13), %rdi
movq %r14, %rsi
shrq $4, %rax
andq $-8, %rdi
addq $1, %rax
movq %rdx, 0(%r13)
salq $6, %rax
movl %eax, %edx
movq -8(%r14,%rdx), %rcx
movq %rcx, -8(%r13,%rdx)
subq %rdi, %r13
addl %r13d, %eax
subq %r13, %rsi
shrl $3, %eax
movl %eax, %ecx
rep movsq
.L2079:
vmovdqa32 (%r15), %zmm0{%k4}{z}
vmovdqu32 %zmm0, (%rbx){%k4}
vzeroupper
jmp .L2084
.cfi_endproc
.LFE15264:
.size _ZN3hwy11N_AVX3_ZEN410SortI32AscEPim, .-_ZN3hwy11N_AVX3_ZEN410SortI32AscEPim
.section .text._ZN3hwy6N_SSE210SortI32AscEPim,"ax",@progbits
.p2align 4
.globl _ZN3hwy6N_SSE210SortI32AscEPim
.hidden _ZN3hwy6N_SSE210SortI32AscEPim
.type _ZN3hwy6N_SSE210SortI32AscEPim, @function
_ZN3hwy6N_SSE210SortI32AscEPim:
.LFB16254:
.cfi_startproc
cmpq $1, %rsi
jbe .L2113
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r14
.cfi_offset 14, -24
leaq (%rdi,%rsi,4), %r14
pushq %r13
.cfi_offset 13, -32
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -40
movq %rsi, %r12
subq $296, %rsp
cmpq $64, %rsi
jbe .L2116
call _ZN3hwy17GetGeneratorStateEv@PLT
movq %r12, %rdx
movq %r14, %rsi
movq %r13, %rdi
movq %rax, %r8
leaq -320(%rbp), %rcx
movl $50, %r9d
call _ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L2091:
addq $296, %rsp
popq %r12
popq %r13
popq %r14
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L2113:
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
.cfi_restore 14
ret
.p2align 4,,10
.p2align 3
.L2116:
.cfi_def_cfa 6, 16
.cfi_offset 6, -16
.cfi_offset 12, -40
.cfi_offset 13, -32
.cfi_offset 14, -24
leaq 256(%rdi), %rax
cmpq %rax, %r14
jb .L2117
movl $4, %esi
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
jmp .L2091
.L2117:
movq %rsi, %rcx
xorl %eax, %eax
leaq -320(%rbp), %r14
cmpq $3, %rsi
jbe .L2097
leaq -4(%rsi), %rax
leaq -320(%rbp), %r14
movq %r13, %rsi
movq %rax, %rdx
andq $-4, %rax
movq %r14, %rdi
shrq $2, %rdx
addq $4, %rax
leal 2(%rdx,%rdx), %ecx
andl $536870910, %ecx
rep movsq
movq %r12, %rcx
subq %rax, %rcx
je .L2103
.L2097:
salq $2, %rax
leaq 0(,%rcx,4), %rdx
testq %rcx, %rcx
movl $4, %ecx
cmove %rcx, %rdx
leaq (%r14,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
.L2103:
leal -1(%r12), %eax
movl $32, %ecx
movl $1, %esi
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $4, %rdx
cmpq %rdx, %r12
jnb .L2102
movdqa .LC4(%rip), %xmm0
movq %r12, %rax
.p2align 4,,10
.p2align 3
.L2101:
movups %xmm0, (%r14,%rax,4)
addq $4, %rax
cmpq %rdx, %rax
jb .L2101
.L2102:
movq %r14, %rdi
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEvT_PT0_m.isra.0
xorl %eax, %eax
cmpq $3, %r12
jbe .L2105
leaq -4(%r12), %rdx
movq -320(%rbp), %rcx
leaq 8(%r13), %rdi
movq %rdx, %rax
andq $-8, %rdi
andq $-4, %rdx
shrq $2, %rax
movq %rcx, 0(%r13)
addq $1, %rax
salq $4, %rax
movl %eax, %ecx
movq -8(%r14,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %r14, %rsi
subq %rdi, %rcx
addl %ecx, %eax
subq %rcx, %rsi
shrl $3, %eax
movl %eax, %ecx
leaq 4(%rdx), %rax
rep movsq
subq %rax, %r12
je .L2091
.L2105:
salq $2, %rax
leaq 0(,%r12,4), %rdx
testq %r12, %r12
movl $4, %ecx
cmove %rcx, %rdx
leaq 0(%r13,%rax), %rdi
leaq (%r14,%rax), %rsi
call memcpy@PLT
jmp .L2091
.cfi_endproc
.LFE16254:
.size _ZN3hwy6N_SSE210SortI32AscEPim, .-_ZN3hwy6N_SSE210SortI32AscEPim
.section .text.vqsort_int32_avx2,"ax",@progbits
.p2align 4
.globl vqsort_int32_avx2
.hidden vqsort_int32_avx2
.type vqsort_int32_avx2, @function
vqsort_int32_avx2:
.LFB16255:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
call _ZN3hwy6N_AVX210SortI32AscEPim
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE16255:
.size vqsort_int32_avx2, .-vqsort_int32_avx2
.section .text.vqsort_int32_sse4,"ax",@progbits
.p2align 4
.globl vqsort_int32_sse4
.hidden vqsort_int32_sse4
.type vqsort_int32_sse4, @function
vqsort_int32_sse4:
.LFB16256:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
call _ZN3hwy6N_SSE410SortI32AscEPim
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE16256:
.size vqsort_int32_sse4, .-vqsort_int32_sse4
.section .text.vqsort_int32_ssse3,"ax",@progbits
.p2align 4
.globl vqsort_int32_ssse3
.hidden vqsort_int32_ssse3
.type vqsort_int32_ssse3, @function
vqsort_int32_ssse3:
.LFB16257:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
call _ZN3hwy7N_SSSE310SortI32AscEPim
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE16257:
.size vqsort_int32_ssse3, .-vqsort_int32_ssse3
.section .text.vqsort_int32_sse2,"ax",@progbits
.p2align 4
.globl vqsort_int32_sse2
.hidden vqsort_int32_sse2
.type vqsort_int32_sse2, @function
vqsort_int32_sse2:
.LFB16258:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
call _ZN3hwy6N_SSE210SortI32AscEPim
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE16258:
.size vqsort_int32_sse2, .-vqsort_int32_sse2
.hidden _ZZN3hwy6N_SSE26detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.weak _ZZN3hwy6N_SSE26detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.section .rodata._ZZN3hwy6N_SSE26detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,"aG",@progbits,_ZZN3hwy6N_SSE26detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,comdat
.balign 16
.type _ZZN3hwy6N_SSE26detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, @object
.size _ZZN3hwy6N_SSE26detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, 256
_ZZN3hwy6N_SSE26detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices:
.string ""
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003"
.string "\001\002\003\b\t\n\013\f\r\016\017\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007"
.string "\001\002\003\004\005\006\007\f\r\016\017\b\t\n\013\004\005\006\007\f\r\016\017"
.string "\001\002\003\b\t\n\013"
.string "\001\002\003\f\r\016\017\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007\b\t\n\013"
.string "\001\002\003\f\r\016\017"
.string "\001\002\003\b\t\n\013\004\005\006\007\f\r\016\017\b\t\n\013"
.string "\001\002\003\004\005\006\007\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007"
.string "\001\002\003\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.ascii "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.hidden _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array
.weak _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array
.section .rodata._ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array,"aG",@progbits,_ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array,comdat
.balign 16
.type _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array, @object
.size _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array, 1024
_ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array:
.long -19088744
.long -1880241239
.long -1611805784
.long -1728127814
.long -1343370344
.long -1459692359
.long -1442915144
.long -1450185269
.long -1074935144
.long -1191256919
.long -1174479704
.long -1181749814
.long -1157702504
.long -1164972599
.long -1163924024
.long -1164378404
.long -806503784
.long -922821719
.long -906044504
.long -913314374
.long -889267304
.long -896537159
.long -895488584
.long -895942949
.long -872490344
.long -879759959
.long -878711384
.long -879165734
.long -877662824
.long -878117159
.long -878051624
.long -878080019
.long -538133864
.long -654390359
.long -637613144
.long -644879174
.long -620835944
.long -628101959
.long -627053384
.long -627507509
.long -604058984
.long -611324759
.long -610276184
.long -610730294
.long -609227624
.long -609681719
.long -609616184
.long -609644564
.long -587285864
.long -594547799
.long -593499224
.long -593953094
.long -592450664
.long -592904519
.long -592838984
.long -592867349
.long -591402344
.long -591855959
.long -591790424
.long -591818774
.long -591724904
.long -591753239
.long -591749144
.long -591750914
.long -270746984
.long -386020439
.long -369243224
.long -376447814
.long -352466024
.long -359670599
.long -358622024
.long -359072309
.long -335689064
.long -342893399
.long -341844824
.long -342295094
.long -340796264
.long -341246519
.long -341180984
.long -341209124
.long -318915944
.long -326116439
.long -325067864
.long -325517894
.long -324019304
.long -324469319
.long -324403784
.long -324431909
.long -322970984
.long -323420759
.long -323355224
.long -323383334
.long -323289704
.long -323317799
.long -323313704
.long -323315459
.long -302204264
.long -309343319
.long -308294744
.long -308740934
.long -307246184
.long -307692359
.long -307626824
.long -307654709
.long -306197864
.long -306643799
.long -306578264
.long -306606134
.long -306512744
.long -306540599
.long -306536504
.long -306538244
.long -305153384
.long -305595479
.long -305529944
.long -305557574
.long -305464424
.long -305492039
.long -305487944
.long -305489669
.long -305399144
.long -305426519
.long -305422424
.long -305424134
.long -305418344
.long -305420039
.long -305419784
.long -305419889
.long -19088744
.long -118633559
.long -101856344
.long -108077894
.long -85079144
.long -91300679
.long -90252104
.long -90640949
.long -68302184
.long -74523479
.long -73474904
.long -73863734
.long -72426344
.long -72815159
.long -72749624
.long -72773924
.long -51529064
.long -57746519
.long -56697944
.long -57086534
.long -55649384
.long -56037959
.long -55972424
.long -55996709
.long -54601064
.long -54989399
.long -54923864
.long -54948134
.long -54858344
.long -54882599
.long -54878504
.long -54880019
.long -34817384
.long -40973399
.long -39924824
.long -40309574
.long -38876264
.long -39260999
.long -39195464
.long -39219509
.long -37827944
.long -38212439
.long -38146904
.long -38170934
.long -38081384
.long -38105399
.long -38101304
.long -38102804
.long -36783464
.long -37164119
.long -37098584
.long -37122374
.long -37033064
.long -37056839
.long -37052744
.long -37054229
.long -36967784
.long -36991319
.long -36987224
.long -36988694
.long -36983144
.long -36984599
.long -36984344
.long -36984434
.long -19088744
.long -24261719
.long -23213144
.long -23536454
.long -22164584
.long -22487879
.long -22422344
.long -22442549
.long -21116264
.long -21439319
.long -21373784
.long -21393974
.long -21308264
.long -21328439
.long -21324344
.long -21325604
.long -20071784
.long -20390999
.long -20325464
.long -20345414
.long -20259944
.long -20279879
.long -20275784
.long -20277029
.long -20194664
.long -20214359
.long -20210264
.long -20211494
.long -20206184
.long -20207399
.long -20207144
.long -20207219
.long -19088744
.long -19346519
.long -19280984
.long -19297094
.long -19215464
.long -19231559
.long -19227464
.long -19228469
.long -19150184
.long -19166039
.long -19161944
.long -19162934
.long -19157864
.long -19158839
.long -19158584
.long -19158644
.long -19088744
.long -19100759
.long -19096664
.long -19097414
.long -19092584
.long -19093319
.long -19093064
.long -19093109
.long -19088744
.long -19089239
.long -19088984
.long -19089014
.long -19088744
.long -19088759
.long -19088744
.long -19088744
.hidden _ZZN3hwy6N_SSE46detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.weak _ZZN3hwy6N_SSE46detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.section .rodata._ZZN3hwy6N_SSE46detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,"aG",@progbits,_ZZN3hwy6N_SSE46detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,comdat
.balign 16
.type _ZZN3hwy6N_SSE46detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, @object
.size _ZZN3hwy6N_SSE46detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, 256
_ZZN3hwy6N_SSE46detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices:
.string ""
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003"
.string "\001\002\003\b\t\n\013\f\r\016\017\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007"
.string "\001\002\003\004\005\006\007\f\r\016\017\b\t\n\013\004\005\006\007\f\r\016\017"
.string "\001\002\003\b\t\n\013"
.string "\001\002\003\f\r\016\017\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007\b\t\n\013"
.string "\001\002\003\f\r\016\017"
.string "\001\002\003\b\t\n\013\004\005\006\007\f\r\016\017\b\t\n\013"
.string "\001\002\003\004\005\006\007\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007"
.string "\001\002\003\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.ascii "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.hidden _ZZN3hwy7N_SSSE36detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.weak _ZZN3hwy7N_SSSE36detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.section .rodata._ZZN3hwy7N_SSSE36detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,"aG",@progbits,_ZZN3hwy7N_SSSE36detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,comdat
.balign 16
.type _ZZN3hwy7N_SSSE36detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, @object
.size _ZZN3hwy7N_SSSE36detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, 256
_ZZN3hwy7N_SSSE36detail21IndicesFromNotBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices:
.string ""
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003"
.string "\001\002\003\b\t\n\013\f\r\016\017\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007"
.string "\001\002\003\004\005\006\007\f\r\016\017\b\t\n\013\004\005\006\007\f\r\016\017"
.string "\001\002\003\b\t\n\013"
.string "\001\002\003\f\r\016\017\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007\b\t\n\013"
.string "\001\002\003\f\r\016\017"
.string "\001\002\003\b\t\n\013\004\005\006\007\f\r\016\017\b\t\n\013"
.string "\001\002\003\004\005\006\007\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007"
.string "\001\002\003\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.ascii "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.hidden _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.weak _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.section .rodata._ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,"aG",@progbits,_ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,comdat
.balign 16
.type _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, @object
.size _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, 256
_ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices:
.string ""
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007"
.string "\001\002\003\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\b\t\n\013"
.string "\001\002\003\004\005\006\007\f\r\016\017"
.string "\001\002\003\b\t\n\013\004\005\006\007\f\r\016\017\004\005\006\007\b\t\n\013"
.string "\001\002\003\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013"
.string "\001\002\003\f\r\016\017\004\005\006\007\b\t\n\013\004\005\006\007\f\r\016\017"
.string "\001\002\003\b\t\n\013"
.string "\001\002\003\004\005\006\007\f\r\016\017\b\t\n\013\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007"
.string "\001\002\003\b\t\n\013\f\r\016\017\004\005\006\007\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003"
.ascii "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.hidden _ZZN3hwy6N_AVX26detail18IndicesFromBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array
.weak _ZZN3hwy6N_AVX26detail18IndicesFromBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array
.section .rodata._ZZN3hwy6N_AVX26detail18IndicesFromBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array,"aG",@progbits,_ZZN3hwy6N_AVX26detail18IndicesFromBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array,comdat
.balign 16
.type _ZZN3hwy6N_AVX26detail18IndicesFromBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array, @object
.size _ZZN3hwy6N_AVX26detail18IndicesFromBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array, 1024
_ZZN3hwy6N_AVX26detail18IndicesFromBits256IiLPv0EEENS0_6Vec256IjEEmE12packed_array:
.long 1985229328
.long 1985229336
.long 1985229321
.long 1985229464
.long 1985229066
.long 1985229224
.long 1985228969
.long 1985231512
.long 1985224971
.long 1985225144
.long 1985224889
.long 1985227672
.long 1985220794
.long 1985223592
.long 1985219497
.long 1985264280
.long 1985159436
.long 1985159624
.long 1985159369
.long 1985162392
.long 1985155274
.long 1985158312
.long 1985154217
.long 1985202840
.long 1985089739
.long 1985092792
.long 1985088697
.long 1985137560
.long 1985023162
.long 1985072040
.long 1985006505
.long 1985788568
.long 1984110861
.long 1984111064
.long 1984110809
.long 1984114072
.long 1984106714
.long 1984109992
.long 1984105897
.long 1984158360
.long 1984041179
.long 1984044472
.long 1984040377
.long 1984093080
.long 1983974842
.long 1984027560
.long 1983962025
.long 1984805528
.long 1982992604
.long 1982995912
.long 1982991817
.long 1983044760
.long 1982926282
.long 1982979240
.long 1982913705
.long 1983761048
.long 1981877707
.long 1981930680
.long 1981865145
.long 1982712728
.long 1980816570
.long 1981664168
.long 1980615593
.long 1994177176
.long 1967333646
.long 1967333864
.long 1967333609
.long 1967337112
.long 1967329514
.long 1967333032
.long 1967328937
.long 1967385240
.long 1967263979
.long 1967267512
.long 1967263417
.long 1967319960
.long 1967197882
.long 1967254440
.long 1967188905
.long 1968093848
.long 1966215404
.long 1966218952
.long 1966214857
.long 1966271640
.long 1966149322
.long 1966206120
.long 1966140585
.long 1967049368
.long 1965100747
.long 1965157560
.long 1965092025
.long 1966001048
.long 1964043450
.long 1964952488
.long 1963903913
.long 1978448536
.long 1949438189
.long 1949441752
.long 1949437657
.long 1949494680
.long 1949372122
.long 1949429160
.long 1949363625
.long 1950276248
.long 1948323547
.long 1948380600
.long 1948315065
.long 1949227928
.long 1947266490
.long 1948179368
.long 1947130793
.long 1961736856
.long 1931546332
.long 1931603400
.long 1931537865
.long 1932450968
.long 1930489290
.long 1931402408
.long 1930353833
.long 1944963736
.long 1913712075
.long 1914625208
.long 1913576633
.long 1928186776
.long 1896799418
.long 1911409576
.long 1894632361
.long 2128394904
.long 1698898191
.long 1698898424
.long 1698898169
.long 1698901912
.long 1698894074
.long 1698897832
.long 1698893737
.long 1698953880
.long 1698828539
.long 1698832312
.long 1698828217
.long 1698888600
.long 1698762682
.long 1698823080
.long 1698757545
.long 1699723928
.long 1697779964
.long 1697783752
.long 1697779657
.long 1697840280
.long 1697714122
.long 1697774760
.long 1697709225
.long 1698679448
.long 1696665547
.long 1696726200
.long 1696660665
.long 1697631128
.long 1695612090
.long 1696582568
.long 1695533993
.long 1711061656
.long 1681002749
.long 1681006552
.long 1681002457
.long 1681063320
.long 1680936922
.long 1680997800
.long 1680932265
.long 1681906328
.long 1679888347
.long 1679949240
.long 1679883705
.long 1680858008
.long 1678835130
.long 1679809448
.long 1678760873
.long 1694349976
.long 1663111132
.long 1663172040
.long 1663106505
.long 1664081048
.long 1662057930
.long 1663032488
.long 1661983913
.long 1677576856
.long 1645280715
.long 1646255288
.long 1645206713
.long 1660799896
.long 1628429498
.long 1644022696
.long 1627245481
.long 1876736664
.long 1412567294
.long 1412571112
.long 1412567017
.long 1412628120
.long 1412501482
.long 1412562600
.long 1412497065
.long 1413474968
.long 1411452907
.long 1411514040
.long 1411448505
.long 1412426648
.long 1410399930
.long 1411378088
.long 1410329513
.long 1425980056
.long 1394675692
.long 1394736840
.long 1394671305
.long 1395649688
.long 1393622730
.long 1394601128
.long 1393552553
.long 1409206936
.long 1376845515
.long 1377823928
.long 1376775353
.long 1392429976
.long 1359998138
.long 1375652776
.long 1358875561
.long 1609349784
.long 1126240237
.long 1126301400
.long 1126235865
.long 1127214488
.long 1125187290
.long 1126165928
.long 1125117353
.long 1140775576
.long 1108410075
.long 1109388728
.long 1108340153
.long 1123998616
.long 1091562938
.long 1107221416
.long 1090444201
.long 1340979864
.long 839974620
.long 840953288
.long 839904713
.long 855563416
.long 823127498
.long 838786216
.long 822009001
.long 1072548504
.long 554692043
.long 570350776
.long 553573561
.long 804113304
.long 285138106
.long 535677864
.long 267242409
.long -19088744
.hidden _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.weak _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.section .rodata._ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,"aG",@progbits,_ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,comdat
.balign 16
.type _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, @object
.size _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, 256
_ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices:
.string ""
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007"
.string "\001\002\003\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\b\t\n\013"
.string "\001\002\003\004\005\006\007\f\r\016\017"
.string "\001\002\003\b\t\n\013\004\005\006\007\f\r\016\017\004\005\006\007\b\t\n\013"
.string "\001\002\003\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013"
.string "\001\002\003\f\r\016\017\004\005\006\007\b\t\n\013\004\005\006\007\f\r\016\017"
.string "\001\002\003\b\t\n\013"
.string "\001\002\003\004\005\006\007\f\r\016\017\b\t\n\013\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007"
.string "\001\002\003\b\t\n\013\f\r\016\017\004\005\006\007\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003"
.ascii "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.hidden _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.weak _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.section .rodata._ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,"aG",@progbits,_ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,comdat
.balign 16
.type _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, @object
.size _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, 256
_ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIiLm4ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices:
.string ""
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\004\005\006\007"
.string "\001\002\003\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\b\t\n\013"
.string "\001\002\003\004\005\006\007\f\r\016\017"
.string "\001\002\003\b\t\n\013\004\005\006\007\f\r\016\017\004\005\006\007\b\t\n\013"
.string "\001\002\003\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013"
.string "\001\002\003\f\r\016\017\004\005\006\007\b\t\n\013\004\005\006\007\f\r\016\017"
.string "\001\002\003\b\t\n\013"
.string "\001\002\003\004\005\006\007\f\r\016\017\b\t\n\013\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007"
.string "\001\002\003\b\t\n\013\f\r\016\017\004\005\006\007\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003"
.ascii "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.set .LC0,.LC3
.section .rodata
.balign 64
.LC1:
.long 7
.long 6
.long 5
.long 4
.long 3
.long 2
.long 1
.long 0
.long 15
.long 14
.long 13
.long 12
.long 11
.long 10
.long 9
.long 8
.balign 64
.LC2:
.long 15
.long 14
.long 13
.long 12
.long 11
.long 10
.long 9
.long 8
.long 7
.long 6
.long 5
.long 4
.long 3
.long 2
.long 1
.long 0
.section .rodata.cst32,"aM",@progbits,32
.balign 32
.LC3:
.long 0
.long 1
.long 2
.long 3
.long 4
.long 5
.long 6
.long 7
.set .LC4,.LC9
.set .LC5,.LC8
.set .LC6,.LC9
.section .rodata
.balign 64
.LC8:
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.long -2147483648
.balign 64
.LC9:
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.long 2147483647
.set .LC10,.LC9
.set .LC13,.LC1
.set .LC14,.LC9
.set .LC15,.LC8
.set .LC16,.LC9
.section .rodata.cst32
.balign 32
.LC17:
.long 0
.long 4
.long 8
.long 12
.long 16
.long 20
.long 24
.long 28
| 560,349 | 24,733 | jart/cosmopolitan | false |
cosmopolitan/third_party/vqsort/vqsort_i64a.S | .text
.globl __popcountdi2
.section .text._ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18780:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
.cfi_offset 15, -24
.cfi_offset 14, -32
movq %rdi, %r14
pushq %r13
.cfi_offset 13, -40
movq %rcx, %r13
pushq %r12
.cfi_offset 12, -48
movq %rsi, %r12
pushq %rbx
subq $88, %rsp
.cfi_offset 3, -56
movq %rdx, -120(%rbp)
movaps %xmm0, -80(%rbp)
movaps %xmm1, -64(%rbp)
movaps %xmm0, -96(%rbp)
movaps %xmm1, -112(%rbp)
cmpq $1, %rsi
jbe .L24
movl $2, %r15d
xorl %ebx, %ebx
jmp .L9
.p2align 4,,10
.p2align 3
.L3:
movdqa -80(%rbp), %xmm5
movmskpd %xmm1, %edi
movups %xmm5, (%r14,%rbx,8)
call __popcountdi2@PLT
cltq
addq %rax, %rbx
leaq 2(%r15), %rax
cmpq %r12, %rax
ja .L56
movq %rax, %r15
.L9:
movdqu -16(%r14,%r15,8), %xmm0
leaq -2(%r15), %rdx
leaq 0(,%rbx,8), %rax
pcmpeqd -96(%rbp), %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm0, %xmm1
movdqu -16(%r14,%r15,8), %xmm0
pcmpeqd -112(%rbp), %xmm0
pshufd $177, %xmm0, %xmm2
pand %xmm2, %xmm0
movdqa %xmm1, %xmm2
por %xmm0, %xmm2
movmskpd %xmm2, %ecx
cmpl $3, %ecx
je .L3
pcmpeqd %xmm2, %xmm2
movq -120(%rbp), %rsi
leaq 2(%rbx), %rdi
pxor %xmm2, %xmm0
pandn %xmm0, %xmm1
movmskpd %xmm1, %ecx
rep bsfl %ecx, %ecx
movslq %ecx, %rcx
addq %rdx, %rcx
movq (%r14,%rcx,8), %xmm0
punpcklqdq %xmm0, %xmm0
movaps %xmm0, (%rsi)
cmpq %rdx, %rdi
ja .L4
movq %rdx, %rcx
addq %r14, %rax
subq %rbx, %rcx
leaq -2(%rcx), %rsi
movq %rsi, %rcx
andq $-2, %rcx
addq %rbx, %rcx
leaq 16(%r14,%rcx,8), %rcx
.p2align 4,,10
.p2align 3
.L5:
movdqa -64(%rbp), %xmm4
addq $16, %rax
movups %xmm4, -16(%rax)
cmpq %rcx, %rax
jne .L5
andq $-2, %rsi
leaq (%rsi,%rdi), %rbx
.L4:
subq %rbx, %rdx
movdqa .LC1(%rip), %xmm2
movdqa .LC0(%rip), %xmm1
leaq 0(,%rbx,8), %rcx
movq %rdx, %xmm0
punpcklqdq %xmm0, %xmm0
movdqa %xmm0, %xmm3
psubq %xmm0, %xmm1
pcmpeqd %xmm2, %xmm3
pcmpgtd %xmm2, %xmm0
pand %xmm3, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L6
movdqa -64(%rbp), %xmm3
movq %xmm3, (%r14,%rbx,8)
.L6:
movhlps %xmm0, %xmm3
movq %xmm3, %rax
testq %rax, %rax
jne .L57
.L17:
addq $88, %rsp
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L57:
.cfi_restore_state
movdqa -64(%rbp), %xmm3
movhps %xmm3, 8(%r14,%rcx)
jmp .L17
.p2align 4,,10
.p2align 3
.L56:
movq %r12, %rcx
leaq 0(,%r15,8), %rsi
leaq 0(,%rbx,8), %r9
subq %r15, %rcx
.L2:
testq %rcx, %rcx
je .L13
leaq 0(,%rcx,8), %rdx
addq %r14, %rsi
movq %r13, %rdi
movq %r9, -112(%rbp)
movq %rcx, -96(%rbp)
call memcpy@PLT
movq -96(%rbp), %rcx
movq -112(%rbp), %r9
.L13:
movdqa .LC1(%rip), %xmm3
movq %rcx, %xmm2
movdqa -80(%rbp), %xmm5
movdqa .LC0(%rip), %xmm1
punpcklqdq %xmm2, %xmm2
movdqa %xmm3, %xmm4
pcmpeqd %xmm2, %xmm4
movdqa %xmm1, %xmm0
psubq %xmm2, %xmm0
pcmpgtd %xmm3, %xmm2
pand %xmm4, %xmm0
por %xmm2, %xmm0
movdqa 0(%r13), %xmm2
pshufd $245, %xmm0, %xmm0
pcmpeqd %xmm2, %xmm5
pcmpeqd -64(%rbp), %xmm2
pshufd $177, %xmm5, %xmm4
pand %xmm0, %xmm4
pand %xmm5, %xmm4
pshufd $177, %xmm2, %xmm5
pand %xmm5, %xmm2
pcmpeqd %xmm5, %xmm5
movdqa %xmm5, %xmm6
pxor %xmm0, %xmm6
por %xmm6, %xmm2
por %xmm4, %xmm2
movmskpd %xmm2, %eax
cmpl $3, %eax
jne .L58
movq %xmm0, %rax
testq %rax, %rax
je .L18
movdqa -80(%rbp), %xmm5
movq %xmm5, (%r14,%r9)
.L18:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
jne .L59
.L19:
movmskpd %xmm4, %edi
call __popcountdi2@PLT
movdqa .LC0(%rip), %xmm1
movdqa .LC1(%rip), %xmm3
movslq %eax, %rdx
addq %rbx, %rdx
leaq 2(%rdx), %rax
cmpq %rax, %r12
jb .L20
.p2align 4,,10
.p2align 3
.L21:
movdqa -64(%rbp), %xmm7
movq %rax, %rdx
movups %xmm7, -16(%r14,%rax,8)
addq $2, %rax
cmpq %rax, %r12
jnb .L21
.L20:
subq %rdx, %r12
movdqa %xmm3, %xmm2
leaq 0(,%rdx,8), %rcx
movq %r12, %xmm0
punpcklqdq %xmm0, %xmm0
pcmpeqd %xmm0, %xmm2
psubq %xmm0, %xmm1
pcmpgtd %xmm3, %xmm0
pand %xmm2, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L22
movdqa -64(%rbp), %xmm3
movq %xmm3, (%r14,%rdx,8)
.L22:
movhlps %xmm0, %xmm3
movq %xmm3, %rax
testq %rax, %rax
je .L23
movdqa -64(%rbp), %xmm3
movhps %xmm3, 8(%r14,%rcx)
.L23:
addq $88, %rsp
movl $1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L59:
.cfi_restore_state
movdqa -80(%rbp), %xmm6
movhps %xmm6, 8(%r14,%r9)
jmp .L19
.L24:
movq %rsi, %rcx
xorl %r9d, %r9d
xorl %esi, %esi
xorl %ebx, %ebx
xorl %r15d, %r15d
jmp .L2
.L58:
pxor %xmm5, %xmm2
leaq 2(%rbx), %rsi
movmskpd %xmm2, %eax
rep bsfl %eax, %eax
cltq
addq %r15, %rax
movq (%r14,%rax,8), %xmm0
movq -120(%rbp), %rax
punpcklqdq %xmm0, %xmm0
movaps %xmm0, (%rax)
cmpq %r15, %rsi
ja .L14
leaq -2(%r15), %rcx
leaq (%r14,%rbx,8), %rax
subq %rbx, %rcx
movq %rcx, %rdx
andq $-2, %rdx
addq %rbx, %rdx
leaq 16(%r14,%rdx,8), %rdx
.p2align 4,,10
.p2align 3
.L15:
movdqa -64(%rbp), %xmm4
addq $16, %rax
movups %xmm4, -16(%rax)
cmpq %rax, %rdx
jne .L15
andq $-2, %rcx
leaq (%rcx,%rsi), %rbx
leaq 0(,%rbx,8), %r9
.L14:
subq %rbx, %r15
movdqa %xmm3, %xmm2
movq %r15, %xmm0
punpcklqdq %xmm0, %xmm0
pcmpeqd %xmm0, %xmm2
psubq %xmm0, %xmm1
pcmpgtd %xmm3, %xmm0
pand %xmm2, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L16
movdqa -64(%rbp), %xmm3
movq %xmm3, (%r14,%r9)
.L16:
movhlps %xmm0, %xmm3
movq %xmm3, %rax
testq %rax, %rax
je .L17
movdqa -64(%rbp), %xmm3
movhps %xmm3, 8(%r14,%r9)
jmp .L17
.cfi_endproc
.LFE18780:
.size _ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, @function
_ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0:
.LFB18781:
.cfi_startproc
cmpq %rdx, %rsi
jbe .L60
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r8
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rax, %rsi
jbe .L60
movq (%rdi,%rdx,8), %r11
movq %r11, %xmm3
punpcklqdq %xmm3, %xmm3
movdqa %xmm3, %xmm6
jmp .L63
.p2align 4,,10
.p2align 3
.L69:
movq %rdx, %rax
.L64:
cmpq %rcx, %rsi
jbe .L65
salq $4, %r8
movq (%rdi,%r8), %xmm0
punpcklqdq %xmm0, %xmm0
movdqa %xmm0, %xmm2
psubq %xmm0, %xmm1
pcmpeqd %xmm4, %xmm2
pcmpgtd %xmm4, %xmm0
pand %xmm2, %xmm1
por %xmm0, %xmm1
pshufd $245, %xmm1, %xmm1
movmskpd %xmm1, %r8d
andl $1, %r8d
jne .L66
.L65:
cmpq %rdx, %rax
je .L60
leaq (%rdi,%rax,8), %rdx
movq (%rdx), %rcx
movq %rcx, (%r10)
movq %r11, (%rdx)
cmpq %rax, %rsi
jbe .L72
movq %rax, %rdx
.L67:
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r8
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rsi, %rax
jnb .L60
.L63:
movq (%rdi,%rax,8), %xmm2
movdqa %xmm3, %xmm0
leaq (%rdi,%rdx,8), %r10
movdqa %xmm6, %xmm4
movdqa %xmm3, %xmm1
punpcklqdq %xmm2, %xmm2
movdqa %xmm2, %xmm5
psubq %xmm2, %xmm0
pcmpeqd %xmm3, %xmm5
pand %xmm5, %xmm0
movdqa %xmm2, %xmm5
pcmpgtd %xmm3, %xmm5
por %xmm5, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %r9d
andl $1, %r9d
je .L69
movdqa %xmm2, %xmm1
movdqa %xmm2, %xmm4
jmp .L64
.p2align 4,,10
.p2align 3
.L66:
cmpq %rcx, %rdx
je .L60
leaq (%rdi,%rcx,8), %rax
movq (%rax), %rdx
movq %rdx, (%r10)
movq %rcx, %rdx
movq %r11, (%rax)
jmp .L67
.p2align 4,,10
.p2align 3
.L60:
ret
.p2align 4,,10
.p2align 3
.L72:
ret
.cfi_endproc
.LFE18781:
.size _ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, .-_ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
.section .text._ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, @function
_ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0:
.LFB18782:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %rax
salq $3, %rax
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq (%rdi,%rax), %r15
pushq %r14
.cfi_offset 14, -32
leaq (%r15,%rax), %r14
pushq %r13
.cfi_offset 13, -40
leaq (%r14,%rax), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%rax), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%rax), %rbx
leaq (%rbx,%rax), %r11
leaq (%r11,%rax), %r10
subq $224, %rsp
leaq (%r10,%rax), %r9
leaq (%r9,%rax), %r8
movq %rdi, -232(%rbp)
movq %rsi, -192(%rbp)
movdqu (%rdi), %xmm9
leaq (%r8,%rax), %rdi
movdqu (%r15), %xmm6
leaq (%rdi,%rax), %rsi
movdqu 0(%r13), %xmm5
movdqu (%r14), %xmm13
leaq (%rsi,%rax), %rcx
movdqa %xmm9, %xmm14
movdqu (%rbx), %xmm3
movdqu (%r12), %xmm12
leaq (%rcx,%rax), %rdx
psubq %xmm6, %xmm14
movdqu (%r10), %xmm2
movdqu (%r11), %xmm11
movdqu (%rdx), %xmm0
movdqu (%rsi), %xmm4
movq %rdx, -216(%rbp)
addq %rax, %rdx
movdqu (%rdx), %xmm15
movdqu (%r8), %xmm8
movq %rdx, -224(%rbp)
addq %rdx, %rax
movaps %xmm0, -96(%rbp)
movdqa %xmm6, %xmm0
movdqu (%rdi), %xmm7
movdqu (%rcx), %xmm1
pcmpeqd %xmm9, %xmm0
movaps %xmm15, -112(%rbp)
movdqu (%r9), %xmm10
pand %xmm14, %xmm0
movdqa %xmm6, %xmm14
pcmpgtd %xmm9, %xmm14
por %xmm14, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm14
pandn %xmm6, %xmm14
pand %xmm0, %xmm6
movdqa %xmm14, %xmm15
movdqa %xmm9, %xmm14
pand %xmm0, %xmm14
por %xmm15, %xmm14
movdqa %xmm0, %xmm15
movdqa %xmm5, %xmm0
pcmpeqd %xmm13, %xmm0
pandn %xmm9, %xmm15
movdqa %xmm13, %xmm9
psubq %xmm5, %xmm9
por %xmm15, %xmm6
pand %xmm9, %xmm0
movdqa %xmm5, %xmm9
pcmpgtd %xmm13, %xmm9
por %xmm9, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm9
pandn %xmm5, %xmm9
pand %xmm0, %xmm5
movdqa %xmm9, %xmm15
movdqa %xmm13, %xmm9
pand %xmm0, %xmm9
por %xmm15, %xmm9
movdqa %xmm0, %xmm15
movdqa %xmm3, %xmm0
pcmpeqd %xmm12, %xmm0
pandn %xmm13, %xmm15
movdqa %xmm12, %xmm13
psubq %xmm3, %xmm13
por %xmm15, %xmm5
pand %xmm13, %xmm0
movdqa %xmm3, %xmm13
pcmpgtd %xmm12, %xmm13
por %xmm13, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm13
pandn %xmm3, %xmm13
pand %xmm0, %xmm3
movdqa %xmm13, %xmm15
movdqa %xmm12, %xmm13
pand %xmm0, %xmm13
por %xmm15, %xmm13
movdqa %xmm0, %xmm15
movdqa %xmm2, %xmm0
pandn %xmm12, %xmm15
pcmpeqd %xmm11, %xmm0
por %xmm15, %xmm3
movaps %xmm3, -64(%rbp)
movdqa %xmm11, %xmm3
psubq %xmm2, %xmm3
pand %xmm3, %xmm0
movdqa %xmm2, %xmm3
pcmpgtd %xmm11, %xmm3
por %xmm3, %xmm0
movdqa %xmm11, %xmm3
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm12
pand %xmm0, %xmm3
pandn %xmm2, %xmm12
pand %xmm0, %xmm2
por %xmm12, %xmm3
movdqa %xmm0, %xmm12
movdqa %xmm8, %xmm0
pcmpeqd %xmm10, %xmm0
pandn %xmm11, %xmm12
movdqa %xmm10, %xmm11
psubq %xmm8, %xmm11
por %xmm12, %xmm2
movdqa %xmm10, %xmm12
pand %xmm11, %xmm0
movdqa %xmm8, %xmm11
pcmpgtd %xmm10, %xmm11
por %xmm11, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm11
pand %xmm0, %xmm12
pandn %xmm8, %xmm11
pand %xmm0, %xmm8
por %xmm11, %xmm12
movdqa %xmm0, %xmm11
movdqa %xmm4, %xmm0
pandn %xmm10, %xmm11
pcmpeqd %xmm7, %xmm0
por %xmm11, %xmm8
movaps %xmm8, -80(%rbp)
movdqa %xmm7, %xmm8
movdqa -96(%rbp), %xmm10
movdqa -112(%rbp), %xmm15
psubq %xmm4, %xmm8
pand %xmm8, %xmm0
movdqa %xmm4, %xmm8
pcmpgtd %xmm7, %xmm8
por %xmm8, %xmm0
movdqa %xmm7, %xmm8
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm11
pand %xmm0, %xmm8
pandn %xmm4, %xmm11
pand %xmm0, %xmm4
por %xmm11, %xmm8
movdqa %xmm0, %xmm11
movdqa %xmm10, %xmm0
pcmpeqd %xmm1, %xmm0
pandn %xmm7, %xmm11
movdqa %xmm1, %xmm7
psubq %xmm10, %xmm7
por %xmm11, %xmm4
movdqa %xmm1, %xmm11
pand %xmm7, %xmm0
movdqa %xmm10, %xmm7
pcmpgtd %xmm1, %xmm7
por %xmm7, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm7
pand %xmm0, %xmm11
pandn %xmm10, %xmm7
por %xmm7, %xmm11
movdqa %xmm0, %xmm7
pand %xmm10, %xmm0
movdqu (%rax), %xmm10
pandn %xmm1, %xmm7
movdqa %xmm15, %xmm1
por %xmm7, %xmm0
movdqu (%rax), %xmm7
movaps %xmm0, -96(%rbp)
psubq %xmm7, %xmm1
movdqu (%rax), %xmm7
movdqa %xmm1, %xmm0
movdqu (%rax), %xmm1
pcmpgtd %xmm15, %xmm7
pcmpeqd %xmm15, %xmm1
pand %xmm0, %xmm1
movdqa %xmm15, %xmm0
por %xmm7, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm7
pand %xmm1, %xmm0
pandn %xmm10, %xmm7
por %xmm7, %xmm0
movdqa %xmm1, %xmm7
pand %xmm10, %xmm1
pandn %xmm15, %xmm7
movdqa %xmm14, %xmm10
movdqa %xmm14, %xmm15
por %xmm7, %xmm1
movdqa %xmm9, %xmm7
psubq %xmm9, %xmm10
pcmpeqd %xmm14, %xmm7
pand %xmm10, %xmm7
movdqa %xmm9, %xmm10
pcmpgtd %xmm14, %xmm10
por %xmm10, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm10
pand %xmm7, %xmm15
pandn %xmm9, %xmm10
pand %xmm7, %xmm9
por %xmm15, %xmm10
movdqa %xmm7, %xmm15
movdqa %xmm5, %xmm7
pcmpeqd %xmm6, %xmm7
pandn %xmm14, %xmm15
movdqa %xmm6, %xmm14
por %xmm9, %xmm15
movdqa %xmm6, %xmm9
psubq %xmm5, %xmm9
pand %xmm9, %xmm7
movdqa %xmm5, %xmm9
pcmpgtd %xmm6, %xmm9
por %xmm9, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm9
pand %xmm7, %xmm14
pandn %xmm5, %xmm9
pand %xmm7, %xmm5
por %xmm14, %xmm9
movdqa %xmm7, %xmm14
pandn %xmm6, %xmm14
movdqa %xmm3, %xmm6
por %xmm14, %xmm5
pcmpeqd %xmm13, %xmm6
movdqa -64(%rbp), %xmm14
movaps %xmm5, -112(%rbp)
movdqa %xmm13, %xmm5
psubq %xmm3, %xmm5
pand %xmm5, %xmm6
movdqa %xmm3, %xmm5
pcmpgtd %xmm13, %xmm5
por %xmm5, %xmm6
movdqa %xmm13, %xmm5
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm7
pand %xmm6, %xmm5
pandn %xmm3, %xmm7
pand %xmm6, %xmm3
por %xmm7, %xmm5
movdqa %xmm6, %xmm7
movdqa %xmm14, %xmm6
pandn %xmm13, %xmm7
pcmpeqd %xmm2, %xmm6
por %xmm7, %xmm3
movdqa %xmm14, %xmm7
psubq %xmm2, %xmm7
pand %xmm7, %xmm6
movdqa %xmm2, %xmm7
pcmpgtd %xmm14, %xmm7
por %xmm7, %xmm6
movdqa %xmm14, %xmm7
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm13
pand %xmm6, %xmm7
pandn %xmm2, %xmm13
pand %xmm6, %xmm2
por %xmm13, %xmm7
movdqa %xmm6, %xmm13
movdqa %xmm8, %xmm6
pandn %xmm14, %xmm13
pcmpeqd %xmm12, %xmm6
movdqa %xmm12, %xmm14
por %xmm13, %xmm2
movdqa %xmm12, %xmm13
psubq %xmm8, %xmm13
pand %xmm13, %xmm6
movdqa %xmm8, %xmm13
pcmpgtd %xmm12, %xmm13
por %xmm13, %xmm6
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm13
pand %xmm6, %xmm14
pandn %xmm8, %xmm13
pand %xmm6, %xmm8
por %xmm14, %xmm13
movdqa %xmm6, %xmm14
movdqa %xmm8, %xmm6
pandn %xmm12, %xmm14
por %xmm14, %xmm6
movdqa -80(%rbp), %xmm14
movaps %xmm6, -128(%rbp)
movdqa %xmm14, %xmm6
movdqa %xmm14, %xmm8
movdqa %xmm14, %xmm12
pcmpeqd %xmm4, %xmm6
psubq %xmm4, %xmm8
pand %xmm8, %xmm6
movdqa %xmm4, %xmm8
pcmpgtd %xmm14, %xmm8
por %xmm8, %xmm6
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm8
pand %xmm6, %xmm12
pandn %xmm4, %xmm8
pand %xmm6, %xmm4
por %xmm12, %xmm8
movdqa %xmm6, %xmm12
movdqa %xmm0, %xmm6
pandn %xmm14, %xmm12
pcmpeqd %xmm11, %xmm6
movdqa -96(%rbp), %xmm14
por %xmm12, %xmm4
movaps %xmm4, -80(%rbp)
movdqa %xmm11, %xmm4
psubq %xmm0, %xmm4
pand %xmm4, %xmm6
movdqa %xmm0, %xmm4
pcmpgtd %xmm11, %xmm4
por %xmm4, %xmm6
movdqa %xmm11, %xmm4
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm12
pand %xmm6, %xmm4
pandn %xmm0, %xmm12
pand %xmm6, %xmm0
por %xmm12, %xmm4
movdqa %xmm6, %xmm12
movdqa %xmm14, %xmm6
pandn %xmm11, %xmm12
movdqa %xmm14, %xmm11
psubq %xmm1, %xmm6
pcmpeqd %xmm1, %xmm11
por %xmm12, %xmm0
pand %xmm6, %xmm11
movdqa %xmm1, %xmm6
pcmpgtd %xmm14, %xmm6
por %xmm6, %xmm11
movdqa %xmm14, %xmm6
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm12
pand %xmm11, %xmm6
pandn %xmm1, %xmm12
pand %xmm11, %xmm1
por %xmm12, %xmm6
movdqa %xmm11, %xmm12
movdqa %xmm5, %xmm11
pandn %xmm14, %xmm12
pcmpeqd %xmm10, %xmm11
movdqa %xmm10, %xmm14
por %xmm12, %xmm1
movdqa %xmm10, %xmm12
psubq %xmm5, %xmm12
pand %xmm12, %xmm11
movdqa %xmm5, %xmm12
pcmpgtd %xmm10, %xmm12
por %xmm12, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm12
pand %xmm11, %xmm14
pandn %xmm5, %xmm12
pand %xmm11, %xmm5
por %xmm14, %xmm12
movdqa %xmm11, %xmm14
movdqa %xmm9, %xmm11
pandn %xmm10, %xmm14
movdqa %xmm9, %xmm10
por %xmm5, %xmm14
movdqa %xmm7, %xmm5
psubq %xmm7, %xmm10
pcmpeqd %xmm9, %xmm5
pand %xmm10, %xmm5
movdqa %xmm7, %xmm10
pcmpgtd %xmm9, %xmm10
por %xmm10, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm10
pand %xmm5, %xmm11
pandn %xmm7, %xmm10
pand %xmm5, %xmm7
por %xmm11, %xmm10
movdqa %xmm5, %xmm11
movdqa %xmm3, %xmm5
pandn %xmm9, %xmm11
pcmpeqd %xmm15, %xmm5
movdqa %xmm15, %xmm9
por %xmm11, %xmm7
movaps %xmm7, -96(%rbp)
movdqa %xmm15, %xmm7
psubq %xmm3, %xmm7
pand %xmm7, %xmm5
movdqa %xmm3, %xmm7
pcmpgtd %xmm15, %xmm7
por %xmm7, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm7
pand %xmm5, %xmm9
pandn %xmm3, %xmm7
pand %xmm5, %xmm3
por %xmm9, %xmm7
movdqa %xmm5, %xmm9
pandn %xmm15, %xmm9
movdqa -112(%rbp), %xmm15
por %xmm9, %xmm3
movaps %xmm3, -144(%rbp)
movdqa %xmm15, %xmm3
movdqa %xmm15, %xmm5
movdqa %xmm15, %xmm9
pcmpeqd %xmm2, %xmm3
psubq %xmm2, %xmm5
pand %xmm5, %xmm3
movdqa %xmm2, %xmm5
pcmpgtd %xmm15, %xmm5
por %xmm5, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm5
pand %xmm3, %xmm9
pandn %xmm2, %xmm5
pand %xmm3, %xmm2
por %xmm9, %xmm5
movdqa %xmm3, %xmm9
movdqa %xmm13, %xmm3
pandn %xmm15, %xmm9
psubq %xmm4, %xmm3
movdqa -128(%rbp), %xmm15
por %xmm9, %xmm2
movaps %xmm2, -64(%rbp)
movdqa %xmm4, %xmm2
pcmpeqd %xmm13, %xmm2
pand %xmm3, %xmm2
movdqa %xmm4, %xmm3
pcmpgtd %xmm13, %xmm3
por %xmm3, %xmm2
movdqa %xmm13, %xmm3
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm9
pand %xmm2, %xmm3
pandn %xmm4, %xmm9
pand %xmm2, %xmm4
por %xmm9, %xmm3
movdqa %xmm2, %xmm9
movdqa %xmm6, %xmm2
pandn %xmm13, %xmm9
pcmpeqd %xmm8, %xmm2
por %xmm9, %xmm4
movdqa %xmm8, %xmm9
psubq %xmm6, %xmm9
pand %xmm9, %xmm2
movdqa %xmm6, %xmm9
pcmpgtd %xmm8, %xmm9
por %xmm9, %xmm2
movdqa %xmm8, %xmm9
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm11
pand %xmm2, %xmm9
pandn %xmm6, %xmm11
pand %xmm2, %xmm6
por %xmm11, %xmm9
movdqa %xmm2, %xmm11
movdqa %xmm15, %xmm2
pandn %xmm8, %xmm11
movdqa %xmm15, %xmm8
psubq %xmm0, %xmm2
pcmpeqd %xmm0, %xmm8
por %xmm11, %xmm6
pand %xmm2, %xmm8
movdqa %xmm0, %xmm2
pcmpgtd %xmm15, %xmm2
por %xmm2, %xmm8
movdqa %xmm15, %xmm2
pshufd $245, %xmm8, %xmm8
movdqa %xmm8, %xmm11
pand %xmm8, %xmm2
pandn %xmm0, %xmm11
pand %xmm8, %xmm0
por %xmm11, %xmm2
movdqa %xmm8, %xmm11
pandn %xmm15, %xmm11
movdqa -80(%rbp), %xmm15
por %xmm11, %xmm0
movdqa %xmm15, %xmm11
movdqa %xmm15, %xmm8
pcmpeqd %xmm1, %xmm11
psubq %xmm1, %xmm8
pand %xmm8, %xmm11
movdqa %xmm1, %xmm8
pcmpgtd %xmm15, %xmm8
por %xmm8, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm8
pandn %xmm1, %xmm8
pand %xmm11, %xmm1
movdqa %xmm8, %xmm13
movdqa %xmm15, %xmm8
pand %xmm11, %xmm8
por %xmm13, %xmm8
movdqa %xmm11, %xmm13
movdqa %xmm3, %xmm11
pcmpeqd %xmm12, %xmm11
pandn %xmm15, %xmm13
movdqa %xmm12, %xmm15
psubq %xmm3, %xmm15
por %xmm13, %xmm1
pand %xmm15, %xmm11
movdqa %xmm3, %xmm15
pcmpgtd %xmm12, %xmm15
por %xmm15, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm15
pandn %xmm3, %xmm15
pand %xmm11, %xmm3
movdqa %xmm15, %xmm13
movdqa %xmm12, %xmm15
pand %xmm11, %xmm15
por %xmm13, %xmm15
movaps %xmm15, -112(%rbp)
movdqa %xmm11, %xmm15
movdqa %xmm10, %xmm11
pandn %xmm12, %xmm15
psubq %xmm9, %xmm11
movdqa %xmm10, %xmm12
movdqa %xmm15, %xmm13
movdqa %xmm3, %xmm15
movdqa %xmm9, %xmm3
pcmpeqd %xmm10, %xmm3
por %xmm13, %xmm15
movdqa -96(%rbp), %xmm13
pand %xmm11, %xmm3
movdqa %xmm9, %xmm11
pcmpgtd %xmm10, %xmm11
por %xmm11, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm11
pand %xmm3, %xmm12
pandn %xmm9, %xmm11
pand %xmm3, %xmm9
por %xmm11, %xmm12
movdqa %xmm3, %xmm11
movdqa %xmm7, %xmm3
pandn %xmm10, %xmm11
movdqa %xmm2, %xmm10
psubq %xmm2, %xmm3
movaps %xmm12, -80(%rbp)
pcmpeqd %xmm7, %xmm10
por %xmm11, %xmm9
pand %xmm3, %xmm10
movdqa %xmm2, %xmm3
pcmpgtd %xmm7, %xmm3
por %xmm3, %xmm10
movdqa %xmm7, %xmm3
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm11
pand %xmm10, %xmm3
pandn %xmm2, %xmm11
pand %xmm10, %xmm2
por %xmm11, %xmm3
movdqa %xmm10, %xmm11
movdqa %xmm8, %xmm10
pcmpeqd %xmm5, %xmm10
pandn %xmm7, %xmm11
movdqa %xmm5, %xmm7
psubq %xmm8, %xmm7
por %xmm11, %xmm2
pand %xmm7, %xmm10
movdqa %xmm8, %xmm7
pcmpgtd %xmm5, %xmm7
por %xmm7, %xmm10
movdqa %xmm5, %xmm7
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm11
pand %xmm10, %xmm7
pandn %xmm8, %xmm11
pand %xmm10, %xmm8
por %xmm11, %xmm7
movdqa %xmm10, %xmm11
movdqa %xmm4, %xmm10
pcmpeqd %xmm14, %xmm10
pandn %xmm5, %xmm11
movdqa %xmm14, %xmm5
psubq %xmm4, %xmm5
por %xmm11, %xmm8
pand %xmm5, %xmm10
movdqa %xmm4, %xmm5
pcmpgtd %xmm14, %xmm5
por %xmm5, %xmm10
movdqa %xmm14, %xmm5
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm11
pand %xmm10, %xmm5
pandn %xmm4, %xmm11
pand %xmm10, %xmm4
por %xmm11, %xmm5
movdqa %xmm10, %xmm11
movdqa %xmm13, %xmm10
pandn %xmm14, %xmm11
psubq %xmm6, %xmm10
movdqa -144(%rbp), %xmm14
por %xmm11, %xmm4
movdqa %xmm13, %xmm11
pcmpeqd %xmm6, %xmm11
pand %xmm10, %xmm11
movdqa %xmm6, %xmm10
pcmpgtd %xmm13, %xmm10
por %xmm10, %xmm11
movdqa %xmm13, %xmm10
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm12
pand %xmm11, %xmm10
pandn %xmm6, %xmm12
pand %xmm11, %xmm6
por %xmm12, %xmm10
movdqa %xmm11, %xmm12
movdqa %xmm14, %xmm11
pandn %xmm13, %xmm12
pcmpeqd %xmm0, %xmm11
por %xmm12, %xmm6
movdqa %xmm14, %xmm12
psubq %xmm0, %xmm12
pand %xmm12, %xmm11
movdqa %xmm0, %xmm12
pcmpgtd %xmm14, %xmm12
por %xmm12, %xmm11
movdqa %xmm14, %xmm12
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm13
pand %xmm11, %xmm12
pandn %xmm0, %xmm13
pand %xmm11, %xmm0
por %xmm13, %xmm12
movdqa %xmm11, %xmm13
pandn %xmm14, %xmm13
movdqa -64(%rbp), %xmm14
por %xmm13, %xmm0
movdqa %xmm14, %xmm11
movdqa %xmm14, %xmm13
movaps %xmm0, -96(%rbp)
pcmpeqd %xmm1, %xmm11
psubq %xmm1, %xmm13
pand %xmm13, %xmm11
movdqa %xmm1, %xmm13
pcmpgtd %xmm14, %xmm13
por %xmm13, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm13
movdqa %xmm11, %xmm0
pandn -64(%rbp), %xmm0
pandn %xmm1, %xmm13
pand %xmm11, %xmm1
pand %xmm11, %xmm14
por %xmm0, %xmm1
movdqa %xmm10, %xmm11
por %xmm14, %xmm13
movaps %xmm1, -160(%rbp)
movdqa %xmm2, %xmm1
psubq %xmm2, %xmm11
movdqa %xmm7, %xmm0
pcmpeqd %xmm10, %xmm1
psubq %xmm4, %xmm0
pand %xmm11, %xmm1
movdqa %xmm2, %xmm11
pcmpgtd %xmm10, %xmm11
por %xmm11, %xmm1
movdqa %xmm10, %xmm11
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm14
pand %xmm1, %xmm11
pandn %xmm2, %xmm14
pand %xmm1, %xmm2
por %xmm14, %xmm11
movdqa %xmm1, %xmm14
movdqa %xmm12, %xmm1
pandn %xmm10, %xmm14
movdqa %xmm9, %xmm10
psubq %xmm9, %xmm1
pcmpeqd %xmm12, %xmm10
por %xmm14, %xmm2
pand %xmm1, %xmm10
movdqa %xmm9, %xmm1
pcmpgtd %xmm12, %xmm1
por %xmm1, %xmm10
movdqa %xmm12, %xmm1
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm14
pand %xmm10, %xmm1
pandn %xmm9, %xmm14
pand %xmm10, %xmm9
por %xmm14, %xmm1
movdqa %xmm10, %xmm14
movdqa %xmm4, %xmm10
pcmpeqd %xmm7, %xmm10
pandn %xmm12, %xmm14
por %xmm14, %xmm9
movdqa %xmm7, %xmm14
pand %xmm0, %xmm10
movdqa %xmm4, %xmm0
pcmpgtd %xmm7, %xmm0
por %xmm0, %xmm10
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm0
pand %xmm10, %xmm14
pandn %xmm4, %xmm0
pand %xmm10, %xmm4
por %xmm0, %xmm14
movdqa %xmm10, %xmm0
pandn %xmm7, %xmm0
movdqa %xmm13, %xmm7
por %xmm0, %xmm4
psubq %xmm8, %xmm7
movaps %xmm4, -64(%rbp)
movdqa %xmm8, %xmm4
pcmpeqd %xmm13, %xmm4
pand %xmm7, %xmm4
movdqa %xmm8, %xmm7
pcmpgtd %xmm13, %xmm7
por %xmm7, %xmm4
movdqa %xmm13, %xmm7
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm10
pand %xmm4, %xmm7
pandn %xmm8, %xmm10
pand %xmm4, %xmm8
por %xmm10, %xmm7
movdqa %xmm4, %xmm10
pandn %xmm13, %xmm10
movdqa -96(%rbp), %xmm13
por %xmm10, %xmm8
movdqa %xmm6, %xmm10
movdqa %xmm13, %xmm4
psubq %xmm13, %xmm10
pcmpeqd %xmm6, %xmm4
pand %xmm10, %xmm4
movdqa %xmm13, %xmm10
pcmpgtd %xmm6, %xmm10
por %xmm10, %xmm4
movdqa %xmm6, %xmm10
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm0
pand %xmm4, %xmm10
pandn %xmm13, %xmm0
por %xmm0, %xmm10
movdqa %xmm4, %xmm0
pandn %xmm6, %xmm0
movdqa %xmm15, %xmm6
movdqa %xmm0, %xmm12
pcmpeqd %xmm5, %xmm6
movdqa %xmm13, %xmm0
movdqa -80(%rbp), %xmm13
pand %xmm4, %xmm0
movdqa %xmm5, %xmm4
psubq %xmm15, %xmm4
por %xmm12, %xmm0
pand %xmm4, %xmm6
movdqa %xmm15, %xmm4
pcmpgtd %xmm5, %xmm4
por %xmm4, %xmm6
movdqa %xmm5, %xmm4
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm12
pand %xmm6, %xmm4
pandn %xmm15, %xmm12
pand %xmm6, %xmm15
por %xmm12, %xmm4
movdqa %xmm6, %xmm12
movdqa %xmm13, %xmm6
pandn %xmm5, %xmm12
movdqa %xmm13, %xmm5
psubq %xmm3, %xmm6
pcmpeqd %xmm3, %xmm5
por %xmm12, %xmm15
pand %xmm6, %xmm5
movdqa %xmm3, %xmm6
pcmpgtd %xmm13, %xmm6
por %xmm6, %xmm5
movdqa %xmm13, %xmm6
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm12
pand %xmm5, %xmm6
pandn %xmm3, %xmm12
pand %xmm5, %xmm3
por %xmm12, %xmm6
movdqa %xmm5, %xmm12
movdqa %xmm4, %xmm5
pandn %xmm13, %xmm12
pcmpeqd %xmm6, %xmm5
movdqa %xmm6, %xmm13
por %xmm12, %xmm3
movdqa %xmm6, %xmm12
psubq %xmm4, %xmm12
pand %xmm12, %xmm5
movdqa %xmm4, %xmm12
pcmpgtd %xmm6, %xmm12
por %xmm12, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm12
pand %xmm5, %xmm13
pandn %xmm4, %xmm12
pand %xmm5, %xmm4
por %xmm12, %xmm13
movdqa %xmm5, %xmm12
movdqa %xmm7, %xmm5
pandn %xmm6, %xmm12
movdqa %xmm10, %xmm6
psubq %xmm10, %xmm5
movaps %xmm13, -128(%rbp)
pcmpeqd %xmm7, %xmm6
por %xmm12, %xmm4
pand %xmm5, %xmm6
movdqa %xmm10, %xmm5
pcmpgtd %xmm7, %xmm5
por %xmm5, %xmm6
movdqa %xmm7, %xmm5
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm12
pand %xmm6, %xmm5
pandn %xmm10, %xmm12
pand %xmm6, %xmm10
por %xmm12, %xmm5
movdqa %xmm6, %xmm12
movdqa %xmm3, %xmm6
pandn %xmm7, %xmm12
movdqa %xmm15, %xmm7
psubq %xmm15, %xmm6
pcmpeqd %xmm3, %xmm7
por %xmm12, %xmm10
pand %xmm6, %xmm7
movdqa %xmm15, %xmm6
pcmpgtd %xmm3, %xmm6
por %xmm6, %xmm7
movdqa %xmm3, %xmm6
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm12
pand %xmm7, %xmm6
pandn %xmm15, %xmm12
pand %xmm7, %xmm15
por %xmm12, %xmm6
movdqa %xmm7, %xmm12
movdqa %xmm0, %xmm7
pcmpeqd %xmm8, %xmm7
pandn %xmm3, %xmm12
movdqa %xmm8, %xmm3
psubq %xmm0, %xmm3
por %xmm12, %xmm15
pand %xmm3, %xmm7
movdqa %xmm0, %xmm3
pcmpgtd %xmm8, %xmm3
por %xmm3, %xmm7
movdqa %xmm8, %xmm3
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm12
pand %xmm7, %xmm3
pandn %xmm0, %xmm12
pand %xmm7, %xmm0
por %xmm12, %xmm3
movdqa %xmm7, %xmm12
movdqa %xmm6, %xmm7
pandn %xmm8, %xmm12
psubq %xmm4, %xmm7
movdqa %xmm6, %xmm8
por %xmm12, %xmm0
movdqa %xmm5, %xmm12
movaps %xmm0, -176(%rbp)
movdqa %xmm4, %xmm0
pcmpeqd %xmm6, %xmm0
pand %xmm7, %xmm0
movdqa %xmm4, %xmm7
pcmpgtd %xmm6, %xmm7
por %xmm7, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm7
pand %xmm0, %xmm8
pandn %xmm4, %xmm7
pand %xmm0, %xmm4
por %xmm7, %xmm8
movdqa %xmm0, %xmm7
movdqa %xmm11, %xmm0
pandn %xmm6, %xmm7
movdqa %xmm1, %xmm6
psubq %xmm1, %xmm0
movaps %xmm8, -144(%rbp)
pcmpeqd %xmm11, %xmm6
por %xmm7, %xmm4
movdqa %xmm9, %xmm8
cmpq $1, -192(%rbp)
pand %xmm0, %xmm6
movdqa %xmm1, %xmm0
pcmpgtd %xmm11, %xmm0
por %xmm0, %xmm6
movdqa %xmm11, %xmm0
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm7
pand %xmm6, %xmm0
pandn %xmm1, %xmm7
pand %xmm6, %xmm1
por %xmm7, %xmm0
movdqa %xmm6, %xmm7
pandn %xmm11, %xmm7
por %xmm7, %xmm1
movdqa %xmm9, %xmm7
movdqa %xmm1, %xmm6
movdqa %xmm2, %xmm1
psubq %xmm2, %xmm7
pcmpeqd %xmm9, %xmm1
pand %xmm7, %xmm1
movdqa %xmm2, %xmm7
pcmpgtd %xmm9, %xmm7
por %xmm7, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm7
pand %xmm1, %xmm8
pandn %xmm2, %xmm7
pand %xmm1, %xmm2
por %xmm7, %xmm8
movdqa %xmm1, %xmm7
movdqa %xmm10, %xmm1
pandn %xmm9, %xmm7
pcmpeqd %xmm3, %xmm1
por %xmm7, %xmm2
movdqa %xmm3, %xmm7
psubq %xmm10, %xmm7
pand %xmm7, %xmm1
movdqa %xmm10, %xmm7
pcmpgtd %xmm3, %xmm7
por %xmm7, %xmm1
movdqa %xmm3, %xmm7
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm9
pand %xmm1, %xmm7
pandn %xmm10, %xmm9
pand %xmm1, %xmm10
por %xmm9, %xmm7
movdqa %xmm1, %xmm9
movdqa %xmm14, %xmm1
pandn %xmm3, %xmm9
movdqa %xmm15, %xmm3
psubq %xmm15, %xmm1
pcmpeqd %xmm14, %xmm3
movdqa %xmm10, %xmm13
movdqa %xmm14, %xmm10
por %xmm9, %xmm13
movdqa %xmm0, %xmm9
pand %xmm1, %xmm3
movdqa %xmm15, %xmm1
pcmpgtd %xmm14, %xmm1
por %xmm1, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm1
pand %xmm3, %xmm10
pandn %xmm15, %xmm1
pand %xmm3, %xmm15
por %xmm1, %xmm10
movdqa %xmm3, %xmm1
movdqa %xmm5, %xmm3
pandn %xmm14, %xmm1
movdqa -64(%rbp), %xmm14
pcmpeqd %xmm10, %xmm9
movdqa %xmm10, %xmm11
por %xmm1, %xmm15
movdqa %xmm14, %xmm1
psubq %xmm14, %xmm3
pcmpeqd %xmm5, %xmm1
pand %xmm3, %xmm1
movdqa %xmm14, %xmm3
pcmpgtd %xmm5, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm3
pand %xmm1, %xmm12
pandn %xmm14, %xmm3
por %xmm3, %xmm12
movdqa %xmm1, %xmm3
pand %xmm14, %xmm1
pandn %xmm5, %xmm3
por %xmm3, %xmm1
movdqa %xmm10, %xmm3
psubq %xmm0, %xmm3
pand %xmm3, %xmm9
movdqa %xmm0, %xmm3
pcmpgtd %xmm10, %xmm3
por %xmm3, %xmm9
pshufd $245, %xmm9, %xmm9
movdqa %xmm9, %xmm3
pand %xmm9, %xmm11
pandn %xmm0, %xmm3
por %xmm3, %xmm11
movdqa %xmm9, %xmm3
pand %xmm0, %xmm9
pandn %xmm10, %xmm3
movdqa %xmm6, %xmm0
movdqa %xmm12, %xmm10
por %xmm3, %xmm9
movdqa %xmm15, %xmm3
psubq %xmm15, %xmm0
pcmpeqd %xmm6, %xmm3
pand %xmm0, %xmm3
movdqa %xmm15, %xmm0
pcmpgtd %xmm6, %xmm0
por %xmm0, %xmm3
movdqa %xmm6, %xmm0
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm5
pand %xmm3, %xmm0
pandn %xmm15, %xmm5
por %xmm5, %xmm0
movdqa %xmm3, %xmm5
pand %xmm15, %xmm3
pandn %xmm6, %xmm5
movdqa %xmm12, %xmm6
por %xmm5, %xmm3
movdqa %xmm8, %xmm5
psubq %xmm8, %xmm6
pcmpeqd %xmm12, %xmm5
pand %xmm6, %xmm5
movdqa %xmm8, %xmm6
pcmpgtd %xmm12, %xmm6
por %xmm6, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm6
pand %xmm5, %xmm10
pandn %xmm8, %xmm6
pand %xmm5, %xmm8
por %xmm6, %xmm10
movdqa %xmm5, %xmm6
movdqa %xmm1, %xmm5
pandn %xmm12, %xmm6
pcmpeqd %xmm2, %xmm5
por %xmm6, %xmm8
movdqa %xmm2, %xmm6
psubq %xmm1, %xmm6
pand %xmm6, %xmm5
movdqa %xmm1, %xmm6
pcmpgtd %xmm2, %xmm6
por %xmm6, %xmm5
movdqa %xmm2, %xmm6
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm12
pand %xmm5, %xmm6
pandn %xmm1, %xmm12
pand %xmm5, %xmm1
por %xmm12, %xmm6
movdqa %xmm5, %xmm12
movdqa %xmm11, %xmm5
pandn %xmm2, %xmm12
movdqa %xmm4, %xmm2
psubq %xmm4, %xmm5
pcmpeqd %xmm11, %xmm2
por %xmm12, %xmm1
movdqa %xmm11, %xmm12
pand %xmm5, %xmm2
movdqa %xmm4, %xmm5
pcmpgtd %xmm11, %xmm5
por %xmm5, %xmm2
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm5
pand %xmm2, %xmm12
pandn %xmm4, %xmm5
pand %xmm2, %xmm4
por %xmm12, %xmm5
movdqa %xmm2, %xmm12
movdqa %xmm0, %xmm2
pandn %xmm11, %xmm12
pcmpeqd %xmm9, %xmm2
movdqa %xmm9, %xmm11
por %xmm12, %xmm4
movaps %xmm4, -64(%rbp)
movdqa %xmm9, %xmm4
psubq %xmm0, %xmm4
pand %xmm4, %xmm2
movdqa %xmm0, %xmm4
pcmpgtd %xmm9, %xmm4
por %xmm4, %xmm2
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm4
pand %xmm2, %xmm11
pandn %xmm0, %xmm4
pand %xmm2, %xmm0
por %xmm4, %xmm11
movdqa %xmm2, %xmm4
movdqa %xmm3, %xmm2
pandn %xmm9, %xmm4
pcmpeqd %xmm10, %xmm2
movdqa %xmm10, %xmm9
movaps %xmm11, -80(%rbp)
por %xmm4, %xmm0
movdqa %xmm10, %xmm4
psubq %xmm3, %xmm4
pand %xmm4, %xmm2
movdqa %xmm3, %xmm4
pcmpgtd %xmm10, %xmm4
por %xmm4, %xmm2
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm4
pand %xmm2, %xmm9
pandn %xmm3, %xmm4
pand %xmm2, %xmm3
por %xmm4, %xmm9
movdqa %xmm2, %xmm4
movdqa %xmm8, %xmm2
pandn %xmm10, %xmm4
psubq %xmm6, %xmm2
por %xmm4, %xmm3
movdqa %xmm6, %xmm4
pcmpeqd %xmm8, %xmm4
pand %xmm2, %xmm4
movdqa %xmm6, %xmm2
pcmpgtd %xmm8, %xmm2
por %xmm2, %xmm4
movdqa %xmm8, %xmm2
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm10
pand %xmm4, %xmm2
pandn %xmm6, %xmm10
pand %xmm4, %xmm6
por %xmm10, %xmm2
movdqa %xmm4, %xmm10
movdqa %xmm7, %xmm4
pandn %xmm8, %xmm10
movdqa %xmm1, %xmm8
psubq %xmm1, %xmm4
pcmpeqd %xmm7, %xmm8
por %xmm10, %xmm6
pand %xmm4, %xmm8
movdqa %xmm1, %xmm4
pcmpgtd %xmm7, %xmm4
por %xmm4, %xmm8
movdqa %xmm7, %xmm4
pshufd $245, %xmm8, %xmm8
movdqa %xmm8, %xmm10
pand %xmm8, %xmm4
pandn %xmm1, %xmm10
pand %xmm8, %xmm1
por %xmm10, %xmm4
movdqa %xmm8, %xmm10
movdqa %xmm0, %xmm8
pandn %xmm7, %xmm10
movdqa %xmm9, %xmm7
psubq %xmm9, %xmm8
pcmpeqd %xmm0, %xmm7
por %xmm10, %xmm1
movdqa %xmm0, %xmm10
pand %xmm8, %xmm7
movdqa %xmm9, %xmm8
pcmpgtd %xmm0, %xmm8
por %xmm8, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm8
pand %xmm7, %xmm10
pandn %xmm9, %xmm8
pand %xmm7, %xmm9
por %xmm8, %xmm10
movdqa %xmm7, %xmm8
movdqa %xmm2, %xmm7
pcmpeqd %xmm3, %xmm7
pandn %xmm0, %xmm8
movdqa %xmm3, %xmm0
movaps %xmm10, -96(%rbp)
psubq %xmm2, %xmm0
movdqa %xmm9, %xmm14
por %xmm8, %xmm14
pand %xmm0, %xmm7
movdqa %xmm2, %xmm0
pcmpgtd %xmm3, %xmm0
por %xmm0, %xmm7
movdqa %xmm3, %xmm0
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm8
pand %xmm7, %xmm0
pandn %xmm2, %xmm8
pand %xmm7, %xmm2
por %xmm8, %xmm0
movdqa %xmm7, %xmm8
pandn %xmm3, %xmm8
por %xmm8, %xmm2
jbe .L77
movdqa -112(%rbp), %xmm7
pshufd $78, %xmm4, %xmm4
pshufd $78, %xmm6, %xmm6
pshufd $78, -160(%rbp), %xmm10
pshufd $78, %xmm1, %xmm11
pshufd $78, %xmm13, %xmm8
movdqa -128(%rbp), %xmm9
pshufd $78, -176(%rbp), %xmm15
movdqa %xmm7, %xmm3
movdqa %xmm7, %xmm1
movdqa %xmm7, %xmm13
movaps %xmm11, -176(%rbp)
pcmpeqd %xmm10, %xmm3
psubq %xmm10, %xmm1
movdqa %xmm9, %xmm12
pshufd $78, %xmm2, %xmm2
pshufd $78, %xmm0, %xmm0
pand %xmm1, %xmm3
movdqa %xmm10, %xmm1
pcmpgtd %xmm7, %xmm1
por %xmm1, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm1
pand %xmm3, %xmm13
movaps %xmm3, -208(%rbp)
pandn %xmm10, %xmm1
por %xmm1, %xmm13
movdqa %xmm3, %xmm1
movdqa -144(%rbp), %xmm3
pandn %xmm7, %xmm1
movdqa %xmm9, %xmm7
pcmpeqd %xmm15, %xmm7
movaps %xmm1, -256(%rbp)
movdqa %xmm9, %xmm1
psubq %xmm15, %xmm1
pand %xmm1, %xmm7
movdqa %xmm15, %xmm1
pcmpgtd %xmm9, %xmm1
por %xmm1, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm1
pand %xmm7, %xmm12
pandn %xmm15, %xmm1
por %xmm1, %xmm12
movdqa %xmm7, %xmm1
pand %xmm15, %xmm7
pandn %xmm9, %xmm1
movdqa %xmm8, %xmm9
movaps %xmm1, -272(%rbp)
movdqa %xmm3, %xmm1
psubq %xmm8, %xmm1
pcmpeqd %xmm3, %xmm8
movaps %xmm9, -192(%rbp)
pand %xmm1, %xmm8
movdqa %xmm9, %xmm1
movdqa %xmm3, %xmm9
pcmpgtd %xmm3, %xmm1
por %xmm1, %xmm8
pshufd $245, %xmm8, %xmm8
movdqa %xmm8, %xmm1
pandn -192(%rbp), %xmm1
pand %xmm8, %xmm9
por %xmm1, %xmm9
movdqa %xmm5, %xmm1
movaps %xmm9, -128(%rbp)
movdqa %xmm8, %xmm9
psubq %xmm11, %xmm1
pand -192(%rbp), %xmm8
pandn %xmm3, %xmm9
movaps %xmm9, -288(%rbp)
movdqa %xmm1, %xmm9
movdqa %xmm11, %xmm1
por -288(%rbp), %xmm8
pcmpeqd %xmm5, %xmm1
pshufd $78, %xmm8, %xmm8
pand %xmm9, %xmm1
movdqa %xmm11, %xmm9
movdqa %xmm5, %xmm11
pcmpgtd %xmm5, %xmm9
por %xmm9, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm9
pand %xmm1, %xmm11
pandn -176(%rbp), %xmm9
por %xmm9, %xmm11
movaps %xmm11, -144(%rbp)
movdqa %xmm1, %xmm11
pand -176(%rbp), %xmm1
pandn %xmm5, %xmm11
movaps %xmm11, -304(%rbp)
movdqa -64(%rbp), %xmm11
por -304(%rbp), %xmm1
movdqa %xmm11, %xmm5
movdqa %xmm11, %xmm9
pshufd $78, %xmm1, %xmm1
pcmpeqd %xmm4, %xmm5
psubq %xmm4, %xmm9
pand %xmm9, %xmm5
movdqa %xmm4, %xmm9
pcmpgtd %xmm11, %xmm9
por %xmm9, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm9
pandn %xmm4, %xmm9
pand %xmm5, %xmm4
movaps %xmm9, -320(%rbp)
movdqa %xmm5, %xmm9
pand -64(%rbp), %xmm5
por -320(%rbp), %xmm5
pandn %xmm11, %xmm9
movdqa -80(%rbp), %xmm11
por %xmm9, %xmm4
pshufd $78, %xmm5, %xmm5
movaps %xmm4, -112(%rbp)
movdqa %xmm11, %xmm4
movdqa %xmm11, %xmm9
pcmpeqd %xmm6, %xmm4
psubq %xmm6, %xmm9
pand %xmm9, %xmm4
movdqa %xmm6, %xmm9
pcmpgtd %xmm11, %xmm9
por %xmm9, %xmm4
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm3
movdqa %xmm4, %xmm9
pandn %xmm11, %xmm3
movdqa -96(%rbp), %xmm11
pandn %xmm6, %xmm9
pand %xmm4, %xmm6
por %xmm3, %xmm6
movaps %xmm9, -336(%rbp)
pand -80(%rbp), %xmm4
por -336(%rbp), %xmm4
movdqa %xmm11, %xmm3
movaps %xmm6, -160(%rbp)
movdqa %xmm11, %xmm6
pcmpeqd %xmm2, %xmm3
psubq %xmm2, %xmm6
pshufd $78, %xmm4, %xmm4
movdqa %xmm3, %xmm9
pand %xmm6, %xmm9
movdqa %xmm2, %xmm6
pcmpgtd %xmm11, %xmm6
por %xmm6, %xmm9
pshufd $245, %xmm9, %xmm9
movdqa %xmm9, %xmm3
pandn %xmm2, %xmm3
pand %xmm9, %xmm2
movaps %xmm3, -352(%rbp)
movdqa %xmm9, %xmm3
pand -96(%rbp), %xmm9
por -272(%rbp), %xmm7
por -352(%rbp), %xmm9
pandn %xmm11, %xmm3
por %xmm3, %xmm2
movdqa %xmm14, %xmm3
pshufd $78, %xmm7, %xmm15
psubq %xmm0, %xmm3
pshufd $78, %xmm9, %xmm9
movdqa %xmm3, %xmm11
movdqa %xmm0, %xmm3
movaps %xmm9, -80(%rbp)
pcmpeqd %xmm14, %xmm3
movdqa %xmm3, %xmm6
movdqa %xmm0, %xmm3
pcmpgtd %xmm14, %xmm3
pand %xmm11, %xmm6
por %xmm3, %xmm6
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm3
pandn %xmm0, %xmm3
pand %xmm6, %xmm0
movdqa %xmm3, %xmm11
movdqa %xmm6, %xmm3
pand %xmm14, %xmm6
pandn %xmm14, %xmm3
por %xmm11, %xmm6
por %xmm3, %xmm0
pshufd $78, %xmm6, %xmm6
movdqa -208(%rbp), %xmm3
movdqa %xmm6, %xmm7
movdqa %xmm0, %xmm9
pcmpeqd %xmm13, %xmm7
pand %xmm10, %xmm3
movdqa %xmm13, %xmm10
por -256(%rbp), %xmm3
pshufd $78, %xmm3, %xmm14
movdqa %xmm13, %xmm3
movdqa %xmm7, %xmm11
psubq %xmm6, %xmm3
movdqa %xmm14, %xmm7
pand %xmm3, %xmm11
pcmpeqd %xmm0, %xmm7
movdqa %xmm6, %xmm3
pcmpgtd %xmm13, %xmm3
por %xmm3, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm3
pand %xmm11, %xmm10
pandn %xmm6, %xmm3
por %xmm3, %xmm10
movdqa %xmm11, %xmm3
pand %xmm6, %xmm11
pandn %xmm13, %xmm3
movdqa -80(%rbp), %xmm13
movaps %xmm3, -96(%rbp)
movdqa %xmm0, %xmm3
psubq %xmm14, %xmm3
pand %xmm3, %xmm7
movdqa %xmm14, %xmm3
pcmpgtd %xmm0, %xmm3
por %xmm3, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm3
pand %xmm7, %xmm9
movaps %xmm7, -256(%rbp)
pandn %xmm14, %xmm3
por %xmm3, %xmm9
movdqa %xmm7, %xmm3
movdqa -112(%rbp), %xmm7
pandn %xmm0, %xmm3
movdqa %xmm13, %xmm0
pcmpeqd %xmm12, %xmm0
movaps %xmm3, -272(%rbp)
movdqa %xmm12, %xmm3
psubq %xmm13, %xmm3
pand %xmm3, %xmm0
movdqa %xmm13, %xmm3
movdqa %xmm12, %xmm13
pcmpgtd %xmm12, %xmm3
por %xmm3, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
pandn -80(%rbp), %xmm3
pand %xmm0, %xmm13
por %xmm3, %xmm13
movdqa %xmm0, %xmm3
pand -80(%rbp), %xmm0
pandn %xmm12, %xmm3
movdqa %xmm2, %xmm12
movaps %xmm13, -176(%rbp)
movdqa %xmm2, %xmm13
movaps %xmm3, -288(%rbp)
movdqa %xmm15, %xmm3
psubq %xmm15, %xmm12
por -288(%rbp), %xmm0
pcmpeqd %xmm2, %xmm3
pshufd $78, %xmm0, %xmm0
pand %xmm12, %xmm3
movdqa %xmm15, %xmm12
pcmpgtd %xmm2, %xmm12
por %xmm12, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm12
pand %xmm3, %xmm13
pandn %xmm15, %xmm12
por %xmm12, %xmm13
movdqa %xmm3, %xmm12
pand %xmm15, %xmm3
movaps %xmm13, -192(%rbp)
movdqa -128(%rbp), %xmm13
pandn %xmm2, %xmm12
movaps %xmm12, -304(%rbp)
movdqa %xmm13, %xmm2
psubq %xmm4, %xmm2
movdqa %xmm2, %xmm12
movdqa %xmm13, %xmm2
pcmpeqd %xmm4, %xmm2
pand %xmm12, %xmm2
movdqa %xmm4, %xmm12
pcmpgtd %xmm13, %xmm12
por %xmm12, %xmm2
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm12
pandn %xmm4, %xmm12
pand %xmm2, %xmm4
movaps %xmm12, -320(%rbp)
movdqa %xmm2, %xmm12
pand -128(%rbp), %xmm2
por -320(%rbp), %xmm2
pandn %xmm13, %xmm12
movdqa -160(%rbp), %xmm13
por %xmm12, %xmm4
pshufd $78, %xmm2, %xmm2
movaps %xmm4, -208(%rbp)
movdqa %xmm13, %xmm4
movdqa %xmm13, %xmm12
pcmpeqd %xmm8, %xmm4
psubq %xmm8, %xmm12
pand %xmm12, %xmm4
movdqa %xmm8, %xmm12
pcmpgtd %xmm13, %xmm12
por %xmm12, %xmm4
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm12
pandn %xmm8, %xmm12
pand %xmm4, %xmm8
movaps %xmm12, -336(%rbp)
movdqa %xmm4, %xmm12
pandn %xmm13, %xmm12
movdqa -144(%rbp), %xmm13
por %xmm12, %xmm8
movaps %xmm8, -64(%rbp)
movdqa %xmm13, %xmm8
movdqa %xmm13, %xmm12
pcmpeqd %xmm5, %xmm8
psubq %xmm5, %xmm12
pand %xmm12, %xmm8
movdqa %xmm5, %xmm12
pcmpgtd %xmm13, %xmm12
por %xmm12, %xmm8
pshufd $245, %xmm8, %xmm8
movdqa %xmm8, %xmm12
pandn %xmm5, %xmm12
pand %xmm8, %xmm5
movaps %xmm12, -352(%rbp)
movdqa %xmm8, %xmm12
pand -144(%rbp), %xmm8
por -352(%rbp), %xmm8
pandn %xmm13, %xmm12
movdqa %xmm7, %xmm13
por %xmm12, %xmm5
movdqa %xmm7, %xmm12
psubq %xmm1, %xmm13
pcmpeqd %xmm1, %xmm12
pshufd $78, %xmm8, %xmm8
pand %xmm13, %xmm12
movdqa %xmm1, %xmm13
pcmpgtd -112(%rbp), %xmm13
por %xmm13, %xmm12
pshufd $245, %xmm12, %xmm12
movdqa %xmm12, %xmm13
movdqa %xmm12, %xmm7
pandn -112(%rbp), %xmm7
pandn %xmm1, %xmm13
pand %xmm12, %xmm1
por -96(%rbp), %xmm11
movdqa -176(%rbp), %xmm15
por %xmm7, %xmm1
movdqa -256(%rbp), %xmm7
por -304(%rbp), %xmm3
pshufd $78, %xmm11, %xmm6
pand -160(%rbp), %xmm4
por -336(%rbp), %xmm4
pand %xmm14, %xmm7
movaps %xmm6, -80(%rbp)
movdqa -112(%rbp), %xmm6
por -272(%rbp), %xmm7
movdqa %xmm10, %xmm14
pshufd $78, %xmm4, %xmm4
pshufd $78, %xmm3, %xmm3
pshufd $78, %xmm7, %xmm7
pand %xmm12, %xmm6
movdqa -80(%rbp), %xmm12
movaps %xmm7, -112(%rbp)
movdqa %xmm8, %xmm7
por %xmm13, %xmm6
pcmpeqd %xmm10, %xmm7
pshufd $78, %xmm6, %xmm11
movdqa %xmm10, %xmm6
psubq %xmm8, %xmm6
movaps %xmm11, -96(%rbp)
movdqa %xmm15, %xmm11
pcmpeqd %xmm2, %xmm11
pand %xmm6, %xmm7
movdqa %xmm8, %xmm6
pcmpgtd %xmm10, %xmm6
por %xmm6, %xmm7
pshufd $245, %xmm7, %xmm7
pand %xmm7, %xmm14
movdqa %xmm7, %xmm6
pandn %xmm8, %xmm6
movdqa %xmm14, %xmm13
por %xmm6, %xmm13
movdqa %xmm7, %xmm6
pand %xmm8, %xmm7
pandn %xmm10, %xmm6
movdqa %xmm5, %xmm10
movaps %xmm6, -272(%rbp)
movdqa %xmm15, %xmm6
psubq %xmm12, %xmm10
psubq %xmm2, %xmm6
pand %xmm6, %xmm11
movdqa %xmm2, %xmm6
pcmpgtd %xmm15, %xmm6
por %xmm6, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm14
movdqa %xmm11, %xmm6
pandn %xmm2, %xmm14
pandn %xmm15, %xmm6
pand %xmm11, %xmm2
por %xmm6, %xmm2
movdqa %xmm12, %xmm6
movdqa %xmm9, %xmm15
movaps %xmm14, -288(%rbp)
pcmpeqd %xmm5, %xmm6
movaps %xmm2, -144(%rbp)
movdqa -208(%rbp), %xmm14
pand %xmm10, %xmm6
movdqa %xmm12, %xmm10
movdqa %xmm5, %xmm12
pcmpgtd %xmm5, %xmm10
por %xmm10, %xmm6
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm10
pandn -80(%rbp), %xmm10
pand %xmm6, %xmm12
por %xmm10, %xmm12
movdqa %xmm6, %xmm10
pandn %xmm5, %xmm10
movdqa %xmm14, %xmm5
movaps %xmm10, -304(%rbp)
movdqa %xmm14, %xmm10
psubq %xmm0, %xmm5
pcmpeqd %xmm0, %xmm10
pand %xmm5, %xmm10
movdqa %xmm0, %xmm5
pcmpgtd %xmm14, %xmm5
por %xmm5, %xmm10
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm5
pandn %xmm0, %xmm5
pand %xmm10, %xmm0
movaps %xmm5, -320(%rbp)
movdqa %xmm10, %xmm5
pandn %xmm14, %xmm5
por %xmm5, %xmm0
movdqa -96(%rbp), %xmm5
psubq %xmm5, %xmm15
movdqa %xmm15, %xmm14
movdqa %xmm5, %xmm15
pcmpeqd %xmm9, %xmm5
pand %xmm14, %xmm5
movdqa %xmm15, %xmm14
movdqa %xmm9, %xmm15
pcmpgtd %xmm9, %xmm14
por %xmm14, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm14
pandn -96(%rbp), %xmm14
pand %xmm5, %xmm15
por %xmm14, %xmm15
movaps %xmm15, -160(%rbp)
movdqa %xmm5, %xmm15
pandn %xmm9, %xmm15
movaps %xmm15, -336(%rbp)
movdqa -192(%rbp), %xmm15
movdqa %xmm15, %xmm9
movdqa %xmm15, %xmm14
pcmpeqd %xmm4, %xmm9
psubq %xmm4, %xmm14
pand %xmm14, %xmm9
movdqa %xmm4, %xmm14
pcmpgtd %xmm15, %xmm14
por %xmm14, %xmm9
pshufd $245, %xmm9, %xmm9
movdqa %xmm9, %xmm14
movdqa %xmm9, %xmm2
pandn %xmm4, %xmm14
pandn %xmm15, %xmm2
pand %xmm9, %xmm4
movdqa -112(%rbp), %xmm15
por %xmm2, %xmm4
movaps %xmm14, -352(%rbp)
movdqa %xmm1, %xmm2
movaps %xmm4, -128(%rbp)
movdqa %xmm15, %xmm4
movdqa %xmm15, %xmm14
psubq %xmm15, %xmm2
pcmpeqd %xmm1, %xmm4
pcmpgtd %xmm1, %xmm14
pand %xmm2, %xmm4
por %xmm14, %xmm4
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm2
pandn -112(%rbp), %xmm2
movdqa %xmm2, %xmm14
movdqa %xmm1, %xmm2
pand %xmm4, %xmm2
movdqa %xmm2, %xmm15
movdqa %xmm4, %xmm2
pandn %xmm1, %xmm2
por %xmm14, %xmm15
movaps %xmm2, -368(%rbp)
movdqa -64(%rbp), %xmm2
movdqa %xmm2, %xmm14
movdqa %xmm2, %xmm1
pcmpeqd %xmm3, %xmm14
psubq %xmm3, %xmm1
pand %xmm1, %xmm14
movdqa %xmm3, %xmm1
pcmpgtd -64(%rbp), %xmm1
por %xmm1, %xmm14
pshufd $245, %xmm14, %xmm14
movdqa %xmm14, %xmm1
movdqa %xmm14, %xmm2
pandn %xmm3, %xmm1
pand %xmm14, %xmm3
movaps %xmm1, -384(%rbp)
pandn -64(%rbp), %xmm2
pand -176(%rbp), %xmm11
por -288(%rbp), %xmm11
pand -96(%rbp), %xmm5
por %xmm2, %xmm3
pand -80(%rbp), %xmm6
por -336(%rbp), %xmm5
pshufd $78, %xmm11, %xmm11
movaps %xmm3, -256(%rbp)
movdqa -64(%rbp), %xmm8
por -272(%rbp), %xmm7
movdqa %xmm11, %xmm2
pshufd $78, %xmm5, %xmm1
movdqa -144(%rbp), %xmm5
pand -208(%rbp), %xmm10
pcmpeqd %xmm13, %xmm2
movaps %xmm1, -80(%rbp)
movdqa %xmm13, %xmm1
pand %xmm14, %xmm8
psubq %xmm11, %xmm1
movdqa %xmm13, %xmm14
pshufd $78, %xmm7, %xmm7
por -320(%rbp), %xmm10
pand -112(%rbp), %xmm4
movdqa %xmm2, %xmm3
movdqa %xmm5, %xmm2
por -304(%rbp), %xmm6
pand %xmm1, %xmm3
movdqa %xmm11, %xmm1
psubq %xmm7, %xmm2
pcmpgtd %xmm13, %xmm1
pshufd $78, %xmm10, %xmm10
pshufd $78, %xmm6, %xmm6
pand -192(%rbp), %xmm9
por -368(%rbp), %xmm4
por -352(%rbp), %xmm9
por -384(%rbp), %xmm8
por %xmm1, %xmm3
pshufd $78, %xmm4, %xmm4
pshufd $245, %xmm3, %xmm3
pshufd $78, %xmm9, %xmm9
pshufd $78, %xmm8, %xmm8
movdqa %xmm3, %xmm1
pand %xmm3, %xmm14
pandn %xmm11, %xmm1
por %xmm1, %xmm14
movdqa %xmm3, %xmm1
pand %xmm11, %xmm3
pandn %xmm13, %xmm1
movdqa %xmm7, %xmm11
por %xmm1, %xmm3
pcmpgtd %xmm5, %xmm11
movdqa %xmm7, %xmm1
pcmpeqd %xmm5, %xmm1
pand %xmm2, %xmm1
movdqa %xmm5, %xmm2
por %xmm11, %xmm1
pshufd $245, %xmm1, %xmm1
pand %xmm1, %xmm2
movdqa %xmm1, %xmm13
pandn %xmm7, %xmm13
movdqa %xmm2, %xmm11
movdqa %xmm12, %xmm2
por %xmm13, %xmm11
movdqa %xmm1, %xmm13
pand %xmm7, %xmm1
pandn %xmm5, %xmm13
psubq %xmm10, %xmm2
movdqa -160(%rbp), %xmm5
por %xmm13, %xmm1
movdqa %xmm10, %xmm13
pcmpeqd %xmm12, %xmm13
movdqa %xmm13, %xmm7
movdqa %xmm12, %xmm13
pand %xmm2, %xmm7
movdqa %xmm10, %xmm2
pcmpgtd %xmm12, %xmm2
por %xmm2, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm2
pand %xmm7, %xmm13
pandn %xmm10, %xmm2
por %xmm13, %xmm2
movdqa %xmm7, %xmm13
pand %xmm10, %xmm7
pandn %xmm12, %xmm13
movdqa %xmm6, %xmm12
movdqa %xmm0, %xmm10
pcmpeqd %xmm0, %xmm12
por %xmm7, %xmm13
psubq %xmm6, %xmm10
movdqa %xmm12, %xmm7
movdqa %xmm0, %xmm12
pand %xmm10, %xmm7
movdqa %xmm6, %xmm10
pcmpgtd %xmm0, %xmm10
por %xmm10, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm10
pand %xmm7, %xmm12
pandn %xmm6, %xmm10
por %xmm10, %xmm12
movdqa %xmm7, %xmm10
pand %xmm6, %xmm7
pandn %xmm0, %xmm10
movdqa %xmm5, %xmm0
movdqa %xmm5, %xmm6
pcmpeqd %xmm9, %xmm0
psubq %xmm9, %xmm6
por %xmm7, %xmm10
movdqa %xmm5, %xmm7
pand %xmm6, %xmm0
movdqa %xmm9, %xmm6
pcmpgtd %xmm5, %xmm6
por %xmm6, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm6
pand %xmm0, %xmm7
pandn %xmm9, %xmm6
por %xmm6, %xmm7
movdqa %xmm0, %xmm6
pand %xmm9, %xmm0
movaps %xmm7, -160(%rbp)
movdqa -128(%rbp), %xmm7
pandn %xmm5, %xmm6
movdqa -80(%rbp), %xmm5
movdqa %xmm0, %xmm9
movdqa %xmm7, %xmm0
por %xmm6, %xmm9
movdqa %xmm7, %xmm6
pcmpeqd %xmm5, %xmm0
psubq %xmm5, %xmm6
pand %xmm6, %xmm0
movdqa %xmm5, %xmm6
pcmpgtd %xmm7, %xmm6
por %xmm6, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm6
pandn -80(%rbp), %xmm6
pand %xmm0, %xmm7
movdqa %xmm0, %xmm5
pand -80(%rbp), %xmm0
pandn -128(%rbp), %xmm5
por %xmm6, %xmm7
movdqa %xmm8, %xmm6
pcmpeqd %xmm15, %xmm6
por %xmm5, %xmm0
movdqa %xmm15, %xmm5
psubq %xmm8, %xmm5
movaps %xmm0, -176(%rbp)
movdqa %xmm6, %xmm0
movdqa %xmm15, %xmm6
pand %xmm5, %xmm0
movdqa %xmm8, %xmm5
pcmpgtd %xmm15, %xmm5
por %xmm5, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm5
pand %xmm0, %xmm6
pandn %xmm8, %xmm5
por %xmm5, %xmm6
movdqa %xmm0, %xmm5
pand %xmm8, %xmm0
pandn %xmm15, %xmm5
movdqa %xmm0, %xmm8
movdqa -256(%rbp), %xmm15
movaps %xmm6, -192(%rbp)
por %xmm5, %xmm8
movdqa %xmm15, %xmm0
movdqa %xmm15, %xmm5
movdqa %xmm15, %xmm6
pcmpeqd %xmm4, %xmm0
psubq %xmm4, %xmm5
pand %xmm5, %xmm0
movdqa %xmm4, %xmm5
pcmpgtd %xmm15, %xmm5
por %xmm5, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm5
pand %xmm0, %xmm6
pandn %xmm4, %xmm5
por %xmm5, %xmm6
movdqa %xmm0, %xmm5
pand %xmm4, %xmm0
pandn %xmm15, %xmm5
pshufd $78, %xmm14, %xmm4
movdqa %xmm0, %xmm15
movaps %xmm6, -208(%rbp)
movdqa %xmm14, %xmm0
por %xmm5, %xmm15
movdqa %xmm14, %xmm5
pcmpeqd %xmm4, %xmm0
psubq %xmm4, %xmm5
pand %xmm5, %xmm0
movdqa %xmm4, %xmm5
pcmpgtd %xmm14, %xmm5
por %xmm5, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm5, %xmm6
movdqa %xmm0, %xmm5
pandn %xmm14, %xmm5
pand %xmm0, %xmm14
pand %xmm4, %xmm0
por %xmm5, %xmm0
pshufd $78, %xmm3, %xmm4
por %xmm6, %xmm14
movapd %xmm0, %xmm5
movdqa %xmm3, %xmm0
movsd %xmm14, %xmm5
pcmpeqd %xmm4, %xmm0
movaps %xmm5, -112(%rbp)
movdqa %xmm3, %xmm5
psubq %xmm4, %xmm5
pand %xmm5, %xmm0
movdqa %xmm4, %xmm5
pcmpgtd %xmm3, %xmm5
por %xmm5, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm5, %xmm6
movdqa %xmm0, %xmm5
pandn %xmm3, %xmm5
pand %xmm0, %xmm3
pand %xmm4, %xmm0
por %xmm5, %xmm0
por %xmm6, %xmm3
movapd %xmm0, %xmm5
movsd %xmm3, %xmm5
pshufd $78, %xmm11, %xmm3
movaps %xmm5, -128(%rbp)
movdqa %xmm11, %xmm5
psubq %xmm3, %xmm5
movdqa %xmm5, %xmm4
movdqa %xmm11, %xmm5
pcmpeqd %xmm3, %xmm5
movdqa %xmm5, %xmm0
movdqa %xmm3, %xmm5
pcmpgtd %xmm11, %xmm5
pand %xmm4, %xmm0
por %xmm5, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm14
movdqa %xmm0, %xmm5
pandn %xmm11, %xmm14
pand %xmm0, %xmm11
pand %xmm3, %xmm0
pandn %xmm3, %xmm5
por %xmm14, %xmm0
pshufd $78, %xmm1, %xmm3
por %xmm5, %xmm11
movapd %xmm0, %xmm5
movsd %xmm11, %xmm5
movaps %xmm5, -144(%rbp)
movdqa %xmm1, %xmm5
psubq %xmm3, %xmm5
movdqa %xmm5, %xmm4
movdqa %xmm1, %xmm5
pcmpeqd %xmm3, %xmm5
movdqa %xmm5, %xmm0
movdqa %xmm3, %xmm5
pcmpgtd %xmm1, %xmm5
pand %xmm4, %xmm0
por %xmm5, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm14
movdqa %xmm0, %xmm5
pandn %xmm1, %xmm14
pand %xmm0, %xmm1
pand %xmm3, %xmm0
pandn %xmm3, %xmm5
por %xmm14, %xmm0
movdqa %xmm2, %xmm3
por %xmm5, %xmm1
movapd %xmm0, %xmm5
movdqa %xmm2, %xmm0
movsd %xmm1, %xmm5
pshufd $78, %xmm2, %xmm1
pcmpeqd %xmm1, %xmm0
psubq %xmm1, %xmm3
pand %xmm3, %xmm0
movdqa %xmm1, %xmm3
pcmpgtd %xmm2, %xmm3
por %xmm3, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
pandn %xmm1, %xmm3
movdqa %xmm3, %xmm4
movdqa %xmm0, %xmm3
pandn %xmm2, %xmm3
pand %xmm0, %xmm2
pand %xmm1, %xmm0
por %xmm3, %xmm0
por %xmm4, %xmm2
movdqa %xmm13, %xmm3
movdqa -160(%rbp), %xmm4
movapd %xmm0, %xmm1
movsd %xmm2, %xmm1
movdqa %xmm13, %xmm2
movaps %xmm1, -64(%rbp)
pshufd $78, %xmm13, %xmm1
pcmpeqd %xmm1, %xmm3
psubq %xmm1, %xmm2
movdqa %xmm3, %xmm0
pand %xmm2, %xmm0
movdqa %xmm1, %xmm2
pcmpgtd %xmm13, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm13, %xmm2
pand %xmm0, %xmm13
pand %xmm1, %xmm0
por %xmm3, %xmm13
pshufd $78, %xmm12, %xmm1
por %xmm2, %xmm0
movdqa %xmm12, %xmm3
pcmpeqd %xmm1, %xmm3
movapd %xmm0, %xmm2
movsd %xmm13, %xmm2
movdqa -176(%rbp), %xmm13
movaps %xmm2, -80(%rbp)
movdqa %xmm12, %xmm2
psubq %xmm1, %xmm2
movdqa %xmm3, %xmm0
pand %xmm2, %xmm0
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm3
pandn %xmm12, %xmm2
pand %xmm0, %xmm12
pand %xmm1, %xmm0
por %xmm3, %xmm12
pshufd $78, %xmm10, %xmm1
por %xmm2, %xmm0
movdqa %xmm10, %xmm3
pcmpeqd %xmm1, %xmm3
movapd %xmm0, %xmm2
movsd %xmm12, %xmm2
movaps %xmm2, -96(%rbp)
movdqa %xmm10, %xmm2
psubq %xmm1, %xmm2
movdqa %xmm3, %xmm0
pand %xmm2, %xmm0
movdqa %xmm1, %xmm2
pcmpgtd %xmm10, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm10, %xmm2
pand %xmm0, %xmm10
pand %xmm1, %xmm0
pandn %xmm1, %xmm3
por %xmm2, %xmm0
pshufd $78, %xmm4, %xmm1
por %xmm3, %xmm10
movapd %xmm0, %xmm2
movdqa %xmm4, %xmm0
movsd %xmm10, %xmm2
pcmpeqd %xmm1, %xmm0
movapd %xmm2, %xmm14
movdqa %xmm4, %xmm2
psubq %xmm1, %xmm2
pand %xmm2, %xmm0
movdqa %xmm1, %xmm2
pcmpgtd %xmm4, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm2
movdqa %xmm0, %xmm3
pandn %xmm4, %xmm2
pand %xmm0, %xmm4
pand %xmm1, %xmm0
pandn %xmm1, %xmm3
por %xmm2, %xmm0
pshufd $78, %xmm9, %xmm1
movdqa %xmm9, %xmm2
por %xmm3, %xmm4
movdqa %xmm9, %xmm3
pcmpeqd %xmm1, %xmm2
psubq %xmm1, %xmm3
movsd %xmm4, %xmm0
pand %xmm3, %xmm2
movdqa %xmm1, %xmm3
pcmpgtd %xmm9, %xmm3
por %xmm3, %xmm2
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm4
movdqa %xmm2, %xmm3
pandn %xmm1, %xmm4
pandn %xmm9, %xmm3
pand %xmm2, %xmm9
por %xmm4, %xmm9
pand %xmm1, %xmm2
movdqa %xmm7, %xmm4
pshufd $78, %xmm7, %xmm1
por %xmm3, %xmm2
movdqa %xmm7, %xmm3
pcmpeqd %xmm1, %xmm4
psubq %xmm1, %xmm3
movsd %xmm9, %xmm2
movdqa %xmm4, %xmm6
pand %xmm3, %xmm6
movdqa %xmm1, %xmm3
pcmpgtd %xmm7, %xmm3
por %xmm3, %xmm6
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm4
movdqa %xmm6, %xmm3
pandn %xmm1, %xmm4
pandn %xmm7, %xmm3
pand %xmm6, %xmm7
por %xmm4, %xmm7
pand %xmm1, %xmm6
movdqa %xmm13, %xmm4
pshufd $78, %xmm13, %xmm1
por %xmm3, %xmm6
movdqa %xmm13, %xmm3
pcmpeqd %xmm1, %xmm4
psubq %xmm1, %xmm3
movsd %xmm7, %xmm6
pand %xmm3, %xmm4
movdqa %xmm1, %xmm3
pcmpgtd %xmm13, %xmm3
por %xmm3, %xmm4
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm3
movdqa %xmm4, %xmm7
pandn %xmm13, %xmm3
pand %xmm4, %xmm13
pand %xmm1, %xmm4
movdqa %xmm13, %xmm9
pandn %xmm1, %xmm7
por %xmm3, %xmm4
movdqa -192(%rbp), %xmm13
por %xmm7, %xmm9
pshufd $78, %xmm13, %xmm3
movdqa %xmm13, %xmm1
movdqa %xmm13, %xmm7
pcmpeqd %xmm3, %xmm1
psubq %xmm3, %xmm7
movsd %xmm9, %xmm4
pand %xmm7, %xmm1
movdqa %xmm3, %xmm7
pcmpgtd %xmm13, %xmm7
por %xmm7, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm7
movdqa %xmm1, %xmm9
pandn %xmm13, %xmm7
pand %xmm1, %xmm13
pand %xmm3, %xmm1
pandn %xmm3, %xmm9
por %xmm7, %xmm1
movdqa %xmm8, %xmm3
pshufd $78, %xmm8, %xmm7
movdqa %xmm13, %xmm10
movdqa -208(%rbp), %xmm13
pcmpeqd %xmm7, %xmm3
por %xmm9, %xmm10
movdqa %xmm8, %xmm9
psubq %xmm7, %xmm9
movsd %xmm10, %xmm1
pand %xmm9, %xmm3
movdqa %xmm7, %xmm9
pcmpgtd %xmm8, %xmm9
por %xmm9, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm10
movdqa %xmm3, %xmm9
pandn %xmm7, %xmm10
pandn %xmm8, %xmm9
pand %xmm3, %xmm8
pand %xmm7, %xmm3
por %xmm10, %xmm8
pshufd $78, %xmm13, %xmm7
por %xmm9, %xmm3
movdqa %xmm13, %xmm9
shufpd $2, %xmm3, %xmm8
movdqa %xmm13, %xmm3
psubq %xmm7, %xmm9
pcmpeqd %xmm7, %xmm3
pand %xmm9, %xmm3
movdqa %xmm7, %xmm9
pcmpgtd %xmm13, %xmm9
por %xmm9, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm9
movdqa %xmm3, %xmm10
pandn %xmm13, %xmm9
pand %xmm3, %xmm13
pand %xmm7, %xmm3
por %xmm9, %xmm3
pandn %xmm7, %xmm10
pshufd $78, %xmm15, %xmm9
movapd %xmm3, %xmm7
movdqa %xmm15, %xmm3
movdqa %xmm13, %xmm11
pcmpeqd %xmm9, %xmm3
por %xmm10, %xmm11
movdqa %xmm15, %xmm10
psubq %xmm9, %xmm10
movsd %xmm11, %xmm7
pand %xmm10, %xmm3
movdqa %xmm9, %xmm10
pcmpgtd %xmm15, %xmm10
por %xmm10, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm11
movdqa %xmm3, %xmm10
pandn %xmm15, %xmm10
pandn %xmm9, %xmm11
pand %xmm3, %xmm15
pand %xmm9, %xmm3
por %xmm11, %xmm15
por %xmm10, %xmm3
movsd %xmm15, %xmm3
.L75:
movdqa -112(%rbp), %xmm15
movq -232(%rbp), %rdx
movups %xmm15, (%rdx)
movdqa -128(%rbp), %xmm15
movups %xmm15, (%r15)
movdqa -144(%rbp), %xmm15
movups %xmm15, (%r14)
movups %xmm5, 0(%r13)
movdqa -64(%rbp), %xmm5
movups %xmm5, (%r12)
movdqa -80(%rbp), %xmm5
movups %xmm5, (%rbx)
movdqa -96(%rbp), %xmm5
movq -224(%rbp), %rbx
movups %xmm5, (%r11)
movups %xmm14, (%r10)
movups %xmm0, (%r9)
movups %xmm2, (%r8)
movups %xmm6, (%rdi)
movups %xmm4, (%rsi)
movups %xmm1, (%rcx)
movq -216(%rbp), %rcx
movups %xmm8, (%rcx)
movups %xmm7, (%rbx)
movups %xmm3, (%rax)
addq $224, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L77:
.cfi_restore_state
movdqa -160(%rbp), %xmm3
movdqa -176(%rbp), %xmm7
movdqa %xmm13, %xmm8
jmp .L75
.cfi_endproc
.LFE18782:
.size _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, .-_ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
.section .text._ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18783:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %r10
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %rbx
.cfi_offset 3, -24
cmpq $7, %rsi
jbe .L94
movl $8, %r8d
xorl %esi, %esi
jmp .L85
.p2align 4,,10
.p2align 3
.L80:
vmovdqu64 %zmm0, (%rax)
kmovb %k0, %eax
popcntq %rax, %rax
addq %rax, %rsi
leaq 8(%r8), %rax
cmpq %r10, %rax
ja .L105
movq %rax, %r8
.L85:
vmovdqu64 -64(%rdi,%r8,8), %zmm3
leaq -8(%r8), %r9
leaq (%rdi,%rsi,8), %rax
vpcmpq $0, %zmm0, %zmm3, %k0
vpcmpq $0, %zmm1, %zmm3, %k1
kmovb %k0, %r11d
kmovb %k1, %ebx
korb %k1, %k0, %k1
kortestb %k1, %k1
jc .L80
kmovb %r11d, %k6
kmovb %ebx, %k5
kxnorb %k5, %k6, %k7
kmovb %k7, %eax
tzcntl %eax, %eax
addq %r9, %rax
vpbroadcastq (%rdi,%rax,8), %zmm0
leaq 8(%rsi), %rax
vmovdqa64 %zmm0, (%rdx)
cmpq %r9, %rax
ja .L81
.p2align 4,,10
.p2align 3
.L82:
vmovdqu64 %zmm1, -64(%rdi,%rax,8)
movq %rax, %rsi
addq $8, %rax
cmpq %rax, %r9
jnb .L82
.L81:
subq %rsi, %r9
leaq (%rdi,%rsi,8), %rdx
movl $255, %eax
cmpq $255, %r9
jbe .L106
.L83:
kmovb %eax, %k4
xorl %eax, %eax
vmovdqu64 %zmm1, (%rdx){%k4}
.L78:
movq -8(%rbp), %rbx
leave
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L106:
.cfi_restore_state
movq $-1, %rax
bzhi %r9, %rax, %rax
movzbl %al, %eax
jmp .L83
.p2align 4,,10
.p2align 3
.L105:
movq %r10, %r11
leaq (%rdi,%r8,8), %rbx
leaq (%rdi,%rsi,8), %r9
movl $255, %eax
subq %r8, %r11
kmovd %eax, %k1
cmpq $255, %r11
jbe .L79
.L86:
vmovdqu64 (%rbx), %zmm2{%k1}{z}
knotb %k1, %k3
vmovdqu64 %zmm2, (%rcx){%k1}
vmovdqa64 (%rcx), %zmm2
vpcmpq $0, %zmm0, %zmm2, %k0
vpcmpq $0, %zmm1, %zmm2, %k2
kandb %k1, %k0, %k0
korb %k2, %k0, %k2
korb %k3, %k2, %k2
kortestb %k2, %k2
jnc .L107
kmovb %k0, %edx
popcntq %rdx, %rdx
addq %rsi, %rdx
vmovdqu64 %zmm0, (%r9){%k1}
leaq 8(%rdx), %rax
cmpq %r10, %rax
ja .L91
.p2align 4,,10
.p2align 3
.L92:
vmovdqu64 %zmm1, -64(%rdi,%rax,8)
movq %rax, %rdx
addq $8, %rax
cmpq %rax, %r10
jnb .L92
.L91:
subq %rdx, %r10
leaq (%rdi,%rdx,8), %rcx
movl $255, %eax
cmpq $255, %r10
ja .L93
movq $-1, %rax
bzhi %r10, %rax, %rax
movzbl %al, %eax
.L93:
kmovb %eax, %k5
movl $1, %eax
vmovdqu64 %zmm1, (%rcx){%k5}
movq -8(%rbp), %rbx
leave
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.L94:
.cfi_restore_state
movq %rsi, %r11
movq %rdi, %r9
movq %rdi, %rbx
xorl %r8d, %r8d
xorl %esi, %esi
.L79:
movq $-1, %rax
bzhi %r11, %rax, %rax
movzbl %al, %eax
kmovd %eax, %k1
jmp .L86
.L107:
knotb %k2, %k3
kmovb %k3, %eax
tzcntl %eax, %eax
addq %r8, %rax
vpbroadcastq (%rdi,%rax,8), %zmm0
leaq 8(%rsi), %rax
vmovdqa64 %zmm0, (%rdx)
cmpq %r8, %rax
ja .L88
.p2align 4,,10
.p2align 3
.L89:
vmovdqu64 %zmm1, -64(%rdi,%rax,8)
movq %rax, %rsi
leaq 8(%rax), %rax
cmpq %rax, %r8
jnb .L89
leaq (%rdi,%rsi,8), %r9
.L88:
subq %rsi, %r8
movl $255, %eax
cmpq $255, %r8
ja .L90
movq $-1, %rax
bzhi %r8, %rax, %rax
movzbl %al, %eax
.L90:
kmovb %eax, %k6
xorl %eax, %eax
vmovdqu64 %zmm1, (%r9){%k6}
jmp .L78
.cfi_endproc
.LFE18783:
.size _ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, @function
_ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0:
.LFB18784:
.cfi_startproc
movq %rsi, %r8
movq %rdx, %rcx
cmpq %rdx, %rsi
jbe .L118
leaq (%rdx,%rdx), %rdx
leaq 1(%rcx), %r9
leaq 1(%rdx), %rsi
addq $2, %rdx
cmpq %rsi, %r8
jbe .L118
movq (%rdi,%rcx,8), %r11
vpbroadcastq %r11, %xmm1
jmp .L111
.p2align 4,,10
.p2align 3
.L121:
movq %rsi, %rax
cmpq %rdx, %r8
ja .L119
.L113:
cmpq %rcx, %rax
je .L118
leaq (%rdi,%rax,8), %rdx
movq (%rdx), %rcx
movq %rcx, (%r10)
movq %r11, (%rdx)
cmpq %rax, %r8
jbe .L120
leaq (%rax,%rax), %rdx
leaq 1(%rax), %r9
leaq 1(%rdx), %rsi
addq $2, %rdx
cmpq %r8, %rsi
jnb .L118
movq %rax, %rcx
.L111:
vpbroadcastq (%rdi,%rsi,8), %xmm0
leaq (%rdi,%rcx,8), %r10
vpcmpq $6, %xmm1, %xmm0, %k0
kmovb %k0, %eax
testb $1, %al
jne .L121
cmpq %rdx, %r8
jbe .L118
salq $4, %r9
vpbroadcastq (%rdi,%r9), %xmm0
vpcmpq $6, %xmm1, %xmm0, %k1
kmovb %k1, %eax
testb $1, %al
je .L118
movq %rdx, %rax
jmp .L113
.p2align 4,,10
.p2align 3
.L118:
ret
.p2align 4,,10
.p2align 3
.L119:
salq $4, %r9
vpbroadcastq (%rdi,%r9), %xmm2
vpcmpq $6, %xmm0, %xmm2, %k2
kmovb %k2, %esi
andl $1, %esi
cmovne %rdx, %rax
jmp .L113
.p2align 4,,10
.p2align 3
.L120:
ret
.cfi_endproc
.LFE18784:
.size _ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, .-_ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
.section .text._ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, @function
_ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0:
.LFB18785:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq 0(,%rsi,8), %r15
leaq (%rdi,%r15), %rdx
pushq %r14
.cfi_offset 14, -32
leaq (%rdx,%r15), %r14
pushq %r13
vmovq %rdx, %xmm18
.cfi_offset 13, -40
leaq (%r14,%r15), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%r15), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%r15), %rbx
leaq (%rbx,%r15), %r11
leaq (%r11,%r15), %r10
andq $-64, %rsp
leaq (%r10,%r15), %r9
movq %rsi, -8(%rsp)
leaq (%r9,%r15), %r8
vmovdqu64 (%rdi), %zmm4
vmovdqu64 (%r9), %zmm5
leaq (%r8,%r15), %rdx
vpminsq (%r8), %zmm5, %zmm8
vmovdqu64 (%r11), %zmm1
leaq (%rdx,%r15), %rsi
vmovq %rdx, %xmm23
vpmaxsq (%r8), %zmm5, %zmm6
leaq (%rsi,%r15), %rcx
leaq (%rcx,%r15), %rdx
leaq (%rdx,%r15), %rax
addq %rax, %r15
movq %r15, -16(%rsp)
vmovq %xmm18, %r15
vpminsq (%r15), %zmm4, %zmm13
vpmaxsq (%r15), %zmm4, %zmm7
vmovq %xmm23, %r15
vmovdqu64 (%r14), %zmm4
vmovdqu64 (%r15), %zmm5
vpminsq 0(%r13), %zmm4, %zmm14
vpmaxsq 0(%r13), %zmm4, %zmm3
vpminsq (%rsi), %zmm5, %zmm9
vpmaxsq (%rsi), %zmm5, %zmm15
vmovdqu64 (%r12), %zmm4
vmovdqu64 (%rcx), %zmm5
vpminsq %zmm14, %zmm13, %zmm10
vpmaxsq %zmm14, %zmm13, %zmm13
vpminsq (%rbx), %zmm4, %zmm12
vpmaxsq (%rbx), %zmm4, %zmm2
vpminsq (%rdx), %zmm5, %zmm0
vpminsq (%r10), %zmm1, %zmm4
vpmaxsq (%rdx), %zmm5, %zmm16
vpmaxsq (%r10), %zmm1, %zmm1
vmovdqu64 (%rax), %zmm5
movq -16(%rsp), %r15
vpminsq %zmm3, %zmm7, %zmm14
vpmaxsq %zmm3, %zmm7, %zmm7
vpminsq %zmm4, %zmm12, %zmm3
vpmaxsq %zmm4, %zmm12, %zmm12
cmpq $1, -8(%rsp)
vpminsq (%r15), %zmm5, %zmm11
vpmaxsq (%r15), %zmm5, %zmm5
vpminsq %zmm1, %zmm2, %zmm4
vpmaxsq %zmm1, %zmm2, %zmm2
vpminsq %zmm9, %zmm8, %zmm1
vpmaxsq %zmm9, %zmm8, %zmm8
vpminsq %zmm15, %zmm6, %zmm9
vpmaxsq %zmm15, %zmm6, %zmm6
vpminsq %zmm11, %zmm0, %zmm15
vpmaxsq %zmm11, %zmm0, %zmm0
vpminsq %zmm5, %zmm16, %zmm11
vpmaxsq %zmm5, %zmm16, %zmm16
vpminsq %zmm3, %zmm10, %zmm5
vpmaxsq %zmm3, %zmm10, %zmm10
vpminsq %zmm4, %zmm14, %zmm3
vpmaxsq %zmm4, %zmm14, %zmm14
vpminsq %zmm12, %zmm13, %zmm4
vpmaxsq %zmm12, %zmm13, %zmm13
vpminsq %zmm2, %zmm7, %zmm12
vpmaxsq %zmm2, %zmm7, %zmm7
vpminsq %zmm15, %zmm1, %zmm2
vpmaxsq %zmm15, %zmm1, %zmm1
vpminsq %zmm11, %zmm9, %zmm15
vpmaxsq %zmm11, %zmm9, %zmm9
vpminsq %zmm0, %zmm8, %zmm11
vpmaxsq %zmm0, %zmm8, %zmm8
vpminsq %zmm16, %zmm6, %zmm0
vpmaxsq %zmm16, %zmm6, %zmm6
vpminsq %zmm2, %zmm5, %zmm17
vpmaxsq %zmm2, %zmm5, %zmm5
vpminsq %zmm15, %zmm3, %zmm2
vpmaxsq %zmm15, %zmm3, %zmm3
vpminsq %zmm11, %zmm4, %zmm15
vpmaxsq %zmm11, %zmm4, %zmm4
vpminsq %zmm0, %zmm12, %zmm11
vpmaxsq %zmm0, %zmm12, %zmm12
vpminsq %zmm1, %zmm10, %zmm0
vpmaxsq %zmm1, %zmm10, %zmm10
vpminsq %zmm9, %zmm14, %zmm1
vpmaxsq %zmm9, %zmm14, %zmm14
vpminsq %zmm8, %zmm13, %zmm9
vpmaxsq %zmm8, %zmm13, %zmm13
vpminsq %zmm6, %zmm7, %zmm8
vpmaxsq %zmm6, %zmm7, %zmm7
vpminsq %zmm4, %zmm1, %zmm6
vpmaxsq %zmm4, %zmm1, %zmm1
vpminsq %zmm3, %zmm9, %zmm4
vpmaxsq %zmm3, %zmm9, %zmm9
vpminsq %zmm10, %zmm11, %zmm3
vpmaxsq %zmm10, %zmm11, %zmm11
vpminsq %zmm12, %zmm8, %zmm10
vpmaxsq %zmm12, %zmm8, %zmm8
vpminsq %zmm13, %zmm14, %zmm12
vpmaxsq %zmm13, %zmm14, %zmm14
vpminsq %zmm5, %zmm0, %zmm13
vpmaxsq %zmm5, %zmm0, %zmm0
vpminsq %zmm15, %zmm2, %zmm5
vpmaxsq %zmm15, %zmm2, %zmm2
vpminsq %zmm13, %zmm5, %zmm16
vpmaxsq %zmm13, %zmm5, %zmm5
vpminsq %zmm12, %zmm10, %zmm13
vpmaxsq %zmm12, %zmm10, %zmm10
vpminsq %zmm0, %zmm2, %zmm12
vpmaxsq %zmm0, %zmm2, %zmm2
vpminsq %zmm14, %zmm8, %zmm0
vpminsq %zmm5, %zmm12, %zmm15
vpmaxsq %zmm5, %zmm12, %zmm12
vpminsq %zmm4, %zmm6, %zmm5
vpmaxsq %zmm4, %zmm6, %zmm6
vpminsq %zmm1, %zmm9, %zmm4
vpmaxsq %zmm1, %zmm9, %zmm9
vpminsq %zmm10, %zmm0, %zmm1
vpmaxsq %zmm10, %zmm0, %zmm0
vpminsq %zmm2, %zmm3, %zmm10
vpmaxsq %zmm2, %zmm3, %zmm3
vpminsq %zmm11, %zmm13, %zmm2
vpmaxsq %zmm11, %zmm13, %zmm13
vpminsq %zmm5, %zmm10, %zmm11
vpmaxsq %zmm5, %zmm10, %zmm10
vpminsq %zmm3, %zmm6, %zmm5
vpmaxsq %zmm3, %zmm6, %zmm6
vpminsq %zmm4, %zmm2, %zmm3
vpmaxsq %zmm4, %zmm2, %zmm2
vpminsq %zmm13, %zmm9, %zmm4
vpmaxsq %zmm13, %zmm9, %zmm9
vpminsq %zmm5, %zmm10, %zmm13
vpmaxsq %zmm5, %zmm10, %zmm10
vpminsq %zmm6, %zmm3, %zmm5
vpmaxsq %zmm6, %zmm3, %zmm3
vpminsq %zmm4, %zmm2, %zmm6
vpmaxsq %zmm14, %zmm8, %zmm8
vpmaxsq %zmm4, %zmm2, %zmm2
vpminsq %zmm12, %zmm11, %zmm14
vpminsq %zmm9, %zmm1, %zmm4
vpmaxsq %zmm12, %zmm11, %zmm11
vpmaxsq %zmm9, %zmm1, %zmm1
vpminsq %zmm5, %zmm10, %zmm12
vpmaxsq %zmm5, %zmm10, %zmm10
vpminsq %zmm6, %zmm3, %zmm5
vpmaxsq %zmm6, %zmm3, %zmm3
jbe .L123
vpshufd $78, %zmm0, %zmm6
vpshufd $78, %zmm7, %zmm7
vpshufd $78, %zmm5, %zmm5
movl $85, %r15d
vpshufd $78, %zmm3, %zmm3
vpshufd $78, %zmm2, %zmm2
vpshufd $78, %zmm4, %zmm4
kmovb %r15d, %k1
vpshufd $78, %zmm1, %zmm1
vpshufd $78, %zmm8, %zmm8
vpminsq %zmm7, %zmm17, %zmm0
cmpq $3, -8(%rsp)
vpmaxsq %zmm7, %zmm17, %zmm9
vpminsq %zmm8, %zmm16, %zmm17
vpminsq %zmm2, %zmm13, %zmm7
vpmaxsq %zmm8, %zmm16, %zmm8
vpshufd $78, %zmm9, %zmm9
vpminsq %zmm6, %zmm15, %zmm16
vpmaxsq %zmm6, %zmm15, %zmm6
vpshufd $78, %zmm8, %zmm8
vpminsq %zmm1, %zmm14, %zmm15
vpmaxsq %zmm1, %zmm14, %zmm1
vpshufd $78, %zmm7, %zmm7
vpminsq %zmm4, %zmm11, %zmm14
vpmaxsq %zmm4, %zmm11, %zmm4
vpshufd $78, %zmm1, %zmm1
vpminsq %zmm3, %zmm12, %zmm11
vpmaxsq %zmm3, %zmm12, %zmm3
vpshufd $78, %zmm14, %zmm14
vpminsq %zmm5, %zmm10, %zmm12
vpmaxsq %zmm5, %zmm10, %zmm5
vpshufd $78, %zmm11, %zmm10
vpshufd $78, %zmm12, %zmm12
vpmaxsq %zmm2, %zmm13, %zmm2
vpmaxsq %zmm9, %zmm5, %zmm19
vpminsq %zmm12, %zmm0, %zmm11
vpmaxsq %zmm12, %zmm0, %zmm13
vpshufd $78, %zmm6, %zmm6
vpminsq %zmm9, %zmm5, %zmm0
vpminsq %zmm14, %zmm15, %zmm12
vpminsq %zmm8, %zmm3, %zmm9
vpminsq %zmm10, %zmm17, %zmm5
vpshufd $78, %zmm12, %zmm12
vpmaxsq %zmm10, %zmm17, %zmm10
vpmaxsq %zmm8, %zmm3, %zmm17
vpminsq %zmm7, %zmm16, %zmm3
vpminsq %zmm6, %zmm2, %zmm8
vpshufd $78, %zmm10, %zmm10
vpmaxsq %zmm6, %zmm2, %zmm6
vpmaxsq %zmm14, %zmm15, %zmm14
vpshufd $78, %zmm3, %zmm2
vpminsq %zmm1, %zmm4, %zmm15
vpshufd $78, %zmm17, %zmm3
vpmaxsq %zmm1, %zmm4, %zmm4
vpmaxsq %zmm12, %zmm11, %zmm17
vpmaxsq %zmm7, %zmm16, %zmm7
vpshufd $78, %zmm8, %zmm1
vpshufd $78, %zmm13, %zmm16
vpshufd $78, %zmm15, %zmm8
vpminsq %zmm12, %zmm11, %zmm13
vpshufd $78, %zmm19, %zmm15
vpminsq %zmm2, %zmm5, %zmm11
vpminsq %zmm16, %zmm14, %zmm12
vpminsq %zmm8, %zmm0, %zmm19
vpmaxsq %zmm16, %zmm14, %zmm14
vpshufd $78, %zmm11, %zmm11
vpmaxsq %zmm8, %zmm0, %zmm16
vpminsq %zmm1, %zmm9, %zmm0
vpminsq %zmm15, %zmm4, %zmm8
vpmaxsq %zmm15, %zmm4, %zmm15
vpshufd $78, %zmm0, %zmm4
vpmaxsq %zmm2, %zmm5, %zmm5
vpshufd $78, %zmm16, %zmm0
vpminsq %zmm10, %zmm7, %zmm2
vpshufd $78, %zmm15, %zmm16
vpmaxsq %zmm10, %zmm7, %zmm7
vpminsq %zmm11, %zmm13, %zmm15
vpshufd $78, %zmm17, %zmm10
vpmaxsq %zmm1, %zmm9, %zmm1
vpminsq %zmm3, %zmm6, %zmm9
vpmaxsq %zmm3, %zmm6, %zmm6
vpshufd $78, %zmm14, %zmm3
vpmaxsq %zmm11, %zmm13, %zmm14
vpminsq %zmm10, %zmm5, %zmm11
vpmaxsq %zmm10, %zmm5, %zmm5
vpshufd $78, %zmm15, %zmm10
vpmaxsq %zmm10, %zmm15, %zmm17
vpshufd $78, %zmm2, %zmm2
vpshufd $78, %zmm9, %zmm9
vpminsq %zmm10, %zmm15, %zmm17{%k1}
vpshufd $78, %zmm14, %zmm10
vpminsq %zmm2, %zmm12, %zmm13
vpmaxsq %zmm2, %zmm12, %zmm12
vpminsq %zmm3, %zmm7, %zmm2
vpmaxsq %zmm3, %zmm7, %zmm7
vpminsq %zmm4, %zmm19, %zmm3
vpmaxsq %zmm4, %zmm19, %zmm19
vpminsq %zmm0, %zmm1, %zmm4
vpmaxsq %zmm0, %zmm1, %zmm1
vpminsq %zmm9, %zmm8, %zmm0
vpmaxsq %zmm9, %zmm8, %zmm8
vpminsq %zmm16, %zmm6, %zmm9
vpmaxsq %zmm16, %zmm6, %zmm6
vpmaxsq %zmm10, %zmm14, %zmm16
vpminsq %zmm10, %zmm14, %zmm16{%k1}
vpshufd $78, %zmm11, %zmm10
vpmaxsq %zmm10, %zmm11, %zmm15
vpminsq %zmm10, %zmm11, %zmm15{%k1}
vpshufd $78, %zmm5, %zmm10
vpmaxsq %zmm10, %zmm5, %zmm14
vpminsq %zmm10, %zmm5, %zmm14{%k1}
vpshufd $78, %zmm13, %zmm5
vpmaxsq %zmm5, %zmm13, %zmm11
vpminsq %zmm5, %zmm13, %zmm11{%k1}
vpshufd $78, %zmm12, %zmm5
vpmaxsq %zmm5, %zmm12, %zmm13
vpminsq %zmm5, %zmm12, %zmm13{%k1}
vpshufd $78, %zmm2, %zmm5
vpmaxsq %zmm5, %zmm2, %zmm12
vpminsq %zmm5, %zmm2, %zmm12{%k1}
vpshufd $78, %zmm7, %zmm2
vpmaxsq %zmm2, %zmm7, %zmm10
vpminsq %zmm2, %zmm7, %zmm10{%k1}
vpshufd $78, %zmm3, %zmm2
vpshufd $78, %zmm4, %zmm7
vpmaxsq %zmm2, %zmm3, %zmm5
vpminsq %zmm2, %zmm3, %zmm5{%k1}
vpshufd $78, %zmm19, %zmm2
vpmaxsq %zmm2, %zmm19, %zmm3
vpminsq %zmm2, %zmm19, %zmm3{%k1}
vpmaxsq %zmm7, %zmm4, %zmm2
vpminsq %zmm7, %zmm4, %zmm2{%k1}
vpshufd $78, %zmm1, %zmm7
vpmaxsq %zmm7, %zmm1, %zmm4
vpminsq %zmm7, %zmm1, %zmm4{%k1}
vpshufd $78, %zmm0, %zmm7
vpmaxsq %zmm7, %zmm0, %zmm1
vpminsq %zmm7, %zmm0, %zmm1{%k1}
vpshufd $78, %zmm8, %zmm7
vpmaxsq %zmm7, %zmm8, %zmm0
vpminsq %zmm7, %zmm8, %zmm0{%k1}
vpshufd $78, %zmm9, %zmm7
vpmaxsq %zmm7, %zmm9, %zmm8
vpminsq %zmm7, %zmm9, %zmm8{%k1}
vpshufd $78, %zmm6, %zmm9
vpmaxsq %zmm9, %zmm6, %zmm7
vpminsq %zmm9, %zmm6, %zmm7{%k1}
jbe .L123
vpermq $27, %zmm5, %zmm5
vpermq $27, %zmm3, %zmm3
vpermq $27, %zmm2, %zmm2
movl $51, %r15d
vpermq $27, %zmm4, %zmm4
vpermq $27, %zmm1, %zmm1
kmovb %r15d, %k2
vpermq $27, %zmm0, %zmm0
vpermq $27, %zmm8, %zmm8
vpermq $27, %zmm7, %zmm7
vpminsq %zmm2, %zmm13, %zmm6
cmpq $7, -8(%rsp)
vpminsq %zmm7, %zmm17, %zmm9
vpmaxsq %zmm7, %zmm17, %zmm7
vpermq $27, %zmm6, %zmm6
vpminsq %zmm8, %zmm16, %zmm17
vpmaxsq %zmm8, %zmm16, %zmm8
vpermq $27, %zmm7, %zmm7
vpminsq %zmm0, %zmm15, %zmm16
vpmaxsq %zmm0, %zmm15, %zmm0
vpermq $27, %zmm8, %zmm8
vpminsq %zmm1, %zmm14, %zmm15
vpmaxsq %zmm1, %zmm14, %zmm1
vpermq $27, %zmm0, %zmm0
vpminsq %zmm4, %zmm11, %zmm14
vpmaxsq %zmm4, %zmm11, %zmm4
vpermq $27, %zmm1, %zmm1
vpminsq %zmm3, %zmm12, %zmm11
vpmaxsq %zmm3, %zmm12, %zmm3
vpermq $27, %zmm14, %zmm14
vpminsq %zmm5, %zmm10, %zmm12
vpmaxsq %zmm5, %zmm10, %zmm5
vpermq $27, %zmm11, %zmm10
vpermq $27, %zmm12, %zmm12
vpminsq %zmm7, %zmm5, %zmm11
vpmaxsq %zmm2, %zmm13, %zmm2
vpminsq %zmm12, %zmm9, %zmm19
vpmaxsq %zmm12, %zmm9, %zmm13
vpmaxsq %zmm7, %zmm5, %zmm20
vpminsq %zmm8, %zmm3, %zmm9
vpminsq %zmm10, %zmm17, %zmm5
vpmaxsq %zmm10, %zmm17, %zmm10
vpmaxsq %zmm8, %zmm3, %zmm17
vpminsq %zmm6, %zmm16, %zmm3
vpermq $27, %zmm10, %zmm10
vpminsq %zmm14, %zmm15, %zmm8
vpminsq %zmm0, %zmm2, %zmm7
vpmaxsq %zmm14, %zmm15, %zmm14
vpmaxsq %zmm0, %zmm2, %zmm0
vpermq $27, %zmm3, %zmm2
vpminsq %zmm1, %zmm4, %zmm15
vpmaxsq %zmm1, %zmm4, %zmm12
vpermq $27, %zmm8, %zmm3
vpmaxsq %zmm6, %zmm16, %zmm6
vpermq $27, %zmm13, %zmm1
vpermq $27, %zmm15, %zmm16
vpermq $27, %zmm17, %zmm8
vpminsq %zmm2, %zmm5, %zmm17
vpminsq %zmm3, %zmm19, %zmm13
vpminsq %zmm16, %zmm11, %zmm4
vpermq $27, %zmm7, %zmm7
vpermq $27, %zmm20, %zmm15
vpmaxsq %zmm3, %zmm19, %zmm19
vpmaxsq %zmm16, %zmm11, %zmm20
vpermq $27, %zmm17, %zmm11
vpmaxsq %zmm2, %zmm5, %zmm3
vpminsq %zmm1, %zmm14, %zmm5
vpmaxsq %zmm1, %zmm14, %zmm14
vpminsq %zmm7, %zmm9, %zmm16
vpmaxsq %zmm10, %zmm6, %zmm1
vpminsq %zmm10, %zmm6, %zmm2
vpermq $27, %zmm19, %zmm10
vpermq $27, %zmm14, %zmm6
vpmaxsq %zmm7, %zmm9, %zmm9
vpminsq %zmm11, %zmm13, %zmm14
vpminsq %zmm15, %zmm12, %zmm7
vpmaxsq %zmm15, %zmm12, %zmm15
vpermq $27, %zmm16, %zmm17
vpminsq %zmm8, %zmm0, %zmm12
vpmaxsq %zmm11, %zmm13, %zmm13
vpermq $27, %zmm2, %zmm2
vpminsq %zmm10, %zmm3, %zmm11
vpermq $27, %zmm12, %zmm16
vpmaxsq %zmm10, %zmm3, %zmm3
vpmaxsq %zmm8, %zmm0, %zmm0
vpermq $27, %zmm14, %zmm10
vpermq $27, %zmm20, %zmm8
vpminsq %zmm17, %zmm4, %zmm19
vpmaxsq %zmm17, %zmm4, %zmm4
vpermq $27, %zmm15, %zmm15
vpminsq %zmm8, %zmm9, %zmm17
vpmaxsq %zmm8, %zmm9, %zmm9
vpminsq %zmm16, %zmm7, %zmm8
vpmaxsq %zmm16, %zmm7, %zmm7
vpmaxsq %zmm10, %zmm14, %zmm16
vpminsq %zmm2, %zmm5, %zmm12
vpminsq %zmm10, %zmm14, %zmm16{%k2}
vpermq $27, %zmm13, %zmm10
vpmaxsq %zmm2, %zmm5, %zmm5
vpminsq %zmm6, %zmm1, %zmm2
vpmaxsq %zmm6, %zmm1, %zmm1
vpminsq %zmm15, %zmm0, %zmm6
vpmaxsq %zmm15, %zmm0, %zmm0
vpmaxsq %zmm10, %zmm13, %zmm15
vpminsq %zmm10, %zmm13, %zmm15{%k2}
vpermq $27, %zmm11, %zmm10
vpmaxsq %zmm10, %zmm11, %zmm14
vpminsq %zmm10, %zmm11, %zmm14{%k2}
vpermq $27, %zmm3, %zmm10
vpmaxsq %zmm10, %zmm3, %zmm11
vpminsq %zmm10, %zmm3, %zmm11{%k2}
vpermq $27, %zmm12, %zmm3
vpmaxsq %zmm3, %zmm12, %zmm13
vpminsq %zmm3, %zmm12, %zmm13{%k2}
vpermq $27, %zmm5, %zmm3
vpmaxsq %zmm3, %zmm5, %zmm12
vpminsq %zmm3, %zmm5, %zmm12{%k2}
vpermq $27, %zmm2, %zmm3
vpmaxsq %zmm3, %zmm2, %zmm10
vpminsq %zmm3, %zmm2, %zmm10{%k2}
vpermq $27, %zmm1, %zmm2
vpmaxsq %zmm2, %zmm1, %zmm5
vpminsq %zmm2, %zmm1, %zmm5{%k2}
vpermq $27, %zmm19, %zmm1
vpmaxsq %zmm1, %zmm19, %zmm3
vpminsq %zmm1, %zmm19, %zmm3{%k2}
vpermq $27, %zmm4, %zmm1
vpmaxsq %zmm1, %zmm4, %zmm2
vpminsq %zmm1, %zmm4, %zmm2{%k2}
vpermq $27, %zmm17, %zmm1
vpmaxsq %zmm1, %zmm17, %zmm4
vpminsq %zmm1, %zmm17, %zmm4{%k2}
vpermq $27, %zmm9, %zmm17
vpmaxsq %zmm17, %zmm9, %zmm1
vpminsq %zmm17, %zmm9, %zmm1{%k2}
vpermq $27, %zmm8, %zmm17
vpmaxsq %zmm17, %zmm8, %zmm9
vpminsq %zmm17, %zmm8, %zmm9{%k2}
vpermq $27, %zmm7, %zmm17
vpmaxsq %zmm17, %zmm7, %zmm8
vpminsq %zmm17, %zmm7, %zmm8{%k2}
vpermq $27, %zmm6, %zmm17
vpmaxsq %zmm17, %zmm6, %zmm7
vpminsq %zmm17, %zmm6, %zmm7{%k2}
vpermq $27, %zmm0, %zmm17
vpmaxsq %zmm17, %zmm0, %zmm6
vpminsq %zmm17, %zmm0, %zmm6{%k2}
vpshufd $78, %zmm16, %zmm0
vpmaxsq %zmm0, %zmm16, %zmm17
vpminsq %zmm0, %zmm16, %zmm17{%k1}
vpshufd $78, %zmm15, %zmm0
vpmaxsq %zmm0, %zmm15, %zmm16
vpminsq %zmm0, %zmm15, %zmm16{%k1}
vpshufd $78, %zmm14, %zmm0
vpmaxsq %zmm0, %zmm14, %zmm15
vpminsq %zmm0, %zmm14, %zmm15{%k1}
vpshufd $78, %zmm11, %zmm0
vpmaxsq %zmm0, %zmm11, %zmm14
vpminsq %zmm0, %zmm11, %zmm14{%k1}
vpshufd $78, %zmm13, %zmm0
vpmaxsq %zmm0, %zmm13, %zmm11
vpminsq %zmm0, %zmm13, %zmm11{%k1}
vpshufd $78, %zmm12, %zmm0
vpmaxsq %zmm0, %zmm12, %zmm13
vpminsq %zmm0, %zmm12, %zmm13{%k1}
vpshufd $78, %zmm10, %zmm0
vpmaxsq %zmm0, %zmm10, %zmm12
vpminsq %zmm0, %zmm10, %zmm12{%k1}
vpshufd $78, %zmm5, %zmm0
vpmaxsq %zmm0, %zmm5, %zmm10
vpminsq %zmm0, %zmm5, %zmm10{%k1}
vpshufd $78, %zmm3, %zmm0
vpmaxsq %zmm0, %zmm3, %zmm5
vpminsq %zmm0, %zmm3, %zmm5{%k1}
vpshufd $78, %zmm2, %zmm0
vpmaxsq %zmm0, %zmm2, %zmm3
vpminsq %zmm0, %zmm2, %zmm3{%k1}
vpshufd $78, %zmm4, %zmm0
vpmaxsq %zmm0, %zmm4, %zmm2
vpminsq %zmm0, %zmm4, %zmm2{%k1}
vpshufd $78, %zmm1, %zmm0
vpmaxsq %zmm0, %zmm1, %zmm4
vpminsq %zmm0, %zmm1, %zmm4{%k1}
vpshufd $78, %zmm9, %zmm0
vpmaxsq %zmm0, %zmm9, %zmm1
vpminsq %zmm0, %zmm9, %zmm1{%k1}
vpshufd $78, %zmm8, %zmm9
vpmaxsq %zmm9, %zmm8, %zmm0
vpminsq %zmm9, %zmm8, %zmm0{%k1}
vpshufd $78, %zmm7, %zmm9
vpmaxsq %zmm9, %zmm7, %zmm8
vpminsq %zmm9, %zmm7, %zmm8{%k1}
vpshufd $78, %zmm6, %zmm9
vpmaxsq %zmm9, %zmm6, %zmm7
vpminsq %zmm9, %zmm6, %zmm7{%k1}
jbe .L123
vmovdqa64 .LC2(%rip), %zmm6
movl $65535, %r15d
kmovd %r15d, %k3
vpermq %zmm7, %zmm6, %zmm7
vpermq %zmm5, %zmm6, %zmm5
vpermq %zmm3, %zmm6, %zmm3
vpermq %zmm2, %zmm6, %zmm2
vpermq %zmm4, %zmm6, %zmm4
vpermq %zmm1, %zmm6, %zmm1
vpermq %zmm0, %zmm6, %zmm0
vpermq %zmm8, %zmm6, %zmm8
vpminsq %zmm7, %zmm17, %zmm9
vpmaxsq %zmm7, %zmm17, %zmm19
vpminsq %zmm8, %zmm16, %zmm7
vpmaxsq %zmm8, %zmm16, %zmm8
vpminsq %zmm0, %zmm15, %zmm16
vpmaxsq %zmm0, %zmm15, %zmm0
vpminsq %zmm1, %zmm14, %zmm15
vpermq %zmm8, %zmm6, %zmm8
vpmaxsq %zmm1, %zmm14, %zmm1
vpminsq %zmm4, %zmm11, %zmm14
vpermq %zmm0, %zmm6, %zmm0
vpmaxsq %zmm4, %zmm11, %zmm4
vpminsq %zmm2, %zmm13, %zmm11
vpermq %zmm14, %zmm6, %zmm14
vpmaxsq %zmm2, %zmm13, %zmm2
vpminsq %zmm3, %zmm12, %zmm13
vpermq %zmm11, %zmm6, %zmm11
vpmaxsq %zmm3, %zmm12, %zmm3
vpminsq %zmm5, %zmm10, %zmm12
vpermq %zmm13, %zmm6, %zmm17
vpmaxsq %zmm5, %zmm10, %zmm5
vpermq %zmm19, %zmm6, %zmm13
vpermq %zmm12, %zmm6, %zmm12
vpminsq %zmm12, %zmm9, %zmm10
vpmaxsq %zmm12, %zmm9, %zmm19
vpermq %zmm1, %zmm6, %zmm1
vpminsq %zmm13, %zmm5, %zmm12
vpmaxsq %zmm13, %zmm5, %zmm20
vpminsq %zmm8, %zmm3, %zmm9
vpminsq %zmm17, %zmm7, %zmm13
vpminsq %zmm11, %zmm16, %zmm5
vpmaxsq %zmm17, %zmm7, %zmm7
vpmaxsq %zmm8, %zmm3, %zmm17
vpmaxsq %zmm11, %zmm16, %zmm3
vpermq %zmm19, %zmm6, %zmm11
vpminsq %zmm14, %zmm15, %zmm16
vpminsq %zmm0, %zmm2, %zmm8
vpmaxsq %zmm14, %zmm15, %zmm14
vpermq %zmm16, %zmm6, %zmm16
vpermq %zmm5, %zmm6, %zmm15
vpmaxsq %zmm0, %zmm2, %zmm0
vpminsq %zmm1, %zmm4, %zmm2
vpermq %zmm20, %zmm6, %zmm5
vpminsq %zmm16, %zmm10, %zmm19
vpmaxsq %zmm1, %zmm4, %zmm1
vpermq %zmm7, %zmm6, %zmm4
vpermq %zmm8, %zmm6, %zmm7
vpermq %zmm2, %zmm6, %zmm8
vpermq %zmm17, %zmm6, %zmm2
vpmaxsq %zmm16, %zmm10, %zmm17
vpminsq %zmm15, %zmm13, %zmm16
vpminsq %zmm11, %zmm14, %zmm10
vpmaxsq %zmm15, %zmm13, %zmm13
vpmaxsq %zmm8, %zmm12, %zmm20
vpmaxsq %zmm11, %zmm14, %zmm15
vpermq %zmm16, %zmm6, %zmm11
vpminsq %zmm4, %zmm3, %zmm14
vpmaxsq %zmm5, %zmm1, %zmm22
vpmaxsq %zmm4, %zmm3, %zmm3
vpminsq %zmm2, %zmm0, %zmm21
vpermq %zmm22, %zmm6, %zmm16
vpminsq %zmm8, %zmm12, %zmm4
vpminsq %zmm7, %zmm9, %zmm8
vpermq %zmm17, %zmm6, %zmm12
vpmaxsq %zmm7, %zmm9, %zmm9
vpermq %zmm21, %zmm6, %zmm17
vpminsq %zmm5, %zmm1, %zmm7
vpmaxsq %zmm2, %zmm0, %zmm0
vpermq %zmm14, %zmm6, %zmm5
vpermq %zmm15, %zmm6, %zmm2
vpermq %zmm8, %zmm6, %zmm1
vpminsq %zmm11, %zmm19, %zmm15
vpermq %zmm20, %zmm6, %zmm8
vpmaxsq %zmm11, %zmm19, %zmm14
vpminsq %zmm12, %zmm13, %zmm11
vpmaxsq %zmm12, %zmm13, %zmm13
vpminsq %zmm5, %zmm10, %zmm12
vpmaxsq %zmm5, %zmm10, %zmm10
vpminsq %zmm2, %zmm3, %zmm5
vpmaxsq %zmm2, %zmm3, %zmm3
vpminsq %zmm1, %zmm4, %zmm2
vpmaxsq %zmm1, %zmm4, %zmm4
vpminsq %zmm8, %zmm9, %zmm1
vpmaxsq %zmm8, %zmm9, %zmm9
vpminsq %zmm17, %zmm7, %zmm8
vpmaxsq %zmm17, %zmm7, %zmm7
vpminsq %zmm16, %zmm0, %zmm17
vpmaxsq %zmm16, %zmm0, %zmm0
vpermq %zmm15, %zmm6, %zmm16
vpminsq %zmm16, %zmm15, %zmm19
vpmaxsq %zmm16, %zmm15, %zmm15
vpermq %zmm14, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm15{%k3}
vpminsq %zmm16, %zmm14, %zmm19
vpmaxsq %zmm16, %zmm14, %zmm14
vpermq %zmm11, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm14{%k3}
vpminsq %zmm16, %zmm11, %zmm19
vpmaxsq %zmm16, %zmm11, %zmm11
vpermq %zmm13, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm11{%k3}
vpminsq %zmm16, %zmm13, %zmm19
vpmaxsq %zmm16, %zmm13, %zmm13
vpermq %zmm12, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm13{%k3}
vpminsq %zmm16, %zmm12, %zmm19
vpmaxsq %zmm16, %zmm12, %zmm12
vpermq %zmm10, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm12{%k3}
vpminsq %zmm16, %zmm10, %zmm19
vpmaxsq %zmm16, %zmm10, %zmm10
vpermq %zmm5, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm10{%k3}
vpminsq %zmm16, %zmm5, %zmm19
vpmaxsq %zmm16, %zmm5, %zmm5
vpermq %zmm3, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm5{%k3}
vpminsq %zmm16, %zmm3, %zmm19
vpmaxsq %zmm16, %zmm3, %zmm3
vpermq %zmm2, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm3{%k3}
vpminsq %zmm16, %zmm2, %zmm19
vpmaxsq %zmm16, %zmm2, %zmm2
vpermq %zmm4, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm2{%k3}
vpminsq %zmm16, %zmm4, %zmm19
vpmaxsq %zmm16, %zmm4, %zmm4
vpermq %zmm1, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm4{%k3}
vpminsq %zmm16, %zmm1, %zmm19
vpmaxsq %zmm16, %zmm1, %zmm1
vpermq %zmm9, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm1{%k3}
vpminsq %zmm16, %zmm9, %zmm19
vpmaxsq %zmm16, %zmm9, %zmm9
vpermq %zmm8, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm9{%k3}
vpminsq %zmm16, %zmm8, %zmm19
vpmaxsq %zmm16, %zmm8, %zmm8
vpermq %zmm7, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm8{%k3}
vpminsq %zmm16, %zmm7, %zmm19
vpmaxsq %zmm16, %zmm7, %zmm7
vpermq %zmm17, %zmm6, %zmm16
vpermq %zmm0, %zmm6, %zmm6
vmovdqu16 %zmm19, %zmm7{%k3}
vpminsq %zmm16, %zmm17, %zmm19
vpmaxsq %zmm16, %zmm17, %zmm17
vpminsq %zmm6, %zmm0, %zmm16
vpmaxsq %zmm6, %zmm0, %zmm0
vshufi32x4 $177, %zmm15, %zmm15, %zmm6
vmovdqu16 %zmm16, %zmm0{%k3}
vpmaxsq %zmm15, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm17{%k3}
vpminsq %zmm15, %zmm6, %zmm16{%k2}
vshufi32x4 $177, %zmm14, %zmm14, %zmm6
vpmaxsq %zmm14, %zmm6, %zmm15
vpminsq %zmm14, %zmm6, %zmm15{%k2}
vshufi32x4 $177, %zmm11, %zmm11, %zmm6
vpmaxsq %zmm11, %zmm6, %zmm14
vpminsq %zmm11, %zmm6, %zmm14{%k2}
vshufi32x4 $177, %zmm13, %zmm13, %zmm6
vpmaxsq %zmm13, %zmm6, %zmm11
vpminsq %zmm13, %zmm6, %zmm11{%k2}
vshufi32x4 $177, %zmm12, %zmm12, %zmm6
vpmaxsq %zmm12, %zmm6, %zmm13
vpminsq %zmm12, %zmm6, %zmm13{%k2}
vshufi32x4 $177, %zmm10, %zmm10, %zmm6
vpmaxsq %zmm10, %zmm6, %zmm12
vpminsq %zmm10, %zmm6, %zmm12{%k2}
vshufi32x4 $177, %zmm5, %zmm5, %zmm6
vpmaxsq %zmm5, %zmm6, %zmm10
vpminsq %zmm5, %zmm6, %zmm10{%k2}
vshufi32x4 $177, %zmm3, %zmm3, %zmm6
vpmaxsq %zmm3, %zmm6, %zmm5
vpminsq %zmm3, %zmm6, %zmm5{%k2}
vshufi32x4 $177, %zmm2, %zmm2, %zmm6
vpmaxsq %zmm2, %zmm6, %zmm3
vpminsq %zmm2, %zmm6, %zmm3{%k2}
vshufi32x4 $177, %zmm4, %zmm4, %zmm6
vpmaxsq %zmm4, %zmm6, %zmm2
vpminsq %zmm4, %zmm6, %zmm2{%k2}
vshufi32x4 $177, %zmm1, %zmm1, %zmm6
vpmaxsq %zmm1, %zmm6, %zmm4
vpminsq %zmm1, %zmm6, %zmm4{%k2}
vshufi32x4 $177, %zmm9, %zmm9, %zmm6
vpmaxsq %zmm9, %zmm6, %zmm1
vpminsq %zmm9, %zmm6, %zmm1{%k2}
vshufi32x4 $177, %zmm8, %zmm8, %zmm6
vpmaxsq %zmm8, %zmm6, %zmm9
vpminsq %zmm8, %zmm6, %zmm9{%k2}
vshufi32x4 $177, %zmm7, %zmm7, %zmm6
vpmaxsq %zmm7, %zmm6, %zmm8
vpminsq %zmm7, %zmm6, %zmm8{%k2}
vshufi32x4 $177, %zmm17, %zmm17, %zmm6
vpmaxsq %zmm17, %zmm6, %zmm7
vpminsq %zmm17, %zmm6, %zmm7{%k2}
vshufi32x4 $177, %zmm0, %zmm0, %zmm17
vpmaxsq %zmm0, %zmm17, %zmm6
vpminsq %zmm0, %zmm17, %zmm6{%k2}
vpshufd $78, %zmm16, %zmm0
vpmaxsq %zmm0, %zmm16, %zmm17
vpminsq %zmm0, %zmm16, %zmm17{%k1}
vpshufd $78, %zmm15, %zmm0
vpmaxsq %zmm0, %zmm15, %zmm16
vpminsq %zmm0, %zmm15, %zmm16{%k1}
vpshufd $78, %zmm14, %zmm0
vpmaxsq %zmm0, %zmm14, %zmm15
vpminsq %zmm0, %zmm14, %zmm15{%k1}
vpshufd $78, %zmm11, %zmm0
vpmaxsq %zmm0, %zmm11, %zmm14
vpminsq %zmm0, %zmm11, %zmm14{%k1}
vpshufd $78, %zmm13, %zmm0
vpmaxsq %zmm0, %zmm13, %zmm11
vpminsq %zmm0, %zmm13, %zmm11{%k1}
vpshufd $78, %zmm12, %zmm0
vpmaxsq %zmm0, %zmm12, %zmm13
vpminsq %zmm0, %zmm12, %zmm13{%k1}
vpshufd $78, %zmm10, %zmm0
vpmaxsq %zmm0, %zmm10, %zmm12
vpminsq %zmm0, %zmm10, %zmm12{%k1}
vpshufd $78, %zmm5, %zmm0
vpmaxsq %zmm0, %zmm5, %zmm10
vpminsq %zmm0, %zmm5, %zmm10{%k1}
vpshufd $78, %zmm3, %zmm0
vpmaxsq %zmm0, %zmm3, %zmm5
vpminsq %zmm0, %zmm3, %zmm5{%k1}
vpshufd $78, %zmm2, %zmm0
vpmaxsq %zmm0, %zmm2, %zmm3
vpminsq %zmm0, %zmm2, %zmm3{%k1}
vpshufd $78, %zmm4, %zmm0
vpmaxsq %zmm0, %zmm4, %zmm2
vpminsq %zmm0, %zmm4, %zmm2{%k1}
vpshufd $78, %zmm1, %zmm0
vpmaxsq %zmm0, %zmm1, %zmm4
vpminsq %zmm0, %zmm1, %zmm4{%k1}
vpshufd $78, %zmm9, %zmm0
vpmaxsq %zmm0, %zmm9, %zmm1
vpminsq %zmm0, %zmm9, %zmm1{%k1}
vpshufd $78, %zmm8, %zmm9
vpmaxsq %zmm9, %zmm8, %zmm0
vpminsq %zmm9, %zmm8, %zmm0{%k1}
vpshufd $78, %zmm7, %zmm9
vpmaxsq %zmm9, %zmm7, %zmm8
vpminsq %zmm9, %zmm7, %zmm8{%k1}
vpshufd $78, %zmm6, %zmm9
vpmaxsq %zmm9, %zmm6, %zmm7
vpminsq %zmm9, %zmm6, %zmm7{%k1}
.L123:
vmovdqu64 %zmm17, (%rdi)
vmovq %xmm18, %rdi
vmovdqu64 %zmm16, (%rdi)
vmovdqu64 %zmm15, (%r14)
vmovdqu64 %zmm14, 0(%r13)
vmovdqu64 %zmm11, (%r12)
vmovdqu64 %zmm13, (%rbx)
vmovq %xmm23, %rbx
vmovdqu64 %zmm12, (%r11)
vmovdqu64 %zmm10, (%r10)
vmovdqu64 %zmm5, (%r9)
vmovdqu64 %zmm3, (%r8)
vmovdqu64 %zmm2, (%rbx)
vmovdqu64 %zmm4, (%rsi)
vmovdqu64 %zmm1, (%rcx)
vmovdqu64 %zmm0, (%rdx)
vmovdqu64 %zmm8, (%rax)
movq -16(%rsp), %rax
vmovdqu64 %zmm7, (%rax)
vzeroupper
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE18785:
.size _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, .-_ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
.section .text._ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18786:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %r10
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %rbx
.cfi_offset 3, -24
cmpq $7, %rsi
jbe .L141
movl $8, %r8d
xorl %esi, %esi
jmp .L132
.p2align 4,,10
.p2align 3
.L127:
vmovdqu64 %zmm0, (%rax)
kmovb %k0, %eax
popcntq %rax, %rax
addq %rax, %rsi
leaq 8(%r8), %rax
cmpq %r10, %rax
ja .L152
movq %rax, %r8
.L132:
vmovdqu64 -64(%rdi,%r8,8), %zmm3
leaq -8(%r8), %r9
leaq (%rdi,%rsi,8), %rax
vpcmpq $0, %zmm0, %zmm3, %k0
vpcmpq $0, %zmm1, %zmm3, %k1
kmovb %k0, %r11d
kmovb %k1, %ebx
korb %k1, %k0, %k1
kortestb %k1, %k1
jc .L127
kmovb %r11d, %k6
kmovb %ebx, %k5
kxnorb %k5, %k6, %k7
kmovb %k7, %eax
tzcntl %eax, %eax
addq %r9, %rax
vpbroadcastq (%rdi,%rax,8), %zmm0
leaq 8(%rsi), %rax
vmovdqa64 %zmm0, (%rdx)
cmpq %r9, %rax
ja .L128
.p2align 4,,10
.p2align 3
.L129:
vmovdqu64 %zmm1, -64(%rdi,%rax,8)
movq %rax, %rsi
addq $8, %rax
cmpq %rax, %r9
jnb .L129
.L128:
subq %rsi, %r9
leaq (%rdi,%rsi,8), %rdx
movl $255, %eax
cmpq $255, %r9
jbe .L153
.L130:
kmovb %eax, %k4
xorl %eax, %eax
vmovdqu64 %zmm1, (%rdx){%k4}
.L125:
movq -8(%rbp), %rbx
leave
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L153:
.cfi_restore_state
movq $-1, %rax
bzhi %r9, %rax, %rax
movzbl %al, %eax
jmp .L130
.p2align 4,,10
.p2align 3
.L152:
movq %r10, %r11
leaq (%rdi,%r8,8), %rbx
leaq (%rdi,%rsi,8), %r9
movl $255, %eax
subq %r8, %r11
kmovd %eax, %k1
cmpq $255, %r11
jbe .L126
.L133:
vmovdqu64 (%rbx), %zmm2{%k1}{z}
knotb %k1, %k3
vmovdqu64 %zmm2, (%rcx){%k1}
vmovdqa64 (%rcx), %zmm2
vpcmpq $0, %zmm0, %zmm2, %k0
vpcmpq $0, %zmm1, %zmm2, %k2
kandb %k1, %k0, %k0
korb %k2, %k0, %k2
korb %k3, %k2, %k2
kortestb %k2, %k2
jnc .L154
kmovb %k0, %edx
popcntq %rdx, %rdx
addq %rsi, %rdx
vmovdqu64 %zmm0, (%r9){%k1}
leaq 8(%rdx), %rax
cmpq %r10, %rax
ja .L138
.p2align 4,,10
.p2align 3
.L139:
vmovdqu64 %zmm1, -64(%rdi,%rax,8)
movq %rax, %rdx
addq $8, %rax
cmpq %rax, %r10
jnb .L139
.L138:
subq %rdx, %r10
leaq (%rdi,%rdx,8), %rcx
movl $255, %eax
cmpq $255, %r10
ja .L140
movq $-1, %rax
bzhi %r10, %rax, %rax
movzbl %al, %eax
.L140:
kmovb %eax, %k5
movl $1, %eax
vmovdqu64 %zmm1, (%rcx){%k5}
movq -8(%rbp), %rbx
leave
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.L141:
.cfi_restore_state
movq %rsi, %r11
movq %rdi, %r9
movq %rdi, %rbx
xorl %r8d, %r8d
xorl %esi, %esi
.L126:
movq $-1, %rax
bzhi %r11, %rax, %rax
movzbl %al, %eax
kmovd %eax, %k1
jmp .L133
.L154:
knotb %k2, %k3
kmovb %k3, %eax
tzcntl %eax, %eax
addq %r8, %rax
vpbroadcastq (%rdi,%rax,8), %zmm0
leaq 8(%rsi), %rax
vmovdqa64 %zmm0, (%rdx)
cmpq %r8, %rax
ja .L135
.p2align 4,,10
.p2align 3
.L136:
vmovdqu64 %zmm1, -64(%rdi,%rax,8)
movq %rax, %rsi
leaq 8(%rax), %rax
cmpq %rax, %r8
jnb .L136
leaq (%rdi,%rsi,8), %r9
.L135:
subq %rsi, %r8
movl $255, %eax
cmpq $255, %r8
ja .L137
movq $-1, %rax
bzhi %r8, %rax, %rax
movzbl %al, %eax
.L137:
kmovb %eax, %k6
xorl %eax, %eax
vmovdqu64 %zmm1, (%r9){%k6}
jmp .L125
.cfi_endproc
.LFE18786:
.size _ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, @function
_ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0:
.LFB18787:
.cfi_startproc
movq %rsi, %r8
movq %rdx, %rcx
cmpq %rdx, %rsi
jbe .L165
leaq (%rdx,%rdx), %rdx
leaq 1(%rcx), %r9
leaq 1(%rdx), %rsi
addq $2, %rdx
cmpq %rsi, %r8
jbe .L165
movq (%rdi,%rcx,8), %r11
vpbroadcastq %r11, %xmm1
jmp .L158
.p2align 4,,10
.p2align 3
.L168:
movq %rsi, %rax
cmpq %rdx, %r8
ja .L166
.L160:
cmpq %rcx, %rax
je .L165
leaq (%rdi,%rax,8), %rdx
movq (%rdx), %rcx
movq %rcx, (%r10)
movq %r11, (%rdx)
cmpq %rax, %r8
jbe .L167
leaq (%rax,%rax), %rdx
leaq 1(%rax), %r9
leaq 1(%rdx), %rsi
addq $2, %rdx
cmpq %r8, %rsi
jnb .L165
movq %rax, %rcx
.L158:
vpbroadcastq (%rdi,%rsi,8), %xmm0
leaq (%rdi,%rcx,8), %r10
vpcmpq $6, %xmm1, %xmm0, %k0
kmovb %k0, %eax
testb $1, %al
jne .L168
cmpq %rdx, %r8
jbe .L165
salq $4, %r9
vpbroadcastq (%rdi,%r9), %xmm0
vpcmpq $6, %xmm1, %xmm0, %k1
kmovb %k1, %eax
testb $1, %al
je .L165
movq %rdx, %rax
jmp .L160
.p2align 4,,10
.p2align 3
.L165:
ret
.p2align 4,,10
.p2align 3
.L166:
salq $4, %r9
vpbroadcastq (%rdi,%r9), %xmm2
vpcmpq $6, %xmm0, %xmm2, %k2
kmovb %k2, %esi
andl $1, %esi
cmovne %rdx, %rax
jmp .L160
.p2align 4,,10
.p2align 3
.L167:
ret
.cfi_endproc
.LFE18787:
.size _ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, .-_ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
.section .text._ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, @function
_ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0:
.LFB18788:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq 0(,%rsi,8), %r15
leaq (%rdi,%r15), %rdx
pushq %r14
.cfi_offset 14, -32
leaq (%rdx,%r15), %r14
pushq %r13
vmovq %rdx, %xmm18
.cfi_offset 13, -40
leaq (%r14,%r15), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%r15), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%r15), %rbx
leaq (%rbx,%r15), %r11
leaq (%r11,%r15), %r10
andq $-64, %rsp
leaq (%r10,%r15), %r9
movq %rsi, -8(%rsp)
leaq (%r9,%r15), %r8
vmovdqu64 (%rdi), %zmm4
vmovdqu64 (%r9), %zmm5
leaq (%r8,%r15), %rdx
vpminsq (%r8), %zmm5, %zmm8
vmovdqu64 (%r11), %zmm1
leaq (%rdx,%r15), %rsi
vmovq %rdx, %xmm23
vpmaxsq (%r8), %zmm5, %zmm6
leaq (%rsi,%r15), %rcx
leaq (%rcx,%r15), %rdx
leaq (%rdx,%r15), %rax
addq %rax, %r15
movq %r15, -16(%rsp)
vmovq %xmm18, %r15
vpminsq (%r15), %zmm4, %zmm13
vpmaxsq (%r15), %zmm4, %zmm7
vmovq %xmm23, %r15
vmovdqu64 (%r14), %zmm4
vmovdqu64 (%r15), %zmm5
vpminsq 0(%r13), %zmm4, %zmm14
vpmaxsq 0(%r13), %zmm4, %zmm3
vpminsq (%rsi), %zmm5, %zmm9
vpmaxsq (%rsi), %zmm5, %zmm15
vmovdqu64 (%r12), %zmm4
vmovdqu64 (%rcx), %zmm5
vpminsq %zmm14, %zmm13, %zmm10
vpmaxsq %zmm14, %zmm13, %zmm13
vpminsq (%rbx), %zmm4, %zmm12
vpmaxsq (%rbx), %zmm4, %zmm2
vpminsq (%rdx), %zmm5, %zmm0
vpminsq (%r10), %zmm1, %zmm4
vpmaxsq (%rdx), %zmm5, %zmm16
vpmaxsq (%r10), %zmm1, %zmm1
vmovdqu64 (%rax), %zmm5
movq -16(%rsp), %r15
vpminsq %zmm3, %zmm7, %zmm14
vpmaxsq %zmm3, %zmm7, %zmm7
vpminsq %zmm4, %zmm12, %zmm3
vpmaxsq %zmm4, %zmm12, %zmm12
cmpq $1, -8(%rsp)
vpminsq (%r15), %zmm5, %zmm11
vpmaxsq (%r15), %zmm5, %zmm5
vpminsq %zmm1, %zmm2, %zmm4
vpmaxsq %zmm1, %zmm2, %zmm2
vpminsq %zmm9, %zmm8, %zmm1
vpmaxsq %zmm9, %zmm8, %zmm8
vpminsq %zmm15, %zmm6, %zmm9
vpmaxsq %zmm15, %zmm6, %zmm6
vpminsq %zmm11, %zmm0, %zmm15
vpmaxsq %zmm11, %zmm0, %zmm0
vpminsq %zmm5, %zmm16, %zmm11
vpmaxsq %zmm5, %zmm16, %zmm16
vpminsq %zmm3, %zmm10, %zmm5
vpmaxsq %zmm3, %zmm10, %zmm10
vpminsq %zmm4, %zmm14, %zmm3
vpmaxsq %zmm4, %zmm14, %zmm14
vpminsq %zmm12, %zmm13, %zmm4
vpmaxsq %zmm12, %zmm13, %zmm13
vpminsq %zmm2, %zmm7, %zmm12
vpmaxsq %zmm2, %zmm7, %zmm7
vpminsq %zmm15, %zmm1, %zmm2
vpmaxsq %zmm15, %zmm1, %zmm1
vpminsq %zmm11, %zmm9, %zmm15
vpmaxsq %zmm11, %zmm9, %zmm9
vpminsq %zmm0, %zmm8, %zmm11
vpmaxsq %zmm0, %zmm8, %zmm8
vpminsq %zmm16, %zmm6, %zmm0
vpmaxsq %zmm16, %zmm6, %zmm6
vpminsq %zmm2, %zmm5, %zmm17
vpmaxsq %zmm2, %zmm5, %zmm5
vpminsq %zmm15, %zmm3, %zmm2
vpmaxsq %zmm15, %zmm3, %zmm3
vpminsq %zmm11, %zmm4, %zmm15
vpmaxsq %zmm11, %zmm4, %zmm4
vpminsq %zmm0, %zmm12, %zmm11
vpmaxsq %zmm0, %zmm12, %zmm12
vpminsq %zmm1, %zmm10, %zmm0
vpmaxsq %zmm1, %zmm10, %zmm10
vpminsq %zmm9, %zmm14, %zmm1
vpmaxsq %zmm9, %zmm14, %zmm14
vpminsq %zmm8, %zmm13, %zmm9
vpmaxsq %zmm8, %zmm13, %zmm13
vpminsq %zmm6, %zmm7, %zmm8
vpmaxsq %zmm6, %zmm7, %zmm7
vpminsq %zmm4, %zmm1, %zmm6
vpmaxsq %zmm4, %zmm1, %zmm1
vpminsq %zmm3, %zmm9, %zmm4
vpmaxsq %zmm3, %zmm9, %zmm9
vpminsq %zmm10, %zmm11, %zmm3
vpmaxsq %zmm10, %zmm11, %zmm11
vpminsq %zmm12, %zmm8, %zmm10
vpmaxsq %zmm12, %zmm8, %zmm8
vpminsq %zmm13, %zmm14, %zmm12
vpmaxsq %zmm13, %zmm14, %zmm14
vpminsq %zmm5, %zmm0, %zmm13
vpmaxsq %zmm5, %zmm0, %zmm0
vpminsq %zmm15, %zmm2, %zmm5
vpmaxsq %zmm15, %zmm2, %zmm2
vpminsq %zmm13, %zmm5, %zmm16
vpmaxsq %zmm13, %zmm5, %zmm5
vpminsq %zmm12, %zmm10, %zmm13
vpmaxsq %zmm12, %zmm10, %zmm10
vpminsq %zmm0, %zmm2, %zmm12
vpmaxsq %zmm0, %zmm2, %zmm2
vpminsq %zmm14, %zmm8, %zmm0
vpminsq %zmm5, %zmm12, %zmm15
vpmaxsq %zmm5, %zmm12, %zmm12
vpminsq %zmm4, %zmm6, %zmm5
vpmaxsq %zmm4, %zmm6, %zmm6
vpminsq %zmm1, %zmm9, %zmm4
vpmaxsq %zmm1, %zmm9, %zmm9
vpminsq %zmm10, %zmm0, %zmm1
vpmaxsq %zmm10, %zmm0, %zmm0
vpminsq %zmm2, %zmm3, %zmm10
vpmaxsq %zmm2, %zmm3, %zmm3
vpminsq %zmm11, %zmm13, %zmm2
vpmaxsq %zmm11, %zmm13, %zmm13
vpminsq %zmm5, %zmm10, %zmm11
vpmaxsq %zmm5, %zmm10, %zmm10
vpminsq %zmm3, %zmm6, %zmm5
vpmaxsq %zmm3, %zmm6, %zmm6
vpminsq %zmm4, %zmm2, %zmm3
vpmaxsq %zmm4, %zmm2, %zmm2
vpminsq %zmm13, %zmm9, %zmm4
vpmaxsq %zmm13, %zmm9, %zmm9
vpminsq %zmm5, %zmm10, %zmm13
vpmaxsq %zmm5, %zmm10, %zmm10
vpminsq %zmm6, %zmm3, %zmm5
vpmaxsq %zmm6, %zmm3, %zmm3
vpminsq %zmm4, %zmm2, %zmm6
vpmaxsq %zmm14, %zmm8, %zmm8
vpmaxsq %zmm4, %zmm2, %zmm2
vpminsq %zmm12, %zmm11, %zmm14
vpminsq %zmm9, %zmm1, %zmm4
vpmaxsq %zmm12, %zmm11, %zmm11
vpmaxsq %zmm9, %zmm1, %zmm1
vpminsq %zmm5, %zmm10, %zmm12
vpmaxsq %zmm5, %zmm10, %zmm10
vpminsq %zmm6, %zmm3, %zmm5
vpmaxsq %zmm6, %zmm3, %zmm3
jbe .L170
vpshufd $78, %zmm0, %zmm6
vpshufd $78, %zmm7, %zmm7
vpshufd $78, %zmm5, %zmm5
movl $85, %r15d
vpshufd $78, %zmm3, %zmm3
vpshufd $78, %zmm2, %zmm2
vpshufd $78, %zmm4, %zmm4
kmovb %r15d, %k1
vpshufd $78, %zmm1, %zmm1
vpshufd $78, %zmm8, %zmm8
vpminsq %zmm7, %zmm17, %zmm0
cmpq $3, -8(%rsp)
vpmaxsq %zmm7, %zmm17, %zmm9
vpminsq %zmm8, %zmm16, %zmm17
vpminsq %zmm2, %zmm13, %zmm7
vpmaxsq %zmm8, %zmm16, %zmm8
vpshufd $78, %zmm9, %zmm9
vpminsq %zmm6, %zmm15, %zmm16
vpmaxsq %zmm6, %zmm15, %zmm6
vpshufd $78, %zmm8, %zmm8
vpminsq %zmm1, %zmm14, %zmm15
vpmaxsq %zmm1, %zmm14, %zmm1
vpshufd $78, %zmm7, %zmm7
vpminsq %zmm4, %zmm11, %zmm14
vpmaxsq %zmm4, %zmm11, %zmm4
vpshufd $78, %zmm1, %zmm1
vpminsq %zmm3, %zmm12, %zmm11
vpmaxsq %zmm3, %zmm12, %zmm3
vpshufd $78, %zmm14, %zmm14
vpminsq %zmm5, %zmm10, %zmm12
vpmaxsq %zmm5, %zmm10, %zmm5
vpshufd $78, %zmm11, %zmm10
vpshufd $78, %zmm12, %zmm12
vpmaxsq %zmm2, %zmm13, %zmm2
vpmaxsq %zmm9, %zmm5, %zmm19
vpminsq %zmm12, %zmm0, %zmm11
vpmaxsq %zmm12, %zmm0, %zmm13
vpshufd $78, %zmm6, %zmm6
vpminsq %zmm9, %zmm5, %zmm0
vpminsq %zmm14, %zmm15, %zmm12
vpminsq %zmm8, %zmm3, %zmm9
vpminsq %zmm10, %zmm17, %zmm5
vpshufd $78, %zmm12, %zmm12
vpmaxsq %zmm10, %zmm17, %zmm10
vpmaxsq %zmm8, %zmm3, %zmm17
vpminsq %zmm7, %zmm16, %zmm3
vpminsq %zmm6, %zmm2, %zmm8
vpshufd $78, %zmm10, %zmm10
vpmaxsq %zmm6, %zmm2, %zmm6
vpmaxsq %zmm14, %zmm15, %zmm14
vpshufd $78, %zmm3, %zmm2
vpminsq %zmm1, %zmm4, %zmm15
vpshufd $78, %zmm17, %zmm3
vpmaxsq %zmm1, %zmm4, %zmm4
vpmaxsq %zmm12, %zmm11, %zmm17
vpmaxsq %zmm7, %zmm16, %zmm7
vpshufd $78, %zmm8, %zmm1
vpshufd $78, %zmm13, %zmm16
vpshufd $78, %zmm15, %zmm8
vpminsq %zmm12, %zmm11, %zmm13
vpshufd $78, %zmm19, %zmm15
vpminsq %zmm2, %zmm5, %zmm11
vpminsq %zmm16, %zmm14, %zmm12
vpminsq %zmm8, %zmm0, %zmm19
vpmaxsq %zmm16, %zmm14, %zmm14
vpshufd $78, %zmm11, %zmm11
vpmaxsq %zmm8, %zmm0, %zmm16
vpminsq %zmm1, %zmm9, %zmm0
vpminsq %zmm15, %zmm4, %zmm8
vpmaxsq %zmm15, %zmm4, %zmm15
vpshufd $78, %zmm0, %zmm4
vpmaxsq %zmm2, %zmm5, %zmm5
vpshufd $78, %zmm16, %zmm0
vpminsq %zmm10, %zmm7, %zmm2
vpshufd $78, %zmm15, %zmm16
vpmaxsq %zmm10, %zmm7, %zmm7
vpminsq %zmm11, %zmm13, %zmm15
vpshufd $78, %zmm17, %zmm10
vpmaxsq %zmm1, %zmm9, %zmm1
vpminsq %zmm3, %zmm6, %zmm9
vpmaxsq %zmm3, %zmm6, %zmm6
vpshufd $78, %zmm14, %zmm3
vpmaxsq %zmm11, %zmm13, %zmm14
vpminsq %zmm10, %zmm5, %zmm11
vpmaxsq %zmm10, %zmm5, %zmm5
vpshufd $78, %zmm15, %zmm10
vpmaxsq %zmm10, %zmm15, %zmm17
vpshufd $78, %zmm2, %zmm2
vpshufd $78, %zmm9, %zmm9
vpminsq %zmm10, %zmm15, %zmm17{%k1}
vpshufd $78, %zmm14, %zmm10
vpminsq %zmm2, %zmm12, %zmm13
vpmaxsq %zmm2, %zmm12, %zmm12
vpminsq %zmm3, %zmm7, %zmm2
vpmaxsq %zmm3, %zmm7, %zmm7
vpminsq %zmm4, %zmm19, %zmm3
vpmaxsq %zmm4, %zmm19, %zmm19
vpminsq %zmm0, %zmm1, %zmm4
vpmaxsq %zmm0, %zmm1, %zmm1
vpminsq %zmm9, %zmm8, %zmm0
vpmaxsq %zmm9, %zmm8, %zmm8
vpminsq %zmm16, %zmm6, %zmm9
vpmaxsq %zmm16, %zmm6, %zmm6
vpmaxsq %zmm10, %zmm14, %zmm16
vpminsq %zmm10, %zmm14, %zmm16{%k1}
vpshufd $78, %zmm11, %zmm10
vpmaxsq %zmm10, %zmm11, %zmm15
vpminsq %zmm10, %zmm11, %zmm15{%k1}
vpshufd $78, %zmm5, %zmm10
vpmaxsq %zmm10, %zmm5, %zmm14
vpminsq %zmm10, %zmm5, %zmm14{%k1}
vpshufd $78, %zmm13, %zmm5
vpmaxsq %zmm5, %zmm13, %zmm11
vpminsq %zmm5, %zmm13, %zmm11{%k1}
vpshufd $78, %zmm12, %zmm5
vpmaxsq %zmm5, %zmm12, %zmm13
vpminsq %zmm5, %zmm12, %zmm13{%k1}
vpshufd $78, %zmm2, %zmm5
vpmaxsq %zmm5, %zmm2, %zmm12
vpminsq %zmm5, %zmm2, %zmm12{%k1}
vpshufd $78, %zmm7, %zmm2
vpmaxsq %zmm2, %zmm7, %zmm10
vpminsq %zmm2, %zmm7, %zmm10{%k1}
vpshufd $78, %zmm3, %zmm2
vpshufd $78, %zmm4, %zmm7
vpmaxsq %zmm2, %zmm3, %zmm5
vpminsq %zmm2, %zmm3, %zmm5{%k1}
vpshufd $78, %zmm19, %zmm2
vpmaxsq %zmm2, %zmm19, %zmm3
vpminsq %zmm2, %zmm19, %zmm3{%k1}
vpmaxsq %zmm7, %zmm4, %zmm2
vpminsq %zmm7, %zmm4, %zmm2{%k1}
vpshufd $78, %zmm1, %zmm7
vpmaxsq %zmm7, %zmm1, %zmm4
vpminsq %zmm7, %zmm1, %zmm4{%k1}
vpshufd $78, %zmm0, %zmm7
vpmaxsq %zmm7, %zmm0, %zmm1
vpminsq %zmm7, %zmm0, %zmm1{%k1}
vpshufd $78, %zmm8, %zmm7
vpmaxsq %zmm7, %zmm8, %zmm0
vpminsq %zmm7, %zmm8, %zmm0{%k1}
vpshufd $78, %zmm9, %zmm7
vpmaxsq %zmm7, %zmm9, %zmm8
vpminsq %zmm7, %zmm9, %zmm8{%k1}
vpshufd $78, %zmm6, %zmm9
vpmaxsq %zmm9, %zmm6, %zmm7
vpminsq %zmm9, %zmm6, %zmm7{%k1}
jbe .L170
vpermq $27, %zmm5, %zmm5
vpermq $27, %zmm3, %zmm3
vpermq $27, %zmm2, %zmm2
movl $51, %r15d
vpermq $27, %zmm4, %zmm4
vpermq $27, %zmm1, %zmm1
kmovb %r15d, %k2
vpermq $27, %zmm0, %zmm0
vpermq $27, %zmm8, %zmm8
vpermq $27, %zmm7, %zmm7
vpminsq %zmm2, %zmm13, %zmm6
cmpq $7, -8(%rsp)
vpminsq %zmm7, %zmm17, %zmm9
vpmaxsq %zmm7, %zmm17, %zmm7
vpermq $27, %zmm6, %zmm6
vpminsq %zmm8, %zmm16, %zmm17
vpmaxsq %zmm8, %zmm16, %zmm8
vpermq $27, %zmm7, %zmm7
vpminsq %zmm0, %zmm15, %zmm16
vpmaxsq %zmm0, %zmm15, %zmm0
vpermq $27, %zmm8, %zmm8
vpminsq %zmm1, %zmm14, %zmm15
vpmaxsq %zmm1, %zmm14, %zmm1
vpermq $27, %zmm0, %zmm0
vpminsq %zmm4, %zmm11, %zmm14
vpmaxsq %zmm4, %zmm11, %zmm4
vpermq $27, %zmm1, %zmm1
vpminsq %zmm3, %zmm12, %zmm11
vpmaxsq %zmm3, %zmm12, %zmm3
vpermq $27, %zmm14, %zmm14
vpminsq %zmm5, %zmm10, %zmm12
vpmaxsq %zmm5, %zmm10, %zmm5
vpermq $27, %zmm11, %zmm10
vpermq $27, %zmm12, %zmm12
vpminsq %zmm7, %zmm5, %zmm11
vpmaxsq %zmm2, %zmm13, %zmm2
vpminsq %zmm12, %zmm9, %zmm19
vpmaxsq %zmm12, %zmm9, %zmm13
vpmaxsq %zmm7, %zmm5, %zmm20
vpminsq %zmm8, %zmm3, %zmm9
vpminsq %zmm10, %zmm17, %zmm5
vpmaxsq %zmm10, %zmm17, %zmm10
vpmaxsq %zmm8, %zmm3, %zmm17
vpminsq %zmm6, %zmm16, %zmm3
vpermq $27, %zmm10, %zmm10
vpminsq %zmm14, %zmm15, %zmm8
vpminsq %zmm0, %zmm2, %zmm7
vpmaxsq %zmm14, %zmm15, %zmm14
vpmaxsq %zmm0, %zmm2, %zmm0
vpermq $27, %zmm3, %zmm2
vpminsq %zmm1, %zmm4, %zmm15
vpmaxsq %zmm1, %zmm4, %zmm12
vpermq $27, %zmm8, %zmm3
vpmaxsq %zmm6, %zmm16, %zmm6
vpermq $27, %zmm13, %zmm1
vpermq $27, %zmm15, %zmm16
vpermq $27, %zmm17, %zmm8
vpminsq %zmm2, %zmm5, %zmm17
vpminsq %zmm3, %zmm19, %zmm13
vpminsq %zmm16, %zmm11, %zmm4
vpermq $27, %zmm7, %zmm7
vpermq $27, %zmm20, %zmm15
vpmaxsq %zmm3, %zmm19, %zmm19
vpmaxsq %zmm16, %zmm11, %zmm20
vpermq $27, %zmm17, %zmm11
vpmaxsq %zmm2, %zmm5, %zmm3
vpminsq %zmm1, %zmm14, %zmm5
vpmaxsq %zmm1, %zmm14, %zmm14
vpminsq %zmm7, %zmm9, %zmm16
vpmaxsq %zmm10, %zmm6, %zmm1
vpminsq %zmm10, %zmm6, %zmm2
vpermq $27, %zmm19, %zmm10
vpermq $27, %zmm14, %zmm6
vpmaxsq %zmm7, %zmm9, %zmm9
vpminsq %zmm11, %zmm13, %zmm14
vpminsq %zmm15, %zmm12, %zmm7
vpmaxsq %zmm15, %zmm12, %zmm15
vpermq $27, %zmm16, %zmm17
vpminsq %zmm8, %zmm0, %zmm12
vpmaxsq %zmm11, %zmm13, %zmm13
vpermq $27, %zmm2, %zmm2
vpminsq %zmm10, %zmm3, %zmm11
vpermq $27, %zmm12, %zmm16
vpmaxsq %zmm10, %zmm3, %zmm3
vpmaxsq %zmm8, %zmm0, %zmm0
vpermq $27, %zmm14, %zmm10
vpermq $27, %zmm20, %zmm8
vpminsq %zmm17, %zmm4, %zmm19
vpmaxsq %zmm17, %zmm4, %zmm4
vpermq $27, %zmm15, %zmm15
vpminsq %zmm8, %zmm9, %zmm17
vpmaxsq %zmm8, %zmm9, %zmm9
vpminsq %zmm16, %zmm7, %zmm8
vpmaxsq %zmm16, %zmm7, %zmm7
vpmaxsq %zmm10, %zmm14, %zmm16
vpminsq %zmm2, %zmm5, %zmm12
vpminsq %zmm10, %zmm14, %zmm16{%k2}
vpermq $27, %zmm13, %zmm10
vpmaxsq %zmm2, %zmm5, %zmm5
vpminsq %zmm6, %zmm1, %zmm2
vpmaxsq %zmm6, %zmm1, %zmm1
vpminsq %zmm15, %zmm0, %zmm6
vpmaxsq %zmm15, %zmm0, %zmm0
vpmaxsq %zmm10, %zmm13, %zmm15
vpminsq %zmm10, %zmm13, %zmm15{%k2}
vpermq $27, %zmm11, %zmm10
vpmaxsq %zmm10, %zmm11, %zmm14
vpminsq %zmm10, %zmm11, %zmm14{%k2}
vpermq $27, %zmm3, %zmm10
vpmaxsq %zmm10, %zmm3, %zmm11
vpminsq %zmm10, %zmm3, %zmm11{%k2}
vpermq $27, %zmm12, %zmm3
vpmaxsq %zmm3, %zmm12, %zmm13
vpminsq %zmm3, %zmm12, %zmm13{%k2}
vpermq $27, %zmm5, %zmm3
vpmaxsq %zmm3, %zmm5, %zmm12
vpminsq %zmm3, %zmm5, %zmm12{%k2}
vpermq $27, %zmm2, %zmm3
vpmaxsq %zmm3, %zmm2, %zmm10
vpminsq %zmm3, %zmm2, %zmm10{%k2}
vpermq $27, %zmm1, %zmm2
vpmaxsq %zmm2, %zmm1, %zmm5
vpminsq %zmm2, %zmm1, %zmm5{%k2}
vpermq $27, %zmm19, %zmm1
vpmaxsq %zmm1, %zmm19, %zmm3
vpminsq %zmm1, %zmm19, %zmm3{%k2}
vpermq $27, %zmm4, %zmm1
vpmaxsq %zmm1, %zmm4, %zmm2
vpminsq %zmm1, %zmm4, %zmm2{%k2}
vpermq $27, %zmm17, %zmm1
vpmaxsq %zmm1, %zmm17, %zmm4
vpminsq %zmm1, %zmm17, %zmm4{%k2}
vpermq $27, %zmm9, %zmm17
vpmaxsq %zmm17, %zmm9, %zmm1
vpminsq %zmm17, %zmm9, %zmm1{%k2}
vpermq $27, %zmm8, %zmm17
vpmaxsq %zmm17, %zmm8, %zmm9
vpminsq %zmm17, %zmm8, %zmm9{%k2}
vpermq $27, %zmm7, %zmm17
vpmaxsq %zmm17, %zmm7, %zmm8
vpminsq %zmm17, %zmm7, %zmm8{%k2}
vpermq $27, %zmm6, %zmm17
vpmaxsq %zmm17, %zmm6, %zmm7
vpminsq %zmm17, %zmm6, %zmm7{%k2}
vpermq $27, %zmm0, %zmm17
vpmaxsq %zmm17, %zmm0, %zmm6
vpminsq %zmm17, %zmm0, %zmm6{%k2}
vpshufd $78, %zmm16, %zmm0
vpmaxsq %zmm0, %zmm16, %zmm17
vpminsq %zmm0, %zmm16, %zmm17{%k1}
vpshufd $78, %zmm15, %zmm0
vpmaxsq %zmm0, %zmm15, %zmm16
vpminsq %zmm0, %zmm15, %zmm16{%k1}
vpshufd $78, %zmm14, %zmm0
vpmaxsq %zmm0, %zmm14, %zmm15
vpminsq %zmm0, %zmm14, %zmm15{%k1}
vpshufd $78, %zmm11, %zmm0
vpmaxsq %zmm0, %zmm11, %zmm14
vpminsq %zmm0, %zmm11, %zmm14{%k1}
vpshufd $78, %zmm13, %zmm0
vpmaxsq %zmm0, %zmm13, %zmm11
vpminsq %zmm0, %zmm13, %zmm11{%k1}
vpshufd $78, %zmm12, %zmm0
vpmaxsq %zmm0, %zmm12, %zmm13
vpminsq %zmm0, %zmm12, %zmm13{%k1}
vpshufd $78, %zmm10, %zmm0
vpmaxsq %zmm0, %zmm10, %zmm12
vpminsq %zmm0, %zmm10, %zmm12{%k1}
vpshufd $78, %zmm5, %zmm0
vpmaxsq %zmm0, %zmm5, %zmm10
vpminsq %zmm0, %zmm5, %zmm10{%k1}
vpshufd $78, %zmm3, %zmm0
vpmaxsq %zmm0, %zmm3, %zmm5
vpminsq %zmm0, %zmm3, %zmm5{%k1}
vpshufd $78, %zmm2, %zmm0
vpmaxsq %zmm0, %zmm2, %zmm3
vpminsq %zmm0, %zmm2, %zmm3{%k1}
vpshufd $78, %zmm4, %zmm0
vpmaxsq %zmm0, %zmm4, %zmm2
vpminsq %zmm0, %zmm4, %zmm2{%k1}
vpshufd $78, %zmm1, %zmm0
vpmaxsq %zmm0, %zmm1, %zmm4
vpminsq %zmm0, %zmm1, %zmm4{%k1}
vpshufd $78, %zmm9, %zmm0
vpmaxsq %zmm0, %zmm9, %zmm1
vpminsq %zmm0, %zmm9, %zmm1{%k1}
vpshufd $78, %zmm8, %zmm9
vpmaxsq %zmm9, %zmm8, %zmm0
vpminsq %zmm9, %zmm8, %zmm0{%k1}
vpshufd $78, %zmm7, %zmm9
vpmaxsq %zmm9, %zmm7, %zmm8
vpminsq %zmm9, %zmm7, %zmm8{%k1}
vpshufd $78, %zmm6, %zmm9
vpmaxsq %zmm9, %zmm6, %zmm7
vpminsq %zmm9, %zmm6, %zmm7{%k1}
jbe .L170
vmovdqa64 .LC2(%rip), %zmm6
movl $65535, %r15d
kmovd %r15d, %k3
vpermq %zmm7, %zmm6, %zmm7
vpermq %zmm5, %zmm6, %zmm5
vpermq %zmm3, %zmm6, %zmm3
vpermq %zmm2, %zmm6, %zmm2
vpermq %zmm4, %zmm6, %zmm4
vpermq %zmm1, %zmm6, %zmm1
vpermq %zmm0, %zmm6, %zmm0
vpermq %zmm8, %zmm6, %zmm8
vpminsq %zmm7, %zmm17, %zmm9
vpmaxsq %zmm7, %zmm17, %zmm19
vpminsq %zmm8, %zmm16, %zmm7
vpmaxsq %zmm8, %zmm16, %zmm8
vpminsq %zmm0, %zmm15, %zmm16
vpmaxsq %zmm0, %zmm15, %zmm0
vpminsq %zmm1, %zmm14, %zmm15
vpermq %zmm8, %zmm6, %zmm8
vpmaxsq %zmm1, %zmm14, %zmm1
vpminsq %zmm4, %zmm11, %zmm14
vpermq %zmm0, %zmm6, %zmm0
vpmaxsq %zmm4, %zmm11, %zmm4
vpminsq %zmm2, %zmm13, %zmm11
vpermq %zmm14, %zmm6, %zmm14
vpmaxsq %zmm2, %zmm13, %zmm2
vpminsq %zmm3, %zmm12, %zmm13
vpermq %zmm11, %zmm6, %zmm11
vpmaxsq %zmm3, %zmm12, %zmm3
vpminsq %zmm5, %zmm10, %zmm12
vpermq %zmm13, %zmm6, %zmm17
vpmaxsq %zmm5, %zmm10, %zmm5
vpermq %zmm19, %zmm6, %zmm13
vpermq %zmm12, %zmm6, %zmm12
vpminsq %zmm12, %zmm9, %zmm10
vpmaxsq %zmm12, %zmm9, %zmm19
vpermq %zmm1, %zmm6, %zmm1
vpminsq %zmm13, %zmm5, %zmm12
vpmaxsq %zmm13, %zmm5, %zmm20
vpminsq %zmm8, %zmm3, %zmm9
vpminsq %zmm17, %zmm7, %zmm13
vpminsq %zmm11, %zmm16, %zmm5
vpmaxsq %zmm17, %zmm7, %zmm7
vpmaxsq %zmm8, %zmm3, %zmm17
vpmaxsq %zmm11, %zmm16, %zmm3
vpermq %zmm19, %zmm6, %zmm11
vpminsq %zmm14, %zmm15, %zmm16
vpminsq %zmm0, %zmm2, %zmm8
vpmaxsq %zmm14, %zmm15, %zmm14
vpermq %zmm16, %zmm6, %zmm16
vpermq %zmm5, %zmm6, %zmm15
vpmaxsq %zmm0, %zmm2, %zmm0
vpminsq %zmm1, %zmm4, %zmm2
vpermq %zmm20, %zmm6, %zmm5
vpminsq %zmm16, %zmm10, %zmm19
vpmaxsq %zmm1, %zmm4, %zmm1
vpermq %zmm7, %zmm6, %zmm4
vpermq %zmm8, %zmm6, %zmm7
vpermq %zmm2, %zmm6, %zmm8
vpermq %zmm17, %zmm6, %zmm2
vpmaxsq %zmm16, %zmm10, %zmm17
vpminsq %zmm15, %zmm13, %zmm16
vpminsq %zmm11, %zmm14, %zmm10
vpmaxsq %zmm15, %zmm13, %zmm13
vpmaxsq %zmm8, %zmm12, %zmm20
vpmaxsq %zmm11, %zmm14, %zmm15
vpermq %zmm16, %zmm6, %zmm11
vpminsq %zmm4, %zmm3, %zmm14
vpmaxsq %zmm5, %zmm1, %zmm22
vpmaxsq %zmm4, %zmm3, %zmm3
vpminsq %zmm2, %zmm0, %zmm21
vpermq %zmm22, %zmm6, %zmm16
vpminsq %zmm8, %zmm12, %zmm4
vpminsq %zmm7, %zmm9, %zmm8
vpermq %zmm17, %zmm6, %zmm12
vpmaxsq %zmm7, %zmm9, %zmm9
vpermq %zmm21, %zmm6, %zmm17
vpminsq %zmm5, %zmm1, %zmm7
vpmaxsq %zmm2, %zmm0, %zmm0
vpermq %zmm14, %zmm6, %zmm5
vpermq %zmm15, %zmm6, %zmm2
vpermq %zmm8, %zmm6, %zmm1
vpminsq %zmm11, %zmm19, %zmm15
vpermq %zmm20, %zmm6, %zmm8
vpmaxsq %zmm11, %zmm19, %zmm14
vpminsq %zmm12, %zmm13, %zmm11
vpmaxsq %zmm12, %zmm13, %zmm13
vpminsq %zmm5, %zmm10, %zmm12
vpmaxsq %zmm5, %zmm10, %zmm10
vpminsq %zmm2, %zmm3, %zmm5
vpmaxsq %zmm2, %zmm3, %zmm3
vpminsq %zmm1, %zmm4, %zmm2
vpmaxsq %zmm1, %zmm4, %zmm4
vpminsq %zmm8, %zmm9, %zmm1
vpmaxsq %zmm8, %zmm9, %zmm9
vpminsq %zmm17, %zmm7, %zmm8
vpmaxsq %zmm17, %zmm7, %zmm7
vpminsq %zmm16, %zmm0, %zmm17
vpmaxsq %zmm16, %zmm0, %zmm0
vpermq %zmm15, %zmm6, %zmm16
vpminsq %zmm16, %zmm15, %zmm19
vpmaxsq %zmm16, %zmm15, %zmm15
vpermq %zmm14, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm15{%k3}
vpminsq %zmm16, %zmm14, %zmm19
vpmaxsq %zmm16, %zmm14, %zmm14
vpermq %zmm11, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm14{%k3}
vpminsq %zmm16, %zmm11, %zmm19
vpmaxsq %zmm16, %zmm11, %zmm11
vpermq %zmm13, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm11{%k3}
vpminsq %zmm16, %zmm13, %zmm19
vpmaxsq %zmm16, %zmm13, %zmm13
vpermq %zmm12, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm13{%k3}
vpminsq %zmm16, %zmm12, %zmm19
vpmaxsq %zmm16, %zmm12, %zmm12
vpermq %zmm10, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm12{%k3}
vpminsq %zmm16, %zmm10, %zmm19
vpmaxsq %zmm16, %zmm10, %zmm10
vpermq %zmm5, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm10{%k3}
vpminsq %zmm16, %zmm5, %zmm19
vpmaxsq %zmm16, %zmm5, %zmm5
vpermq %zmm3, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm5{%k3}
vpminsq %zmm16, %zmm3, %zmm19
vpmaxsq %zmm16, %zmm3, %zmm3
vpermq %zmm2, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm3{%k3}
vpminsq %zmm16, %zmm2, %zmm19
vpmaxsq %zmm16, %zmm2, %zmm2
vpermq %zmm4, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm2{%k3}
vpminsq %zmm16, %zmm4, %zmm19
vpmaxsq %zmm16, %zmm4, %zmm4
vpermq %zmm1, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm4{%k3}
vpminsq %zmm16, %zmm1, %zmm19
vpmaxsq %zmm16, %zmm1, %zmm1
vpermq %zmm9, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm1{%k3}
vpminsq %zmm16, %zmm9, %zmm19
vpmaxsq %zmm16, %zmm9, %zmm9
vpermq %zmm8, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm9{%k3}
vpminsq %zmm16, %zmm8, %zmm19
vpmaxsq %zmm16, %zmm8, %zmm8
vpermq %zmm7, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm8{%k3}
vpminsq %zmm16, %zmm7, %zmm19
vpmaxsq %zmm16, %zmm7, %zmm7
vpermq %zmm17, %zmm6, %zmm16
vpermq %zmm0, %zmm6, %zmm6
vmovdqu16 %zmm19, %zmm7{%k3}
vpminsq %zmm16, %zmm17, %zmm19
vpmaxsq %zmm16, %zmm17, %zmm17
vpminsq %zmm6, %zmm0, %zmm16
vpmaxsq %zmm6, %zmm0, %zmm0
vshufi32x4 $177, %zmm15, %zmm15, %zmm6
vmovdqu16 %zmm16, %zmm0{%k3}
vpmaxsq %zmm15, %zmm6, %zmm16
vmovdqu16 %zmm19, %zmm17{%k3}
vpminsq %zmm15, %zmm6, %zmm16{%k2}
vshufi32x4 $177, %zmm14, %zmm14, %zmm6
vpmaxsq %zmm14, %zmm6, %zmm15
vpminsq %zmm14, %zmm6, %zmm15{%k2}
vshufi32x4 $177, %zmm11, %zmm11, %zmm6
vpmaxsq %zmm11, %zmm6, %zmm14
vpminsq %zmm11, %zmm6, %zmm14{%k2}
vshufi32x4 $177, %zmm13, %zmm13, %zmm6
vpmaxsq %zmm13, %zmm6, %zmm11
vpminsq %zmm13, %zmm6, %zmm11{%k2}
vshufi32x4 $177, %zmm12, %zmm12, %zmm6
vpmaxsq %zmm12, %zmm6, %zmm13
vpminsq %zmm12, %zmm6, %zmm13{%k2}
vshufi32x4 $177, %zmm10, %zmm10, %zmm6
vpmaxsq %zmm10, %zmm6, %zmm12
vpminsq %zmm10, %zmm6, %zmm12{%k2}
vshufi32x4 $177, %zmm5, %zmm5, %zmm6
vpmaxsq %zmm5, %zmm6, %zmm10
vpminsq %zmm5, %zmm6, %zmm10{%k2}
vshufi32x4 $177, %zmm3, %zmm3, %zmm6
vpmaxsq %zmm3, %zmm6, %zmm5
vpminsq %zmm3, %zmm6, %zmm5{%k2}
vshufi32x4 $177, %zmm2, %zmm2, %zmm6
vpmaxsq %zmm2, %zmm6, %zmm3
vpminsq %zmm2, %zmm6, %zmm3{%k2}
vshufi32x4 $177, %zmm4, %zmm4, %zmm6
vpmaxsq %zmm4, %zmm6, %zmm2
vpminsq %zmm4, %zmm6, %zmm2{%k2}
vshufi32x4 $177, %zmm1, %zmm1, %zmm6
vpmaxsq %zmm1, %zmm6, %zmm4
vpminsq %zmm1, %zmm6, %zmm4{%k2}
vshufi32x4 $177, %zmm9, %zmm9, %zmm6
vpmaxsq %zmm9, %zmm6, %zmm1
vpminsq %zmm9, %zmm6, %zmm1{%k2}
vshufi32x4 $177, %zmm8, %zmm8, %zmm6
vpmaxsq %zmm8, %zmm6, %zmm9
vpminsq %zmm8, %zmm6, %zmm9{%k2}
vshufi32x4 $177, %zmm7, %zmm7, %zmm6
vpmaxsq %zmm7, %zmm6, %zmm8
vpminsq %zmm7, %zmm6, %zmm8{%k2}
vshufi32x4 $177, %zmm17, %zmm17, %zmm6
vpmaxsq %zmm17, %zmm6, %zmm7
vpminsq %zmm17, %zmm6, %zmm7{%k2}
vshufi32x4 $177, %zmm0, %zmm0, %zmm17
vpmaxsq %zmm0, %zmm17, %zmm6
vpminsq %zmm0, %zmm17, %zmm6{%k2}
vpshufd $78, %zmm16, %zmm0
vpmaxsq %zmm0, %zmm16, %zmm17
vpminsq %zmm0, %zmm16, %zmm17{%k1}
vpshufd $78, %zmm15, %zmm0
vpmaxsq %zmm0, %zmm15, %zmm16
vpminsq %zmm0, %zmm15, %zmm16{%k1}
vpshufd $78, %zmm14, %zmm0
vpmaxsq %zmm0, %zmm14, %zmm15
vpminsq %zmm0, %zmm14, %zmm15{%k1}
vpshufd $78, %zmm11, %zmm0
vpmaxsq %zmm0, %zmm11, %zmm14
vpminsq %zmm0, %zmm11, %zmm14{%k1}
vpshufd $78, %zmm13, %zmm0
vpmaxsq %zmm0, %zmm13, %zmm11
vpminsq %zmm0, %zmm13, %zmm11{%k1}
vpshufd $78, %zmm12, %zmm0
vpmaxsq %zmm0, %zmm12, %zmm13
vpminsq %zmm0, %zmm12, %zmm13{%k1}
vpshufd $78, %zmm10, %zmm0
vpmaxsq %zmm0, %zmm10, %zmm12
vpminsq %zmm0, %zmm10, %zmm12{%k1}
vpshufd $78, %zmm5, %zmm0
vpmaxsq %zmm0, %zmm5, %zmm10
vpminsq %zmm0, %zmm5, %zmm10{%k1}
vpshufd $78, %zmm3, %zmm0
vpmaxsq %zmm0, %zmm3, %zmm5
vpminsq %zmm0, %zmm3, %zmm5{%k1}
vpshufd $78, %zmm2, %zmm0
vpmaxsq %zmm0, %zmm2, %zmm3
vpminsq %zmm0, %zmm2, %zmm3{%k1}
vpshufd $78, %zmm4, %zmm0
vpmaxsq %zmm0, %zmm4, %zmm2
vpminsq %zmm0, %zmm4, %zmm2{%k1}
vpshufd $78, %zmm1, %zmm0
vpmaxsq %zmm0, %zmm1, %zmm4
vpminsq %zmm0, %zmm1, %zmm4{%k1}
vpshufd $78, %zmm9, %zmm0
vpmaxsq %zmm0, %zmm9, %zmm1
vpminsq %zmm0, %zmm9, %zmm1{%k1}
vpshufd $78, %zmm8, %zmm9
vpmaxsq %zmm9, %zmm8, %zmm0
vpminsq %zmm9, %zmm8, %zmm0{%k1}
vpshufd $78, %zmm7, %zmm9
vpmaxsq %zmm9, %zmm7, %zmm8
vpminsq %zmm9, %zmm7, %zmm8{%k1}
vpshufd $78, %zmm6, %zmm9
vpmaxsq %zmm9, %zmm6, %zmm7
vpminsq %zmm9, %zmm6, %zmm7{%k1}
.L170:
vmovdqu64 %zmm17, (%rdi)
vmovq %xmm18, %rdi
vmovdqu64 %zmm16, (%rdi)
vmovdqu64 %zmm15, (%r14)
vmovdqu64 %zmm14, 0(%r13)
vmovdqu64 %zmm11, (%r12)
vmovdqu64 %zmm13, (%rbx)
vmovq %xmm23, %rbx
vmovdqu64 %zmm12, (%r11)
vmovdqu64 %zmm10, (%r10)
vmovdqu64 %zmm5, (%r9)
vmovdqu64 %zmm3, (%r8)
vmovdqu64 %zmm2, (%rbx)
vmovdqu64 %zmm4, (%rsi)
vmovdqu64 %zmm1, (%rcx)
vmovdqu64 %zmm0, (%rdx)
vmovdqu64 %zmm8, (%rax)
movq -16(%rsp), %rax
vmovdqu64 %zmm7, (%rax)
vzeroupper
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE18788:
.size _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, .-_ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
.section .text._ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18789:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
vmovdqa %ymm0, %ymm3
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
movq %rdx, %r15
pushq %r14
.cfi_offset 14, -32
movq %rsi, %r14
pushq %r13
pushq %r12
.cfi_offset 13, -40
.cfi_offset 12, -48
movq %rdi, %r12
pushq %rbx
andq $-32, %rsp
subq $96, %rsp
.cfi_offset 3, -56
cmpq $3, %rsi
jbe .L187
movl $4, %r13d
xorl %ebx, %ebx
jmp .L178
.p2align 4,,10
.p2align 3
.L174:
vmovmskpd %ymm2, %eax
vmovdqu %ymm3, (%rsi)
popcntq %rax, %rax
addq %rax, %rbx
leaq 4(%r13), %rax
cmpq %r14, %rax
ja .L195
movq %rax, %r13
.L178:
vpcmpeqq -32(%r12,%r13,8), %ymm3, %ymm2
vpcmpeqq -32(%r12,%r13,8), %ymm1, %ymm0
leaq -4(%r13), %rdx
leaq (%r12,%rbx,8), %rsi
vpor %ymm0, %ymm2, %ymm4
vmovmskpd %ymm4, %eax
cmpl $15, %eax
je .L174
vpcmpeqd %ymm3, %ymm3, %ymm3
vpxor %ymm3, %ymm0, %ymm0
vpandn %ymm0, %ymm2, %ymm2
vmovmskpd %ymm2, %eax
tzcntl %eax, %eax
addq %rdx, %rax
vpbroadcastq (%r12,%rax,8), %ymm0
leaq 4(%rbx), %rax
vmovdqa %ymm0, (%r15)
cmpq %rax, %rdx
jb .L175
.p2align 4,,10
.p2align 3
.L176:
vmovdqu %ymm1, -32(%r12,%rax,8)
movq %rax, %rbx
addq $4, %rax
cmpq %rdx, %rax
jbe .L176
.L175:
subq %rbx, %rdx
xorl %eax, %eax
vmovq %rdx, %xmm7
vpbroadcastq %xmm7, %ymm0
vpcmpgtq .LC3(%rip), %ymm0, %ymm0
vpmaskmovq %ymm1, %ymm0, (%r12,%rbx,8)
.L172:
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L195:
.cfi_restore_state
movq %r14, %r8
leaq 0(,%r13,8), %rsi
leaq (%r12,%rbx,8), %r9
subq %r13, %r8
.L173:
testq %r8, %r8
je .L182
leaq 0(,%r8,8), %rdx
addq %r12, %rsi
movq %rcx, %rdi
movq %r9, 80(%rsp)
movq %r8, 88(%rsp)
vmovdqa %ymm1, (%rsp)
vmovdqa %ymm3, 32(%rsp)
vzeroupper
call memcpy@PLT
movq 88(%rsp), %r8
movq 80(%rsp), %r9
vmovdqa 32(%rsp), %ymm3
vmovdqa (%rsp), %ymm1
movq %rax, %rcx
.L182:
vmovdqa (%rcx), %ymm0
vmovq %r8, %xmm6
vmovdqa .LC3(%rip), %ymm5
vpbroadcastq %xmm6, %ymm2
vpcmpeqq %ymm3, %ymm0, %ymm4
vpcmpgtq %ymm5, %ymm2, %ymm2
vpcmpeqq %ymm1, %ymm0, %ymm0
vpand %ymm2, %ymm4, %ymm7
vpor %ymm4, %ymm0, %ymm0
vpcmpeqd %ymm4, %ymm4, %ymm4
vpxor %ymm4, %ymm2, %ymm6
vpor %ymm6, %ymm0, %ymm0
vmovmskpd %ymm0, %eax
cmpl $15, %eax
jne .L196
vmovmskpd %ymm7, %edx
vpmaskmovq %ymm3, %ymm2, (%r9)
popcntq %rdx, %rdx
addq %rbx, %rdx
leaq 4(%rdx), %rax
cmpq %rax, %r14
jb .L185
.p2align 4,,10
.p2align 3
.L186:
vmovdqu %ymm1, -32(%r12,%rax,8)
movq %rax, %rdx
addq $4, %rax
cmpq %rax, %r14
jnb .L186
.L185:
subq %rdx, %r14
movl $1, %eax
vmovq %r14, %xmm6
vpbroadcastq %xmm6, %ymm0
vpcmpgtq %ymm5, %ymm0, %ymm0
vpmaskmovq %ymm1, %ymm0, (%r12,%rdx,8)
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.L187:
.cfi_restore_state
movq %rsi, %r8
movq %rdi, %r9
xorl %esi, %esi
xorl %ebx, %ebx
xorl %r13d, %r13d
jmp .L173
.L196:
vpxor %ymm4, %ymm0, %ymm0
vmovmskpd %ymm0, %eax
tzcntl %eax, %eax
addq %r13, %rax
vpbroadcastq (%r12,%rax,8), %ymm0
leaq 4(%rbx), %rax
vmovdqa %ymm0, (%r15)
cmpq %r13, %rax
ja .L183
.p2align 4,,10
.p2align 3
.L184:
vmovdqu %ymm1, -32(%r12,%rax,8)
movq %rax, %rbx
leaq 4(%rax), %rax
cmpq %r13, %rax
jbe .L184
leaq (%r12,%rbx,8), %r9
.L183:
subq %rbx, %r13
xorl %eax, %eax
vmovq %r13, %xmm7
vpbroadcastq %xmm7, %ymm0
vpcmpgtq %ymm5, %ymm0, %ymm0
vpmaskmovq %ymm1, %ymm0, (%r9)
jmp .L172
.cfi_endproc
.LFE18789:
.size _ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, @function
_ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0:
.LFB18790:
.cfi_startproc
cmpq %rdx, %rsi
jbe .L210
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r8
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rax, %rsi
jbe .L210
movq (%rdi,%rdx,8), %r11
vmovq %r11, %xmm4
vpunpcklqdq %xmm4, %xmm4, %xmm0
jmp .L200
.p2align 4,,10
.p2align 3
.L201:
cmpq %rcx, %rsi
jbe .L210
movq %rdx, %rax
.L206:
salq $4, %r8
vmovddup (%rdi,%r8), %xmm1
vpcmpgtq %xmm3, %xmm1, %xmm1
vmovmskpd %xmm1, %r8d
andl $1, %r8d
jne .L203
.L202:
cmpq %rdx, %rax
je .L210
leaq (%rdi,%rax,8), %rdx
movq (%rdx), %rcx
movq %rcx, (%r10)
movq %r11, (%rdx)
cmpq %rax, %rsi
jbe .L211
movq %rax, %rdx
.L204:
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r8
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rsi, %rax
jnb .L210
.L200:
vmovddup (%rdi,%rax,8), %xmm1
vpcmpgtq %xmm0, %xmm1, %xmm2
leaq (%rdi,%rdx,8), %r10
vmovdqa %xmm0, %xmm3
vmovmskpd %xmm2, %r9d
andl $1, %r9d
je .L201
cmpq %rcx, %rsi
jbe .L202
vmovdqa %xmm1, %xmm3
jmp .L206
.p2align 4,,10
.p2align 3
.L203:
cmpq %rdx, %rcx
je .L212
leaq (%rdi,%rcx,8), %rax
movq (%rax), %rdx
movq %rdx, (%r10)
movq %rcx, %rdx
movq %r11, (%rax)
jmp .L204
.p2align 4,,10
.p2align 3
.L210:
ret
.p2align 4,,10
.p2align 3
.L211:
ret
.L212:
ret
.cfi_endproc
.LFE18790:
.size _ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, .-_ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
.section .text._ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18791:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movdqa %xmm0, %xmm3
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
movq %rdx, %r15
pushq %r14
.cfi_offset 14, -32
movq %rsi, %r14
pushq %r13
.cfi_offset 13, -40
movq %rdi, %r13
pushq %r12
pushq %rbx
subq $56, %rsp
.cfi_offset 12, -48
.cfi_offset 3, -56
cmpq $1, %rsi
jbe .L236
movl $2, %r12d
xorl %ebx, %ebx
jmp .L221
.p2align 4,,10
.p2align 3
.L215:
movmskpd %xmm2, %eax
movups %xmm3, 0(%r13,%rbx,8)
popcntq %rax, %rax
addq %rax, %rbx
leaq 2(%r12), %rax
cmpq %r14, %rax
ja .L268
movq %rax, %r12
.L221:
movdqu -16(%r13,%r12,8), %xmm2
movdqu -16(%r13,%r12,8), %xmm0
leaq -2(%r12), %rdx
leaq 0(,%rbx,8), %rax
pcmpeqq %xmm3, %xmm2
pcmpeqq %xmm1, %xmm0
movdqa %xmm2, %xmm4
por %xmm0, %xmm4
movmskpd %xmm4, %esi
cmpl $3, %esi
je .L215
pcmpeqd %xmm3, %xmm3
leaq 2(%rbx), %rdi
pxor %xmm3, %xmm0
pandn %xmm0, %xmm2
movmskpd %xmm2, %ecx
rep bsfl %ecx, %ecx
movslq %ecx, %rcx
addq %rdx, %rcx
movddup 0(%r13,%rcx,8), %xmm0
movaps %xmm0, (%r15)
cmpq %rdx, %rdi
ja .L216
movq %rdx, %rcx
addq %r13, %rax
subq %rbx, %rcx
leaq -2(%rcx), %rsi
movq %rsi, %rcx
andq $-2, %rcx
addq %rbx, %rcx
leaq 16(%r13,%rcx,8), %rcx
.p2align 4,,10
.p2align 3
.L217:
movups %xmm1, (%rax)
addq $16, %rax
cmpq %rcx, %rax
jne .L217
andq $-2, %rsi
leaq (%rsi,%rdi), %rbx
.L216:
subq %rbx, %rdx
leaq 0(,%rbx,8), %rcx
movq %rdx, %xmm0
punpcklqdq %xmm0, %xmm0
pcmpgtq .LC0(%rip), %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L218
movq %xmm1, 0(%r13,%rbx,8)
.L218:
pextrq $1, %xmm0, %rax
testq %rax, %rax
jne .L269
.L229:
addq $56, %rsp
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L269:
.cfi_restore_state
pextrq $1, %xmm1, 8(%r13,%rcx)
jmp .L229
.p2align 4,,10
.p2align 3
.L268:
movq %r14, %r8
leaq 0(,%r12,8), %rsi
leaq 0(,%rbx,8), %r9
subq %r12, %r8
.L214:
testq %r8, %r8
je .L225
leaq 0(,%r8,8), %rdx
movq %rcx, %rdi
addq %r13, %rsi
movq %r9, -64(%rbp)
movq %r8, -56(%rbp)
movaps %xmm1, -96(%rbp)
movaps %xmm3, -80(%rbp)
call memcpy@PLT
movq -56(%rbp), %r8
movq -64(%rbp), %r9
movdqa -80(%rbp), %xmm3
movdqa -96(%rbp), %xmm1
movq %rax, %rcx
.L225:
movdqa (%rcx), %xmm0
movdqa .LC0(%rip), %xmm4
movq %r8, %xmm2
punpcklqdq %xmm2, %xmm2
movdqa %xmm0, %xmm5
pcmpgtq %xmm4, %xmm2
pcmpeqq %xmm3, %xmm5
pcmpeqq %xmm1, %xmm0
movdqa %xmm2, %xmm6
movdqa %xmm5, %xmm7
por %xmm5, %xmm0
pcmpeqd %xmm5, %xmm5
pxor %xmm5, %xmm6
pand %xmm2, %xmm7
por %xmm6, %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
jne .L270
movq %xmm2, %rax
testq %rax, %rax
je .L230
movq %xmm3, 0(%r13,%r9)
.L230:
pextrq $1, %xmm2, %rax
testq %rax, %rax
jne .L271
.L231:
movmskpd %xmm7, %edx
popcntq %rdx, %rdx
addq %rbx, %rdx
leaq 2(%rdx), %rax
cmpq %rax, %r14
jb .L232
.p2align 4,,10
.p2align 3
.L233:
movups %xmm1, -16(%r13,%rax,8)
movq %rax, %rdx
addq $2, %rax
cmpq %rax, %r14
jnb .L233
.L232:
subq %rdx, %r14
leaq 0(,%rdx,8), %rcx
movq %r14, %xmm0
punpcklqdq %xmm0, %xmm0
pcmpgtq %xmm4, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L234
movq %xmm1, 0(%r13,%rdx,8)
.L234:
pextrq $1, %xmm0, %rax
testq %rax, %rax
je .L235
pextrq $1, %xmm1, 8(%r13,%rcx)
.L235:
addq $56, %rsp
movl $1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L271:
.cfi_restore_state
pextrq $1, %xmm3, 8(%r13,%r9)
jmp .L231
.L236:
movq %rsi, %r8
xorl %r9d, %r9d
xorl %esi, %esi
xorl %ebx, %ebx
xorl %r12d, %r12d
jmp .L214
.L270:
pxor %xmm5, %xmm0
leaq 2(%rbx), %rsi
movmskpd %xmm0, %eax
rep bsfl %eax, %eax
cltq
addq %r12, %rax
movddup 0(%r13,%rax,8), %xmm0
movaps %xmm0, (%r15)
cmpq %r12, %rsi
ja .L226
leaq -2(%r12), %rcx
leaq 0(%r13,%rbx,8), %rax
subq %rbx, %rcx
movq %rcx, %rdx
andq $-2, %rdx
addq %rbx, %rdx
leaq 16(%r13,%rdx,8), %rdx
.p2align 4,,10
.p2align 3
.L227:
movups %xmm1, (%rax)
addq $16, %rax
cmpq %rax, %rdx
jne .L227
andq $-2, %rcx
leaq (%rcx,%rsi), %rbx
leaq 0(,%rbx,8), %r9
.L226:
subq %rbx, %r12
movq %r12, %xmm0
punpcklqdq %xmm0, %xmm0
pcmpgtq %xmm4, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L228
movq %xmm1, 0(%r13,%r9)
.L228:
pextrq $1, %xmm0, %rax
testq %rax, %rax
je .L229
pextrq $1, %xmm1, 8(%r13,%r9)
jmp .L229
.cfi_endproc
.LFE18791:
.size _ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, @function
_ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0:
.LFB18792:
.cfi_startproc
cmpq %rdx, %rsi
jbe .L272
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r8
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rax, %rsi
jbe .L272
movq (%rdi,%rdx,8), %r11
movq %r11, %xmm4
movddup %xmm4, %xmm0
jmp .L275
.p2align 4,,10
.p2align 3
.L276:
cmpq %rcx, %rsi
jbe .L272
movq %rdx, %rax
.L281:
salq $4, %r8
movddup (%rdi,%r8), %xmm1
pcmpgtq %xmm3, %xmm1
movmskpd %xmm1, %r8d
andl $1, %r8d
jne .L278
.L277:
cmpq %rdx, %rax
je .L272
leaq (%rdi,%rax,8), %rdx
movq (%rdx), %rcx
movq %rcx, (%r10)
movq %r11, (%rdx)
cmpq %rax, %rsi
jbe .L285
movq %rax, %rdx
.L279:
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r8
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rsi, %rax
jnb .L272
.L275:
movddup (%rdi,%rax,8), %xmm1
movdqa %xmm1, %xmm2
leaq (%rdi,%rdx,8), %r10
movdqa %xmm0, %xmm3
pcmpgtq %xmm0, %xmm2
movmskpd %xmm2, %r9d
andl $1, %r9d
je .L276
cmpq %rcx, %rsi
jbe .L277
movdqa %xmm1, %xmm3
jmp .L281
.p2align 4,,10
.p2align 3
.L278:
cmpq %rdx, %rcx
je .L286
leaq (%rdi,%rcx,8), %rax
movq (%rax), %rdx
movq %rdx, (%r10)
movq %rcx, %rdx
movq %r11, (%rax)
jmp .L279
.p2align 4,,10
.p2align 3
.L272:
ret
.p2align 4,,10
.p2align 3
.L285:
ret
.L286:
ret
.cfi_endproc
.LFE18792:
.size _ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, .-_ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
.section .text._ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, @function
_ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0:
.LFB18793:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %rax
salq $3, %rax
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq (%rdi,%rax), %r15
pushq %r14
.cfi_offset 14, -32
leaq (%r15,%rax), %r14
pushq %r13
.cfi_offset 13, -40
leaq (%r14,%rax), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%rax), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%rax), %rbx
leaq (%rbx,%rax), %r11
leaq (%r11,%rax), %r10
addq $-128, %rsp
leaq (%r10,%rax), %r9
leaq (%r9,%rax), %r8
movq %rdi, -136(%rbp)
movq %rsi, -160(%rbp)
movdqu (%r15), %xmm14
movdqu (%rdi), %xmm7
leaq (%r8,%rax), %rdi
movdqu 0(%r13), %xmm3
movdqu (%r14), %xmm8
leaq (%rdi,%rax), %rsi
movdqa %xmm14, %xmm0
movdqa %xmm14, %xmm12
movdqu (%rbx), %xmm13
movdqu (%r12), %xmm1
pcmpgtq %xmm7, %xmm0
movdqu (%r10), %xmm11
movdqu (%r11), %xmm6
leaq (%rsi,%rax), %rcx
movdqu (%r8), %xmm10
leaq (%rcx,%rax), %rdx
movdqu (%rsi), %xmm2
movdqu (%rdx), %xmm4
movdqu (%rdi), %xmm5
movq %rdx, -120(%rbp)
addq %rax, %rdx
pblendvb %xmm0, %xmm7, %xmm12
addq %rdx, %rax
movdqu (%rcx), %xmm15
movq %rdx, -128(%rbp)
pblendvb %xmm0, %xmm14, %xmm7
movdqa %xmm3, %xmm0
movdqa %xmm3, %xmm14
movaps %xmm12, -80(%rbp)
pcmpgtq %xmm8, %xmm0
movdqu (%r9), %xmm12
movdqu (%rax), %xmm9
movaps %xmm4, -64(%rbp)
movdqu (%rdx), %xmm4
pblendvb %xmm0, %xmm8, %xmm14
pblendvb %xmm0, %xmm3, %xmm8
movdqa %xmm13, %xmm0
pcmpgtq %xmm1, %xmm0
movdqa %xmm13, %xmm3
pblendvb %xmm0, %xmm1, %xmm3
pblendvb %xmm0, %xmm13, %xmm1
movdqa %xmm11, %xmm0
pcmpgtq %xmm6, %xmm0
movdqa %xmm11, %xmm13
pblendvb %xmm0, %xmm6, %xmm13
pblendvb %xmm0, %xmm11, %xmm6
movdqu (%r9), %xmm11
movdqa %xmm10, %xmm0
pcmpgtq %xmm11, %xmm0
movdqa %xmm10, %xmm11
pblendvb %xmm0, %xmm12, %xmm11
movaps %xmm11, -96(%rbp)
movdqa %xmm12, %xmm11
movdqa -80(%rbp), %xmm12
pblendvb %xmm0, %xmm10, %xmm11
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm10
pcmpgtq %xmm5, %xmm0
movaps %xmm11, -112(%rbp)
pblendvb %xmm0, %xmm5, %xmm10
pblendvb %xmm0, %xmm2, %xmm5
movdqa %xmm10, %xmm11
movdqa -64(%rbp), %xmm10
movdqa %xmm10, %xmm0
movdqa %xmm10, %xmm2
pcmpgtq %xmm15, %xmm0
pblendvb %xmm0, %xmm15, %xmm2
pblendvb %xmm0, %xmm10, %xmm15
movdqa %xmm9, %xmm0
pcmpgtq %xmm4, %xmm0
movdqa %xmm9, %xmm10
pblendvb %xmm0, %xmm4, %xmm10
pblendvb %xmm0, %xmm9, %xmm4
movdqa %xmm14, %xmm0
pcmpgtq %xmm12, %xmm0
movdqa %xmm14, %xmm9
pblendvb %xmm0, %xmm12, %xmm9
pblendvb %xmm0, %xmm14, %xmm12
movdqa %xmm8, %xmm0
pcmpgtq %xmm7, %xmm0
movdqa %xmm8, %xmm14
pblendvb %xmm0, %xmm7, %xmm14
pblendvb %xmm0, %xmm8, %xmm7
movdqa %xmm13, %xmm0
pcmpgtq %xmm3, %xmm0
movaps %xmm7, -176(%rbp)
movdqa %xmm13, %xmm7
movdqa %xmm6, %xmm8
pblendvb %xmm0, %xmm3, %xmm7
pblendvb %xmm0, %xmm13, %xmm3
movdqa %xmm6, %xmm0
movdqa -96(%rbp), %xmm13
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm1, %xmm8
pblendvb %xmm0, %xmm6, %xmm1
movdqa %xmm11, %xmm0
pcmpgtq %xmm13, %xmm0
movdqa %xmm11, %xmm6
movaps %xmm1, -64(%rbp)
movdqa %xmm5, %xmm1
pblendvb %xmm0, %xmm13, %xmm6
pblendvb %xmm0, %xmm11, %xmm13
movdqa %xmm5, %xmm0
movdqa -112(%rbp), %xmm11
pcmpgtq %xmm11, %xmm0
pblendvb %xmm0, %xmm11, %xmm1
pblendvb %xmm0, %xmm5, %xmm11
movdqa %xmm10, %xmm0
pcmpgtq %xmm2, %xmm0
movdqa %xmm10, %xmm5
movaps %xmm11, -80(%rbp)
movdqa -176(%rbp), %xmm11
movaps %xmm1, -96(%rbp)
pblendvb %xmm0, %xmm2, %xmm5
pblendvb %xmm0, %xmm10, %xmm2
movdqa %xmm4, %xmm0
pcmpgtq %xmm15, %xmm0
movdqa %xmm4, %xmm10
pblendvb %xmm0, %xmm15, %xmm10
pblendvb %xmm0, %xmm4, %xmm15
movdqa %xmm7, %xmm0
pcmpgtq %xmm9, %xmm0
movdqa %xmm7, %xmm4
pblendvb %xmm0, %xmm9, %xmm4
pblendvb %xmm0, %xmm7, %xmm9
movdqa %xmm8, %xmm0
pcmpgtq %xmm14, %xmm0
movdqa %xmm8, %xmm7
pblendvb %xmm0, %xmm14, %xmm7
pblendvb %xmm0, %xmm8, %xmm14
movdqa %xmm3, %xmm0
pcmpgtq %xmm12, %xmm0
movdqa %xmm3, %xmm8
pblendvb %xmm0, %xmm12, %xmm8
pblendvb %xmm0, %xmm3, %xmm12
movdqa -64(%rbp), %xmm3
movdqa %xmm3, %xmm0
movdqa %xmm3, %xmm1
pcmpgtq %xmm11, %xmm0
pblendvb %xmm0, %xmm11, %xmm1
pblendvb %xmm0, -64(%rbp), %xmm11
movdqa %xmm5, %xmm0
pcmpgtq %xmm6, %xmm0
movdqa %xmm1, %xmm3
movaps %xmm11, -112(%rbp)
movdqa %xmm5, %xmm1
movdqa -96(%rbp), %xmm11
pblendvb %xmm0, %xmm6, %xmm1
pblendvb %xmm0, %xmm5, %xmm6
movdqa %xmm10, %xmm0
pcmpgtq %xmm11, %xmm0
movdqa %xmm10, %xmm5
pblendvb %xmm0, %xmm11, %xmm5
pblendvb %xmm0, %xmm10, %xmm11
movdqa %xmm2, %xmm0
pcmpgtq %xmm13, %xmm0
movdqa %xmm2, %xmm10
movaps %xmm11, -64(%rbp)
movdqa %xmm15, %xmm11
pblendvb %xmm0, %xmm13, %xmm10
pblendvb %xmm0, %xmm2, %xmm13
movdqa -80(%rbp), %xmm2
movdqa %xmm15, %xmm0
pcmpgtq %xmm2, %xmm0
pblendvb %xmm0, %xmm2, %xmm11
movdqa %xmm11, %xmm2
movdqa -80(%rbp), %xmm11
pblendvb %xmm0, %xmm15, %xmm11
movdqa %xmm1, %xmm0
movdqa %xmm1, %xmm15
pcmpgtq %xmm4, %xmm0
pblendvb %xmm0, %xmm4, %xmm15
pblendvb %xmm0, %xmm1, %xmm4
movdqa %xmm5, %xmm0
pcmpgtq %xmm7, %xmm0
movaps %xmm15, -80(%rbp)
movdqa %xmm10, %xmm1
movaps %xmm15, -256(%rbp)
movdqa %xmm5, %xmm15
pblendvb %xmm0, %xmm7, %xmm15
pblendvb %xmm0, %xmm5, %xmm7
movdqa %xmm10, %xmm0
pcmpgtq %xmm8, %xmm0
movdqa %xmm2, %xmm5
pblendvb %xmm0, %xmm8, %xmm1
pblendvb %xmm0, %xmm10, %xmm8
movdqa %xmm2, %xmm0
pcmpgtq %xmm3, %xmm0
movdqa %xmm14, %xmm10
pblendvb %xmm0, %xmm3, %xmm5
pblendvb %xmm0, %xmm2, %xmm3
movdqa %xmm6, %xmm0
pcmpgtq %xmm9, %xmm0
movdqa %xmm6, %xmm2
pblendvb %xmm0, %xmm9, %xmm2
pblendvb %xmm0, %xmm6, %xmm9
movdqa -64(%rbp), %xmm6
movdqa %xmm6, %xmm0
pcmpgtq %xmm14, %xmm0
pblendvb %xmm0, -64(%rbp), %xmm10
pblendvb %xmm0, %xmm14, %xmm6
movdqa %xmm13, %xmm0
pcmpgtq %xmm12, %xmm0
movdqa %xmm13, %xmm14
pblendvb %xmm0, %xmm12, %xmm14
pblendvb %xmm0, %xmm13, %xmm12
movdqa %xmm11, %xmm0
movaps %xmm14, -64(%rbp)
movdqa %xmm11, %xmm14
movdqa -112(%rbp), %xmm11
movdqa %xmm14, %xmm13
pcmpgtq %xmm11, %xmm0
pblendvb %xmm0, %xmm11, %xmm13
pblendvb %xmm0, %xmm14, %xmm11
movdqa %xmm8, %xmm0
pcmpgtq %xmm6, %xmm0
movaps %xmm11, -176(%rbp)
movdqa %xmm8, %xmm14
movdqa -64(%rbp), %xmm11
pblendvb %xmm0, %xmm6, %xmm14
pblendvb %xmm0, %xmm8, %xmm6
movdqa %xmm7, %xmm0
pcmpgtq %xmm11, %xmm0
movdqa %xmm7, %xmm8
pblendvb %xmm0, %xmm11, %xmm8
pblendvb %xmm0, %xmm7, %xmm11
movdqa %xmm9, %xmm0
pcmpgtq %xmm5, %xmm0
movdqa %xmm9, %xmm7
pblendvb %xmm0, %xmm5, %xmm7
pblendvb %xmm0, %xmm9, %xmm5
movdqa %xmm3, %xmm0
pcmpgtq %xmm13, %xmm0
movdqa %xmm3, %xmm9
pblendvb %xmm0, %xmm13, %xmm9
pblendvb %xmm0, %xmm3, %xmm13
movdqa %xmm12, %xmm0
pcmpgtq %xmm10, %xmm0
movdqa %xmm12, %xmm3
pblendvb %xmm0, %xmm10, %xmm3
pblendvb %xmm0, %xmm12, %xmm10
movdqa %xmm4, %xmm0
pcmpgtq %xmm2, %xmm0
movdqa %xmm4, %xmm12
pblendvb %xmm0, %xmm2, %xmm12
pblendvb %xmm0, %xmm4, %xmm2
movdqa %xmm1, %xmm0
pcmpgtq %xmm15, %xmm0
movdqa %xmm1, %xmm4
pblendvb %xmm0, %xmm15, %xmm4
pblendvb %xmm0, %xmm1, %xmm15
movdqa %xmm12, %xmm0
pcmpgtq %xmm4, %xmm0
movdqa %xmm12, %xmm1
pblendvb %xmm0, %xmm4, %xmm1
pblendvb %xmm0, %xmm12, %xmm4
movdqa %xmm3, %xmm0
pcmpgtq %xmm9, %xmm0
movdqa %xmm3, %xmm12
movaps %xmm1, -272(%rbp)
movaps %xmm1, -64(%rbp)
movdqa %xmm2, %xmm1
pblendvb %xmm0, %xmm9, %xmm12
pblendvb %xmm0, %xmm3, %xmm9
movdqa %xmm2, %xmm0
pcmpgtq %xmm15, %xmm0
movdqa %xmm4, %xmm3
pblendvb %xmm0, %xmm15, %xmm1
pblendvb %xmm0, %xmm2, %xmm15
movdqa %xmm10, %xmm0
pcmpgtq %xmm13, %xmm0
movdqa %xmm10, %xmm2
pblendvb %xmm0, %xmm13, %xmm2
pblendvb %xmm0, %xmm10, %xmm13
movdqa %xmm4, %xmm0
pcmpgtq %xmm1, %xmm0
movaps %xmm13, -192(%rbp)
movdqa %xmm8, %xmm10
pblendvb %xmm0, %xmm1, %xmm3
pblendvb %xmm0, %xmm4, %xmm1
movdqa %xmm8, %xmm0
pcmpgtq %xmm14, %xmm0
movdqa %xmm1, %xmm13
movdqa %xmm14, %xmm1
movaps %xmm3, -288(%rbp)
movdqa %xmm11, %xmm4
movaps %xmm3, -96(%rbp)
movdqa %xmm15, %xmm3
pblendvb %xmm0, %xmm14, %xmm10
pblendvb %xmm0, %xmm8, %xmm1
movdqa %xmm6, %xmm0
pcmpgtq %xmm11, %xmm0
movdqa %xmm6, %xmm8
pblendvb %xmm0, %xmm6, %xmm4
pblendvb %xmm0, %xmm11, %xmm8
movdqa %xmm9, %xmm0
pcmpgtq %xmm2, %xmm0
movdqa %xmm9, %xmm6
movdqa %xmm8, %xmm11
pblendvb %xmm0, %xmm2, %xmm6
pblendvb %xmm0, %xmm9, %xmm2
movdqa %xmm15, %xmm0
pcmpgtq %xmm7, %xmm0
movaps %xmm2, -224(%rbp)
movdqa %xmm5, %xmm2
movdqa %xmm13, %xmm9
movaps %xmm6, -208(%rbp)
pblendvb %xmm0, %xmm7, %xmm3
pblendvb %xmm0, %xmm15, %xmm7
movdqa %xmm5, %xmm0
pcmpgtq %xmm12, %xmm0
pblendvb %xmm0, %xmm12, %xmm2
pblendvb %xmm0, %xmm5, %xmm12
movdqa %xmm10, %xmm0
pcmpgtq %xmm3, %xmm0
movdqa %xmm10, %xmm5
movdqa %xmm2, %xmm6
movdqa %xmm7, %xmm2
pblendvb %xmm0, %xmm3, %xmm5
pblendvb %xmm0, %xmm10, %xmm3
movdqa %xmm7, %xmm0
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm1, %xmm2
pblendvb %xmm0, %xmm7, %xmm1
movdqa %xmm8, %xmm0
pcmpgtq %xmm6, %xmm0
movdqa %xmm12, %xmm7
movdqa %xmm2, %xmm14
pblendvb %xmm0, %xmm6, %xmm11
pblendvb %xmm0, %xmm8, %xmm6
movdqa %xmm12, %xmm0
pcmpgtq %xmm4, %xmm0
pblendvb %xmm0, %xmm4, %xmm7
pblendvb %xmm0, %xmm12, %xmm4
movdqa %xmm13, %xmm0
pcmpgtq %xmm5, %xmm0
pblendvb %xmm0, %xmm5, %xmm9
pblendvb %xmm0, %xmm13, %xmm5
movdqa %xmm2, %xmm0
pcmpgtq %xmm3, %xmm0
movdqa %xmm5, %xmm10
movdqa %xmm5, %xmm15
movaps %xmm9, -112(%rbp)
movdqa %xmm7, %xmm5
cmpq $1, -160(%rbp)
pblendvb %xmm0, %xmm3, %xmm14
pblendvb %xmm0, %xmm2, %xmm3
movdqa %xmm1, %xmm0
pcmpgtq %xmm11, %xmm0
movdqa %xmm1, %xmm2
pblendvb %xmm0, %xmm11, %xmm2
pblendvb %xmm0, %xmm1, %xmm11
movdqa %xmm7, %xmm0
pcmpgtq %xmm6, %xmm0
movdqa %xmm6, %xmm1
movdqa %xmm2, %xmm13
pblendvb %xmm0, %xmm6, %xmm5
movdqa -208(%rbp), %xmm6
pblendvb %xmm0, %xmm7, %xmm1
movdqa %xmm4, %xmm0
movaps %xmm1, -240(%rbp)
movdqa %xmm4, %xmm1
pcmpgtq %xmm6, %xmm0
movdqa %xmm6, %xmm7
pblendvb %xmm0, %xmm4, %xmm7
pblendvb %xmm0, %xmm6, %xmm1
movdqa %xmm2, %xmm0
pcmpgtq %xmm3, %xmm0
movdqa %xmm5, %xmm4
pblendvb %xmm0, %xmm3, %xmm13
pblendvb %xmm0, %xmm2, %xmm3
movdqa %xmm5, %xmm0
pcmpgtq %xmm11, %xmm0
pblendvb %xmm0, %xmm11, %xmm4
pblendvb %xmm0, %xmm5, %xmm11
jbe .L291
movdqa -256(%rbp), %xmm12
pshufd $78, %xmm7, %xmm7
pshufd $78, -176(%rbp), %xmm6
movdqa %xmm6, %xmm0
movdqa %xmm6, %xmm15
pshufd $78, %xmm1, %xmm1
pshufd $78, %xmm11, %xmm11
pshufd $78, -192(%rbp), %xmm2
pcmpgtq %xmm12, %xmm0
pshufd $78, %xmm4, %xmm4
pshufd $78, -224(%rbp), %xmm5
pshufd $78, -240(%rbp), %xmm8
pblendvb %xmm0, %xmm12, %xmm15
pblendvb %xmm0, %xmm6, %xmm12
movdqa %xmm2, %xmm0
movaps %xmm12, -64(%rbp)
movdqa %xmm2, %xmm6
movdqa -272(%rbp), %xmm12
pcmpgtq %xmm12, %xmm0
pblendvb %xmm0, %xmm12, %xmm6
pblendvb %xmm0, %xmm2, %xmm12
movdqa %xmm5, %xmm0
movdqa -288(%rbp), %xmm2
movaps %xmm12, -80(%rbp)
movdqa %xmm5, %xmm12
pcmpgtq %xmm2, %xmm0
pblendvb %xmm0, %xmm2, %xmm12
pblendvb %xmm0, %xmm5, %xmm2
movdqa %xmm7, %xmm0
pcmpgtq %xmm9, %xmm0
movdqa %xmm7, %xmm5
movaps %xmm12, -96(%rbp)
pblendvb %xmm0, %xmm9, %xmm5
pblendvb %xmm0, %xmm7, %xmm9
movdqa %xmm1, %xmm0
pcmpgtq %xmm10, %xmm0
movdqa %xmm1, %xmm7
movaps %xmm5, -112(%rbp)
pshufd $78, %xmm9, %xmm5
pshufd $78, %xmm2, %xmm9
pblendvb %xmm0, %xmm10, %xmm7
pblendvb %xmm0, %xmm1, %xmm10
movdqa %xmm8, %xmm0
pcmpgtq %xmm14, %xmm0
movdqa %xmm8, %xmm1
pshufd $78, %xmm7, %xmm7
movaps %xmm10, -160(%rbp)
pblendvb %xmm0, %xmm14, %xmm1
movdqa %xmm1, %xmm10
movdqa %xmm14, %xmm1
movdqa %xmm4, %xmm14
pblendvb %xmm0, %xmm8, %xmm1
movdqa %xmm11, %xmm0
movdqa %xmm11, %xmm8
pcmpgtq %xmm13, %xmm0
pshufd $78, %xmm10, %xmm10
pblendvb %xmm0, %xmm13, %xmm8
pblendvb %xmm0, %xmm11, %xmm13
movdqa %xmm4, %xmm0
pshufd $78, -80(%rbp), %xmm11
pcmpgtq %xmm3, %xmm0
pshufd $78, %xmm8, %xmm8
pblendvb %xmm0, %xmm3, %xmm14
pblendvb %xmm0, %xmm4, %xmm3
pshufd $78, -64(%rbp), %xmm4
pshufd $78, %xmm14, %xmm14
movdqa %xmm3, %xmm2
movdqa %xmm14, %xmm0
movdqa %xmm14, %xmm12
pcmpgtq %xmm15, %xmm0
pblendvb %xmm0, %xmm15, %xmm12
pblendvb %xmm0, %xmm14, %xmm15
movdqa %xmm4, %xmm0
pcmpgtq %xmm3, %xmm0
movdqa %xmm4, %xmm14
pblendvb %xmm0, %xmm3, %xmm14
pblendvb %xmm0, %xmm4, %xmm2
movdqa %xmm8, %xmm0
movdqa -96(%rbp), %xmm3
pcmpgtq %xmm6, %xmm0
movdqa %xmm8, %xmm4
movaps %xmm14, -64(%rbp)
movdqa %xmm2, %xmm14
movdqa %xmm10, %xmm2
pblendvb %xmm0, %xmm6, %xmm4
pblendvb %xmm0, %xmm8, %xmm6
movdqa %xmm11, %xmm0
pcmpgtq %xmm13, %xmm0
movdqa %xmm11, %xmm8
pshufd $78, %xmm6, %xmm6
pblendvb %xmm0, %xmm13, %xmm8
pblendvb %xmm0, %xmm11, %xmm13
movdqa %xmm10, %xmm0
pcmpgtq %xmm3, %xmm0
movaps %xmm8, -80(%rbp)
movdqa %xmm9, %xmm11
pshufd $78, %xmm13, %xmm13
pblendvb %xmm0, %xmm3, %xmm2
movdqa %xmm2, %xmm8
movdqa %xmm3, %xmm2
movdqa -112(%rbp), %xmm3
pblendvb %xmm0, %xmm10, %xmm2
movdqa %xmm9, %xmm0
pshufd $78, %xmm8, %xmm8
pcmpgtq %xmm1, %xmm0
pshufd $78, %xmm15, %xmm10
pblendvb %xmm0, %xmm1, %xmm11
pblendvb %xmm0, %xmm9, %xmm1
movdqa %xmm7, %xmm0
pcmpgtq %xmm3, %xmm0
movdqa %xmm7, %xmm9
movaps %xmm11, -96(%rbp)
pshufd $78, -96(%rbp), %xmm15
pblendvb %xmm0, %xmm3, %xmm9
pblendvb %xmm0, %xmm7, %xmm3
movdqa %xmm5, %xmm0
movdqa %xmm3, %xmm11
pshufd $78, %xmm9, %xmm9
movdqa %xmm5, %xmm7
movdqa -160(%rbp), %xmm3
pcmpgtq %xmm3, %xmm0
pblendvb %xmm0, %xmm3, %xmm7
pblendvb %xmm0, %xmm5, %xmm3
movdqa %xmm9, %xmm0
pcmpgtq %xmm12, %xmm0
pshufd $78, %xmm14, %xmm5
movdqa %xmm9, %xmm14
pshufd $78, %xmm7, %xmm7
pblendvb %xmm0, %xmm12, %xmm14
pblendvb %xmm0, %xmm9, %xmm12
movdqa %xmm8, %xmm0
pcmpgtq %xmm4, %xmm0
movdqa %xmm8, %xmm9
pblendvb %xmm0, %xmm4, %xmm9
pblendvb %xmm0, %xmm8, %xmm4
movdqa %xmm10, %xmm0
pcmpgtq %xmm11, %xmm0
movdqa %xmm10, %xmm8
movaps %xmm9, -96(%rbp)
movdqa -80(%rbp), %xmm9
pblendvb %xmm0, %xmm11, %xmm8
pblendvb %xmm0, %xmm10, %xmm11
movdqa %xmm6, %xmm0
pcmpgtq %xmm2, %xmm0
movdqa %xmm6, %xmm10
movaps %xmm8, -112(%rbp)
pshufd $78, %xmm11, %xmm11
pblendvb %xmm0, %xmm2, %xmm10
pblendvb %xmm0, %xmm6, %xmm2
movdqa -64(%rbp), %xmm6
movdqa %xmm7, %xmm0
movdqa %xmm10, %xmm8
movdqa %xmm7, %xmm10
pcmpgtq %xmm6, %xmm0
pshufd $78, %xmm8, %xmm8
pblendvb %xmm0, %xmm6, %xmm10
pblendvb %xmm0, %xmm7, %xmm6
movdqa %xmm15, %xmm0
pcmpgtq %xmm9, %xmm0
movdqa %xmm15, %xmm7
pshufd $78, %xmm6, %xmm6
pblendvb %xmm0, %xmm9, %xmm7
pblendvb %xmm0, %xmm15, %xmm9
movdqa %xmm5, %xmm0
pcmpgtq %xmm3, %xmm0
movdqa %xmm5, %xmm15
pshufd $78, %xmm7, %xmm7
pblendvb %xmm0, %xmm3, %xmm15
pblendvb %xmm0, %xmm5, %xmm3
movdqa %xmm13, %xmm0
pcmpgtq %xmm1, %xmm0
movdqa %xmm13, %xmm5
movaps %xmm15, -64(%rbp)
pshufd $78, -96(%rbp), %xmm15
pshufd $78, %xmm3, %xmm3
pblendvb %xmm0, %xmm1, %xmm5
pblendvb %xmm0, %xmm13, %xmm1
movdqa %xmm15, %xmm0
pcmpgtq %xmm14, %xmm0
pshufd $78, %xmm12, %xmm13
movdqa %xmm15, %xmm12
pshufd $78, %xmm5, %xmm5
pblendvb %xmm0, %xmm14, %xmm12
pblendvb %xmm0, %xmm15, %xmm14
movdqa %xmm13, %xmm0
pcmpgtq %xmm4, %xmm0
movaps %xmm12, -80(%rbp)
movdqa %xmm13, %xmm15
movdqa -112(%rbp), %xmm12
pblendvb %xmm0, %xmm4, %xmm15
pblendvb %xmm0, %xmm13, %xmm4
movdqa %xmm8, %xmm0
pcmpgtq %xmm12, %xmm0
movdqa %xmm8, %xmm13
pblendvb %xmm0, %xmm12, %xmm13
pblendvb %xmm0, %xmm8, %xmm12
movdqa %xmm11, %xmm0
pcmpgtq %xmm2, %xmm0
movdqa %xmm11, %xmm8
pblendvb %xmm0, %xmm2, %xmm8
pblendvb %xmm0, %xmm11, %xmm2
movdqa %xmm7, %xmm0
pcmpgtq %xmm10, %xmm0
movdqa %xmm7, %xmm11
pblendvb %xmm0, %xmm10, %xmm11
pblendvb %xmm0, %xmm7, %xmm10
movdqa %xmm6, %xmm0
pcmpgtq %xmm9, %xmm0
movdqa %xmm6, %xmm7
pblendvb %xmm0, %xmm9, %xmm7
pblendvb %xmm0, %xmm6, %xmm9
movdqa %xmm5, %xmm0
movdqa -64(%rbp), %xmm6
movaps %xmm7, -160(%rbp)
movdqa %xmm5, %xmm7
pcmpgtq %xmm6, %xmm0
pblendvb %xmm0, %xmm6, %xmm7
pblendvb %xmm0, %xmm5, %xmm6
movdqa %xmm3, %xmm0
pcmpgtq %xmm1, %xmm0
movdqa %xmm3, %xmm5
pblendvb %xmm0, %xmm1, %xmm5
pblendvb %xmm0, %xmm3, %xmm1
movaps %xmm1, -176(%rbp)
movdqa -80(%rbp), %xmm3
pshufd $78, %xmm3, %xmm1
movdqa %xmm1, %xmm0
pcmpgtq %xmm3, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm3
pshufd $78, %xmm14, %xmm1
movdqa %xmm1, %xmm0
movaps %xmm3, -80(%rbp)
movdqa -160(%rbp), %xmm3
pcmpgtq %xmm14, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm14
pshufd $78, %xmm15, %xmm1
movdqa %xmm1, %xmm0
movaps %xmm14, -64(%rbp)
movdqa -176(%rbp), %xmm14
pcmpgtq %xmm15, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm15
pshufd $78, %xmm4, %xmm1
movdqa %xmm1, %xmm0
movaps %xmm15, -96(%rbp)
pcmpgtq %xmm4, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm4
pshufd $78, %xmm13, %xmm1
movdqa %xmm1, %xmm0
movaps %xmm4, -112(%rbp)
pcmpgtq %xmm13, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm13
pshufd $78, %xmm12, %xmm1
movdqa %xmm1, %xmm0
movdqa %xmm13, %xmm15
pcmpgtq %xmm12, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm12
pshufd $78, %xmm8, %xmm1
movdqa %xmm1, %xmm0
pcmpgtq %xmm8, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm8
pshufd $78, %xmm2, %xmm1
movdqa %xmm1, %xmm0
pcmpgtq %xmm2, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm2
pshufd $78, %xmm11, %xmm1
movdqa %xmm1, %xmm0
pcmpgtq %xmm11, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm11
pshufd $78, %xmm10, %xmm1
movdqa %xmm1, %xmm0
movdqa %xmm11, %xmm4
pcmpgtq %xmm10, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm10
pshufd $78, %xmm3, %xmm1
movdqa %xmm1, %xmm0
movdqa %xmm10, %xmm11
pcmpgtq %xmm3, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm1, %xmm3
movdqa %xmm3, %xmm10
pshufd $78, %xmm9, %xmm3
movdqa %xmm3, %xmm0
pcmpgtq %xmm9, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm3, %xmm9
pshufd $78, %xmm7, %xmm3
movdqa %xmm3, %xmm0
movdqa %xmm9, %xmm1
pshufd $78, %xmm5, %xmm9
pcmpgtq %xmm7, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm3, %xmm7
pshufd $78, %xmm6, %xmm3
movdqa %xmm3, %xmm0
pcmpgtq %xmm6, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm3, %xmm6
movdqa %xmm9, %xmm0
pcmpgtq %xmm5, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm9, %xmm5
movdqa %xmm5, %xmm3
pshufd $78, %xmm14, %xmm5
movdqa %xmm5, %xmm0
pcmpgtq %xmm14, %xmm0
punpckhqdq %xmm0, %xmm0
pblendvb %xmm0, %xmm5, %xmm14
movdqa %xmm14, %xmm0
.L289:
movdqa -80(%rbp), %xmm5
movq -136(%rbp), %rdx
movups %xmm5, (%rdx)
movdqa -64(%rbp), %xmm5
movups %xmm5, (%r15)
movdqa -96(%rbp), %xmm5
movups %xmm5, (%r14)
movdqa -112(%rbp), %xmm5
movups %xmm5, 0(%r13)
movups %xmm15, (%r12)
movups %xmm12, (%rbx)
movq -128(%rbp), %rbx
movups %xmm8, (%r11)
movups %xmm2, (%r10)
movups %xmm4, (%r9)
movups %xmm11, (%r8)
movups %xmm10, (%rdi)
movups %xmm1, (%rsi)
movups %xmm7, (%rcx)
movq -120(%rbp), %rcx
movups %xmm6, (%rcx)
movups %xmm3, (%rbx)
movups %xmm0, (%rax)
subq $-128, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L291:
.cfi_restore_state
movdqa %xmm3, %xmm2
movdqa %xmm14, %xmm12
movdqa -176(%rbp), %xmm0
movdqa -192(%rbp), %xmm3
movdqa -224(%rbp), %xmm6
movdqa %xmm13, %xmm8
movdqa -240(%rbp), %xmm10
jmp .L289
.cfi_endproc
.LFE18793:
.size _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, .-_ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
.section .text._ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, @function
_ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0:
.LFB18794:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
.cfi_offset 15, -24
.cfi_offset 14, -32
movq %rdi, %r14
pushq %r13
.cfi_offset 13, -40
movq %rcx, %r13
pushq %r12
.cfi_offset 12, -48
movq %rsi, %r12
pushq %rbx
subq $88, %rsp
.cfi_offset 3, -56
movq %rdx, -120(%rbp)
movaps %xmm0, -80(%rbp)
movaps %xmm1, -64(%rbp)
movaps %xmm0, -96(%rbp)
movaps %xmm1, -112(%rbp)
cmpq $1, %rsi
jbe .L315
movl $2, %r15d
xorl %ebx, %ebx
jmp .L300
.p2align 4,,10
.p2align 3
.L294:
movdqa -80(%rbp), %xmm5
movmskpd %xmm1, %edi
movups %xmm5, (%r14,%rbx,8)
call __popcountdi2@PLT
cltq
addq %rax, %rbx
leaq 2(%r15), %rax
cmpq %r12, %rax
ja .L347
movq %rax, %r15
.L300:
movdqu -16(%r14,%r15,8), %xmm0
leaq -2(%r15), %rdx
leaq 0(,%rbx,8), %rax
pcmpeqd -96(%rbp), %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm0, %xmm1
movdqu -16(%r14,%r15,8), %xmm0
pcmpeqd -112(%rbp), %xmm0
pshufd $177, %xmm0, %xmm2
pand %xmm2, %xmm0
movdqa %xmm1, %xmm2
por %xmm0, %xmm2
movmskpd %xmm2, %ecx
cmpl $3, %ecx
je .L294
pcmpeqd %xmm2, %xmm2
movq -120(%rbp), %rsi
leaq 2(%rbx), %rdi
pxor %xmm2, %xmm0
pandn %xmm0, %xmm1
movmskpd %xmm1, %ecx
rep bsfl %ecx, %ecx
movslq %ecx, %rcx
addq %rdx, %rcx
movddup (%r14,%rcx,8), %xmm0
movaps %xmm0, (%rsi)
cmpq %rdx, %rdi
ja .L295
movq %rdx, %rcx
addq %r14, %rax
subq %rbx, %rcx
leaq -2(%rcx), %rsi
movq %rsi, %rcx
andq $-2, %rcx
addq %rbx, %rcx
leaq 16(%r14,%rcx,8), %rcx
.p2align 4,,10
.p2align 3
.L296:
movdqa -64(%rbp), %xmm4
addq $16, %rax
movups %xmm4, -16(%rax)
cmpq %rcx, %rax
jne .L296
andq $-2, %rsi
leaq (%rsi,%rdi), %rbx
.L295:
subq %rbx, %rdx
movdqa .LC1(%rip), %xmm2
movdqa .LC0(%rip), %xmm1
leaq 0(,%rbx,8), %rcx
movq %rdx, %xmm0
punpcklqdq %xmm0, %xmm0
movdqa %xmm0, %xmm3
psubq %xmm0, %xmm1
pcmpeqd %xmm2, %xmm3
pcmpgtd %xmm2, %xmm0
pand %xmm3, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L297
movdqa -64(%rbp), %xmm3
movq %xmm3, (%r14,%rbx,8)
.L297:
movhlps %xmm0, %xmm3
movq %xmm3, %rax
testq %rax, %rax
jne .L348
.L308:
addq $88, %rsp
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L348:
.cfi_restore_state
movdqa -64(%rbp), %xmm3
movhps %xmm3, 8(%r14,%rcx)
jmp .L308
.p2align 4,,10
.p2align 3
.L347:
movq %r12, %rcx
leaq 0(,%r15,8), %rsi
leaq 0(,%rbx,8), %r9
subq %r15, %rcx
.L293:
testq %rcx, %rcx
je .L304
leaq 0(,%rcx,8), %rdx
addq %r14, %rsi
movq %r13, %rdi
movq %r9, -112(%rbp)
movq %rcx, -96(%rbp)
call memcpy@PLT
movq -96(%rbp), %rcx
movq -112(%rbp), %r9
.L304:
movdqa .LC1(%rip), %xmm3
movq %rcx, %xmm2
movdqa -80(%rbp), %xmm5
movdqa .LC0(%rip), %xmm1
punpcklqdq %xmm2, %xmm2
movdqa %xmm3, %xmm4
pcmpeqd %xmm2, %xmm4
movdqa %xmm1, %xmm0
psubq %xmm2, %xmm0
pcmpgtd %xmm3, %xmm2
pand %xmm4, %xmm0
por %xmm2, %xmm0
movdqa 0(%r13), %xmm2
pshufd $245, %xmm0, %xmm0
pcmpeqd %xmm2, %xmm5
pcmpeqd -64(%rbp), %xmm2
pshufd $177, %xmm5, %xmm4
pand %xmm0, %xmm4
pand %xmm5, %xmm4
pshufd $177, %xmm2, %xmm5
pand %xmm5, %xmm2
pcmpeqd %xmm5, %xmm5
movdqa %xmm5, %xmm6
pxor %xmm0, %xmm6
por %xmm6, %xmm2
por %xmm4, %xmm2
movmskpd %xmm2, %eax
cmpl $3, %eax
jne .L349
movq %xmm0, %rax
testq %rax, %rax
je .L309
movdqa -80(%rbp), %xmm5
movq %xmm5, (%r14,%r9)
.L309:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
jne .L350
.L310:
movmskpd %xmm4, %edi
call __popcountdi2@PLT
movdqa .LC0(%rip), %xmm1
movdqa .LC1(%rip), %xmm3
movslq %eax, %rdx
addq %rbx, %rdx
leaq 2(%rdx), %rax
cmpq %rax, %r12
jb .L311
.p2align 4,,10
.p2align 3
.L312:
movdqa -64(%rbp), %xmm7
movq %rax, %rdx
movups %xmm7, -16(%r14,%rax,8)
addq $2, %rax
cmpq %rax, %r12
jnb .L312
.L311:
subq %rdx, %r12
movdqa %xmm3, %xmm2
leaq 0(,%rdx,8), %rcx
movq %r12, %xmm0
punpcklqdq %xmm0, %xmm0
pcmpeqd %xmm0, %xmm2
psubq %xmm0, %xmm1
pcmpgtd %xmm3, %xmm0
pand %xmm2, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L313
movdqa -64(%rbp), %xmm3
movq %xmm3, (%r14,%rdx,8)
.L313:
movhlps %xmm0, %xmm3
movq %xmm3, %rax
testq %rax, %rax
je .L314
movdqa -64(%rbp), %xmm3
movhps %xmm3, 8(%r14,%rcx)
.L314:
addq $88, %rsp
movl $1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L350:
.cfi_restore_state
movdqa -80(%rbp), %xmm6
movhps %xmm6, 8(%r14,%r9)
jmp .L310
.L315:
movq %rsi, %rcx
xorl %r9d, %r9d
xorl %esi, %esi
xorl %ebx, %ebx
xorl %r15d, %r15d
jmp .L293
.L349:
pxor %xmm5, %xmm2
leaq 2(%rbx), %rsi
movmskpd %xmm2, %eax
rep bsfl %eax, %eax
cltq
addq %r15, %rax
movddup (%r14,%rax,8), %xmm0
movq -120(%rbp), %rax
movaps %xmm0, (%rax)
cmpq %r15, %rsi
ja .L305
leaq -2(%r15), %rcx
leaq (%r14,%rbx,8), %rax
subq %rbx, %rcx
movq %rcx, %rdx
andq $-2, %rdx
addq %rbx, %rdx
leaq 16(%r14,%rdx,8), %rdx
.p2align 4,,10
.p2align 3
.L306:
movdqa -64(%rbp), %xmm4
addq $16, %rax
movups %xmm4, -16(%rax)
cmpq %rax, %rdx
jne .L306
andq $-2, %rcx
leaq (%rcx,%rsi), %rbx
leaq 0(,%rbx,8), %r9
.L305:
subq %rbx, %r15
movdqa %xmm3, %xmm2
movq %r15, %xmm0
punpcklqdq %xmm0, %xmm0
pcmpeqd %xmm0, %xmm2
psubq %xmm0, %xmm1
pcmpgtd %xmm3, %xmm0
pand %xmm2, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L307
movdqa -64(%rbp), %xmm3
movq %xmm3, (%r14,%r9)
.L307:
movhlps %xmm0, %xmm3
movq %xmm3, %rax
testq %rax, %rax
je .L308
movdqa -64(%rbp), %xmm3
movhps %xmm3, 8(%r14,%r9)
jmp .L308
.cfi_endproc
.LFE18794:
.size _ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0, .-_ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
.section .text._ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, @function
_ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0:
.LFB18795:
.cfi_startproc
cmpq %rdx, %rsi
jbe .L351
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r8
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rax, %rsi
jbe .L351
movq (%rdi,%rdx,8), %r11
movq %r11, %xmm7
movddup %xmm7, %xmm3
movdqa %xmm3, %xmm6
jmp .L354
.p2align 4,,10
.p2align 3
.L360:
movq %rdx, %rax
.L355:
cmpq %rcx, %rsi
jbe .L356
salq $4, %r8
movddup (%rdi,%r8), %xmm0
movdqa %xmm0, %xmm2
psubq %xmm0, %xmm1
pcmpeqd %xmm4, %xmm2
pcmpgtd %xmm4, %xmm0
pand %xmm2, %xmm1
por %xmm0, %xmm1
pshufd $245, %xmm1, %xmm1
movmskpd %xmm1, %r8d
andl $1, %r8d
jne .L357
.L356:
cmpq %rdx, %rax
je .L351
leaq (%rdi,%rax,8), %rdx
movq (%rdx), %rcx
movq %rcx, (%r10)
movq %r11, (%rdx)
cmpq %rax, %rsi
jbe .L363
movq %rax, %rdx
.L358:
leaq (%rdx,%rdx), %rcx
leaq 1(%rdx), %r8
leaq 1(%rcx), %rax
addq $2, %rcx
cmpq %rsi, %rax
jnb .L351
.L354:
movddup (%rdi,%rax,8), %xmm2
movdqa %xmm2, %xmm5
movdqa %xmm3, %xmm0
leaq (%rdi,%rdx,8), %r10
pcmpeqd %xmm3, %xmm5
psubq %xmm2, %xmm0
movdqa %xmm6, %xmm4
movdqa %xmm3, %xmm1
pand %xmm5, %xmm0
movdqa %xmm2, %xmm5
pcmpgtd %xmm3, %xmm5
por %xmm5, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %r9d
andl $1, %r9d
je .L360
movdqa %xmm2, %xmm1
movdqa %xmm2, %xmm4
jmp .L355
.p2align 4,,10
.p2align 3
.L357:
cmpq %rcx, %rdx
je .L351
leaq (%rdi,%rcx,8), %rax
movq (%rax), %rdx
movq %rdx, (%r10)
movq %rcx, %rdx
movq %r11, (%rax)
jmp .L358
.p2align 4,,10
.p2align 3
.L351:
ret
.p2align 4,,10
.p2align 3
.L363:
ret
.cfi_endproc
.LFE18795:
.size _ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0, .-_ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
.section .text._ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, @function
_ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0:
.LFB18796:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %rax
salq $3, %rax
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq (%rdi,%rax), %r15
pushq %r14
.cfi_offset 14, -32
leaq (%r15,%rax), %r14
pushq %r13
.cfi_offset 13, -40
leaq (%r14,%rax), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%rax), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%rax), %rbx
leaq (%rbx,%rax), %r11
leaq (%r11,%rax), %r10
subq $224, %rsp
leaq (%r10,%rax), %r9
leaq (%r9,%rax), %r8
movq %rdi, -232(%rbp)
movq %rsi, -192(%rbp)
movdqu (%rdi), %xmm9
leaq (%r8,%rax), %rdi
movdqu (%r15), %xmm6
leaq (%rdi,%rax), %rsi
movdqu 0(%r13), %xmm5
movdqu (%r14), %xmm13
leaq (%rsi,%rax), %rcx
movdqa %xmm9, %xmm14
movdqu (%rbx), %xmm3
movdqu (%r12), %xmm12
leaq (%rcx,%rax), %rdx
psubq %xmm6, %xmm14
movdqu (%r10), %xmm2
movdqu (%r11), %xmm11
movdqu (%rdx), %xmm0
movdqu (%rsi), %xmm4
movq %rdx, -216(%rbp)
addq %rax, %rdx
movdqu (%rdx), %xmm15
movdqu (%r8), %xmm8
movq %rdx, -224(%rbp)
addq %rdx, %rax
movaps %xmm0, -96(%rbp)
movdqa %xmm6, %xmm0
movdqu (%rdi), %xmm7
movdqu (%rcx), %xmm1
pcmpeqd %xmm9, %xmm0
movaps %xmm15, -112(%rbp)
movdqu (%r9), %xmm10
pand %xmm14, %xmm0
movdqa %xmm6, %xmm14
pcmpgtd %xmm9, %xmm14
por %xmm14, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm14
pandn %xmm6, %xmm14
pand %xmm0, %xmm6
movdqa %xmm14, %xmm15
movdqa %xmm9, %xmm14
pand %xmm0, %xmm14
por %xmm15, %xmm14
movdqa %xmm0, %xmm15
movdqa %xmm5, %xmm0
pcmpeqd %xmm13, %xmm0
pandn %xmm9, %xmm15
movdqa %xmm13, %xmm9
psubq %xmm5, %xmm9
por %xmm15, %xmm6
pand %xmm9, %xmm0
movdqa %xmm5, %xmm9
pcmpgtd %xmm13, %xmm9
por %xmm9, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm9
pandn %xmm5, %xmm9
pand %xmm0, %xmm5
movdqa %xmm9, %xmm15
movdqa %xmm13, %xmm9
pand %xmm0, %xmm9
por %xmm15, %xmm9
movdqa %xmm0, %xmm15
movdqa %xmm3, %xmm0
pcmpeqd %xmm12, %xmm0
pandn %xmm13, %xmm15
movdqa %xmm12, %xmm13
psubq %xmm3, %xmm13
por %xmm15, %xmm5
pand %xmm13, %xmm0
movdqa %xmm3, %xmm13
pcmpgtd %xmm12, %xmm13
por %xmm13, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm13
pandn %xmm3, %xmm13
pand %xmm0, %xmm3
movdqa %xmm13, %xmm15
movdqa %xmm12, %xmm13
pand %xmm0, %xmm13
por %xmm15, %xmm13
movdqa %xmm0, %xmm15
movdqa %xmm2, %xmm0
pandn %xmm12, %xmm15
pcmpeqd %xmm11, %xmm0
por %xmm15, %xmm3
movaps %xmm3, -64(%rbp)
movdqa %xmm11, %xmm3
psubq %xmm2, %xmm3
pand %xmm3, %xmm0
movdqa %xmm2, %xmm3
pcmpgtd %xmm11, %xmm3
por %xmm3, %xmm0
movdqa %xmm11, %xmm3
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm12
pand %xmm0, %xmm3
pandn %xmm2, %xmm12
pand %xmm0, %xmm2
por %xmm12, %xmm3
movdqa %xmm0, %xmm12
movdqa %xmm8, %xmm0
pcmpeqd %xmm10, %xmm0
pandn %xmm11, %xmm12
movdqa %xmm10, %xmm11
psubq %xmm8, %xmm11
por %xmm12, %xmm2
movdqa %xmm10, %xmm12
pand %xmm11, %xmm0
movdqa %xmm8, %xmm11
pcmpgtd %xmm10, %xmm11
por %xmm11, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm11
pand %xmm0, %xmm12
pandn %xmm8, %xmm11
pand %xmm0, %xmm8
por %xmm11, %xmm12
movdqa %xmm0, %xmm11
movdqa %xmm4, %xmm0
pandn %xmm10, %xmm11
pcmpeqd %xmm7, %xmm0
por %xmm11, %xmm8
movaps %xmm8, -80(%rbp)
movdqa %xmm7, %xmm8
movdqa -96(%rbp), %xmm10
movdqa -112(%rbp), %xmm15
psubq %xmm4, %xmm8
pand %xmm8, %xmm0
movdqa %xmm4, %xmm8
pcmpgtd %xmm7, %xmm8
por %xmm8, %xmm0
movdqa %xmm7, %xmm8
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm11
pand %xmm0, %xmm8
pandn %xmm4, %xmm11
pand %xmm0, %xmm4
por %xmm11, %xmm8
movdqa %xmm0, %xmm11
movdqa %xmm10, %xmm0
pcmpeqd %xmm1, %xmm0
pandn %xmm7, %xmm11
movdqa %xmm1, %xmm7
psubq %xmm10, %xmm7
por %xmm11, %xmm4
movdqa %xmm1, %xmm11
pand %xmm7, %xmm0
movdqa %xmm10, %xmm7
pcmpgtd %xmm1, %xmm7
por %xmm7, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm7
pand %xmm0, %xmm11
pandn %xmm10, %xmm7
por %xmm7, %xmm11
movdqa %xmm0, %xmm7
pand %xmm10, %xmm0
movdqu (%rax), %xmm10
pandn %xmm1, %xmm7
movdqu (%rax), %xmm1
por %xmm7, %xmm0
movdqa %xmm15, %xmm7
psubq %xmm1, %xmm7
movdqu (%rax), %xmm1
movaps %xmm0, -96(%rbp)
movdqa %xmm15, %xmm0
pcmpeqd %xmm15, %xmm1
pand %xmm7, %xmm1
movdqu (%rax), %xmm7
pcmpgtd %xmm15, %xmm7
por %xmm7, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm7
pand %xmm1, %xmm0
pandn %xmm10, %xmm7
por %xmm7, %xmm0
movdqa %xmm1, %xmm7
pand %xmm10, %xmm1
pandn %xmm15, %xmm7
movdqa %xmm14, %xmm10
movdqa %xmm14, %xmm15
por %xmm7, %xmm1
movdqa %xmm9, %xmm7
psubq %xmm9, %xmm10
pcmpeqd %xmm14, %xmm7
pand %xmm10, %xmm7
movdqa %xmm9, %xmm10
pcmpgtd %xmm14, %xmm10
por %xmm10, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm10
pand %xmm7, %xmm15
pandn %xmm9, %xmm10
pand %xmm7, %xmm9
por %xmm15, %xmm10
movdqa %xmm7, %xmm15
movdqa %xmm5, %xmm7
pcmpeqd %xmm6, %xmm7
pandn %xmm14, %xmm15
movdqa %xmm6, %xmm14
por %xmm9, %xmm15
movdqa %xmm6, %xmm9
psubq %xmm5, %xmm9
pand %xmm9, %xmm7
movdqa %xmm5, %xmm9
pcmpgtd %xmm6, %xmm9
por %xmm9, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm9
pand %xmm7, %xmm14
pandn %xmm5, %xmm9
pand %xmm7, %xmm5
por %xmm14, %xmm9
movdqa %xmm7, %xmm14
pandn %xmm6, %xmm14
movdqa %xmm3, %xmm6
por %xmm14, %xmm5
pcmpeqd %xmm13, %xmm6
movdqa -64(%rbp), %xmm14
movaps %xmm5, -112(%rbp)
movdqa %xmm13, %xmm5
psubq %xmm3, %xmm5
pand %xmm5, %xmm6
movdqa %xmm3, %xmm5
pcmpgtd %xmm13, %xmm5
por %xmm5, %xmm6
movdqa %xmm13, %xmm5
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm7
pand %xmm6, %xmm5
pandn %xmm3, %xmm7
pand %xmm6, %xmm3
por %xmm7, %xmm5
movdqa %xmm6, %xmm7
movdqa %xmm14, %xmm6
pandn %xmm13, %xmm7
pcmpeqd %xmm2, %xmm6
por %xmm7, %xmm3
movdqa %xmm14, %xmm7
psubq %xmm2, %xmm7
pand %xmm7, %xmm6
movdqa %xmm2, %xmm7
pcmpgtd %xmm14, %xmm7
por %xmm7, %xmm6
movdqa %xmm14, %xmm7
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm13
pand %xmm6, %xmm7
pandn %xmm2, %xmm13
pand %xmm6, %xmm2
por %xmm13, %xmm7
movdqa %xmm6, %xmm13
movdqa %xmm8, %xmm6
pandn %xmm14, %xmm13
pcmpeqd %xmm12, %xmm6
movdqa %xmm12, %xmm14
por %xmm13, %xmm2
movdqa %xmm12, %xmm13
psubq %xmm8, %xmm13
pand %xmm13, %xmm6
movdqa %xmm8, %xmm13
pcmpgtd %xmm12, %xmm13
por %xmm13, %xmm6
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm13
pand %xmm6, %xmm14
pandn %xmm8, %xmm13
pand %xmm6, %xmm8
por %xmm14, %xmm13
movdqa %xmm6, %xmm14
movdqa %xmm8, %xmm6
pandn %xmm12, %xmm14
por %xmm14, %xmm6
movdqa -80(%rbp), %xmm14
movaps %xmm6, -128(%rbp)
movdqa %xmm14, %xmm6
movdqa %xmm14, %xmm8
movdqa %xmm14, %xmm12
pcmpeqd %xmm4, %xmm6
psubq %xmm4, %xmm8
pand %xmm8, %xmm6
movdqa %xmm4, %xmm8
pcmpgtd %xmm14, %xmm8
por %xmm8, %xmm6
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm8
pand %xmm6, %xmm12
pandn %xmm4, %xmm8
pand %xmm6, %xmm4
por %xmm12, %xmm8
movdqa %xmm6, %xmm12
movdqa %xmm0, %xmm6
pandn %xmm14, %xmm12
pcmpeqd %xmm11, %xmm6
movdqa -96(%rbp), %xmm14
por %xmm12, %xmm4
movaps %xmm4, -80(%rbp)
movdqa %xmm11, %xmm4
psubq %xmm0, %xmm4
pand %xmm4, %xmm6
movdqa %xmm0, %xmm4
pcmpgtd %xmm11, %xmm4
por %xmm4, %xmm6
movdqa %xmm11, %xmm4
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm12
pand %xmm6, %xmm4
pandn %xmm0, %xmm12
pand %xmm6, %xmm0
por %xmm12, %xmm4
movdqa %xmm6, %xmm12
movdqa %xmm14, %xmm6
pandn %xmm11, %xmm12
movdqa %xmm14, %xmm11
psubq %xmm1, %xmm6
pcmpeqd %xmm1, %xmm11
por %xmm12, %xmm0
pand %xmm6, %xmm11
movdqa %xmm1, %xmm6
pcmpgtd %xmm14, %xmm6
por %xmm6, %xmm11
movdqa %xmm14, %xmm6
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm12
pand %xmm11, %xmm6
pandn %xmm1, %xmm12
pand %xmm11, %xmm1
por %xmm12, %xmm6
movdqa %xmm11, %xmm12
movdqa %xmm5, %xmm11
pandn %xmm14, %xmm12
pcmpeqd %xmm10, %xmm11
movdqa %xmm10, %xmm14
por %xmm12, %xmm1
movdqa %xmm10, %xmm12
psubq %xmm5, %xmm12
pand %xmm12, %xmm11
movdqa %xmm5, %xmm12
pcmpgtd %xmm10, %xmm12
por %xmm12, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm12
pand %xmm11, %xmm14
pandn %xmm5, %xmm12
pand %xmm11, %xmm5
por %xmm14, %xmm12
movdqa %xmm11, %xmm14
movdqa %xmm9, %xmm11
pandn %xmm10, %xmm14
movdqa %xmm9, %xmm10
por %xmm5, %xmm14
movdqa %xmm7, %xmm5
psubq %xmm7, %xmm10
pcmpeqd %xmm9, %xmm5
pand %xmm10, %xmm5
movdqa %xmm7, %xmm10
pcmpgtd %xmm9, %xmm10
por %xmm10, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm10
pand %xmm5, %xmm11
pandn %xmm7, %xmm10
pand %xmm5, %xmm7
por %xmm11, %xmm10
movdqa %xmm5, %xmm11
movdqa %xmm3, %xmm5
pandn %xmm9, %xmm11
pcmpeqd %xmm15, %xmm5
movdqa %xmm15, %xmm9
por %xmm11, %xmm7
movaps %xmm7, -96(%rbp)
movdqa %xmm15, %xmm7
psubq %xmm3, %xmm7
pand %xmm7, %xmm5
movdqa %xmm3, %xmm7
pcmpgtd %xmm15, %xmm7
por %xmm7, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm7
pand %xmm5, %xmm9
pandn %xmm3, %xmm7
pand %xmm5, %xmm3
por %xmm9, %xmm7
movdqa %xmm5, %xmm9
pandn %xmm15, %xmm9
movdqa -112(%rbp), %xmm15
por %xmm9, %xmm3
movaps %xmm3, -144(%rbp)
movdqa %xmm15, %xmm3
movdqa %xmm15, %xmm5
movdqa %xmm15, %xmm9
pcmpeqd %xmm2, %xmm3
psubq %xmm2, %xmm5
pand %xmm5, %xmm3
movdqa %xmm2, %xmm5
pcmpgtd %xmm15, %xmm5
por %xmm5, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm5
pand %xmm3, %xmm9
pandn %xmm2, %xmm5
pand %xmm3, %xmm2
por %xmm9, %xmm5
movdqa %xmm3, %xmm9
movdqa %xmm13, %xmm3
pandn %xmm15, %xmm9
psubq %xmm4, %xmm3
movdqa -128(%rbp), %xmm15
por %xmm9, %xmm2
movaps %xmm2, -64(%rbp)
movdqa %xmm4, %xmm2
pcmpeqd %xmm13, %xmm2
pand %xmm3, %xmm2
movdqa %xmm4, %xmm3
pcmpgtd %xmm13, %xmm3
por %xmm3, %xmm2
movdqa %xmm13, %xmm3
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm9
pand %xmm2, %xmm3
pandn %xmm4, %xmm9
pand %xmm2, %xmm4
por %xmm9, %xmm3
movdqa %xmm2, %xmm9
movdqa %xmm6, %xmm2
pandn %xmm13, %xmm9
pcmpeqd %xmm8, %xmm2
por %xmm9, %xmm4
movdqa %xmm8, %xmm9
psubq %xmm6, %xmm9
pand %xmm9, %xmm2
movdqa %xmm6, %xmm9
pcmpgtd %xmm8, %xmm9
por %xmm9, %xmm2
movdqa %xmm8, %xmm9
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm11
pand %xmm2, %xmm9
pandn %xmm6, %xmm11
pand %xmm2, %xmm6
por %xmm11, %xmm9
movdqa %xmm2, %xmm11
movdqa %xmm15, %xmm2
pandn %xmm8, %xmm11
movdqa %xmm15, %xmm8
psubq %xmm0, %xmm2
pcmpeqd %xmm0, %xmm8
por %xmm11, %xmm6
pand %xmm2, %xmm8
movdqa %xmm0, %xmm2
pcmpgtd %xmm15, %xmm2
por %xmm2, %xmm8
movdqa %xmm15, %xmm2
pshufd $245, %xmm8, %xmm8
movdqa %xmm8, %xmm11
pand %xmm8, %xmm2
pandn %xmm0, %xmm11
pand %xmm8, %xmm0
por %xmm11, %xmm2
movdqa %xmm8, %xmm11
pandn %xmm15, %xmm11
movdqa -80(%rbp), %xmm15
por %xmm11, %xmm0
movdqa %xmm15, %xmm11
movdqa %xmm15, %xmm8
pcmpeqd %xmm1, %xmm11
psubq %xmm1, %xmm8
pand %xmm8, %xmm11
movdqa %xmm1, %xmm8
pcmpgtd %xmm15, %xmm8
por %xmm8, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm8
pandn %xmm1, %xmm8
pand %xmm11, %xmm1
movdqa %xmm8, %xmm13
movdqa %xmm15, %xmm8
pand %xmm11, %xmm8
por %xmm13, %xmm8
movdqa %xmm11, %xmm13
movdqa %xmm3, %xmm11
pcmpeqd %xmm12, %xmm11
pandn %xmm15, %xmm13
movdqa %xmm12, %xmm15
psubq %xmm3, %xmm15
por %xmm13, %xmm1
pand %xmm15, %xmm11
movdqa %xmm3, %xmm15
pcmpgtd %xmm12, %xmm15
por %xmm15, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm15
pandn %xmm3, %xmm15
pand %xmm11, %xmm3
movdqa %xmm15, %xmm13
movdqa %xmm12, %xmm15
pand %xmm11, %xmm15
por %xmm13, %xmm15
movaps %xmm15, -112(%rbp)
movdqa %xmm11, %xmm15
movdqa %xmm10, %xmm11
pandn %xmm12, %xmm15
psubq %xmm9, %xmm11
movdqa %xmm10, %xmm12
movdqa %xmm15, %xmm13
movdqa %xmm3, %xmm15
movdqa %xmm9, %xmm3
pcmpeqd %xmm10, %xmm3
por %xmm13, %xmm15
movdqa -96(%rbp), %xmm13
pand %xmm11, %xmm3
movdqa %xmm9, %xmm11
pcmpgtd %xmm10, %xmm11
por %xmm11, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm11
pand %xmm3, %xmm12
pandn %xmm9, %xmm11
pand %xmm3, %xmm9
por %xmm11, %xmm12
movdqa %xmm3, %xmm11
movdqa %xmm7, %xmm3
pandn %xmm10, %xmm11
movdqa %xmm2, %xmm10
psubq %xmm2, %xmm3
movaps %xmm12, -80(%rbp)
pcmpeqd %xmm7, %xmm10
por %xmm11, %xmm9
pand %xmm3, %xmm10
movdqa %xmm2, %xmm3
pcmpgtd %xmm7, %xmm3
por %xmm3, %xmm10
movdqa %xmm7, %xmm3
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm11
pand %xmm10, %xmm3
pandn %xmm2, %xmm11
pand %xmm10, %xmm2
por %xmm11, %xmm3
movdqa %xmm10, %xmm11
movdqa %xmm8, %xmm10
pcmpeqd %xmm5, %xmm10
pandn %xmm7, %xmm11
movdqa %xmm5, %xmm7
psubq %xmm8, %xmm7
por %xmm11, %xmm2
pand %xmm7, %xmm10
movdqa %xmm8, %xmm7
pcmpgtd %xmm5, %xmm7
por %xmm7, %xmm10
movdqa %xmm5, %xmm7
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm11
pand %xmm10, %xmm7
pandn %xmm8, %xmm11
pand %xmm10, %xmm8
por %xmm11, %xmm7
movdqa %xmm10, %xmm11
movdqa %xmm4, %xmm10
pcmpeqd %xmm14, %xmm10
pandn %xmm5, %xmm11
movdqa %xmm14, %xmm5
psubq %xmm4, %xmm5
por %xmm11, %xmm8
pand %xmm5, %xmm10
movdqa %xmm4, %xmm5
pcmpgtd %xmm14, %xmm5
por %xmm5, %xmm10
movdqa %xmm14, %xmm5
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm11
pand %xmm10, %xmm5
pandn %xmm4, %xmm11
pand %xmm10, %xmm4
por %xmm11, %xmm5
movdqa %xmm10, %xmm11
movdqa %xmm13, %xmm10
pandn %xmm14, %xmm11
psubq %xmm6, %xmm10
movdqa -144(%rbp), %xmm14
por %xmm11, %xmm4
movdqa %xmm13, %xmm11
pcmpeqd %xmm6, %xmm11
pand %xmm10, %xmm11
movdqa %xmm6, %xmm10
pcmpgtd %xmm13, %xmm10
por %xmm10, %xmm11
movdqa %xmm13, %xmm10
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm12
pand %xmm11, %xmm10
pandn %xmm6, %xmm12
pand %xmm11, %xmm6
por %xmm12, %xmm10
movdqa %xmm11, %xmm12
movdqa %xmm14, %xmm11
pandn %xmm13, %xmm12
pcmpeqd %xmm0, %xmm11
por %xmm12, %xmm6
movdqa %xmm14, %xmm12
psubq %xmm0, %xmm12
pand %xmm12, %xmm11
movdqa %xmm0, %xmm12
pcmpgtd %xmm14, %xmm12
por %xmm12, %xmm11
movdqa %xmm14, %xmm12
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm13
pand %xmm11, %xmm12
pandn %xmm0, %xmm13
pand %xmm11, %xmm0
por %xmm13, %xmm12
movdqa %xmm11, %xmm13
pandn %xmm14, %xmm13
movdqa -64(%rbp), %xmm14
por %xmm13, %xmm0
movdqa %xmm14, %xmm11
movdqa %xmm14, %xmm13
movaps %xmm0, -96(%rbp)
pcmpeqd %xmm1, %xmm11
psubq %xmm1, %xmm13
pand %xmm13, %xmm11
movdqa %xmm1, %xmm13
pcmpgtd %xmm14, %xmm13
por %xmm13, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm13
movdqa %xmm11, %xmm0
pandn -64(%rbp), %xmm0
pandn %xmm1, %xmm13
pand %xmm11, %xmm1
pand %xmm11, %xmm14
por %xmm0, %xmm1
movdqa %xmm10, %xmm11
por %xmm14, %xmm13
movaps %xmm1, -144(%rbp)
movdqa %xmm2, %xmm1
psubq %xmm2, %xmm11
movdqa %xmm7, %xmm0
pcmpeqd %xmm10, %xmm1
psubq %xmm4, %xmm0
pand %xmm11, %xmm1
movdqa %xmm2, %xmm11
pcmpgtd %xmm10, %xmm11
por %xmm11, %xmm1
movdqa %xmm10, %xmm11
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm14
pand %xmm1, %xmm11
pandn %xmm2, %xmm14
pand %xmm1, %xmm2
por %xmm14, %xmm11
movdqa %xmm1, %xmm14
movdqa %xmm12, %xmm1
pandn %xmm10, %xmm14
movdqa %xmm9, %xmm10
psubq %xmm9, %xmm1
pcmpeqd %xmm12, %xmm10
por %xmm14, %xmm2
pand %xmm1, %xmm10
movdqa %xmm9, %xmm1
pcmpgtd %xmm12, %xmm1
por %xmm1, %xmm10
movdqa %xmm12, %xmm1
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm14
pand %xmm10, %xmm1
pandn %xmm9, %xmm14
pand %xmm10, %xmm9
por %xmm14, %xmm1
movdqa %xmm10, %xmm14
movdqa %xmm4, %xmm10
pcmpeqd %xmm7, %xmm10
pandn %xmm12, %xmm14
por %xmm14, %xmm9
movdqa %xmm7, %xmm14
pand %xmm0, %xmm10
movdqa %xmm4, %xmm0
pcmpgtd %xmm7, %xmm0
por %xmm0, %xmm10
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm0
pand %xmm10, %xmm14
pandn %xmm4, %xmm0
pand %xmm10, %xmm4
por %xmm0, %xmm14
movdqa %xmm10, %xmm0
pandn %xmm7, %xmm0
movdqa %xmm13, %xmm7
por %xmm0, %xmm4
psubq %xmm8, %xmm7
movaps %xmm4, -64(%rbp)
movdqa %xmm8, %xmm4
pcmpeqd %xmm13, %xmm4
pand %xmm7, %xmm4
movdqa %xmm8, %xmm7
pcmpgtd %xmm13, %xmm7
por %xmm7, %xmm4
movdqa %xmm13, %xmm7
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm10
pand %xmm4, %xmm7
pandn %xmm8, %xmm10
pand %xmm4, %xmm8
por %xmm10, %xmm7
movdqa %xmm4, %xmm10
pandn %xmm13, %xmm10
movdqa -96(%rbp), %xmm13
por %xmm10, %xmm8
movdqa %xmm6, %xmm10
movdqa %xmm13, %xmm4
psubq %xmm13, %xmm10
pcmpeqd %xmm6, %xmm4
pand %xmm10, %xmm4
movdqa %xmm13, %xmm10
pcmpgtd %xmm6, %xmm10
por %xmm10, %xmm4
movdqa %xmm6, %xmm10
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm0
pand %xmm4, %xmm10
pandn %xmm13, %xmm0
por %xmm0, %xmm10
movdqa %xmm4, %xmm0
pandn %xmm6, %xmm0
movdqa %xmm15, %xmm6
movdqa %xmm0, %xmm12
pcmpeqd %xmm5, %xmm6
movdqa %xmm13, %xmm0
movdqa -80(%rbp), %xmm13
pand %xmm4, %xmm0
movdqa %xmm5, %xmm4
psubq %xmm15, %xmm4
por %xmm12, %xmm0
pand %xmm4, %xmm6
movdqa %xmm15, %xmm4
pcmpgtd %xmm5, %xmm4
por %xmm4, %xmm6
movdqa %xmm5, %xmm4
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm12
pand %xmm6, %xmm4
pandn %xmm15, %xmm12
pand %xmm6, %xmm15
por %xmm12, %xmm4
movdqa %xmm6, %xmm12
movdqa %xmm13, %xmm6
pandn %xmm5, %xmm12
movdqa %xmm13, %xmm5
psubq %xmm3, %xmm6
pcmpeqd %xmm3, %xmm5
por %xmm12, %xmm15
pand %xmm6, %xmm5
movdqa %xmm3, %xmm6
pcmpgtd %xmm13, %xmm6
por %xmm6, %xmm5
movdqa %xmm13, %xmm6
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm12
pand %xmm5, %xmm6
pandn %xmm3, %xmm12
pand %xmm5, %xmm3
por %xmm12, %xmm6
movdqa %xmm5, %xmm12
movdqa %xmm4, %xmm5
pandn %xmm13, %xmm12
pcmpeqd %xmm6, %xmm5
movdqa %xmm6, %xmm13
por %xmm12, %xmm3
movdqa %xmm6, %xmm12
psubq %xmm4, %xmm12
pand %xmm12, %xmm5
movdqa %xmm4, %xmm12
pcmpgtd %xmm6, %xmm12
por %xmm12, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm12
pand %xmm5, %xmm13
pandn %xmm4, %xmm12
pand %xmm5, %xmm4
por %xmm12, %xmm13
movdqa %xmm5, %xmm12
movdqa %xmm10, %xmm5
pcmpeqd %xmm7, %xmm5
pandn %xmm6, %xmm12
movdqa %xmm7, %xmm6
movaps %xmm13, -128(%rbp)
psubq %xmm10, %xmm6
por %xmm12, %xmm4
pand %xmm6, %xmm5
movdqa %xmm10, %xmm6
pcmpgtd %xmm7, %xmm6
por %xmm6, %xmm5
movdqa %xmm7, %xmm6
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm12
pand %xmm5, %xmm6
pandn %xmm10, %xmm12
pand %xmm5, %xmm10
por %xmm12, %xmm6
movdqa %xmm5, %xmm12
movdqa %xmm15, %xmm5
pcmpeqd %xmm3, %xmm5
pandn %xmm7, %xmm12
movdqa %xmm3, %xmm7
psubq %xmm15, %xmm7
por %xmm12, %xmm10
pand %xmm7, %xmm5
movdqa %xmm15, %xmm7
pcmpgtd %xmm3, %xmm7
por %xmm7, %xmm5
movdqa %xmm3, %xmm7
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm12
pand %xmm5, %xmm7
pandn %xmm15, %xmm12
pand %xmm5, %xmm15
por %xmm12, %xmm7
movdqa %xmm5, %xmm12
movdqa %xmm15, %xmm5
pandn %xmm3, %xmm12
movdqa %xmm8, %xmm3
por %xmm12, %xmm5
movdqa %xmm0, %xmm12
psubq %xmm0, %xmm3
pcmpeqd %xmm8, %xmm12
pand %xmm3, %xmm12
movdqa %xmm0, %xmm3
pcmpgtd %xmm8, %xmm3
por %xmm3, %xmm12
movdqa %xmm8, %xmm3
pshufd $245, %xmm12, %xmm12
movdqa %xmm12, %xmm13
pand %xmm12, %xmm3
pandn %xmm0, %xmm13
pand %xmm12, %xmm0
por %xmm13, %xmm3
movdqa %xmm12, %xmm13
movdqa %xmm7, %xmm12
pandn %xmm8, %xmm13
movdqa %xmm7, %xmm8
por %xmm13, %xmm0
psubq %xmm4, %xmm8
movaps %xmm0, -160(%rbp)
movdqa %xmm4, %xmm0
pcmpeqd %xmm7, %xmm0
pand %xmm8, %xmm0
movdqa %xmm4, %xmm8
pcmpgtd %xmm7, %xmm8
por %xmm8, %xmm0
pshufd $245, %xmm0, %xmm0
pand %xmm0, %xmm12
movdqa %xmm0, %xmm8
pandn %xmm4, %xmm8
movdqa %xmm12, %xmm15
pand %xmm0, %xmm4
por %xmm8, %xmm15
movdqa %xmm0, %xmm8
movdqa %xmm11, %xmm0
pandn %xmm7, %xmm8
movdqa %xmm1, %xmm7
psubq %xmm1, %xmm0
pcmpeqd %xmm11, %xmm7
por %xmm8, %xmm4
pand %xmm0, %xmm7
movdqa %xmm1, %xmm0
pcmpgtd %xmm11, %xmm0
por %xmm0, %xmm7
movdqa %xmm11, %xmm0
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm8
pand %xmm7, %xmm0
pandn %xmm1, %xmm8
pand %xmm7, %xmm1
por %xmm8, %xmm0
movdqa %xmm7, %xmm8
movdqa %xmm9, %xmm7
pandn %xmm11, %xmm8
psubq %xmm2, %xmm7
por %xmm8, %xmm1
movdqa %xmm1, %xmm11
movdqa %xmm2, %xmm1
pcmpeqd %xmm9, %xmm1
pand %xmm7, %xmm1
movdqa %xmm2, %xmm7
pcmpgtd %xmm9, %xmm7
por %xmm7, %xmm1
movdqa %xmm9, %xmm7
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm8
pand %xmm1, %xmm7
pandn %xmm2, %xmm8
pand %xmm1, %xmm2
por %xmm8, %xmm7
movdqa %xmm1, %xmm8
movdqa %xmm10, %xmm1
pandn %xmm9, %xmm8
pcmpeqd %xmm3, %xmm1
por %xmm8, %xmm2
movdqa %xmm3, %xmm8
psubq %xmm10, %xmm8
pand %xmm8, %xmm1
movdqa %xmm10, %xmm8
pcmpgtd %xmm3, %xmm8
por %xmm8, %xmm1
movdqa %xmm3, %xmm8
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm13
pand %xmm1, %xmm8
pandn %xmm10, %xmm13
pand %xmm1, %xmm10
por %xmm13, %xmm8
movdqa %xmm1, %xmm13
movdqa %xmm14, %xmm1
pandn %xmm3, %xmm13
movdqa %xmm5, %xmm3
psubq %xmm5, %xmm1
pcmpeqd %xmm14, %xmm3
por %xmm13, %xmm10
movdqa %xmm14, %xmm13
movaps %xmm10, -176(%rbp)
movdqa -64(%rbp), %xmm9
movdqa %xmm6, %xmm10
cmpq $1, -192(%rbp)
pand %xmm1, %xmm3
movdqa %xmm5, %xmm1
pcmpgtd %xmm14, %xmm1
por %xmm1, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm1
pand %xmm3, %xmm13
pandn %xmm5, %xmm1
pand %xmm3, %xmm5
por %xmm1, %xmm13
movdqa %xmm3, %xmm1
movdqa %xmm6, %xmm3
pandn %xmm14, %xmm1
psubq %xmm9, %xmm3
movdqa %xmm13, %xmm12
por %xmm1, %xmm5
movdqa %xmm9, %xmm1
pcmpeqd %xmm6, %xmm1
pand %xmm3, %xmm1
movdqa %xmm9, %xmm3
pcmpgtd %xmm6, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm3
pand %xmm1, %xmm10
pandn %xmm9, %xmm3
por %xmm3, %xmm10
movdqa %xmm1, %xmm3
pand %xmm9, %xmm1
movdqa %xmm0, %xmm9
pandn %xmm6, %xmm3
pcmpeqd %xmm13, %xmm9
por %xmm3, %xmm1
movdqa %xmm13, %xmm3
psubq %xmm0, %xmm3
pand %xmm3, %xmm9
movdqa %xmm0, %xmm3
pcmpgtd %xmm13, %xmm3
por %xmm3, %xmm9
pshufd $245, %xmm9, %xmm9
movdqa %xmm9, %xmm3
pand %xmm9, %xmm12
pandn %xmm0, %xmm3
por %xmm3, %xmm12
movdqa %xmm9, %xmm3
pand %xmm0, %xmm9
pandn %xmm13, %xmm3
movdqa %xmm11, %xmm0
por %xmm3, %xmm9
movdqa %xmm5, %xmm3
psubq %xmm5, %xmm0
pcmpeqd %xmm11, %xmm3
pand %xmm0, %xmm3
movdqa %xmm5, %xmm0
pcmpgtd %xmm11, %xmm0
por %xmm0, %xmm3
movdqa %xmm11, %xmm0
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm6
pand %xmm3, %xmm0
pandn %xmm5, %xmm6
por %xmm6, %xmm0
movdqa %xmm3, %xmm6
pand %xmm5, %xmm3
movdqa %xmm7, %xmm5
pandn %xmm11, %xmm6
movdqa %xmm10, %xmm11
pcmpeqd %xmm10, %xmm5
por %xmm6, %xmm3
movdqa %xmm10, %xmm6
psubq %xmm7, %xmm6
pand %xmm6, %xmm5
movdqa %xmm7, %xmm6
pcmpgtd %xmm10, %xmm6
por %xmm6, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm6
pand %xmm5, %xmm11
pandn %xmm7, %xmm6
por %xmm6, %xmm11
movdqa %xmm5, %xmm6
pand %xmm7, %xmm5
movdqa %xmm1, %xmm7
pandn %xmm10, %xmm6
pcmpeqd %xmm2, %xmm7
por %xmm6, %xmm5
movdqa %xmm2, %xmm6
psubq %xmm1, %xmm6
pand %xmm6, %xmm7
movdqa %xmm1, %xmm6
pcmpgtd %xmm2, %xmm6
por %xmm6, %xmm7
movdqa %xmm2, %xmm6
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm10
pand %xmm7, %xmm6
pandn %xmm1, %xmm10
pand %xmm7, %xmm1
por %xmm10, %xmm6
movdqa %xmm7, %xmm10
movdqa %xmm12, %xmm7
pandn %xmm2, %xmm10
movdqa %xmm4, %xmm2
psubq %xmm4, %xmm7
pcmpeqd %xmm12, %xmm2
por %xmm10, %xmm1
movdqa %xmm12, %xmm10
pand %xmm7, %xmm2
movdqa %xmm4, %xmm7
pcmpgtd %xmm12, %xmm7
por %xmm7, %xmm2
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm7
pand %xmm2, %xmm10
pandn %xmm4, %xmm7
pand %xmm2, %xmm4
por %xmm7, %xmm10
movdqa %xmm2, %xmm7
movdqa %xmm0, %xmm2
pandn %xmm12, %xmm7
pcmpeqd %xmm9, %xmm2
por %xmm7, %xmm4
movdqa %xmm9, %xmm7
movaps %xmm4, -64(%rbp)
movdqa %xmm9, %xmm4
psubq %xmm0, %xmm4
pand %xmm4, %xmm2
movdqa %xmm0, %xmm4
pcmpgtd %xmm9, %xmm4
por %xmm4, %xmm2
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm4
pand %xmm2, %xmm7
pandn %xmm0, %xmm4
pand %xmm2, %xmm0
por %xmm4, %xmm7
movdqa %xmm2, %xmm4
movdqa %xmm3, %xmm2
pandn %xmm9, %xmm4
pcmpeqd %xmm11, %xmm2
movaps %xmm7, -80(%rbp)
por %xmm4, %xmm0
movdqa %xmm11, %xmm4
psubq %xmm3, %xmm4
pand %xmm4, %xmm2
movdqa %xmm3, %xmm4
pcmpgtd %xmm11, %xmm4
por %xmm4, %xmm2
movdqa %xmm11, %xmm4
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm7
pand %xmm2, %xmm4
pandn %xmm3, %xmm7
pand %xmm2, %xmm3
por %xmm7, %xmm4
movdqa %xmm2, %xmm7
movdqa %xmm5, %xmm2
pandn %xmm11, %xmm7
psubq %xmm6, %xmm2
por %xmm7, %xmm3
movdqa %xmm6, %xmm7
pcmpeqd %xmm5, %xmm7
pand %xmm2, %xmm7
movdqa %xmm6, %xmm2
pcmpgtd %xmm5, %xmm2
por %xmm2, %xmm7
movdqa %xmm5, %xmm2
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm9
pand %xmm7, %xmm2
pandn %xmm6, %xmm9
pand %xmm7, %xmm6
por %xmm9, %xmm2
movdqa %xmm7, %xmm9
movdqa %xmm8, %xmm7
pandn %xmm5, %xmm9
movdqa %xmm1, %xmm5
psubq %xmm1, %xmm7
pcmpeqd %xmm8, %xmm5
por %xmm9, %xmm6
pand %xmm7, %xmm5
movdqa %xmm1, %xmm7
pcmpgtd %xmm8, %xmm7
por %xmm7, %xmm5
movdqa %xmm8, %xmm7
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm9
pand %xmm5, %xmm7
pandn %xmm1, %xmm9
pand %xmm5, %xmm1
por %xmm9, %xmm7
movdqa %xmm5, %xmm9
movdqa %xmm4, %xmm5
pcmpeqd %xmm0, %xmm5
pandn %xmm8, %xmm9
movdqa %xmm0, %xmm8
psubq %xmm4, %xmm8
por %xmm9, %xmm1
movdqa %xmm0, %xmm9
pand %xmm8, %xmm5
movdqa %xmm4, %xmm8
pcmpgtd %xmm0, %xmm8
por %xmm8, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm8
pand %xmm5, %xmm9
pandn %xmm4, %xmm8
pand %xmm5, %xmm4
por %xmm8, %xmm9
movdqa %xmm5, %xmm8
pandn %xmm0, %xmm8
movdqa %xmm3, %xmm0
movaps %xmm9, -96(%rbp)
por %xmm8, %xmm4
psubq %xmm2, %xmm0
movdqa %xmm4, %xmm14
movdqa %xmm2, %xmm4
pcmpeqd %xmm3, %xmm4
pand %xmm0, %xmm4
movdqa %xmm2, %xmm0
pcmpgtd %xmm3, %xmm0
por %xmm0, %xmm4
movdqa %xmm3, %xmm0
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm5
pand %xmm4, %xmm0
pandn %xmm2, %xmm5
pand %xmm4, %xmm2
por %xmm5, %xmm0
movdqa %xmm4, %xmm5
pandn %xmm3, %xmm5
por %xmm5, %xmm2
jbe .L368
movdqa -112(%rbp), %xmm12
pshufd $78, %xmm7, %xmm7
pshufd $78, %xmm6, %xmm6
pshufd $78, -144(%rbp), %xmm9
pshufd $78, %xmm1, %xmm11
movdqa -128(%rbp), %xmm8
pshufd $78, -160(%rbp), %xmm4
pshufd $78, -176(%rbp), %xmm5
movdqa %xmm12, %xmm3
movdqa %xmm12, %xmm1
movdqa %xmm12, %xmm13
movaps %xmm5, -192(%rbp)
pcmpeqd %xmm9, %xmm3
psubq %xmm9, %xmm1
pshufd $78, %xmm2, %xmm2
movaps %xmm11, -176(%rbp)
pshufd $78, %xmm0, %xmm0
pand %xmm1, %xmm3
movdqa %xmm9, %xmm1
pcmpgtd %xmm12, %xmm1
por %xmm1, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm1
pand %xmm3, %xmm13
pandn %xmm9, %xmm1
por %xmm1, %xmm13
movdqa %xmm3, %xmm1
pand %xmm9, %xmm3
pandn %xmm12, %xmm1
movdqa %xmm4, %xmm12
movdqa %xmm13, %xmm9
movaps %xmm1, -256(%rbp)
movdqa %xmm8, %xmm1
psubq %xmm4, %xmm1
pcmpeqd %xmm8, %xmm4
movaps %xmm12, -208(%rbp)
pand %xmm1, %xmm4
movdqa %xmm12, %xmm1
movdqa %xmm8, %xmm12
pcmpgtd %xmm8, %xmm1
por %xmm1, %xmm4
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm1
pandn -208(%rbp), %xmm1
pand %xmm4, %xmm12
por %xmm1, %xmm12
movdqa %xmm4, %xmm1
pandn %xmm8, %xmm1
movdqa %xmm15, %xmm8
psubq %xmm5, %xmm8
movaps %xmm1, -272(%rbp)
movdqa %xmm8, %xmm1
movdqa %xmm5, %xmm8
pcmpeqd %xmm15, %xmm8
pand %xmm1, %xmm8
movdqa %xmm5, %xmm1
movdqa %xmm15, %xmm5
pcmpgtd %xmm15, %xmm1
por %xmm1, %xmm8
pshufd $245, %xmm8, %xmm8
movdqa %xmm8, %xmm1
pandn -192(%rbp), %xmm1
pand %xmm8, %xmm5
por %xmm1, %xmm5
movdqa %xmm8, %xmm1
pand -192(%rbp), %xmm8
pandn %xmm15, %xmm1
movaps %xmm5, -128(%rbp)
movdqa %xmm10, %xmm5
movaps %xmm1, -288(%rbp)
movdqa %xmm11, %xmm1
psubq %xmm11, %xmm5
pcmpeqd %xmm10, %xmm1
pand %xmm5, %xmm1
movdqa %xmm11, %xmm5
movdqa %xmm10, %xmm11
pcmpgtd %xmm10, %xmm5
por %xmm5, %xmm1
pshufd $245, %xmm1, %xmm1
pand %xmm1, %xmm11
movdqa %xmm1, %xmm5
pandn -176(%rbp), %xmm5
movdqa %xmm11, %xmm15
movdqa %xmm1, %xmm11
pand -176(%rbp), %xmm1
por %xmm5, %xmm15
pandn %xmm10, %xmm11
movaps %xmm15, -144(%rbp)
movdqa -64(%rbp), %xmm15
movaps %xmm11, -304(%rbp)
por -304(%rbp), %xmm1
movdqa %xmm15, %xmm5
movdqa %xmm15, %xmm10
pcmpeqd %xmm7, %xmm5
psubq %xmm7, %xmm10
pshufd $78, %xmm1, %xmm1
pand %xmm10, %xmm5
movdqa %xmm7, %xmm10
pcmpgtd %xmm15, %xmm10
por %xmm10, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm10
pandn %xmm7, %xmm10
pand %xmm5, %xmm7
movaps %xmm10, -320(%rbp)
movdqa %xmm5, %xmm10
pand -64(%rbp), %xmm5
por -320(%rbp), %xmm5
pandn %xmm15, %xmm10
por %xmm10, %xmm7
movdqa -80(%rbp), %xmm10
pshufd $78, %xmm5, %xmm5
movaps %xmm7, -112(%rbp)
movdqa %xmm10, %xmm11
movdqa %xmm10, %xmm7
pcmpeqd %xmm6, %xmm11
psubq %xmm6, %xmm7
pand %xmm7, %xmm11
movdqa %xmm6, %xmm7
pcmpgtd %xmm10, %xmm7
por %xmm7, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm7
pandn %xmm6, %xmm7
pand %xmm11, %xmm6
movaps %xmm7, -336(%rbp)
movdqa %xmm11, %xmm7
pand -80(%rbp), %xmm11
por -336(%rbp), %xmm11
pandn %xmm10, %xmm7
movdqa -96(%rbp), %xmm10
por %xmm7, %xmm6
pshufd $78, %xmm11, %xmm11
movdqa %xmm10, %xmm7
movaps %xmm6, -160(%rbp)
movdqa %xmm10, %xmm6
pcmpeqd %xmm2, %xmm7
psubq %xmm2, %xmm6
pand %xmm6, %xmm7
movdqa %xmm2, %xmm6
pcmpgtd %xmm10, %xmm6
por %xmm6, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm6
pandn %xmm2, %xmm6
pand %xmm7, %xmm2
movaps %xmm6, -352(%rbp)
movdqa %xmm7, %xmm6
por -288(%rbp), %xmm8
pand -96(%rbp), %xmm7
pandn %xmm10, %xmm6
por -256(%rbp), %xmm3
por -352(%rbp), %xmm7
por %xmm6, %xmm2
movdqa %xmm14, %xmm6
pand -208(%rbp), %xmm4
psubq %xmm0, %xmm6
pshufd $78, %xmm7, %xmm7
por -272(%rbp), %xmm4
movdqa %xmm6, %xmm10
movdqa %xmm0, %xmm6
movaps %xmm7, -80(%rbp)
pshufd $78, %xmm8, %xmm8
pcmpeqd %xmm14, %xmm6
pshufd $78, %xmm4, %xmm4
movaps %xmm4, -96(%rbp)
pand %xmm10, %xmm6
movdqa %xmm0, %xmm10
pcmpgtd %xmm14, %xmm10
por %xmm10, %xmm6
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm10
movdqa %xmm6, %xmm15
pandn %xmm0, %xmm10
pand %xmm6, %xmm0
pand %xmm14, %xmm6
por %xmm10, %xmm6
pandn %xmm14, %xmm15
movdqa -80(%rbp), %xmm14
pshufd $78, %xmm6, %xmm6
por %xmm15, %xmm0
pshufd $78, %xmm3, %xmm15
movdqa %xmm6, %xmm10
movdqa %xmm13, %xmm3
movdqa %xmm15, %xmm7
pcmpeqd %xmm13, %xmm10
pcmpeqd %xmm0, %xmm7
psubq %xmm6, %xmm3
pand %xmm3, %xmm10
movdqa %xmm6, %xmm3
pcmpgtd %xmm13, %xmm3
por %xmm3, %xmm10
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm3
pand %xmm10, %xmm9
movdqa %xmm10, %xmm4
pandn %xmm6, %xmm3
pandn %xmm13, %xmm4
movdqa %xmm12, %xmm13
por %xmm3, %xmm9
movdqa %xmm0, %xmm3
pand %xmm6, %xmm10
movaps %xmm4, -256(%rbp)
psubq %xmm15, %xmm3
movdqa %xmm0, %xmm4
pand %xmm3, %xmm7
movdqa %xmm15, %xmm3
pcmpgtd %xmm0, %xmm3
por %xmm3, %xmm7
pshufd $245, %xmm7, %xmm7
movdqa %xmm7, %xmm3
pand %xmm7, %xmm4
pandn %xmm15, %xmm3
por %xmm3, %xmm4
movdqa %xmm7, %xmm3
pand %xmm15, %xmm7
pandn %xmm0, %xmm3
movdqa %xmm12, %xmm0
psubq %xmm14, %xmm0
movaps %xmm3, -272(%rbp)
movdqa %xmm0, %xmm3
movdqa %xmm14, %xmm0
pcmpeqd %xmm12, %xmm0
pand %xmm3, %xmm0
movdqa %xmm14, %xmm3
movdqa %xmm2, %xmm14
pcmpgtd %xmm12, %xmm3
por %xmm3, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
pandn -80(%rbp), %xmm3
pand %xmm0, %xmm13
movaps %xmm0, -288(%rbp)
por %xmm3, %xmm13
movdqa %xmm0, %xmm3
movdqa -112(%rbp), %xmm0
movaps %xmm13, -176(%rbp)
movdqa -96(%rbp), %xmm13
pandn %xmm12, %xmm3
movdqa %xmm2, %xmm12
movaps %xmm3, -304(%rbp)
movdqa %xmm13, %xmm3
psubq %xmm13, %xmm12
pcmpeqd %xmm2, %xmm3
pand %xmm12, %xmm3
movdqa %xmm13, %xmm12
movdqa -128(%rbp), %xmm13
pcmpgtd %xmm2, %xmm12
por %xmm12, %xmm3
pshufd $245, %xmm3, %xmm3
movdqa %xmm3, %xmm12
pandn -96(%rbp), %xmm12
pand %xmm3, %xmm14
por %xmm12, %xmm14
movdqa %xmm3, %xmm12
pandn %xmm2, %xmm12
movdqa %xmm13, %xmm2
movaps %xmm14, -192(%rbp)
pcmpeqd %xmm11, %xmm2
movaps %xmm12, -320(%rbp)
movdqa %xmm13, %xmm12
psubq %xmm11, %xmm12
pand %xmm12, %xmm2
movdqa %xmm11, %xmm12
pcmpgtd %xmm13, %xmm12
por %xmm12, %xmm2
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm14
movdqa %xmm2, %xmm12
pandn %xmm11, %xmm14
pand %xmm2, %xmm11
pandn %xmm13, %xmm12
movdqa %xmm11, %xmm13
movaps %xmm14, -336(%rbp)
pand -128(%rbp), %xmm2
por -336(%rbp), %xmm2
por %xmm12, %xmm13
movdqa -160(%rbp), %xmm12
movaps %xmm13, -208(%rbp)
pshufd $78, %xmm2, %xmm2
movdqa %xmm12, %xmm14
movdqa %xmm12, %xmm11
pcmpeqd %xmm8, %xmm14
psubq %xmm8, %xmm11
pand %xmm11, %xmm14
movdqa %xmm8, %xmm11
pcmpgtd %xmm12, %xmm11
por %xmm11, %xmm14
pshufd $245, %xmm14, %xmm14
movdqa %xmm14, %xmm11
pandn %xmm8, %xmm11
pand %xmm14, %xmm8
movaps %xmm11, -352(%rbp)
movdqa %xmm14, %xmm11
pandn %xmm12, %xmm11
movdqa -144(%rbp), %xmm12
por %xmm11, %xmm8
movaps %xmm8, -64(%rbp)
movdqa %xmm12, %xmm8
movdqa %xmm12, %xmm11
pcmpeqd %xmm5, %xmm8
psubq %xmm5, %xmm11
pand %xmm11, %xmm8
movdqa %xmm5, %xmm11
pcmpgtd %xmm12, %xmm11
por %xmm11, %xmm8
pshufd $245, %xmm8, %xmm8
movdqa %xmm8, %xmm11
pandn %xmm5, %xmm11
pand %xmm8, %xmm5
movdqa %xmm11, %xmm13
movdqa %xmm8, %xmm11
pand -144(%rbp), %xmm8
pandn %xmm12, %xmm11
movdqa %xmm0, %xmm12
por %xmm11, %xmm5
movdqa %xmm0, %xmm11
psubq %xmm1, %xmm12
pcmpeqd %xmm1, %xmm11
por %xmm13, %xmm8
pshufd $78, %xmm8, %xmm8
pand %xmm12, %xmm11
movdqa %xmm1, %xmm12
pcmpgtd -112(%rbp), %xmm12
por %xmm12, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm12
movdqa %xmm11, %xmm0
pandn -112(%rbp), %xmm0
pandn %xmm1, %xmm12
pand %xmm11, %xmm1
por %xmm0, %xmm1
movdqa -288(%rbp), %xmm0
movdqa -112(%rbp), %xmm6
por -272(%rbp), %xmm7
pand -96(%rbp), %xmm3
pand %xmm11, %xmm6
pand -80(%rbp), %xmm0
por -256(%rbp), %xmm10
pshufd $78, %xmm7, %xmm7
por %xmm12, %xmm6
movdqa %xmm9, %xmm12
movdqa -208(%rbp), %xmm15
movaps %xmm7, -96(%rbp)
movdqa %xmm8, %xmm7
pshufd $78, %xmm6, %xmm6
pshufd $78, %xmm10, %xmm10
pcmpeqd %xmm9, %xmm7
movaps %xmm6, -112(%rbp)
movdqa %xmm9, %xmm6
por -304(%rbp), %xmm0
psubq %xmm8, %xmm6
movaps %xmm10, -80(%rbp)
por -320(%rbp), %xmm3
pand -160(%rbp), %xmm14
por -352(%rbp), %xmm14
pshufd $78, %xmm0, %xmm0
pand %xmm6, %xmm7
movdqa %xmm8, %xmm6
pshufd $78, %xmm3, %xmm3
pcmpgtd %xmm9, %xmm6
pshufd $78, %xmm14, %xmm14
por %xmm6, %xmm7
pshufd $245, %xmm7, %xmm7
pand %xmm7, %xmm12
movdqa %xmm7, %xmm6
movdqa %xmm12, %xmm13
movdqa %xmm7, %xmm12
pandn %xmm8, %xmm6
pandn %xmm9, %xmm12
por %xmm6, %xmm13
pand %xmm8, %xmm7
movdqa -176(%rbp), %xmm9
movaps %xmm12, -272(%rbp)
movdqa %xmm5, %xmm12
movdqa %xmm9, %xmm11
movdqa %xmm9, %xmm6
psubq %xmm10, %xmm12
pcmpeqd %xmm2, %xmm11
psubq %xmm2, %xmm6
pand %xmm6, %xmm11
movdqa %xmm2, %xmm6
pcmpgtd %xmm9, %xmm6
por %xmm6, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm6
pandn %xmm2, %xmm6
pand %xmm11, %xmm2
movaps %xmm6, -288(%rbp)
movdqa %xmm11, %xmm6
pandn %xmm9, %xmm6
por %xmm6, %xmm2
movdqa %xmm10, %xmm6
pcmpeqd %xmm5, %xmm6
pand %xmm12, %xmm6
movdqa %xmm10, %xmm12
pcmpgtd %xmm5, %xmm12
por %xmm12, %xmm6
pshufd $245, %xmm6, %xmm6
movdqa %xmm6, %xmm10
movdqa %xmm6, %xmm12
pandn -80(%rbp), %xmm12
pandn %xmm5, %xmm10
movaps %xmm10, -304(%rbp)
movdqa %xmm15, %xmm10
movdqa %xmm12, %xmm9
movdqa %xmm5, %xmm12
pcmpeqd %xmm0, %xmm10
movdqa %xmm15, %xmm5
pand %xmm6, %xmm12
psubq %xmm0, %xmm5
por %xmm9, %xmm12
pand %xmm5, %xmm10
movdqa %xmm0, %xmm5
pcmpgtd %xmm15, %xmm5
por %xmm5, %xmm10
pshufd $245, %xmm10, %xmm10
movdqa %xmm10, %xmm5
pandn %xmm0, %xmm5
pand %xmm10, %xmm0
movaps %xmm5, -320(%rbp)
movdqa %xmm10, %xmm5
pandn %xmm15, %xmm5
movdqa %xmm4, %xmm15
por %xmm5, %xmm0
movdqa -112(%rbp), %xmm5
movaps %xmm0, -144(%rbp)
psubq %xmm5, %xmm15
movdqa %xmm15, %xmm9
movdqa %xmm5, %xmm15
pcmpeqd %xmm4, %xmm5
pand %xmm9, %xmm5
movdqa %xmm15, %xmm9
movdqa %xmm4, %xmm15
pcmpgtd %xmm4, %xmm9
por %xmm9, %xmm5
pshufd $245, %xmm5, %xmm5
movdqa %xmm5, %xmm9
pandn -112(%rbp), %xmm9
pand %xmm5, %xmm15
por %xmm9, %xmm15
movdqa %xmm5, %xmm9
movaps %xmm15, -160(%rbp)
pandn %xmm4, %xmm9
movdqa -192(%rbp), %xmm15
movaps %xmm9, -336(%rbp)
movdqa %xmm15, %xmm9
movdqa %xmm15, %xmm4
pcmpeqd %xmm14, %xmm9
psubq %xmm14, %xmm4
pand %xmm4, %xmm9
movdqa %xmm14, %xmm4
pcmpgtd %xmm15, %xmm4
por %xmm4, %xmm9
pshufd $245, %xmm9, %xmm9
movdqa %xmm9, %xmm0
movdqa %xmm9, %xmm4
pandn %xmm15, %xmm0
movdqa -96(%rbp), %xmm15
pandn %xmm14, %xmm4
pand %xmm9, %xmm14
por %xmm0, %xmm14
movaps %xmm4, -352(%rbp)
movdqa %xmm1, %xmm0
movdqa %xmm15, %xmm4
movaps %xmm14, -128(%rbp)
movdqa %xmm15, %xmm14
psubq %xmm15, %xmm0
pcmpeqd %xmm1, %xmm4
pcmpgtd %xmm1, %xmm14
pand %xmm0, %xmm4
por %xmm14, %xmm4
pshufd $245, %xmm4, %xmm4
movdqa %xmm4, %xmm0
pandn -96(%rbp), %xmm0
movdqa %xmm0, %xmm14
movdqa %xmm1, %xmm0
pand %xmm4, %xmm0
movdqa %xmm0, %xmm15
movdqa %xmm4, %xmm0
pandn %xmm1, %xmm0
por %xmm14, %xmm15
movaps %xmm0, -368(%rbp)
movdqa -64(%rbp), %xmm0
movdqa %xmm0, %xmm1
movdqa %xmm0, %xmm14
pcmpeqd %xmm3, %xmm1
psubq %xmm3, %xmm14
pand %xmm14, %xmm1
movdqa %xmm3, %xmm14
pcmpgtd -64(%rbp), %xmm14
pand -80(%rbp), %xmm6
pand -112(%rbp), %xmm5
pand -176(%rbp), %xmm11
por -272(%rbp), %xmm7
por -288(%rbp), %xmm11
pand -96(%rbp), %xmm4
por %xmm14, %xmm1
pshufd $78, %xmm7, %xmm7
movdqa -208(%rbp), %xmm8
por -304(%rbp), %xmm6
pshufd $245, %xmm1, %xmm1
pshufd $78, %xmm11, %xmm11
pand -192(%rbp), %xmm9
movdqa %xmm1, %xmm14
movdqa %xmm1, %xmm0
pandn -64(%rbp), %xmm0
pandn %xmm3, %xmm14
pand %xmm1, %xmm3
pand %xmm10, %xmm8
por %xmm0, %xmm3
movdqa %xmm13, %xmm10
por -320(%rbp), %xmm8
movaps %xmm14, -384(%rbp)
movaps %xmm3, -256(%rbp)
movdqa -64(%rbp), %xmm3
psubq %xmm11, %xmm10
pshufd $78, %xmm6, %xmm6
pshufd $78, %xmm8, %xmm8
por -336(%rbp), %xmm5
por -352(%rbp), %xmm9
pand %xmm1, %xmm3
movdqa %xmm11, %xmm1
por -384(%rbp), %xmm3
pcmpeqd %xmm13, %xmm1
pshufd $78, %xmm9, %xmm9
pshufd $78, %xmm5, %xmm5
pshufd $78, %xmm3, %xmm3
por -368(%rbp), %xmm4
pand %xmm10, %xmm1
movdqa %xmm11, %xmm10
pshufd $78, %xmm4, %xmm4
pcmpgtd %xmm13, %xmm10
por %xmm10, %xmm1
movdqa %xmm13, %xmm10
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm0
pand %xmm1, %xmm10
pandn %xmm11, %xmm0
por %xmm0, %xmm10
movdqa %xmm1, %xmm0
pand %xmm11, %xmm1
movdqa %xmm7, %xmm11
pandn %xmm13, %xmm0
movdqa %xmm2, %xmm13
pcmpeqd %xmm2, %xmm11
psubq %xmm7, %xmm13
por %xmm0, %xmm1
movdqa %xmm2, %xmm0
movaps %xmm1, -64(%rbp)
movdqa -144(%rbp), %xmm1
pand %xmm13, %xmm11
movdqa %xmm7, %xmm13
pcmpgtd %xmm2, %xmm13
por %xmm13, %xmm11
pshufd $245, %xmm11, %xmm11
movdqa %xmm11, %xmm13
pand %xmm11, %xmm0
pandn %xmm7, %xmm13
por %xmm0, %xmm13
movdqa %xmm11, %xmm0
pand %xmm7, %xmm11
pandn %xmm2, %xmm0
movdqa %xmm8, %xmm2
movdqa %xmm12, %xmm7
pcmpeqd %xmm12, %xmm2
psubq %xmm8, %xmm7
movdqa %xmm0, %xmm14
por %xmm11, %xmm14
movdqa %xmm12, %xmm11
movdqa %xmm1, %xmm0
pand %xmm7, %xmm2
movdqa %xmm8, %xmm7
pcmpgtd %xmm12, %xmm7
por %xmm7, %xmm2
pshufd $245, %xmm2, %xmm2
movdqa %xmm2, %xmm7
pand %xmm2, %xmm11
pandn %xmm8, %xmm7
por %xmm7, %xmm11
movdqa %xmm2, %xmm7
pand %xmm8, %xmm2
pandn %xmm12, %xmm7
por %xmm7, %xmm2
movdqa %xmm1, %xmm7
movdqa %xmm2, %xmm12
movdqa %xmm6, %xmm2
psubq %xmm6, %xmm7
pcmpeqd %xmm1, %xmm2
pand %xmm7, %xmm2
movdqa %xmm6, %xmm7
pcmpgtd %xmm1, %xmm7
por %xmm7, %xmm2
pshufd $245, %xmm2, %xmm2
pand %xmm2, %xmm0
movdqa %xmm2, %xmm7
pandn %xmm6, %xmm7
movdqa %xmm0, %xmm8
por %xmm7, %xmm8
movdqa %xmm2, %xmm7
pand %xmm6, %xmm2
pandn %xmm1, %xmm7
movdqa -160(%rbp), %xmm1
por %xmm2, %xmm7
movdqa %xmm1, %xmm0
movdqa %xmm1, %xmm2
movdqa %xmm1, %xmm6
pcmpeqd %xmm9, %xmm0
psubq %xmm9, %xmm2
pand %xmm2, %xmm0
movdqa %xmm9, %xmm2
pcmpgtd %xmm1, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm2
pand %xmm0, %xmm6
pandn %xmm9, %xmm2
por %xmm2, %xmm6
movdqa %xmm0, %xmm2
pand %xmm9, %xmm0
pandn %xmm1, %xmm2
movaps %xmm6, -144(%rbp)
movdqa -128(%rbp), %xmm6
por %xmm2, %xmm0
movdqa %xmm0, %xmm9
movdqa %xmm6, %xmm0
movdqa %xmm6, %xmm2
pcmpeqd %xmm5, %xmm0
psubq %xmm5, %xmm2
pand %xmm2, %xmm0
movdqa %xmm5, %xmm2
pcmpgtd %xmm6, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm1
pandn -128(%rbp), %xmm1
movdqa %xmm0, %xmm2
pand %xmm0, %xmm6
pand %xmm5, %xmm0
pandn %xmm5, %xmm2
por %xmm1, %xmm0
movdqa %xmm3, %xmm1
por %xmm2, %xmm6
pcmpeqd %xmm15, %xmm1
movdqa %xmm15, %xmm2
movdqa %xmm15, %xmm5
movaps %xmm0, -160(%rbp)
psubq %xmm3, %xmm2
movdqa %xmm1, %xmm0
pand %xmm2, %xmm0
movdqa %xmm3, %xmm2
pcmpgtd %xmm15, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm2
pand %xmm0, %xmm5
pandn %xmm3, %xmm2
por %xmm2, %xmm5
movdqa %xmm0, %xmm2
pand %xmm3, %xmm0
pandn %xmm15, %xmm2
movdqa -256(%rbp), %xmm15
por %xmm2, %xmm0
movdqa %xmm15, %xmm1
movdqa %xmm15, %xmm2
movdqa %xmm15, %xmm3
movaps %xmm0, -176(%rbp)
pcmpeqd %xmm4, %xmm1
psubq %xmm4, %xmm2
movdqa %xmm1, %xmm0
pand %xmm2, %xmm0
movdqa %xmm4, %xmm2
pcmpgtd %xmm15, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm2
pand %xmm0, %xmm3
pandn %xmm4, %xmm2
por %xmm2, %xmm3
movdqa %xmm0, %xmm2
pand %xmm4, %xmm0
pandn %xmm15, %xmm2
movdqa %xmm0, %xmm4
movaps %xmm3, -192(%rbp)
pshufd $78, %xmm10, %xmm3
por %xmm2, %xmm4
movdqa %xmm10, %xmm2
movdqa %xmm3, %xmm1
movdqa -64(%rbp), %xmm15
psubq %xmm3, %xmm2
pcmpgtd %xmm10, %xmm1
movdqa %xmm2, %xmm0
movdqa %xmm10, %xmm2
pcmpeqd %xmm3, %xmm2
pand %xmm0, %xmm2
por %xmm1, %xmm2
pshufd $245, %xmm2, %xmm0
punpckhqdq %xmm0, %xmm0
movdqa %xmm0, %xmm2
pand %xmm3, %xmm0
pshufd $78, %xmm15, %xmm3
pandn %xmm10, %xmm2
movdqa %xmm0, %xmm1
por %xmm2, %xmm1
movdqa %xmm15, %xmm2
pcmpeqd %xmm3, %xmm2
movaps %xmm1, -112(%rbp)
movdqa %xmm15, %xmm1
psubq %xmm3, %xmm1
pand %xmm1, %xmm2
movdqa %xmm3, %xmm1
pcmpgtd %xmm15, %xmm1
por %xmm1, %xmm2
pshufd $245, %xmm2, %xmm0
punpckhqdq %xmm0, %xmm0
movdqa %xmm0, %xmm2
pand %xmm3, %xmm0
pshufd $78, %xmm9, %xmm3
pandn %xmm15, %xmm2
movdqa %xmm0, %xmm1
por %xmm2, %xmm1
pshufd $78, %xmm13, %xmm2
movaps %xmm1, -128(%rbp)
movdqa %xmm13, %xmm1
movdqa %xmm2, %xmm15
psubq %xmm2, %xmm1
pcmpgtd %xmm13, %xmm15
movdqa %xmm1, %xmm0
movdqa %xmm13, %xmm1
pcmpeqd %xmm2, %xmm1
pand %xmm0, %xmm1
por %xmm15, %xmm1
pshufd $245, %xmm1, %xmm0
punpckhqdq %xmm0, %xmm0
movdqa %xmm0, %xmm1
pand %xmm2, %xmm0
pshufd $78, %xmm14, %xmm2
pandn %xmm13, %xmm1
movdqa %xmm0, %xmm15
movdqa %xmm2, %xmm10
por %xmm1, %xmm15
pcmpgtd %xmm14, %xmm10
movdqa %xmm14, %xmm1
psubq %xmm2, %xmm1
movdqa %xmm1, %xmm0
movdqa %xmm14, %xmm1
pcmpeqd %xmm2, %xmm1
pand %xmm0, %xmm1
por %xmm10, %xmm1
pshufd $245, %xmm1, %xmm0
punpckhqdq %xmm0, %xmm0
movdqa %xmm0, %xmm1
pand %xmm2, %xmm0
pshufd $78, %xmm11, %xmm2
pandn %xmm14, %xmm1
movdqa %xmm0, %xmm10
movdqa %xmm2, %xmm14
por %xmm1, %xmm10
pcmpgtd %xmm11, %xmm14
movdqa %xmm11, %xmm1
psubq %xmm2, %xmm1
movdqa %xmm1, %xmm0
movdqa %xmm11, %xmm1
pcmpeqd %xmm2, %xmm1
pand %xmm0, %xmm1
por %xmm14, %xmm1
pshufd $245, %xmm1, %xmm0
punpckhqdq %xmm0, %xmm0
movdqa %xmm0, %xmm1
pand %xmm2, %xmm0
pandn %xmm11, %xmm1
movdqa %xmm0, %xmm2
pshufd $78, %xmm4, %xmm11
por %xmm1, %xmm2
movdqa %xmm12, %xmm1
movaps %xmm2, -64(%rbp)
pshufd $78, %xmm12, %xmm2
movdqa -160(%rbp), %xmm13
psubq %xmm2, %xmm1
movdqa %xmm2, %xmm14
movdqa %xmm1, %xmm0
pcmpgtd %xmm12, %xmm14
movdqa %xmm12, %xmm1
pcmpeqd %xmm2, %xmm1
pand %xmm0, %xmm1
por %xmm14, %xmm1
pshufd $245, %xmm1, %xmm0
punpckhqdq %xmm0, %xmm0
movdqa %xmm0, %xmm1
pand %xmm2, %xmm0
pandn %xmm12, %xmm1
movdqa %xmm0, %xmm2
por %xmm1, %xmm2
movdqa %xmm8, %xmm1
movaps %xmm2, -80(%rbp)
pshufd $78, %xmm8, %xmm2
psubq %xmm2, %xmm1
movdqa %xmm2, %xmm14
movdqa %xmm1, %xmm0
pcmpgtd %xmm8, %xmm14
movdqa %xmm8, %xmm1
pcmpeqd %xmm2, %xmm1
pand %xmm0, %xmm1
por %xmm14, %xmm1
pshufd $245, %xmm1, %xmm0
punpckhqdq %xmm0, %xmm0
movdqa %xmm0, %xmm1
pand %xmm2, %xmm0
pandn %xmm8, %xmm1
movdqa %xmm0, %xmm2
por %xmm1, %xmm2
movdqa %xmm7, %xmm1
movaps %xmm2, -96(%rbp)
pshufd $78, %xmm7, %xmm2
psubq %xmm2, %xmm1
movdqa %xmm2, %xmm14
movdqa %xmm1, %xmm0
pcmpgtd %xmm7, %xmm14
movdqa %xmm7, %xmm1
pcmpeqd %xmm2, %xmm1
pand %xmm0, %xmm1
por %xmm14, %xmm1
pshufd $245, %xmm1, %xmm0
punpckhqdq %xmm0, %xmm0
movdqa %xmm0, %xmm1
pand %xmm2, %xmm0
pandn %xmm7, %xmm1
movdqa -144(%rbp), %xmm7
movdqa %xmm0, %xmm14
por %xmm1, %xmm14
pshufd $78, %xmm7, %xmm2
movdqa %xmm7, %xmm1
movdqa %xmm7, %xmm0
pcmpeqd %xmm2, %xmm1
movdqa %xmm2, %xmm8
psubq %xmm2, %xmm0
pcmpgtd %xmm7, %xmm8
pand %xmm0, %xmm1
por %xmm8, %xmm1
pshufd $78, %xmm5, %xmm8
pshufd $245, %xmm1, %xmm0
punpckhqdq %xmm0, %xmm0
movdqa %xmm0, %xmm1
pand %xmm2, %xmm0
movdqa %xmm9, %xmm2
pandn %xmm7, %xmm1
psubq %xmm3, %xmm2
pshufd $78, %xmm6, %xmm7
por %xmm1, %xmm0
movdqa %xmm9, %xmm1
pcmpeqd %xmm3, %xmm1
pand %xmm2, %xmm1
movdqa %xmm3, %xmm2
pcmpgtd %xmm9, %xmm2
por %xmm2, %xmm1
pshufd $245, %xmm1, %xmm2
punpckhqdq %xmm2, %xmm2
movdqa %xmm2, %xmm1
pand %xmm3, %xmm2
movdqa %xmm6, %xmm3
pandn %xmm9, %xmm1
pcmpeqd %xmm7, %xmm3
por %xmm1, %xmm2
movdqa %xmm6, %xmm1
psubq %xmm7, %xmm1
pand %xmm1, %xmm3
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm3
pshufd $245, %xmm3, %xmm1
punpckhqdq %xmm1, %xmm1
movdqa %xmm1, %xmm3
pandn %xmm6, %xmm3
movdqa %xmm1, %xmm6
movdqa %xmm13, %xmm1
pand %xmm7, %xmm6
movdqa %xmm13, %xmm7
por %xmm3, %xmm6
pshufd $78, %xmm13, %xmm3
pcmpeqd %xmm3, %xmm1
psubq %xmm3, %xmm7
pand %xmm7, %xmm1
movdqa %xmm3, %xmm7
pcmpgtd %xmm13, %xmm7
por %xmm7, %xmm1
pshufd $245, %xmm1, %xmm7
punpckhqdq %xmm7, %xmm7
movdqa %xmm7, %xmm1
pand %xmm3, %xmm7
movdqa %xmm5, %xmm3
pandn %xmm13, %xmm1
pcmpeqd %xmm8, %xmm3
movdqa -176(%rbp), %xmm13
por %xmm1, %xmm7
movdqa %xmm5, %xmm1
psubq %xmm8, %xmm1
pand %xmm1, %xmm3
movdqa %xmm8, %xmm1
pcmpgtd %xmm5, %xmm1
por %xmm1, %xmm3
pshufd $245, %xmm3, %xmm1
punpckhqdq %xmm1, %xmm1
movdqa %xmm1, %xmm3
pand %xmm8, %xmm1
movdqa %xmm13, %xmm8
pandn %xmm5, %xmm3
pshufd $78, %xmm13, %xmm5
por %xmm3, %xmm1
movdqa %xmm13, %xmm3
movdqa %xmm5, %xmm9
pcmpeqd %xmm5, %xmm3
pcmpgtd %xmm13, %xmm9
psubq %xmm5, %xmm8
pand %xmm8, %xmm3
por %xmm9, %xmm3
pshufd $245, %xmm3, %xmm9
punpckhqdq %xmm9, %xmm9
movdqa %xmm9, %xmm3
pand %xmm5, %xmm9
pandn %xmm13, %xmm3
movdqa -192(%rbp), %xmm13
por %xmm3, %xmm9
pshufd $78, %xmm13, %xmm5
movdqa %xmm13, %xmm3
movdqa %xmm13, %xmm8
pcmpeqd %xmm5, %xmm3
psubq %xmm5, %xmm8
pand %xmm8, %xmm3
movdqa %xmm5, %xmm8
pcmpgtd %xmm13, %xmm8
por %xmm8, %xmm3
pshufd $245, %xmm3, %xmm8
punpckhqdq %xmm8, %xmm8
movdqa %xmm8, %xmm3
pand %xmm5, %xmm8
movdqa %xmm4, %xmm5
pandn %xmm13, %xmm3
pcmpeqd %xmm11, %xmm5
por %xmm3, %xmm8
movdqa %xmm4, %xmm3
psubq %xmm11, %xmm3
pand %xmm3, %xmm5
movdqa %xmm11, %xmm3
pcmpgtd %xmm4, %xmm3
por %xmm3, %xmm5
pshufd $245, %xmm5, %xmm3
punpckhqdq %xmm3, %xmm3
movdqa %xmm3, %xmm5
pand %xmm11, %xmm3
pandn %xmm4, %xmm5
por %xmm5, %xmm3
.L366:
movdqa -112(%rbp), %xmm4
movq -232(%rbp), %rdx
movups %xmm4, (%rdx)
movdqa -128(%rbp), %xmm4
movups %xmm4, (%r15)
movdqa -64(%rbp), %xmm4
movups %xmm15, (%r14)
movups %xmm10, 0(%r13)
movups %xmm4, (%r12)
movdqa -80(%rbp), %xmm4
movups %xmm4, (%rbx)
movdqa -96(%rbp), %xmm4
movq -224(%rbp), %rbx
movups %xmm4, (%r11)
movups %xmm14, (%r10)
movups %xmm0, (%r9)
movups %xmm2, (%r8)
movups %xmm6, (%rdi)
movups %xmm7, (%rsi)
movups %xmm1, (%rcx)
movq -216(%rbp), %rcx
movups %xmm9, (%rcx)
movups %xmm8, (%rbx)
movups %xmm3, (%rax)
addq $224, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L368:
.cfi_restore_state
movdqa -144(%rbp), %xmm3
movdqa -160(%rbp), %xmm8
movdqa -176(%rbp), %xmm9
jmp .L366
.cfi_endproc
.LFE18796:
.size _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, .-_ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
.section .text._ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18797:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
movq %rcx, %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $2952, %rsp
.cfi_offset 14, -32
.cfi_offset 13, -40
.cfi_offset 12, -48
.cfi_offset 3, -56
movq %rdi, -2648(%rbp)
movq %rsi, -2808(%rbp)
movq %rdx, -2760(%rbp)
movq %r8, -2736(%rbp)
movq %r9, -2768(%rbp)
cmpq $32, %rdx
jbe .L594
movq %rdi, %r12
movq %rdi, %r14
shrq $3, %r12
movq %r12, %rax
andl $7, %eax
jne .L595
movq %rdx, %r11
movq %rdi, %r13
movq %r8, %rax
.L381:
movq 8(%rax), %rdx
movq 16(%rax), %r9
movq %rdx, %rcx
leaq 1(%r9), %rdi
movq %rdx, %rsi
xorq (%rax), %rdi
rolq $24, %rcx
shrq $11, %rsi
movq %rcx, %rax
leaq (%rdx,%rdx,8), %rcx
leaq 2(%r9), %rdx
addq %rdi, %rax
xorq %rsi, %rcx
movq %rax, %rsi
xorq %rdx, %rcx
leaq (%rax,%rax,8), %rdx
movq %rax, %r8
rolq $24, %rsi
shrq $11, %r8
leaq 3(%r9), %rax
addq %rcx, %rsi
xorq %r8, %rdx
movq %rsi, %r10
movq %rsi, %r8
xorq %rax, %rdx
shrq $11, %r8
rolq $24, %r10
leaq (%rsi,%rsi,8), %rax
leaq 4(%r9), %rsi
addq %rdx, %r10
xorq %r8, %rax
addq $5, %r9
xorq %rsi, %rax
movq %r10, %r8
movq %r10, %rsi
shrq $11, %rsi
rolq $24, %r8
addq %rax, %r8
movq %rsi, %rbx
leaq (%r10,%r10,8), %rsi
xorq %rbx, %rsi
movq %r8, %rbx
leaq (%r8,%r8,8), %r10
rolq $24, %r8
xorq %r9, %rsi
shrq $11, %rbx
xorq %rbx, %r10
addq %rsi, %r8
movq -2736(%rbp), %rbx
movl %esi, %esi
movq %r10, %xmm0
movq %r8, %xmm6
movl %ecx, %r10d
movabsq $34359738359, %r8
punpcklqdq %xmm6, %xmm0
movq %r9, 16(%rbx)
movl %edx, %r9d
movups %xmm0, (%rbx)
movq %r11, %rbx
shrq $3, %rbx
cmpq %r8, %r11
movl $4294967295, %r8d
movl %edi, %r11d
cmova %r8, %rbx
shrq $32, %rdi
movl %eax, %r8d
shrq $32, %rcx
shrq $32, %rdx
imulq %rbx, %r11
shrq $32, %rax
imulq %rbx, %rdi
imulq %rbx, %r10
imulq %rbx, %rcx
shrq $32, %r11
imulq %rbx, %r9
shrq $32, %rdi
salq $6, %r11
imulq %rbx, %rdx
shrq $32, %r10
salq $6, %rdi
addq %r13, %r11
imulq %rbx, %r8
shrq $32, %rcx
salq $6, %r10
addq %r13, %rdi
shrq $32, %r9
salq $6, %rcx
addq %r13, %r10
shrq $32, %rdx
salq $6, %r9
addq %r13, %rcx
shrq $32, %r8
salq $6, %rdx
addq %r13, %r9
salq $6, %r8
addq %r13, %rdx
addq %r13, %r8
imulq %rbx, %rax
imulq %rbx, %rsi
xorl %ebx, %ebx
shrq $32, %rax
shrq $32, %rsi
salq $6, %rax
salq $6, %rsi
addq %r13, %rax
addq %r13, %rsi
.L383:
movdqa (%r10,%rbx,8), %xmm2
movdqa (%r11,%rbx,8), %xmm4
movdqa (%rdi,%rbx,8), %xmm0
movdqa %xmm2, %xmm3
movdqa %xmm4, %xmm1
pcmpeqd %xmm4, %xmm3
psubq %xmm2, %xmm1
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm4, %xmm3
por %xmm3, %xmm1
movdqa %xmm4, %xmm3
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm5
pand %xmm1, %xmm3
pandn %xmm2, %xmm5
pand %xmm1, %xmm2
por %xmm5, %xmm3
movdqa %xmm1, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm0, %xmm4
movdqa %xmm3, %xmm1
pcmpeqd %xmm3, %xmm4
psubq %xmm0, %xmm1
por %xmm5, %xmm2
pand %xmm4, %xmm1
movdqa %xmm0, %xmm4
pcmpgtd %xmm3, %xmm4
por %xmm4, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm0
pandn %xmm3, %xmm4
movdqa %xmm2, %xmm3
por %xmm4, %xmm0
movdqa (%rcx,%rbx,8), %xmm4
pcmpeqd %xmm0, %xmm3
movdqa %xmm0, %xmm1
psubq %xmm2, %xmm1
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm0, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm3
pand %xmm1, %xmm0
movdqa %xmm4, %xmm1
pandn %xmm2, %xmm3
movdqa (%rdx,%rbx,8), %xmm2
por %xmm3, %xmm0
movdqa %xmm2, %xmm3
psubq %xmm2, %xmm1
movaps %xmm0, (%r15,%rbx,8)
movdqa (%r9,%rbx,8), %xmm0
pcmpeqd %xmm4, %xmm3
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm4, %xmm3
por %xmm3, %xmm1
movdqa %xmm4, %xmm3
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm5
pand %xmm1, %xmm3
pandn %xmm2, %xmm5
pand %xmm1, %xmm2
por %xmm5, %xmm3
movdqa %xmm1, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm0, %xmm4
movdqa %xmm3, %xmm1
pcmpeqd %xmm3, %xmm4
psubq %xmm0, %xmm1
por %xmm5, %xmm2
pand %xmm4, %xmm1
movdqa %xmm0, %xmm4
pcmpgtd %xmm3, %xmm4
por %xmm4, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm0
pandn %xmm3, %xmm4
movdqa %xmm2, %xmm3
por %xmm4, %xmm0
movdqa (%r8,%rbx,8), %xmm4
pcmpeqd %xmm0, %xmm3
movdqa %xmm0, %xmm1
psubq %xmm2, %xmm1
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm0, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm3
pand %xmm1, %xmm0
movdqa %xmm4, %xmm1
pandn %xmm2, %xmm3
movdqa (%rsi,%rbx,8), %xmm2
por %xmm3, %xmm0
movdqa %xmm2, %xmm3
psubq %xmm2, %xmm1
movaps %xmm0, 64(%r15,%rbx,8)
movdqa (%rax,%rbx,8), %xmm0
pcmpeqd %xmm4, %xmm3
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm4, %xmm3
por %xmm3, %xmm1
movdqa %xmm4, %xmm3
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm5
pand %xmm1, %xmm3
pandn %xmm2, %xmm5
pand %xmm1, %xmm2
por %xmm5, %xmm3
movdqa %xmm1, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm0, %xmm4
movdqa %xmm3, %xmm1
pcmpeqd %xmm3, %xmm4
psubq %xmm0, %xmm1
por %xmm5, %xmm2
pand %xmm4, %xmm1
movdqa %xmm0, %xmm4
pcmpgtd %xmm3, %xmm4
por %xmm4, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm0
pandn %xmm3, %xmm4
movdqa %xmm2, %xmm3
por %xmm4, %xmm0
pcmpeqd %xmm0, %xmm3
movdqa %xmm0, %xmm1
psubq %xmm2, %xmm1
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm0, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm3
pand %xmm1, %xmm0
pandn %xmm2, %xmm3
por %xmm3, %xmm0
movaps %xmm0, 128(%r15,%rbx,8)
addq $2, %rbx
cmpq $8, %rbx
jne .L383
movq (%r15), %xmm2
movdqa 16(%r15), %xmm0
leaq 192(%r15), %r13
movdqa (%r15), %xmm1
punpcklqdq %xmm2, %xmm2
pxor %xmm2, %xmm1
pxor %xmm2, %xmm0
por %xmm1, %xmm0
movdqa 32(%r15), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 48(%r15), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 64(%r15), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 80(%r15), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 96(%r15), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 112(%r15), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 128(%r15), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 144(%r15), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 160(%r15), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 176(%r15), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm1, %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
je .L384
movdqa .LC4(%rip), %xmm0
movl $2, %esi
movq %r15, %rdi
movups %xmm0, 192(%r15)
movups %xmm0, 208(%r15)
movups %xmm0, 224(%r15)
movups %xmm0, 240(%r15)
movups %xmm0, 256(%r15)
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq (%r15), %xmm2
pcmpeqd %xmm0, %xmm0
movq 184(%r15), %xmm1
punpcklqdq %xmm1, %xmm1
punpcklqdq %xmm2, %xmm2
paddq %xmm1, %xmm0
pcmpeqd %xmm2, %xmm0
pshufd $177, %xmm0, %xmm3
pand %xmm3, %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
jne .L386
movq -2760(%rbp), %rsi
leaq -64(%rbp), %rdx
movq %r13, %rcx
movdqa %xmm2, %xmm0
movq -2648(%rbp), %rdi
call _ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L369
.L386:
movq 96(%r15), %rax
cmpq %rax, 88(%r15)
jne .L482
cmpq 80(%r15), %rax
jne .L425
cmpq 72(%r15), %rax
jne .L483
cmpq 64(%r15), %rax
jne .L484
cmpq 56(%r15), %rax
jne .L485
cmpq 48(%r15), %rax
jne .L486
cmpq 40(%r15), %rax
jne .L487
cmpq 32(%r15), %rax
jne .L488
cmpq 24(%r15), %rax
jne .L489
cmpq 16(%r15), %rax
jne .L490
cmpq 8(%r15), %rax
jne .L491
xorl %ebx, %ebx
movl $1, %edx
cmpq %rax, (%r15)
jne .L428
.L427:
movq %rax, %xmm2
punpcklqdq %xmm2, %xmm2
.L593:
movl $1, -2812(%rbp)
.L423:
cmpq $0, -2768(%rbp)
je .L596
movq -2760(%rbp), %rax
movq -2648(%rbp), %rsi
movaps %xmm2, -2624(%rbp)
subq $2, %rax
movdqu (%rsi,%rax,8), %xmm6
movq %rax, %rcx
movq %rax, -2672(%rbp)
andl $7, %ecx
movq %rcx, -2688(%rbp)
movaps %xmm6, -2800(%rbp)
andl $6, %eax
je .L492
movdqu (%rsi), %xmm4
movdqa %xmm2, %xmm1
movaps %xmm2, -2848(%rbp)
movdqa %xmm4, %xmm0
psubq %xmm4, %xmm1
movaps %xmm4, -2640(%rbp)
pcmpeqd %xmm2, %xmm0
pand %xmm0, %xmm1
movdqa %xmm4, %xmm0
pcmpgtd %xmm2, %xmm0
por %xmm0, %xmm1
pcmpeqd %xmm0, %xmm0
pshufd $245, %xmm1, %xmm1
pxor %xmm1, %xmm0
movaps %xmm1, -2832(%rbp)
movmskpd %xmm0, %ebx
movq %rbx, %rdi
salq $4, %rbx
call __popcountdi2@PLT
leaq _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rcx
movdqa -2640(%rbp), %xmm4
movdqa (%rcx,%rbx), %xmm0
movq %rcx, -2728(%rbp)
cltq
movq %rax, -2704(%rbp)
movaps %xmm0, -336(%rbp)
movzbl -328(%rbp), %edx
movd %xmm0, %r9d
movaps %xmm0, -352(%rbp)
andl $15, %r9d
movq %rdx, %rcx
movzbl -343(%rbp), %edx
movaps %xmm0, -320(%rbp)
movzbl -313(%rbp), %eax
movaps %xmm0, -368(%rbp)
andl $15, %ecx
movq %rdx, %rdi
movzbl -358(%rbp), %edx
movaps %xmm0, -304(%rbp)
movzbl -298(%rbp), %r14d
andl $15, %edi
andl $15, %eax
movaps %xmm0, -224(%rbp)
movzbl -223(%rbp), %r10d
andl $15, %edx
movaps %xmm0, -240(%rbp)
andl $15, %r14d
movzbl -238(%rbp), %r11d
movaps %xmm0, -256(%rbp)
movzbl -253(%rbp), %ebx
andl $15, %r10d
movaps %xmm0, -272(%rbp)
movzbl -268(%rbp), %r12d
andl $15, %r11d
movaps %xmm0, -288(%rbp)
movzbl -283(%rbp), %r13d
andl $15, %ebx
movaps %xmm0, -384(%rbp)
andl $15, %r12d
movq %rcx, -2640(%rbp)
andl $15, %r13d
movq %rdi, -2720(%rbp)
movq %rdx, -2656(%rbp)
movzbl -373(%rbp), %edx
movaps %xmm4, -208(%rbp)
movaps %xmm0, -400(%rbp)
movzbl -388(%rbp), %ecx
andl $15, %edx
movdqa .LC1(%rip), %xmm6
movq -2704(%rbp), %xmm3
movaps %xmm0, -416(%rbp)
movzbl -403(%rbp), %esi
movaps %xmm0, -432(%rbp)
andl $15, %ecx
movdqa %xmm6, %xmm5
movzbl -418(%rbp), %edi
movaps %xmm0, -448(%rbp)
movzbl -208(%rbp,%rax), %eax
andl $15, %esi
punpcklqdq %xmm3, %xmm3
movzbl -208(%rbp,%r14), %r14d
andl $15, %edi
movzbl -208(%rbp,%r13), %r13d
movaps %xmm6, -2752(%rbp)
salq $8, %rax
movzbl -208(%rbp,%rbx), %ebx
movzbl -208(%rbp,%r12), %r12d
pcmpeqd %xmm3, %xmm5
orq %r14, %rax
movzbl -433(%rbp), %r8d
movzbl -208(%rbp,%r11), %r11d
salq $8, %rax
movzbl -208(%rbp,%rdi), %edi
movzbl -208(%rbp,%r10), %r10d
orq %r13, %rax
andl $15, %r8d
movzbl -208(%rbp,%rsi), %esi
movzbl -208(%rbp,%rcx), %ecx
salq $8, %rax
movzbl -208(%rbp,%r8), %r8d
movzbl -208(%rbp,%rdx), %edx
movzbl -208(%rbp,%r9), %r9d
orq %r12, %rax
salq $8, %rax
salq $8, %r8
orq %rbx, %rax
salq $8, %rax
orq %r11, %rax
salq $8, %rax
orq %r10, %rax
salq $8, %rax
orq %rdi, %r8
movq -2720(%rbp), %rdi
salq $8, %r8
orq %r9, %rax
orq %rsi, %r8
salq $8, %r8
orq %rcx, %r8
movq -2640(%rbp), %rcx
movq %rax, -2640(%rbp)
salq $8, %r8
orq %rdx, %r8
movq -2656(%rbp), %rdx
salq $8, %r8
movzbl -208(%rbp,%rdx), %edx
orq %rdx, %r8
movzbl -208(%rbp,%rdi), %edx
salq $8, %r8
orq %rdx, %r8
movzbl -208(%rbp,%rcx), %edx
salq $8, %r8
orq %rdx, %r8
movq %r8, -2632(%rbp)
movdqa .LC0(%rip), %xmm7
movdqa -2832(%rbp), %xmm1
movdqa -2848(%rbp), %xmm2
movdqa %xmm7, %xmm0
movaps %xmm7, -2784(%rbp)
psubq %xmm3, %xmm0
pcmpgtd %xmm6, %xmm3
pand %xmm5, %xmm0
por %xmm3, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L433
movq -2648(%rbp), %rsi
movdqa -2640(%rbp), %xmm6
movq %xmm6, (%rsi)
.L433:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
je .L434
movq -2648(%rbp), %rax
movdqa -2640(%rbp), %xmm6
movhps %xmm6, 8(%rax)
.L434:
movq -2648(%rbp), %rax
movq -2704(%rbp), %rbx
movmskpd %xmm1, %r12d
movaps %xmm4, -2720(%rbp)
movq %r12, %rdi
movaps %xmm2, -2848(%rbp)
salq $4, %r12
leaq (%rax,%rbx,8), %rbx
call __popcountdi2@PLT
movdqa -2720(%rbp), %xmm4
movslq %eax, %rcx
movq %rcx, -2640(%rbp)
movq -2728(%rbp), %rcx
movaps %xmm4, -192(%rbp)
movdqa (%rcx,%r12), %xmm0
movaps %xmm0, -576(%rbp)
movzbl -568(%rbp), %edx
movd %xmm0, %r9d
movaps %xmm0, -464(%rbp)
movzbl -463(%rbp), %eax
andl $15, %r9d
movq %rdx, %rcx
movaps %xmm0, -592(%rbp)
movzbl -583(%rbp), %edx
andl $15, %eax
movaps %xmm0, -608(%rbp)
andl $15, %ecx
movq %rdx, %rsi
movzbl -598(%rbp), %edx
movq %rax, -2704(%rbp)
movaps %xmm0, -560(%rbp)
movzbl -553(%rbp), %eax
andl $15, %esi
movaps %xmm0, -544(%rbp)
movq %rdx, %rdi
movzbl -538(%rbp), %r14d
andl $15, %edi
andl $15, %eax
movq %rcx, -2720(%rbp)
movq %rsi, -2656(%rbp)
andl $15, %r14d
movq %rdi, -2832(%rbp)
movaps %xmm0, -480(%rbp)
movzbl -478(%rbp), %r10d
movaps %xmm0, -496(%rbp)
movzbl -493(%rbp), %r11d
movaps %xmm0, -512(%rbp)
movzbl -508(%rbp), %r12d
andl $15, %r10d
movaps %xmm0, -528(%rbp)
movzbl -523(%rbp), %r13d
andl $15, %r11d
movaps %xmm0, -624(%rbp)
andl $15, %r12d
movzbl -613(%rbp), %edx
movaps %xmm0, -640(%rbp)
andl $15, %r13d
movzbl -628(%rbp), %ecx
movaps %xmm0, -656(%rbp)
movzbl -643(%rbp), %esi
andl $15, %edx
movaps %xmm0, -672(%rbp)
movzbl -658(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -688(%rbp)
movzbl -192(%rbp,%rax), %eax
movzbl -192(%rbp,%r14), %r14d
andl $15, %esi
movzbl -192(%rbp,%r13), %r13d
movzbl -673(%rbp), %r8d
andl $15, %edi
salq $8, %rax
movzbl -192(%rbp,%r12), %r12d
movzbl -192(%rbp,%r11), %r11d
orq %r14, %rax
andl $15, %r8d
movzbl -192(%rbp,%r10), %r10d
movzbl -192(%rbp,%rdi), %edi
salq $8, %rax
movzbl -192(%rbp,%rsi), %esi
movzbl -192(%rbp,%r8), %r8d
orq %r13, %rax
movzbl -192(%rbp,%rcx), %ecx
movzbl -192(%rbp,%rdx), %edx
salq $8, %rax
salq $8, %r8
movzbl -192(%rbp,%r9), %r9d
orq %r12, %rax
salq $8, %rax
orq %r11, %rax
movq -2704(%rbp), %r11
salq $8, %rax
orq %r10, %rax
movzbl -192(%rbp,%r11), %r10d
salq $8, %rax
orq %r10, %rax
salq $8, %rax
orq %rdi, %r8
movq -2832(%rbp), %rdi
salq $8, %r8
orq %r9, %rax
orq %rsi, %r8
movq -2656(%rbp), %rsi
movq %rax, -2704(%rbp)
salq $8, %r8
orq %rcx, %r8
movq -2720(%rbp), %rcx
salq $8, %r8
orq %rdx, %r8
movzbl -192(%rbp,%rdi), %edx
salq $8, %r8
orq %rdx, %r8
movzbl -192(%rbp,%rsi), %edx
salq $8, %r8
orq %rdx, %r8
movzbl -192(%rbp,%rcx), %edx
salq $8, %r8
orq %rdx, %r8
movq %r8, -2696(%rbp)
movdqa -2704(%rbp), %xmm6
testb $4, -2672(%rbp)
movdqa -2848(%rbp), %xmm2
movups %xmm6, (%r15)
je .L435
movq -2648(%rbp), %rax
movdqa -2624(%rbp), %xmm6
movdqa %xmm2, %xmm1
movaps %xmm2, -2880(%rbp)
movdqu 16(%rax), %xmm3
movdqa %xmm6, %xmm0
pcmpeqd %xmm3, %xmm0
psubq %xmm3, %xmm1
movaps %xmm3, -2704(%rbp)
pand %xmm0, %xmm1
movdqa %xmm3, %xmm0
pcmpgtd %xmm6, %xmm0
por %xmm0, %xmm1
pcmpeqd %xmm0, %xmm0
pshufd $245, %xmm1, %xmm1
pxor %xmm1, %xmm0
movaps %xmm1, -2864(%rbp)
movmskpd %xmm0, %r12d
movq %r12, %rdi
salq $4, %r12
call __popcountdi2@PLT
movq -2728(%rbp), %rcx
movdqa -2704(%rbp), %xmm3
cltq
movdqa (%rcx,%r12), %xmm0
movq %rax, -2720(%rbp)
movaps %xmm3, -176(%rbp)
movaps %xmm0, -816(%rbp)
movzbl -808(%rbp), %edx
movd %xmm0, %r9d
movaps %xmm0, -704(%rbp)
movzbl -703(%rbp), %eax
andl $15, %r9d
movaps %xmm0, -832(%rbp)
movq %rdx, %rdi
movzbl -823(%rbp), %edx
movaps %xmm0, -800(%rbp)
movq %rax, %rcx
andl $15, %edi
movzbl -793(%rbp), %eax
movaps %xmm0, -848(%rbp)
movq %rdx, %rsi
movzbl -838(%rbp), %edx
andl $15, %ecx
movaps %xmm0, -784(%rbp)
andl $15, %esi
andl $15, %eax
movzbl -778(%rbp), %r14d
andl $15, %edx
movaps %xmm0, -720(%rbp)
movzbl -718(%rbp), %r10d
movaps %xmm0, -736(%rbp)
andl $15, %r14d
movzbl -733(%rbp), %r11d
movaps %xmm0, -752(%rbp)
movzbl -748(%rbp), %r12d
andl $15, %r10d
movaps %xmm0, -768(%rbp)
movzbl -763(%rbp), %r13d
andl $15, %r11d
movq %rcx, -2704(%rbp)
andl $15, %r12d
movq %rdi, -2656(%rbp)
andl $15, %r13d
movq %rsi, -2832(%rbp)
movq %rdx, -2848(%rbp)
movaps %xmm0, -864(%rbp)
movzbl -853(%rbp), %edx
movaps %xmm0, -880(%rbp)
movzbl -868(%rbp), %ecx
movaps %xmm0, -896(%rbp)
movzbl -883(%rbp), %esi
andl $15, %edx
movaps %xmm0, -912(%rbp)
movzbl -898(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -928(%rbp)
movzbl -176(%rbp,%rax), %eax
movzbl -176(%rbp,%r14), %r14d
andl $15, %esi
movzbl -176(%rbp,%r13), %r13d
movzbl -913(%rbp), %r8d
andl $15, %edi
salq $8, %rax
movzbl -176(%rbp,%r12), %r12d
movzbl -176(%rbp,%r11), %r11d
orq %r14, %rax
andl $15, %r8d
movzbl -176(%rbp,%r10), %r10d
movzbl -176(%rbp,%rdi), %edi
salq $8, %rax
movzbl -176(%rbp,%rsi), %esi
movzbl -176(%rbp,%r8), %r8d
orq %r13, %rax
movzbl -176(%rbp,%rcx), %ecx
movzbl -176(%rbp,%rdx), %edx
salq $8, %rax
salq $8, %r8
movzbl -176(%rbp,%r9), %r9d
orq %r12, %rax
salq $8, %rax
orq %r11, %rax
movq -2704(%rbp), %r11
salq $8, %rax
orq %r10, %rax
movzbl -176(%rbp,%r11), %r10d
salq $8, %rax
orq %r10, %rax
salq $8, %rax
orq %rdi, %r8
movq -2656(%rbp), %rdi
salq $8, %r8
orq %r9, %rax
orq %rsi, %r8
movq -2832(%rbp), %rsi
movq %rax, -2704(%rbp)
salq $8, %r8
orq %rcx, %r8
salq $8, %r8
orq %rdx, %r8
movq -2848(%rbp), %rdx
salq $8, %r8
movzbl -176(%rbp,%rdx), %edx
orq %rdx, %r8
movzbl -176(%rbp,%rsi), %edx
salq $8, %r8
orq %rdx, %r8
movzbl -176(%rbp,%rdi), %edx
salq $8, %r8
orq %rdx, %r8
movq %r8, -2696(%rbp)
movdqa -2752(%rbp), %xmm6
movdqa -2784(%rbp), %xmm0
movdqa -2864(%rbp), %xmm1
movq -2720(%rbp), %xmm4
movdqa %xmm6, %xmm5
movdqa -2880(%rbp), %xmm2
punpcklqdq %xmm4, %xmm4
pcmpeqd %xmm4, %xmm5
psubq %xmm4, %xmm0
pcmpgtd %xmm6, %xmm4
pand %xmm5, %xmm0
por %xmm4, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L436
movdqa -2704(%rbp), %xmm6
movq %xmm6, (%rbx)
.L436:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
je .L437
movdqa -2704(%rbp), %xmm6
movhps %xmm6, 8(%rbx)
.L437:
movq -2720(%rbp), %rax
movmskpd %xmm1, %r12d
movaps %xmm3, -2704(%rbp)
movq %r12, %rdi
movaps %xmm2, -2864(%rbp)
salq $4, %r12
leaq (%rbx,%rax,8), %rbx
call __popcountdi2@PLT
movdqa -2704(%rbp), %xmm3
movslq %eax, %r8
movq -2728(%rbp), %rax
movaps %xmm3, -160(%rbp)
movdqa (%rax,%r12), %xmm0
movaps %xmm0, -1056(%rbp)
movzbl -1048(%rbp), %edx
movd %xmm0, %r9d
movaps %xmm0, -1072(%rbp)
andl $15, %r9d
movq %rdx, %rcx
movzbl -1063(%rbp), %edx
movaps %xmm0, -1088(%rbp)
movaps %xmm0, -944(%rbp)
movzbl -943(%rbp), %eax
andl $15, %ecx
movq %rdx, %rdi
movzbl -1078(%rbp), %edx
movaps %xmm0, -1104(%rbp)
andl $15, %eax
andl $15, %edi
movaps %xmm0, -1040(%rbp)
andl $15, %edx
movq %rax, -2704(%rbp)
movzbl -1033(%rbp), %eax
movq %rdx, -2832(%rbp)
movzbl -1093(%rbp), %edx
movq %rdi, -2656(%rbp)
andl $15, %eax
movaps %xmm0, -1024(%rbp)
movq %rdx, %rdi
movzbl -1018(%rbp), %r14d
andl $15, %edi
movq %rcx, -2720(%rbp)
movaps %xmm0, -960(%rbp)
andl $15, %r14d
movzbl -958(%rbp), %r10d
movaps %xmm0, -976(%rbp)
movzbl -973(%rbp), %r11d
movaps %xmm0, -992(%rbp)
movzbl -988(%rbp), %r12d
andl $15, %r10d
movaps %xmm0, -1008(%rbp)
movzbl -1003(%rbp), %r13d
andl $15, %r11d
movq %rdi, -2848(%rbp)
andl $15, %r12d
movaps %xmm0, -1120(%rbp)
andl $15, %r13d
movzbl -1108(%rbp), %edx
movaps %xmm0, -1136(%rbp)
movzbl -1123(%rbp), %ecx
movaps %xmm0, -1152(%rbp)
movzbl -1138(%rbp), %esi
andl $15, %edx
movaps %xmm0, -1168(%rbp)
movzbl -160(%rbp,%rax), %eax
movzbl -160(%rbp,%r14), %r14d
andl $15, %ecx
movzbl -160(%rbp,%r13), %r13d
movzbl -1153(%rbp), %edi
andl $15, %esi
salq $8, %rax
movzbl -160(%rbp,%r12), %r12d
movzbl -160(%rbp,%r11), %r11d
orq %r14, %rax
andl $15, %edi
movzbl -160(%rbp,%r10), %r10d
movzbl -160(%rbp,%rsi), %esi
salq $8, %rax
movzbl -160(%rbp,%rdi), %edi
movzbl -160(%rbp,%rcx), %ecx
orq %r13, %rax
movzbl -160(%rbp,%rdx), %edx
movzbl -160(%rbp,%r9), %r9d
salq $8, %rax
salq $8, %rdi
orq %r12, %rax
salq $8, %rax
orq %r11, %rax
movq -2704(%rbp), %r11
salq $8, %rax
orq %r10, %rax
movzbl -160(%rbp,%r11), %r10d
movq -2848(%rbp), %r11
salq $8, %rax
orq %r10, %rax
salq $8, %rax
orq %rsi, %rdi
movq -2656(%rbp), %rsi
salq $8, %rdi
orq %r9, %rax
orq %rcx, %rdi
movq -2720(%rbp), %rcx
movq %rax, -2704(%rbp)
salq $8, %rdi
orq %rdx, %rdi
movzbl -160(%rbp,%r11), %edx
salq $8, %rdi
orq %rdx, %rdi
movq -2832(%rbp), %rdx
salq $8, %rdi
movzbl -160(%rbp,%rdx), %edx
orq %rdx, %rdi
movzbl -160(%rbp,%rsi), %edx
salq $8, %rdi
orq %rdx, %rdi
movzbl -160(%rbp,%rcx), %edx
salq $8, %rdi
orq %rdx, %rdi
movq %rdi, -2696(%rbp)
movq -2640(%rbp), %rax
movdqa -2704(%rbp), %xmm6
movdqa -2864(%rbp), %xmm2
movups %xmm6, (%r15,%rax,8)
addq %r8, %rax
cmpq $5, -2688(%rbp)
movq %rax, -2640(%rbp)
jbe .L435
movq -2648(%rbp), %rcx
movdqa -2624(%rbp), %xmm6
movdqa %xmm2, %xmm1
movaps %xmm2, -2880(%rbp)
movdqu 32(%rcx), %xmm3
movdqa %xmm6, %xmm0
pcmpeqd %xmm3, %xmm0
psubq %xmm3, %xmm1
movaps %xmm3, -2704(%rbp)
pand %xmm0, %xmm1
movdqa %xmm3, %xmm0
pcmpgtd %xmm6, %xmm0
por %xmm0, %xmm1
pcmpeqd %xmm0, %xmm0
pshufd $245, %xmm1, %xmm1
pxor %xmm1, %xmm0
movaps %xmm1, -2864(%rbp)
movmskpd %xmm0, %r12d
movq %r12, %rdi
salq $4, %r12
call __popcountdi2@PLT
movdqa -2704(%rbp), %xmm3
movslq %eax, %rcx
movq -2728(%rbp), %rax
movq %rcx, -2720(%rbp)
movdqa (%rax,%r12), %xmm0
movaps %xmm3, -144(%rbp)
movaps %xmm0, -1184(%rbp)
movzbl -1183(%rbp), %eax
movd %xmm0, %r10d
movaps %xmm0, -1200(%rbp)
andl $15, %r10d
andl $15, %eax
movaps %xmm0, -1296(%rbp)
movzbl -1288(%rbp), %edx
movq %rax, -2704(%rbp)
movzbl -1198(%rbp), %eax
movaps %xmm0, -1280(%rbp)
movq %rdx, %rdi
movaps %xmm0, -1312(%rbp)
movq %rax, %rsi
movzbl -1303(%rbp), %edx
andl $15, %edi
movzbl -1273(%rbp), %eax
movaps %xmm0, -1264(%rbp)
movzbl -1258(%rbp), %r14d
andl $15, %esi
andl $15, %edx
movaps %xmm0, -1216(%rbp)
movzbl -1213(%rbp), %r11d
andl $15, %eax
movaps %xmm0, -1232(%rbp)
andl $15, %r14d
movzbl -1228(%rbp), %r12d
movaps %xmm0, -1248(%rbp)
movzbl -1243(%rbp), %r13d
andl $15, %r11d
movq %rsi, -2656(%rbp)
andl $15, %r12d
movq %rdi, -2832(%rbp)
andl $15, %r13d
movaps %xmm0, -1328(%rbp)
movq %rdx, -2848(%rbp)
movzbl -1318(%rbp), %edx
movaps %xmm0, -1344(%rbp)
movzbl -1333(%rbp), %ecx
movaps %xmm0, -1360(%rbp)
movzbl -1348(%rbp), %esi
andl $15, %edx
movaps %xmm0, -1376(%rbp)
movzbl -1363(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -1392(%rbp)
movzbl -1378(%rbp), %r8d
andl $15, %esi
movaps %xmm0, -1408(%rbp)
movzbl -144(%rbp,%rax), %eax
movzbl -144(%rbp,%r14), %r14d
andl $15, %edi
movzbl -144(%rbp,%r13), %r13d
movzbl -1393(%rbp), %r9d
andl $15, %r8d
salq $8, %rax
movzbl -144(%rbp,%r12), %r12d
movzbl -144(%rbp,%r11), %r11d
orq %r14, %rax
movq -2656(%rbp), %r14
andl $15, %r9d
movzbl -144(%rbp,%r8), %r8d
salq $8, %rax
movzbl -144(%rbp,%rdi), %edi
movzbl -144(%rbp,%r9), %r9d
orq %r13, %rax
movzbl -144(%rbp,%rsi), %esi
movzbl -144(%rbp,%rcx), %ecx
salq $8, %rax
salq $8, %r9
movzbl -144(%rbp,%rdx), %edx
movzbl -144(%rbp,%r10), %r10d
orq %r12, %rax
salq $8, %rax
orq %r11, %rax
movzbl -144(%rbp,%r14), %r11d
salq $8, %rax
orq %r11, %rax
movq -2704(%rbp), %r11
salq $8, %rax
movzbl -144(%rbp,%r11), %r11d
orq %r11, %rax
salq $8, %rax
orq %r8, %r9
salq $8, %r9
orq %r10, %rax
orq %rdi, %r9
movq -2832(%rbp), %rdi
salq $8, %r9
orq %rsi, %r9
salq $8, %r9
orq %rcx, %r9
salq $8, %r9
orq %rdx, %r9
movq -2848(%rbp), %rdx
salq $8, %r9
movzbl -144(%rbp,%rdx), %edx
orq %rdx, %r9
movzbl -144(%rbp,%rdi), %edx
movq %rax, -2704(%rbp)
movdqa -2752(%rbp), %xmm6
movdqa -2784(%rbp), %xmm0
salq $8, %r9
movq -2720(%rbp), %xmm4
orq %rdx, %r9
movdqa -2864(%rbp), %xmm1
movdqa %xmm6, %xmm5
movq %r9, -2696(%rbp)
movdqa -2880(%rbp), %xmm2
punpcklqdq %xmm4, %xmm4
pcmpeqd %xmm4, %xmm5
psubq %xmm4, %xmm0
pcmpgtd %xmm6, %xmm4
pand %xmm5, %xmm0
por %xmm4, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L438
movdqa -2704(%rbp), %xmm6
movq %xmm6, (%rbx)
.L438:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
je .L439
movdqa -2704(%rbp), %xmm6
movhps %xmm6, 8(%rbx)
.L439:
movq -2720(%rbp), %rax
movmskpd %xmm1, %r12d
movaps %xmm3, -2704(%rbp)
movq %r12, %rdi
movaps %xmm2, -2864(%rbp)
salq $4, %r12
leaq (%rbx,%rax,8), %rbx
call __popcountdi2@PLT
movdqa -2704(%rbp), %xmm3
movslq %eax, %r8
movq -2728(%rbp), %rax
movaps %xmm3, -128(%rbp)
movdqa (%rax,%r12), %xmm0
movaps %xmm0, -1424(%rbp)
movzbl -1423(%rbp), %eax
movd %xmm0, %ecx
movaps %xmm0, -1440(%rbp)
andl $15, %ecx
andl $15, %eax
movaps %xmm0, -1536(%rbp)
movzbl -1528(%rbp), %edx
movq %rax, -2720(%rbp)
movzbl -1438(%rbp), %eax
movaps %xmm0, -1520(%rbp)
movq %rdx, %rdi
movq %rax, %rsi
movaps %xmm0, -1552(%rbp)
movzbl -1513(%rbp), %eax
andl $15, %edi
movzbl -1543(%rbp), %edx
movaps %xmm0, -1504(%rbp)
movzbl -1498(%rbp), %r14d
andl $15, %esi
andl $15, %eax
movq %rsi, -2656(%rbp)
andl $15, %edx
movq %rdi, -2832(%rbp)
andl $15, %r14d
movq %rdx, -2848(%rbp)
movaps %xmm0, -1456(%rbp)
movzbl -1453(%rbp), %r11d
movaps %xmm0, -1472(%rbp)
movzbl -1468(%rbp), %r12d
movaps %xmm0, -1488(%rbp)
movzbl -1483(%rbp), %r13d
andl $15, %r11d
movaps %xmm0, -1568(%rbp)
movzbl -1558(%rbp), %edx
andl $15, %r12d
movq %rcx, -2704(%rbp)
andl $15, %r13d
movaps %xmm0, -1584(%rbp)
movzbl -1573(%rbp), %ecx
andl $15, %edx
movaps %xmm0, -1600(%rbp)
movzbl -1588(%rbp), %esi
movaps %xmm0, -1616(%rbp)
movzbl -1603(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -1632(%rbp)
movzbl -1618(%rbp), %r9d
andl $15, %esi
movaps %xmm0, -1648(%rbp)
movzbl -128(%rbp,%rax), %eax
andl $15, %edi
movzbl -128(%rbp,%r14), %r14d
movzbl -128(%rbp,%r13), %r13d
movzbl -128(%rbp,%r12), %r12d
andl $15, %r9d
salq $8, %rax
movzbl -128(%rbp,%rdi), %edi
movzbl -128(%rbp,%rsi), %esi
orq %r14, %rax
movzbl -128(%rbp,%r11), %r11d
movzbl -1633(%rbp), %r10d
salq $8, %rax
movzbl -128(%rbp,%r9), %r9d
movzbl -128(%rbp,%rcx), %ecx
orq %r13, %rax
movq -2720(%rbp), %r14
andl $15, %r10d
movzbl -128(%rbp,%rdx), %edx
salq $8, %rax
movzbl -128(%rbp,%r10), %r10d
orq %r12, %rax
movq -2656(%rbp), %r12
salq $8, %rax
salq $8, %r10
orq %r11, %rax
movzbl -128(%rbp,%r12), %r11d
salq $8, %rax
orq %r11, %rax
movzbl -128(%rbp,%r14), %r11d
salq $8, %rax
orq %r11, %rax
movq -2704(%rbp), %r11
salq $8, %rax
orq %r9, %r10
salq $8, %r10
movzbl -128(%rbp,%r11), %r11d
orq %rdi, %r10
movq -2832(%rbp), %rdi
salq $8, %r10
orq %r11, %rax
orq %rsi, %r10
movq %rax, -2704(%rbp)
salq $8, %r10
orq %rcx, %r10
salq $8, %r10
orq %rdx, %r10
movq -2848(%rbp), %rdx
salq $8, %r10
movzbl -128(%rbp,%rdx), %edx
orq %rdx, %r10
movzbl -128(%rbp,%rdi), %edx
salq $8, %r10
orq %rdx, %r10
movq %r10, -2696(%rbp)
movq -2640(%rbp), %rax
movdqa -2704(%rbp), %xmm6
movdqa -2864(%rbp), %xmm2
movups %xmm6, (%r15,%rax,8)
addq %r8, %rax
movq %rax, -2640(%rbp)
.L435:
movq -2688(%rbp), %rcx
leaq -2(%rcx), %rax
leaq 1(%rcx), %rdx
movq -2640(%rbp), %rcx
andq $-2, %rax
addq $2, %rax
cmpq $2, %rdx
movl $2, %edx
cmovbe %rdx, %rax
leaq 0(,%rcx,8), %r13
.L432:
movq -2688(%rbp), %rcx
cmpq %rax, %rcx
je .L440
movdqa -2752(%rbp), %xmm7
subq %rax, %rcx
movdqa %xmm2, %xmm6
movdqa -2784(%rbp), %xmm1
movq %rcx, %xmm0
movq -2648(%rbp), %rcx
movaps %xmm2, -2896(%rbp)
punpcklqdq %xmm0, %xmm0
movdqa %xmm7, %xmm3
pcmpeqd %xmm0, %xmm3
movdqu (%rcx,%rax,8), %xmm5
psubq %xmm0, %xmm1
pcmpgtd %xmm7, %xmm0
psubq %xmm5, %xmm6
movaps %xmm5, -2688(%rbp)
pand %xmm3, %xmm1
por %xmm1, %xmm0
movdqa %xmm6, %xmm1
movdqa -2624(%rbp), %xmm6
pshufd $245, %xmm0, %xmm4
movdqa %xmm6, %xmm3
movaps %xmm4, -2864(%rbp)
pcmpeqd %xmm5, %xmm3
pand %xmm3, %xmm1
movdqa %xmm5, %xmm3
pcmpgtd %xmm6, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm6
movaps %xmm1, -2880(%rbp)
pandn %xmm4, %xmm6
movmskpd %xmm6, %r12d
movq %r12, %rdi
salq $4, %r12
call __popcountdi2@PLT
movq -2728(%rbp), %rcx
movdqa -2688(%rbp), %xmm5
cltq
movdqa (%rcx,%r12), %xmm0
movq %rax, -2704(%rbp)
movaps %xmm5, -112(%rbp)
movaps %xmm0, -1664(%rbp)
movzbl -1663(%rbp), %eax
movd %xmm0, %ecx
movaps %xmm0, -1680(%rbp)
andl $15, %ecx
movq %rax, %rdi
movzbl -1678(%rbp), %eax
movaps %xmm0, -1760(%rbp)
movaps %xmm0, -1776(%rbp)
movzbl -1768(%rbp), %edx
andl $15, %edi
movq %rax, %rsi
movzbl -1753(%rbp), %eax
movaps %xmm0, -1744(%rbp)
movzbl -1738(%rbp), %r14d
andl $15, %esi
andl $15, %edx
movaps %xmm0, -1696(%rbp)
movzbl -1693(%rbp), %r10d
andl $15, %eax
movaps %xmm0, -1712(%rbp)
andl $15, %r14d
movzbl -1708(%rbp), %r11d
movaps %xmm0, -1728(%rbp)
movzbl -1723(%rbp), %r12d
andl $15, %r10d
movq %rcx, -2688(%rbp)
andl $15, %r11d
movq %rdi, -2720(%rbp)
andl $15, %r12d
movq %rsi, -2656(%rbp)
movaps %xmm0, -1792(%rbp)
movq %rdx, -2832(%rbp)
movzbl -1783(%rbp), %edx
movaps %xmm0, -1808(%rbp)
movaps %xmm0, -1824(%rbp)
movq %rdx, %r8
movzbl -1813(%rbp), %ecx
movzbl -1798(%rbp), %edx
movaps %xmm0, -1840(%rbp)
andl $15, %r8d
movzbl -1828(%rbp), %esi
movaps %xmm0, -1856(%rbp)
andl $15, %edx
andl $15, %ecx
movzbl -1843(%rbp), %edi
movaps %xmm0, -1872(%rbp)
andl $15, %esi
movaps %xmm0, -1888(%rbp)
movzbl -112(%rbp,%rax), %eax
movzbl -112(%rbp,%r14), %r14d
andl $15, %edi
movzbl -112(%rbp,%r12), %r12d
movzbl -112(%rbp,%r11), %r11d
movq %r8, -2848(%rbp)
salq $8, %rax
movzbl -112(%rbp,%r10), %r10d
movzbl -1873(%rbp), %r9d
orq %r14, %rax
movzbl -112(%rbp,%rdi), %edi
movzbl -112(%rbp,%rsi), %esi
salq $8, %rax
movq -2720(%rbp), %r14
andl $15, %r9d
movzbl -1858(%rbp), %r8d
orq %r12, %rax
movzbl -112(%rbp,%r9), %r9d
movzbl -112(%rbp,%rcx), %ecx
salq $8, %rax
andl $15, %r8d
movzbl -112(%rbp,%rdx), %edx
orq %r11, %rax
movzbl -112(%rbp,%r8), %r8d
movq -2688(%rbp), %r11
salq $8, %rax
orq %r10, %rax
movq -2656(%rbp), %r10
salq $8, %rax
movzbl -112(%rbp,%r10), %r10d
orq %r10, %rax
movzbl -112(%rbp,%r14), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -112(%rbp,%r11), %r10d
salq $8, %rax
salq $8, %r9
orq %r8, %r9
movq -2848(%rbp), %r8
orq %r10, %rax
salq $8, %r9
orq %rdi, %r9
salq $8, %r9
orq %rsi, %r9
salq $8, %r9
orq %rcx, %r9
salq $8, %r9
orq %rdx, %r9
movzbl -112(%rbp,%r8), %edx
movq %rax, -2688(%rbp)
movdqa -2752(%rbp), %xmm7
movdqa -2784(%rbp), %xmm0
salq $8, %r9
movq -2704(%rbp), %xmm3
orq %rdx, %r9
movq -2832(%rbp), %rdx
movdqa %xmm7, %xmm6
salq $8, %r9
movdqa -2864(%rbp), %xmm4
movdqa -2880(%rbp), %xmm1
punpcklqdq %xmm3, %xmm3
movzbl -112(%rbp,%rdx), %edx
movdqa -2896(%rbp), %xmm2
pcmpeqd %xmm3, %xmm6
psubq %xmm3, %xmm0
pcmpgtd %xmm7, %xmm3
orq %rdx, %r9
movq %r9, -2680(%rbp)
pand %xmm6, %xmm0
por %xmm3, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L441
movdqa -2688(%rbp), %xmm6
movq %xmm6, (%rbx)
.L441:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
je .L442
movdqa -2688(%rbp), %xmm6
movhps %xmm6, 8(%rbx)
.L442:
pand %xmm4, %xmm1
movq -2704(%rbp), %rax
movaps %xmm5, -2688(%rbp)
movmskpd %xmm1, %r12d
movaps %xmm2, -2864(%rbp)
movq %r12, %rdi
leaq (%rbx,%rax,8), %rbx
salq $4, %r12
call __popcountdi2@PLT
movq -2728(%rbp), %rcx
movdqa -2688(%rbp), %xmm5
movl %eax, -2848(%rbp)
movdqa (%rcx,%r12), %xmm0
movaps %xmm5, -96(%rbp)
movaps %xmm0, -1904(%rbp)
movzbl -1903(%rbp), %eax
movd %xmm0, %ecx
movaps %xmm0, -2016(%rbp)
movzbl -2008(%rbp), %edx
andl $15, %ecx
movq %rax, %rdi
movaps %xmm0, -1920(%rbp)
movzbl -1918(%rbp), %eax
andl $15, %edx
movaps %xmm0, -2032(%rbp)
andl $15, %edi
movq %rdx, -2656(%rbp)
movzbl -2023(%rbp), %edx
movq %rax, %rsi
movaps %xmm0, -2000(%rbp)
movzbl -1993(%rbp), %eax
andl $15, %esi
movaps %xmm0, -1984(%rbp)
movq %rdx, %r8
movzbl -1978(%rbp), %r14d
andl $15, %r8d
andl $15, %eax
movq %rcx, -2688(%rbp)
movq %rdi, -2704(%rbp)
andl $15, %r14d
movq %rsi, -2720(%rbp)
movq %r8, -2832(%rbp)
movaps %xmm0, -1936(%rbp)
movzbl -1933(%rbp), %r10d
movaps %xmm0, -1952(%rbp)
movzbl -1948(%rbp), %r11d
movaps %xmm0, -1968(%rbp)
movzbl -1963(%rbp), %r12d
andl $15, %r10d
movaps %xmm0, -2048(%rbp)
movzbl -2038(%rbp), %edx
andl $15, %r11d
movaps %xmm0, -2064(%rbp)
andl $15, %r12d
movzbl -2053(%rbp), %ecx
movaps %xmm0, -2080(%rbp)
movzbl -2068(%rbp), %esi
andl $15, %edx
movaps %xmm0, -2096(%rbp)
movzbl -2083(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -2112(%rbp)
movzbl -2098(%rbp), %r8d
andl $15, %esi
movaps %xmm0, -2128(%rbp)
movzbl -96(%rbp,%rax), %eax
andl $15, %edi
movzbl -96(%rbp,%r14), %r14d
movzbl -96(%rbp,%r12), %r12d
movzbl -96(%rbp,%r11), %r11d
andl $15, %r8d
salq $8, %rax
movzbl -96(%rbp,%rdi), %edi
movzbl -96(%rbp,%rsi), %esi
orq %r14, %rax
movzbl -96(%rbp,%r10), %r10d
movzbl -2113(%rbp), %r9d
salq $8, %rax
movzbl -96(%rbp,%r8), %r8d
movzbl -96(%rbp,%rcx), %ecx
orq %r12, %rax
movq -2704(%rbp), %r14
andl $15, %r9d
movzbl -96(%rbp,%rdx), %edx
salq $8, %rax
movzbl -96(%rbp,%r9), %r9d
orq %r11, %rax
movq -2688(%rbp), %r11
salq $8, %rax
salq $8, %r9
orq %r10, %rax
movq -2720(%rbp), %r10
salq $8, %rax
movzbl -96(%rbp,%r10), %r10d
orq %r10, %rax
movzbl -96(%rbp,%r14), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -96(%rbp,%r11), %r10d
salq $8, %rax
orq %r8, %r9
movq -2832(%rbp), %r8
salq $8, %r9
orq %r10, %rax
orq %rdi, %r9
movq %rax, -2688(%rbp)
salq $8, %r9
orq %rsi, %r9
salq $8, %r9
orq %rcx, %r9
salq $8, %r9
orq %rdx, %r9
movzbl -96(%rbp,%r8), %edx
salq $8, %r9
orq %rdx, %r9
movq -2656(%rbp), %rdx
salq $8, %r9
movzbl -96(%rbp,%rdx), %edx
orq %rdx, %r9
movq %r9, -2680(%rbp)
movdqa -2688(%rbp), %xmm6
movslq -2848(%rbp), %rax
addq %rax, -2640(%rbp)
movq -2640(%rbp), %rcx
movdqa -2864(%rbp), %xmm2
movups %xmm6, (%r15,%r13)
leaq 0(,%rcx,8), %r13
.L440:
movq -2648(%rbp), %rax
movq -2672(%rbp), %r12
subq -2640(%rbp), %r12
leaq (%rax,%r12,8), %rax
cmpl $8, %r13d
jnb .L443
testl %r13d, %r13d
jne .L597
.L444:
cmpl $8, %r13d
jnb .L447
.L601:
testl %r13d, %r13d
jne .L598
.L448:
movq -2672(%rbp), %rcx
movq %rbx, %rax
subq -2648(%rbp), %rax
sarq $3, %rax
subq %rax, %rcx
subq %rax, %r12
movq %rax, -2848(%rbp)
movq %rcx, -2832(%rbp)
leaq (%rbx,%r12,8), %rax
je .L493
movdqu (%rbx), %xmm6
leaq 64(%rbx), %rdx
leaq -64(%rax), %rcx
movaps %xmm6, -2864(%rbp)
movdqu 16(%rbx), %xmm6
movaps %xmm6, -2880(%rbp)
movdqu 32(%rbx), %xmm6
movaps %xmm6, -2896(%rbp)
movdqu 48(%rbx), %xmm6
movaps %xmm6, -2912(%rbp)
movdqu -64(%rax), %xmm6
movaps %xmm6, -2928(%rbp)
movdqu -48(%rax), %xmm6
movaps %xmm6, -2944(%rbp)
movdqu -32(%rax), %xmm6
movaps %xmm6, -2960(%rbp)
movdqu -16(%rax), %xmm6
movaps %xmm6, -2976(%rbp)
cmpq %rcx, %rdx
je .L494
movq %r15, -2984(%rbp)
xorl %r13d, %r13d
movl $2, %r14d
movq %rcx, %r15
movaps %xmm2, -2640(%rbp)
jmp .L455
.p2align 4,,10
.p2align 3
.L600:
movdqu -64(%r15), %xmm5
movdqu -48(%r15), %xmm4
prefetcht0 -256(%r15)
subq $64, %r15
movdqu 32(%r15), %xmm3
movdqu 48(%r15), %xmm1
.L454:
movdqa -2624(%rbp), %xmm7
movdqa -2640(%rbp), %xmm0
movq %rdx, -2656(%rbp)
movaps %xmm1, -2720(%rbp)
movdqa %xmm7, %xmm2
psubq %xmm5, %xmm0
movaps %xmm3, -2704(%rbp)
pcmpeqd %xmm5, %xmm2
movaps %xmm4, -2688(%rbp)
pand %xmm2, %xmm0
movdqa %xmm5, %xmm2
pcmpgtd %xmm7, %xmm2
pshufd $78, %xmm5, %xmm7
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm6
movdqa %xmm0, %xmm2
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm6
punpckhqdq %xmm0, %xmm2
pandn %xmm6, %xmm2
movdqa %xmm2, %xmm6
pand %xmm7, %xmm2
pandn %xmm5, %xmm6
por %xmm6, %xmm2
movaps %xmm2, -2672(%rbp)
call __popcountdi2@PLT
movdqa -2672(%rbp), %xmm2
leaq -2(%r12,%r13), %rsi
movdqa -2624(%rbp), %xmm7
movdqa -2688(%rbp), %xmm4
movdqa -2640(%rbp), %xmm0
cltq
movups %xmm2, (%rbx,%r13,8)
addq $2, %r13
movups %xmm2, (%rbx,%rsi,8)
movdqa %xmm7, %xmm2
psubq %xmm4, %xmm0
subq %rax, %r13
pcmpeqd %xmm4, %xmm2
pshufd $78, %xmm4, %xmm6
pand %xmm2, %xmm0
movdqa %xmm4, %xmm2
pcmpgtd %xmm7, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm5
movdqa %xmm0, %xmm2
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm5
punpckhqdq %xmm0, %xmm2
pandn %xmm5, %xmm2
movdqa %xmm2, %xmm5
pand %xmm6, %xmm2
pandn %xmm4, %xmm5
por %xmm5, %xmm2
movaps %xmm2, -2672(%rbp)
call __popcountdi2@PLT
movdqa -2672(%rbp), %xmm2
leaq -4(%r12,%r13), %rsi
movdqa -2624(%rbp), %xmm7
movdqa -2704(%rbp), %xmm3
movdqa -2640(%rbp), %xmm0
cltq
movups %xmm2, (%rbx,%r13,8)
movups %xmm2, (%rbx,%rsi,8)
movdqa %xmm7, %xmm2
psubq %xmm3, %xmm0
movq %r14, %rsi
pcmpeqd %xmm3, %xmm2
pshufd $78, %xmm3, %xmm5
subq %rax, %rsi
addq %rsi, %r13
pand %xmm2, %xmm0
movdqa %xmm3, %xmm2
pcmpgtd %xmm7, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm4
movdqa %xmm0, %xmm2
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm4
punpckhqdq %xmm0, %xmm2
pandn %xmm4, %xmm2
movdqa %xmm2, %xmm4
pand %xmm5, %xmm2
pandn %xmm3, %xmm4
por %xmm4, %xmm2
movaps %xmm2, -2672(%rbp)
call __popcountdi2@PLT
movdqa -2672(%rbp), %xmm2
leaq -6(%r12,%r13), %rdi
movq %r14, %rcx
movdqa -2624(%rbp), %xmm7
movdqa -2720(%rbp), %xmm1
cltq
subq $8, %r12
movups %xmm2, (%rbx,%r13,8)
movdqa -2640(%rbp), %xmm0
subq %rax, %rcx
movups %xmm2, (%rbx,%rdi,8)
movdqa %xmm7, %xmm2
pshufd $78, %xmm1, %xmm4
addq %rcx, %r13
pcmpeqd %xmm1, %xmm2
psubq %xmm1, %xmm0
pand %xmm2, %xmm0
movdqa %xmm1, %xmm2
pcmpgtd %xmm7, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm2
pandn %xmm3, %xmm2
movdqa %xmm2, %xmm3
pandn %xmm1, %xmm3
movdqa %xmm2, %xmm1
pand %xmm4, %xmm1
por %xmm3, %xmm1
movaps %xmm1, -2672(%rbp)
call __popcountdi2@PLT
movdqa -2672(%rbp), %xmm1
leaq 0(%r13,%r12), %rsi
movq -2656(%rbp), %rdx
cltq
movups %xmm1, (%rbx,%r13,8)
movups %xmm1, (%rbx,%rsi,8)
movq %r14, %rsi
subq %rax, %rsi
addq %rsi, %r13
cmpq %r15, %rdx
je .L599
.L455:
movq %rdx, %rax
subq %rbx, %rax
sarq $3, %rax
subq %r13, %rax
cmpq $8, %rax
ja .L600
movdqu (%rdx), %xmm5
movdqu 16(%rdx), %xmm4
prefetcht0 256(%rdx)
addq $64, %rdx
movdqu -32(%rdx), %xmm3
movdqu -16(%rdx), %xmm1
jmp .L454
.p2align 4,,10
.p2align 3
.L429:
cmpq $23, %rdx
je .L592
.L428:
movq %rdx, %rcx
addq $1, %rdx
cmpq %rax, (%r15,%rdx,8)
je .L429
movl $12, %edx
subq $11, %rcx
subq %rbx, %rdx
cmpq %rdx, %rcx
jb .L427
.L592:
movq (%r15,%rbx,8), %rax
jmp .L427
.p2align 4,,10
.p2align 3
.L595:
movq %rdx, %rbx
movl $8, %edx
subq %rax, %rdx
leaq -8(%rax,%rbx), %r11
movq %r8, %rax
leaq (%rdi,%rdx,8), %r13
jmp .L381
.p2align 4,,10
.p2align 3
.L599:
movdqa -2640(%rbp), %xmm2
movq -2984(%rbp), %r15
leaq (%rbx,%r13,8), %rdx
leaq (%r12,%r13), %r14
addq $2, %r13
.L452:
movdqa -2864(%rbp), %xmm7
movdqa -2624(%rbp), %xmm6
movdqa %xmm2, %xmm0
movq %rdx, -2688(%rbp)
movaps %xmm2, -2672(%rbp)
movdqa %xmm7, %xmm1
psubq %xmm7, %xmm0
pshufd $78, %xmm7, %xmm4
pcmpeqd %xmm6, %xmm1
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -2640(%rbp)
call __popcountdi2@PLT
movdqa -2640(%rbp), %xmm1
movdqa -2880(%rbp), %xmm7
movq -2688(%rbp), %rdx
movdqa -2624(%rbp), %xmm6
cltq
movdqa -2672(%rbp), %xmm2
pshufd $78, %xmm7, %xmm4
subq %rax, %r13
movups %xmm1, (%rdx)
movups %xmm1, -16(%rbx,%r14,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -2640(%rbp)
call __popcountdi2@PLT
movdqa -2640(%rbp), %xmm1
leaq -4(%r12,%r13), %rdx
movdqa -2896(%rbp), %xmm7
movdqa -2624(%rbp), %xmm6
movdqa -2672(%rbp), %xmm2
cltq
movups %xmm1, (%rbx,%r13,8)
pshufd $78, %xmm7, %xmm4
subq %rax, %r13
movups %xmm1, (%rbx,%rdx,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
leaq 2(%r13), %r14
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
movl $2, %r13d
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -2640(%rbp)
call __popcountdi2@PLT
movdqa -2912(%rbp), %xmm7
leaq -6(%r12,%r14), %rdx
movdqa -2640(%rbp), %xmm1
movdqa -2624(%rbp), %xmm6
movdqa -2672(%rbp), %xmm2
cltq
movups %xmm1, (%rbx,%r14,8)
pshufd $78, %xmm7, %xmm4
movups %xmm1, (%rbx,%rdx,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
movq %r13, %rdx
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
subq %rax, %rdx
addq %rdx, %r14
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -2640(%rbp)
call __popcountdi2@PLT
movdqa -2928(%rbp), %xmm7
leaq -8(%r12,%r14), %rdx
movdqa -2640(%rbp), %xmm1
movdqa -2624(%rbp), %xmm6
movdqa -2672(%rbp), %xmm2
cltq
movups %xmm1, (%rbx,%r14,8)
pshufd $78, %xmm7, %xmm4
movups %xmm1, (%rbx,%rdx,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
movq %r13, %rdx
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
subq %rax, %rdx
addq %rdx, %r14
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -2640(%rbp)
call __popcountdi2@PLT
movdqa -2944(%rbp), %xmm7
leaq -10(%r12,%r14), %rdx
movdqa -2640(%rbp), %xmm1
movdqa -2624(%rbp), %xmm6
movdqa -2672(%rbp), %xmm2
cltq
movups %xmm1, (%rbx,%r14,8)
pshufd $78, %xmm7, %xmm4
movups %xmm1, (%rbx,%rdx,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
movq %r13, %rdx
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
subq %rax, %rdx
addq %rdx, %r14
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -2640(%rbp)
call __popcountdi2@PLT
movdqa -2640(%rbp), %xmm1
leaq -12(%r12,%r14), %rdx
cltq
movups %xmm1, (%rbx,%r14,8)
movups %xmm1, (%rbx,%rdx,8)
movdqa -2672(%rbp), %xmm2
movq %r13, %rdx
movdqa -2960(%rbp), %xmm7
movdqa -2624(%rbp), %xmm6
subq %rax, %rdx
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
pshufd $78, %xmm7, %xmm4
addq %rdx, %r14
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -2640(%rbp)
call __popcountdi2@PLT
movdqa -2976(%rbp), %xmm7
movdqa -2640(%rbp), %xmm1
leaq -14(%r12,%r14), %rdx
movdqa -2624(%rbp), %xmm6
movdqa -2672(%rbp), %xmm2
cltq
movups %xmm1, (%rbx,%r14,8)
pshufd $78, %xmm7, %xmm4
movups %xmm1, (%rbx,%rdx,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
movq %r13, %rdx
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
subq %rax, %rdx
movaps %xmm2, -2688(%rbp)
addq %rdx, %r14
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -2640(%rbp)
call __popcountdi2@PLT
leaq -16(%r12,%r14), %rdx
movdqa -2640(%rbp), %xmm1
movdqa -2688(%rbp), %xmm2
cltq
subq %rax, %r13
movups %xmm1, (%rbx,%r14,8)
leaq 0(%r13,%r14), %r12
movups %xmm1, (%rbx,%rdx,8)
movq -2832(%rbp), %rdx
leaq 0(,%r12,8), %rax
movq %rax, -2672(%rbp)
subq %r12, %rdx
.L451:
movq -2832(%rbp), %rcx
cmpq $2, %rdx
movdqa -2624(%rbp), %xmm7
leaq -16(,%rcx,8), %rax
cmovnb -2672(%rbp), %rax
movdqu (%rbx,%rax), %xmm6
movups %xmm6, (%rbx,%rcx,8)
movaps %xmm6, -2640(%rbp)
movdqa -2800(%rbp), %xmm6
movdqa %xmm6, %xmm0
psubq %xmm6, %xmm2
pcmpeqd %xmm7, %xmm0
movdqa %xmm2, %xmm1
pand %xmm0, %xmm1
movdqa %xmm6, %xmm0
pcmpgtd %xmm7, %xmm0
por %xmm0, %xmm1
pcmpeqd %xmm0, %xmm0
pshufd $245, %xmm1, %xmm1
pxor %xmm1, %xmm0
movaps %xmm1, -2832(%rbp)
movmskpd %xmm0, %r13d
movq %r13, %rdi
salq $4, %r13
call __popcountdi2@PLT
movq -2728(%rbp), %rcx
movdqa -2800(%rbp), %xmm6
cltq
movdqa (%rcx,%r13), %xmm0
movq %rax, -2640(%rbp)
movaps %xmm6, -80(%rbp)
movaps %xmm0, -2144(%rbp)
movzbl -2143(%rbp), %eax
movd %xmm0, %ecx
movaps %xmm0, -2224(%rbp)
andl $15, %ecx
movq %rax, %rdi
movzbl -2218(%rbp), %eax
movaps %xmm0, -2160(%rbp)
movzbl -2158(%rbp), %r10d
movaps %xmm0, -2240(%rbp)
andl $15, %edi
movaps %xmm0, -2256(%rbp)
movq %rax, %rsi
movq %r10, %r11
movzbl -2233(%rbp), %eax
movzbl -2248(%rbp), %edx
andl $15, %r11d
andl $15, %esi
movaps %xmm0, -2176(%rbp)
andl $15, %eax
movaps %xmm0, -2192(%rbp)
movq %rsi, %r10
movzbl -2188(%rbp), %r13d
andl $15, %edx
movaps %xmm0, -2208(%rbp)
movzbl -2203(%rbp), %r14d
movq %rcx, -2624(%rbp)
andl $15, %r13d
movq %rdi, -2688(%rbp)
andl $15, %r14d
movq %r11, -2704(%rbp)
movzbl -2173(%rbp), %r11d
movaps %xmm0, -2272(%rbp)
movq %rdx, -2720(%rbp)
movzbl -2263(%rbp), %edx
andl $15, %r11d
movaps %xmm0, -2288(%rbp)
movaps %xmm0, -2304(%rbp)
movq %rdx, %r8
movzbl -2293(%rbp), %ecx
movzbl -2278(%rbp), %edx
movaps %xmm0, -2320(%rbp)
andl $15, %r8d
movzbl -2308(%rbp), %esi
movaps %xmm0, -2336(%rbp)
andl $15, %edx
andl $15, %ecx
movzbl -2323(%rbp), %edi
movaps %xmm0, -2352(%rbp)
andl $15, %esi
movaps %xmm0, -2368(%rbp)
movzbl -80(%rbp,%rax), %eax
movzbl -80(%rbp,%r10), %r10d
andl $15, %edi
movzbl -80(%rbp,%r14), %r14d
movzbl -80(%rbp,%r13), %r13d
movq %r8, -2656(%rbp)
salq $8, %rax
movzbl -80(%rbp,%r11), %r11d
movzbl -2353(%rbp), %r9d
orq %r10, %rax
movzbl -80(%rbp,%rdi), %edi
movzbl -80(%rbp,%rsi), %esi
salq $8, %rax
andl $15, %r9d
movzbl -80(%rbp,%rcx), %ecx
movzbl -2338(%rbp), %r8d
orq %r14, %rax
movq -2688(%rbp), %r14
movzbl -80(%rbp,%r9), %r9d
salq $8, %rax
andl $15, %r8d
movzbl -80(%rbp,%rdx), %edx
orq %r13, %rax
movzbl -80(%rbp,%r8), %r8d
salq $8, %r9
salq $8, %rax
orq %r11, %rax
movq -2704(%rbp), %r11
salq $8, %rax
movzbl -80(%rbp,%r11), %r10d
movq -2624(%rbp), %r11
orq %r10, %rax
movzbl -80(%rbp,%r14), %r10d
salq $8, %rax
orq %r10, %rax
movzbl -80(%rbp,%r11), %r10d
salq $8, %rax
orq %r8, %r9
movq -2656(%rbp), %r8
salq $8, %r9
orq %r10, %rax
orq %rdi, %r9
salq $8, %r9
orq %rsi, %r9
salq $8, %r9
orq %rcx, %r9
salq $8, %r9
orq %rdx, %r9
movzbl -80(%rbp,%r8), %edx
movq %rax, -2624(%rbp)
movdqa -2752(%rbp), %xmm6
movdqa -2784(%rbp), %xmm0
salq $8, %r9
movq -2640(%rbp), %xmm2
orq %rdx, %r9
movq -2720(%rbp), %rdx
movdqa %xmm6, %xmm3
salq $8, %r9
movdqa -2832(%rbp), %xmm1
punpcklqdq %xmm2, %xmm2
movzbl -80(%rbp,%rdx), %edx
pcmpeqd %xmm2, %xmm3
psubq %xmm2, %xmm0
pcmpgtd %xmm6, %xmm2
orq %rdx, %r9
movq %r9, -2616(%rbp)
pand %xmm3, %xmm0
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L457
movq -2672(%rbp), %rsi
movdqa -2624(%rbp), %xmm6
movq %xmm6, (%rbx,%rsi)
.L457:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
je .L458
movq -2672(%rbp), %rax
movdqa -2624(%rbp), %xmm6
movhps %xmm6, 8(%rbx,%rax)
.L458:
addq -2640(%rbp), %r12
movmskpd %xmm1, %r13d
movq %r13, %rdi
leaq 0(,%r12,8), %rax
salq $4, %r13
movq %rax, -2656(%rbp)
call __popcountdi2@PLT
movdqa -2800(%rbp), %xmm6
movl %eax, -2720(%rbp)
movq -2728(%rbp), %rax
movaps %xmm6, -64(%rbp)
movdqa (%rax,%r13), %xmm0
movaps %xmm0, -2384(%rbp)
movzbl -2383(%rbp), %eax
movd %xmm0, %r10d
movaps %xmm0, -2496(%rbp)
movzbl -2488(%rbp), %edx
andl $15, %r10d
andl $15, %eax
movaps %xmm0, -2400(%rbp)
movaps %xmm0, -2512(%rbp)
movq %rdx, %rsi
movzbl -2503(%rbp), %edx
movq %rax, -2624(%rbp)
movzbl -2398(%rbp), %eax
andl $15, %esi
movaps %xmm0, -2464(%rbp)
andl $15, %edx
movq %rax, %rcx
movzbl -2458(%rbp), %eax
movaps %xmm0, -2528(%rbp)
movq %rdx, -2688(%rbp)
movzbl -2518(%rbp), %edx
andl $15, %ecx
movaps %xmm0, -2480(%rbp)
movq %rax, %rdi
movzbl -2473(%rbp), %eax
movq %rdx, %r9
andl $15, %edi
movaps %xmm0, -2416(%rbp)
movzbl -2413(%rbp), %r11d
andl $15, %r9d
andl $15, %eax
movaps %xmm0, -2432(%rbp)
movq %rdi, %r8
movaps %xmm0, -2448(%rbp)
movzbl -2428(%rbp), %r13d
andl $15, %r11d
movzbl -2443(%rbp), %r14d
movq %rcx, -2640(%rbp)
movq %rsi, -2672(%rbp)
andl $15, %r14d
andl $15, %r13d
movq %r9, -2704(%rbp)
movaps %xmm0, -2544(%rbp)
movzbl -2533(%rbp), %edx
movaps %xmm0, -2560(%rbp)
movzbl -2548(%rbp), %ecx
movaps %xmm0, -2576(%rbp)
movzbl -2563(%rbp), %esi
andl $15, %edx
movaps %xmm0, -2592(%rbp)
movzbl -2578(%rbp), %edi
andl $15, %ecx
movaps %xmm0, -2608(%rbp)
movzbl -64(%rbp,%rax), %eax
andl $15, %esi
movzbl -64(%rbp,%r8), %r8d
movzbl -64(%rbp,%r14), %r14d
andl $15, %edi
movzbl -64(%rbp,%rsi), %esi
salq $8, %rax
movzbl -64(%rbp,%r13), %r13d
movzbl -64(%rbp,%r11), %r11d
orq %r8, %rax
movzbl -64(%rbp,%rdi), %edi
movzbl -64(%rbp,%rcx), %ecx
salq $8, %rax
movzbl -2593(%rbp), %r9d
movzbl -64(%rbp,%rdx), %edx
orq %r14, %rax
movq -2640(%rbp), %r14
movzbl -64(%rbp,%r10), %r10d
salq $8, %rax
andl $15, %r9d
orq %r13, %rax
movzbl -64(%rbp,%r9), %r9d
salq $8, %rax
orq %r11, %rax
movzbl -64(%rbp,%r14), %r11d
salq $8, %rax
orq %r11, %rax
movq -2624(%rbp), %r11
salq $8, %rax
movzbl -64(%rbp,%r11), %r11d
orq %r11, %rax
salq $8, %rax
salq $8, %r9
orq %rdi, %r9
orq %r10, %rax
salq $8, %r9
movq %rax, -2624(%rbp)
orq %rsi, %r9
movq -2672(%rbp), %rsi
salq $8, %r9
orq %rcx, %r9
movq -2704(%rbp), %rcx
salq $8, %r9
orq %rdx, %r9
movzbl -64(%rbp,%rcx), %edx
salq $8, %r9
orq %rdx, %r9
movq -2688(%rbp), %rdx
salq $8, %r9
movzbl -64(%rbp,%rdx), %edx
orq %rdx, %r9
movzbl -64(%rbp,%rsi), %edx
salq $8, %r9
orq %rdx, %r9
movq %r9, -2616(%rbp)
movslq -2720(%rbp), %rax
movdqa -2752(%rbp), %xmm6
movdqa -2784(%rbp), %xmm0
movq %rax, %xmm1
punpcklqdq %xmm1, %xmm1
movdqa %xmm6, %xmm2
pcmpeqd %xmm1, %xmm2
psubq %xmm1, %xmm0
pcmpgtd %xmm6, %xmm1
pand %xmm2, %xmm0
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L459
movdqa -2624(%rbp), %xmm6
movq %xmm6, (%rbx,%r12,8)
.L459:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
je .L460
movq -2656(%rbp), %rax
movdqa -2624(%rbp), %xmm6
movhps %xmm6, 8(%rbx,%rax)
.L460:
movq -2848(%rbp), %rbx
addq %r12, %rbx
movq -2768(%rbp), %r12
subq $1, %r12
cmpl $2, -2812(%rbp)
je .L462
movq -2736(%rbp), %r8
movq %r12, %r9
movq %r15, %rcx
movq %rbx, %rdx
movq -2808(%rbp), %rsi
movq -2648(%rbp), %rdi
call _ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -2812(%rbp)
je .L369
.L462:
movq -2760(%rbp), %rdx
movq %r12, %r9
movq %r15, %rcx
movq -2648(%rbp), %rax
movq -2736(%rbp), %r8
movq -2808(%rbp), %rsi
subq %rbx, %rdx
leaq (%rax,%rbx,8), %rdi
call _ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L369:
addq $2952, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L443:
.cfi_restore_state
movq (%rax), %rdx
leaq 8(%rbx), %rdi
movq %rax, %rsi
andq $-8, %rdi
movq %rdx, (%rbx)
movl %r13d, %edx
movq -8(%rax,%rdx), %rcx
movq %rcx, -8(%rbx,%rdx)
movq %rbx, %rcx
subq %rdi, %rcx
subq %rcx, %rsi
addl %r13d, %ecx
shrl $3, %ecx
rep movsq
cmpl $8, %r13d
jb .L601
.L447:
movq (%r15), %rdx
leaq 8(%rax), %rdi
movq %r15, %rsi
andq $-8, %rdi
movq %rdx, (%rax)
movl %r13d, %edx
movq -8(%r15,%rdx), %rcx
movq %rcx, -8(%rax,%rdx)
subq %rdi, %rax
leal 0(%r13,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
jmp .L448
.L598:
movzbl (%r15), %edx
movb %dl, (%rax)
jmp .L448
.L597:
movzbl (%rax), %edx
movb %dl, (%rbx)
jmp .L444
.L594:
cmpq $1, %rdx
jbe .L369
leaq 256(%rdi), %rax
cmpq %rax, %rsi
jb .L373
movl $2, %esi
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L369
.L384:
movq -2648(%rbp), %rax
andl $1, %r12d
movdqa %xmm2, %xmm5
movl $2, %edi
movdqa .LC1(%rip), %xmm7
subq %r12, %rdi
movdqu (%rax), %xmm6
movq %rdi, %xmm3
punpcklqdq %xmm3, %xmm3
movaps %xmm7, -2752(%rbp)
movaps %xmm6, -2624(%rbp)
movdqa .LC0(%rip), %xmm6
movdqa -2624(%rbp), %xmm0
movdqa %xmm6, %xmm1
movaps %xmm6, -2784(%rbp)
movdqa %xmm7, %xmm6
pcmpeqd %xmm3, %xmm6
pcmpeqd %xmm2, %xmm0
psubq %xmm3, %xmm1
pcmpgtd %xmm7, %xmm3
pand %xmm6, %xmm1
pshufd $177, %xmm0, %xmm4
por %xmm3, %xmm1
pand %xmm4, %xmm0
pshufd $245, %xmm1, %xmm1
pandn %xmm1, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L602
movq -2648(%rbp), %rax
pxor %xmm1, %xmm1
movq -2760(%rbp), %r8
pxor %xmm6, %xmm6
movdqa %xmm1, %xmm0
leaq 256(%rax,%rdi,8), %rsi
.p2align 4,,10
.p2align 3
.L390:
movq %rdi, %rcx
leaq 32(%rdi), %rdi
cmpq %rdi, %r8
jb .L603
leaq -256(%rsi), %rax
.L389:
movdqa (%rax), %xmm3
leaq 32(%rax), %rdx
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 16(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm1
movdqa 32(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 48(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm1
movdqa 64(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 80(%rax), %xmm3
leaq 96(%rdx), %rax
pxor %xmm2, %xmm3
por %xmm3, %xmm1
movdqa 64(%rdx), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 80(%rdx), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm1
cmpq %rsi, %rax
jne .L389
movdqa %xmm0, %xmm3
leaq 352(%rdx), %rsi
por %xmm1, %xmm3
pcmpeqd %xmm6, %xmm3
pshufd $177, %xmm3, %xmm4
pand %xmm4, %xmm3
movmskpd %xmm3, %eax
cmpl $3, %eax
je .L390
movq -2648(%rbp), %rax
movdqa %xmm5, %xmm0
pcmpeqd %xmm3, %xmm3
movq -2648(%rbp), %rdx
pcmpeqd (%rax,%rcx,8), %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
pxor %xmm3, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L392
.p2align 4,,10
.p2align 3
.L391:
addq $2, %rcx
movdqa %xmm5, %xmm0
pcmpeqd (%rdx,%rcx,8), %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
pxor %xmm3, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
je .L391
.L392:
rep bsfl %eax, %eax
cltq
addq %rcx, %rax
.L388:
movq -2648(%rbp), %rcx
movdqa %xmm5, %xmm3
movdqa %xmm2, %xmm0
leaq (%rcx,%rax,8), %rdi
movq (%rdi), %rbx
movq %rbx, %xmm1
punpcklqdq %xmm1, %xmm1
pcmpeqd %xmm1, %xmm3
psubq %xmm1, %xmm0
movaps %xmm1, -2640(%rbp)
pand %xmm3, %xmm0
movdqa %xmm1, %xmm3
pcmpgtd %xmm5, %xmm3
por %xmm3, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %edx
testl %edx, %edx
jne .L397
movq -2760(%rbp), %rax
movq %r14, -2720(%rbp)
xorl %r13d, %r13d
movq %rbx, -2688(%rbp)
movq %rcx, %rbx
leaq -2(%rax), %r12
movaps %xmm5, -2624(%rbp)
movq %rax, %r14
movaps %xmm1, -2704(%rbp)
movaps %xmm2, -2672(%rbp)
jmp .L404
.p2align 4,,10
.p2align 3
.L398:
movdqa -2672(%rbp), %xmm6
movmskpd %xmm0, %edi
movups %xmm6, (%rbx,%r12,8)
call __popcountdi2@PLT
cltq
addq %rax, %r13
leaq -2(%r12), %rax
cmpq %rax, %r14
jbe .L604
movq %rax, %r12
.L404:
movdqu (%rbx,%r12,8), %xmm0
pcmpeqd -2640(%rbp), %xmm0
pshufd $177, %xmm0, %xmm1
movdqa %xmm0, %xmm3
movdqu (%rbx,%r12,8), %xmm0
pand %xmm1, %xmm3
pcmpeqd -2624(%rbp), %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
movdqa %xmm3, %xmm1
por %xmm0, %xmm1
movmskpd %xmm1, %eax
cmpl $3, %eax
je .L398
pcmpeqd %xmm4, %xmm4
movq -2648(%rbp), %rcx
leaq 2(%r12), %rdx
movdqa -2624(%rbp), %xmm5
pxor %xmm4, %xmm0
movq -2688(%rbp), %rbx
movdqa -2704(%rbp), %xmm1
pandn %xmm0, %xmm3
movdqa -2672(%rbp), %xmm2
movmskpd %xmm3, %eax
rep bsfl %eax, %eax
cltq
addq %r12, %rax
addq $4, %r12
movq (%rcx,%rax,8), %xmm3
movq -2760(%rbp), %rax
punpcklqdq %xmm3, %xmm3
subq %r13, %rax
movaps %xmm3, -64(%rbp)
cmpq %r12, %rax
jb .L399
.p2align 4,,10
.p2align 3
.L400:
movups %xmm1, -16(%rcx,%r12,8)
movq %r12, %rdx
addq $2, %r12
cmpq %rax, %r12
jbe .L400
.L399:
movdqa -2752(%rbp), %xmm7
subq %rdx, %rax
movdqa -2784(%rbp), %xmm4
leaq 0(,%rdx,8), %rcx
movq %rax, %xmm0
punpcklqdq %xmm0, %xmm0
movdqa %xmm7, %xmm6
pcmpeqd %xmm0, %xmm6
psubq %xmm0, %xmm4
pcmpgtd %xmm7, %xmm0
pand %xmm6, %xmm4
por %xmm4, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L401
movq -2648(%rbp), %rax
movq %rbx, (%rax,%rdx,8)
.L401:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
je .L403
movq -2648(%rbp), %rax
movq %rbx, 8(%rax,%rcx)
.L403:
movdqa %xmm5, %xmm0
pcmpeqd .LC5(%rip), %xmm0
pshufd $177, %xmm0, %xmm4
pand %xmm4, %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
je .L480
movdqa %xmm5, %xmm0
pcmpeqd .LC6(%rip), %xmm0
pshufd $177, %xmm0, %xmm4
pand %xmm4, %xmm0
movmskpd %xmm0, %eax
movl %eax, -2812(%rbp)
cmpl $3, %eax
je .L605
movdqa %xmm1, %xmm4
movdqa %xmm1, %xmm0
movdqa %xmm1, %xmm6
pcmpeqd %xmm3, %xmm4
psubq %xmm3, %xmm0
pand %xmm4, %xmm0
movdqa %xmm3, %xmm4
pcmpgtd %xmm1, %xmm4
por %xmm4, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm4
pand %xmm0, %xmm6
pandn %xmm3, %xmm4
por %xmm4, %xmm6
movdqa %xmm6, %xmm7
movdqa %xmm6, %xmm4
pcmpeqd %xmm5, %xmm7
psubq %xmm2, %xmm4
pand %xmm7, %xmm4
movdqa %xmm5, %xmm7
pcmpgtd %xmm6, %xmm7
por %xmm7, %xmm4
pshufd $245, %xmm4, %xmm4
movmskpd %xmm4, %eax
testl %eax, %eax
jne .L606
movdqa %xmm2, %xmm0
movl $32, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L414:
movq -2648(%rbp), %rbx
leaq (%rcx,%rax,2), %rdx
movdqa %xmm0, %xmm1
addq $1, %rax
movdqu (%rbx,%rdx,8), %xmm3
movdqa %xmm3, %xmm4
psubq %xmm3, %xmm1
pcmpeqd %xmm0, %xmm4
pand %xmm4, %xmm1
movdqa %xmm3, %xmm4
pcmpgtd %xmm0, %xmm4
por %xmm4, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm4
pand %xmm0, %xmm1
pandn %xmm3, %xmm4
por %xmm4, %xmm1
movdqa %xmm1, %xmm0
cmpq $16, %rax
jne .L414
movdqa %xmm1, %xmm3
psubq %xmm2, %xmm1
pcmpeqd %xmm5, %xmm3
pand %xmm3, %xmm1
movdqa %xmm5, %xmm3
pcmpgtd %xmm0, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movmskpd %xmm1, %eax
testl %eax, %eax
jne .L593
leaq 32(%rsi), %rax
cmpq %rax, -2760(%rbp)
jb .L607
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L414
.L492:
movdqa .LC0(%rip), %xmm6
leaq _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rcx
movq %rsi, %rbx
xorl %r13d, %r13d
movq $0, -2640(%rbp)
movaps %xmm6, -2784(%rbp)
movdqa .LC1(%rip), %xmm6
movq %rcx, -2728(%rbp)
movaps %xmm6, -2752(%rbp)
jmp .L432
.L494:
movq %r12, %r14
movq %rbx, %rdx
movl $2, %r13d
jmp .L452
.L493:
movq $0, -2672(%rbp)
movq %rcx, %rdx
jmp .L451
.L596:
movq -2760(%rbp), %rsi
movq -2648(%rbp), %rdi
leaq -1(%rsi), %rbx
movq %rbx, %r12
shrq %r12
.p2align 4,,10
.p2align 3
.L430:
movq %r12, %rdx
call _ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %r12
jnb .L430
.p2align 4,,10
.p2align 3
.L431:
movq (%rdi,%rbx,8), %rdx
movq (%rdi), %rax
movq %rbx, %rsi
movq %rdx, (%rdi)
xorl %edx, %edx
movq %rax, (%rdi,%rbx,8)
call _ZN3hwy6N_SSE26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L431
jmp .L369
.L482:
movl $12, %edx
movl $11, %ebx
jmp .L428
.L483:
movl $9, %ebx
movl $10, %edx
jmp .L428
.L484:
movl $9, %edx
jmp .L428
.L485:
movl $8, %edx
movl $7, %ebx
jmp .L428
.L486:
movl $6, %ebx
movl $7, %edx
jmp .L428
.L603:
movq -2648(%rbp), %rdi
movq -2760(%rbp), %rsi
pcmpeqd %xmm3, %xmm3
.p2align 4,,10
.p2align 3
.L394:
movq %rcx, %rdx
addq $2, %rcx
cmpq %rcx, %rsi
jb .L608
movdqa %xmm5, %xmm0
pcmpeqd -16(%rdi,%rcx,8), %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
pxor %xmm3, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
je .L394
.L591:
rep bsfl %eax, %eax
cltq
addq %rdx, %rax
jmp .L388
.L487:
movl $5, %ebx
movl $6, %edx
jmp .L428
.L488:
movl $4, %ebx
movl $5, %edx
jmp .L428
.L397:
movq -2760(%rbp), %rsi
leaq -64(%rbp), %rdx
movq %r15, %rcx
movdqa %xmm2, %xmm0
movaps %xmm1, -2624(%rbp)
subq %rax, %rsi
call _ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L369
movq (%r15), %xmm2
movdqa -64(%rbp), %xmm3
movdqa -2624(%rbp), %xmm1
punpcklqdq %xmm2, %xmm2
movdqa %xmm2, %xmm5
jmp .L403
.L489:
movl $3, %ebx
movl $4, %edx
jmp .L428
.L490:
movl $2, %ebx
movl $3, %edx
jmp .L428
.L491:
movl $1, %ebx
movl $2, %edx
jmp .L428
.L604:
movdqa -2752(%rbp), %xmm6
movq -2648(%rbp), %rax
movq %r12, %xmm0
movdqa -2784(%rbp), %xmm3
punpcklqdq %xmm0, %xmm0
movdqa -2624(%rbp), %xmm5
movdqa %xmm6, %xmm4
movdqa -2704(%rbp), %xmm1
movq -2760(%rbp), %rcx
pcmpeqd %xmm0, %xmm4
psubq %xmm0, %xmm3
movq -2720(%rbp), %r14
movq -2688(%rbp), %rbx
pcmpgtd %xmm6, %xmm0
movdqu (%rax), %xmm6
movdqa -2672(%rbp), %xmm2
subq %r13, %rcx
movaps %xmm6, -2624(%rbp)
movdqa -2624(%rbp), %xmm6
pand %xmm4, %xmm3
por %xmm0, %xmm3
movdqa -2624(%rbp), %xmm0
pcmpeqd %xmm5, %xmm6
pshufd $245, %xmm3, %xmm3
pcmpeqd %xmm1, %xmm0
pshufd $177, %xmm6, %xmm4
pand %xmm3, %xmm4
pshufd $177, %xmm0, %xmm7
pand %xmm6, %xmm4
pcmpeqd %xmm6, %xmm6
pand %xmm7, %xmm0
pxor %xmm6, %xmm3
por %xmm3, %xmm0
por %xmm4, %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
jne .L609
movmskpd %xmm4, %edi
movaps %xmm2, -2640(%rbp)
movaps %xmm1, -2624(%rbp)
movq %rcx, -2672(%rbp)
call __popcountdi2@PLT
movq -2648(%rbp), %rbx
movdqa -2640(%rbp), %xmm2
movslq %eax, %rdx
movq -2672(%rbp), %rax
movdqa -2624(%rbp), %xmm1
movups %xmm2, (%rbx)
subq %rdx, %rax
cmpq $1, %rax
jbe .L469
leaq -2(%rax), %rcx
movq %rcx, %rdx
shrq %rdx
salq $4, %rdx
leaq 16(%rbx,%rdx), %rdx
.L411:
movups %xmm1, (%r14)
addq $16, %r14
cmpq %rdx, %r14
jne .L411
andq $-2, %rcx
movq %rcx, %rdx
addq $2, %rdx
leaq 0(,%rdx,8), %rcx
subq %rdx, %rax
.L410:
movaps %xmm1, (%r15)
testq %rax, %rax
je .L369
movq -2648(%rbp), %rdi
leaq 0(,%rax,8), %rdx
movq %r15, %rsi
addq %rcx, %rdi
call memcpy@PLT
jmp .L369
.L607:
movq -2760(%rbp), %rcx
movq %rbx, %rdx
jmp .L421
.L422:
movdqu -16(%rdx,%rsi,8), %xmm1
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm0
pcmpeqd %xmm5, %xmm3
psubq %xmm2, %xmm0
pand %xmm3, %xmm0
movdqa %xmm5, %xmm3
pcmpgtd %xmm1, %xmm3
por %xmm3, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L593
.L421:
movq %rsi, %rax
addq $2, %rsi
cmpq %rsi, %rcx
jnb .L422
movq -2760(%rbp), %rbx
cmpq %rax, %rbx
je .L480
movq -2648(%rbp), %rax
movdqu -16(%rax,%rbx,8), %xmm1
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm0
pcmpeqd %xmm5, %xmm3
pcmpgtd %xmm1, %xmm5
psubq %xmm2, %xmm0
pand %xmm3, %xmm0
por %xmm5, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %eax
cmpl $1, %eax
movl $1, %eax
adcl $0, %eax
movl %eax, -2812(%rbp)
jmp .L423
.L425:
movl $11, %edx
movl $10, %ebx
jmp .L428
.L608:
movq -2760(%rbp), %rax
leaq -2(%rax), %rdx
movq -2648(%rbp), %rax
movdqu (%rax,%rdx,8), %xmm6
movaps %xmm6, -2624(%rbp)
movdqa -2624(%rbp), %xmm0
pcmpeqd %xmm5, %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
pcmpeqd %xmm1, %xmm1
pxor %xmm1, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
je .L369
jmp .L591
.L602:
rep bsfl %eax, %eax
cltq
jmp .L388
.L373:
movq %rdx, %r11
leaq -2(%rdx), %rdx
movq -2648(%rbp), %r10
leaq 8(%rcx), %rdi
movq %rdx, %rbx
andq $-8, %rdi
andq $-2, %rdx
shrq %rbx
movq (%r10), %rax
movq %r10, %rsi
leaq 2(%rdx), %r12
addq $1, %rbx
salq $4, %rbx
movq %rax, (%rcx)
movl %ebx, %r8d
leaq 8(%r10,%r8), %r14
leaq 8(%rcx,%r8), %r13
movq -16(%r14), %rax
movq %rax, -16(%r13)
movq %rcx, %rax
subq %rdi, %rax
subq %rax, %rsi
leal (%rbx,%rax), %ecx
movq %r11, %rax
shrl $3, %ecx
subq %r12, %rax
rep movsq
movq %r11, -2760(%rbp)
movq %rax, %rcx
movq %rax, -2624(%rbp)
je .L374
leaq 0(,%r12,8), %rax
leaq 0(,%rcx,8), %rdx
movq %r8, -2640(%rbp)
leaq (%r10,%rax), %rsi
leaq (%r15,%rax), %rdi
call memcpy@PLT
movq -2760(%rbp), %r11
movl $32, %ecx
movq -2640(%rbp), %r8
movl %r11d, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rax
salq $4, %rax
addq $2, %rax
cmpq %rax, %r11
jnb .L610
.L375:
movdqa .LC4(%rip), %xmm0
movq -2760(%rbp), %rdx
.L379:
movups %xmm0, (%r15,%rdx,8)
addq $2, %rdx
cmpq %rax, %rdx
jb .L379
movq %r15, %rdi
movq %r8, -2640(%rbp)
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -2648(%rbp), %rcx
movq (%r15), %rax
movq %r15, %rsi
movq %rax, (%rcx)
movq -2640(%rbp), %r8
leaq 8(%rcx), %rdi
andq $-8, %rdi
movq -8(%r15,%r8), %rax
movq %rax, -8(%rcx,%r8)
movq %rcx, %rax
subq %rdi, %rax
leal (%rbx,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
cmpq $0, -2624(%rbp)
je .L369
.L377:
movq -2648(%rbp), %rdi
movq -2624(%rbp), %rdx
salq $3, %r12
leaq (%r15,%r12), %rsi
addq %r12, %rdi
salq $3, %rdx
call memcpy@PLT
jmp .L369
.L480:
movl $2, -2812(%rbp)
jmp .L423
.L605:
pcmpeqd %xmm0, %xmm0
paddq %xmm0, %xmm2
jmp .L423
.L606:
movdqa %xmm0, %xmm4
pand %xmm3, %xmm0
pandn %xmm1, %xmm4
movdqa %xmm2, %xmm1
por %xmm4, %xmm0
movdqa %xmm0, %xmm3
psubq %xmm0, %xmm1
pcmpeqd %xmm5, %xmm3
pcmpgtd %xmm5, %xmm0
pand %xmm3, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L593
movdqa %xmm2, %xmm0
movl $32, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L415:
movq -2648(%rbp), %rbx
leaq (%rcx,%rax,2), %rdx
movdqa %xmm0, %xmm1
addq $1, %rax
movdqu (%rbx,%rdx,8), %xmm3
movdqa %xmm3, %xmm4
psubq %xmm3, %xmm1
pcmpeqd %xmm0, %xmm4
pand %xmm4, %xmm1
movdqa %xmm3, %xmm4
pcmpgtd %xmm0, %xmm4
por %xmm4, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm3
pandn %xmm0, %xmm4
por %xmm4, %xmm3
movdqa %xmm3, %xmm0
cmpq $16, %rax
jne .L415
pcmpeqd %xmm5, %xmm3
movdqa %xmm2, %xmm1
psubq %xmm0, %xmm1
pand %xmm3, %xmm1
movdqa %xmm0, %xmm3
pcmpgtd %xmm5, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movmskpd %xmm1, %eax
testl %eax, %eax
jne .L593
leaq 32(%rsi), %rax
cmpq %rax, -2760(%rbp)
jb .L611
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L415
.L374:
movq -2760(%rbp), %rdi
movl $32, %ecx
movl %edi, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rax
salq $4, %rax
addq $2, %rax
cmpq %rax, %rdi
jb .L375
movq %r15, %rdi
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -2648(%rbp), %rcx
movq (%r15), %rax
movq %r15, %rsi
movq %rax, (%rcx)
movq -16(%r13), %rax
leaq 8(%rcx), %rdi
andq $-8, %rdi
movq %rax, -16(%r14)
movq %rcx, %rax
subq %rdi, %rax
leal (%rbx,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
jmp .L369
.p2align 4,,10
.p2align 3
.L469:
xorl %ecx, %ecx
jmp .L410
.L609:
pxor %xmm6, %xmm0
movq -2648(%rbp), %rsi
movmskpd %xmm0, %eax
rep bsfl %eax, %eax
cltq
movq (%rsi,%rax,8), %xmm3
leaq 2(%r12), %rax
punpcklqdq %xmm3, %xmm3
movaps %xmm3, -64(%rbp)
cmpq %rcx, %rax
ja .L406
.L407:
movq -2648(%rbp), %rsi
movq %rax, %r12
movups %xmm1, -16(%rsi,%rax,8)
addq $2, %rax
cmpq %rcx, %rax
jbe .L407
.L406:
movq %rcx, %rax
movdqa -2752(%rbp), %xmm7
movdqa -2784(%rbp), %xmm0
leaq 0(,%r12,8), %rdx
subq %r12, %rax
movq %rax, %xmm4
movdqa %xmm7, %xmm6
punpcklqdq %xmm4, %xmm4
pcmpeqd %xmm4, %xmm6
psubq %xmm4, %xmm0
pcmpgtd %xmm7, %xmm4
pand %xmm6, %xmm0
por %xmm4, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L408
movq -2648(%rbp), %rax
movq %rbx, (%rax,%r12,8)
.L408:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
je .L403
movq -2648(%rbp), %rax
movq %rbx, 8(%rax,%rdx)
jmp .L403
.L611:
movq %rbx, %rdx
jmp .L417
.L418:
movdqu -16(%rdx,%rsi,8), %xmm1
movdqa %xmm2, %xmm0
movdqa %xmm1, %xmm3
psubq %xmm1, %xmm0
pcmpeqd %xmm5, %xmm3
pcmpgtd %xmm5, %xmm1
pand %xmm3, %xmm0
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L593
.L417:
movq %rsi, %rax
addq $2, %rsi
cmpq %rsi, -2760(%rbp)
jnb .L418
movq -2760(%rbp), %rbx
cmpq %rax, %rbx
je .L419
movq -2648(%rbp), %rax
movdqa %xmm2, %xmm0
movdqu -16(%rax,%rbx,8), %xmm1
movdqa %xmm1, %xmm3
psubq %xmm1, %xmm0
pcmpeqd %xmm5, %xmm3
pcmpgtd %xmm5, %xmm1
pand %xmm3, %xmm0
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L593
.L419:
movl $3, -2812(%rbp)
pcmpeqd %xmm0, %xmm0
paddq %xmm0, %xmm2
jmp .L423
.L610:
movq %r15, %rdi
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -2648(%rbp), %rcx
movq (%r15), %rax
movq %r15, %rsi
movq %rax, (%rcx)
movq -16(%r13), %rax
leaq 8(%rcx), %rdi
andq $-8, %rdi
movq %rax, -16(%r14)
movq %rcx, %rax
subq %rdi, %rax
leal (%rbx,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
jmp .L377
.cfi_endproc
.LFE18797:
.size _ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18799:
.cfi_startproc
leaq 8(%rsp), %r10
.cfi_def_cfa 10, 0
andq $-64, %rsp
pushq -8(%r10)
pushq %rbp
movq %rsp, %rbp
.cfi_escape 0x10,0x6,0x2,0x76,0
pushq %r15
.cfi_escape 0x10,0xf,0x2,0x76,0x78
movq %rdx, %r15
pushq %r14
pushq %r13
.cfi_escape 0x10,0xe,0x2,0x76,0x70
.cfi_escape 0x10,0xd,0x2,0x76,0x68
movq %rdi, %r13
pushq %r12
.cfi_escape 0x10,0xc,0x2,0x76,0x60
movq %rcx, %r12
pushq %r10
.cfi_escape 0xf,0x3,0x76,0x58,0x6
pushq %rbx
addq $-128, %rsp
.cfi_escape 0x10,0x3,0x2,0x76,0x50
movq %rsi, -136(%rbp)
movq %r9, -128(%rbp)
cmpq $128, %rdx
jbe .L786
movq %rdi, %r11
movq %rdi, -152(%rbp)
movq %r8, %rbx
shrq $3, %r11
movq %r11, %rdi
andl $7, %edi
movq %rdi, -144(%rbp)
jne .L787
movq %rdx, -120(%rbp)
movq %r13, %r11
.L625:
movq 8(%rbx), %rdx
movq 16(%rbx), %r9
movq %rdx, %rsi
leaq 1(%r9), %rdi
leaq (%rdx,%rdx,8), %rcx
xorq (%rbx), %rdi
shrq $11, %rsi
rorx $40, %rdx, %rax
leaq 2(%r9), %rdx
addq %rdi, %rax
xorq %rsi, %rcx
movq %rax, %r8
rorx $40, %rax, %rsi
xorq %rdx, %rcx
shrq $11, %r8
leaq (%rax,%rax,8), %rdx
leaq 3(%r9), %rax
addq %rcx, %rsi
xorq %r8, %rdx
movq %rsi, %r8
xorq %rax, %rdx
leaq (%rsi,%rsi,8), %rax
rorx $40, %rsi, %r10
shrq $11, %r8
addq %rdx, %r10
leaq 4(%r9), %rsi
addq $5, %r9
xorq %r8, %rax
rorx $40, %r10, %r8
movq %r9, 16(%rbx)
xorq %rsi, %rax
movq %r10, %rsi
shrq $11, %rsi
addq %rax, %r8
movq %rsi, %r14
leaq (%r10,%r10,8), %rsi
leaq (%r8,%r8,8), %r10
xorq %r14, %rsi
movq %r8, %r14
rorx $40, %r8, %r8
shrq $11, %r14
xorq %r9, %rsi
movabsq $34359738359, %r9
xorq %r14, %r10
addq %rsi, %r8
movl %esi, %esi
vmovq %r10, %xmm6
movq -120(%rbp), %r10
vpinsrq $1, %r8, %xmm6, %xmm0
movq %r10, %r14
vmovdqu %xmm0, (%rbx)
shrq $3, %r14
cmpq %r9, %r10
movl $4294967295, %r9d
movq %r14, %r8
leaq 192(%r12), %r14
cmova %r9, %r8
movl %edi, %r9d
shrq $32, %rdi
imulq %r8, %r9
imulq %r8, %rdi
imulq %r8, %rsi
shrq $32, %r9
salq $6, %r9
shrq $32, %rdi
vmovdqa64 (%r11,%r9), %zmm2
movl %ecx, %r9d
shrq $32, %rcx
imulq %r8, %r9
salq $6, %rdi
shrq $32, %rsi
imulq %r8, %rcx
salq $6, %rsi
vmovdqa64 (%r11,%rsi), %zmm5
shrq $32, %r9
salq $6, %r9
shrq $32, %rcx
vmovdqa64 (%r11,%r9), %zmm3
salq $6, %rcx
vpminsq %zmm3, %zmm2, %zmm0
vpmaxsq (%r11,%rdi), %zmm0, %zmm0
vpmaxsq %zmm3, %zmm2, %zmm2
vpminsq %zmm2, %zmm0, %zmm0
vmovdqa64 (%r11,%rcx), %zmm2
movq %rdx, %rcx
movl %edx, %edx
shrq $32, %rcx
imulq %r8, %rdx
vmovdqa64 %zmm0, (%r12)
imulq %r8, %rcx
shrq $32, %rdx
shrq $32, %rcx
salq $6, %rdx
salq $6, %rcx
vmovdqa64 (%r11,%rcx), %zmm4
vpminsq %zmm4, %zmm2, %zmm3
vpmaxsq (%r11,%rdx), %zmm3, %zmm3
movl %eax, %edx
shrq $32, %rax
imulq %r8, %rdx
vpmaxsq %zmm4, %zmm2, %zmm2
imulq %r8, %rax
vpminsq %zmm2, %zmm3, %zmm3
vmovdqa64 %zmm3, 64(%r12)
shrq $32, %rdx
salq $6, %rdx
shrq $32, %rax
vmovdqa64 (%r11,%rdx), %zmm4
salq $6, %rax
vpminsq %zmm5, %zmm4, %zmm2
vpmaxsq (%r11,%rax), %zmm2, %zmm1
vpmaxsq %zmm5, %zmm4, %zmm4
vpbroadcastq %xmm0, %zmm5
vpminsq %zmm4, %zmm1, %zmm1
vpxord %zmm0, %zmm5, %zmm0
vpxord %zmm3, %zmm5, %zmm3
vmovdqa64 %zmm1, 128(%r12)
vpord %zmm3, %zmm0, %zmm0
vpxord %zmm1, %zmm5, %zmm1
vmovdqa32 %zmm5, %zmm2
vpord %zmm1, %zmm0, %zmm0
vptestnmq %zmm0, %zmm0, %k0
kortestb %k0, %k0
jc .L627
vpbroadcastq .LC10(%rip), %zmm0
movl $2, %esi
movq %r12, %rdi
vmovdqu64 %zmm0, 192(%r12)
vmovdqu64 %zmm0, 256(%r12)
vzeroupper
call _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
vpbroadcastq (%r12), %zmm2
vpbroadcastq 184(%r12), %zmm1
vpternlogd $0xFF, %zmm0, %zmm0, %zmm0
vpaddq %zmm0, %zmm1, %zmm0
vpcmpq $0, %zmm0, %zmm2, %k0
kortestb %k0, %k0
jnc .L629
leaq -112(%rbp), %rdx
movq %r14, %rcx
vmovdqa64 %zmm2, %zmm0
movq %r15, %rsi
movq %r13, %rdi
call _ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L781
.L629:
movq 96(%r12), %rdx
cmpq %rdx, 88(%r12)
jne .L727
cmpq 80(%r12), %rdx
jne .L670
cmpq 72(%r12), %rdx
jne .L728
cmpq 64(%r12), %rdx
jne .L729
cmpq 56(%r12), %rdx
jne .L730
cmpq 48(%r12), %rdx
jne .L731
cmpq 40(%r12), %rdx
jne .L732
cmpq 32(%r12), %rdx
jne .L733
cmpq 24(%r12), %rdx
jne .L734
cmpq 16(%r12), %rdx
jne .L735
cmpq 8(%r12), %rdx
jne .L736
movq (%r12), %rax
cmpq %rax, %rdx
jne .L788
.L672:
vpbroadcastq %rax, %zmm2
.L785:
movl $1, -144(%rbp)
.L667:
cmpq $0, -128(%rbp)
je .L789
leaq -8(%r15), %rdx
movq %rdx, %r9
leaq 0(%r13,%rdx,8), %r10
movq %rdx, %rcx
andl $31, %r9d
vmovdqu64 (%r10), %zmm16
movq %r9, -120(%rbp)
andl $24, %ecx
je .L677
vmovdqu64 0(%r13), %zmm1
leaq _ZZN3hwy11N_AVX3_ZEN4L8CompressIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array(%rip), %r14
vmovdqa64 .LC9(%rip), %zmm0
movq $-1, %rdi
vpcmpq $6, %zmm2, %zmm1, %k1
knotb %k1, %k4
kmovb %k4, %eax
movq %rax, %rsi
kmovb %k1, %ecx
vpbroadcastq (%r14,%rsi,8), %zmm3
movzbl %cl, %esi
popcntq %rax, %rax
xorl %ecx, %ecx
bzhi %rax, %rdi, %r8
kmovb %r8d, %k6
leaq 0(%r13,%rax,8), %rax
popcntq %rsi, %rcx
vpsrlvq %zmm0, %zmm3, %zmm3
vpermq %zmm1, %zmm3, %zmm3
vmovdqu64 %zmm3, 0(%r13){%k6}
vpbroadcastq (%r14,%rsi,8), %zmm3
vpsrlvq %zmm0, %zmm3, %zmm3
vpermq %zmm1, %zmm3, %zmm1
vmovdqu64 %zmm1, (%r12)
testb $16, %dl
je .L678
vmovdqu64 64(%r13), %zmm1
vpcmpq $6, %zmm2, %zmm1, %k1
knotb %k1, %k4
kmovb %k4, %esi
movq %rsi, %r10
kmovb %k1, %r8d
vpbroadcastq (%r14,%r10,8), %zmm3
popcntq %rsi, %rsi
bzhi %rsi, %rdi, %r11
kmovb %r11d, %k7
vpsrlvq %zmm0, %zmm3, %zmm3
vpermq %zmm1, %zmm3, %zmm3
vmovdqu64 %zmm3, (%rax){%k7}
leaq (%rax,%rsi,8), %rax
movzbl %r8b, %esi
xorl %r8d, %r8d
vpbroadcastq (%r14,%rsi,8), %zmm3
popcntq %rsi, %r8
vpsrlvq %zmm0, %zmm3, %zmm3
vpermq %zmm1, %zmm3, %zmm1
vmovdqu64 %zmm1, (%r12,%rcx,8)
addq %r8, %rcx
cmpq $23, %r9
jbe .L678
vmovdqu64 128(%r13), %zmm1
vpcmpq $6, %zmm2, %zmm1, %k1
knotb %k1, %k4
kmovb %k4, %esi
movq %rsi, %r10
kmovb %k1, %r8d
vpbroadcastq (%r14,%r10,8), %zmm3
popcntq %rsi, %rsi
bzhi %rsi, %rdi, %rdi
kmovb %edi, %k2
vpsrlvq %zmm0, %zmm3, %zmm3
vpermq %zmm1, %zmm3, %zmm3
vmovdqu64 %zmm3, (%rax){%k2}
leaq (%rax,%rsi,8), %rax
movzbl %r8b, %esi
xorl %r8d, %r8d
vpbroadcastq (%r14,%rsi,8), %zmm3
popcntq %rsi, %r8
leaq 1(%r9), %rsi
vpsrlvq %zmm0, %zmm3, %zmm3
vpermq %zmm1, %zmm3, %zmm1
vmovdqu64 %zmm1, (%r12,%rcx,8)
addq %r8, %rcx
cmpq $9, %rsi
sbbq %rsi, %rsi
leaq 0(,%rcx,8), %r8
andq $-16, %rsi
addq $24, %rsi
cmpq %rsi, %r9
jne .L790
.L680:
movq %rax, %r9
movq %rdx, %rsi
subq %r13, %r9
subq %rcx, %rsi
movq %r9, %rdi
leaq 0(%r13,%rsi,8), %r11
sarq $3, %rdi
subq %rdi, %rdx
movq %rdi, -120(%rbp)
movq %rdx, %rcx
movq %rdx, -152(%rbp)
movq %rsi, %rdx
subq %rdi, %rdx
leaq (%rax,%rcx,8), %rdi
leaq (%rax,%rdx,8), %r10
vmovq %rdi, %xmm17
.p2align 4,,10
.p2align 3
.L682:
cmpl $8, %r8d
jnb .L684
testl %r8d, %r8d
jne .L791
.L685:
cmpl $8, %r8d
jnb .L688
testl %r8d, %r8d
jne .L792
.L689:
testq %rdx, %rdx
je .L739
.L703:
leaq 256(%rax), %rsi
leaq -256(%r10), %rdi
vmovdqu64 (%rax), %zmm15
vmovdqu64 64(%rax), %zmm14
vmovdqu64 128(%rax), %zmm13
vmovdqu64 192(%rax), %zmm12
vmovdqu64 -128(%r10), %zmm9
vmovdqu64 -64(%r10), %zmm8
vmovdqu64 -256(%r10), %zmm11
vmovdqu64 -192(%r10), %zmm10
cmpq %rdi, %rsi
je .L740
xorl %ecx, %ecx
leaq _ZZN3hwy11N_AVX3_ZEN4L11CompressNotIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array(%rip), %r9
movl $8, %r8d
jmp .L696
.p2align 4,,10
.p2align 3
.L794:
vmovdqu64 -128(%rdi), %zmm3
vmovdqu64 -64(%rdi), %zmm1
prefetcht0 -1024(%rdi)
subq $256, %rdi
vmovdqu64 (%rdi), %zmm5
vmovdqu64 64(%rdi), %zmm4
.L695:
vpcmpq $6, %zmm2, %zmm5, %k2
vpcmpq $6, %zmm2, %zmm4, %k7
vpcmpq $6, %zmm2, %zmm3, %k6
vpcmpq $6, %zmm2, %zmm1, %k5
kmovb %k2, %r11d
vpbroadcastq (%r9,%r11,8), %zmm18
movq %r11, %r10
leaq -8(%rdx,%rcx), %r11
popcntq %r10, %r10
vpsrlvq %zmm0, %zmm18, %zmm18
vpermq %zmm5, %zmm18, %zmm5
vmovdqu64 %zmm5, (%rax,%rcx,8)
addq $8, %rcx
vmovdqu64 %zmm5, (%rax,%r11,8)
kmovb %k7, %r11d
subq %r10, %rcx
vpbroadcastq (%r9,%r11,8), %zmm5
movq %r11, %r10
leaq -16(%rdx,%rcx), %r11
vpsrlvq %zmm0, %zmm5, %zmm5
popcntq %r10, %r10
vpermq %zmm4, %zmm5, %zmm4
vmovdqu64 %zmm4, (%rax,%rcx,8)
vmovdqu64 %zmm4, (%rax,%r11,8)
movq %r8, %r11
subq %r10, %r11
addq %r11, %rcx
kmovb %k6, %r11d
vpbroadcastq (%r9,%r11,8), %zmm4
movq %r11, %r10
leaq -24(%rdx,%rcx), %r11
popcntq %r10, %r10
subq $32, %rdx
vpsrlvq %zmm0, %zmm4, %zmm4
vpermq %zmm3, %zmm4, %zmm3
vmovdqu64 %zmm3, (%rax,%rcx,8)
vmovdqu64 %zmm3, (%rax,%r11,8)
movq %r8, %r11
subq %r10, %r11
addq %rcx, %r11
kmovb %k5, %ecx
vpbroadcastq (%r9,%rcx,8), %zmm3
movq %rcx, %r10
leaq (%r11,%rdx), %rcx
popcntq %r10, %r10
vpsrlvq %zmm0, %zmm3, %zmm3
vpermq %zmm1, %zmm3, %zmm1
vmovdqu64 %zmm1, (%rax,%r11,8)
vmovdqu64 %zmm1, (%rax,%rcx,8)
movq %r8, %rcx
subq %r10, %rcx
addq %r11, %rcx
cmpq %rdi, %rsi
je .L793
.L696:
movq %rsi, %r10
subq %rax, %r10
sarq $3, %r10
subq %rcx, %r10
cmpq $32, %r10
ja .L794
vmovdqu64 (%rsi), %zmm5
vmovdqu64 64(%rsi), %zmm4
prefetcht0 1024(%rsi)
addq $256, %rsi
vmovdqu64 -128(%rsi), %zmm3
vmovdqu64 -64(%rsi), %zmm1
jmp .L695
.p2align 4,,10
.p2align 3
.L787:
movl $8, %eax
subq %rdi, %rax
leaq 0(%r13,%rax,8), %r11
leaq -8(%rdi,%rdx), %rax
movq %rax, -120(%rbp)
jmp .L625
.p2align 4,,10
.p2align 3
.L793:
leaq (%rdx,%rcx), %r8
leaq (%rax,%rcx,8), %r10
addq $8, %rcx
.L693:
vpcmpq $6, %zmm2, %zmm15, %k4
vpcmpq $6, %zmm2, %zmm14, %k3
xorl %esi, %esi
vpcmpq $6, %zmm2, %zmm13, %k1
kmovb %k4, %edi
vpbroadcastq (%r9,%rdi,8), %zmm1
popcntq %rdi, %rsi
kmovb %k3, %edi
subq %rsi, %rcx
movq %rdi, %rsi
vpsrlvq %zmm0, %zmm1, %zmm1
popcntq %rsi, %rsi
vpcmpq $6, %zmm2, %zmm12, %k4
vpcmpq $6, %zmm2, %zmm11, %k3
vpermq %zmm15, %zmm1, %zmm15
vpbroadcastq (%r9,%rdi,8), %zmm1
leaq -16(%rdx,%rcx), %rdi
vmovdqu64 %zmm15, (%r10)
vpsrlvq %zmm0, %zmm1, %zmm1
vmovdqu64 %zmm15, -64(%rax,%r8,8)
vpermq %zmm14, %zmm1, %zmm14
vmovdqu64 %zmm14, (%rax,%rcx,8)
subq %rsi, %rcx
vmovdqu64 %zmm14, (%rax,%rdi,8)
kmovb %k1, %edi
addq $8, %rcx
vpbroadcastq (%r9,%rdi,8), %zmm1
movq %rdi, %rsi
vpcmpq $6, %zmm2, %zmm10, %k1
leaq -24(%rdx,%rcx), %rdi
vpsrlvq %zmm0, %zmm1, %zmm1
vpermq %zmm13, %zmm1, %zmm13
vmovdqu64 %zmm13, (%rax,%rcx,8)
vmovdqu64 %zmm13, (%rax,%rdi,8)
xorl %edi, %edi
popcntq %rsi, %rdi
movl $8, %esi
movq %rsi, %r8
subq %rdi, %r8
kmovb %k4, %edi
vpbroadcastq (%r9,%rdi,8), %zmm1
vpcmpq $6, %zmm2, %zmm9, %k4
addq %rcx, %r8
movq %rdi, %rcx
vpsrlvq %zmm0, %zmm1, %zmm1
leaq -32(%rdx,%r8), %rdi
popcntq %rcx, %rcx
vpermq %zmm12, %zmm1, %zmm12
vmovdqu64 %zmm12, (%rax,%r8,8)
vmovdqu64 %zmm12, (%rax,%rdi,8)
movq %rsi, %rdi
subq %rcx, %rdi
addq %r8, %rdi
kmovb %k3, %r8d
vpbroadcastq (%r9,%r8,8), %zmm1
movq %r8, %rcx
leaq -40(%rdx,%rdi), %r8
popcntq %rcx, %rcx
vpcmpq $6, %zmm2, %zmm8, %k3
vpsrlvq %zmm0, %zmm1, %zmm1
vpermq %zmm11, %zmm1, %zmm11
vmovdqu64 %zmm11, (%rax,%rdi,8)
vmovdqu64 %zmm11, (%rax,%r8,8)
movq %rsi, %r8
subq %rcx, %r8
addq %rdi, %r8
kmovb %k1, %edi
vpbroadcastq (%r9,%rdi,8), %zmm1
movq %rdi, %rcx
leaq -48(%rdx,%r8), %rdi
popcntq %rcx, %rcx
vpsrlvq %zmm0, %zmm1, %zmm1
vpermq %zmm10, %zmm1, %zmm10
vmovdqu64 %zmm10, (%rax,%r8,8)
vmovdqu64 %zmm10, (%rax,%rdi,8)
movq %rsi, %rdi
subq %rcx, %rdi
addq %r8, %rdi
kmovb %k4, %r8d
vpbroadcastq (%r9,%r8,8), %zmm1
movq %r8, %rcx
leaq -56(%rdx,%rdi), %r8
popcntq %rcx, %rcx
vpsrlvq %zmm0, %zmm1, %zmm1
vpermq %zmm9, %zmm1, %zmm9
vmovdqu64 %zmm9, (%rax,%rdi,8)
vmovdqu64 %zmm9, (%rax,%r8,8)
movq %rsi, %r8
subq %rcx, %r8
xorl %ecx, %ecx
addq %rdi, %r8
kmovb %k3, %edi
vpbroadcastq (%r9,%rdi,8), %zmm1
popcntq %rdi, %rcx
leaq -64(%rdx,%r8), %rdx
subq %rcx, %rsi
vpsrlvq %zmm0, %zmm1, %zmm1
vpermq %zmm8, %zmm1, %zmm8
vmovdqu64 %zmm8, (%rax,%r8,8)
vmovdqu64 %zmm8, (%rax,%rdx,8)
leaq (%rsi,%r8), %rdx
movq -152(%rbp), %rsi
leaq (%rax,%rdx,8), %rcx
subq %rdx, %rsi
.L692:
movq %rcx, %rdi
cmpq $7, %rsi
ja .L697
movq -152(%rbp), %rdi
leaq -64(%rax,%rdi,8), %rdi
.L697:
vpcmpq $6, %zmm2, %zmm16, %k3
vmovdqu64 (%rdi), %zmm7
vmovq %xmm17, %rsi
vmovdqu64 %zmm7, (%rsi)
movq $-1, %rsi
knotb %k3, %k4
kmovb %k4, %edi
movq %rdi, %r10
kmovb %k3, %r8d
vpbroadcastq (%r14,%r10,8), %zmm1
popcntq %rdi, %rdi
addq %rdi, %rdx
bzhi %rdi, %rsi, %r11
kmovb %r11d, %k3
vpsrlvq %zmm0, %zmm1, %zmm1
vpermq %zmm16, %zmm1, %zmm1
vmovdqu64 %zmm1, (%rcx){%k3}
vpbroadcastq (%r14,%r8,8), %zmm1
movzbl %r8b, %ecx
popcntq %rcx, %rcx
bzhi %rcx, %rsi, %rsi
kmovb %esi, %k4
vpsrlvq %zmm0, %zmm1, %zmm0
vpermq %zmm16, %zmm0, %zmm0
vmovdqu64 %zmm0, (%rax,%rdx,8){%k4}
movq -120(%rbp), %r14
movq -128(%rbp), %r9
addq %rdx, %r14
subq $1, %r9
cmpl $2, -144(%rbp)
je .L795
movq -136(%rbp), %rsi
movq %rbx, %r8
movq %r12, %rcx
movq %r14, %rdx
movq %r13, %rdi
movq %r9, -120(%rbp)
vzeroupper
call _ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -144(%rbp)
movq -120(%rbp), %r9
je .L781
.L699:
movq %r15, %rdx
movq -136(%rbp), %rsi
movq %rbx, %r8
movq %r12, %rcx
subq %r14, %rdx
leaq 0(%r13,%r14,8), %rdi
call _ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L781:
subq $-128, %rsp
popq %rbx
popq %r10
.cfi_remember_state
.cfi_def_cfa 10, 0
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
leaq -8(%r10), %rsp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L688:
.cfi_restore_state
movq (%r12), %rcx
movl %r8d, %esi
leaq 8(%r11), %rdi
andq $-8, %rdi
movq %rcx, (%r11)
movq -8(%r12,%rsi), %rcx
movq %rcx, -8(%r11,%rsi)
movq %r11, %rcx
movq %r12, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L689
.p2align 4,,10
.p2align 3
.L684:
movq (%r11), %rcx
movl %r8d, %esi
leaq 8(%rax), %rdi
andq $-8, %rdi
movq %rcx, (%rax)
movq -8(%r11,%rsi), %rcx
movq %rcx, -8(%rax,%rsi)
movq %rax, %rcx
movq %r11, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L685
.p2align 4,,10
.p2align 3
.L790:
subq %rsi, -120(%rbp)
leaq 0(%r13,%rsi,8), %r10
leaq (%r12,%r8), %rsi
.L702:
movq -120(%rbp), %r9
movq $-1, %rdi
bzhi %r9, %rdi, %rdi
movzbl %dil, %edi
kmovd %edi, %k1
.L683:
vmovdqu64 (%r10), %zmm1
movq $-1, %rdi
vpcmpq $6, %zmm2, %zmm1, %k0
kandnb %k1, %k0, %k4
kmovb %k4, %r8d
movq %r8, %r9
popcntq %r8, %r8
vpbroadcastq (%r14,%r9,8), %zmm3
bzhi %r8, %rdi, %rdi
kmovb %edi, %k5
kandb %k1, %k0, %k1
kmovb %k1, %edi
vpsrlvq %zmm0, %zmm3, %zmm3
vpermq %zmm1, %zmm3, %zmm3
vmovdqu64 %zmm3, (%rax){%k5}
leaq (%rax,%r8,8), %rax
xorl %r8d, %r8d
vpbroadcastq (%r14,%rdi,8), %zmm3
movq %rax, %r9
popcntq %rdi, %r8
addq %rcx, %r8
movq %rdx, %rcx
subq %r13, %r9
vpsrlvq %zmm0, %zmm3, %zmm3
subq %r8, %rcx
salq $3, %r8
movq %r9, %rdi
leaq 0(%r13,%rcx,8), %r11
sarq $3, %rdi
vpermq %zmm1, %zmm3, %zmm1
subq %rdi, %rdx
vmovdqu64 %zmm1, (%rsi)
movq %rdx, -152(%rbp)
movq %rdx, %rsi
movq %rcx, %rdx
subq %rdi, %rdx
movq %rdi, -120(%rbp)
leaq (%rax,%rsi,8), %rdi
leaq (%rax,%rdx,8), %r10
vmovq %rdi, %xmm17
jmp .L682
.p2align 4,,10
.p2align 3
.L792:
movzbl (%r12), %ecx
movb %cl, (%r11)
jmp .L689
.p2align 4,,10
.p2align 3
.L791:
movzbl (%r11), %ecx
movb %cl, (%rax)
jmp .L685
.p2align 4,,10
.p2align 3
.L678:
movq -120(%rbp), %r9
leaq 0(,%rcx,8), %r8
leaq -8(%r9), %rsi
leaq 1(%r9), %rdi
andq $-8, %rsi
addq $8, %rsi
cmpq $8, %rdi
movl $8, %edi
cmovbe %rdi, %rsi
cmpq %rsi, %r9
je .L680
subq %rsi, -120(%rbp)
movq -120(%rbp), %rdi
leaq 0(%r13,%rsi,8), %r10
leaq (%r12,%r8), %rsi
cmpq $255, %rdi
jbe .L702
movl $255, %edi
kmovd %edi, %k1
jmp .L683
.p2align 4,,10
.p2align 3
.L786:
cmpq $1, %rdx
jbe .L781
leaq 1024(%rdi), %rax
cmpq %rax, %rsi
jb .L796
movl $8, %esi
call _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L781
.p2align 4,,10
.p2align 3
.L627:
vmovdqu64 0(%r13), %zmm6
movl $8, %esi
movq $-1, %rax
subq -144(%rbp), %rsi
bzhi %rsi, %rax, %rax
kmovb %eax, %k1
vpcmpq $4, %zmm5, %zmm6, %k0
kandb %k1, %k0, %k0
kmovb %k0, %eax
kortestb %k0, %k0
jne .L797
vpxor %xmm4, %xmm4, %xmm4
leaq 1024(%r13,%rsi,8), %rdi
vmovdqa64 %zmm4, %zmm3
.p2align 4,,10
.p2align 3
.L633:
movq %rsi, %rcx
subq $-128, %rsi
cmpq %rsi, %r15
jb .L637
leaq -1024(%rdi), %rax
.L632:
vpxord (%rax), %zmm2, %zmm0
vpxord 64(%rax), %zmm2, %zmm1
leaq 128(%rax), %rdx
vpord %zmm3, %zmm0, %zmm3
vpord %zmm4, %zmm1, %zmm4
vpxord 128(%rax), %zmm2, %zmm0
vpxord 192(%rax), %zmm2, %zmm1
vpord %zmm3, %zmm0, %zmm3
vpxord 256(%rax), %zmm2, %zmm0
vpord %zmm4, %zmm1, %zmm4
vpxord 320(%rax), %zmm2, %zmm1
leaq 384(%rdx), %rax
vpord %zmm3, %zmm0, %zmm3
vpxord 256(%rdx), %zmm2, %zmm0
vpord %zmm4, %zmm1, %zmm4
vpxord 320(%rdx), %zmm2, %zmm1
vpord %zmm3, %zmm0, %zmm0
vpord %zmm4, %zmm1, %zmm1
vmovdqa64 %zmm0, %zmm3
vmovdqa64 %zmm1, %zmm4
cmpq %rdi, %rax
jne .L632
vpord %zmm1, %zmm0, %zmm0
leaq 1408(%rdx), %rdi
vptestnmq %zmm0, %zmm0, %k0
kortestb %k0, %k0
setc %al
testb %al, %al
jne .L633
vmovdqa64 0(%r13,%rcx,8), %zmm6
vpcmpq $4, %zmm5, %zmm6, %k0
kortestb %k0, %k0
jne .L635
.p2align 4,,10
.p2align 3
.L634:
addq $8, %rcx
vmovdqa64 0(%r13,%rcx,8), %zmm7
vpcmpq $4, %zmm5, %zmm7, %k0
kortestb %k0, %k0
je .L634
.L635:
kmovb %k0, %eax
tzcntl %eax, %eax
addq %rcx, %rax
.L631:
vpbroadcastq 0(%r13,%rax,8), %zmm1
leaq 0(%r13,%rax,8), %rdi
vpcmpq $6, %zmm5, %zmm1, %k0
kortestb %k0, %k0
jne .L640
leaq -8(%r15), %rax
xorl %ecx, %ecx
jmp .L646
.p2align 4,,10
.p2align 3
.L641:
kmovb %k0, %edx
popcntq %rdx, %rdx
addq %rdx, %rcx
leaq -8(%rax), %rdx
vmovdqu64 %zmm5, 0(%r13,%rax,8)
cmpq %rdx, %r15
jbe .L798
movq %rdx, %rax
.L646:
vmovdqu64 0(%r13,%rax,8), %zmm6
vpcmpq $0, %zmm1, %zmm6, %k1
vpcmpq $0, %zmm5, %zmm6, %k0
kmovb %k1, %edx
kmovb %k0, %esi
korb %k0, %k1, %k1
kortestb %k1, %k1
jc .L641
kmovb %edx, %k1
kmovb %esi, %k4
kxnorb %k4, %k1, %k1
kmovb %k1, %edx
tzcntl %edx, %edx
leaq 8(%rax), %rsi
addq %rax, %rdx
addq $16, %rax
vpbroadcastq 0(%r13,%rdx,8), %zmm0
movq %r15, %rdx
subq %rcx, %rdx
vmovdqa64 %zmm0, -112(%rbp)
cmpq %rdx, %rax
ja .L642
.p2align 4,,10
.p2align 3
.L643:
vmovdqu64 %zmm1, -64(%r13,%rax,8)
movq %rax, %rsi
addq $8, %rax
cmpq %rax, %rdx
jnb .L643
.L642:
subq %rsi, %rdx
leaq 0(%r13,%rsi,8), %rcx
movl $255, %eax
cmpq $255, %rdx
ja .L644
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzbl %al, %eax
.L644:
kmovb %eax, %k2
vmovdqu64 %zmm1, (%rcx){%k2}
.L645:
vpbroadcastq (%r12), %zmm2
vpcmpq $0, .LC8(%rip), %zmm2, %k0
kortestb %k0, %k0
jc .L725
vpcmpq $0, .LC7(%rip), %zmm2, %k0
kortestb %k0, %k0
jc .L663
vpminsq %zmm0, %zmm1, %zmm3
vpcmpq $6, %zmm3, %zmm2, %k0
kortestb %k0, %k0
jne .L799
vmovdqa64 %zmm2, %zmm0
movl $128, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L658:
leaq (%rcx,%rax,8), %rdx
addq $1, %rax
vpminsq 0(%r13,%rdx,8), %zmm0, %zmm0
cmpq $16, %rax
jne .L658
vpcmpq $6, %zmm0, %zmm2, %k0
kortestb %k0, %k0
jne .L785
leaq 128(%rsi), %rax
cmpq %rax, %r15
jb .L665
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L658
.p2align 4,,10
.p2align 3
.L637:
movq %rcx, %rdx
addq $8, %rcx
cmpq %rcx, %r15
jb .L800
vmovdqa64 -64(%r13,%rcx,8), %zmm6
vpcmpq $4, %zmm5, %zmm6, %k0
kmovb %k0, %eax
kortestb %k0, %k0
je .L637
.L783:
tzcntl %eax, %eax
addq %rdx, %rax
jmp .L631
.p2align 4,,10
.p2align 3
.L677:
cmpq $0, -120(%rbp)
je .L801
movq %r12, %rsi
movq %r13, %r10
leaq _ZZN3hwy11N_AVX3_ZEN4L8CompressIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array(%rip), %r14
movq %r13, %rax
vmovdqa64 .LC9(%rip), %zmm0
jmp .L702
.p2align 4,,10
.p2align 3
.L795:
vzeroupper
jmp .L699
.p2align 4,,10
.p2align 3
.L739:
movq -152(%rbp), %rsi
movq %rax, %rcx
jmp .L692
.p2align 4,,10
.p2align 3
.L740:
movq %rax, %r10
movq %rdx, %r8
movl $8, %ecx
leaq _ZZN3hwy11N_AVX3_ZEN4L11CompressNotIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array(%rip), %r9
jmp .L693
.L789:
leaq -1(%r15), %rbx
movq %rbx, %r12
shrq %r12
.p2align 4,,10
.p2align 3
.L675:
movq %r12, %rdx
movq %r15, %rsi
movq %r13, %rdi
call _ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %r12
jnb .L675
.p2align 4,,10
.p2align 3
.L676:
movq 0(%r13,%rbx,8), %rdx
movq 0(%r13), %rax
movq %rbx, %rsi
movq %r13, %rdi
movq %rdx, 0(%r13)
xorl %edx, %edx
movq %rax, 0(%r13,%rbx,8)
call _ZN3hwy11N_AVX3_ZEN46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L676
jmp .L781
.p2align 4,,10
.p2align 3
.L666:
vpcmpq $6, -64(%r13,%rsi,8), %zmm2, %k0
kortestb %k0, %k0
jne .L785
.L665:
movq %rsi, %rax
addq $8, %rsi
cmpq %rsi, %r15
jnb .L666
cmpq %rax, %r15
je .L725
vpcmpq $6, -64(%r13,%r15,8), %zmm2, %k0
xorl %eax, %eax
kortestb %k0, %k0
sete %al
addl $1, %eax
movl %eax, -144(%rbp)
jmp .L667
.L727:
movl $12, %eax
movl $11, %esi
jmp .L673
.p2align 4,,10
.p2align 3
.L674:
cmpq $23, %rax
je .L784
.L673:
movq %rax, %rcx
addq $1, %rax
cmpq (%r12,%rax,8), %rdx
je .L674
movl $12, %edi
subq $11, %rcx
movq %rdx, %rax
subq %rsi, %rdi
cmpq %rdi, %rcx
jb .L672
.L784:
movq (%r12,%rsi,8), %rax
jmp .L672
.L728:
movl $9, %esi
movl $10, %eax
jmp .L673
.L729:
movl $8, %esi
movl $9, %eax
jmp .L673
.L730:
movl $7, %esi
movl $8, %eax
jmp .L673
.L731:
movl $6, %esi
movl $7, %eax
jmp .L673
.L732:
movl $5, %esi
movl $6, %eax
jmp .L673
.L640:
movq %r15, %rsi
leaq -112(%rbp), %rdx
vmovdqa64 %zmm5, %zmm0
movq %r12, %rcx
subq %rax, %rsi
call _ZN3hwy11N_AVX3_ZEN46detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L781
vmovdqa64 -112(%rbp), %zmm0
jmp .L645
.L733:
movl $4, %esi
movl $5, %eax
jmp .L673
.L734:
movl $3, %esi
movl $4, %eax
jmp .L673
.L735:
movl $2, %esi
movl $3, %eax
jmp .L673
.L736:
movl $1, %esi
movl $2, %eax
jmp .L673
.L788:
xorl %esi, %esi
movl $1, %eax
jmp .L673
.L798:
movl $255, %edi
vmovdqu64 0(%r13), %zmm0
kmovd %edi, %k2
cmpq $255, %rax
ja .L647
movq $-1, %rdx
bzhi %rax, %rdx, %rdx
movzbl %dl, %edi
kmovd %edi, %k2
.L647:
vpcmpq $0, %zmm1, %zmm0, %k0
vpcmpq $0, %zmm5, %zmm0, %k1
movq %r15, %rsi
kandb %k2, %k1, %k1
knotb %k2, %k2
korb %k1, %k0, %k0
korb %k2, %k0, %k0
kortestb %k0, %k0
setc %dl
subq %rcx, %rsi
testb %dl, %dl
je .L802
movq %rsi, %rdx
kmovb %k1, %eax
popcntq %rax, %rax
vmovdqu64 %zmm5, 0(%r13)
subq %rax, %rdx
cmpq $7, %rdx
jbe .L652
leaq -8(%rdx), %rcx
movq -152(%rbp), %rsi
movq %rcx, %rax
shrq $3, %rax
salq $6, %rax
leaq 64(%r13,%rax), %rax
.p2align 4,,10
.p2align 3
.L653:
vmovdqu64 %zmm1, (%rsi)
addq $64, %rsi
cmpq %rsi, %rax
jne .L653
andq $-8, %rcx
vmovdqa64 %zmm1, (%r12)
leaq 8(%rcx), %rax
leaq 0(%r13,%rax,8), %r13
subq %rax, %rdx
movl $255, %eax
kmovd %eax, %k1
cmpq $255, %rdx
jbe .L704
.L654:
vmovdqu64 (%r12), %zmm0{%k1}{z}
vmovdqu64 %zmm0, 0(%r13){%k1}
vzeroupper
jmp .L781
.L670:
movl $11, %eax
movl $10, %esi
jmp .L673
.L800:
leaq -8(%r15), %rdx
vmovdqu64 0(%r13,%rdx,8), %zmm7
vpcmpq $4, %zmm5, %zmm7, %k0
kmovb %k0, %eax
kortestb %k0, %k0
jne .L783
vzeroupper
jmp .L781
.L662:
vmovdqu64 -64(%r13,%rsi,8), %zmm7
vpcmpq $6, %zmm2, %zmm7, %k0
kortestb %k0, %k0
jne .L785
.L661:
movq %rsi, %rax
addq $8, %rsi
cmpq %rsi, %r15
jnb .L662
cmpq %rax, %r15
je .L663
vmovdqu64 -64(%r13,%r15,8), %zmm7
vpcmpq $6, %zmm2, %zmm7, %k0
kortestb %k0, %k0
jne .L785
.L663:
movl $3, -144(%rbp)
vpternlogd $0xFF, %zmm0, %zmm0, %zmm0
vpaddq %zmm0, %zmm2, %zmm2
jmp .L667
.L797:
tzcntl %eax, %eax
jmp .L631
.L796:
movq %rdi, %rcx
movq %r12, %rdi
cmpq $7, %rdx
jbe .L618
leaq -8(%rdx), %rdx
movq 0(%r13), %rcx
leaq 8(%r12), %rdi
movq %rdx, %rax
andq $-8, %rdi
shrq $3, %rax
movq %rcx, (%r12)
addq $1, %rax
salq $6, %rax
movl %eax, %ecx
movq -8(%r13,%rcx), %rsi
movq %rsi, -8(%r12,%rcx)
movq %r12, %rcx
movq %r13, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
movq %r15, %rdx
andq $-8, %rax
shrl $3, %ecx
rep movsq
addq $8, %rax
leaq 0(,%rax,8), %rcx
subq %rax, %rdx
movl $255, %eax
leaq (%r12,%rcx), %rdi
addq %r13, %rcx
cmpq $255, %rdx
jbe .L618
.L619:
leal -1(%r15), %edx
movl $32, %r8d
movl $1, %esi
kmovb %eax, %k7
bsrl %edx, %edx
vmovdqu64 (%rcx), %zmm0{%k7}{z}
movq %r15, %rax
xorl $31, %edx
subl %edx, %r8d
movl $1, %edx
vmovdqu64 %zmm0, (%rdi){%k7}
vpbroadcastq .LC10(%rip), %zmm0
shlx %r8, %rsi, %rsi
shrq $4, %rsi
cmove %rdx, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $8, %rdx
cmpq %rdx, %r15
jnb .L623
.p2align 4,,10
.p2align 3
.L620:
vmovdqu64 %zmm0, (%r12,%rax,8)
addq $8, %rax
cmpq %rdx, %rax
jb .L620
.L623:
movq %r12, %rdi
vzeroupper
call _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
cmpq $7, %r15
jbe .L622
leaq -8(%r15), %rdx
movq (%r12), %rcx
leaq 8(%r13), %rdi
movq %rdx, %rax
andq $-8, %rdi
shrq $3, %rax
movq %rcx, 0(%r13)
addq $1, %rax
salq $6, %rax
movl %eax, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %r12, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-8, %rax
shrl $3, %ecx
rep movsq
addq $8, %rax
leaq 0(,%rax,8), %rdx
subq %rax, %r15
movl $255, %eax
addq %rdx, %r13
addq %rdx, %r12
cmpq $255, %r15
jbe .L622
.L624:
kmovb %eax, %k7
vmovdqu64 (%r12), %zmm0{%k7}{z}
vmovdqu64 %zmm0, 0(%r13){%k7}
vzeroupper
jmp .L781
.L652:
vmovdqa64 %zmm1, (%r12)
.L704:
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzbl %al, %eax
kmovd %eax, %k1
jmp .L654
.L801:
movq %rdx, -152(%rbp)
vmovq %r10, %xmm17
movq %r13, %rax
vmovdqa64 .LC9(%rip), %zmm0
leaq _ZZN3hwy11N_AVX3_ZEN4L8CompressIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array(%rip), %r14
jmp .L703
.L725:
movl $2, -144(%rbp)
jmp .L667
.L799:
vpmaxsq %zmm0, %zmm1, %zmm1
vpcmpq $6, %zmm2, %zmm1, %k0
kortestb %k0, %k0
jne .L785
vmovdqa64 %zmm2, %zmm0
movl $128, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L659:
leaq (%rcx,%rax,8), %rdx
addq $1, %rax
vpmaxsq 0(%r13,%rdx,8), %zmm0, %zmm0
cmpq $16, %rax
jne .L659
vpcmpq $6, %zmm2, %zmm0, %k0
kortestb %k0, %k0
jne .L785
leaq 128(%rsi), %rax
cmpq %rax, %r15
jb .L661
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L659
.L618:
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzbl %al, %eax
jmp .L619
.L622:
movq $-1, %rax
bzhi %r15, %rax, %rax
movzbl %al, %eax
jmp .L624
.L802:
knotb %k0, %k1
kmovb %k1, %edx
tzcntl %edx, %edx
vpbroadcastq 0(%r13,%rdx,8), %zmm0
leaq 8(%rax), %rdx
vmovdqa64 %zmm0, -112(%rbp)
cmpq %rsi, %rdx
ja .L649
.L650:
vmovdqu64 %zmm1, -64(%r13,%rdx,8)
movq %rdx, %rax
addq $8, %rdx
cmpq %rsi, %rdx
jbe .L650
.L649:
movq %rsi, %rdx
leaq 0(%r13,%rax,8), %rcx
subq %rax, %rdx
movl $-1, %eax
cmpq $255, %rdx
ja .L651
orq $-1, %rax
bzhi %rdx, %rax, %rax
.L651:
kmovb %eax, %k7
vmovdqu64 %zmm1, (%rcx){%k7}
jmp .L645
.cfi_endproc
.LFE18799:
.size _ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18801:
.cfi_startproc
leaq 8(%rsp), %r10
.cfi_def_cfa 10, 0
andq $-64, %rsp
pushq -8(%r10)
pushq %rbp
movq %rsp, %rbp
.cfi_escape 0x10,0x6,0x2,0x76,0
pushq %r15
.cfi_escape 0x10,0xf,0x2,0x76,0x78
movq %rdx, %r15
pushq %r14
pushq %r13
.cfi_escape 0x10,0xe,0x2,0x76,0x70
.cfi_escape 0x10,0xd,0x2,0x76,0x68
movq %rdi, %r13
pushq %r12
.cfi_escape 0x10,0xc,0x2,0x76,0x60
movq %rcx, %r12
pushq %r10
.cfi_escape 0xf,0x3,0x76,0x58,0x6
pushq %rbx
addq $-128, %rsp
.cfi_escape 0x10,0x3,0x2,0x76,0x50
movq %rsi, -128(%rbp)
movq %r9, -120(%rbp)
cmpq $128, %rdx
jbe .L977
movq %rdi, %r11
movq %rdi, -152(%rbp)
movq %r8, %rbx
shrq $3, %r11
movq %r11, %rdi
andl $7, %edi
movq %rdi, -144(%rbp)
jne .L978
movq %rdx, -136(%rbp)
movq %r13, %r11
.L816:
movq 8(%rbx), %rdx
movq 16(%rbx), %r9
movq %rdx, %rsi
leaq 1(%r9), %rdi
leaq (%rdx,%rdx,8), %rcx
xorq (%rbx), %rdi
shrq $11, %rsi
rorx $40, %rdx, %rax
leaq 2(%r9), %rdx
addq %rdi, %rax
xorq %rsi, %rcx
movq %rax, %r8
rorx $40, %rax, %rsi
xorq %rdx, %rcx
shrq $11, %r8
leaq (%rax,%rax,8), %rdx
leaq 3(%r9), %rax
addq %rcx, %rsi
xorq %r8, %rdx
movq %rsi, %r8
xorq %rax, %rdx
leaq (%rsi,%rsi,8), %rax
rorx $40, %rsi, %r10
shrq $11, %r8
addq %rdx, %r10
leaq 4(%r9), %rsi
addq $5, %r9
xorq %r8, %rax
rorx $40, %r10, %r8
movq %r9, 16(%rbx)
xorq %rsi, %rax
movq %r10, %rsi
shrq $11, %rsi
addq %rax, %r8
movq %rsi, %r14
leaq (%r10,%r10,8), %rsi
leaq (%r8,%r8,8), %r10
xorq %r14, %rsi
movq %r8, %r14
rorx $40, %r8, %r8
shrq $11, %r14
xorq %r9, %rsi
movabsq $34359738359, %r9
xorq %r14, %r10
addq %rsi, %r8
movl %esi, %esi
vmovq %r10, %xmm6
movq -136(%rbp), %r10
vpinsrq $1, %r8, %xmm6, %xmm0
movq %r10, %r14
vmovdqu %xmm0, (%rbx)
shrq $3, %r14
cmpq %r9, %r10
movl $4294967295, %r9d
movq %r14, %r8
leaq 192(%r12), %r14
cmova %r9, %r8
movl %edi, %r9d
shrq $32, %rdi
imulq %r8, %r9
imulq %r8, %rdi
imulq %r8, %rsi
shrq $32, %r9
salq $6, %r9
shrq $32, %rdi
vmovdqa64 (%r11,%r9), %zmm2
movl %ecx, %r9d
shrq $32, %rcx
imulq %r8, %r9
salq $6, %rdi
shrq $32, %rsi
imulq %r8, %rcx
salq $6, %rsi
vmovdqa64 (%r11,%rsi), %zmm5
shrq $32, %r9
salq $6, %r9
shrq $32, %rcx
vmovdqa64 (%r11,%r9), %zmm3
salq $6, %rcx
vpminsq %zmm3, %zmm2, %zmm0
vpmaxsq (%r11,%rdi), %zmm0, %zmm0
vpmaxsq %zmm3, %zmm2, %zmm2
vpminsq %zmm2, %zmm0, %zmm0
vmovdqa64 (%r11,%rcx), %zmm2
movq %rdx, %rcx
movl %edx, %edx
shrq $32, %rcx
imulq %r8, %rdx
vmovdqa64 %zmm0, (%r12)
imulq %r8, %rcx
shrq $32, %rdx
shrq $32, %rcx
salq $6, %rdx
salq $6, %rcx
vmovdqa64 (%r11,%rcx), %zmm4
vpminsq %zmm4, %zmm2, %zmm3
vpmaxsq (%r11,%rdx), %zmm3, %zmm3
movl %eax, %edx
shrq $32, %rax
imulq %r8, %rdx
vpmaxsq %zmm4, %zmm2, %zmm2
imulq %r8, %rax
vpminsq %zmm2, %zmm3, %zmm3
vmovdqa64 %zmm3, 64(%r12)
shrq $32, %rdx
salq $6, %rdx
shrq $32, %rax
vmovdqa64 (%r11,%rdx), %zmm4
salq $6, %rax
vpminsq %zmm5, %zmm4, %zmm2
vpmaxsq (%r11,%rax), %zmm2, %zmm1
vpmaxsq %zmm5, %zmm4, %zmm4
vpbroadcastq %xmm0, %zmm5
vpminsq %zmm4, %zmm1, %zmm1
vpxord %zmm0, %zmm5, %zmm0
vpxord %zmm3, %zmm5, %zmm3
vmovdqa64 %zmm1, 128(%r12)
vpord %zmm3, %zmm0, %zmm0
vpxord %zmm1, %zmm5, %zmm1
vmovdqa32 %zmm5, %zmm2
vpord %zmm1, %zmm0, %zmm0
vptestnmq %zmm0, %zmm0, %k0
kortestb %k0, %k0
jc .L818
vpbroadcastq .LC10(%rip), %zmm0
movl $2, %esi
movq %r12, %rdi
vmovdqu64 %zmm0, 192(%r12)
vmovdqu64 %zmm0, 256(%r12)
vzeroupper
call _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
vpbroadcastq (%r12), %zmm2
vpbroadcastq 184(%r12), %zmm1
vpternlogd $0xFF, %zmm0, %zmm0, %zmm0
vpaddq %zmm0, %zmm1, %zmm0
vpcmpq $0, %zmm0, %zmm2, %k0
kortestb %k0, %k0
jnc .L820
leaq -112(%rbp), %rdx
movq %r14, %rcx
vmovdqa64 %zmm2, %zmm0
movq %r15, %rsi
movq %r13, %rdi
call _ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L972
.L820:
movq 96(%r12), %rdx
cmpq %rdx, 88(%r12)
jne .L918
cmpq 80(%r12), %rdx
jne .L861
cmpq 72(%r12), %rdx
jne .L919
cmpq 64(%r12), %rdx
jne .L920
cmpq 56(%r12), %rdx
jne .L921
cmpq 48(%r12), %rdx
jne .L922
cmpq 40(%r12), %rdx
jne .L923
cmpq 32(%r12), %rdx
jne .L924
cmpq 24(%r12), %rdx
jne .L925
cmpq 16(%r12), %rdx
jne .L926
cmpq 8(%r12), %rdx
jne .L927
movq (%r12), %rax
cmpq %rax, %rdx
jne .L979
.L863:
vpbroadcastq %rax, %zmm0
.L976:
movl $1, -136(%rbp)
.L858:
cmpq $0, -120(%rbp)
je .L980
leaq -8(%r15), %rdx
leaq 0(%r13,%rdx,8), %r10
movq %rdx, %r9
movq %rdx, %rcx
vmovdqu64 (%r10), %zmm6
andl $31, %r9d
andl $24, %ecx
je .L868
vmovdqu64 0(%r13), %zmm1
vpcmpq $6, %zmm0, %zmm1, %k2
knotb %k2, %k1
vpcompressq %zmm1, 0(%r13){%k1}
kmovb %k1, %eax
kmovb %k2, %ecx
popcntq %rax, %rax
popcntq %rcx, %rcx
leaq 0(%r13,%rax,8), %rax
vpcompressq %zmm1, (%r12){%k2}
testb $16, %dl
je .L869
vmovdqu64 64(%r13), %zmm1
vpcmpq $6, %zmm0, %zmm1, %k1
knotb %k1, %k2
vpcompressq %zmm1, (%rax){%k2}
kmovb %k2, %esi
popcntq %rsi, %rsi
vpcompressq %zmm1, (%r12,%rcx,8){%k1}
leaq (%rax,%rsi,8), %rax
kmovb %k1, %esi
popcntq %rsi, %rsi
addq %rsi, %rcx
cmpq $23, %r9
jbe .L869
vmovdqu64 128(%r13), %zmm1
vpcmpq $6, %zmm0, %zmm1, %k1
knotb %k1, %k2
vpcompressq %zmm1, (%rax){%k2}
kmovb %k2, %esi
popcntq %rsi, %rsi
vpcompressq %zmm1, (%r12,%rcx,8){%k1}
leaq (%rax,%rsi,8), %rax
kmovb %k1, %esi
popcntq %rsi, %rsi
addq %rsi, %rcx
leaq 1(%r9), %rsi
cmpq $9, %rsi
leaq 0(,%rcx,8), %r8
sbbq %rsi, %rsi
andq $-16, %rsi
addq $24, %rsi
cmpq %rsi, %r9
jne .L981
.L871:
movq %rax, %r9
movq %rdx, %rsi
movq %rdx, %rdi
subq %r13, %r9
subq %rcx, %rsi
sarq $3, %r9
leaq 0(%r13,%rsi,8), %r11
subq %r9, %rdi
subq %r9, %rsi
movq %rdi, -144(%rbp)
leaq (%rax,%rdi,8), %rdi
movq %rsi, %rdx
leaq (%rax,%rsi,8), %r10
vmovq %rdi, %xmm17
.p2align 4,,10
.p2align 3
.L873:
cmpl $8, %r8d
jnb .L875
testl %r8d, %r8d
jne .L982
.L876:
cmpl $8, %r8d
jnb .L879
testl %r8d, %r8d
jne .L983
.L880:
testq %rdx, %rdx
je .L930
.L894:
leaq 256(%rax), %rsi
leaq -256(%r10), %rdi
vmovdqu64 (%rax), %zmm15
vmovdqu64 64(%rax), %zmm14
vmovdqu64 128(%rax), %zmm13
vmovdqu64 192(%rax), %zmm12
vmovdqu64 -128(%r10), %zmm9
vmovdqu64 -64(%r10), %zmm8
vmovdqu64 -256(%r10), %zmm11
vmovdqu64 -192(%r10), %zmm10
cmpq %rdi, %rsi
je .L931
xorl %ecx, %ecx
leaq _ZZN3hwy6N_AVX3L11CompressNotIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array(%rip), %r14
vmovdqa64 .LC9(%rip), %zmm5
movl $8, %r8d
jmp .L887
.p2align 4,,10
.p2align 3
.L985:
vmovdqu64 -128(%rdi), %zmm2
vmovdqu64 -64(%rdi), %zmm1
prefetcht0 -1024(%rdi)
subq $256, %rdi
vmovdqu64 (%rdi), %zmm4
vmovdqu64 64(%rdi), %zmm3
.L886:
vpcmpq $6, %zmm0, %zmm4, %k5
vpcmpq $6, %zmm0, %zmm3, %k6
vpcmpq $6, %zmm0, %zmm2, %k7
vpcmpq $6, %zmm0, %zmm1, %k4
kmovb %k5, %r11d
vpbroadcastq (%r14,%r11,8), %zmm7
movq %r11, %r10
leaq -8(%rdx,%rcx), %r11
popcntq %r10, %r10
vpsrlvq %zmm5, %zmm7, %zmm7
vpermq %zmm4, %zmm7, %zmm4
vmovdqu64 %zmm4, (%rax,%rcx,8)
addq $8, %rcx
vmovdqu64 %zmm4, (%rax,%r11,8)
kmovb %k6, %r11d
subq %r10, %rcx
vpbroadcastq (%r14,%r11,8), %zmm4
movq %r11, %r10
leaq -16(%rdx,%rcx), %r11
vpsrlvq %zmm5, %zmm4, %zmm4
popcntq %r10, %r10
vpermq %zmm3, %zmm4, %zmm3
vmovdqu64 %zmm3, (%rax,%rcx,8)
vmovdqu64 %zmm3, (%rax,%r11,8)
movq %r8, %r11
subq %r10, %r11
leaq (%r11,%rcx), %r10
kmovb %k7, %r11d
vpbroadcastq (%r14,%r11,8), %zmm3
movq %r11, %rcx
leaq -24(%rdx,%r10), %r11
popcntq %rcx, %rcx
subq $32, %rdx
vpsrlvq %zmm5, %zmm3, %zmm3
vpermq %zmm2, %zmm3, %zmm2
vmovdqu64 %zmm2, (%rax,%r10,8)
vmovdqu64 %zmm2, (%rax,%r11,8)
movq %r8, %r11
subq %rcx, %r11
kmovb %k4, %ecx
vpbroadcastq (%r14,%rcx,8), %zmm2
addq %r10, %r11
movq %rcx, %r10
vpsrlvq %zmm5, %zmm2, %zmm2
leaq (%r11,%rdx), %rcx
popcntq %r10, %r10
vpermq %zmm1, %zmm2, %zmm1
vmovdqu64 %zmm1, (%rax,%r11,8)
vmovdqu64 %zmm1, (%rax,%rcx,8)
movq %r8, %rcx
subq %r10, %rcx
addq %r11, %rcx
cmpq %rdi, %rsi
je .L984
.L887:
movq %rsi, %r10
subq %rax, %r10
sarq $3, %r10
subq %rcx, %r10
cmpq $32, %r10
ja .L985
vmovdqu64 (%rsi), %zmm4
vmovdqu64 64(%rsi), %zmm3
prefetcht0 1024(%rsi)
addq $256, %rsi
vmovdqu64 -128(%rsi), %zmm2
vmovdqu64 -64(%rsi), %zmm1
jmp .L886
.p2align 4,,10
.p2align 3
.L978:
movl $8, %eax
subq %rdi, %rax
leaq 0(%r13,%rax,8), %r11
leaq -8(%rdi,%rdx), %rax
movq %rax, -136(%rbp)
jmp .L816
.p2align 4,,10
.p2align 3
.L984:
leaq (%rdx,%rcx), %r8
leaq (%rax,%rcx,8), %r10
addq $8, %rcx
.L884:
vpcmpq $6, %zmm0, %zmm15, %k3
xorl %esi, %esi
kmovb %k3, %edi
vpbroadcastq (%r14,%rdi,8), %zmm1
vpcmpq $6, %zmm0, %zmm14, %k3
popcntq %rdi, %rsi
subq %rsi, %rcx
vpsrlvq %zmm5, %zmm1, %zmm1
kmovb %k3, %edi
vpcmpq $6, %zmm0, %zmm13, %k3
movq %rdi, %rsi
vpermq %zmm15, %zmm1, %zmm15
vpbroadcastq (%r14,%rdi,8), %zmm1
leaq -16(%rdx,%rcx), %rdi
popcntq %rsi, %rsi
vmovdqu64 %zmm15, (%r10)
vpsrlvq %zmm5, %zmm1, %zmm1
vmovdqu64 %zmm15, -64(%rax,%r8,8)
vpermq %zmm14, %zmm1, %zmm14
vmovdqu64 %zmm14, (%rax,%rcx,8)
subq %rsi, %rcx
vmovdqu64 %zmm14, (%rax,%rdi,8)
kmovb %k3, %edi
addq $8, %rcx
vpbroadcastq (%r14,%rdi,8), %zmm1
movq %rdi, %rsi
vpcmpq $6, %zmm0, %zmm12, %k3
leaq -24(%rdx,%rcx), %rdi
vpsrlvq %zmm5, %zmm1, %zmm1
vpermq %zmm13, %zmm1, %zmm13
vmovdqu64 %zmm13, (%rax,%rcx,8)
vmovdqu64 %zmm13, (%rax,%rdi,8)
xorl %edi, %edi
popcntq %rsi, %rdi
movl $8, %esi
movq %rsi, %r8
subq %rdi, %r8
kmovb %k3, %edi
vpbroadcastq (%r14,%rdi,8), %zmm1
vpcmpq $6, %zmm0, %zmm11, %k3
addq %rcx, %r8
movq %rdi, %rcx
vpsrlvq %zmm5, %zmm1, %zmm1
leaq -32(%rdx,%r8), %rdi
popcntq %rcx, %rcx
vpermq %zmm12, %zmm1, %zmm12
vmovdqu64 %zmm12, (%rax,%r8,8)
vmovdqu64 %zmm12, (%rax,%rdi,8)
movq %rsi, %rdi
subq %rcx, %rdi
addq %r8, %rdi
kmovb %k3, %r8d
vpbroadcastq (%r14,%r8,8), %zmm1
movq %r8, %rcx
vpcmpq $6, %zmm0, %zmm10, %k3
leaq -40(%rdx,%rdi), %r8
popcntq %rcx, %rcx
vpsrlvq %zmm5, %zmm1, %zmm1
vpermq %zmm11, %zmm1, %zmm11
vmovdqu64 %zmm11, (%rax,%rdi,8)
vmovdqu64 %zmm11, (%rax,%r8,8)
movq %rsi, %r8
subq %rcx, %r8
addq %rdi, %r8
kmovb %k3, %edi
vpbroadcastq (%r14,%rdi,8), %zmm1
movq %rdi, %rcx
vpcmpq $6, %zmm0, %zmm9, %k3
leaq -48(%rdx,%r8), %rdi
popcntq %rcx, %rcx
vpsrlvq %zmm5, %zmm1, %zmm1
vpermq %zmm10, %zmm1, %zmm10
vmovdqu64 %zmm10, (%rax,%r8,8)
vmovdqu64 %zmm10, (%rax,%rdi,8)
movq %rsi, %rdi
subq %rcx, %rdi
addq %r8, %rdi
kmovb %k3, %r8d
vpbroadcastq (%r14,%r8,8), %zmm1
movq %r8, %rcx
vpcmpq $6, %zmm0, %zmm8, %k3
leaq -56(%rdx,%rdi), %r8
popcntq %rcx, %rcx
vpsrlvq %zmm5, %zmm1, %zmm1
vpermq %zmm9, %zmm1, %zmm9
vmovdqu64 %zmm9, (%rax,%rdi,8)
vmovdqu64 %zmm9, (%rax,%r8,8)
movq %rsi, %r8
subq %rcx, %r8
xorl %ecx, %ecx
addq %rdi, %r8
kmovb %k3, %edi
vpbroadcastq (%r14,%rdi,8), %zmm1
popcntq %rdi, %rcx
leaq -64(%rdx,%r8), %rdx
subq %rcx, %rsi
vpsrlvq %zmm5, %zmm1, %zmm1
vpermq %zmm8, %zmm1, %zmm8
vmovdqu64 %zmm8, (%rax,%r8,8)
vmovdqu64 %zmm8, (%rax,%rdx,8)
leaq (%rsi,%r8), %rdx
movq -144(%rbp), %rsi
leaq (%rax,%rdx,8), %rcx
subq %rdx, %rsi
.L883:
movq %rcx, %rdi
cmpq $7, %rsi
ja .L888
movq -144(%rbp), %rdi
leaq -64(%rax,%rdi,8), %rdi
.L888:
vmovdqu64 (%rdi), %zmm7
vpcmpq $6, %zmm0, %zmm6, %k2
vmovq %xmm17, %rsi
vmovdqu64 %zmm7, (%rsi)
knotb %k2, %k1
vpcompressq %zmm6, (%rcx){%k1}
kmovb %k1, %ecx
popcntq %rcx, %rcx
addq %rcx, %rdx
vpcompressq %zmm6, (%rax,%rdx,8){%k2}
leaq (%r9,%rdx), %r14
movq -120(%rbp), %r9
subq $1, %r9
cmpl $2, -136(%rbp)
je .L986
movq -128(%rbp), %rsi
movq %rbx, %r8
movq %r12, %rcx
movq %r14, %rdx
movq %r13, %rdi
movq %r9, -120(%rbp)
vzeroupper
call _ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -136(%rbp)
movq -120(%rbp), %r9
je .L972
.L890:
movq %r15, %rdx
movq -128(%rbp), %rsi
leaq 0(%r13,%r14,8), %rdi
movq %rbx, %r8
subq %r14, %rdx
movq %r12, %rcx
call _ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L972:
subq $-128, %rsp
popq %rbx
popq %r10
.cfi_remember_state
.cfi_def_cfa 10, 0
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
leaq -8(%r10), %rsp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L879:
.cfi_restore_state
movq (%r12), %rcx
leaq 8(%r11), %rdi
andq $-8, %rdi
movq %rcx, (%r11)
movl %r8d, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r11,%rcx)
movq %r11, %rcx
movq %r12, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L880
.p2align 4,,10
.p2align 3
.L875:
movq (%r11), %rcx
leaq 8(%rax), %rdi
andq $-8, %rdi
movq %rcx, (%rax)
movl %r8d, %ecx
movq -8(%r11,%rcx), %rsi
movq %rsi, -8(%rax,%rcx)
movq %rax, %rcx
movq %r11, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L876
.p2align 4,,10
.p2align 3
.L981:
subq %rsi, %r9
leaq 0(%r13,%rsi,8), %r11
leaq (%r12,%r8), %rsi
.L893:
movq $-1, %rdi
bzhi %r9, %rdi, %rdi
movzbl %dil, %edi
kmovd %edi, %k0
.L874:
vmovdqu64 (%r11), %zmm1
vpcmpq $6, %zmm0, %zmm1, %k1
kandnb %k0, %k1, %k2
vpcompressq %zmm1, (%rax){%k2}
kmovb %k2, %edi
kandb %k0, %k1, %k1
popcntq %rdi, %rdi
leaq (%rax,%rdi,8), %rax
kmovb %k1, %r8d
popcntq %r8, %r8
movq %rax, %r9
addq %rcx, %r8
movq %rdx, %rcx
movq %rdx, %rdi
subq %r13, %r9
subq %r8, %rcx
vpcompressq %zmm1, (%rsi){%k1}
salq $3, %r8
sarq $3, %r9
movq %rcx, %rdx
leaq 0(%r13,%rcx,8), %r11
subq %r9, %rdi
subq %r9, %rdx
movq %rdi, -144(%rbp)
leaq (%rax,%rdi,8), %rdi
leaq (%rax,%rdx,8), %r10
vmovq %rdi, %xmm17
jmp .L873
.p2align 4,,10
.p2align 3
.L983:
movzbl (%r12), %ecx
movb %cl, (%r11)
jmp .L880
.p2align 4,,10
.p2align 3
.L982:
movzbl (%r11), %ecx
movb %cl, (%rax)
jmp .L876
.p2align 4,,10
.p2align 3
.L869:
leaq -8(%r9), %rsi
leaq 1(%r9), %rdi
andq $-8, %rsi
leaq 0(,%rcx,8), %r8
addq $8, %rsi
cmpq $8, %rdi
movl $8, %edi
cmovbe %rdi, %rsi
cmpq %rsi, %r9
je .L871
subq %rsi, %r9
leaq 0(%r13,%rsi,8), %r11
leaq (%r12,%r8), %rsi
cmpq $255, %r9
jbe .L893
movl $255, %edi
kmovd %edi, %k0
jmp .L874
.p2align 4,,10
.p2align 3
.L977:
cmpq $1, %rdx
jbe .L972
leaq 1024(%rdi), %rax
cmpq %rax, %rsi
jb .L987
movl $8, %esi
call _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L972
.p2align 4,,10
.p2align 3
.L818:
vmovdqu64 0(%r13), %zmm6
movl $8, %esi
movq $-1, %rax
subq -144(%rbp), %rsi
bzhi %rsi, %rax, %rax
kmovb %eax, %k2
vpcmpq $4, %zmm5, %zmm6, %k0
kandb %k2, %k0, %k0
kmovb %k0, %eax
kortestb %k0, %k0
jne .L988
vpxor %xmm4, %xmm4, %xmm4
leaq 1024(%r13,%rsi,8), %rdi
vmovdqa64 %zmm4, %zmm3
.p2align 4,,10
.p2align 3
.L824:
movq %rsi, %rcx
subq $-128, %rsi
cmpq %rsi, %r15
jb .L828
leaq -1024(%rdi), %rax
.L823:
vpxord (%rax), %zmm2, %zmm0
vpxord 64(%rax), %zmm2, %zmm1
leaq 128(%rax), %rdx
vpord %zmm3, %zmm0, %zmm3
vpord %zmm4, %zmm1, %zmm4
vpxord 128(%rax), %zmm2, %zmm0
vpxord 192(%rax), %zmm2, %zmm1
vpord %zmm3, %zmm0, %zmm3
vpxord 256(%rax), %zmm2, %zmm0
vpord %zmm4, %zmm1, %zmm4
vpxord 320(%rax), %zmm2, %zmm1
leaq 384(%rdx), %rax
vpord %zmm3, %zmm0, %zmm3
vpxord 256(%rdx), %zmm2, %zmm0
vpord %zmm4, %zmm1, %zmm4
vpxord 320(%rdx), %zmm2, %zmm1
vpord %zmm3, %zmm0, %zmm0
vpord %zmm4, %zmm1, %zmm1
vmovdqa64 %zmm0, %zmm3
vmovdqa64 %zmm1, %zmm4
cmpq %rax, %rdi
jne .L823
vpord %zmm1, %zmm0, %zmm0
leaq 1408(%rdx), %rdi
vptestnmq %zmm0, %zmm0, %k0
kortestb %k0, %k0
setc %al
testb %al, %al
jne .L824
vmovdqa64 0(%r13,%rcx,8), %zmm6
vpcmpq $4, %zmm5, %zmm6, %k0
kortestb %k0, %k0
jne .L826
.p2align 4,,10
.p2align 3
.L825:
addq $8, %rcx
vmovdqa64 0(%r13,%rcx,8), %zmm6
vpcmpq $4, %zmm5, %zmm6, %k0
kortestb %k0, %k0
je .L825
.L826:
kmovb %k0, %eax
tzcntl %eax, %eax
addq %rcx, %rax
.L822:
vpbroadcastq 0(%r13,%rax,8), %zmm1
leaq 0(%r13,%rax,8), %rdi
vpcmpq $6, %zmm5, %zmm1, %k0
kortestb %k0, %k0
jne .L831
leaq -8(%r15), %rax
xorl %ecx, %ecx
jmp .L837
.p2align 4,,10
.p2align 3
.L832:
kmovb %k0, %edx
popcntq %rdx, %rdx
addq %rdx, %rcx
leaq -8(%rax), %rdx
vmovdqu64 %zmm5, 0(%r13,%rax,8)
cmpq %rdx, %r15
jbe .L989
movq %rdx, %rax
.L837:
vmovdqu64 0(%r13,%rax,8), %zmm6
vpcmpq $0, %zmm1, %zmm6, %k1
vpcmpq $0, %zmm5, %zmm6, %k0
kmovb %k1, %edx
kmovb %k0, %esi
korb %k0, %k1, %k1
kortestb %k1, %k1
jc .L832
kmovb %edx, %k2
kmovb %esi, %k3
kxnorb %k3, %k2, %k2
kmovb %k2, %edx
tzcntl %edx, %edx
leaq 8(%rax), %rsi
addq %rax, %rdx
addq $16, %rax
vpbroadcastq 0(%r13,%rdx,8), %zmm2
movq %r15, %rdx
subq %rcx, %rdx
vmovdqa64 %zmm2, -112(%rbp)
cmpq %rdx, %rax
ja .L833
.p2align 4,,10
.p2align 3
.L834:
vmovdqu64 %zmm1, -64(%r13,%rax,8)
movq %rax, %rsi
addq $8, %rax
cmpq %rax, %rdx
jnb .L834
.L833:
subq %rsi, %rdx
leaq 0(%r13,%rsi,8), %rcx
movl $255, %eax
cmpq $255, %rdx
ja .L835
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzbl %al, %eax
.L835:
kmovb %eax, %k3
vmovdqu64 %zmm1, (%rcx){%k3}
.L836:
vpbroadcastq (%r12), %zmm0
vpcmpq $0, .LC8(%rip), %zmm0, %k0
kortestb %k0, %k0
jc .L916
vpcmpq $0, .LC7(%rip), %zmm0, %k0
kortestb %k0, %k0
jc .L854
vpminsq %zmm2, %zmm1, %zmm3
vpcmpq $6, %zmm3, %zmm0, %k0
kortestb %k0, %k0
jne .L990
vmovdqa64 %zmm0, %zmm1
movl $128, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L849:
leaq (%rcx,%rax,8), %rdx
addq $1, %rax
vpminsq 0(%r13,%rdx,8), %zmm1, %zmm1
cmpq $16, %rax
jne .L849
vpcmpq $6, %zmm1, %zmm0, %k0
kortestb %k0, %k0
jne .L976
leaq 128(%rsi), %rax
cmpq %rax, %r15
jb .L856
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L849
.p2align 4,,10
.p2align 3
.L828:
movq %rcx, %rdx
addq $8, %rcx
cmpq %rcx, %r15
jb .L991
vmovdqa64 -64(%r13,%rcx,8), %zmm6
vpcmpq $4, %zmm5, %zmm6, %k0
kmovb %k0, %eax
kortestb %k0, %k0
je .L828
.L974:
tzcntl %eax, %eax
addq %rdx, %rax
jmp .L822
.p2align 4,,10
.p2align 3
.L868:
movq %r12, %rsi
movq %r13, %r11
movq %r13, %rax
testq %r9, %r9
jne .L893
movq %rdx, -144(%rbp)
vmovq %r10, %xmm17
jmp .L894
.p2align 4,,10
.p2align 3
.L986:
vzeroupper
jmp .L890
.p2align 4,,10
.p2align 3
.L930:
movq -144(%rbp), %rsi
movq %rax, %rcx
jmp .L883
.p2align 4,,10
.p2align 3
.L931:
vmovdqa64 .LC9(%rip), %zmm5
movq %rax, %r10
movq %rdx, %r8
movl $8, %ecx
leaq _ZZN3hwy6N_AVX3L11CompressNotIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array(%rip), %r14
jmp .L884
.L980:
leaq -1(%r15), %rbx
movq %rbx, %r12
shrq %r12
.p2align 4,,10
.p2align 3
.L866:
movq %r12, %rdx
movq %r15, %rsi
movq %r13, %rdi
call _ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %r12
jnb .L866
.p2align 4,,10
.p2align 3
.L867:
movq 0(%r13,%rbx,8), %rdx
movq 0(%r13), %rax
movq %rbx, %rsi
movq %r13, %rdi
movq %rdx, 0(%r13)
xorl %edx, %edx
movq %rax, 0(%r13,%rbx,8)
call _ZN3hwy6N_AVX36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L867
jmp .L972
.p2align 4,,10
.p2align 3
.L857:
vpcmpq $6, -64(%r13,%rsi,8), %zmm0, %k0
kortestb %k0, %k0
jne .L976
.L856:
movq %rsi, %rax
addq $8, %rsi
cmpq %rsi, %r15
jnb .L857
cmpq %rax, %r15
je .L916
vpcmpq $6, -64(%r13,%r15,8), %zmm0, %k0
xorl %eax, %eax
kortestb %k0, %k0
sete %al
addl $1, %eax
movl %eax, -136(%rbp)
jmp .L858
.L918:
movl $12, %eax
movl $11, %esi
jmp .L864
.p2align 4,,10
.p2align 3
.L865:
cmpq $23, %rax
je .L975
.L864:
movq %rax, %rcx
addq $1, %rax
cmpq (%r12,%rax,8), %rdx
je .L865
movl $12, %edi
subq $11, %rcx
movq %rdx, %rax
subq %rsi, %rdi
cmpq %rdi, %rcx
jb .L863
.L975:
movq (%r12,%rsi,8), %rax
jmp .L863
.L919:
movl $9, %esi
movl $10, %eax
jmp .L864
.L920:
movl $8, %esi
movl $9, %eax
jmp .L864
.L921:
movl $7, %esi
movl $8, %eax
jmp .L864
.L922:
movl $6, %esi
movl $7, %eax
jmp .L864
.L923:
movl $5, %esi
movl $6, %eax
jmp .L864
.L831:
movq %r15, %rsi
leaq -112(%rbp), %rdx
vmovdqa64 %zmm5, %zmm0
movq %r12, %rcx
subq %rax, %rsi
call _ZN3hwy6N_AVX36detail22MaybePartitionTwoValueINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L972
vmovdqa64 -112(%rbp), %zmm2
jmp .L836
.L924:
movl $4, %esi
movl $5, %eax
jmp .L864
.L925:
movl $3, %esi
movl $4, %eax
jmp .L864
.L926:
movl $2, %esi
movl $3, %eax
jmp .L864
.L927:
movl $1, %esi
movl $2, %eax
jmp .L864
.L979:
xorl %esi, %esi
movl $1, %eax
jmp .L864
.L989:
movl $255, %edi
vmovdqu64 0(%r13), %zmm0
kmovd %edi, %k2
cmpq $255, %rax
ja .L838
movq $-1, %rdx
bzhi %rax, %rdx, %rdx
movzbl %dl, %edi
kmovd %edi, %k2
.L838:
vpcmpq $0, %zmm1, %zmm0, %k0
vpcmpq $0, %zmm5, %zmm0, %k1
movq %r15, %rsi
kandb %k2, %k1, %k1
knotb %k2, %k2
korb %k1, %k0, %k0
korb %k2, %k0, %k0
kortestb %k0, %k0
setc %dl
subq %rcx, %rsi
testb %dl, %dl
je .L992
kmovb %k1, %eax
popcntq %rax, %rax
subq %rax, %rsi
vmovdqu64 %zmm5, 0(%r13)
movq %rsi, %rdx
cmpq $7, %rsi
jbe .L843
leaq -8(%rsi), %rcx
movq -152(%rbp), %rsi
movq %rcx, %rax
shrq $3, %rax
salq $6, %rax
leaq 64(%r13,%rax), %rax
.p2align 4,,10
.p2align 3
.L844:
vmovdqu64 %zmm1, (%rsi)
addq $64, %rsi
cmpq %rax, %rsi
jne .L844
andq $-8, %rcx
vmovdqa64 %zmm1, (%r12)
leaq 8(%rcx), %rax
leaq 0(%r13,%rax,8), %r13
subq %rax, %rdx
movl $255, %eax
kmovd %eax, %k1
cmpq $255, %rdx
jbe .L895
.L845:
vmovdqu64 (%r12), %zmm0{%k1}{z}
vmovdqu64 %zmm0, 0(%r13){%k1}
vzeroupper
jmp .L972
.L861:
movl $11, %eax
movl $10, %esi
jmp .L864
.L991:
leaq -8(%r15), %rdx
vmovdqu64 0(%r13,%rdx,8), %zmm6
vpcmpq $4, %zmm5, %zmm6, %k0
kmovb %k0, %eax
kortestb %k0, %k0
jne .L974
vzeroupper
jmp .L972
.L853:
vmovdqu64 -64(%r13,%rsi,8), %zmm6
vpcmpq $6, %zmm0, %zmm6, %k0
kortestb %k0, %k0
jne .L976
.L852:
movq %rsi, %rax
addq $8, %rsi
cmpq %rsi, %r15
jnb .L853
cmpq %rax, %r15
je .L854
vmovdqu64 -64(%r13,%r15,8), %zmm6
vpcmpq $6, %zmm0, %zmm6, %k0
kortestb %k0, %k0
jne .L976
.L854:
movl $3, -136(%rbp)
vpternlogd $0xFF, %zmm1, %zmm1, %zmm1
vpaddq %zmm1, %zmm0, %zmm0
jmp .L858
.L988:
tzcntl %eax, %eax
jmp .L822
.L987:
movq %rdi, %rcx
movq %r12, %rdi
cmpq $7, %rdx
jbe .L809
leaq -8(%rdx), %rdx
movq 0(%r13), %rcx
leaq 8(%r12), %rdi
movq %rdx, %rax
andq $-8, %rdi
shrq $3, %rax
movq %rcx, (%r12)
addq $1, %rax
salq $6, %rax
movl %eax, %ecx
movq -8(%r13,%rcx), %rsi
movq %rsi, -8(%r12,%rcx)
movq %r12, %rcx
movq %r13, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
movq %r15, %rdx
andq $-8, %rax
shrl $3, %ecx
rep movsq
addq $8, %rax
leaq 0(,%rax,8), %rcx
subq %rax, %rdx
movl $255, %eax
leaq (%r12,%rcx), %rdi
addq %r13, %rcx
cmpq $255, %rdx
jbe .L809
.L810:
leal -1(%r15), %edx
movl $32, %r8d
movl $1, %esi
kmovb %eax, %k4
bsrl %edx, %edx
vmovdqu64 (%rcx), %zmm0{%k4}{z}
movq %r15, %rax
xorl $31, %edx
subl %edx, %r8d
movl $1, %edx
vmovdqu64 %zmm0, (%rdi){%k4}
vpbroadcastq .LC10(%rip), %zmm0
shlx %r8, %rsi, %rsi
shrq $4, %rsi
cmove %rdx, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $8, %rdx
cmpq %rdx, %r15
jnb .L814
.p2align 4,,10
.p2align 3
.L811:
vmovdqu64 %zmm0, (%r12,%rax,8)
addq $8, %rax
cmpq %rdx, %rax
jb .L811
.L814:
movq %r12, %rdi
vzeroupper
call _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
cmpq $7, %r15
jbe .L813
leaq -8(%r15), %rdx
movq (%r12), %rcx
leaq 8(%r13), %rdi
movq %rdx, %rax
andq $-8, %rdi
shrq $3, %rax
movq %rcx, 0(%r13)
addq $1, %rax
salq $6, %rax
movl %eax, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %r12, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-8, %rax
shrl $3, %ecx
rep movsq
addq $8, %rax
leaq 0(,%rax,8), %rdx
subq %rax, %r15
movl $255, %eax
addq %rdx, %r13
addq %rdx, %r12
cmpq $255, %r15
jbe .L813
.L815:
kmovb %eax, %k6
vmovdqu64 (%r12), %zmm0{%k6}{z}
vmovdqu64 %zmm0, 0(%r13){%k6}
vzeroupper
jmp .L972
.L843:
vmovdqa64 %zmm1, (%r12)
.L895:
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzbl %al, %eax
kmovd %eax, %k1
jmp .L845
.L916:
movl $2, -136(%rbp)
jmp .L858
.L990:
vpmaxsq %zmm2, %zmm1, %zmm1
vpcmpq $6, %zmm0, %zmm1, %k0
kortestb %k0, %k0
jne .L976
vmovdqa64 %zmm0, %zmm1
movl $128, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L850:
leaq (%rcx,%rax,8), %rdx
addq $1, %rax
vpmaxsq 0(%r13,%rdx,8), %zmm1, %zmm1
cmpq $16, %rax
jne .L850
vpcmpq $6, %zmm0, %zmm1, %k0
kortestb %k0, %k0
jne .L976
leaq 128(%rsi), %rax
cmpq %rax, %r15
jb .L852
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L850
.L813:
movq $-1, %rax
bzhi %r15, %rax, %rax
movzbl %al, %eax
jmp .L815
.L809:
movq $-1, %rax
bzhi %rdx, %rax, %rax
movzbl %al, %eax
jmp .L810
.L992:
knotb %k0, %k2
kmovb %k2, %edx
tzcntl %edx, %edx
vpbroadcastq 0(%r13,%rdx,8), %zmm2
leaq 8(%rax), %rdx
vmovdqa64 %zmm2, -112(%rbp)
cmpq %rsi, %rdx
ja .L840
.L841:
vmovdqu64 %zmm1, -64(%r13,%rdx,8)
movq %rdx, %rax
addq $8, %rdx
cmpq %rsi, %rdx
jbe .L841
.L840:
subq %rax, %rsi
leaq 0(%r13,%rax,8), %rcx
movl $-1, %eax
cmpq $255, %rsi
ja .L842
orq $-1, %rax
bzhi %rsi, %rax, %rax
.L842:
kmovb %eax, %k4
vmovdqu64 %zmm1, (%rcx){%k4}
jmp .L836
.cfi_endproc
.LFE18801:
.size _ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18803:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rdi, %r10
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
pushq %r13
pushq %r12
.cfi_offset 15, -24
.cfi_offset 14, -32
.cfi_offset 13, -40
.cfi_offset 12, -48
movq %rcx, %r12
pushq %rbx
subq $104, %rsp
.cfi_offset 3, -56
movq %rsi, -88(%rbp)
movq %rdx, -72(%rbp)
movq %r9, -80(%rbp)
cmpq $32, %rdx
jbe .L1219
movq %rdi, %rax
movq %rdi, -128(%rbp)
movq %r8, %rbx
shrq $3, %rax
movq %rax, %rdx
movq %rax, -112(%rbp)
andl $7, %edx
jne .L1220
movq -72(%rbp), %r14
movq %rdi, %rax
.L1005:
movq 8(%rbx), %rdx
movq 16(%rbx), %r11
movq %rdx, %rcx
leaq (%rdx,%rdx,8), %rsi
leaq 1(%r11), %r8
movq %rdx, %rdi
rolq $24, %rcx
xorq (%rbx), %r8
shrq $11, %rdi
leaq 2(%r11), %rdx
addq %r8, %rcx
xorq %rsi, %rdi
xorq %rdx, %rdi
movq %rcx, %rdx
leaq (%rcx,%rcx,8), %rsi
shrq $11, %rcx
rolq $24, %rdx
xorq %rsi, %rcx
leaq 3(%r11), %rsi
addq %rdi, %rdx
xorq %rsi, %rcx
movq %rdx, %rsi
leaq (%rdx,%rdx,8), %r9
shrq $11, %rdx
rolq $24, %rsi
xorq %r9, %rdx
leaq 4(%r11), %r9
addq $5, %r11
addq %rcx, %rsi
xorq %r9, %rdx
movq %r11, 16(%rbx)
movq %rsi, %r9
leaq (%rsi,%rsi,8), %r13
shrq $11, %rsi
rolq $24, %r9
xorq %r13, %rsi
addq %rdx, %r9
xorq %r11, %rsi
movabsq $34359738359, %r11
movq %r9, %r15
leaq (%r9,%r9,8), %r13
rolq $24, %r9
shrq $11, %r15
addq %rsi, %r9
movl %esi, %esi
xorq %r15, %r13
movl %edx, %r15d
movq %r13, %xmm0
movl %r8d, %r13d
pinsrq $1, %r9, %xmm0
movq %r14, %r9
shrq $3, %r9
cmpq %r11, %r14
movl $4294967295, %r11d
movl %ecx, %r14d
cmova %r11, %r9
shrq $32, %r8
movl %edi, %r11d
movups %xmm0, (%rbx)
shrq $32, %rdi
imulq %r9, %r13
shrq $32, %rcx
shrq $32, %rdx
imulq %r9, %r8
imulq %r9, %r11
shrq $32, %r13
imulq %r9, %rdi
imulq %r9, %r14
shrq $32, %r8
imulq %r9, %rcx
shrq $32, %r11
imulq %r9, %r15
shrq $32, %rdi
imulq %r9, %rdx
shrq $32, %r14
imulq %r9, %rsi
movq %r13, %r9
shrq $32, %rcx
leaq 2(,%r13,8), %r13
salq $6, %r9
shrq $32, %r15
movdqa (%rax,%r9), %xmm4
movq %r8, %r9
shrq $32, %rdx
salq $6, %r9
shrq $32, %rsi
movdqa (%rax,%r9), %xmm3
movq %r11, %r9
salq $6, %r9
movdqa (%rax,%r9), %xmm2
movq %rdi, %r9
salq $6, %r9
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm1
movdqa (%rax,%r9), %xmm11
movq %r14, %r9
pcmpgtq %xmm4, %xmm0
salq $6, %r9
leaq 2(,%r14,8), %r14
pblendvb %xmm0, %xmm4, %xmm1
pblendvb %xmm0, %xmm2, %xmm4
movdqa %xmm3, %xmm0
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm3, %xmm1
movdqa (%rax,%r9), %xmm3
movdqa %xmm4, %xmm0
movq %rcx, %r9
pcmpgtq %xmm1, %xmm0
salq $6, %r9
movdqa (%rax,%r9), %xmm2
movq %r15, %r9
leaq 2(,%r15,8), %r15
salq $6, %r9
movdqa (%rax,%r15,8), %xmm6
pblendvb %xmm0, %xmm1, %xmm4
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm1
movdqa (%rax,%r9), %xmm7
pcmpgtq %xmm11, %xmm0
movq %rdx, %r9
movaps %xmm4, (%r12)
leaq 2(,%rdx,8), %rdx
salq $6, %r9
pblendvb %xmm0, %xmm11, %xmm1
pblendvb %xmm0, %xmm2, %xmm11
movdqa %xmm3, %xmm0
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm3, %xmm1
movdqa (%rax,%r9), %xmm3
movdqa %xmm11, %xmm0
movq %rsi, %r9
pcmpgtq %xmm1, %xmm0
salq $6, %r9
leaq 2(,%rsi,8), %rsi
movdqa (%rax,%r9), %xmm2
leaq 0(,%r13,8), %r9
movdqa 16(%rax,%r9), %xmm13
pblendvb %xmm0, %xmm1, %xmm11
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm1
pcmpgtq %xmm7, %xmm0
movaps %xmm11, 64(%r12)
pblendvb %xmm0, %xmm7, %xmm1
pblendvb %xmm0, %xmm2, %xmm7
movdqa %xmm3, %xmm0
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm3, %xmm1
movdqa (%rax,%r13,8), %xmm3
movdqa %xmm7, %xmm0
leaq 2(,%r8,8), %r13
movdqa (%rax,%r13,8), %xmm5
leaq 0(,%r13,8), %r8
pcmpgtq %xmm1, %xmm0
leaq 2(,%r11,8), %r13
movdqa (%rax,%r13,8), %xmm2
leaq 0(,%r13,8), %r11
leaq 2(,%rdi,8), %r13
movdqa (%rax,%r13,8), %xmm10
leaq 0(,%r13,8), %rdi
leaq 0(,%r14,8), %r13
pblendvb %xmm0, %xmm1, %xmm7
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm1
movaps %xmm7, 128(%r12)
pcmpgtq %xmm3, %xmm0
pblendvb %xmm0, %xmm3, %xmm1
pblendvb %xmm0, %xmm2, %xmm3
movdqa %xmm5, %xmm0
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm5, %xmm1
movdqa %xmm3, %xmm0
movdqa (%rax,%r14,8), %xmm5
leaq 2(,%rcx,8), %r14
pcmpgtq %xmm1, %xmm0
movdqa (%rax,%r14,8), %xmm2
leaq 0(,%r14,8), %rcx
leaq 0(,%r15,8), %r14
leaq 0(,%rdx,8), %r15
pblendvb %xmm0, %xmm1, %xmm3
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm1
pcmpgtq %xmm10, %xmm0
movaps %xmm3, 16(%r12)
pblendvb %xmm0, %xmm10, %xmm1
pblendvb %xmm0, %xmm2, %xmm10
movdqa %xmm5, %xmm0
movdqa (%rax,%rsi,8), %xmm2
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm5, %xmm1
movdqa %xmm10, %xmm0
movdqa (%rax,%rdx,8), %xmm5
leaq 0(,%rsi,8), %rdx
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm1, %xmm10
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm1
pcmpgtq %xmm6, %xmm0
movaps %xmm10, 80(%r12)
pblendvb %xmm0, %xmm6, %xmm1
pblendvb %xmm0, %xmm2, %xmm6
movdqa %xmm5, %xmm0
movdqa 16(%rax,%r11), %xmm2
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm5, %xmm1
movdqa %xmm6, %xmm0
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm1, %xmm6
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm1
movaps %xmm6, 144(%r12)
pcmpgtq %xmm13, %xmm0
pblendvb %xmm0, %xmm13, %xmm1
pblendvb %xmm0, %xmm2, %xmm13
movdqa 16(%rax,%r8), %xmm0
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, 16(%rax,%r8), %xmm1
movdqa %xmm13, %xmm0
movdqa 16(%rax,%rcx), %xmm2
movdqa 16(%rax,%rdi), %xmm9
pcmpgtq %xmm1, %xmm0
movdqa 16(%rax,%r14), %xmm5
movdqa 32(%rax,%r9), %xmm12
movdqa 32(%rax,%r8), %xmm8
movdqa 32(%rax,%rcx), %xmm14
movdqa 32(%rax,%r15), %xmm15
pblendvb %xmm0, %xmm1, %xmm13
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm1
pcmpgtq %xmm9, %xmm0
movaps %xmm13, 32(%r12)
pblendvb %xmm0, %xmm9, %xmm1
pblendvb %xmm0, %xmm2, %xmm9
movdqa 16(%rax,%r13), %xmm0
movdqa 16(%rax,%rdx), %xmm2
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, 16(%rax,%r13), %xmm1
movdqa %xmm9, %xmm0
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm1, %xmm9
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm1
pcmpgtq %xmm5, %xmm0
movaps %xmm9, 96(%r12)
pblendvb %xmm0, %xmm5, %xmm1
pblendvb %xmm0, %xmm2, %xmm5
movdqa 16(%rax,%r15), %xmm0
movdqa 32(%rax,%r11), %xmm2
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, 16(%rax,%r15), %xmm1
movdqa %xmm5, %xmm0
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm1, %xmm5
movdqa %xmm2, %xmm0
movdqa %xmm2, %xmm1
movaps %xmm5, 160(%r12)
pcmpgtq %xmm12, %xmm0
pblendvb %xmm0, %xmm12, %xmm1
pblendvb %xmm0, %xmm2, %xmm12
movdqa %xmm8, %xmm0
movdqa 32(%rax,%r13), %xmm2
pcmpgtq %xmm1, %xmm0
leaq 192(%r12), %r13
pblendvb %xmm0, %xmm8, %xmm1
movdqa %xmm12, %xmm0
movdqa 32(%rax,%rdi), %xmm8
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm1, %xmm12
movdqa %xmm14, %xmm0
movdqa %xmm14, %xmm1
pcmpgtq %xmm8, %xmm0
movaps %xmm12, 48(%r12)
pblendvb %xmm0, %xmm8, %xmm1
pblendvb %xmm0, %xmm14, %xmm8
movdqa %xmm2, %xmm0
movdqa 32(%rax,%rdx), %xmm14
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm2, %xmm1
movdqa %xmm8, %xmm0
movdqa %xmm14, %xmm2
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm1, %xmm8
movdqa 32(%rax,%r14), %xmm1
movdqa %xmm14, %xmm0
movaps %xmm8, 112(%r12)
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm1, %xmm2
pblendvb %xmm0, %xmm14, %xmm1
movdqa %xmm15, %xmm0
pcmpgtq %xmm2, %xmm0
pblendvb %xmm0, %xmm15, %xmm2
movdqa %xmm1, %xmm0
pcmpgtq %xmm2, %xmm0
pblendvb %xmm0, %xmm2, %xmm1
movdqa %xmm4, %xmm2
punpcklqdq %xmm2, %xmm2
movdqa %xmm1, %xmm0
movaps %xmm1, 176(%r12)
movdqa %xmm3, %xmm1
pxor %xmm2, %xmm1
pxor %xmm2, %xmm4
pxor %xmm2, %xmm13
movdqa 192(%r12), %xmm3
por %xmm4, %xmm1
pxor %xmm2, %xmm12
pxor %xmm2, %xmm11
por %xmm13, %xmm1
pxor %xmm2, %xmm10
pxor %xmm2, %xmm9
por %xmm12, %xmm1
pxor %xmm2, %xmm8
pxor %xmm2, %xmm7
por %xmm11, %xmm1
pxor %xmm2, %xmm6
pxor %xmm2, %xmm5
por %xmm10, %xmm1
pxor %xmm2, %xmm0
pxor %xmm2, %xmm3
por %xmm9, %xmm1
por %xmm8, %xmm1
por %xmm7, %xmm1
por %xmm6, %xmm1
por %xmm5, %xmm1
por %xmm0, %xmm1
pxor %xmm0, %xmm0
por %xmm1, %xmm3
pblendvb %xmm0, %xmm3, %xmm1
pxor %xmm0, %xmm0
pcmpeqq %xmm0, %xmm1
movmskpd %xmm1, %eax
cmpl $3, %eax
je .L1007
movdqa .LC4(%rip), %xmm0
movl $2, %esi
movq %r12, %rdi
movq %r10, -112(%rbp)
movups %xmm0, 192(%r12)
movups %xmm0, 208(%r12)
movups %xmm0, 224(%r12)
movups %xmm0, 240(%r12)
movups %xmm0, 256(%r12)
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
pcmpeqd %xmm0, %xmm0
movddup (%r12), %xmm2
movddup 184(%r12), %xmm1
paddq %xmm1, %xmm0
movq -112(%rbp), %r10
pcmpeqq %xmm2, %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
jne .L1009
movq -72(%rbp), %rsi
movq %r10, %rdi
leaq -64(%rbp), %rdx
movq %r13, %rcx
movdqa %xmm2, %xmm0
movq %r10, -112(%rbp)
call _ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
movq -112(%rbp), %r10
testb %al, %al
jne .L993
.L1009:
movq 96(%r12), %rdx
cmpq %rdx, 88(%r12)
jne .L1105
cmpq 80(%r12), %rdx
jne .L1048
cmpq 72(%r12), %rdx
jne .L1106
cmpq 64(%r12), %rdx
jne .L1107
cmpq 56(%r12), %rdx
jne .L1108
cmpq 48(%r12), %rdx
jne .L1109
cmpq 40(%r12), %rdx
jne .L1110
cmpq 32(%r12), %rdx
jne .L1111
cmpq 24(%r12), %rdx
jne .L1112
cmpq 16(%r12), %rdx
jne .L1113
cmpq 8(%r12), %rdx
jne .L1114
movq (%r12), %rax
cmpq %rax, %rdx
jne .L1221
.L1050:
movq %rax, %xmm2
punpcklqdq %xmm2, %xmm2
.L1217:
movl $1, -112(%rbp)
.L1046:
cmpq $0, -80(%rbp)
je .L1222
movq -72(%rbp), %rax
leaq -2(%rax), %r9
movq %r9, %rdx
movq %r9, %rsi
movdqu (%r10,%r9,8), %xmm15
andl $7, %edx
andl $6, %esi
je .L1116
movdqu (%r10), %xmm1
pcmpeqd %xmm0, %xmm0
xorl %ecx, %ecx
movdqa .LC0(%rip), %xmm8
leaq _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %r13
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm4
pcmpgtq %xmm2, %xmm3
pxor %xmm3, %xmm0
movmskpd %xmm0, %eax
popcntq %rax, %rcx
movq %rcx, %xmm7
salq $4, %rax
movddup %xmm7, %xmm0
pshufb 0(%r13,%rax), %xmm4
pcmpgtq %xmm8, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L1056
movq %xmm4, (%r10)
.L1056:
pextrq $1, %xmm0, %rax
testq %rax, %rax
je .L1057
pextrq $1, %xmm4, 8(%r10)
.L1057:
movmskpd %xmm3, %esi
leaq (%r10,%rcx,8), %rax
xorl %ecx, %ecx
popcntq %rsi, %rcx
salq $4, %rsi
pshufb 0(%r13,%rsi), %xmm1
movups %xmm1, (%r12)
testb $4, %r9b
je .L1058
movdqu 16(%r10), %xmm1
pcmpeqd %xmm0, %xmm0
xorl %edi, %edi
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm4
pcmpgtq %xmm2, %xmm3
pxor %xmm3, %xmm0
movmskpd %xmm0, %esi
popcntq %rsi, %rdi
movq %rdi, %xmm7
salq $4, %rsi
movddup %xmm7, %xmm0
pshufb 0(%r13,%rsi), %xmm4
pcmpgtq %xmm8, %xmm0
movq %xmm0, %rsi
testq %rsi, %rsi
je .L1059
movq %xmm4, (%rax)
.L1059:
pextrq $1, %xmm0, %rsi
testq %rsi, %rsi
je .L1060
pextrq $1, %xmm4, 8(%rax)
.L1060:
movmskpd %xmm3, %esi
leaq (%rax,%rdi,8), %rax
movq %rsi, %rdi
popcntq %rsi, %rsi
salq $4, %rdi
pshufb 0(%r13,%rdi), %xmm1
movups %xmm1, (%r12,%rcx,8)
addq %rsi, %rcx
cmpq $5, %rdx
jbe .L1058
movdqu 32(%r10), %xmm1
pcmpeqd %xmm0, %xmm0
xorl %edi, %edi
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm4
pcmpgtq %xmm2, %xmm3
pxor %xmm3, %xmm0
movmskpd %xmm0, %esi
popcntq %rsi, %rdi
movq %rdi, %xmm7
salq $4, %rsi
movddup %xmm7, %xmm0
pshufb 0(%r13,%rsi), %xmm4
pcmpgtq %xmm8, %xmm0
movq %xmm0, %rsi
testq %rsi, %rsi
je .L1061
movq %xmm4, (%rax)
.L1061:
pextrq $1, %xmm0, %rsi
testq %rsi, %rsi
je .L1062
pextrq $1, %xmm4, 8(%rax)
.L1062:
movmskpd %xmm3, %esi
leaq (%rax,%rdi,8), %rax
movq %rsi, %rdi
popcntq %rsi, %rsi
salq $4, %rdi
pshufb 0(%r13,%rdi), %xmm1
movups %xmm1, (%r12,%rcx,8)
addq %rsi, %rcx
.L1058:
leaq -2(%rdx), %rsi
leaq 1(%rdx), %rdi
andq $-2, %rsi
leaq 0(,%rcx,8), %r8
addq $2, %rsi
cmpq $2, %rdi
movl $2, %edi
cmovbe %rdi, %rsi
.L1055:
cmpq %rsi, %rdx
je .L1063
movdqu (%r10,%rsi,8), %xmm3
subq %rsi, %rdx
xorl %esi, %esi
movq %rdx, %xmm0
movdqa %xmm3, %xmm4
punpcklqdq %xmm0, %xmm0
movdqa %xmm3, %xmm5
pcmpgtq %xmm2, %xmm4
pcmpgtq %xmm8, %xmm0
movdqa %xmm4, %xmm1
pandn %xmm0, %xmm1
movmskpd %xmm1, %edx
popcntq %rdx, %rsi
movq %rsi, %xmm7
salq $4, %rdx
movddup %xmm7, %xmm1
pshufb 0(%r13,%rdx), %xmm5
pcmpgtq %xmm8, %xmm1
movq %xmm1, %rdx
testq %rdx, %rdx
je .L1064
movq %xmm5, (%rax)
.L1064:
pextrq $1, %xmm1, %rdx
testq %rdx, %rdx
je .L1065
pextrq $1, %xmm5, 8(%rax)
.L1065:
pand %xmm0, %xmm4
leaq (%rax,%rsi,8), %rax
movmskpd %xmm4, %edx
movq %rdx, %rsi
popcntq %rdx, %rdx
addq %rdx, %rcx
salq $4, %rsi
pshufb 0(%r13,%rsi), %xmm3
movups %xmm3, (%r12,%r8)
leaq 0(,%rcx,8), %r8
.L1063:
movq %r9, %rdx
subq %rcx, %rdx
leaq (%r10,%rdx,8), %r11
cmpl $8, %r8d
jnb .L1066
testl %r8d, %r8d
jne .L1223
.L1067:
cmpl $8, %r8d
jnb .L1070
testl %r8d, %r8d
jne .L1224
.L1071:
movq %rax, %rcx
movq %r9, %r14
subq %r10, %rcx
sarq $3, %rcx
subq %rcx, %r14
subq %rcx, %rdx
movq %rcx, %r15
leaq (%rax,%rdx,8), %rcx
je .L1117
movdqu -32(%rcx), %xmm7
leaq 64(%rax), %rsi
leaq -64(%rcx), %rdi
movdqu (%rax), %xmm14
movdqu 16(%rax), %xmm13
movdqu 32(%rax), %xmm12
movaps %xmm7, -128(%rbp)
movdqu -16(%rcx), %xmm7
movdqu 48(%rax), %xmm11
movdqu -64(%rcx), %xmm10
movdqu -48(%rcx), %xmm9
movaps %xmm7, -144(%rbp)
cmpq %rdi, %rsi
je .L1118
xorl %ecx, %ecx
movl $2, %r8d
jmp .L1078
.p2align 4,,10
.p2align 3
.L1226:
movdqu -64(%rdi), %xmm5
movdqu -48(%rdi), %xmm4
prefetcht0 -256(%rdi)
subq $64, %rdi
movdqu 32(%rdi), %xmm3
movdqu 48(%rdi), %xmm1
.L1077:
movdqa %xmm5, %xmm6
leaq -2(%rdx,%rcx), %r11
pcmpgtq %xmm2, %xmm6
movdqa %xmm6, %xmm7
movdqa %xmm6, %xmm0
movmskpd %xmm6, %r9d
punpcklqdq %xmm6, %xmm7
punpckhqdq %xmm6, %xmm0
popcntq %r9, %r9
pandn %xmm7, %xmm0
pshufd $78, %xmm5, %xmm7
pblendvb %xmm0, %xmm7, %xmm5
movups %xmm5, (%rax,%rcx,8)
addq $2, %rcx
movups %xmm5, (%rax,%r11,8)
movdqa %xmm4, %xmm5
subq %r9, %rcx
pcmpgtq %xmm2, %xmm5
leaq -4(%rdx,%rcx), %r11
movdqa %xmm5, %xmm6
movdqa %xmm5, %xmm0
movmskpd %xmm5, %r9d
punpcklqdq %xmm5, %xmm6
punpckhqdq %xmm5, %xmm0
popcntq %r9, %r9
pandn %xmm6, %xmm0
pshufd $78, %xmm4, %xmm6
pblendvb %xmm0, %xmm6, %xmm4
movups %xmm4, (%rax,%rcx,8)
movups %xmm4, (%rax,%r11,8)
movdqa %xmm3, %xmm4
movq %r8, %r11
pcmpgtq %xmm2, %xmm4
subq %r9, %r11
addq %r11, %rcx
leaq -6(%rdx,%rcx), %r9
subq $8, %rdx
movdqa %xmm4, %xmm5
movdqa %xmm4, %xmm0
movmskpd %xmm4, %r11d
punpcklqdq %xmm4, %xmm5
punpckhqdq %xmm4, %xmm0
popcntq %r11, %r11
pandn %xmm5, %xmm0
pshufd $78, %xmm3, %xmm5
pblendvb %xmm0, %xmm5, %xmm3
movups %xmm3, (%rax,%rcx,8)
movups %xmm3, (%rax,%r9,8)
movdqa %xmm1, %xmm3
movq %r8, %r9
pcmpgtq %xmm2, %xmm3
subq %r11, %r9
addq %rcx, %r9
leaq (%r9,%rdx), %rcx
movdqa %xmm3, %xmm4
movdqa %xmm3, %xmm0
movmskpd %xmm3, %r11d
punpcklqdq %xmm3, %xmm4
punpckhqdq %xmm3, %xmm0
popcntq %r11, %r11
pandn %xmm4, %xmm0
pshufd $78, %xmm1, %xmm4
pblendvb %xmm0, %xmm4, %xmm1
movups %xmm1, (%rax,%r9,8)
movups %xmm1, (%rax,%rcx,8)
movq %r8, %rcx
subq %r11, %rcx
addq %r9, %rcx
cmpq %rdi, %rsi
je .L1225
.L1078:
movq %rsi, %r9
subq %rax, %r9
sarq $3, %r9
subq %rcx, %r9
cmpq $8, %r9
ja .L1226
movdqu (%rsi), %xmm5
movdqu 16(%rsi), %xmm4
prefetcht0 256(%rsi)
addq $64, %rsi
movdqu -32(%rsi), %xmm3
movdqu -16(%rsi), %xmm1
jmp .L1077
.p2align 4,,10
.p2align 3
.L1220:
movl $8, %eax
subq %rdx, %rax
leaq (%rdi,%rax,8), %rax
movq -72(%rbp), %rdi
leaq -8(%rdx,%rdi), %r14
jmp .L1005
.p2align 4,,10
.p2align 3
.L1225:
leaq 2(%rcx), %rsi
leaq (%rax,%rcx,8), %rdi
addq %rdx, %rcx
.L1075:
movdqa %xmm14, %xmm1
movdqa -128(%rbp), %xmm7
pcmpgtq %xmm2, %xmm1
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm0
movmskpd %xmm1, %r8d
punpcklqdq %xmm1, %xmm3
punpckhqdq %xmm1, %xmm0
movdqa %xmm13, %xmm1
popcntq %r8, %r8
pcmpgtq %xmm2, %xmm1
pandn %xmm3, %xmm0
pshufd $78, %xmm14, %xmm3
subq %r8, %rsi
pblendvb %xmm0, %xmm3, %xmm14
movups %xmm14, (%rdi)
leaq -4(%rdx,%rsi), %rdi
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm0
movups %xmm14, -16(%rax,%rcx,8)
movmskpd %xmm1, %ecx
punpcklqdq %xmm1, %xmm3
punpckhqdq %xmm1, %xmm0
movdqa %xmm12, %xmm1
pcmpgtq %xmm2, %xmm1
pandn %xmm3, %xmm0
pshufd $78, %xmm13, %xmm3
pblendvb %xmm0, %xmm3, %xmm13
movups %xmm13, (%rax,%rsi,8)
movdqa %xmm1, %xmm3
movups %xmm13, (%rax,%rdi,8)
movdqa %xmm1, %xmm0
xorl %edi, %edi
punpcklqdq %xmm1, %xmm3
popcntq %rcx, %rdi
punpckhqdq %xmm1, %xmm0
subq %rdi, %rsi
leaq 2(%rsi), %rcx
pandn %xmm3, %xmm0
movmskpd %xmm1, %edi
pshufd $78, %xmm12, %xmm3
movdqa %xmm11, %xmm1
leaq -6(%rdx,%rcx), %rsi
popcntq %rdi, %rdi
pcmpgtq %xmm2, %xmm1
pblendvb %xmm0, %xmm3, %xmm12
movups %xmm12, (%rax,%rcx,8)
movups %xmm12, (%rax,%rsi,8)
movl $2, %esi
movq %rsi, %r8
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm0
subq %rdi, %r8
punpcklqdq %xmm1, %xmm3
punpckhqdq %xmm1, %xmm0
addq %r8, %rcx
movmskpd %xmm1, %r8d
movdqa %xmm10, %xmm1
pcmpgtq %xmm2, %xmm1
pandn %xmm3, %xmm0
pshufd $78, %xmm11, %xmm3
popcntq %r8, %r8
pblendvb %xmm0, %xmm3, %xmm11
leaq -8(%rdx,%rcx), %rdi
movups %xmm11, (%rax,%rcx,8)
movdqa %xmm1, %xmm3
movups %xmm11, (%rax,%rdi,8)
movdqa %xmm1, %xmm0
movq %rsi, %rdi
punpcklqdq %xmm1, %xmm3
subq %r8, %rdi
punpckhqdq %xmm1, %xmm0
movmskpd %xmm1, %r8d
movdqa %xmm9, %xmm1
pandn %xmm3, %xmm0
addq %rcx, %rdi
pcmpgtq %xmm2, %xmm1
pshufd $78, %xmm10, %xmm3
leaq -10(%rdx,%rdi), %rcx
popcntq %r8, %r8
pblendvb %xmm0, %xmm3, %xmm10
movups %xmm10, (%rax,%rdi,8)
movdqa %xmm1, %xmm3
movups %xmm10, (%rax,%rcx,8)
movdqa %xmm1, %xmm0
movq %rsi, %rcx
punpcklqdq %xmm1, %xmm3
subq %r8, %rcx
punpckhqdq %xmm1, %xmm0
movmskpd %xmm1, %r8d
movdqa %xmm7, %xmm1
pandn %xmm3, %xmm0
addq %rdi, %rcx
pcmpgtq %xmm2, %xmm1
pshufd $78, %xmm9, %xmm3
leaq -12(%rdx,%rcx), %rdi
popcntq %r8, %r8
pblendvb %xmm0, %xmm3, %xmm9
movups %xmm9, (%rax,%rcx,8)
movdqa %xmm1, %xmm3
movups %xmm9, (%rax,%rdi,8)
movdqa %xmm1, %xmm0
movq %rsi, %rdi
punpcklqdq %xmm1, %xmm3
subq %r8, %rdi
punpckhqdq %xmm1, %xmm0
addq %rcx, %rdi
pandn %xmm3, %xmm0
pshufd $78, %xmm7, %xmm3
pblendvb %xmm0, %xmm3, %xmm7
leaq -14(%rdx,%rdi), %rcx
movmskpd %xmm1, %r8d
movups %xmm7, (%rax,%rdi,8)
popcntq %r8, %r8
movups %xmm7, (%rax,%rcx,8)
movdqa -144(%rbp), %xmm7
movq %rsi, %rcx
subq %r8, %rcx
movdqa %xmm7, %xmm1
addq %rdi, %rcx
pcmpgtq %xmm2, %xmm1
leaq -16(%rdx,%rcx), %rdx
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm0
movmskpd %xmm1, %edi
punpcklqdq %xmm1, %xmm3
punpckhqdq %xmm1, %xmm0
popcntq %rdi, %rdi
subq %rdi, %rsi
pandn %xmm3, %xmm0
pshufd $78, %xmm7, %xmm3
movq %r14, %rdi
pblendvb %xmm0, %xmm3, %xmm7
movups %xmm7, (%rax,%rcx,8)
movups %xmm7, (%rax,%rdx,8)
leaq (%rsi,%rcx), %rdx
subq %rdx, %rdi
leaq 0(,%rdx,8), %rsi
.L1074:
movdqa %xmm15, %xmm1
cmpq $2, %rdi
leaq -16(,%r14,8), %rcx
pcmpgtq %xmm2, %xmm1
cmovnb %rsi, %rcx
pcmpeqd %xmm0, %xmm0
movdqa %xmm15, %xmm2
movdqu (%rax,%rcx), %xmm7
xorl %ecx, %ecx
pxor %xmm1, %xmm0
movmskpd %xmm0, %edi
movups %xmm7, (%rax,%r14,8)
popcntq %rdi, %rcx
movq %rcx, %xmm7
salq $4, %rdi
movddup %xmm7, %xmm0
pshufb 0(%r13,%rdi), %xmm2
pcmpgtq %xmm8, %xmm0
movq %xmm0, %rdi
testq %rdi, %rdi
je .L1080
movq %xmm2, (%rax,%rsi)
.L1080:
pextrq $1, %xmm0, %rdi
testq %rdi, %rdi
je .L1081
pextrq $1, %xmm2, 8(%rax,%rsi)
.L1081:
addq %rdx, %rcx
movmskpd %xmm1, %edx
movq %rdx, %rdi
leaq 0(,%rcx,8), %rsi
salq $4, %rdi
pshufb 0(%r13,%rdi), %xmm15
xorl %edi, %edi
popcntq %rdx, %rdi
movq %rdi, %xmm0
punpcklqdq %xmm0, %xmm0
pcmpgtq %xmm8, %xmm0
movq %xmm0, %rdx
testq %rdx, %rdx
je .L1082
movq %xmm15, (%rax,%rcx,8)
.L1082:
pextrq $1, %xmm0, %rdx
testq %rdx, %rdx
je .L1083
pextrq $1, %xmm15, 8(%rax,%rsi)
.L1083:
movq -80(%rbp), %r14
addq %rcx, %r15
subq $1, %r14
cmpl $2, -112(%rbp)
je .L1085
movq -88(%rbp), %rsi
movq %r10, %rdi
movq %r14, %r9
movq %rbx, %r8
movq %r12, %rcx
movq %r15, %rdx
movq %r10, -80(%rbp)
call _ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -112(%rbp)
movq -80(%rbp), %r10
je .L993
.L1085:
movq -72(%rbp), %rdx
movq -88(%rbp), %rsi
leaq (%r10,%r15,8), %rdi
movq %r14, %r9
movq %rbx, %r8
movq %r12, %rcx
subq %r15, %rdx
call _ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L993:
addq $104, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1070:
.cfi_restore_state
movq (%r12), %rcx
leaq 8(%r11), %rdi
andq $-8, %rdi
movq %rcx, (%r11)
movl %r8d, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r11,%rcx)
subq %rdi, %r11
movq %r12, %rsi
leal (%r8,%r11), %ecx
subq %r11, %rsi
shrl $3, %ecx
rep movsq
jmp .L1071
.p2align 4,,10
.p2align 3
.L1066:
movq (%r11), %rcx
leaq 8(%rax), %rdi
andq $-8, %rdi
movq %rcx, (%rax)
movl %r8d, %ecx
movq -8(%r11,%rcx), %rsi
movq %rsi, -8(%rax,%rcx)
movq %rax, %rcx
movq %r11, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
jmp .L1067
.L1224:
movzbl (%r12), %ecx
movb %cl, (%r11)
jmp .L1071
.L1223:
movzbl (%r11), %ecx
movb %cl, (%rax)
jmp .L1067
.L1219:
cmpq $1, %rdx
jbe .L993
leaq 256(%rdi), %rax
cmpq %rax, %rsi
jb .L997
movl $2, %esi
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L993
.L1007:
movq -112(%rbp), %rax
movl $2, %edi
movdqu (%r10), %xmm0
movdqa .LC0(%rip), %xmm8
andl $1, %eax
pcmpeqq %xmm2, %xmm0
subq %rax, %rdi
movq %rdi, %xmm7
movddup %xmm7, %xmm1
pcmpgtq %xmm8, %xmm1
pandn %xmm1, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1227
pxor %xmm1, %xmm1
movq -72(%rbp), %r8
leaq 256(%r10,%rdi,8), %rsi
movdqa %xmm1, %xmm0
movdqa %xmm1, %xmm4
.p2align 4,,10
.p2align 3
.L1013:
movq %rdi, %rcx
leaq 32(%rdi), %rdi
cmpq %rdi, %r8
jb .L1228
leaq -256(%rsi), %rax
.L1012:
movdqa (%rax), %xmm3
leaq 32(%rax), %rdx
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 16(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm1
movdqa 32(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 48(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm1
movdqa 64(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 80(%rax), %xmm3
leaq 96(%rdx), %rax
pxor %xmm2, %xmm3
por %xmm3, %xmm1
movdqa 64(%rdx), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 80(%rdx), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm1
cmpq %rsi, %rax
jne .L1012
movdqa %xmm0, %xmm3
leaq 352(%rdx), %rsi
por %xmm1, %xmm3
pcmpeqq %xmm4, %xmm3
movmskpd %xmm3, %eax
cmpl $3, %eax
je .L1013
movdqa %xmm2, %xmm0
pcmpeqd %xmm1, %xmm1
pcmpeqq (%r10,%rcx,8), %xmm0
pxor %xmm1, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1015
.p2align 4,,10
.p2align 3
.L1014:
addq $2, %rcx
movdqa %xmm2, %xmm0
pcmpeqq (%r10,%rcx,8), %xmm0
pxor %xmm1, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
je .L1014
.L1015:
rep bsfl %eax, %eax
cltq
addq %rcx, %rax
.L1011:
leaq (%r10,%rax,8), %r8
movq (%r8), %rdi
movq %rdi, %xmm7
movddup %xmm7, %xmm1
movdqa %xmm1, %xmm0
pcmpgtq %xmm2, %xmm0
movmskpd %xmm0, %edx
testl %edx, %edx
jne .L1020
movq -72(%rbp), %rsi
xorl %ecx, %ecx
leaq -2(%rsi), %rax
jmp .L1027
.p2align 4,,10
.p2align 3
.L1021:
movmskpd %xmm0, %edx
movups %xmm2, (%r10,%rax,8)
popcntq %rdx, %rdx
addq %rdx, %rcx
leaq -2(%rax), %rdx
cmpq %rdx, %rsi
jbe .L1229
movq %rdx, %rax
.L1027:
movdqu (%r10,%rax,8), %xmm3
movdqu (%r10,%rax,8), %xmm0
pcmpeqq %xmm1, %xmm3
pcmpeqq %xmm2, %xmm0
movdqa %xmm3, %xmm4
por %xmm0, %xmm4
movmskpd %xmm4, %edx
cmpl $3, %edx
je .L1021
pcmpeqd %xmm4, %xmm4
leaq 2(%rax), %rsi
pxor %xmm4, %xmm0
pandn %xmm0, %xmm3
movmskpd %xmm3, %edx
rep bsfl %edx, %edx
movslq %edx, %rdx
addq %rax, %rdx
addq $4, %rax
movddup (%r10,%rdx,8), %xmm3
movq -72(%rbp), %rdx
movaps %xmm3, -64(%rbp)
subq %rcx, %rdx
cmpq %rax, %rdx
jb .L1022
.p2align 4,,10
.p2align 3
.L1023:
movups %xmm1, -16(%r10,%rax,8)
movq %rax, %rsi
addq $2, %rax
cmpq %rdx, %rax
jbe .L1023
.L1022:
subq %rsi, %rdx
leaq 0(,%rsi,8), %rcx
movq %rdx, %xmm0
punpcklqdq %xmm0, %xmm0
pcmpgtq %xmm8, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L1031
movq %rdi, (%r10,%rsi,8)
.L1031:
pextrq $1, %xmm0, %rax
testq %rax, %rax
je .L1026
movq %rdi, 8(%r10,%rcx)
.L1026:
movdqa %xmm2, %xmm0
pcmpeqq .LC12(%rip), %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
je .L1103
movdqa %xmm2, %xmm0
pcmpeqq .LC4(%rip), %xmm0
movmskpd %xmm0, %eax
movl %eax, -112(%rbp)
cmpl $3, %eax
je .L1230
movdqa %xmm3, %xmm0
movdqa %xmm3, %xmm5
movdqa %xmm2, %xmm4
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm1, %xmm5
pcmpgtq %xmm5, %xmm4
movmskpd %xmm4, %eax
testl %eax, %eax
jne .L1231
movdqa %xmm2, %xmm3
movl $32, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1037:
leaq (%rcx,%rax,2), %rdx
addq $1, %rax
movdqu (%r10,%rdx,8), %xmm1
movdqa %xmm1, %xmm0
pcmpgtq %xmm3, %xmm0
pblendvb %xmm0, %xmm3, %xmm1
movdqa %xmm1, %xmm3
cmpq $16, %rax
jne .L1037
movdqa %xmm2, %xmm0
pcmpgtq %xmm1, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1217
leaq 32(%rsi), %rax
cmpq %rax, -72(%rbp)
jb .L1232
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1037
.L1116:
xorl %r8d, %r8d
xorl %ecx, %ecx
leaq _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %r13
movq %r10, %rax
movdqa .LC0(%rip), %xmm8
jmp .L1055
.L1118:
movq %rdx, %rcx
movq %rax, %rdi
movl $2, %esi
jmp .L1075
.L1117:
xorl %esi, %esi
movq %r14, %rdi
jmp .L1074
.L1222:
movq -72(%rbp), %rsi
movq %r10, %rdi
leaq -1(%rsi), %rbx
movq %rbx, %r12
shrq %r12
.p2align 4,,10
.p2align 3
.L1053:
movq %r12, %rdx
call _ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %r12
jnb .L1053
.p2align 4,,10
.p2align 3
.L1054:
movq (%rdi,%rbx,8), %rdx
movq (%rdi), %rax
movq %rbx, %rsi
movq %rdx, (%rdi)
xorl %edx, %edx
movq %rax, (%rdi,%rbx,8)
call _ZN3hwy6N_SSE46detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L1054
jmp .L993
.L1105:
movl $12, %eax
movl $11, %esi
jmp .L1051
.p2align 4,,10
.p2align 3
.L1052:
cmpq $23, %rax
je .L1216
.L1051:
movq %rax, %rcx
addq $1, %rax
cmpq (%r12,%rax,8), %rdx
je .L1052
movl $12, %edi
subq $11, %rcx
movq %rdx, %rax
subq %rsi, %rdi
cmpq %rdi, %rcx
jb .L1050
.L1216:
movq (%r12,%rsi,8), %rax
jmp .L1050
.L1106:
movl $9, %esi
movl $10, %eax
jmp .L1051
.L1107:
movl $8, %esi
movl $9, %eax
jmp .L1051
.L1108:
movl $7, %esi
movl $8, %eax
jmp .L1051
.L1109:
movl $6, %esi
movl $7, %eax
jmp .L1051
.L1228:
movq -72(%rbp), %rsi
pcmpeqd %xmm1, %xmm1
.p2align 4,,10
.p2align 3
.L1017:
movq %rcx, %rdx
addq $2, %rcx
cmpq %rcx, %rsi
jb .L1233
movdqa %xmm2, %xmm0
pcmpeqq -16(%r10,%rcx,8), %xmm0
pxor %xmm1, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
je .L1017
.L1214:
rep bsfl %eax, %eax
cltq
addq %rdx, %rax
jmp .L1011
.L1110:
movl $5, %esi
movl $6, %eax
jmp .L1051
.L1111:
movl $4, %esi
movl $5, %eax
jmp .L1051
.L1020:
movq -72(%rbp), %rsi
leaq -64(%rbp), %rdx
movq %r12, %rcx
movdqa %xmm2, %xmm0
movq %r8, %rdi
movq %r10, -128(%rbp)
subq %rax, %rsi
movaps %xmm1, -112(%rbp)
call _ZN3hwy6N_SSE46detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L993
movdqa -64(%rbp), %xmm3
movq -128(%rbp), %r10
movddup (%r12), %xmm2
movdqa -112(%rbp), %xmm1
jmp .L1026
.L1112:
movl $3, %esi
movl $4, %eax
jmp .L1051
.L1113:
movl $2, %esi
movl $3, %eax
jmp .L1051
.L1114:
movl $1, %esi
movl $2, %eax
jmp .L1051
.L1221:
xorl %esi, %esi
movl $1, %eax
jmp .L1051
.L1229:
movdqu (%r10), %xmm4
movdqu (%r10), %xmm0
movq %rax, %xmm7
movddup %xmm7, %xmm3
movq -72(%rbp), %rdx
pcmpeqq %xmm2, %xmm4
pcmpeqq %xmm1, %xmm0
pcmpgtq %xmm8, %xmm3
subq %rcx, %rdx
movdqa %xmm4, %xmm5
por %xmm4, %xmm0
pcmpeqd %xmm4, %xmm4
pand %xmm3, %xmm5
pxor %xmm4, %xmm3
por %xmm3, %xmm0
movmskpd %xmm0, %esi
cmpl $3, %esi
jne .L1234
movmskpd %xmm5, %ecx
movq %rdx, %rax
movups %xmm2, (%r10)
popcntq %rcx, %rcx
subq %rcx, %rax
cmpq $1, %rax
jbe .L1092
leaq -2(%rax), %rcx
movq -128(%rbp), %rsi
movq %rcx, %rdx
shrq %rdx
salq $4, %rdx
leaq 16(%r10,%rdx), %rdx
.L1034:
movups %xmm1, (%rsi)
addq $16, %rsi
cmpq %rsi, %rdx
jne .L1034
movq %rcx, %rdx
andq $-2, %rdx
addq $2, %rdx
leaq 0(,%rdx,8), %rcx
subq %rdx, %rax
.L1033:
movaps %xmm1, (%r12)
testq %rax, %rax
je .L993
leaq (%r10,%rcx), %rdi
leaq 0(,%rax,8), %rdx
movq %r12, %rsi
call memcpy@PLT
jmp .L993
.L1232:
movq -72(%rbp), %rdx
jmp .L1044
.L1045:
movdqu -16(%r10,%rsi,8), %xmm7
movdqa %xmm2, %xmm0
pcmpgtq %xmm7, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1217
.L1044:
movq %rsi, %rax
addq $2, %rsi
cmpq %rsi, %rdx
jnb .L1045
movq -72(%rbp), %rdi
cmpq %rax, %rdi
je .L1103
movdqu -16(%r10,%rdi,8), %xmm7
movdqa %xmm2, %xmm0
pcmpgtq %xmm7, %xmm0
movaps %xmm7, -112(%rbp)
movmskpd %xmm0, %eax
cmpl $1, %eax
movl $1, %eax
adcl $0, %eax
movl %eax, -112(%rbp)
jmp .L1046
.L1048:
movl $11, %eax
movl $10, %esi
jmp .L1051
.L1233:
movq -72(%rbp), %rax
pcmpeqd %xmm1, %xmm1
leaq -2(%rax), %rdx
movdqu (%r10,%rdx,8), %xmm0
pcmpeqq %xmm2, %xmm0
pxor %xmm1, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
je .L993
jmp .L1214
.L1227:
rep bsfl %eax, %eax
cltq
jmp .L1011
.L1103:
movl $2, -112(%rbp)
jmp .L1046
.L997:
movq %rdx, %r11
leaq -2(%rdx), %rdx
movq (%rdi), %rax
movq %r10, %rsi
movq %rdx, %rbx
andq $-2, %rdx
shrq %rbx
movq %rax, (%rcx)
leaq 2(%rdx), %r13
addq $1, %rbx
salq $4, %rbx
movl %ebx, %r8d
leaq 8(%rdi,%r8), %r15
leaq 8(%rcx,%r8), %r14
movq -16(%r15), %rax
leaq 8(%rcx), %rdi
andq $-8, %rdi
movq %rax, -16(%r14)
movq %rcx, %rax
subq %rdi, %rax
subq %rax, %rsi
leal (%rbx,%rax), %ecx
movq %r11, %rax
shrl $3, %ecx
subq %r13, %rax
rep movsq
movq %r11, -72(%rbp)
movq %rax, %rsi
movq %rax, -80(%rbp)
je .L998
leaq 0(,%r13,8), %rax
leaq 0(,%rsi,8), %rdx
movq %r8, -112(%rbp)
leaq (%r10,%rax), %rsi
leaq (%r12,%rax), %rdi
movq %r10, -88(%rbp)
call memcpy@PLT
movq -72(%rbp), %r11
movl $32, %ecx
movq -88(%rbp), %r10
movq -112(%rbp), %r8
movl %r11d, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rax
salq $4, %rax
addq $2, %rax
cmpq %rax, %r11
jnb .L1235
.L999:
movdqa .LC4(%rip), %xmm0
movq -72(%rbp), %rdx
.L1003:
movups %xmm0, (%r12,%rdx,8)
addq $2, %rdx
cmpq %rax, %rdx
jb .L1003
movq %r12, %rdi
movq %r8, -88(%rbp)
movq %r10, -72(%rbp)
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -72(%rbp), %r10
movq (%r12), %rax
movq %r12, %rsi
movq %rax, (%r10)
movq -88(%rbp), %r8
leaq 8(%r10), %rdi
andq $-8, %rdi
movq -8(%r12,%r8), %rax
movq %rax, -8(%r10,%r8)
movq %r10, %rax
subq %rdi, %rax
leal (%rbx,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
cmpq $0, -80(%rbp)
je .L993
.L1001:
movq -80(%rbp), %rdx
salq $3, %r13
leaq (%r10,%r13), %rdi
leaq (%r12,%r13), %rsi
salq $3, %rdx
call memcpy@PLT
jmp .L993
.L1230:
pcmpeqd %xmm0, %xmm0
paddq %xmm0, %xmm2
jmp .L1046
.L1231:
movdqa %xmm1, %xmm7
pblendvb %xmm0, %xmm3, %xmm7
movdqa %xmm7, %xmm0
pcmpgtq %xmm2, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1217
movdqa %xmm2, %xmm1
movl $32, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1038:
leaq (%rcx,%rax,2), %rdx
movdqa %xmm1, %xmm7
addq $1, %rax
movdqu (%r10,%rdx,8), %xmm3
movdqa %xmm3, %xmm0
pcmpgtq %xmm1, %xmm0
pblendvb %xmm0, %xmm3, %xmm7
movdqa %xmm7, %xmm0
movdqa %xmm7, %xmm1
cmpq $16, %rax
jne .L1038
pcmpgtq %xmm2, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1217
leaq 32(%rsi), %rax
cmpq %rax, -72(%rbp)
jb .L1040
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1038
.L1041:
movdqu -16(%r10,%rsi,8), %xmm0
pcmpgtq %xmm2, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1217
.L1040:
movq %rsi, %rax
addq $2, %rsi
cmpq %rsi, -72(%rbp)
jnb .L1041
movq -72(%rbp), %rdi
cmpq %rax, %rdi
je .L1042
movdqu -16(%r10,%rdi,8), %xmm7
movdqa %xmm7, %xmm0
movaps %xmm7, -112(%rbp)
pcmpgtq %xmm2, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1217
.L1042:
pcmpeqd %xmm0, %xmm0
movl $3, -112(%rbp)
paddq %xmm0, %xmm2
jmp .L1046
.L998:
movq -72(%rbp), %rdi
movl $32, %ecx
movl %edi, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rax
salq $4, %rax
addq $2, %rax
cmpq %rax, %rdi
jb .L999
movq %r12, %rdi
movq %r10, -72(%rbp)
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -72(%rbp), %r10
movq (%r12), %rax
movq %r12, %rsi
leaq 8(%r10), %rdi
movq %rax, (%r10)
movq -16(%r14), %rax
andq $-8, %rdi
subq %rdi, %r10
movq %rax, -16(%r15)
leal (%rbx,%r10), %ecx
subq %r10, %rsi
shrl $3, %ecx
rep movsq
jmp .L993
.p2align 4,,10
.p2align 3
.L1092:
xorl %ecx, %ecx
jmp .L1033
.L1234:
pxor %xmm4, %xmm0
movmskpd %xmm0, %ecx
rep bsfl %ecx, %ecx
movslq %ecx, %rcx
movddup (%r10,%rcx,8), %xmm3
leaq 2(%rax), %rcx
movaps %xmm3, -64(%rbp)
cmpq %rdx, %rcx
ja .L1029
.L1030:
movups %xmm1, -16(%r10,%rcx,8)
movq %rcx, %rax
addq $2, %rcx
cmpq %rdx, %rcx
jbe .L1030
.L1029:
subq %rax, %rdx
leaq 0(,%rax,8), %rcx
movq %rdx, %xmm0
punpcklqdq %xmm0, %xmm0
pcmpgtq %xmm8, %xmm0
movq %xmm0, %rdx
testq %rdx, %rdx
je .L1031
movq %rdi, (%r10,%rax,8)
jmp .L1031
.L1235:
movq %r12, %rdi
movq %r10, -72(%rbp)
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -72(%rbp), %r10
movq (%r12), %rax
movq %r12, %rsi
movq %rax, (%r10)
movq -16(%r14), %rax
leaq 8(%r10), %rdi
andq $-8, %rdi
movq %rax, -16(%r15)
movq %r10, %rax
subq %rdi, %rax
leal (%rbx,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
jmp .L1001
.cfi_endproc
.LFE18803:
.size _ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18805:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
pushq %r13
.cfi_offset 15, -24
.cfi_offset 14, -32
.cfi_offset 13, -40
movq %rcx, %r13
pushq %r12
pushq %rbx
subq $392, %rsp
.cfi_offset 12, -48
.cfi_offset 3, -56
movq %rdi, -104(%rbp)
movq %rsi, -264(%rbp)
movq %rdx, -216(%rbp)
movq %r8, -192(%rbp)
movq %r9, -224(%rbp)
cmpq $32, %rdx
jbe .L1463
movq %rdi, %r10
movq %rdi, %r12
shrq $3, %r10
movq %r10, %rax
andl $7, %eax
jne .L1464
movq %rdx, %r14
movq %rdi, %r15
movq %r8, %rax
.L1248:
movq 8(%rax), %rdx
movq 16(%rax), %r9
movq %rdx, %rsi
leaq 1(%r9), %rdi
leaq (%rdx,%rdx,8), %rcx
xorq (%rax), %rdi
rolq $24, %rsi
movq %rsi, %rax
movq %rdx, %rsi
leaq 2(%r9), %rdx
addq %rdi, %rax
shrq $11, %rsi
xorq %rsi, %rcx
movq %rax, %rsi
movq %rax, %r8
rolq $24, %rsi
xorq %rdx, %rcx
shrq $11, %r8
leaq (%rax,%rax,8), %rdx
addq %rcx, %rsi
xorq %r8, %rdx
leaq 3(%r9), %rax
movq %rsi, %r11
movq %rsi, %r8
xorq %rax, %rdx
shrq $11, %r8
rolq $24, %r11
leaq (%rsi,%rsi,8), %rax
leaq 4(%r9), %rsi
addq %rdx, %r11
xorq %r8, %rax
addq $5, %r9
xorq %rsi, %rax
movq %r11, %r8
movq %r11, %rsi
shrq $11, %rsi
rolq $24, %r8
addq %rax, %r8
movq %rsi, %rbx
leaq (%r11,%r11,8), %rsi
xorq %rbx, %rsi
movq %r8, %rbx
leaq (%r8,%r8,8), %r11
rolq $24, %r8
xorq %r9, %rsi
shrq $11, %rbx
xorq %rbx, %r11
addq %rsi, %r8
movq -192(%rbp), %rbx
movl %esi, %esi
movq %r11, %xmm0
movq %r8, %xmm6
movl %ecx, %r11d
movabsq $34359738359, %r8
punpcklqdq %xmm6, %xmm0
movq %r9, 16(%rbx)
movl %edx, %r9d
movups %xmm0, (%rbx)
movq %r14, %rbx
shrq $3, %rbx
cmpq %r8, %r14
movl $4294967295, %r8d
movl %edi, %r14d
cmova %r8, %rbx
shrq $32, %rdi
movl %eax, %r8d
shrq $32, %rcx
shrq $32, %rdx
imulq %rbx, %r14
shrq $32, %rax
imulq %rbx, %rdi
imulq %rbx, %r11
imulq %rbx, %rcx
shrq $32, %r14
imulq %rbx, %r9
shrq $32, %rdi
salq $6, %r14
imulq %rbx, %rdx
shrq $32, %r11
salq $6, %rdi
addq %r15, %r14
imulq %rbx, %r8
shrq $32, %rcx
salq $6, %r11
addq %r15, %rdi
shrq $32, %r9
salq $6, %rcx
addq %r15, %r11
shrq $32, %rdx
salq $6, %r9
addq %r15, %rcx
shrq $32, %r8
salq $6, %rdx
addq %r15, %r9
salq $6, %r8
addq %r15, %rdx
addq %r15, %r8
imulq %rbx, %rax
imulq %rbx, %rsi
xorl %ebx, %ebx
shrq $32, %rax
shrq $32, %rsi
salq $6, %rax
salq $6, %rsi
addq %r15, %rax
addq %r15, %rsi
.L1250:
movdqa (%r11,%rbx,8), %xmm2
movdqa (%r14,%rbx,8), %xmm4
movdqa (%rdi,%rbx,8), %xmm0
movdqa %xmm2, %xmm3
movdqa %xmm4, %xmm1
pcmpeqd %xmm4, %xmm3
psubq %xmm2, %xmm1
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm4, %xmm3
por %xmm3, %xmm1
movdqa %xmm4, %xmm3
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm5
pand %xmm1, %xmm3
pandn %xmm2, %xmm5
pand %xmm1, %xmm2
por %xmm5, %xmm3
movdqa %xmm1, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm0, %xmm4
movdqa %xmm3, %xmm1
pcmpeqd %xmm3, %xmm4
psubq %xmm0, %xmm1
por %xmm5, %xmm2
pand %xmm4, %xmm1
movdqa %xmm0, %xmm4
pcmpgtd %xmm3, %xmm4
por %xmm4, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm0
pandn %xmm3, %xmm4
movdqa %xmm2, %xmm3
por %xmm4, %xmm0
movdqa (%rcx,%rbx,8), %xmm4
pcmpeqd %xmm0, %xmm3
movdqa %xmm0, %xmm1
psubq %xmm2, %xmm1
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm0, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm3
pand %xmm1, %xmm0
movdqa %xmm4, %xmm1
pandn %xmm2, %xmm3
movdqa (%rdx,%rbx,8), %xmm2
por %xmm3, %xmm0
movdqa %xmm2, %xmm3
psubq %xmm2, %xmm1
movaps %xmm0, 0(%r13,%rbx,8)
movdqa (%r9,%rbx,8), %xmm0
pcmpeqd %xmm4, %xmm3
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm4, %xmm3
por %xmm3, %xmm1
movdqa %xmm4, %xmm3
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm5
pand %xmm1, %xmm3
pandn %xmm2, %xmm5
pand %xmm1, %xmm2
por %xmm5, %xmm3
movdqa %xmm1, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm0, %xmm4
movdqa %xmm3, %xmm1
pcmpeqd %xmm3, %xmm4
psubq %xmm0, %xmm1
por %xmm5, %xmm2
pand %xmm4, %xmm1
movdqa %xmm0, %xmm4
pcmpgtd %xmm3, %xmm4
por %xmm4, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm0
pandn %xmm3, %xmm4
movdqa %xmm2, %xmm3
por %xmm4, %xmm0
movdqa (%r8,%rbx,8), %xmm4
pcmpeqd %xmm0, %xmm3
movdqa %xmm0, %xmm1
psubq %xmm2, %xmm1
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm0, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm3
pand %xmm1, %xmm0
movdqa %xmm4, %xmm1
pandn %xmm2, %xmm3
movdqa (%rsi,%rbx,8), %xmm2
por %xmm3, %xmm0
movdqa %xmm2, %xmm3
psubq %xmm2, %xmm1
movaps %xmm0, 64(%r13,%rbx,8)
movdqa (%rax,%rbx,8), %xmm0
pcmpeqd %xmm4, %xmm3
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm4, %xmm3
por %xmm3, %xmm1
movdqa %xmm4, %xmm3
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm5
pand %xmm1, %xmm3
pandn %xmm2, %xmm5
pand %xmm1, %xmm2
por %xmm5, %xmm3
movdqa %xmm1, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm0, %xmm4
movdqa %xmm3, %xmm1
pcmpeqd %xmm3, %xmm4
psubq %xmm0, %xmm1
por %xmm5, %xmm2
pand %xmm4, %xmm1
movdqa %xmm0, %xmm4
pcmpgtd %xmm3, %xmm4
por %xmm4, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm0
pandn %xmm3, %xmm4
movdqa %xmm2, %xmm3
por %xmm4, %xmm0
pcmpeqd %xmm0, %xmm3
movdqa %xmm0, %xmm1
psubq %xmm2, %xmm1
pand %xmm3, %xmm1
movdqa %xmm2, %xmm3
pcmpgtd %xmm0, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm3
pand %xmm1, %xmm0
pandn %xmm2, %xmm3
por %xmm3, %xmm0
movaps %xmm0, 128(%r13,%rbx,8)
addq $2, %rbx
cmpq $8, %rbx
jne .L1250
movdqa 16(%r13), %xmm0
movdqa 0(%r13), %xmm1
movddup 0(%r13), %xmm2
leaq 192(%r13), %r14
pxor %xmm2, %xmm1
pxor %xmm2, %xmm0
por %xmm1, %xmm0
movdqa 32(%r13), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 48(%r13), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 64(%r13), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 80(%r13), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 96(%r13), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 112(%r13), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 128(%r13), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 144(%r13), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 160(%r13), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
movdqa 176(%r13), %xmm1
pxor %xmm2, %xmm1
por %xmm1, %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm1, %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
je .L1251
movdqa .LC4(%rip), %xmm0
movl $2, %esi
movq %r13, %rdi
movups %xmm0, 192(%r13)
movups %xmm0, 208(%r13)
movups %xmm0, 224(%r13)
movups %xmm0, 240(%r13)
movups %xmm0, 256(%r13)
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
pcmpeqd %xmm0, %xmm0
movddup 0(%r13), %xmm2
movddup 184(%r13), %xmm1
paddq %xmm1, %xmm0
pcmpeqd %xmm2, %xmm0
pshufd $177, %xmm0, %xmm3
pand %xmm3, %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
jne .L1253
movq -104(%rbp), %rdi
leaq -64(%rbp), %rdx
movq %r14, %rcx
movdqa %xmm2, %xmm0
movq -216(%rbp), %rsi
call _ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1236
.L1253:
movq 96(%r13), %rax
cmpq %rax, 88(%r13)
jne .L1349
cmpq 80(%r13), %rax
jne .L1292
cmpq 72(%r13), %rax
jne .L1350
cmpq 64(%r13), %rax
jne .L1351
cmpq 56(%r13), %rax
jne .L1352
cmpq 48(%r13), %rax
jne .L1353
cmpq 40(%r13), %rax
jne .L1354
cmpq 32(%r13), %rax
jne .L1355
cmpq 24(%r13), %rax
jne .L1356
cmpq 16(%r13), %rax
jne .L1357
cmpq 8(%r13), %rax
jne .L1358
xorl %ebx, %ebx
movl $1, %edx
cmpq %rax, 0(%r13)
jne .L1295
.L1294:
movq %rax, %xmm2
punpcklqdq %xmm2, %xmm2
.L1461:
movl $1, -268(%rbp)
.L1290:
cmpq $0, -224(%rbp)
je .L1465
movq -216(%rbp), %rax
movq -104(%rbp), %r12
movaps %xmm2, -80(%rbp)
leaq -2(%rax), %r15
movdqu (%r12,%r15,8), %xmm6
movq %r15, %rbx
movq %r15, %rax
andl $7, %ebx
movaps %xmm6, -256(%rbp)
andl $6, %eax
je .L1359
movdqu (%r12), %xmm4
movdqa %xmm2, %xmm1
movaps %xmm2, -128(%rbp)
movdqa %xmm4, %xmm0
psubq %xmm4, %xmm1
movaps %xmm4, -144(%rbp)
pcmpeqd %xmm2, %xmm0
pand %xmm0, %xmm1
movdqa %xmm4, %xmm0
pcmpgtd %xmm2, %xmm0
por %xmm0, %xmm1
pcmpeqd %xmm0, %xmm0
pshufd $245, %xmm1, %xmm1
pxor %xmm1, %xmm0
movaps %xmm1, -96(%rbp)
movmskpd %xmm0, %r14d
movq %r14, %rdi
salq $4, %r14
call __popcountdi2@PLT
movdqa .LC1(%rip), %xmm7
movdqa .LC0(%rip), %xmm2
leaq _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rsi
cltq
movdqa -144(%rbp), %xmm4
movdqa -96(%rbp), %xmm1
movq %rsi, -184(%rbp)
movq %rax, %xmm6
movdqa %xmm2, %xmm0
movaps %xmm2, -240(%rbp)
movdqa -128(%rbp), %xmm2
movddup %xmm6, %xmm3
movdqa %xmm7, %xmm6
movdqa %xmm4, %xmm5
movaps %xmm7, -208(%rbp)
pcmpeqd %xmm3, %xmm6
psubq %xmm3, %xmm0
pshufb (%rsi,%r14), %xmm5
pcmpgtd %xmm7, %xmm3
pand %xmm6, %xmm0
por %xmm3, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rdx
testq %rdx, %rdx
je .L1300
movq %xmm5, (%r12)
.L1300:
movhlps %xmm0, %xmm6
movq %xmm6, %rdx
testq %rdx, %rdx
je .L1301
movq -104(%rbp), %rsi
movhps %xmm5, 8(%rsi)
.L1301:
movmskpd %xmm1, %ecx
movq -104(%rbp), %rsi
movaps %xmm4, -144(%rbp)
movq %rcx, %rdi
movq %rcx, -96(%rbp)
movaps %xmm2, -128(%rbp)
leaq (%rsi,%rax,8), %r12
call __popcountdi2@PLT
movq -96(%rbp), %rcx
movdqa -128(%rbp), %xmm2
movdqa -144(%rbp), %xmm4
movslq %eax, %r14
movq -184(%rbp), %rax
salq $4, %rcx
testb $4, %r15b
movdqa %xmm4, %xmm0
pshufb (%rax,%rcx), %xmm0
movups %xmm0, 0(%r13)
je .L1302
movq -104(%rbp), %rsi
movdqa -80(%rbp), %xmm6
movdqa %xmm2, %xmm1
movaps %xmm2, -160(%rbp)
movdqu 16(%rsi), %xmm3
movdqa %xmm6, %xmm0
pcmpeqd %xmm3, %xmm0
psubq %xmm3, %xmm1
movaps %xmm3, -144(%rbp)
pand %xmm0, %xmm1
movdqa %xmm3, %xmm0
pcmpgtd %xmm6, %xmm0
por %xmm0, %xmm1
pcmpeqd %xmm0, %xmm0
pshufd $245, %xmm1, %xmm1
pxor %xmm1, %xmm0
movaps %xmm1, -128(%rbp)
movmskpd %xmm0, %ecx
movq %rcx, %rdi
movq %rcx, -96(%rbp)
call __popcountdi2@PLT
movq -96(%rbp), %rcx
movdqa -208(%rbp), %xmm7
cltq
movdqa -240(%rbp), %xmm0
movdqa -144(%rbp), %xmm3
movq %rax, %xmm6
movq -184(%rbp), %rsi
salq $4, %rcx
movdqa -128(%rbp), %xmm1
movddup %xmm6, %xmm4
movdqa %xmm7, %xmm6
movdqa %xmm3, %xmm5
movdqa -160(%rbp), %xmm2
pcmpeqd %xmm4, %xmm6
psubq %xmm4, %xmm0
pshufb (%rsi,%rcx), %xmm5
pcmpgtd %xmm7, %xmm4
pand %xmm6, %xmm0
por %xmm4, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rcx
testq %rcx, %rcx
je .L1303
movq %xmm5, (%r12)
.L1303:
movhlps %xmm0, %xmm6
movq %xmm6, %rcx
testq %rcx, %rcx
je .L1304
movhps %xmm5, 8(%r12)
.L1304:
movmskpd %xmm1, %ecx
movaps %xmm3, -144(%rbp)
leaq (%r12,%rax,8), %r12
movq %rcx, %rdi
movq %rcx, -96(%rbp)
movaps %xmm2, -128(%rbp)
call __popcountdi2@PLT
movq -96(%rbp), %rcx
movdqa -128(%rbp), %xmm2
movdqa -144(%rbp), %xmm3
movq -184(%rbp), %rsi
cltq
salq $4, %rcx
movdqa %xmm3, %xmm0
pshufb (%rsi,%rcx), %xmm0
movups %xmm0, 0(%r13,%r14,8)
addq %rax, %r14
cmpq $5, %rbx
jbe .L1302
movq -104(%rbp), %rax
movdqa -80(%rbp), %xmm6
movdqa %xmm2, %xmm1
movaps %xmm2, -160(%rbp)
movdqu 32(%rax), %xmm3
movdqa %xmm6, %xmm0
pcmpeqd %xmm3, %xmm0
psubq %xmm3, %xmm1
movaps %xmm3, -144(%rbp)
pand %xmm0, %xmm1
movdqa %xmm3, %xmm0
pcmpgtd %xmm6, %xmm0
por %xmm0, %xmm1
pcmpeqd %xmm0, %xmm0
pshufd $245, %xmm1, %xmm1
pxor %xmm1, %xmm0
movaps %xmm1, -128(%rbp)
movmskpd %xmm0, %ecx
movq %rcx, %rdi
movq %rcx, -96(%rbp)
call __popcountdi2@PLT
movq -96(%rbp), %rcx
movdqa -208(%rbp), %xmm7
cltq
movdqa -240(%rbp), %xmm0
movdqa -144(%rbp), %xmm3
movq %rax, %xmm5
movq -184(%rbp), %rsi
salq $4, %rcx
movdqa -128(%rbp), %xmm1
movddup %xmm5, %xmm4
movdqa %xmm7, %xmm5
movdqa %xmm3, %xmm6
movdqa -160(%rbp), %xmm2
pcmpeqd %xmm4, %xmm5
psubq %xmm4, %xmm0
pshufb (%rsi,%rcx), %xmm6
pcmpgtd %xmm7, %xmm4
pand %xmm5, %xmm0
por %xmm4, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rcx
testq %rcx, %rcx
je .L1305
movq %xmm6, (%r12)
.L1305:
movhlps %xmm0, %xmm5
movq %xmm5, %rcx
testq %rcx, %rcx
je .L1306
movhps %xmm6, 8(%r12)
.L1306:
movmskpd %xmm1, %ecx
movaps %xmm3, -144(%rbp)
leaq (%r12,%rax,8), %r12
movq %rcx, %rdi
movq %rcx, -96(%rbp)
movaps %xmm2, -128(%rbp)
call __popcountdi2@PLT
movq -96(%rbp), %rcx
movdqa -128(%rbp), %xmm2
movdqa -144(%rbp), %xmm3
movq -184(%rbp), %rsi
cltq
salq $4, %rcx
movdqa %xmm3, %xmm0
pshufb (%rsi,%rcx), %xmm0
movups %xmm0, 0(%r13,%r14,8)
addq %rax, %r14
.L1302:
leaq -2(%rbx), %rax
leaq 1(%rbx), %rcx
andq $-2, %rax
leaq 0(,%r14,8), %r8
addq $2, %rax
cmpq $2, %rcx
movl $2, %ecx
cmovbe %rcx, %rax
.L1299:
cmpq %rax, %rbx
je .L1307
subq %rax, %rbx
movdqa -208(%rbp), %xmm4
movq -104(%rbp), %rsi
movq %r8, -176(%rbp)
movq %rbx, %xmm0
movdqa -240(%rbp), %xmm1
movdqa -80(%rbp), %xmm6
movaps %xmm2, -160(%rbp)
punpcklqdq %xmm0, %xmm0
movdqa %xmm4, %xmm3
movdqu (%rsi,%rax,8), %xmm5
pcmpeqd %xmm0, %xmm3
psubq %xmm0, %xmm1
movdqa %xmm6, %xmm7
pcmpgtd %xmm4, %xmm0
pcmpeqd %xmm5, %xmm7
movaps %xmm5, -144(%rbp)
pand %xmm3, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm4
movdqa %xmm2, %xmm0
psubq %xmm5, %xmm0
movaps %xmm4, -96(%rbp)
pand %xmm7, %xmm0
movdqa %xmm5, %xmm7
pcmpgtd %xmm6, %xmm7
por %xmm7, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm6
movaps %xmm0, -128(%rbp)
pandn %xmm4, %xmm6
movmskpd %xmm6, %ebx
movq %rbx, %rdi
salq $4, %rbx
call __popcountdi2@PLT
movdqa -208(%rbp), %xmm4
movdqa -240(%rbp), %xmm1
cltq
movdqa -144(%rbp), %xmm5
movq -184(%rbp), %rsi
movq %rax, %xmm6
movdqa -128(%rbp), %xmm0
movdqa -160(%rbp), %xmm2
movddup %xmm6, %xmm3
movdqa %xmm4, %xmm6
movdqa %xmm5, %xmm7
movq -176(%rbp), %r8
pcmpeqd %xmm3, %xmm6
psubq %xmm3, %xmm1
pshufb (%rsi,%rbx), %xmm7
pcmpgtd %xmm4, %xmm3
movdqa -96(%rbp), %xmm4
pand %xmm6, %xmm1
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movq %xmm1, %rcx
testq %rcx, %rcx
je .L1308
movq %xmm7, (%r12)
.L1308:
movhlps %xmm1, %xmm6
movq %xmm6, %rcx
testq %rcx, %rcx
je .L1309
movhps %xmm7, 8(%r12)
.L1309:
pand %xmm4, %xmm0
movq %r8, -128(%rbp)
leaq (%r12,%rax,8), %r12
movmskpd %xmm0, %ebx
movaps %xmm5, -144(%rbp)
movq %rbx, %rdi
movaps %xmm2, -96(%rbp)
salq $4, %rbx
call __popcountdi2@PLT
movq -184(%rbp), %rsi
movq -128(%rbp), %r8
movdqa -144(%rbp), %xmm5
cltq
movdqa -96(%rbp), %xmm2
addq %rax, %r14
movdqa %xmm5, %xmm0
pshufb (%rsi,%rbx), %xmm0
movups %xmm0, 0(%r13,%r8)
leaq 0(,%r14,8), %r8
.L1307:
movq -104(%rbp), %rax
movq %r15, %r9
subq %r14, %r9
leaq (%rax,%r9,8), %rax
cmpl $8, %r8d
jnb .L1310
testl %r8d, %r8d
jne .L1466
.L1311:
cmpl $8, %r8d
jnb .L1314
.L1470:
testl %r8d, %r8d
jne .L1467
.L1315:
movq %r12, %rax
subq -104(%rbp), %rax
sarq $3, %rax
subq %rax, %r15
subq %rax, %r9
movq %rax, -288(%rbp)
movq %r15, -280(%rbp)
movq %r9, %r14
leaq (%r12,%r9,8), %rax
je .L1360
movdqu (%r12), %xmm6
leaq 64(%r12), %rcx
leaq -64(%rax), %rsi
movaps %xmm6, -304(%rbp)
movdqu 16(%r12), %xmm6
movaps %xmm6, -320(%rbp)
movdqu 32(%r12), %xmm6
movaps %xmm6, -336(%rbp)
movdqu 48(%r12), %xmm6
movaps %xmm6, -352(%rbp)
movdqu -64(%rax), %xmm6
movaps %xmm6, -368(%rbp)
movdqu -48(%rax), %xmm6
movaps %xmm6, -384(%rbp)
movdqu -32(%rax), %xmm6
movaps %xmm6, -400(%rbp)
movdqu -16(%rax), %xmm6
movaps %xmm6, -416(%rbp)
cmpq %rsi, %rcx
je .L1361
movq %r13, -424(%rbp)
xorl %ebx, %ebx
movl $2, %r15d
movq %rsi, %r13
movaps %xmm2, -96(%rbp)
jmp .L1322
.p2align 4,,10
.p2align 3
.L1469:
movdqu -64(%r13), %xmm5
movdqu -48(%r13), %xmm4
prefetcht0 -256(%r13)
subq $64, %r13
movdqu 32(%r13), %xmm3
movdqu 48(%r13), %xmm1
.L1321:
movdqa -80(%rbp), %xmm7
movdqa -96(%rbp), %xmm0
movq %rcx, -112(%rbp)
movaps %xmm1, -176(%rbp)
movdqa %xmm7, %xmm2
psubq %xmm5, %xmm0
movaps %xmm3, -160(%rbp)
pcmpeqd %xmm5, %xmm2
movaps %xmm4, -144(%rbp)
pand %xmm2, %xmm0
movdqa %xmm5, %xmm2
pcmpgtd %xmm7, %xmm2
pshufd $78, %xmm5, %xmm7
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm6
movdqa %xmm0, %xmm2
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm6
punpckhqdq %xmm0, %xmm2
pandn %xmm6, %xmm2
movdqa %xmm2, %xmm6
pand %xmm7, %xmm2
pandn %xmm5, %xmm6
por %xmm6, %xmm2
movaps %xmm2, -128(%rbp)
call __popcountdi2@PLT
movdqa -128(%rbp), %xmm2
movdqa -80(%rbp), %xmm7
leaq -2(%r14,%rbx), %rdx
movdqa -144(%rbp), %xmm4
movdqa -96(%rbp), %xmm0
cltq
movups %xmm2, (%r12,%rbx,8)
addq $2, %rbx
movups %xmm2, (%r12,%rdx,8)
movdqa %xmm7, %xmm2
psubq %xmm4, %xmm0
pshufd $78, %xmm4, %xmm6
pcmpeqd %xmm4, %xmm2
subq %rax, %rbx
pand %xmm2, %xmm0
movdqa %xmm4, %xmm2
pcmpgtd %xmm7, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm5
movdqa %xmm0, %xmm2
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm5
punpckhqdq %xmm0, %xmm2
pandn %xmm5, %xmm2
movdqa %xmm2, %xmm5
pand %xmm6, %xmm2
pandn %xmm4, %xmm5
por %xmm5, %xmm2
movaps %xmm2, -128(%rbp)
call __popcountdi2@PLT
movdqa -128(%rbp), %xmm2
movdqa -80(%rbp), %xmm7
leaq -4(%r14,%rbx), %rdx
movdqa -160(%rbp), %xmm3
movdqa -96(%rbp), %xmm0
cltq
movups %xmm2, (%r12,%rbx,8)
movups %xmm2, (%r12,%rdx,8)
movdqa %xmm7, %xmm2
psubq %xmm3, %xmm0
movq %r15, %rdx
pcmpeqd %xmm3, %xmm2
pshufd $78, %xmm3, %xmm5
subq %rax, %rdx
addq %rdx, %rbx
pand %xmm2, %xmm0
movdqa %xmm3, %xmm2
pcmpgtd %xmm7, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm4
movdqa %xmm0, %xmm2
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm4
punpckhqdq %xmm0, %xmm2
pandn %xmm4, %xmm2
movdqa %xmm2, %xmm4
pand %xmm5, %xmm2
pandn %xmm3, %xmm4
por %xmm4, %xmm2
movaps %xmm2, -128(%rbp)
call __popcountdi2@PLT
movdqa -128(%rbp), %xmm2
movdqa -80(%rbp), %xmm7
movq %r15, %rdx
movdqa -176(%rbp), %xmm1
leaq -6(%r14,%rbx), %rdi
movdqa -96(%rbp), %xmm0
cltq
movups %xmm2, (%r12,%rbx,8)
subq %rax, %rdx
subq $8, %r14
movups %xmm2, (%r12,%rdi,8)
movdqa %xmm7, %xmm2
psubq %xmm1, %xmm0
pshufd $78, %xmm1, %xmm4
pcmpeqd %xmm1, %xmm2
addq %rdx, %rbx
pand %xmm2, %xmm0
movdqa %xmm1, %xmm2
pcmpgtd %xmm7, %xmm2
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm2
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm2
pandn %xmm3, %xmm2
movdqa %xmm2, %xmm3
pandn %xmm1, %xmm3
movdqa %xmm2, %xmm1
pand %xmm4, %xmm1
por %xmm3, %xmm1
movaps %xmm1, -128(%rbp)
call __popcountdi2@PLT
movdqa -128(%rbp), %xmm1
leaq (%rbx,%r14), %rdx
movq -112(%rbp), %rcx
cltq
movups %xmm1, (%r12,%rbx,8)
movups %xmm1, (%r12,%rdx,8)
movq %r15, %rdx
subq %rax, %rdx
addq %rdx, %rbx
cmpq %r13, %rcx
je .L1468
.L1322:
movq %rcx, %rax
subq %r12, %rax
sarq $3, %rax
subq %rbx, %rax
cmpq $8, %rax
ja .L1469
movdqu (%rcx), %xmm5
movdqu 16(%rcx), %xmm4
prefetcht0 256(%rcx)
addq $64, %rcx
movdqu -32(%rcx), %xmm3
movdqu -16(%rcx), %xmm1
jmp .L1321
.p2align 4,,10
.p2align 3
.L1296:
cmpq $23, %rdx
je .L1460
.L1295:
movq %rdx, %rcx
addq $1, %rdx
cmpq %rax, 0(%r13,%rdx,8)
je .L1296
movl $12, %edx
subq $11, %rcx
subq %rbx, %rdx
cmpq %rdx, %rcx
jb .L1294
.L1460:
movq 0(%r13,%rbx,8), %rax
jmp .L1294
.p2align 4,,10
.p2align 3
.L1464:
movq -216(%rbp), %rsi
movl $8, %edx
subq %rax, %rdx
leaq -8(%rax,%rsi), %r14
leaq (%rdi,%rdx,8), %r15
movq %r8, %rax
jmp .L1248
.p2align 4,,10
.p2align 3
.L1468:
movdqa -96(%rbp), %xmm2
movq -424(%rbp), %r13
leaq (%r12,%rbx,8), %rcx
leaq (%r14,%rbx), %r15
addq $2, %rbx
.L1319:
movdqa -304(%rbp), %xmm7
movdqa -80(%rbp), %xmm6
movdqa %xmm2, %xmm0
movq %rcx, -144(%rbp)
movaps %xmm2, -128(%rbp)
movdqa %xmm7, %xmm1
psubq %xmm7, %xmm0
pshufd $78, %xmm7, %xmm4
pcmpeqd %xmm6, %xmm1
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -96(%rbp)
call __popcountdi2@PLT
movdqa -96(%rbp), %xmm1
movdqa -80(%rbp), %xmm6
movdqa -320(%rbp), %xmm7
movq -144(%rbp), %rcx
cltq
movdqa -128(%rbp), %xmm2
subq %rax, %rbx
movups %xmm1, (%rcx)
pshufd $78, %xmm7, %xmm4
movups %xmm1, -16(%r12,%r15,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -96(%rbp)
call __popcountdi2@PLT
movdqa -96(%rbp), %xmm1
movdqa -80(%rbp), %xmm6
leaq -4(%r14,%rbx), %rcx
movdqa -336(%rbp), %xmm7
movdqa -128(%rbp), %xmm2
cltq
movups %xmm1, (%r12,%rbx,8)
subq %rax, %rbx
movups %xmm1, (%r12,%rcx,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
leaq 2(%rbx), %r15
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
pshufd $78, %xmm7, %xmm4
movl $2, %ebx
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -96(%rbp)
call __popcountdi2@PLT
movdqa -96(%rbp), %xmm1
movdqa -80(%rbp), %xmm6
leaq -6(%r14,%r15), %rcx
movdqa -352(%rbp), %xmm7
movdqa -128(%rbp), %xmm2
cltq
movups %xmm1, (%r12,%r15,8)
movups %xmm1, (%r12,%rcx,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
movq %rbx, %rcx
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
pshufd $78, %xmm7, %xmm4
subq %rax, %rcx
addq %rcx, %r15
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -96(%rbp)
call __popcountdi2@PLT
movdqa -96(%rbp), %xmm1
movdqa -80(%rbp), %xmm6
leaq -8(%r14,%r15), %rcx
movdqa -368(%rbp), %xmm7
movdqa -128(%rbp), %xmm2
cltq
movups %xmm1, (%r12,%r15,8)
movups %xmm1, (%r12,%rcx,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
movq %rbx, %rcx
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
pshufd $78, %xmm7, %xmm4
subq %rax, %rcx
addq %rcx, %r15
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -96(%rbp)
call __popcountdi2@PLT
movdqa -96(%rbp), %xmm1
movdqa -80(%rbp), %xmm6
leaq -10(%r14,%r15), %rcx
movdqa -384(%rbp), %xmm7
movdqa -128(%rbp), %xmm2
cltq
movups %xmm1, (%r12,%r15,8)
movups %xmm1, (%r12,%rcx,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
movq %rbx, %rcx
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
pshufd $78, %xmm7, %xmm4
subq %rax, %rcx
addq %rcx, %r15
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -96(%rbp)
call __popcountdi2@PLT
movdqa -96(%rbp), %xmm1
leaq -12(%r14,%r15), %rcx
cltq
movups %xmm1, (%r12,%r15,8)
movups %xmm1, (%r12,%rcx,8)
movdqa -128(%rbp), %xmm2
movdqa -80(%rbp), %xmm6
movq %rbx, %rcx
movdqa -400(%rbp), %xmm7
subq %rax, %rcx
movdqa %xmm2, %xmm0
addq %rcx, %r15
movdqa %xmm7, %xmm1
psubq %xmm7, %xmm0
pshufd $78, %xmm7, %xmm4
pcmpeqd %xmm6, %xmm1
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -96(%rbp)
call __popcountdi2@PLT
movdqa -96(%rbp), %xmm1
leaq -14(%r14,%r15), %rcx
movdqa -416(%rbp), %xmm7
movdqa -80(%rbp), %xmm6
movdqa -128(%rbp), %xmm2
cltq
movups %xmm1, (%r12,%r15,8)
pshufd $78, %xmm7, %xmm4
movups %xmm1, (%r12,%rcx,8)
movdqa %xmm7, %xmm1
movdqa %xmm2, %xmm0
movq %rbx, %rcx
pcmpeqd %xmm6, %xmm1
psubq %xmm7, %xmm0
subq %rax, %rcx
addq %rcx, %r15
pand %xmm1, %xmm0
movdqa %xmm7, %xmm1
pcmpgtd %xmm6, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm1
movmskpd %xmm0, %edi
punpcklqdq %xmm0, %xmm3
punpckhqdq %xmm0, %xmm1
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
pand %xmm4, %xmm1
pandn %xmm7, %xmm3
por %xmm3, %xmm1
movaps %xmm1, -96(%rbp)
call __popcountdi2@PLT
movdqa -96(%rbp), %xmm1
leaq -16(%r14,%r15), %rcx
movdqa -128(%rbp), %xmm2
cltq
movups %xmm1, (%r12,%r15,8)
subq %rax, %rbx
movups %xmm1, (%r12,%rcx,8)
movq -280(%rbp), %rcx
leaq (%rbx,%r15), %r14
leaq 0(,%r14,8), %r15
subq %r14, %rcx
.L1318:
movq -280(%rbp), %rsi
cmpq $2, %rcx
movdqa -80(%rbp), %xmm7
leaq -16(,%rsi,8), %rax
cmovnb %r15, %rax
movdqu (%r12,%rax), %xmm6
movups %xmm6, (%r12,%rsi,8)
movaps %xmm6, -96(%rbp)
movdqa -256(%rbp), %xmm6
movdqa %xmm6, %xmm0
psubq %xmm6, %xmm2
pcmpeqd %xmm7, %xmm0
movdqa %xmm2, %xmm1
pand %xmm0, %xmm1
movdqa %xmm6, %xmm0
pcmpgtd %xmm7, %xmm0
por %xmm0, %xmm1
pcmpeqd %xmm0, %xmm0
pshufd $245, %xmm1, %xmm1
pxor %xmm1, %xmm0
movaps %xmm1, -80(%rbp)
movmskpd %xmm0, %ebx
movq %rbx, %rdi
salq $4, %rbx
call __popcountdi2@PLT
movdqa -240(%rbp), %xmm0
movdqa -80(%rbp), %xmm1
cltq
movq -184(%rbp), %rsi
movdqa -256(%rbp), %xmm4
movq %rax, %xmm6
movddup %xmm6, %xmm2
movdqa -208(%rbp), %xmm6
pshufb (%rsi,%rbx), %xmm4
psubq %xmm2, %xmm0
movdqa %xmm6, %xmm3
pcmpeqd %xmm2, %xmm3
pcmpgtd %xmm6, %xmm2
pand %xmm3, %xmm0
por %xmm2, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rcx
testq %rcx, %rcx
je .L1324
movq %xmm4, (%r12,%r15)
.L1324:
movhlps %xmm0, %xmm6
movq %xmm6, %rcx
testq %rcx, %rcx
je .L1325
movhps %xmm4, 8(%r12,%r15)
.L1325:
movmskpd %xmm1, %r15d
addq %rax, %r14
movq %r15, %rdi
salq $4, %r15
leaq 0(,%r14,8), %rbx
call __popcountdi2@PLT
movdqa -208(%rbp), %xmm6
movdqa -240(%rbp), %xmm0
cltq
movq -184(%rbp), %rsi
movdqa -256(%rbp), %xmm2
movq %rax, %xmm1
movdqa %xmm6, %xmm3
punpcklqdq %xmm1, %xmm1
pshufb (%rsi,%r15), %xmm2
pcmpeqd %xmm1, %xmm3
psubq %xmm1, %xmm0
pcmpgtd %xmm6, %xmm1
pand %xmm3, %xmm0
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L1326
movq %xmm2, (%r12,%r14,8)
.L1326:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
je .L1327
movhps %xmm2, 8(%r12,%rbx)
.L1327:
movq -288(%rbp), %rbx
addq %r14, %rbx
movq -224(%rbp), %r14
subq $1, %r14
cmpl $2, -268(%rbp)
je .L1329
movq -192(%rbp), %r8
movq %r14, %r9
movq %r13, %rcx
movq %rbx, %rdx
movq -264(%rbp), %rsi
movq -104(%rbp), %rdi
call _ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -268(%rbp)
je .L1236
.L1329:
movq -216(%rbp), %rdx
movq -104(%rbp), %rax
movq %r14, %r9
movq %r13, %rcx
movq -192(%rbp), %r8
movq -264(%rbp), %rsi
subq %rbx, %rdx
leaq (%rax,%rbx,8), %rdi
call _ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1236:
addq $392, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1310:
.cfi_restore_state
movq (%rax), %rcx
leaq 8(%r12), %rdi
andq $-8, %rdi
movq %rcx, (%r12)
movl %r8d, %ecx
movq -8(%rax,%rcx), %rsi
movq %rsi, -8(%r12,%rcx)
movq %r12, %rcx
movq %rax, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r8d, %ecx
shrl $3, %ecx
rep movsq
cmpl $8, %r8d
jb .L1470
.L1314:
movq 0(%r13), %rcx
leaq 8(%rax), %rdi
andq $-8, %rdi
movq %rcx, (%rax)
movl %r8d, %ecx
movq -8(%r13,%rcx), %rsi
movq %rsi, -8(%rax,%rcx)
subq %rdi, %rax
movq %r13, %rsi
leal (%r8,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
jmp .L1315
.L1467:
movzbl 0(%r13), %ecx
movb %cl, (%rax)
jmp .L1315
.L1466:
movzbl (%rax), %ecx
movb %cl, (%r12)
jmp .L1311
.L1463:
cmpq $1, %rdx
jbe .L1236
leaq 256(%rdi), %rax
cmpq %rax, %rsi
jb .L1240
movl $2, %esi
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L1236
.L1251:
movq %r10, %rax
movl $2, %edi
movdqa .LC1(%rip), %xmm7
movdqa %xmm2, %xmm5
andl $1, %eax
subq %rax, %rdi
movq -104(%rbp), %rax
movaps %xmm7, -208(%rbp)
movdqu (%rax), %xmm6
movaps %xmm6, -80(%rbp)
movq %rdi, %xmm6
movdqa -80(%rbp), %xmm0
movddup %xmm6, %xmm3
movdqa .LC0(%rip), %xmm6
pcmpeqd %xmm2, %xmm0
movdqa %xmm6, %xmm1
movaps %xmm6, -240(%rbp)
movdqa %xmm7, %xmm6
pcmpeqd %xmm3, %xmm6
psubq %xmm3, %xmm1
pcmpgtd %xmm7, %xmm3
pshufd $177, %xmm0, %xmm4
pand %xmm4, %xmm0
pand %xmm6, %xmm1
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
pandn %xmm1, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1471
movq -104(%rbp), %rax
pxor %xmm1, %xmm1
movq -216(%rbp), %r8
pxor %xmm6, %xmm6
movdqa %xmm1, %xmm0
leaq 256(%rax,%rdi,8), %rsi
.p2align 4,,10
.p2align 3
.L1257:
movq %rdi, %rcx
leaq 32(%rdi), %rdi
cmpq %rdi, %r8
jb .L1472
leaq -256(%rsi), %rax
.L1256:
movdqa (%rax), %xmm3
leaq 32(%rax), %rdx
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 16(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm1
movdqa 32(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 48(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm1
movdqa 64(%rax), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 80(%rax), %xmm3
leaq 96(%rdx), %rax
pxor %xmm2, %xmm3
por %xmm3, %xmm1
movdqa 64(%rdx), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm0
movdqa 80(%rdx), %xmm3
pxor %xmm2, %xmm3
por %xmm3, %xmm1
cmpq %rsi, %rax
jne .L1256
movdqa %xmm0, %xmm3
leaq 352(%rdx), %rsi
por %xmm1, %xmm3
pcmpeqd %xmm6, %xmm3
pshufd $177, %xmm3, %xmm4
pand %xmm4, %xmm3
movmskpd %xmm3, %eax
cmpl $3, %eax
je .L1257
movq -104(%rbp), %rax
movdqa %xmm5, %xmm0
pcmpeqd %xmm3, %xmm3
movq -104(%rbp), %rdx
pcmpeqd (%rax,%rcx,8), %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
pxor %xmm3, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1259
.p2align 4,,10
.p2align 3
.L1258:
addq $2, %rcx
movdqa %xmm5, %xmm0
pcmpeqd (%rdx,%rcx,8), %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
pxor %xmm3, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
je .L1258
.L1259:
rep bsfl %eax, %eax
cltq
addq %rcx, %rax
.L1255:
movq -104(%rbp), %rsi
movdqa %xmm5, %xmm3
movdqa %xmm2, %xmm0
leaq (%rsi,%rax,8), %rdi
movq (%rdi), %rbx
movq %rbx, %xmm6
movddup %xmm6, %xmm1
pcmpeqd %xmm1, %xmm3
psubq %xmm1, %xmm0
movaps %xmm1, -96(%rbp)
pand %xmm3, %xmm0
movdqa %xmm1, %xmm3
pcmpgtd %xmm5, %xmm3
por %xmm3, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %edx
testl %edx, %edx
jne .L1264
movq -216(%rbp), %rax
xorl %r15d, %r15d
movaps %xmm5, -80(%rbp)
movq %r12, -176(%rbp)
leaq -2(%rax), %r14
movq %rax, %r12
movq %r13, %rax
movq %rbx, -144(%rbp)
movq %r15, %r13
movaps %xmm1, -160(%rbp)
movq %rsi, %rbx
movq %rax, %r15
movaps %xmm2, -128(%rbp)
jmp .L1271
.p2align 4,,10
.p2align 3
.L1265:
movdqa -128(%rbp), %xmm6
movmskpd %xmm0, %edi
movups %xmm6, (%rbx,%r14,8)
call __popcountdi2@PLT
cltq
addq %rax, %r13
leaq -2(%r14), %rax
cmpq %rax, %r12
jbe .L1473
movq %rax, %r14
.L1271:
movdqu (%rbx,%r14,8), %xmm0
pcmpeqd -96(%rbp), %xmm0
pshufd $177, %xmm0, %xmm1
movdqa %xmm0, %xmm3
movdqu (%rbx,%r14,8), %xmm0
pand %xmm1, %xmm3
pcmpeqd -80(%rbp), %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
movdqa %xmm3, %xmm1
por %xmm0, %xmm1
movmskpd %xmm1, %eax
cmpl $3, %eax
je .L1265
pcmpeqd %xmm4, %xmm4
movq %r15, %rax
movq %r13, %r15
movq -104(%rbp), %rcx
pxor %xmm4, %xmm0
movq %rax, %r13
leaq 2(%r14), %rdx
movdqa -80(%rbp), %xmm5
pandn %xmm0, %xmm3
movq -144(%rbp), %rbx
movdqa -128(%rbp), %xmm2
movmskpd %xmm3, %eax
movdqa -160(%rbp), %xmm1
rep bsfl %eax, %eax
cltq
addq %r14, %rax
addq $4, %r14
movddup (%rcx,%rax,8), %xmm3
movq -216(%rbp), %rax
movaps %xmm3, -64(%rbp)
subq %r15, %rax
cmpq %r14, %rax
jb .L1266
.p2align 4,,10
.p2align 3
.L1267:
movups %xmm1, -16(%rcx,%r14,8)
movq %r14, %rdx
addq $2, %r14
cmpq %rax, %r14
jbe .L1267
.L1266:
movdqa -208(%rbp), %xmm7
subq %rdx, %rax
movdqa -240(%rbp), %xmm4
leaq 0(,%rdx,8), %rcx
movq %rax, %xmm0
punpcklqdq %xmm0, %xmm0
movdqa %xmm7, %xmm6
pcmpeqd %xmm0, %xmm6
psubq %xmm0, %xmm4
pcmpgtd %xmm7, %xmm0
pand %xmm6, %xmm4
por %xmm4, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L1275
movq -104(%rbp), %rax
movq %rbx, (%rax,%rdx,8)
.L1275:
movhlps %xmm0, %xmm6
movq %xmm6, %rax
testq %rax, %rax
je .L1270
movq -104(%rbp), %rax
movq %rbx, 8(%rax,%rcx)
.L1270:
movdqa %xmm5, %xmm0
pcmpeqd .LC5(%rip), %xmm0
pshufd $177, %xmm0, %xmm4
pand %xmm4, %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
je .L1347
movdqa %xmm5, %xmm0
pcmpeqd .LC6(%rip), %xmm0
pshufd $177, %xmm0, %xmm4
pand %xmm4, %xmm0
movmskpd %xmm0, %eax
movl %eax, -268(%rbp)
cmpl $3, %eax
je .L1474
movdqa %xmm1, %xmm4
movdqa %xmm1, %xmm0
movdqa %xmm1, %xmm6
pcmpeqd %xmm3, %xmm4
psubq %xmm3, %xmm0
pand %xmm4, %xmm0
movdqa %xmm3, %xmm4
pcmpgtd %xmm1, %xmm4
por %xmm4, %xmm0
pshufd $245, %xmm0, %xmm0
movdqa %xmm0, %xmm4
pand %xmm0, %xmm6
pandn %xmm3, %xmm4
por %xmm4, %xmm6
movdqa %xmm6, %xmm7
movdqa %xmm6, %xmm4
pcmpeqd %xmm5, %xmm7
psubq %xmm2, %xmm4
pand %xmm7, %xmm4
movdqa %xmm5, %xmm7
pcmpgtd %xmm6, %xmm7
por %xmm7, %xmm4
pshufd $245, %xmm4, %xmm4
movmskpd %xmm4, %eax
testl %eax, %eax
jne .L1475
movdqa %xmm2, %xmm0
movl $32, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1281:
movq -104(%rbp), %rdi
leaq (%rcx,%rax,2), %rdx
movdqa %xmm0, %xmm1
addq $1, %rax
movdqu (%rdi,%rdx,8), %xmm3
movdqa %xmm3, %xmm4
psubq %xmm3, %xmm1
pcmpeqd %xmm0, %xmm4
pand %xmm4, %xmm1
movdqa %xmm3, %xmm4
pcmpgtd %xmm0, %xmm4
por %xmm4, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm4
pand %xmm0, %xmm1
pandn %xmm3, %xmm4
por %xmm4, %xmm1
movdqa %xmm1, %xmm0
cmpq $16, %rax
jne .L1281
movdqa %xmm1, %xmm3
psubq %xmm2, %xmm1
pcmpeqd %xmm5, %xmm3
pand %xmm3, %xmm1
movdqa %xmm5, %xmm3
pcmpgtd %xmm0, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movmskpd %xmm1, %eax
testl %eax, %eax
jne .L1461
leaq 32(%rsi), %rax
cmpq %rax, -216(%rbp)
jb .L1476
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1281
.L1359:
movdqa .LC0(%rip), %xmm6
leaq _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices(%rip), %rsi
xorl %r8d, %r8d
xorl %r14d, %r14d
movq %rsi, -184(%rbp)
movaps %xmm6, -240(%rbp)
movdqa .LC1(%rip), %xmm6
movaps %xmm6, -208(%rbp)
jmp .L1299
.L1361:
movq %r9, %r15
movq %r12, %rcx
movl $2, %ebx
jmp .L1319
.L1360:
movq %r15, %rcx
xorl %r15d, %r15d
jmp .L1318
.L1465:
movq -216(%rbp), %rsi
movq -104(%rbp), %rdi
leaq -1(%rsi), %rbx
movq %rbx, %r13
shrq %r13
.p2align 4,,10
.p2align 3
.L1297:
movq %r13, %rdx
call _ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %r13
jnb .L1297
.p2align 4,,10
.p2align 3
.L1298:
movq (%rdi,%rbx,8), %rdx
movq (%rdi), %rax
movq %rbx, %rsi
movq %rdx, (%rdi)
xorl %edx, %edx
movq %rax, (%rdi,%rbx,8)
call _ZN3hwy7N_SSSE36detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L1298
jmp .L1236
.L1349:
movl $12, %edx
movl $11, %ebx
jmp .L1295
.L1350:
movl $9, %ebx
movl $10, %edx
jmp .L1295
.L1351:
movl $9, %edx
jmp .L1295
.L1352:
movl $8, %edx
movl $7, %ebx
jmp .L1295
.L1353:
movl $6, %ebx
movl $7, %edx
jmp .L1295
.L1472:
movq -104(%rbp), %rdi
movq -216(%rbp), %rsi
pcmpeqd %xmm3, %xmm3
.p2align 4,,10
.p2align 3
.L1261:
movq %rcx, %rdx
addq $2, %rcx
cmpq %rcx, %rsi
jb .L1477
movdqa %xmm5, %xmm0
pcmpeqd -16(%rdi,%rcx,8), %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
pxor %xmm3, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
je .L1261
.L1458:
rep bsfl %eax, %eax
cltq
addq %rdx, %rax
jmp .L1255
.L1354:
movl $5, %ebx
movl $6, %edx
jmp .L1295
.L1355:
movl $4, %ebx
movl $5, %edx
jmp .L1295
.L1264:
leaq -64(%rbp), %rdx
movq %r13, %rcx
movdqa %xmm2, %xmm0
movaps %xmm1, -80(%rbp)
movq -216(%rbp), %rsi
subq %rax, %rsi
call _ZN3hwy7N_SSSE36detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1236
movddup 0(%r13), %xmm2
movdqa -64(%rbp), %xmm3
movdqa -80(%rbp), %xmm1
movdqa %xmm2, %xmm5
jmp .L1270
.L1356:
movl $3, %ebx
movl $4, %edx
jmp .L1295
.L1357:
movl $2, %ebx
movl $3, %edx
jmp .L1295
.L1358:
movl $1, %ebx
movl $2, %edx
jmp .L1295
.L1473:
movq %r14, %xmm6
movq %r15, %rax
movq %r13, %r15
movdqa -240(%rbp), %xmm3
movddup %xmm6, %xmm0
movq %rax, %r13
movdqa -208(%rbp), %xmm6
movq -104(%rbp), %rax
psubq %xmm0, %xmm3
movdqa -80(%rbp), %xmm5
movdqa -160(%rbp), %xmm1
movdqa %xmm6, %xmm4
movq -216(%rbp), %rdx
movq -176(%rbp), %r12
pcmpeqd %xmm0, %xmm4
pcmpgtd %xmm6, %xmm0
movdqu (%rax), %xmm6
movq -144(%rbp), %rbx
movdqa -128(%rbp), %xmm2
subq %r15, %rdx
movaps %xmm6, -80(%rbp)
movdqa -80(%rbp), %xmm6
pand %xmm4, %xmm3
pcmpeqd %xmm5, %xmm6
por %xmm0, %xmm3
movdqa -80(%rbp), %xmm0
pshufd $245, %xmm3, %xmm3
pcmpeqd %xmm1, %xmm0
pshufd $177, %xmm6, %xmm4
pand %xmm3, %xmm4
pand %xmm6, %xmm4
pshufd $177, %xmm0, %xmm7
pcmpeqd %xmm6, %xmm6
pand %xmm7, %xmm0
pxor %xmm6, %xmm3
por %xmm3, %xmm0
por %xmm4, %xmm0
movmskpd %xmm0, %eax
cmpl $3, %eax
jne .L1478
movmskpd %xmm4, %edi
movaps %xmm2, -96(%rbp)
movaps %xmm1, -80(%rbp)
movq %rdx, -128(%rbp)
call __popcountdi2@PLT
movq -104(%rbp), %rsi
movdqa -96(%rbp), %xmm2
movslq %eax, %rcx
movq -128(%rbp), %rax
movdqa -80(%rbp), %xmm1
movups %xmm2, (%rsi)
subq %rcx, %rax
cmpq $1, %rax
jbe .L1336
leaq -2(%rax), %rcx
movq %rcx, %rdx
shrq %rdx
salq $4, %rdx
leaq 16(%rsi,%rdx), %rdx
.L1278:
movups %xmm1, (%r12)
addq $16, %r12
cmpq %rdx, %r12
jne .L1278
andq $-2, %rcx
movq %rcx, %rdx
addq $2, %rdx
leaq 0(,%rdx,8), %rcx
subq %rdx, %rax
.L1277:
movaps %xmm1, 0(%r13)
testq %rax, %rax
je .L1236
movq -104(%rbp), %rdi
leaq 0(,%rax,8), %rdx
movq %r13, %rsi
addq %rcx, %rdi
call memcpy@PLT
jmp .L1236
.L1476:
movq -216(%rbp), %rcx
movq %rdi, %rdx
jmp .L1288
.L1289:
movdqu -16(%rdx,%rsi,8), %xmm1
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm0
pcmpeqd %xmm5, %xmm3
psubq %xmm2, %xmm0
pand %xmm3, %xmm0
movdqa %xmm5, %xmm3
pcmpgtd %xmm1, %xmm3
por %xmm3, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1461
.L1288:
movq %rsi, %rax
addq $2, %rsi
cmpq %rsi, %rcx
jnb .L1289
movq -216(%rbp), %rsi
cmpq %rax, %rsi
je .L1347
movq -104(%rbp), %rax
movdqu -16(%rax,%rsi,8), %xmm1
movdqa %xmm1, %xmm3
movdqa %xmm1, %xmm0
pcmpeqd %xmm5, %xmm3
pcmpgtd %xmm1, %xmm5
psubq %xmm2, %xmm0
pand %xmm3, %xmm0
por %xmm5, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %eax
cmpl $1, %eax
movl $1, %eax
adcl $0, %eax
movl %eax, -268(%rbp)
jmp .L1290
.L1292:
movl $11, %edx
movl $10, %ebx
jmp .L1295
.L1477:
movq -216(%rbp), %rax
leaq -2(%rax), %rdx
movq -104(%rbp), %rax
movdqu (%rax,%rdx,8), %xmm6
movaps %xmm6, -80(%rbp)
movdqa -80(%rbp), %xmm0
pcmpeqd %xmm5, %xmm0
pshufd $177, %xmm0, %xmm1
pand %xmm1, %xmm0
pcmpeqd %xmm1, %xmm1
pxor %xmm1, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
je .L1236
jmp .L1458
.L1471:
rep bsfl %eax, %eax
cltq
jmp .L1255
.L1240:
movq %rdx, %r10
leaq -2(%rdx), %rdx
movq -104(%rbp), %r11
leaq 8(%rcx), %rdi
movq %rdx, %rbx
andq $-8, %rdi
andq $-2, %rdx
movq %r10, %r12
shrq %rbx
movq (%r11), %rax
movq %r11, %rsi
addq $1, %rbx
salq $4, %rbx
movq %rax, (%rcx)
movl %ebx, %r8d
leaq 8(%r11,%r8), %r15
leaq 8(%rcx,%r8), %r14
movq -16(%r15), %rax
movq %rax, -16(%r14)
movq %rcx, %rax
subq %rdi, %rax
subq %rax, %rsi
leal (%rbx,%rax), %ecx
leaq 2(%rdx), %rax
shrl $3, %ecx
rep movsq
movq %rax, -80(%rbp)
movq %r10, -216(%rbp)
subq %rax, %r12
je .L1241
salq $3, %rax
leaq 0(,%r12,8), %rdx
movq %r8, -96(%rbp)
leaq (%r11,%rax), %rsi
leaq 0(%r13,%rax), %rdi
call memcpy@PLT
movq -216(%rbp), %r10
movl $32, %ecx
movq -96(%rbp), %r8
movl %r10d, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rax
salq $4, %rax
addq $2, %rax
cmpq %rax, %r10
jnb .L1479
.L1242:
movdqa .LC4(%rip), %xmm0
movq -216(%rbp), %rdx
.L1246:
movups %xmm0, 0(%r13,%rdx,8)
addq $2, %rdx
cmpq %rax, %rdx
jb .L1246
movq %r13, %rdi
movq %r8, -96(%rbp)
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -104(%rbp), %rsi
movq 0(%r13), %rax
movq %rax, (%rsi)
movq -96(%rbp), %r8
leaq 8(%rsi), %rdi
andq $-8, %rdi
movq -8(%r13,%r8), %rax
movq %rax, -8(%rsi,%r8)
movq %rsi, %rax
movq %r13, %rsi
subq %rdi, %rax
leal (%rbx,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
testq %r12, %r12
je .L1236
.L1244:
movq -80(%rbp), %rax
movq -104(%rbp), %rdi
leaq 0(,%r12,8), %rdx
salq $3, %rax
addq %rax, %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
jmp .L1236
.L1347:
movl $2, -268(%rbp)
jmp .L1290
.L1474:
pcmpeqd %xmm0, %xmm0
paddq %xmm0, %xmm2
jmp .L1290
.L1475:
movdqa %xmm0, %xmm4
pand %xmm3, %xmm0
pandn %xmm1, %xmm4
movdqa %xmm2, %xmm1
por %xmm4, %xmm0
movdqa %xmm0, %xmm3
psubq %xmm0, %xmm1
pcmpeqd %xmm5, %xmm3
pcmpgtd %xmm5, %xmm0
pand %xmm3, %xmm1
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1461
movdqa %xmm2, %xmm0
movl $32, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1282:
movq -104(%rbp), %rdi
leaq (%rcx,%rax,2), %rdx
movdqa %xmm0, %xmm1
addq $1, %rax
movdqu (%rdi,%rdx,8), %xmm3
movdqa %xmm3, %xmm4
psubq %xmm3, %xmm1
pcmpeqd %xmm0, %xmm4
pand %xmm4, %xmm1
movdqa %xmm3, %xmm4
pcmpgtd %xmm0, %xmm4
por %xmm4, %xmm1
pshufd $245, %xmm1, %xmm1
movdqa %xmm1, %xmm4
pand %xmm1, %xmm3
pandn %xmm0, %xmm4
por %xmm4, %xmm3
movdqa %xmm3, %xmm0
cmpq $16, %rax
jne .L1282
pcmpeqd %xmm5, %xmm3
movdqa %xmm2, %xmm1
psubq %xmm0, %xmm1
pand %xmm3, %xmm1
movdqa %xmm0, %xmm3
pcmpgtd %xmm5, %xmm3
por %xmm3, %xmm1
pshufd $245, %xmm1, %xmm1
movmskpd %xmm1, %eax
testl %eax, %eax
jne .L1461
leaq 32(%rsi), %rax
cmpq %rax, -216(%rbp)
jb .L1480
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1282
.L1241:
movq -216(%rbp), %rdi
movl $32, %ecx
movl %edi, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rax
salq $4, %rax
addq $2, %rax
cmpq %rax, %rdi
jb .L1242
movq %r13, %rdi
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -104(%rbp), %rsi
movq 0(%r13), %rax
movq %rax, (%rsi)
movq -16(%r14), %rax
leaq 8(%rsi), %rdi
andq $-8, %rdi
movq %rax, -16(%r15)
movq %rsi, %rax
movq %r13, %rsi
subq %rdi, %rax
leal (%rbx,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
jmp .L1236
.p2align 4,,10
.p2align 3
.L1336:
xorl %ecx, %ecx
jmp .L1277
.L1478:
pxor %xmm6, %xmm0
movq -104(%rbp), %rsi
movmskpd %xmm0, %eax
rep bsfl %eax, %eax
cltq
movddup (%rsi,%rax,8), %xmm3
leaq 2(%r14), %rax
movaps %xmm3, -64(%rbp)
cmpq %rdx, %rax
ja .L1273
.L1274:
movq -104(%rbp), %rsi
movq %rax, %r14
movups %xmm1, -16(%rsi,%rax,8)
addq $2, %rax
cmpq %rdx, %rax
jbe .L1274
.L1273:
movq %rdx, %rax
movdqa -208(%rbp), %xmm7
movdqa -240(%rbp), %xmm0
leaq 0(,%r14,8), %rcx
subq %r14, %rax
movq %rax, %xmm6
movddup %xmm6, %xmm4
movdqa %xmm7, %xmm6
pcmpeqd %xmm4, %xmm6
psubq %xmm4, %xmm0
pcmpgtd %xmm7, %xmm4
pand %xmm6, %xmm0
por %xmm4, %xmm0
pshufd $245, %xmm0, %xmm0
movq %xmm0, %rax
testq %rax, %rax
je .L1275
movq -104(%rbp), %rax
movq %rbx, (%rax,%r14,8)
jmp .L1275
.L1480:
movq %rdi, %rdx
jmp .L1284
.L1285:
movdqu -16(%rdx,%rsi,8), %xmm1
movdqa %xmm2, %xmm0
movdqa %xmm1, %xmm3
psubq %xmm1, %xmm0
pcmpeqd %xmm5, %xmm3
pcmpgtd %xmm5, %xmm1
pand %xmm3, %xmm0
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1461
.L1284:
movq %rsi, %rax
addq $2, %rsi
cmpq %rsi, -216(%rbp)
jnb .L1285
movq -216(%rbp), %rsi
cmpq %rax, %rsi
je .L1286
movq -104(%rbp), %rax
movdqa %xmm2, %xmm0
movdqu -16(%rax,%rsi,8), %xmm1
movdqa %xmm1, %xmm3
psubq %xmm1, %xmm0
pcmpeqd %xmm5, %xmm3
pcmpgtd %xmm5, %xmm1
pand %xmm3, %xmm0
por %xmm1, %xmm0
pshufd $245, %xmm0, %xmm0
movmskpd %xmm0, %eax
testl %eax, %eax
jne .L1461
.L1286:
movl $3, -268(%rbp)
pcmpeqd %xmm0, %xmm0
paddq %xmm0, %xmm2
jmp .L1290
.L1479:
movq %r13, %rdi
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -104(%rbp), %rsi
movq 0(%r13), %rax
movq %rax, (%rsi)
movq -16(%r14), %rax
leaq 8(%rsi), %rdi
andq $-8, %rdi
movq %rax, -16(%r15)
movq %rsi, %rax
movq %r13, %rsi
subq %rdi, %rax
leal (%rbx,%rax), %ecx
subq %rax, %rsi
shrl $3, %ecx
rep movsq
jmp .L1244
.cfi_endproc
.LFE18805:
.size _ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text._ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, @function
_ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0:
.LFB18807:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsi, %rax
movq %rdi, %rdx
salq $3, %rax
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
.cfi_offset 15, -24
leaq (%rdi,%rax), %r15
pushq %r14
.cfi_offset 14, -32
leaq (%r15,%rax), %r14
pushq %r13
.cfi_offset 13, -40
leaq (%r14,%rax), %r13
pushq %r12
.cfi_offset 12, -48
leaq 0(%r13,%rax), %r12
pushq %rbx
.cfi_offset 3, -56
leaq (%r12,%rax), %rbx
leaq (%rbx,%rax), %r11
leaq (%r11,%rax), %r10
andq $-32, %rsp
leaq (%r10,%rax), %r9
subq $392, %rsp
leaq (%r9,%rax), %r8
movq %rsi, 192(%rsp)
vmovdqu (%rdi), %ymm3
vmovdqu (%r15), %ymm14
leaq (%r8,%rax), %rdi
vmovdqu 0(%r13), %ymm11
vmovdqu (%r14), %ymm4
leaq (%rdi,%rax), %rsi
vpcmpgtq %ymm3, %ymm14, %ymm15
vmovdqu (%rbx), %ymm12
vmovdqu (%r12), %ymm1
leaq (%rsi,%rax), %rcx
vmovdqu (%r10), %ymm9
vmovdqu (%r11), %ymm2
movq %rcx, 184(%rsp)
vmovdqu (%r9), %ymm8
vmovdqu (%r8), %ymm10
vpblendvb %ymm15, %ymm3, %ymm14, %ymm13
vpblendvb %ymm15, %ymm14, %ymm3, %ymm3
vmovdqu (%rsi), %ymm7
vmovdqu (%rdi), %ymm0
vpcmpgtq %ymm4, %ymm11, %ymm15
vmovdqu (%rcx), %ymm5
addq %rax, %rcx
movq %rcx, 176(%rsp)
vmovdqa %ymm5, 360(%rsp)
vmovdqu (%rcx), %ymm5
addq %rax, %rcx
vpblendvb %ymm15, %ymm4, %ymm11, %ymm14
vpblendvb %ymm15, %ymm11, %ymm4, %ymm4
addq %rcx, %rax
vpcmpgtq %ymm1, %ymm12, %ymm15
vmovdqu (%rax), %ymm6
vpblendvb %ymm15, %ymm1, %ymm12, %ymm11
vpblendvb %ymm15, %ymm12, %ymm1, %ymm1
vpcmpgtq %ymm2, %ymm9, %ymm15
vpblendvb %ymm15, %ymm2, %ymm9, %ymm12
vpblendvb %ymm15, %ymm9, %ymm2, %ymm2
vpcmpgtq %ymm8, %ymm10, %ymm15
vpblendvb %ymm15, %ymm8, %ymm10, %ymm9
vpblendvb %ymm15, %ymm10, %ymm8, %ymm15
vmovdqa %ymm15, 328(%rsp)
vpcmpgtq %ymm0, %ymm7, %ymm8
vmovdqa 360(%rsp), %ymm15
vpblendvb %ymm8, %ymm0, %ymm7, %ymm10
vpblendvb %ymm8, %ymm7, %ymm0, %ymm0
vpcmpgtq %ymm15, %ymm5, %ymm8
vpblendvb %ymm8, %ymm15, %ymm5, %ymm7
vpblendvb %ymm8, %ymm5, %ymm15, %ymm5
vmovdqa %ymm5, 360(%rsp)
vpcmpgtq (%rcx), %ymm6, %ymm5
vpblendvb %ymm5, (%rcx), %ymm6, %ymm8
vmovdqu (%rcx), %ymm15
cmpq $1, 192(%rsp)
vpblendvb %ymm5, %ymm6, %ymm15, %ymm5
vpcmpgtq %ymm13, %ymm14, %ymm15
vpblendvb %ymm15, %ymm13, %ymm14, %ymm6
vpblendvb %ymm15, %ymm14, %ymm13, %ymm15
vpcmpgtq %ymm3, %ymm4, %ymm14
vpblendvb %ymm14, %ymm3, %ymm4, %ymm13
vpblendvb %ymm14, %ymm4, %ymm3, %ymm14
vpcmpgtq %ymm11, %ymm12, %ymm4
vpblendvb %ymm4, %ymm11, %ymm12, %ymm3
vpblendvb %ymm4, %ymm12, %ymm11, %ymm4
vpcmpgtq %ymm1, %ymm2, %ymm12
vpblendvb %ymm12, %ymm1, %ymm2, %ymm11
vpblendvb %ymm12, %ymm2, %ymm1, %ymm1
vpcmpgtq %ymm9, %ymm10, %ymm12
vpblendvb %ymm12, %ymm9, %ymm10, %ymm2
vpblendvb %ymm12, %ymm10, %ymm9, %ymm10
vmovdqa 328(%rsp), %ymm12
vmovdqa %ymm10, 296(%rsp)
vpcmpgtq %ymm12, %ymm0, %ymm10
vpblendvb %ymm10, %ymm12, %ymm0, %ymm9
vpblendvb %ymm10, %ymm0, %ymm12, %ymm0
vmovdqa 360(%rsp), %ymm12
vmovdqa %ymm0, 328(%rsp)
vpcmpgtq %ymm7, %ymm8, %ymm0
vpblendvb %ymm0, %ymm7, %ymm8, %ymm10
vpblendvb %ymm0, %ymm8, %ymm7, %ymm7
vpcmpgtq %ymm12, %ymm5, %ymm0
vpblendvb %ymm0, %ymm12, %ymm5, %ymm8
vpblendvb %ymm0, %ymm5, %ymm12, %ymm0
vpcmpgtq %ymm6, %ymm3, %ymm12
vpblendvb %ymm12, %ymm6, %ymm3, %ymm5
vpblendvb %ymm12, %ymm3, %ymm6, %ymm12
vpcmpgtq %ymm13, %ymm11, %ymm6
vpblendvb %ymm6, %ymm13, %ymm11, %ymm3
vpblendvb %ymm6, %ymm11, %ymm13, %ymm13
vpcmpgtq %ymm15, %ymm4, %ymm11
vpblendvb %ymm11, %ymm15, %ymm4, %ymm6
vpblendvb %ymm11, %ymm4, %ymm15, %ymm15
vpcmpgtq %ymm14, %ymm1, %ymm11
vpblendvb %ymm11, %ymm14, %ymm1, %ymm4
vpblendvb %ymm11, %ymm1, %ymm14, %ymm1
vmovdqa 296(%rsp), %ymm14
vmovdqa %ymm1, 264(%rsp)
vpcmpgtq %ymm2, %ymm10, %ymm1
vpblendvb %ymm1, %ymm2, %ymm10, %ymm11
vpblendvb %ymm1, %ymm10, %ymm2, %ymm2
vpcmpgtq %ymm9, %ymm8, %ymm1
vpblendvb %ymm1, %ymm9, %ymm8, %ymm10
vpblendvb %ymm1, %ymm8, %ymm9, %ymm8
vpcmpgtq %ymm14, %ymm7, %ymm1
vpblendvb %ymm1, %ymm14, %ymm7, %ymm9
vpblendvb %ymm1, %ymm7, %ymm14, %ymm7
vmovdqa %ymm7, 360(%rsp)
vmovdqa 328(%rsp), %ymm7
vpcmpgtq %ymm7, %ymm0, %ymm14
vpblendvb %ymm14, %ymm7, %ymm0, %ymm1
vpblendvb %ymm14, %ymm0, %ymm7, %ymm0
vpcmpgtq %ymm5, %ymm11, %ymm14
vpblendvb %ymm14, %ymm5, %ymm11, %ymm7
vpblendvb %ymm14, %ymm11, %ymm5, %ymm14
vpcmpgtq %ymm3, %ymm10, %ymm5
vmovdqa %ymm7, 40(%rsp)
vmovdqa %ymm7, 328(%rsp)
vpblendvb %ymm5, %ymm3, %ymm10, %ymm7
vpblendvb %ymm5, %ymm10, %ymm3, %ymm3
vmovdqa %ymm7, 296(%rsp)
vpcmpgtq %ymm6, %ymm9, %ymm10
vpblendvb %ymm10, %ymm6, %ymm9, %ymm5
vpblendvb %ymm10, %ymm9, %ymm6, %ymm6
vpcmpgtq %ymm4, %ymm1, %ymm10
vpblendvb %ymm10, %ymm4, %ymm1, %ymm9
vpblendvb %ymm10, %ymm1, %ymm4, %ymm4
vmovdqa 360(%rsp), %ymm1
vpcmpgtq %ymm12, %ymm2, %ymm10
vpblendvb %ymm10, %ymm12, %ymm2, %ymm7
vpblendvb %ymm10, %ymm2, %ymm12, %ymm10
vpcmpgtq %ymm15, %ymm1, %ymm12
vpcmpgtq %ymm13, %ymm8, %ymm2
vmovdqa 360(%rsp), %ymm1
vpblendvb %ymm2, %ymm13, %ymm8, %ymm11
vpblendvb %ymm2, %ymm8, %ymm13, %ymm2
vpblendvb %ymm12, %ymm15, %ymm1, %ymm8
vpblendvb %ymm12, %ymm1, %ymm15, %ymm1
vmovdqa 264(%rsp), %ymm15
vpcmpgtq %ymm15, %ymm0, %ymm13
vpblendvb %ymm13, %ymm15, %ymm0, %ymm12
vpblendvb %ymm13, %ymm0, %ymm15, %ymm0
vmovdqa 296(%rsp), %ymm15
vmovdqa %ymm0, 136(%rsp)
vpcmpgtq %ymm11, %ymm6, %ymm13
vpblendvb %ymm13, %ymm11, %ymm6, %ymm0
vpblendvb %ymm13, %ymm6, %ymm11, %ymm6
vpcmpgtq %ymm8, %ymm3, %ymm13
vpblendvb %ymm13, %ymm8, %ymm3, %ymm11
vpblendvb %ymm13, %ymm3, %ymm8, %ymm8
vpcmpgtq %ymm9, %ymm10, %ymm3
vpblendvb %ymm3, %ymm9, %ymm10, %ymm13
vpblendvb %ymm3, %ymm10, %ymm9, %ymm9
vpcmpgtq %ymm12, %ymm4, %ymm10
vpblendvb %ymm10, %ymm12, %ymm4, %ymm3
vpblendvb %ymm10, %ymm4, %ymm12, %ymm4
vpcmpgtq %ymm2, %ymm1, %ymm12
vpblendvb %ymm12, %ymm2, %ymm1, %ymm10
vpblendvb %ymm12, %ymm1, %ymm2, %ymm2
vpcmpgtq %ymm7, %ymm14, %ymm1
vpblendvb %ymm1, %ymm7, %ymm14, %ymm12
vpblendvb %ymm1, %ymm14, %ymm7, %ymm14
vpcmpgtq %ymm15, %ymm5, %ymm7
vpblendvb %ymm7, %ymm15, %ymm5, %ymm1
vpblendvb %ymm7, %ymm5, %ymm15, %ymm5
vpcmpgtq %ymm1, %ymm12, %ymm7
vpblendvb %ymm7, %ymm1, %ymm12, %ymm15
vpblendvb %ymm7, %ymm12, %ymm1, %ymm1
vpcmpgtq %ymm3, %ymm10, %ymm7
vmovdqa %ymm15, 8(%rsp)
vmovdqa %ymm15, 360(%rsp)
vpblendvb %ymm7, %ymm3, %ymm10, %ymm12
vpblendvb %ymm7, %ymm10, %ymm3, %ymm10
vpcmpgtq %ymm5, %ymm14, %ymm7
vpblendvb %ymm7, %ymm5, %ymm14, %ymm3
vpblendvb %ymm7, %ymm14, %ymm5, %ymm7
vpcmpgtq %ymm4, %ymm2, %ymm5
vpblendvb %ymm5, %ymm4, %ymm2, %ymm14
vpblendvb %ymm5, %ymm2, %ymm4, %ymm4
vpcmpgtq %ymm3, %ymm1, %ymm5
vmovdqa %ymm4, 104(%rsp)
vpcmpgtq %ymm12, %ymm9, %ymm2
vpblendvb %ymm5, %ymm3, %ymm1, %ymm4
vpblendvb %ymm5, %ymm1, %ymm3, %ymm5
vpcmpgtq %ymm0, %ymm11, %ymm1
vmovdqa %ymm4, -24(%rsp)
vmovdqa %ymm4, 296(%rsp)
vpblendvb %ymm1, %ymm0, %ymm11, %ymm15
vpblendvb %ymm1, %ymm11, %ymm0, %ymm1
vpcmpgtq %ymm8, %ymm6, %ymm0
vpblendvb %ymm0, %ymm8, %ymm6, %ymm11
vpblendvb %ymm0, %ymm6, %ymm8, %ymm6
vpcmpgtq %ymm14, %ymm10, %ymm0
vpblendvb %ymm0, %ymm10, %ymm14, %ymm4
vpblendvb %ymm0, %ymm14, %ymm10, %ymm8
vpblendvb %ymm2, %ymm12, %ymm9, %ymm0
vmovdqa %ymm4, 72(%rsp)
vpcmpgtq %ymm13, %ymm7, %ymm4
vpblendvb %ymm2, %ymm9, %ymm12, %ymm2
vpblendvb %ymm4, %ymm13, %ymm7, %ymm3
vpblendvb %ymm4, %ymm7, %ymm13, %ymm4
vpcmpgtq %ymm3, %ymm15, %ymm7
vpblendvb %ymm7, %ymm3, %ymm15, %ymm12
vpblendvb %ymm7, %ymm15, %ymm3, %ymm3
vpcmpgtq %ymm1, %ymm4, %ymm7
vpblendvb %ymm7, %ymm1, %ymm4, %ymm10
vpblendvb %ymm7, %ymm4, %ymm1, %ymm4
vpcmpgtq %ymm0, %ymm11, %ymm1
vpblendvb %ymm1, %ymm0, %ymm11, %ymm7
vpblendvb %ymm1, %ymm11, %ymm0, %ymm0
vpcmpgtq %ymm6, %ymm2, %ymm1
vpblendvb %ymm1, %ymm6, %ymm2, %ymm9
vpblendvb %ymm1, %ymm2, %ymm6, %ymm2
vpcmpgtq %ymm12, %ymm5, %ymm6
vpblendvb %ymm6, %ymm12, %ymm5, %ymm1
vpblendvb %ymm6, %ymm5, %ymm12, %ymm15
vmovdqa %ymm1, 264(%rsp)
vpcmpgtq %ymm3, %ymm10, %ymm5
vmovdqa %ymm15, 232(%rsp)
vpblendvb %ymm5, %ymm3, %ymm10, %ymm11
vpblendvb %ymm5, %ymm10, %ymm3, %ymm3
vmovdqa %ymm11, 200(%rsp)
vpcmpgtq %ymm7, %ymm4, %ymm5
vpblendvb %ymm5, %ymm7, %ymm4, %ymm6
vpblendvb %ymm5, %ymm4, %ymm7, %ymm4
vpcmpgtq %ymm0, %ymm9, %ymm5
vpblendvb %ymm5, %ymm0, %ymm9, %ymm7
vpblendvb %ymm5, %ymm9, %ymm0, %ymm0
vpcmpgtq %ymm8, %ymm2, %ymm9
vpblendvb %ymm9, %ymm8, %ymm2, %ymm5
vpblendvb %ymm9, %ymm2, %ymm8, %ymm2
vpcmpgtq %ymm3, %ymm6, %ymm8
vpblendvb %ymm8, %ymm3, %ymm6, %ymm10
vpblendvb %ymm8, %ymm6, %ymm3, %ymm3
vpcmpgtq %ymm4, %ymm7, %ymm6
vpblendvb %ymm6, %ymm4, %ymm7, %ymm12
vpblendvb %ymm6, %ymm7, %ymm4, %ymm6
jbe .L1486
vmovdqa 40(%rsp), %ymm13
vpshufd $78, 104(%rsp), %ymm4
vpshufd $78, 136(%rsp), %ymm7
vpshufd $78, 72(%rsp), %ymm9
vpshufd $78, %ymm2, %ymm2
vpshufd $78, %ymm5, %ymm5
vpshufd $78, %ymm0, %ymm0
vpcmpgtq %ymm13, %ymm7, %ymm8
vpshufd $78, %ymm6, %ymm6
vpshufd $78, %ymm12, %ymm12
vpblendvb %ymm8, %ymm13, %ymm7, %ymm14
vpblendvb %ymm8, %ymm7, %ymm13, %ymm7
vmovdqa 8(%rsp), %ymm13
vmovdqa %ymm7, 360(%rsp)
vpcmpgtq %ymm13, %ymm4, %ymm8
vpblendvb %ymm8, %ymm13, %ymm4, %ymm7
vpblendvb %ymm8, %ymm4, %ymm13, %ymm4
vmovdqa -24(%rsp), %ymm13
vmovdqa %ymm4, 328(%rsp)
vpcmpgtq %ymm13, %ymm9, %ymm8
vpblendvb %ymm8, %ymm13, %ymm9, %ymm4
vpblendvb %ymm8, %ymm9, %ymm13, %ymm9
vpcmpgtq %ymm1, %ymm2, %ymm8
vpshufd $78, %ymm9, %ymm9
vpblendvb %ymm8, %ymm1, %ymm2, %ymm13
vpblendvb %ymm8, %ymm2, %ymm1, %ymm1
vpcmpgtq %ymm15, %ymm5, %ymm8
vpshufd $78, %ymm1, %ymm1
vmovdqa %ymm13, 296(%rsp)
vpblendvb %ymm8, %ymm15, %ymm5, %ymm2
vpblendvb %ymm8, %ymm5, %ymm15, %ymm5
vpcmpgtq %ymm11, %ymm0, %ymm8
vpshufd $78, %ymm2, %ymm2
vmovdqa %ymm5, 264(%rsp)
vpblendvb %ymm8, %ymm11, %ymm0, %ymm5
vpblendvb %ymm8, %ymm0, %ymm11, %ymm0
vpcmpgtq %ymm10, %ymm6, %ymm11
vpshufd $78, %ymm5, %ymm5
vpblendvb %ymm11, %ymm10, %ymm6, %ymm8
vpblendvb %ymm11, %ymm6, %ymm10, %ymm10
vpcmpgtq %ymm3, %ymm12, %ymm6
vpshufd $78, %ymm8, %ymm8
vpblendvb %ymm6, %ymm3, %ymm12, %ymm11
vpblendvb %ymm6, %ymm12, %ymm3, %ymm3
vpshufd $78, 360(%rsp), %ymm6
vpshufd $78, 328(%rsp), %ymm12
vpshufd $78, %ymm11, %ymm11
vpcmpgtq %ymm14, %ymm11, %ymm15
vpblendvb %ymm15, %ymm14, %ymm11, %ymm13
vpblendvb %ymm15, %ymm11, %ymm14, %ymm15
vpcmpgtq %ymm3, %ymm6, %ymm11
vpblendvb %ymm11, %ymm3, %ymm6, %ymm14
vmovdqa %ymm14, 360(%rsp)
vpblendvb %ymm11, %ymm6, %ymm3, %ymm14
vpcmpgtq %ymm7, %ymm8, %ymm3
vmovdqa 296(%rsp), %ymm11
vpblendvb %ymm3, %ymm7, %ymm8, %ymm6
vpblendvb %ymm3, %ymm8, %ymm7, %ymm7
vpcmpgtq %ymm10, %ymm12, %ymm3
vpshufd $78, %ymm7, %ymm7
vpblendvb %ymm3, %ymm10, %ymm12, %ymm8
vpblendvb %ymm3, %ymm12, %ymm10, %ymm10
vmovdqa 264(%rsp), %ymm12
vpcmpgtq %ymm4, %ymm5, %ymm3
vpshufd $78, %ymm10, %ymm10
vmovdqa %ymm8, 328(%rsp)
vpblendvb %ymm3, %ymm4, %ymm5, %ymm8
vpblendvb %ymm3, %ymm5, %ymm4, %ymm4
vpcmpgtq %ymm0, %ymm9, %ymm3
vpshufd $78, %ymm8, %ymm8
vpblendvb %ymm3, %ymm0, %ymm9, %ymm5
vpblendvb %ymm3, %ymm9, %ymm0, %ymm0
vpcmpgtq %ymm11, %ymm2, %ymm3
vpshufd $78, %ymm5, %ymm5
vpblendvb %ymm3, %ymm11, %ymm2, %ymm9
vpblendvb %ymm3, %ymm2, %ymm11, %ymm2
vpcmpgtq %ymm12, %ymm1, %ymm11
vpshufd $78, %ymm9, %ymm9
vpblendvb %ymm11, %ymm12, %ymm1, %ymm3
vpblendvb %ymm11, %ymm1, %ymm12, %ymm1
vpshufd $78, %ymm15, %ymm12
vpcmpgtq %ymm13, %ymm9, %ymm15
vpshufd $78, %ymm14, %ymm11
vpshufd $78, %ymm3, %ymm3
vpblendvb %ymm15, %ymm13, %ymm9, %ymm14
vpblendvb %ymm15, %ymm9, %ymm13, %ymm15
vpcmpgtq %ymm6, %ymm8, %ymm9
vpblendvb %ymm9, %ymm6, %ymm8, %ymm13
vpblendvb %ymm9, %ymm8, %ymm6, %ymm6
vpcmpgtq %ymm2, %ymm12, %ymm8
vpblendvb %ymm8, %ymm2, %ymm12, %ymm9
vpblendvb %ymm8, %ymm12, %ymm2, %ymm2
vpcmpgtq %ymm4, %ymm7, %ymm8
vpshufd $78, %ymm2, %ymm2
vmovdqa %ymm9, 296(%rsp)
vpblendvb %ymm8, %ymm4, %ymm7, %ymm9
vpblendvb %ymm8, %ymm7, %ymm4, %ymm4
vmovdqa 360(%rsp), %ymm8
vpshufd $78, %ymm9, %ymm9
vpcmpgtq %ymm8, %ymm3, %ymm7
vpblendvb %ymm7, %ymm8, %ymm3, %ymm12
vpblendvb %ymm7, %ymm3, %ymm8, %ymm3
vmovdqa 328(%rsp), %ymm8
vmovdqa %ymm3, 360(%rsp)
vpcmpgtq %ymm8, %ymm5, %ymm7
vpblendvb %ymm7, %ymm8, %ymm5, %ymm3
vpblendvb %ymm7, %ymm5, %ymm8, %ymm5
vpcmpgtq %ymm1, %ymm11, %ymm7
vpblendvb %ymm7, %ymm1, %ymm11, %ymm8
vpblendvb %ymm7, %ymm11, %ymm1, %ymm1
vpcmpgtq %ymm0, %ymm10, %ymm11
vpshufd $78, %ymm1, %ymm1
vmovdqa %ymm8, 328(%rsp)
vpshufd $78, %ymm3, %ymm8
vpshufd $78, 360(%rsp), %ymm3
vpblendvb %ymm11, %ymm0, %ymm10, %ymm7
vpblendvb %ymm11, %ymm10, %ymm0, %ymm0
vpshufd $78, %ymm13, %ymm11
vpshufd $78, %ymm15, %ymm10
vpcmpgtq %ymm14, %ymm11, %ymm15
vpshufd $78, %ymm7, %ymm7
vpblendvb %ymm15, %ymm14, %ymm11, %ymm13
vpblendvb %ymm15, %ymm11, %ymm14, %ymm14
vmovdqa %ymm13, 360(%rsp)
vpcmpgtq %ymm6, %ymm10, %ymm11
vmovdqa 296(%rsp), %ymm13
vpblendvb %ymm11, %ymm6, %ymm10, %ymm15
vpblendvb %ymm11, %ymm10, %ymm6, %ymm10
vpcmpgtq %ymm13, %ymm9, %ymm6
vpblendvb %ymm6, %ymm13, %ymm9, %ymm11
vpblendvb %ymm6, %ymm9, %ymm13, %ymm9
vpcmpgtq %ymm4, %ymm2, %ymm6
vpblendvb %ymm6, %ymm4, %ymm2, %ymm13
vpblendvb %ymm6, %ymm2, %ymm4, %ymm4
vpcmpgtq %ymm12, %ymm8, %ymm2
vpblendvb %ymm2, %ymm12, %ymm8, %ymm6
vpblendvb %ymm2, %ymm8, %ymm12, %ymm8
vmovdqa %ymm6, 136(%rsp)
vpcmpgtq %ymm5, %ymm3, %ymm2
vpblendvb %ymm2, %ymm5, %ymm3, %ymm12
vpblendvb %ymm2, %ymm3, %ymm5, %ymm3
vmovdqa 328(%rsp), %ymm5
vmovdqa %ymm12, 104(%rsp)
vpcmpgtq %ymm5, %ymm7, %ymm2
vpblendvb %ymm2, %ymm5, %ymm7, %ymm6
vpblendvb %ymm2, %ymm7, %ymm5, %ymm7
vmovdqa 360(%rsp), %ymm5
vpcmpgtq %ymm0, %ymm1, %ymm2
vmovdqa %ymm6, 72(%rsp)
vpblendvb %ymm2, %ymm0, %ymm1, %ymm12
vpblendvb %ymm2, %ymm1, %ymm0, %ymm2
vpshufd $78, %ymm5, %ymm1
vpcmpgtq %ymm5, %ymm1, %ymm0
vmovdqa %ymm12, 40(%rsp)
vmovdqa %ymm2, 8(%rsp)
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm1, %ymm5, %ymm6
vpshufd $78, %ymm14, %ymm1
vmovdqa %ymm6, 328(%rsp)
vpcmpgtq %ymm14, %ymm1, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm1, %ymm14, %ymm1
vmovdqa %ymm1, -24(%rsp)
vmovdqa 104(%rsp), %ymm5
cmpq $3, 192(%rsp)
vmovdqa %ymm1, 360(%rsp)
vpshufd $78, %ymm15, %ymm1
vpcmpgtq %ymm15, %ymm1, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm1, %ymm15, %ymm15
vpshufd $78, %ymm10, %ymm1
vmovdqa %ymm15, 296(%rsp)
vpcmpgtq %ymm10, %ymm1, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm1, %ymm10, %ymm1
vpshufd $78, %ymm8, %ymm10
vmovdqa %ymm1, -56(%rsp)
vmovdqa %ymm1, 264(%rsp)
vpshufd $78, %ymm11, %ymm1
vpcmpgtq %ymm11, %ymm1, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm1, %ymm11, %ymm11
vpshufd $78, %ymm9, %ymm1
vmovdqa %ymm11, 232(%rsp)
vpcmpgtq %ymm9, %ymm1, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm1, %ymm9, %ymm1
vmovdqa 40(%rsp), %ymm9
vmovdqa %ymm1, -88(%rsp)
vmovdqa %ymm1, 200(%rsp)
vpshufd $78, %ymm13, %ymm1
vpcmpgtq %ymm13, %ymm1, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm1, %ymm13, %ymm12
vpshufd $78, %ymm4, %ymm1
vpcmpgtq %ymm4, %ymm1, %ymm0
vmovdqa %ymm12, %ymm14
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm1, %ymm4, %ymm1
vmovdqa 136(%rsp), %ymm4
vmovdqa %ymm1, -120(%rsp)
vmovdqa %ymm1, %ymm13
vpshufd $78, %ymm4, %ymm1
vpcmpgtq %ymm4, %ymm1, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm1, %ymm4, %ymm4
vpcmpgtq %ymm8, %ymm10, %ymm0
vpshufd $78, %ymm5, %ymm1
vpcmpgtq %ymm5, %ymm1, %ymm2
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpunpckhqdq %ymm2, %ymm2, %ymm2
vpblendvb %ymm0, %ymm10, %ymm8, %ymm10
vmovdqa 8(%rsp), %ymm8
vpblendvb %ymm2, %ymm1, %ymm5, %ymm1
vpshufd $78, %ymm3, %ymm5
vpcmpgtq %ymm3, %ymm5, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm5, %ymm3, %ymm5
vmovdqa 72(%rsp), %ymm0
vpshufd $78, %ymm0, %ymm2
vpcmpgtq %ymm0, %ymm2, %ymm3
vpunpckhqdq %ymm3, %ymm3, %ymm3
vpblendvb %ymm3, %ymm2, %ymm0, %ymm2
vpshufd $78, %ymm7, %ymm3
vpcmpgtq %ymm7, %ymm3, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm3, %ymm7, %ymm7
vpshufd $78, %ymm9, %ymm3
vpcmpgtq %ymm9, %ymm3, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm3, %ymm9, %ymm3
vpshufd $78, %ymm8, %ymm9
vpcmpgtq %ymm8, %ymm9, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm9, %ymm8, %ymm9
jbe .L1487
vpshufd $78, %ymm9, %ymm9
vpshufd $78, %ymm5, %ymm5
vpshufd $78, %ymm2, %ymm0
vpermq $78, %ymm9, %ymm9
vpermq $78, %ymm5, %ymm8
vpshufd $78, %ymm3, %ymm3
vmovdqa -24(%rsp), %ymm5
vpcmpgtq %ymm6, %ymm9, %ymm2
vpermq $78, %ymm3, %ymm3
vpshufd $78, %ymm7, %ymm7
vpermq $78, %ymm7, %ymm7
vpermq $78, %ymm0, %ymm0
vpshufd $78, %ymm1, %ymm1
vpermq $78, %ymm1, %ymm1
vpshufd $78, %ymm10, %ymm10
vpshufd $78, %ymm4, %ymm4
vpblendvb %ymm2, %ymm6, %ymm9, %ymm14
vpblendvb %ymm2, %ymm9, %ymm6, %ymm13
vmovdqa -56(%rsp), %ymm9
vpermq $78, %ymm10, %ymm10
vpcmpgtq %ymm5, %ymm3, %ymm2
vpermq $78, %ymm4, %ymm4
vpblendvb %ymm2, %ymm5, %ymm3, %ymm6
vpblendvb %ymm2, %ymm3, %ymm5, %ymm3
vpcmpgtq %ymm15, %ymm7, %ymm2
vpshufd $78, %ymm3, %ymm3
vpermq $78, %ymm3, %ymm3
vpblendvb %ymm2, %ymm15, %ymm7, %ymm5
vpblendvb %ymm2, %ymm7, %ymm15, %ymm7
vpcmpgtq %ymm9, %ymm0, %ymm2
vpshufd $78, %ymm7, %ymm7
vpermq $78, %ymm7, %ymm7
vpblendvb %ymm2, %ymm9, %ymm0, %ymm15
vpblendvb %ymm2, %ymm0, %ymm9, %ymm0
vpcmpgtq %ymm11, %ymm8, %ymm9
vpshufd $78, %ymm0, %ymm0
vmovdqa %ymm15, 360(%rsp)
vmovdqa -120(%rsp), %ymm15
vpermq $78, %ymm0, %ymm0
vpblendvb %ymm9, %ymm11, %ymm8, %ymm2
vpblendvb %ymm9, %ymm8, %ymm11, %ymm11
vmovdqa -88(%rsp), %ymm9
vmovdqa %ymm11, 328(%rsp)
vpshufd $78, %ymm2, %ymm2
vpcmpgtq %ymm9, %ymm1, %ymm8
vpermq $78, %ymm2, %ymm2
vpblendvb %ymm8, %ymm9, %ymm1, %ymm11
vpblendvb %ymm8, %ymm1, %ymm9, %ymm1
vpcmpgtq %ymm12, %ymm10, %ymm9
vpshufd $78, %ymm11, %ymm11
vpermq $78, %ymm11, %ymm11
vpblendvb %ymm9, %ymm12, %ymm10, %ymm8
vpblendvb %ymm9, %ymm10, %ymm12, %ymm10
vpcmpgtq %ymm15, %ymm4, %ymm9
vpshufd $78, %ymm8, %ymm8
vpermq $78, %ymm8, %ymm8
vpblendvb %ymm9, %ymm15, %ymm4, %ymm12
vpblendvb %ymm9, %ymm4, %ymm15, %ymm4
vpshufd $78, %ymm13, %ymm9
vpshufd $78, %ymm12, %ymm12
vpermq $78, %ymm9, %ymm9
vpermq $78, %ymm12, %ymm12
vpcmpgtq %ymm14, %ymm12, %ymm15
vpblendvb %ymm15, %ymm14, %ymm12, %ymm13
vpblendvb %ymm15, %ymm12, %ymm14, %ymm15
vpcmpgtq %ymm4, %ymm9, %ymm12
vpblendvb %ymm12, %ymm4, %ymm9, %ymm14
vmovdqa %ymm14, 296(%rsp)
vpblendvb %ymm12, %ymm9, %ymm4, %ymm14
vpcmpgtq %ymm6, %ymm8, %ymm4
vpblendvb %ymm4, %ymm6, %ymm8, %ymm9
vpblendvb %ymm4, %ymm8, %ymm6, %ymm6
vpcmpgtq %ymm10, %ymm3, %ymm4
vpshufd $78, %ymm6, %ymm6
vpermq $78, %ymm6, %ymm6
vpblendvb %ymm4, %ymm10, %ymm3, %ymm12
vpblendvb %ymm4, %ymm3, %ymm10, %ymm10
vpcmpgtq %ymm5, %ymm11, %ymm3
vpshufd $78, %ymm10, %ymm10
vmovdqa %ymm12, 264(%rsp)
vpermq $78, %ymm10, %ymm10
vpblendvb %ymm3, %ymm5, %ymm11, %ymm8
vpblendvb %ymm3, %ymm11, %ymm5, %ymm5
vmovdqa 328(%rsp), %ymm11
vpcmpgtq %ymm1, %ymm7, %ymm3
vpshufd $78, %ymm8, %ymm8
vpermq $78, %ymm8, %ymm8
vpblendvb %ymm3, %ymm1, %ymm7, %ymm4
vpblendvb %ymm3, %ymm7, %ymm1, %ymm1
vmovdqa 360(%rsp), %ymm7
vpshufd $78, %ymm4, %ymm4
vpcmpgtq %ymm7, %ymm2, %ymm3
vpermq $78, %ymm4, %ymm4
vpblendvb %ymm3, %ymm7, %ymm2, %ymm12
vpblendvb %ymm3, %ymm2, %ymm7, %ymm2
vpcmpgtq %ymm11, %ymm0, %ymm7
vpshufd $78, %ymm12, %ymm12
vpermq $78, %ymm12, %ymm12
vpblendvb %ymm7, %ymm11, %ymm0, %ymm3
vpblendvb %ymm7, %ymm0, %ymm11, %ymm0
vpshufd $78, %ymm15, %ymm7
vpcmpgtq %ymm13, %ymm12, %ymm15
vpshufd $78, %ymm14, %ymm11
vpermq $78, %ymm7, %ymm7
vpshufd $78, %ymm3, %ymm3
vpermq $78, %ymm11, %ymm11
vpermq $78, %ymm3, %ymm3
vpblendvb %ymm15, %ymm13, %ymm12, %ymm14
vpblendvb %ymm15, %ymm12, %ymm13, %ymm15
vpcmpgtq %ymm9, %ymm8, %ymm12
vpblendvb %ymm12, %ymm9, %ymm8, %ymm13
vpblendvb %ymm12, %ymm8, %ymm9, %ymm9
vmovdqa %ymm13, 360(%rsp)
vpcmpgtq %ymm2, %ymm7, %ymm8
vpblendvb %ymm8, %ymm2, %ymm7, %ymm13
vpblendvb %ymm8, %ymm7, %ymm2, %ymm2
vpcmpgtq %ymm5, %ymm6, %ymm7
vpshufd $78, %ymm2, %ymm2
vpermq $78, %ymm2, %ymm2
vpblendvb %ymm7, %ymm5, %ymm6, %ymm8
vpblendvb %ymm7, %ymm6, %ymm5, %ymm5
vmovdqa 296(%rsp), %ymm7
vpshufd $78, %ymm8, %ymm8
vpcmpgtq %ymm7, %ymm3, %ymm6
vpermq $78, %ymm8, %ymm8
vpblendvb %ymm6, %ymm7, %ymm3, %ymm12
vpblendvb %ymm6, %ymm3, %ymm7, %ymm3
vmovdqa %ymm12, 328(%rsp)
vpshufd $78, %ymm3, %ymm3
vmovdqa 264(%rsp), %ymm12
vpermq $78, %ymm3, %ymm3
vpcmpgtq %ymm12, %ymm4, %ymm6
vpblendvb %ymm6, %ymm12, %ymm4, %ymm7
vpblendvb %ymm6, %ymm4, %ymm12, %ymm4
vpcmpgtq %ymm0, %ymm11, %ymm6
vpshufd $78, %ymm7, %ymm7
vpermq $78, %ymm7, %ymm7
vpblendvb %ymm6, %ymm0, %ymm11, %ymm12
vpblendvb %ymm6, %ymm11, %ymm0, %ymm0
vpcmpgtq %ymm1, %ymm10, %ymm11
vpshufd $78, %ymm0, %ymm0
vmovdqa %ymm12, 296(%rsp)
vpermq $78, %ymm0, %ymm0
vpblendvb %ymm11, %ymm1, %ymm10, %ymm6
vpblendvb %ymm11, %ymm10, %ymm1, %ymm1
vpshufd $78, 360(%rsp), %ymm11
vpermq $78, %ymm11, %ymm11
vpshufd $78, %ymm15, %ymm10
vpcmpgtq %ymm14, %ymm11, %ymm15
vpshufd $78, %ymm6, %ymm6
vpermq $78, %ymm10, %ymm10
vpermq $78, %ymm6, %ymm6
vpblendvb %ymm15, %ymm14, %ymm11, %ymm12
vpblendvb %ymm15, %ymm11, %ymm14, %ymm14
vmovdqa %ymm12, 360(%rsp)
vpcmpgtq %ymm9, %ymm10, %ymm11
vmovdqa 328(%rsp), %ymm12
vpblendvb %ymm11, %ymm9, %ymm10, %ymm15
vpblendvb %ymm11, %ymm10, %ymm9, %ymm10
vpcmpgtq %ymm13, %ymm8, %ymm9
vpblendvb %ymm9, %ymm13, %ymm8, %ymm11
vpblendvb %ymm9, %ymm8, %ymm13, %ymm9
vpcmpgtq %ymm5, %ymm2, %ymm8
vpblendvb %ymm8, %ymm5, %ymm2, %ymm13
vpblendvb %ymm8, %ymm2, %ymm5, %ymm5
vpcmpgtq %ymm12, %ymm7, %ymm2
vpblendvb %ymm2, %ymm12, %ymm7, %ymm8
vpblendvb %ymm2, %ymm7, %ymm12, %ymm7
vpcmpgtq %ymm4, %ymm3, %ymm2
vpblendvb %ymm2, %ymm4, %ymm3, %ymm12
vpblendvb %ymm2, %ymm3, %ymm4, %ymm3
vmovdqa %ymm12, 328(%rsp)
vmovdqa 296(%rsp), %ymm12
vpcmpgtq %ymm12, %ymm6, %ymm2
vpblendvb %ymm2, %ymm12, %ymm6, %ymm4
vpblendvb %ymm2, %ymm6, %ymm12, %ymm6
vpcmpgtq %ymm1, %ymm0, %ymm2
vpblendvb %ymm2, %ymm1, %ymm0, %ymm12
vpblendvb %ymm2, %ymm0, %ymm1, %ymm2
vmovdqa %ymm12, 296(%rsp)
vmovdqa 360(%rsp), %ymm12
vmovdqa %ymm2, 264(%rsp)
vpshufd $78, %ymm12, %ymm0
vpermq $78, %ymm0, %ymm0
vpcmpgtq %ymm12, %ymm0, %ymm1
vpblendvb %ymm1, %ymm12, %ymm0, %ymm2
vpblendvb %ymm1, %ymm0, %ymm12, %ymm12
vpblendd $15, %ymm2, %ymm12, %ymm0
vmovdqa %ymm0, 360(%rsp)
vpshufd $78, %ymm14, %ymm0
vpermq $78, %ymm0, %ymm0
vpcmpgtq %ymm14, %ymm0, %ymm1
vpblendvb %ymm1, %ymm14, %ymm0, %ymm2
vpblendvb %ymm1, %ymm0, %ymm14, %ymm14
vpshufd $78, %ymm15, %ymm0
vpermq $78, %ymm0, %ymm0
vpblendd $15, %ymm2, %ymm14, %ymm14
vpcmpgtq %ymm15, %ymm0, %ymm1
vpblendvb %ymm1, %ymm15, %ymm0, %ymm2
vpblendvb %ymm1, %ymm0, %ymm15, %ymm15
vpshufd $78, %ymm10, %ymm0
vpblendd $15, %ymm2, %ymm15, %ymm1
vpermq $78, %ymm0, %ymm0
vmovdqa 328(%rsp), %ymm15
vmovdqa %ymm1, 232(%rsp)
vpcmpgtq %ymm10, %ymm0, %ymm1
vpblendvb %ymm1, %ymm10, %ymm0, %ymm2
vpblendvb %ymm1, %ymm0, %ymm10, %ymm10
vpshufd $78, %ymm11, %ymm0
vpermq $78, %ymm0, %ymm0
vpblendd $15, %ymm2, %ymm10, %ymm10
vpcmpgtq %ymm11, %ymm0, %ymm1
vpblendvb %ymm1, %ymm11, %ymm0, %ymm2
vpblendvb %ymm1, %ymm0, %ymm11, %ymm11
vpshufd $78, %ymm9, %ymm0
vpermq $78, %ymm0, %ymm0
vpblendd $15, %ymm2, %ymm11, %ymm2
vpcmpgtq %ymm9, %ymm0, %ymm1
vpblendvb %ymm1, %ymm9, %ymm0, %ymm11
vpblendvb %ymm1, %ymm0, %ymm9, %ymm9
vpshufd $78, %ymm13, %ymm1
vpermq $78, %ymm1, %ymm1
vpblendd $15, %ymm11, %ymm9, %ymm0
vmovdqa %ymm0, 200(%rsp)
vpcmpgtq %ymm13, %ymm1, %ymm9
vmovdqa 264(%rsp), %ymm0
vpblendvb %ymm9, %ymm13, %ymm1, %ymm11
vpblendvb %ymm9, %ymm1, %ymm13, %ymm13
vpshufd $78, %ymm5, %ymm1
vpermq $78, %ymm1, %ymm1
vpblendd $15, %ymm11, %ymm13, %ymm13
vpcmpgtq %ymm5, %ymm1, %ymm9
vpblendvb %ymm9, %ymm5, %ymm1, %ymm11
vpblendvb %ymm9, %ymm1, %ymm5, %ymm5
vpshufd $78, %ymm8, %ymm1
vpermq $78, %ymm1, %ymm1
vpblendd $15, %ymm11, %ymm5, %ymm5
vpcmpgtq %ymm8, %ymm1, %ymm9
vpblendvb %ymm9, %ymm8, %ymm1, %ymm11
vpblendvb %ymm9, %ymm1, %ymm8, %ymm8
vpshufd $78, %ymm7, %ymm1
vpermq $78, %ymm1, %ymm1
vpblendd $15, %ymm11, %ymm8, %ymm8
vpcmpgtq %ymm7, %ymm1, %ymm9
vpblendvb %ymm9, %ymm7, %ymm1, %ymm11
vpblendvb %ymm9, %ymm1, %ymm7, %ymm7
vpshufd $78, %ymm15, %ymm1
vpermq $78, %ymm1, %ymm1
vpblendd $15, %ymm11, %ymm7, %ymm7
vpcmpgtq %ymm15, %ymm1, %ymm9
vpblendvb %ymm9, %ymm15, %ymm1, %ymm11
vpblendvb %ymm9, %ymm1, %ymm15, %ymm9
vpshufd $78, %ymm3, %ymm1
vpermq $78, %ymm1, %ymm1
vpblendd $15, %ymm11, %ymm9, %ymm9
vpcmpgtq %ymm3, %ymm1, %ymm11
vpblendvb %ymm11, %ymm3, %ymm1, %ymm12
vpblendvb %ymm11, %ymm1, %ymm3, %ymm3
vpshufd $78, %ymm4, %ymm1
vpermq $78, %ymm1, %ymm1
vpblendd $15, %ymm12, %ymm3, %ymm3
vpcmpgtq %ymm4, %ymm1, %ymm11
vpblendvb %ymm11, %ymm4, %ymm1, %ymm12
vpblendvb %ymm11, %ymm1, %ymm4, %ymm4
vpshufd $78, %ymm6, %ymm1
vpermq $78, %ymm1, %ymm1
vpblendd $15, %ymm12, %ymm4, %ymm4
vmovdqa 296(%rsp), %ymm12
vpcmpgtq %ymm6, %ymm1, %ymm15
vpblendvb %ymm15, %ymm6, %ymm1, %ymm11
vpblendvb %ymm15, %ymm1, %ymm6, %ymm6
vpshufd $78, %ymm12, %ymm1
vpermq $78, %ymm1, %ymm1
vpblendd $15, %ymm11, %ymm6, %ymm15
vpcmpgtq %ymm12, %ymm1, %ymm11
vpblendvb %ymm11, %ymm12, %ymm1, %ymm6
vpblendvb %ymm11, %ymm1, %ymm12, %ymm11
vpshufd $78, %ymm0, %ymm1
vpermq $78, %ymm1, %ymm1
vpblendd $15, %ymm6, %ymm11, %ymm11
vpcmpgtq %ymm0, %ymm1, %ymm6
vpblendvb %ymm6, %ymm0, %ymm1, %ymm12
vpblendvb %ymm6, %ymm1, %ymm0, %ymm1
vmovdqa 360(%rsp), %ymm0
vpblendd $15, %ymm12, %ymm1, %ymm1
vpshufd $78, %ymm0, %ymm12
vpcmpgtq %ymm0, %ymm12, %ymm6
vpunpckhqdq %ymm6, %ymm6, %ymm6
vpblendvb %ymm6, %ymm12, %ymm0, %ymm6
vpshufd $78, %ymm14, %ymm12
vmovdqa %ymm6, 328(%rsp)
vpcmpgtq %ymm14, %ymm12, %ymm6
vpunpckhqdq %ymm6, %ymm6, %ymm6
vpblendvb %ymm6, %ymm12, %ymm14, %ymm6
vmovdqa %ymm6, 360(%rsp)
vmovdqa 232(%rsp), %ymm0
vpshufd $78, %ymm0, %ymm12
vpcmpgtq %ymm0, %ymm12, %ymm6
vpunpckhqdq %ymm6, %ymm6, %ymm6
vpblendvb %ymm6, %ymm12, %ymm0, %ymm6
vpshufd $78, %ymm10, %ymm12
vmovdqa 200(%rsp), %ymm0
vmovdqa %ymm6, 296(%rsp)
vpcmpgtq %ymm10, %ymm12, %ymm6
vpunpckhqdq %ymm6, %ymm6, %ymm6
vpblendvb %ymm6, %ymm12, %ymm10, %ymm6
vpshufd $78, %ymm2, %ymm10
vpshufd $78, %ymm8, %ymm12
vmovdqa %ymm6, 264(%rsp)
vpcmpgtq %ymm2, %ymm10, %ymm6
vpunpckhqdq %ymm6, %ymm6, %ymm6
vpblendvb %ymm6, %ymm10, %ymm2, %ymm6
vmovdqa %ymm6, 232(%rsp)
vpshufd $78, %ymm0, %ymm6
vpcmpgtq %ymm0, %ymm6, %ymm2
vpunpckhqdq %ymm2, %ymm2, %ymm2
vpblendvb %ymm2, %ymm6, %ymm0, %ymm6
vpshufd $78, %ymm13, %ymm2
vmovdqa %ymm6, 200(%rsp)
vpcmpgtq %ymm13, %ymm2, %ymm0
vpshufd $78, %ymm7, %ymm6
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm2, %ymm13, %ymm14
vpshufd $78, %ymm5, %ymm2
vpcmpgtq %ymm5, %ymm2, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm2, %ymm5, %ymm13
vpcmpgtq %ymm8, %ymm12, %ymm0
vpshufd $78, %ymm3, %ymm5
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm12, %ymm8, %ymm12
vpcmpgtq %ymm7, %ymm6, %ymm0
vpunpckhqdq %ymm0, %ymm0, %ymm0
vpblendvb %ymm0, %ymm6, %ymm7, %ymm6
vpshufd $78, %ymm9, %ymm0
vpshufd $78, %ymm15, %ymm7
vpcmpgtq %ymm9, %ymm0, %ymm2
vpunpckhqdq %ymm2, %ymm2, %ymm2
vpblendvb %ymm2, %ymm0, %ymm9, %ymm0
vpcmpgtq %ymm3, %ymm5, %ymm2
vpshufd $78, %ymm1, %ymm9
vpunpckhqdq %ymm2, %ymm2, %ymm2
vpblendvb %ymm2, %ymm5, %ymm3, %ymm5
vpshufd $78, %ymm4, %ymm2
vpcmpgtq %ymm4, %ymm2, %ymm3
vpunpckhqdq %ymm3, %ymm3, %ymm3
vpblendvb %ymm3, %ymm2, %ymm4, %ymm2
vpcmpgtq %ymm15, %ymm7, %ymm3
vpcmpgtq %ymm1, %ymm9, %ymm4
vpunpckhqdq %ymm3, %ymm3, %ymm3
vpblendvb %ymm3, %ymm7, %ymm15, %ymm7
vpshufd $78, %ymm11, %ymm3
vpunpckhqdq %ymm4, %ymm4, %ymm4
vpcmpgtq %ymm11, %ymm3, %ymm8
vpblendvb %ymm4, %ymm9, %ymm1, %ymm9
vpunpckhqdq %ymm8, %ymm8, %ymm8
vpblendvb %ymm8, %ymm3, %ymm11, %ymm3
.L1483:
vmovdqa 328(%rsp), %ymm4
vmovdqu %ymm4, (%rdx)
movq 184(%rsp), %rdx
vmovdqa 360(%rsp), %ymm4
vmovdqu %ymm4, (%r15)
vmovdqa 296(%rsp), %ymm4
vmovdqu %ymm4, (%r14)
vmovdqa 264(%rsp), %ymm4
vmovdqu %ymm4, 0(%r13)
vmovdqa 232(%rsp), %ymm4
vmovdqu %ymm4, (%r12)
vmovdqa 200(%rsp), %ymm4
vmovdqu %ymm4, (%rbx)
movq 176(%rsp), %rbx
vmovdqu %ymm14, (%r11)
vmovdqu %ymm13, (%r10)
vmovdqu %ymm12, (%r9)
vmovdqu %ymm6, (%r8)
vmovdqu %ymm0, (%rdi)
vmovdqu %ymm5, (%rsi)
vmovdqu %ymm2, (%rdx)
vmovdqu %ymm7, (%rbx)
vmovdqu %ymm3, (%rcx)
vmovdqu %ymm9, (%rax)
vzeroupper
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1486:
.cfi_restore_state
vmovdqa %ymm3, %ymm13
vmovdqa 72(%rsp), %ymm7
vmovdqa 104(%rsp), %ymm3
vmovdqa %ymm10, %ymm14
vmovdqa 136(%rsp), %ymm9
jmp .L1483
.p2align 4,,10
.p2align 3
.L1487:
vmovdqa %ymm4, %ymm12
vmovdqa %ymm10, %ymm6
vmovdqa %ymm1, %ymm0
jmp .L1483
.cfi_endproc
.LFE18807:
.size _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0, .-_ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
.section .text._ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0,"ax",@progbits
.p2align 4
.type _ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, @function
_ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0:
.LFB18808:
.cfi_startproc
leaq 8(%rsp), %r10
.cfi_def_cfa 10, 0
andq $-32, %rsp
pushq -8(%r10)
pushq %rbp
movq %rsp, %rbp
.cfi_escape 0x10,0x6,0x2,0x76,0
pushq %r15
pushq %r14
pushq %r13
.cfi_escape 0x10,0xf,0x2,0x76,0x78
.cfi_escape 0x10,0xe,0x2,0x76,0x70
.cfi_escape 0x10,0xd,0x2,0x76,0x68
movq %rdi, %r13
pushq %r12
.cfi_escape 0x10,0xc,0x2,0x76,0x60
movq %rcx, %r12
pushq %r10
.cfi_escape 0xf,0x3,0x76,0x58,0x6
pushq %rbx
addq $-128, %rsp
.cfi_escape 0x10,0x3,0x2,0x76,0x50
movq %rsi, -104(%rbp)
movq %rdx, -88(%rbp)
movq %r9, -96(%rbp)
cmpq $64, %rdx
jbe .L1654
movq %rdi, %rax
movq %rdi, -112(%rbp)
movq %r8, %rbx
shrq $3, %rax
movq %rax, %rdx
movq %rax, -144(%rbp)
andl $7, %edx
jne .L1655
movq -88(%rbp), %r14
movq %rdi, %rax
.L1501:
movq 8(%rbx), %rcx
movq 16(%rbx), %r10
movq %rcx, %rdi
leaq 1(%r10), %r8
leaq (%rcx,%rcx,8), %rsi
xorq (%rbx), %r8
shrq $11, %rdi
rorx $40, %rcx, %rdx
leaq 2(%r10), %rcx
addq %r8, %rdx
xorq %rdi, %rsi
movq %rdx, %r9
rorx $40, %rdx, %rdi
xorq %rcx, %rsi
shrq $11, %r9
leaq (%rdx,%rdx,8), %rcx
leaq 3(%r10), %rdx
addq %rsi, %rdi
xorq %r9, %rcx
movq %rdi, %r9
xorq %rdx, %rcx
leaq (%rdi,%rdi,8), %rdx
rorx $40, %rdi, %r11
shrq $11, %r9
addq %rcx, %r11
leaq 4(%r10), %rdi
addq $5, %r10
xorq %r9, %rdx
movq %r11, %r15
rorx $40, %r11, %r9
movq %r10, 16(%rbx)
xorq %rdi, %rdx
shrq $11, %r15
leaq (%r11,%r11,8), %rdi
addq %rdx, %r9
xorq %r15, %rdi
movq %r9, %r15
leaq (%r9,%r9,8), %r11
xorq %r10, %rdi
rorx $40, %r9, %r9
shrq $11, %r15
addq %rdi, %r9
movl %edi, %edi
movabsq $34359738359, %r10
xorq %r15, %r11
movl %edx, %r15d
vmovq %r11, %xmm7
movl %r8d, %r11d
vpinsrq $1, %r9, %xmm7, %xmm0
movq %r14, %r9
shrq $3, %r9
cmpq %r10, %r14
movl $4294967295, %r10d
movl %ecx, %r14d
cmova %r10, %r9
shrq $32, %r8
movl %esi, %r10d
vmovdqu %xmm0, (%rbx)
shrq $32, %rsi
imulq %r9, %r11
shrq $32, %rcx
shrq $32, %rdx
imulq %r9, %r8
imulq %r9, %r10
shrq $32, %r11
imulq %r9, %rsi
imulq %r9, %r14
shrq $32, %r8
imulq %r9, %rcx
shrq $32, %r10
imulq %r9, %r15
shrq $32, %rsi
imulq %r9, %rdx
shrq $32, %r14
imulq %r9, %rdi
movq %r11, %r9
shrq $32, %rcx
salq $6, %r9
shrq $32, %r15
vmovdqa (%rax,%r9), %ymm2
movq %r8, %r9
shrq $32, %rdx
leaq 4(,%r8,8), %r8
salq $6, %r9
shrq $32, %rdi
vmovdqa (%rax,%r9), %ymm3
movq %r10, %r9
salq $6, %r9
vmovdqa (%rax,%r9), %ymm1
movq %rsi, %r9
leaq 4(,%rsi,8), %rsi
salq $6, %r9
vpcmpgtq %ymm2, %ymm1, %ymm4
vmovdqa (%rax,%r9), %ymm6
movq %r14, %r9
salq $6, %r9
vpblendvb %ymm4, %ymm2, %ymm1, %ymm0
vpblendvb %ymm4, %ymm1, %ymm2, %ymm2
vpcmpgtq %ymm0, %ymm3, %ymm1
vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
vmovdqa (%rax,%r9), %ymm3
movq %rcx, %r9
leaq 4(,%rcx,8), %rcx
vpcmpgtq %ymm0, %ymm2, %ymm1
salq $6, %r9
vpblendvb %ymm1, %ymm0, %ymm2, %ymm2
vmovdqa (%rax,%r9), %ymm1
movq %r15, %r9
salq $6, %r9
vmovdqa %ymm2, (%r12)
vpcmpgtq %ymm6, %ymm1, %ymm4
vpblendvb %ymm4, %ymm6, %ymm1, %ymm0
vpblendvb %ymm4, %ymm1, %ymm6, %ymm6
vmovdqa (%rax,%r9), %ymm4
movq %rdx, %r9
vpcmpgtq %ymm0, %ymm3, %ymm1
salq $6, %r9
leaq 4(,%rdx,8), %rdx
vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
vmovdqa (%rax,%r9), %ymm3
movq %rdi, %r9
vpcmpgtq %ymm0, %ymm6, %ymm1
salq $6, %r9
vpblendvb %ymm1, %ymm0, %ymm6, %ymm6
vmovdqa (%rax,%r9), %ymm1
leaq 4(,%r11,8), %r9
vmovdqa %ymm6, 64(%r12)
vpcmpgtq %ymm4, %ymm1, %ymm5
vpblendvb %ymm5, %ymm4, %ymm1, %ymm0
vpblendvb %ymm5, %ymm1, %ymm4, %ymm4
vmovdqa (%rax,%r8,8), %ymm5
leaq 4(,%r10,8), %r8
vpcmpgtq %ymm0, %ymm3, %ymm1
vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
vmovdqa (%rax,%r8,8), %ymm3
vpcmpgtq %ymm0, %ymm4, %ymm1
vpblendvb %ymm1, %ymm0, %ymm4, %ymm4
vmovdqa (%rax,%r9,8), %ymm0
vmovdqa %ymm4, 128(%r12)
vpcmpgtq %ymm0, %ymm3, %ymm7
vpblendvb %ymm7, %ymm0, %ymm3, %ymm1
vpblendvb %ymm7, %ymm3, %ymm0, %ymm0
vpcmpgtq %ymm1, %ymm5, %ymm3
vpblendvb %ymm3, %ymm5, %ymm1, %ymm1
vmovdqa (%rax,%rcx,8), %ymm5
leaq 4(,%r15,8), %rcx
vpcmpgtq %ymm1, %ymm0, %ymm3
vpblendvb %ymm3, %ymm1, %ymm0, %ymm0
vmovdqa (%rax,%rsi,8), %ymm1
leaq 4(,%r14,8), %rsi
leaq 192(%r12), %r14
vmovdqa (%rax,%rsi,8), %ymm7
vmovdqa %ymm0, 32(%r12)
vpcmpgtq %ymm1, %ymm5, %ymm8
vpblendvb %ymm8, %ymm1, %ymm5, %ymm3
vpblendvb %ymm8, %ymm5, %ymm1, %ymm1
vmovdqa (%rax,%rdx,8), %ymm8
leaq 4(,%rdi,8), %rdx
vpcmpgtq %ymm3, %ymm7, %ymm5
vpblendvb %ymm5, %ymm7, %ymm3, %ymm3
vmovdqa (%rax,%rdx,8), %ymm7
vpcmpgtq %ymm3, %ymm1, %ymm5
vpblendvb %ymm5, %ymm3, %ymm1, %ymm5
vmovdqa (%rax,%rcx,8), %ymm1
vmovdqa %ymm5, 96(%r12)
vpcmpgtq %ymm1, %ymm7, %ymm9
vpblendvb %ymm9, %ymm1, %ymm7, %ymm3
vpblendvb %ymm9, %ymm7, %ymm1, %ymm1
vpcmpgtq %ymm3, %ymm8, %ymm7
vpblendvb %ymm7, %ymm8, %ymm3, %ymm3
vpcmpgtq %ymm3, %ymm1, %ymm7
vpblendvb %ymm7, %ymm3, %ymm1, %ymm1
vpbroadcastq %xmm2, %ymm3
vpxor %ymm2, %ymm3, %ymm2
vpxor %ymm0, %ymm3, %ymm0
vpxor %ymm6, %ymm3, %ymm6
vmovdqa %ymm1, 160(%r12)
vpor %ymm2, %ymm0, %ymm0
vpxor %ymm5, %ymm3, %ymm5
vpxor %ymm4, %ymm3, %ymm4
vpor %ymm6, %ymm0, %ymm0
vpxor %ymm1, %ymm3, %ymm1
vpxor %xmm2, %xmm2, %xmm2
vpor %ymm5, %ymm0, %ymm0
vpor %ymm4, %ymm0, %ymm0
vpor %ymm1, %ymm0, %ymm0
vpxor 192(%r12), %ymm3, %ymm1
vpor %ymm0, %ymm1, %ymm1
vpblendvb %ymm2, %ymm1, %ymm0, %ymm0
vpxor %xmm1, %xmm1, %xmm1
vpcmpeqq %ymm1, %ymm0, %ymm0
vmovmskpd %ymm0, %eax
cmpl $15, %eax
je .L1503
vmovdqa .LC13(%rip), %ymm0
movl $2, %esi
movq %r12, %rdi
vmovdqu %ymm0, 192(%r12)
vmovdqu %ymm0, 224(%r12)
vmovdqu %ymm0, 256(%r12)
vzeroupper
call _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
vpbroadcastq (%r12), %ymm2
vpcmpeqd %ymm0, %ymm0, %ymm0
vpbroadcastq 184(%r12), %ymm1
vpaddq %ymm0, %ymm1, %ymm0
vpcmpeqq %ymm2, %ymm0, %ymm0
vmovmskpd %ymm0, %eax
cmpl $15, %eax
jne .L1505
movq -88(%rbp), %rsi
leaq -80(%rbp), %rdx
movq %r14, %rcx
vmovdqa %ymm2, %ymm0
movq %r13, %rdi
call _ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1649
.L1505:
movq 96(%r12), %rdx
cmpq %rdx, 88(%r12)
jne .L1585
cmpq 80(%r12), %rdx
jne .L1540
cmpq 72(%r12), %rdx
jne .L1586
cmpq 64(%r12), %rdx
jne .L1587
cmpq 56(%r12), %rdx
jne .L1588
cmpq 48(%r12), %rdx
jne .L1589
cmpq 40(%r12), %rdx
jne .L1590
cmpq 32(%r12), %rdx
jne .L1591
cmpq 24(%r12), %rdx
jne .L1592
cmpq 16(%r12), %rdx
jne .L1593
cmpq 8(%r12), %rdx
jne .L1594
movq (%r12), %rax
cmpq %rax, %rdx
jne .L1656
.L1542:
vmovq %rax, %xmm7
vpbroadcastq %xmm7, %ymm0
.L1653:
movl $1, -112(%rbp)
.L1538:
cmpq $0, -96(%rbp)
je .L1657
movq -88(%rbp), %rax
leaq -4(%rax), %r10
movq %r10, %rsi
movq %r10, %rdx
vmovdqu 0(%r13,%r10,8), %ymm4
andl $15, %esi
andl $12, %edx
je .L1596
vmovdqu 0(%r13), %ymm1
vpcmpeqd %ymm2, %ymm2, %ymm2
leaq _ZZN3hwy6N_AVX26detail18IndicesFromBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices(%rip), %r8
xorl %ecx, %ecx
vpcmpgtq %ymm0, %ymm1, %ymm5
vpxor %ymm2, %ymm5, %ymm3
vmovmskpd %ymm3, %eax
movq %rax, %rdx
popcntq %rax, %rax
leaq 0(%r13,%rax,8), %rax
salq $5, %rdx
vmovdqa (%r8,%rdx), %ymm3
vmovmskpd %ymm5, %edx
popcntq %rdx, %rcx
salq $5, %rdx
vpslld $28, %ymm3, %ymm6
vpermd %ymm1, %ymm3, %ymm3
vpmaskmovq %ymm3, %ymm6, 0(%r13)
vmovdqa (%r8,%rdx), %ymm3
vpermd %ymm1, %ymm3, %ymm1
vmovdqu %ymm1, (%r12)
testb $8, %r10b
je .L1548
vmovdqu 32(%r13), %ymm1
vpcmpgtq %ymm0, %ymm1, %ymm5
vpxor %ymm2, %ymm5, %ymm3
vmovmskpd %ymm3, %edx
movq %rdx, %rdi
popcntq %rdx, %rdx
salq $5, %rdi
vmovdqa (%r8,%rdi), %ymm3
vpslld $28, %ymm3, %ymm6
vpermd %ymm1, %ymm3, %ymm3
vpmaskmovq %ymm3, %ymm6, (%rax)
leaq (%rax,%rdx,8), %rax
vmovmskpd %ymm5, %edx
movq %rdx, %rdi
popcntq %rdx, %rdx
salq $5, %rdi
vmovdqa (%r8,%rdi), %ymm3
vpermd %ymm1, %ymm3, %ymm1
vmovdqu %ymm1, (%r12,%rcx,8)
addq %rdx, %rcx
cmpq $11, %rsi
jbe .L1548
vmovdqu 64(%r13), %ymm1
vpcmpgtq %ymm0, %ymm1, %ymm3
vpxor %ymm2, %ymm3, %ymm2
vmovmskpd %ymm2, %edx
movq %rdx, %rdi
popcntq %rdx, %rdx
salq $5, %rdi
vmovdqa (%r8,%rdi), %ymm2
vpslld $28, %ymm2, %ymm5
vpermd %ymm1, %ymm2, %ymm2
vpmaskmovq %ymm2, %ymm5, (%rax)
leaq (%rax,%rdx,8), %rax
vmovmskpd %ymm3, %edx
movq %rdx, %rdi
popcntq %rdx, %rdx
salq $5, %rdi
vmovdqa (%r8,%rdi), %ymm2
vpermd %ymm1, %ymm2, %ymm1
vmovdqu %ymm1, (%r12,%rcx,8)
addq %rdx, %rcx
.L1548:
leaq -4(%rsi), %rdx
leaq 1(%rsi), %rdi
andq $-4, %rdx
leaq 0(,%rcx,8), %r9
addq $4, %rdx
cmpq $4, %rdi
movl $4, %edi
cmovbe %rdi, %rdx
.L1547:
cmpq %rsi, %rdx
je .L1549
subq %rdx, %rsi
vmovdqu 0(%r13,%rdx,8), %ymm2
vmovq %rsi, %xmm1
vpbroadcastq %xmm1, %ymm1
vpcmpgtq %ymm0, %ymm2, %ymm3
vpcmpgtq .LC3(%rip), %ymm1, %ymm1
vpandn %ymm1, %ymm3, %ymm5
vpand %ymm1, %ymm3, %ymm3
vmovmskpd %ymm5, %edx
movq %rdx, %rsi
popcntq %rdx, %rdx
salq $5, %rsi
vmovdqa (%r8,%rsi), %ymm5
vpslld $28, %ymm5, %ymm6
vpermd %ymm2, %ymm5, %ymm5
vpmaskmovq %ymm5, %ymm6, (%rax)
leaq (%rax,%rdx,8), %rax
vmovmskpd %ymm3, %edx
movq %rdx, %rsi
popcntq %rdx, %rdx
addq %rdx, %rcx
salq $5, %rsi
vmovdqa (%r8,%rsi), %ymm1
vpermd %ymm2, %ymm1, %ymm2
vmovdqu %ymm2, (%r12,%r9)
leaq 0(,%rcx,8), %r9
.L1549:
movq %r10, %rdx
subq %rcx, %rdx
leaq 0(%r13,%rdx,8), %r11
cmpl $8, %r9d
jnb .L1550
testl %r9d, %r9d
jne .L1658
.L1551:
cmpl $8, %r9d
jnb .L1554
testl %r9d, %r9d
jne .L1659
.L1555:
movq %rax, %rcx
subq %r13, %rcx
sarq $3, %rcx
subq %rcx, %r10
subq %rcx, %rdx
movq %rcx, %r15
movq %r10, -144(%rbp)
leaq (%rax,%rdx,8), %rcx
je .L1597
leaq 128(%rax), %rsi
leaq -128(%rcx), %r10
vmovdqu (%rax), %ymm12
vmovdqu 32(%rax), %ymm11
vmovdqu 64(%rax), %ymm10
vmovdqu 96(%rax), %ymm9
vmovdqu -128(%rcx), %ymm8
vmovdqu -96(%rcx), %ymm7
vmovdqu -64(%rcx), %ymm6
vmovdqu -32(%rcx), %ymm5
cmpq %r10, %rsi
je .L1598
xorl %ecx, %ecx
leaq _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices(%rip), %rdi
movl $4, %r11d
jmp .L1562
.p2align 4,,10
.p2align 3
.L1661:
vmovdqu -128(%r10), %ymm13
vmovdqu -96(%r10), %ymm3
prefetcht0 -512(%r10)
addq $-128, %r10
vmovdqu 64(%r10), %ymm2
vmovdqu 96(%r10), %ymm1
.L1561:
vpcmpgtq %ymm0, %ymm13, %ymm14
vmovmskpd %ymm14, %r9d
movq %r9, %r14
popcntq %r9, %r9
salq $5, %r14
vmovdqa (%rdi,%r14), %ymm14
leaq -4(%rdx,%rcx), %r14
vpermd %ymm13, %ymm14, %ymm13
vmovdqu %ymm13, (%rax,%rcx,8)
addq $4, %rcx
vmovdqu %ymm13, (%rax,%r14,8)
vpcmpgtq %ymm0, %ymm3, %ymm13
subq %r9, %rcx
vmovmskpd %ymm13, %r9d
movq %r9, %r14
popcntq %r9, %r9
salq $5, %r14
vmovdqa (%rdi,%r14), %ymm13
leaq -8(%rcx,%rdx), %r14
vpermd %ymm3, %ymm13, %ymm3
vmovdqu %ymm3, (%rax,%rcx,8)
vmovdqu %ymm3, (%rax,%r14,8)
vpcmpgtq %ymm0, %ymm2, %ymm3
movq %r11, %r14
subq %r9, %r14
addq %r14, %rcx
vmovmskpd %ymm3, %r9d
movq %r9, %r14
popcntq %r9, %r9
salq $5, %r14
vmovdqa (%rdi,%r14), %ymm3
leaq -12(%rcx,%rdx), %r14
subq $16, %rdx
vpermd %ymm2, %ymm3, %ymm2
vmovdqu %ymm2, (%rax,%rcx,8)
vmovdqu %ymm2, (%rax,%r14,8)
vpcmpgtq %ymm0, %ymm1, %ymm2
movq %r11, %r14
subq %r9, %r14
leaq (%r14,%rcx), %r9
vmovmskpd %ymm2, %ecx
movq %rcx, %r14
popcntq %rcx, %rcx
salq $5, %r14
vmovdqa (%rdi,%r14), %ymm2
leaq (%r9,%rdx), %r14
vpermd %ymm1, %ymm2, %ymm1
vmovdqu %ymm1, (%rax,%r9,8)
vmovdqu %ymm1, (%rax,%r14,8)
movq %r11, %r14
subq %rcx, %r14
leaq (%r14,%r9), %rcx
cmpq %r10, %rsi
je .L1660
.L1562:
movq %rsi, %r9
subq %rax, %r9
sarq $3, %r9
subq %rcx, %r9
cmpq $16, %r9
ja .L1661
vmovdqu (%rsi), %ymm13
vmovdqu 32(%rsi), %ymm3
prefetcht0 512(%rsi)
subq $-128, %rsi
vmovdqu -64(%rsi), %ymm2
vmovdqu -32(%rsi), %ymm1
jmp .L1561
.p2align 4,,10
.p2align 3
.L1655:
movl $8, %eax
subq %rdx, %rax
leaq (%rdi,%rax,8), %rax
movq -88(%rbp), %rdi
leaq -8(%rdx,%rdi), %r14
jmp .L1501
.p2align 4,,10
.p2align 3
.L1660:
leaq (%rdx,%rcx), %r9
leaq (%rax,%rcx,8), %r10
addq $4, %rcx
.L1559:
vpcmpgtq %ymm0, %ymm12, %ymm1
vmovmskpd %ymm1, %esi
movq %rsi, %r11
popcntq %rsi, %rsi
subq %rsi, %rcx
salq $5, %r11
vmovdqa (%rdi,%r11), %ymm1
vpermd %ymm12, %ymm1, %ymm12
vpcmpgtq %ymm0, %ymm11, %ymm1
vmovdqu %ymm12, (%r10)
vmovdqu %ymm12, -32(%rax,%r9,8)
vmovmskpd %ymm1, %esi
movq %rsi, %r9
popcntq %rsi, %rsi
salq $5, %r9
vmovdqa (%rdi,%r9), %ymm1
leaq -8(%rdx,%rcx), %r9
vpermd %ymm11, %ymm1, %ymm11
vpcmpgtq %ymm0, %ymm10, %ymm1
vmovdqu %ymm11, (%rax,%rcx,8)
subq %rsi, %rcx
vmovdqu %ymm11, (%rax,%r9,8)
addq $4, %rcx
vmovmskpd %ymm1, %r9d
movq %r9, %rsi
popcntq %r9, %r9
salq $5, %rsi
vmovdqa (%rdi,%rsi), %ymm1
leaq -12(%rdx,%rcx), %rsi
vpermd %ymm10, %ymm1, %ymm10
vpcmpgtq %ymm0, %ymm9, %ymm1
vmovdqu %ymm10, (%rax,%rcx,8)
vmovdqu %ymm10, (%rax,%rsi,8)
movl $4, %esi
movq %rsi, %r10
subq %r9, %r10
vmovmskpd %ymm1, %r9d
addq %r10, %rcx
movq %r9, %r10
popcntq %r9, %r9
salq $5, %r10
vmovdqa (%rdi,%r10), %ymm1
leaq -16(%rdx,%rcx), %r10
vpermd %ymm9, %ymm1, %ymm9
vpcmpgtq %ymm0, %ymm8, %ymm1
vmovdqu %ymm9, (%rax,%rcx,8)
vmovdqu %ymm9, (%rax,%r10,8)
movq %rsi, %r10
subq %r9, %r10
leaq (%r10,%rcx), %r9
vmovmskpd %ymm1, %ecx
movq %rcx, %r10
popcntq %rcx, %rcx
salq $5, %r10
vmovdqa (%rdi,%r10), %ymm1
leaq -20(%rdx,%r9), %r10
vpermd %ymm8, %ymm1, %ymm8
vpcmpgtq %ymm0, %ymm7, %ymm1
vmovdqu %ymm8, (%rax,%r9,8)
vmovdqu %ymm8, (%rax,%r10,8)
movq %rsi, %r10
subq %rcx, %r10
leaq (%r10,%r9), %rcx
vmovmskpd %ymm1, %r9d
movq %r9, %r10
popcntq %r9, %r9
salq $5, %r10
vmovdqa (%rdi,%r10), %ymm1
leaq -24(%rdx,%rcx), %r10
vpermd %ymm7, %ymm1, %ymm7
vpcmpgtq %ymm0, %ymm6, %ymm1
vmovdqu %ymm7, (%rax,%rcx,8)
vmovdqu %ymm7, (%rax,%r10,8)
movq %rsi, %r10
subq %r9, %r10
leaq (%r10,%rcx), %r9
vmovmskpd %ymm1, %ecx
movq %rcx, %r10
salq $5, %r10
vmovdqa (%rdi,%r10), %ymm1
leaq -28(%rdx,%r9), %r10
vpermd %ymm6, %ymm1, %ymm6
vpcmpgtq %ymm0, %ymm5, %ymm1
vmovdqu %ymm6, (%rax,%r9,8)
vmovdqu %ymm6, (%rax,%r10,8)
xorl %r10d, %r10d
popcntq %rcx, %r10
movq %rsi, %rcx
subq %r10, %rcx
addq %r9, %rcx
vmovmskpd %ymm1, %r9d
movq %r9, %r10
leaq -32(%rdx,%rcx), %rdx
popcntq %r9, %r9
subq %r9, %rsi
salq $5, %r10
vmovdqa (%rdi,%r10), %ymm1
movq -144(%rbp), %rdi
vpermd %ymm5, %ymm1, %ymm5
vmovdqu %ymm5, (%rax,%rcx,8)
vmovdqu %ymm5, (%rax,%rdx,8)
leaq (%rsi,%rcx), %rdx
subq %rdx, %rdi
leaq (%rax,%rdx,8), %rcx
.L1558:
movq %rcx, %rsi
cmpq $3, %rdi
ja .L1563
movq -144(%rbp), %rdi
leaq -32(%rax,%rdi,8), %rsi
.L1563:
vpcmpgtq %ymm0, %ymm4, %ymm0
vpcmpeqd %ymm1, %ymm1, %ymm1
vmovdqu (%rsi), %ymm6
movq -144(%rbp), %rdi
vmovdqu %ymm6, (%rax,%rdi,8)
vpxor %ymm1, %ymm0, %ymm1
vmovdqa %ymm6, -176(%rbp)
vmovmskpd %ymm1, %esi
movq %rsi, %rdi
popcntq %rsi, %rsi
addq %rsi, %rdx
salq $5, %rdi
leaq (%r15,%rdx), %r14
vmovdqa (%r8,%rdi), %ymm1
vpslld $28, %ymm1, %ymm2
vpermd %ymm4, %ymm1, %ymm1
vpmaskmovq %ymm1, %ymm2, (%rcx)
vmovmskpd %ymm0, %ecx
salq $5, %rcx
vmovdqa (%r8,%rcx), %ymm0
vpslld $28, %ymm0, %ymm1
vpermd %ymm4, %ymm0, %ymm4
vpmaskmovq %ymm4, %ymm1, (%rax,%rdx,8)
movq -96(%rbp), %r15
subq $1, %r15
cmpl $2, -112(%rbp)
je .L1662
movq -104(%rbp), %rsi
movq %r15, %r9
movq %rbx, %r8
movq %r12, %rcx
movq %r14, %rdx
movq %r13, %rdi
vzeroupper
call _ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
cmpl $3, -112(%rbp)
je .L1649
.L1565:
movq -88(%rbp), %rdx
movq -104(%rbp), %rsi
leaq 0(%r13,%r14,8), %rdi
movq %r15, %r9
movq %rbx, %r8
movq %r12, %rcx
subq %r14, %rdx
call _ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1649:
subq $-128, %rsp
popq %rbx
popq %r10
.cfi_remember_state
.cfi_def_cfa 10, 0
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
leaq -8(%r10), %rsp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1554:
.cfi_restore_state
movq (%r12), %rcx
leaq 8(%r11), %rdi
andq $-8, %rdi
movq %rcx, (%r11)
movl %r9d, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r11,%rcx)
subq %rdi, %r11
movq %r12, %rsi
leal (%r9,%r11), %ecx
subq %r11, %rsi
shrl $3, %ecx
rep movsq
jmp .L1555
.p2align 4,,10
.p2align 3
.L1550:
movq (%r11), %rcx
leaq 8(%rax), %rdi
andq $-8, %rdi
movq %rcx, (%rax)
movl %r9d, %ecx
movq -8(%r11,%rcx), %rsi
movq %rsi, -8(%rax,%rcx)
movq %rax, %rcx
movq %r11, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %r9d, %ecx
shrl $3, %ecx
rep movsq
jmp .L1551
.p2align 4,,10
.p2align 3
.L1659:
movzbl (%r12), %ecx
movb %cl, (%r11)
jmp .L1555
.p2align 4,,10
.p2align 3
.L1658:
movzbl (%r11), %ecx
movb %cl, (%rax)
jmp .L1551
.p2align 4,,10
.p2align 3
.L1654:
cmpq $1, %rdx
jbe .L1649
leaq 512(%rdi), %rax
cmpq %rax, %rsi
jb .L1663
movl $4, %esi
call _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L1649
.p2align 4,,10
.p2align 3
.L1503:
movq -144(%rbp), %rax
movl $4, %edi
vmovdqa .LC3(%rip), %ymm4
vpcmpeqq 0(%r13), %ymm3, %ymm0
andl $3, %eax
subq %rax, %rdi
vmovq %rdi, %xmm6
vpbroadcastq %xmm6, %ymm1
vpcmpgtq %ymm4, %ymm1, %ymm1
vpandn %ymm1, %ymm0, %ymm0
vmovmskpd %ymm0, %eax
testl %eax, %eax
jne .L1664
vpxor %xmm1, %xmm1, %xmm1
movq -88(%rbp), %r8
leaq 512(%r13,%rdi,8), %rsi
vmovdqa %ymm1, %ymm0
vmovdqa %ymm1, %ymm5
.p2align 4,,10
.p2align 3
.L1509:
movq %rdi, %rcx
leaq 64(%rdi), %rdi
cmpq %rdi, %r8
jb .L1665
leaq -512(%rsi), %rax
.L1508:
vpxor (%rax), %ymm3, %ymm2
leaq 64(%rax), %rdx
vpor %ymm0, %ymm2, %ymm0
vpxor 32(%rax), %ymm3, %ymm2
vpor %ymm1, %ymm2, %ymm1
vpxor 64(%rax), %ymm3, %ymm2
vpor %ymm0, %ymm2, %ymm0
vpxor 96(%rax), %ymm3, %ymm2
vpor %ymm1, %ymm2, %ymm1
vpxor 128(%rax), %ymm3, %ymm2
vpor %ymm0, %ymm2, %ymm0
vpxor 160(%rax), %ymm3, %ymm2
leaq 192(%rdx), %rax
vpor %ymm1, %ymm2, %ymm1
vpxor 128(%rdx), %ymm3, %ymm2
vpor %ymm0, %ymm2, %ymm0
vpxor 160(%rdx), %ymm3, %ymm2
vpor %ymm1, %ymm2, %ymm1
cmpq %rsi, %rax
jne .L1508
vpor %ymm1, %ymm0, %ymm2
leaq 704(%rdx), %rsi
vpcmpeqq %ymm5, %ymm2, %ymm2
vmovmskpd %ymm2, %eax
cmpl $15, %eax
je .L1509
vpcmpeqq 0(%r13,%rcx,8), %ymm3, %ymm0
vpcmpeqd %ymm1, %ymm1, %ymm1
vpxor %ymm1, %ymm0, %ymm0
vmovmskpd %ymm0, %eax
testl %eax, %eax
jne .L1511
.p2align 4,,10
.p2align 3
.L1510:
addq $4, %rcx
vpcmpeqq 0(%r13,%rcx,8), %ymm3, %ymm0
vpxor %ymm1, %ymm0, %ymm0
vmovmskpd %ymm0, %eax
testl %eax, %eax
je .L1510
.L1511:
tzcntl %eax, %eax
addq %rcx, %rax
.L1507:
vpbroadcastq 0(%r13,%rax,8), %ymm1
leaq 0(%r13,%rax,8), %rdi
vpcmpgtq %ymm3, %ymm1, %ymm0
vmovmskpd %ymm0, %edx
testl %edx, %edx
jne .L1516
movq -88(%rbp), %rsi
xorl %ecx, %ecx
leaq -4(%rsi), %rax
jmp .L1521
.p2align 4,,10
.p2align 3
.L1517:
vmovmskpd %ymm0, %edx
vmovdqu %ymm3, 0(%r13,%rax,8)
popcntq %rdx, %rdx
addq %rdx, %rcx
leaq -4(%rax), %rdx
cmpq %rdx, %rsi
jbe .L1666
movq %rdx, %rax
.L1521:
vpcmpeqq 0(%r13,%rax,8), %ymm1, %ymm2
vpcmpeqq 0(%r13,%rax,8), %ymm3, %ymm0
vpor %ymm0, %ymm2, %ymm5
vmovmskpd %ymm5, %edx
cmpl $15, %edx
je .L1517
vpcmpeqd %ymm3, %ymm3, %ymm3
leaq 4(%rax), %rsi
vpxor %ymm3, %ymm0, %ymm0
vpandn %ymm0, %ymm2, %ymm2
vmovmskpd %ymm2, %edx
tzcntl %edx, %edx
addq %rax, %rdx
addq $8, %rax
vpbroadcastq 0(%r13,%rdx,8), %ymm3
movq -88(%rbp), %rdx
subq %rcx, %rdx
vmovdqa %ymm3, -80(%rbp)
cmpq %rdx, %rax
ja .L1518
.p2align 4,,10
.p2align 3
.L1519:
vmovdqu %ymm1, -32(%r13,%rax,8)
movq %rax, %rsi
addq $4, %rax
cmpq %rax, %rdx
jnb .L1519
.L1518:
subq %rsi, %rdx
vmovq %rdx, %xmm6
vpbroadcastq %xmm6, %ymm0
vpcmpgtq %ymm4, %ymm0, %ymm0
vpmaskmovq %ymm1, %ymm0, 0(%r13,%rsi,8)
.L1520:
vpbroadcastq (%r12), %ymm0
vpcmpeqq .LC14(%rip), %ymm0, %ymm2
vmovmskpd %ymm2, %eax
cmpl $15, %eax
je .L1583
vpcmpeqq .LC13(%rip), %ymm0, %ymm2
vmovmskpd %ymm2, %eax
cmpl $15, %eax
je .L1534
vpcmpgtq %ymm1, %ymm3, %ymm4
vpblendvb %ymm4, %ymm1, %ymm3, %ymm2
vpcmpgtq %ymm2, %ymm0, %ymm2
vmovmskpd %ymm2, %eax
testl %eax, %eax
jne .L1667
vmovdqa %ymm0, %ymm2
movl $64, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1529:
leaq (%rcx,%rax,4), %rdx
addq $1, %rax
vmovdqu 0(%r13,%rdx,8), %ymm1
vpcmpgtq %ymm2, %ymm1, %ymm3
vpblendvb %ymm3, %ymm2, %ymm1, %ymm1
vmovdqa %ymm1, %ymm2
cmpq $16, %rax
jne .L1529
vpcmpgtq %ymm1, %ymm0, %ymm1
vmovmskpd %ymm1, %eax
testl %eax, %eax
jne .L1653
leaq 64(%rsi), %rax
cmpq %rax, -88(%rbp)
jb .L1668
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1529
.p2align 4,,10
.p2align 3
.L1596:
xorl %r9d, %r9d
xorl %ecx, %ecx
leaq _ZZN3hwy6N_AVX26detail18IndicesFromBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices(%rip), %r8
movq %r13, %rax
jmp .L1547
.p2align 4,,10
.p2align 3
.L1662:
vzeroupper
jmp .L1565
.p2align 4,,10
.p2align 3
.L1597:
movq %r10, %rdi
movq %rax, %rcx
jmp .L1558
.p2align 4,,10
.p2align 3
.L1598:
movq %rax, %r10
movq %rdx, %r9
movl $4, %ecx
leaq _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices(%rip), %rdi
jmp .L1559
.L1657:
movq -88(%rbp), %rsi
leaq -1(%rsi), %rbx
movq %rbx, %r12
shrq %r12
.p2align 4,,10
.p2align 3
.L1545:
movq %r12, %rdx
movq %r13, %rdi
call _ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %r12
jnb .L1545
.p2align 4,,10
.p2align 3
.L1546:
movq 0(%r13,%rbx,8), %rdx
movq 0(%r13), %rax
movq %rbx, %rsi
movq %r13, %rdi
movq %rdx, 0(%r13)
xorl %edx, %edx
movq %rax, 0(%r13,%rbx,8)
call _ZN3hwy6N_AVX26detail8SiftDownINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_mm.isra.0
subq $1, %rbx
jne .L1546
jmp .L1649
.L1585:
movl $12, %eax
movl $11, %esi
jmp .L1543
.p2align 4,,10
.p2align 3
.L1544:
cmpq $23, %rax
je .L1652
.L1543:
movq %rax, %rcx
addq $1, %rax
cmpq (%r12,%rax,8), %rdx
je .L1544
movl $12, %edi
subq $11, %rcx
movq %rdx, %rax
subq %rsi, %rdi
cmpq %rdi, %rcx
jb .L1542
.L1652:
movq (%r12,%rsi,8), %rax
jmp .L1542
.L1586:
movl $9, %esi
movl $10, %eax
jmp .L1543
.L1587:
movl $8, %esi
movl $9, %eax
jmp .L1543
.L1588:
movl $7, %esi
movl $8, %eax
jmp .L1543
.L1589:
movl $6, %esi
movl $7, %eax
jmp .L1543
.L1665:
movq -88(%rbp), %rsi
vpcmpeqd %ymm1, %ymm1, %ymm1
.p2align 4,,10
.p2align 3
.L1513:
movq %rcx, %rdx
addq $4, %rcx
cmpq %rcx, %rsi
jb .L1669
vpcmpeqq -32(%r13,%rcx,8), %ymm3, %ymm0
vpxor %ymm1, %ymm0, %ymm0
vmovmskpd %ymm0, %eax
testl %eax, %eax
je .L1513
.L1651:
tzcntl %eax, %eax
addq %rdx, %rax
jmp .L1507
.L1590:
movl $5, %esi
movl $6, %eax
jmp .L1543
.L1591:
movl $4, %esi
movl $5, %eax
jmp .L1543
.L1516:
movq -88(%rbp), %rsi
leaq -80(%rbp), %rdx
movq %r12, %rcx
vmovdqa %ymm3, %ymm0
vmovdqa %ymm1, -144(%rbp)
subq %rax, %rsi
call _ZN3hwy6N_AVX26detail22MaybePartitionTwoValueINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0
testb %al, %al
jne .L1649
vmovdqa -80(%rbp), %ymm3
vmovdqa -144(%rbp), %ymm1
jmp .L1520
.L1592:
movl $3, %esi
movl $4, %eax
jmp .L1543
.L1593:
movl $2, %esi
movl $3, %eax
jmp .L1543
.L1594:
movl $1, %esi
movl $2, %eax
jmp .L1543
.L1656:
xorl %esi, %esi
movl $1, %eax
jmp .L1543
.L1666:
vmovq %rax, %xmm6
vpcmpeqq 0(%r13), %ymm3, %ymm5
movq -88(%rbp), %rdx
vpbroadcastq %xmm6, %ymm2
vpcmpeqq 0(%r13), %ymm1, %ymm0
vpcmpgtq %ymm4, %ymm2, %ymm2
subq %rcx, %rdx
vpor %ymm5, %ymm0, %ymm0
vpand %ymm2, %ymm5, %ymm6
vpcmpeqd %ymm5, %ymm5, %ymm5
vpxor %ymm5, %ymm2, %ymm2
vpor %ymm2, %ymm0, %ymm0
vmovmskpd %ymm0, %esi
cmpl $15, %esi
jne .L1670
vmovmskpd %ymm6, %ecx
movq %rdx, %rax
vmovdqu %ymm3, 0(%r13)
popcntq %rcx, %rcx
subq %rcx, %rax
cmpq $3, %rax
jbe .L1572
leaq -4(%rax), %rcx
movq -112(%rbp), %rsi
movq %rcx, %rdx
shrq $2, %rdx
salq $5, %rdx
leaq 32(%r13,%rdx), %rdx
.p2align 4,,10
.p2align 3
.L1526:
vmovdqu %ymm1, (%rsi)
addq $32, %rsi
cmpq %rsi, %rdx
jne .L1526
andq $-4, %rcx
leaq 4(%rcx), %rdx
leaq 0(,%rdx,8), %rcx
subq %rdx, %rax
.L1525:
vmovdqa %ymm1, (%r12)
testq %rax, %rax
je .L1648
leaq 0(%r13,%rcx), %rdi
leaq 0(,%rax,8), %rdx
movq %r12, %rsi
vzeroupper
call memcpy@PLT
jmp .L1649
.L1668:
movq -88(%rbp), %rdx
jmp .L1536
.p2align 4,,10
.p2align 3
.L1537:
vpcmpgtq -32(%r13,%rsi,8), %ymm0, %ymm1
vmovmskpd %ymm1, %eax
testl %eax, %eax
jne .L1653
.L1536:
movq %rsi, %rax
addq $4, %rsi
cmpq %rsi, %rdx
jnb .L1537
movq -88(%rbp), %rdi
cmpq %rax, %rdi
je .L1583
vpcmpgtq -32(%r13,%rdi,8), %ymm0, %ymm1
vmovmskpd %ymm1, %eax
cmpl $1, %eax
movl $1, %eax
adcl $0, %eax
movl %eax, -112(%rbp)
jmp .L1538
.L1540:
movl $11, %eax
movl $10, %esi
jmp .L1543
.L1669:
movq -88(%rbp), %rax
vpcmpeqd %ymm1, %ymm1, %ymm1
vpcmpeqq -32(%r13,%rax,8), %ymm3, %ymm0
leaq -4(%rax), %rdx
vpxor %ymm1, %ymm0, %ymm0
vmovmskpd %ymm0, %eax
testl %eax, %eax
jne .L1651
.L1648:
vzeroupper
jmp .L1649
.L1533:
vmovdqu -32(%r13,%rsi,8), %ymm6
vpcmpgtq %ymm0, %ymm6, %ymm1
vmovmskpd %ymm1, %eax
testl %eax, %eax
jne .L1653
.L1532:
movq %rsi, %rax
addq $4, %rsi
cmpq %rsi, -88(%rbp)
jnb .L1533
movq -88(%rbp), %rdi
cmpq %rax, %rdi
je .L1534
vmovdqu -32(%r13,%rdi,8), %ymm6
vpcmpgtq %ymm0, %ymm6, %ymm1
vmovdqa %ymm6, -144(%rbp)
vmovmskpd %ymm1, %eax
testl %eax, %eax
jne .L1653
.L1534:
vpcmpeqd %ymm1, %ymm1, %ymm1
movl $3, -112(%rbp)
vpaddq %ymm1, %ymm0, %ymm0
jmp .L1538
.L1663:
movq %rdx, %rcx
xorl %eax, %eax
cmpq $3, %rdx
jbe .L1494
movq %rdx, %rbx
leaq -4(%rdx), %rdx
movq (%rdi), %rcx
movq %rdx, %rax
shrq $2, %rax
movq %rcx, (%r12)
addq $1, %rax
salq $5, %rax
movl %eax, %ecx
movq -8(%rdi,%rcx), %rsi
leaq 8(%r12), %rdi
andq $-8, %rdi
movq %rsi, -8(%r12,%rcx)
movq %r12, %rcx
movq %r13, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-4, %rax
shrl $3, %ecx
rep movsq
addq $4, %rax
subq %rax, %rbx
movq %rbx, %rcx
je .L1497
.L1494:
salq $3, %rax
leaq 0(,%rcx,8), %rdx
testq %rcx, %rcx
movl $8, %ecx
cmove %rcx, %rdx
leaq (%r12,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
.L1497:
movq -88(%rbp), %rbx
movl $32, %edx
movl $1, %esi
movl %ebx, %eax
subl $1, %eax
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %edx
movl $1, %eax
shlx %rdx, %rsi, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $4, %rdx
cmpq %rdx, %rbx
jnb .L1496
vmovdqa .LC13(%rip), %ymm0
movq %rbx, %rax
.p2align 4,,10
.p2align 3
.L1495:
vmovdqu %ymm0, (%r12,%rax,8)
addq $4, %rax
cmpq %rdx, %rax
jb .L1495
vzeroupper
.L1496:
movq %r12, %rdi
call _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
xorl %eax, %eax
cmpq $3, -88(%rbp)
jbe .L1499
movq -88(%rbp), %rbx
movq (%r12), %rcx
leaq 8(%r13), %rdi
andq $-8, %rdi
leaq -4(%rbx), %rdx
movq %rcx, 0(%r13)
movq %rdx, %rax
shrq $2, %rax
addq $1, %rax
salq $5, %rax
movl %eax, %ecx
movq -8(%r12,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %r12, %rsi
subq %rdi, %rcx
subq %rcx, %rsi
addl %eax, %ecx
movq %rdx, %rax
andq $-4, %rax
shrl $3, %ecx
rep movsq
addq $4, %rax
subq %rax, %rbx
movq %rbx, -88(%rbp)
je .L1649
.L1499:
movq -88(%rbp), %rbx
salq $3, %rax
movl $8, %ecx
leaq 0(%r13,%rax), %rdi
leaq (%r12,%rax), %rsi
leaq 0(,%rbx,8), %rdx
testq %rbx, %rbx
cmove %rcx, %rdx
call memcpy@PLT
jmp .L1649
.L1664:
tzcntl %eax, %eax
jmp .L1507
.L1583:
movl $2, -112(%rbp)
jmp .L1538
.L1667:
vpblendvb %ymm4, %ymm3, %ymm1, %ymm1
vpcmpgtq %ymm0, %ymm1, %ymm1
vmovmskpd %ymm1, %eax
testl %eax, %eax
jne .L1653
vmovdqa %ymm0, %ymm2
movl $64, %esi
xorl %ecx, %ecx
xorl %eax, %eax
.p2align 4,,10
.p2align 3
.L1530:
leaq (%rcx,%rax,4), %rdx
addq $1, %rax
vmovdqu 0(%r13,%rdx,8), %ymm1
vpcmpgtq %ymm2, %ymm1, %ymm3
vpblendvb %ymm3, %ymm1, %ymm2, %ymm1
vmovdqa %ymm1, %ymm2
cmpq $16, %rax
jne .L1530
vpcmpgtq %ymm0, %ymm1, %ymm1
vmovmskpd %ymm1, %eax
testl %eax, %eax
jne .L1653
leaq 64(%rsi), %rax
cmpq %rax, -88(%rbp)
jb .L1532
movq %rsi, %rcx
movq %rax, %rsi
xorl %eax, %eax
jmp .L1530
.L1572:
xorl %ecx, %ecx
jmp .L1525
.L1670:
vpxor %ymm5, %ymm0, %ymm0
vmovmskpd %ymm0, %ecx
tzcntl %ecx, %ecx
vpbroadcastq 0(%r13,%rcx,8), %ymm3
leaq 4(%rax), %rcx
vmovdqa %ymm3, -80(%rbp)
cmpq %rdx, %rcx
ja .L1523
.L1524:
vmovdqu %ymm1, -32(%r13,%rcx,8)
movq %rcx, %rax
addq $4, %rcx
cmpq %rdx, %rcx
jbe .L1524
.L1523:
subq %rax, %rdx
vmovq %rdx, %xmm0
vpbroadcastq %xmm0, %ymm0
vpcmpgtq %ymm4, %ymm0, %ymm0
vpmaskmovq %ymm1, %ymm0, 0(%r13,%rax,8)
jmp .L1520
.cfi_endproc
.LFE18808:
.size _ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0, .-_ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.section .text.unlikely._ZN3hwy7N_SSSE310SortI64AscEPlm,"ax",@progbits
.LCOLDB15:
.section .text._ZN3hwy7N_SSSE310SortI64AscEPlm,"ax",@progbits
.LHOTB15:
.p2align 4
.globl _ZN3hwy7N_SSSE310SortI64AscEPlm
.hidden _ZN3hwy7N_SSSE310SortI64AscEPlm
.type _ZN3hwy7N_SSSE310SortI64AscEPlm, @function
_ZN3hwy7N_SSSE310SortI64AscEPlm:
.LFB2946:
.cfi_startproc
cmpq $1, %rsi
jbe .L1692
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
pushq %r13
.cfi_offset 15, -24
.cfi_offset 14, -32
.cfi_offset 13, -40
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -48
movq %rsi, %r12
pushq %rbx
subq $312, %rsp
.cfi_offset 3, -56
cmpq $32, %rsi
jbe .L1695
cmpq $0, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
je .L1696
.L1682:
leaq -336(%rbp), %rcx
leaq 0(%r13,%r12,8), %rsi
movq %r12, %rdx
movq %r13, %rdi
movl $50, %r9d
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %r8
call _ZN3hwy7N_SSSE36detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1671:
addq $312, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1692:
.cfi_restore 3
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
.cfi_restore 14
.cfi_restore 15
ret
.p2align 4,,10
.p2align 3
.L1695:
.cfi_def_cfa 6, 16
.cfi_offset 3, -56
.cfi_offset 6, -16
.cfi_offset 12, -48
.cfi_offset 13, -40
.cfi_offset 14, -32
.cfi_offset 15, -24
leaq 0(,%rsi,8), %r8
leaq 256(%rdi), %rax
leaq (%rdi,%r8), %rdx
cmpq %rax, %rdx
jb .L1675
movl $2, %esi
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L1671
.p2align 4,,10
.p2align 3
.L1696:
xorl %edx, %edx
movl $16, %esi
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %rdi
call getrandom@PLT
cmpq $16, %rax
jne .L1690
movq $1, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
jmp .L1682
.L1675:
leaq -2(%rsi), %r14
movq %r12, %rdx
leaq -336(%rbp), %r15
movq %r13, %rsi
movq %r14, %rbx
andq $-2, %r14
movq %r15, %rdi
shrq %rbx
addq $2, %r14
addq $1, %rbx
salq $4, %rbx
movl %ebx, %ecx
shrl $3, %ecx
subq %r14, %rdx
rep movsq
movq %rdx, -344(%rbp)
je .L1679
leaq 0(,%r14,8), %rax
salq $3, %rdx
movq %r8, -352(%rbp)
leaq (%r15,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
movq -352(%rbp), %r8
.L1679:
leal -1(%r12), %eax
movl $32, %ecx
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
leaq 2(%rdx), %rax
cmpq %rax, %r12
jnb .L1680
movdqa .LC4(%rip), %xmm0
leaq 2(%r12), %rdx
movups %xmm0, -336(%rbp,%r8)
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -320(%rbp,%r8)
leaq 4(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -304(%rbp,%r8)
leaq 6(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -288(%rbp,%r8)
leaq 8(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -272(%rbp,%r8)
leaq 10(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -256(%rbp,%r8)
leaq 12(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -240(%rbp,%r8)
leaq 14(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -224(%rbp,%r8)
leaq 16(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -208(%rbp,%r8)
leaq 18(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -192(%rbp,%r8)
leaq 20(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -176(%rbp,%r8)
leaq 22(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -160(%rbp,%r8)
leaq 24(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
movups %xmm0, -144(%rbp,%r8)
leaq 26(%r12), %rdx
cmpq %rdx, %rax
jbe .L1680
leaq 28(%r12), %rdx
movups %xmm0, -128(%rbp,%r8)
cmpq %rdx, %rax
jbe .L1680
addq $30, %r12
movups %xmm0, -112(%rbp,%r8)
cmpq %r12, %rax
jbe .L1680
movups %xmm0, -96(%rbp,%r8)
.L1680:
movq %r15, %rdi
call _ZN3hwy7N_SSSE36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -336(%rbp), %rax
leaq 8(%r13), %rdi
movq %r15, %rsi
andq $-8, %rdi
movq %rax, 0(%r13)
movl %ebx, %eax
movq -8(%r15,%rax), %rdx
movq %rdx, -8(%r13,%rax)
movq %r13, %rax
subq %rdi, %rax
addl %eax, %ebx
subq %rax, %rsi
shrl $3, %ebx
movl %ebx, %ecx
rep movsq
movq -344(%rbp), %rax
testq %rax, %rax
je .L1671
salq $3, %r14
salq $3, %rax
leaq 0(%r13,%r14), %rdi
movq %rax, %rdx
leaq (%r15,%r14), %rsi
call memcpy@PLT
jmp .L1671
.cfi_endproc
.section .text.unlikely._ZN3hwy7N_SSSE310SortI64AscEPlm
.cfi_startproc
.type _ZN3hwy7N_SSSE310SortI64AscEPlm.cold, @function
_ZN3hwy7N_SSSE310SortI64AscEPlm.cold:
.LFSB2946:
.L1690:
.cfi_def_cfa 6, 16
.cfi_offset 3, -56
.cfi_offset 6, -16
.cfi_offset 12, -48
.cfi_offset 13, -40
.cfi_offset 14, -32
.cfi_offset 15, -24
call abort@PLT
.cfi_endproc
.LFE2946:
.section .text._ZN3hwy7N_SSSE310SortI64AscEPlm
.size _ZN3hwy7N_SSSE310SortI64AscEPlm, .-_ZN3hwy7N_SSSE310SortI64AscEPlm
.section .text.unlikely._ZN3hwy7N_SSSE310SortI64AscEPlm
.size _ZN3hwy7N_SSSE310SortI64AscEPlm.cold, .-_ZN3hwy7N_SSSE310SortI64AscEPlm.cold
.LCOLDE15:
.section .text._ZN3hwy7N_SSSE310SortI64AscEPlm
.LHOTE15:
.section .text.unlikely._ZN3hwy6N_SSE410SortI64AscEPlm,"ax",@progbits
.LCOLDB16:
.section .text._ZN3hwy6N_SSE410SortI64AscEPlm,"ax",@progbits
.LHOTB16:
.p2align 4
.globl _ZN3hwy6N_SSE410SortI64AscEPlm
.hidden _ZN3hwy6N_SSE410SortI64AscEPlm
.type _ZN3hwy6N_SSE410SortI64AscEPlm, @function
_ZN3hwy6N_SSE410SortI64AscEPlm:
.LFB4014:
.cfi_startproc
cmpq $1, %rsi
jbe .L1718
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
pushq %r13
.cfi_offset 15, -24
.cfi_offset 14, -32
.cfi_offset 13, -40
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -48
movq %rsi, %r12
pushq %rbx
subq $312, %rsp
.cfi_offset 3, -56
cmpq $32, %rsi
jbe .L1721
cmpq $0, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
je .L1722
.L1708:
leaq -336(%rbp), %rcx
leaq 0(%r13,%r12,8), %rsi
movq %r12, %rdx
movq %r13, %rdi
movl $50, %r9d
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %r8
call _ZN3hwy6N_SSE46detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1697:
addq $312, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1718:
.cfi_restore 3
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
.cfi_restore 14
.cfi_restore 15
ret
.p2align 4,,10
.p2align 3
.L1721:
.cfi_def_cfa 6, 16
.cfi_offset 3, -56
.cfi_offset 6, -16
.cfi_offset 12, -48
.cfi_offset 13, -40
.cfi_offset 14, -32
.cfi_offset 15, -24
leaq 0(,%rsi,8), %r8
leaq 256(%rdi), %rax
leaq (%rdi,%r8), %rdx
cmpq %rax, %rdx
jb .L1701
movl $2, %esi
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L1697
.p2align 4,,10
.p2align 3
.L1722:
xorl %edx, %edx
movl $16, %esi
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %rdi
call getrandom@PLT
cmpq $16, %rax
jne .L1716
movq $1, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
jmp .L1708
.L1701:
leaq -2(%rsi), %r14
movq %r12, %rdx
leaq -336(%rbp), %r15
movq %r13, %rsi
movq %r14, %rbx
andq $-2, %r14
movq %r15, %rdi
shrq %rbx
addq $2, %r14
addq $1, %rbx
salq $4, %rbx
movl %ebx, %ecx
shrl $3, %ecx
subq %r14, %rdx
rep movsq
movq %rdx, -344(%rbp)
je .L1705
leaq 0(,%r14,8), %rax
salq $3, %rdx
movq %r8, -352(%rbp)
leaq (%r15,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
movq -352(%rbp), %r8
.L1705:
leal -1(%r12), %eax
movl $32, %ecx
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
leaq 2(%rdx), %rax
cmpq %rax, %r12
jnb .L1706
movdqa .LC4(%rip), %xmm0
leaq 2(%r12), %rdx
movups %xmm0, -336(%rbp,%r8)
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -320(%rbp,%r8)
leaq 4(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -304(%rbp,%r8)
leaq 6(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -288(%rbp,%r8)
leaq 8(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -272(%rbp,%r8)
leaq 10(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -256(%rbp,%r8)
leaq 12(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -240(%rbp,%r8)
leaq 14(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -224(%rbp,%r8)
leaq 16(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -208(%rbp,%r8)
leaq 18(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -192(%rbp,%r8)
leaq 20(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -176(%rbp,%r8)
leaq 22(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -160(%rbp,%r8)
leaq 24(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
movups %xmm0, -144(%rbp,%r8)
leaq 26(%r12), %rdx
cmpq %rdx, %rax
jbe .L1706
leaq 28(%r12), %rdx
movups %xmm0, -128(%rbp,%r8)
cmpq %rdx, %rax
jbe .L1706
addq $30, %r12
movups %xmm0, -112(%rbp,%r8)
cmpq %r12, %rax
jbe .L1706
movups %xmm0, -96(%rbp,%r8)
.L1706:
movq %r15, %rdi
call _ZN3hwy6N_SSE46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -336(%rbp), %rax
leaq 8(%r13), %rdi
movq %r15, %rsi
andq $-8, %rdi
movq %rax, 0(%r13)
movl %ebx, %eax
movq -8(%r15,%rax), %rdx
movq %rdx, -8(%r13,%rax)
movq %r13, %rax
subq %rdi, %rax
addl %eax, %ebx
subq %rax, %rsi
shrl $3, %ebx
movl %ebx, %ecx
rep movsq
movq -344(%rbp), %rax
testq %rax, %rax
je .L1697
salq $3, %r14
salq $3, %rax
leaq 0(%r13,%r14), %rdi
movq %rax, %rdx
leaq (%r15,%r14), %rsi
call memcpy@PLT
jmp .L1697
.cfi_endproc
.section .text.unlikely._ZN3hwy6N_SSE410SortI64AscEPlm
.cfi_startproc
.type _ZN3hwy6N_SSE410SortI64AscEPlm.cold, @function
_ZN3hwy6N_SSE410SortI64AscEPlm.cold:
.LFSB4014:
.L1716:
.cfi_def_cfa 6, 16
.cfi_offset 3, -56
.cfi_offset 6, -16
.cfi_offset 12, -48
.cfi_offset 13, -40
.cfi_offset 14, -32
.cfi_offset 15, -24
call abort@PLT
.cfi_endproc
.LFE4014:
.section .text._ZN3hwy6N_SSE410SortI64AscEPlm
.size _ZN3hwy6N_SSE410SortI64AscEPlm, .-_ZN3hwy6N_SSE410SortI64AscEPlm
.section .text.unlikely._ZN3hwy6N_SSE410SortI64AscEPlm
.size _ZN3hwy6N_SSE410SortI64AscEPlm.cold, .-_ZN3hwy6N_SSE410SortI64AscEPlm.cold
.LCOLDE16:
.section .text._ZN3hwy6N_SSE410SortI64AscEPlm
.LHOTE16:
.section .text.unlikely._ZN3hwy6N_AVX210SortI64AscEPlm,"ax",@progbits
.LCOLDB17:
.section .text._ZN3hwy6N_AVX210SortI64AscEPlm,"ax",@progbits
.LHOTB17:
.p2align 4
.globl _ZN3hwy6N_AVX210SortI64AscEPlm
.hidden _ZN3hwy6N_AVX210SortI64AscEPlm
.type _ZN3hwy6N_AVX210SortI64AscEPlm, @function
_ZN3hwy6N_AVX210SortI64AscEPlm:
.LFB10439:
.cfi_startproc
cmpq $1, %rsi
jbe .L1751
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r14
pushq %r13
.cfi_offset 14, -24
.cfi_offset 13, -32
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -40
movq %rsi, %r12
andq $-32, %rsp
subq $576, %rsp
cmpq $64, %rsi
jbe .L1754
cmpq $0, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
je .L1755
.L1738:
movq %rsp, %rcx
leaq 0(%r13,%r12,8), %rsi
movq %r12, %rdx
movq %r13, %rdi
movl $50, %r9d
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %r8
call _ZN3hwy6N_AVX26detail7RecurseINS0_4SimdIlLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1749:
leaq -24(%rbp), %rsp
popq %r12
popq %r13
popq %r14
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1751:
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
.cfi_restore 14
ret
.p2align 4,,10
.p2align 3
.L1754:
.cfi_def_cfa 6, 16
.cfi_offset 6, -16
.cfi_offset 12, -40
.cfi_offset 13, -32
.cfi_offset 14, -24
leaq (%rdi,%rsi,8), %rax
leaq 512(%rdi), %rdx
cmpq %rdx, %rax
jb .L1756
movl $4, %esi
call _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L1749
.p2align 4,,10
.p2align 3
.L1755:
xorl %edx, %edx
movl $16, %esi
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %rdi
call getrandom@PLT
cmpq $16, %rax
jne .L1748
movq $1, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
jmp .L1738
.L1756:
movq %rsi, %rcx
xorl %eax, %eax
movq %rsp, %r14
cmpq $3, %rsi
jbe .L1729
leaq -4(%rsi), %rax
movq %rsp, %r14
movq %r13, %rsi
movq %rax, %rdx
andq $-4, %rax
movq %r14, %rdi
shrq $2, %rdx
addq $4, %rax
leal 4(,%rdx,4), %ecx
andl $536870908, %ecx
rep movsq
movq %r12, %rcx
subq %rax, %rcx
je .L1733
.L1729:
salq $3, %rax
leaq 0(,%rcx,8), %rdx
testq %rcx, %rcx
movl $8, %ecx
cmove %rcx, %rdx
leaq (%r14,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
.L1733:
leal -1(%r12), %eax
movl $32, %edx
movl $1, %esi
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %edx
movl $1, %eax
shlx %rdx, %rsi, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
addq $4, %rdx
cmpq %rdx, %r12
jnb .L1734
vmovdqa .LC13(%rip), %ymm0
movq %r12, %rax
.p2align 4,,10
.p2align 3
.L1735:
vmovdqu %ymm0, (%r14,%rax,8)
addq $4, %rax
cmpq %rax, %rdx
ja .L1735
vzeroupper
.L1734:
movq %r14, %rdi
call _ZN3hwy6N_AVX26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
cmpq $3, %r12
jbe .L1740
leaq -4(%r12), %rdx
movq (%rsp), %rcx
leaq 8(%r13), %rdi
movq %rdx, %rax
andq $-8, %rdi
andq $-4, %rdx
shrq $2, %rax
movq %rcx, 0(%r13)
addq $1, %rax
salq $5, %rax
movl %eax, %ecx
movq -8(%r14,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %r14, %rsi
subq %rdi, %rcx
addl %ecx, %eax
subq %rcx, %rsi
shrl $3, %eax
movl %eax, %ecx
leaq 4(%rdx), %rax
rep movsq
subq %rax, %r12
je .L1749
.L1736:
salq $3, %rax
leaq 0(,%r12,8), %rdx
testq %r12, %r12
movl $8, %ecx
cmove %rcx, %rdx
leaq 0(%r13,%rax), %rdi
leaq (%r14,%rax), %rsi
call memcpy@PLT
jmp .L1749
.L1740:
xorl %eax, %eax
jmp .L1736
.cfi_endproc
.section .text.unlikely._ZN3hwy6N_AVX210SortI64AscEPlm
.cfi_startproc
.type _ZN3hwy6N_AVX210SortI64AscEPlm.cold, @function
_ZN3hwy6N_AVX210SortI64AscEPlm.cold:
.LFSB10439:
.L1748:
.cfi_def_cfa 6, 16
.cfi_offset 6, -16
.cfi_offset 12, -40
.cfi_offset 13, -32
.cfi_offset 14, -24
call abort@PLT
.cfi_endproc
.LFE10439:
.section .text._ZN3hwy6N_AVX210SortI64AscEPlm
.size _ZN3hwy6N_AVX210SortI64AscEPlm, .-_ZN3hwy6N_AVX210SortI64AscEPlm
.section .text.unlikely._ZN3hwy6N_AVX210SortI64AscEPlm
.size _ZN3hwy6N_AVX210SortI64AscEPlm.cold, .-_ZN3hwy6N_AVX210SortI64AscEPlm.cold
.LCOLDE17:
.section .text._ZN3hwy6N_AVX210SortI64AscEPlm
.LHOTE17:
.section .text.unlikely._ZN3hwy6N_AVX310SortI64AscEPlm,"ax",@progbits
.LCOLDB18:
.section .text._ZN3hwy6N_AVX310SortI64AscEPlm,"ax",@progbits
.LHOTB18:
.p2align 4
.globl _ZN3hwy6N_AVX310SortI64AscEPlm
.hidden _ZN3hwy6N_AVX310SortI64AscEPlm
.type _ZN3hwy6N_AVX310SortI64AscEPlm, @function
_ZN3hwy6N_AVX310SortI64AscEPlm:
.LFB12848:
.cfi_startproc
cmpq $1, %rsi
jbe .L1781
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r13
.cfi_offset 13, -24
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -32
movq %rsi, %r12
pushq %rbx
andq $-64, %rsp
subq $1152, %rsp
.cfi_offset 3, -40
cmpq $128, %rsi
jbe .L1784
cmpq $0, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
je .L1785
.L1772:
movq %rsp, %rcx
leaq 0(%r13,%r12,8), %rsi
movq %r12, %rdx
movq %r13, %rdi
movl $50, %r9d
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %r8
call _ZN3hwy6N_AVX36detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1779:
leaq -24(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1781:
.cfi_restore 3
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
ret
.p2align 4,,10
.p2align 3
.L1784:
.cfi_def_cfa 6, 16
.cfi_offset 3, -40
.cfi_offset 6, -16
.cfi_offset 12, -32
.cfi_offset 13, -24
leaq (%rdi,%rsi,8), %rax
leaq 1024(%rdi), %rdx
cmpq %rdx, %rax
jb .L1786
movl $8, %esi
call _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L1779
.p2align 4,,10
.p2align 3
.L1785:
xorl %edx, %edx
movl $16, %esi
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %rdi
call getrandom@PLT
cmpq $16, %rax
jne .L1778
movq $1, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
jmp .L1772
.L1786:
cmpq $7, %rsi
jbe .L1787
leaq -8(%rsi), %rax
movq %rsp, %rbx
movq %r13, %rsi
movq %rax, %rdx
andq $-8, %rax
movq %rbx, %rdi
shrq $3, %rdx
addq $8, %rax
leal 8(,%rdx,8), %ecx
leaq 0(,%rax,8), %rdx
andl $536870904, %ecx
rep movsq
movq %r12, %rcx
leaq (%rbx,%rdx), %rdi
addq %r13, %rdx
subq %rax, %rcx
movl $255, %eax
kmovd %eax, %k1
cmpq $255, %rcx
jbe .L1762
.L1766:
leal -1(%r12), %eax
movl $32, %ecx
movl $1, %esi
vmovdqu64 (%rdx), %zmm0{%k1}{z}
bsrl %eax, %eax
xorl $31, %eax
vmovdqa64 %zmm0, (%rdi){%k1}
vpbroadcastq .LC10(%rip), %zmm0
subl %eax, %ecx
movl $1, %eax
shlx %rcx, %rsi, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %r12, %rax
movq %rsi, %rdx
salq $4, %rdx
addq $8, %rdx
cmpq %rdx, %r12
jnb .L1770
.p2align 4,,10
.p2align 3
.L1767:
vmovdqu64 %zmm0, (%rbx,%rax,8)
addq $8, %rax
cmpq %rdx, %rax
jb .L1767
.L1770:
movq %rbx, %rdi
vzeroupper
call _ZN3hwy6N_AVX36detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
cmpq $7, %r12
jbe .L1769
leaq -8(%r12), %rdx
movq (%rsp), %rcx
leaq 8(%r13), %rdi
movq %rdx, %rax
andq $-8, %rdi
andq $-8, %rdx
shrq $3, %rax
movq %rcx, 0(%r13)
addq $1, %rax
salq $6, %rax
movl %eax, %ecx
movq -8(%rbx,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %rbx, %rsi
subq %rdi, %rcx
addl %ecx, %eax
subq %rcx, %rsi
shrl $3, %eax
movl %eax, %ecx
leaq 8(%rdx), %rax
rep movsq
leaq 0(,%rax,8), %rdx
subq %rax, %r12
movl $255, %eax
addq %rdx, %r13
addq %rdx, %rbx
kmovd %eax, %k1
cmpq $255, %r12
jbe .L1769
.L1771:
vmovdqa64 (%rbx), %zmm0{%k1}{z}
vmovdqu64 %zmm0, 0(%r13){%k1}
vzeroupper
jmp .L1779
.L1787:
movq %rsp, %rbx
movq %rdi, %rdx
movq %rsi, %rcx
movq %rbx, %rdi
.L1762:
movq $-1, %rax
bzhi %rcx, %rax, %rax
movzbl %al, %eax
kmovd %eax, %k1
jmp .L1766
.L1769:
movq $-1, %rax
bzhi %r12, %rax, %rax
movzbl %al, %eax
kmovd %eax, %k1
jmp .L1771
.cfi_endproc
.section .text.unlikely._ZN3hwy6N_AVX310SortI64AscEPlm
.cfi_startproc
.type _ZN3hwy6N_AVX310SortI64AscEPlm.cold, @function
_ZN3hwy6N_AVX310SortI64AscEPlm.cold:
.LFSB12848:
.L1778:
.cfi_def_cfa 6, 16
.cfi_offset 3, -40
.cfi_offset 6, -16
.cfi_offset 12, -32
.cfi_offset 13, -24
call abort@PLT
.cfi_endproc
.LFE12848:
.section .text._ZN3hwy6N_AVX310SortI64AscEPlm
.size _ZN3hwy6N_AVX310SortI64AscEPlm, .-_ZN3hwy6N_AVX310SortI64AscEPlm
.section .text.unlikely._ZN3hwy6N_AVX310SortI64AscEPlm
.size _ZN3hwy6N_AVX310SortI64AscEPlm.cold, .-_ZN3hwy6N_AVX310SortI64AscEPlm.cold
.LCOLDE18:
.section .text._ZN3hwy6N_AVX310SortI64AscEPlm
.LHOTE18:
.section .text.unlikely._ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm,"ax",@progbits
.LCOLDB19:
.section .text._ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm,"ax",@progbits
.LHOTB19:
.p2align 4
.globl _ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm
.hidden _ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm
.type _ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm, @function
_ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm:
.LFB15264:
.cfi_startproc
cmpq $1, %rsi
jbe .L1812
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r13
.cfi_offset 13, -24
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -32
movq %rsi, %r12
pushq %rbx
andq $-64, %rsp
subq $1152, %rsp
.cfi_offset 3, -40
cmpq $128, %rsi
jbe .L1815
cmpq $0, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
je .L1816
.L1803:
movq %rsp, %rcx
leaq 0(%r13,%r12,8), %rsi
movq %r12, %rdx
movq %r13, %rdi
movl $50, %r9d
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %r8
call _ZN3hwy11N_AVX3_ZEN46detail7RecurseINS0_4SimdIlLm8ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1810:
leaq -24(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1812:
.cfi_restore 3
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
ret
.p2align 4,,10
.p2align 3
.L1815:
.cfi_def_cfa 6, 16
.cfi_offset 3, -40
.cfi_offset 6, -16
.cfi_offset 12, -32
.cfi_offset 13, -24
leaq (%rdi,%rsi,8), %rax
leaq 1024(%rdi), %rdx
cmpq %rdx, %rax
jb .L1817
movl $8, %esi
call _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L1810
.p2align 4,,10
.p2align 3
.L1816:
xorl %edx, %edx
movl $16, %esi
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %rdi
call getrandom@PLT
cmpq $16, %rax
jne .L1809
movq $1, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
jmp .L1803
.L1817:
cmpq $7, %rsi
jbe .L1818
leaq -8(%rsi), %rax
movq %rsp, %rbx
movq %r13, %rsi
movq %rax, %rdx
andq $-8, %rax
movq %rbx, %rdi
shrq $3, %rdx
addq $8, %rax
leal 8(,%rdx,8), %ecx
leaq 0(,%rax,8), %rdx
andl $536870904, %ecx
rep movsq
movq %r12, %rcx
leaq (%rbx,%rdx), %rdi
addq %r13, %rdx
subq %rax, %rcx
movl $255, %eax
kmovd %eax, %k1
cmpq $255, %rcx
jbe .L1793
.L1797:
leal -1(%r12), %eax
movl $32, %ecx
movl $1, %esi
vmovdqu64 (%rdx), %zmm0{%k1}{z}
bsrl %eax, %eax
xorl $31, %eax
vmovdqa64 %zmm0, (%rdi){%k1}
vpbroadcastq .LC10(%rip), %zmm0
subl %eax, %ecx
movl $1, %eax
shlx %rcx, %rsi, %rsi
shrq $4, %rsi
cmove %rax, %rsi
movq %r12, %rax
movq %rsi, %rdx
salq $4, %rdx
addq $8, %rdx
cmpq %rdx, %r12
jnb .L1801
.p2align 4,,10
.p2align 3
.L1798:
vmovdqu64 %zmm0, (%rbx,%rax,8)
addq $8, %rax
cmpq %rdx, %rax
jb .L1798
.L1801:
movq %rbx, %rdi
vzeroupper
call _ZN3hwy11N_AVX3_ZEN46detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
cmpq $7, %r12
jbe .L1800
leaq -8(%r12), %rdx
movq (%rsp), %rcx
leaq 8(%r13), %rdi
movq %rdx, %rax
andq $-8, %rdi
andq $-8, %rdx
shrq $3, %rax
movq %rcx, 0(%r13)
addq $1, %rax
salq $6, %rax
movl %eax, %ecx
movq -8(%rbx,%rcx), %rsi
movq %rsi, -8(%r13,%rcx)
movq %r13, %rcx
movq %rbx, %rsi
subq %rdi, %rcx
addl %ecx, %eax
subq %rcx, %rsi
shrl $3, %eax
movl %eax, %ecx
leaq 8(%rdx), %rax
rep movsq
leaq 0(,%rax,8), %rdx
subq %rax, %r12
movl $255, %eax
addq %rdx, %r13
addq %rdx, %rbx
kmovd %eax, %k1
cmpq $255, %r12
jbe .L1800
.L1802:
vmovdqa64 (%rbx), %zmm0{%k1}{z}
vmovdqu64 %zmm0, 0(%r13){%k1}
vzeroupper
jmp .L1810
.L1818:
movq %rsp, %rbx
movq %rdi, %rdx
movq %rsi, %rcx
movq %rbx, %rdi
.L1793:
movq $-1, %rax
bzhi %rcx, %rax, %rax
movzbl %al, %eax
kmovd %eax, %k1
jmp .L1797
.L1800:
movq $-1, %rax
bzhi %r12, %rax, %rax
movzbl %al, %eax
kmovd %eax, %k1
jmp .L1802
.cfi_endproc
.section .text.unlikely._ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm
.cfi_startproc
.type _ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm.cold, @function
_ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm.cold:
.LFSB15264:
.L1809:
.cfi_def_cfa 6, 16
.cfi_offset 3, -40
.cfi_offset 6, -16
.cfi_offset 12, -32
.cfi_offset 13, -24
call abort@PLT
.cfi_endproc
.LFE15264:
.section .text._ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm
.size _ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm, .-_ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm
.section .text.unlikely._ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm
.size _ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm.cold, .-_ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm.cold
.LCOLDE19:
.section .text._ZN3hwy11N_AVX3_ZEN410SortI64AscEPlm
.LHOTE19:
.section .text.unlikely._ZN3hwy6N_SSE210SortI64AscEPlm,"ax",@progbits
.LCOLDB20:
.section .text._ZN3hwy6N_SSE210SortI64AscEPlm,"ax",@progbits
.LHOTB20:
.p2align 4
.globl _ZN3hwy6N_SSE210SortI64AscEPlm
.hidden _ZN3hwy6N_SSE210SortI64AscEPlm
.type _ZN3hwy6N_SSE210SortI64AscEPlm, @function
_ZN3hwy6N_SSE210SortI64AscEPlm:
.LFB16254:
.cfi_startproc
cmpq $1, %rsi
jbe .L1840
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r15
pushq %r14
pushq %r13
.cfi_offset 15, -24
.cfi_offset 14, -32
.cfi_offset 13, -40
movq %rdi, %r13
pushq %r12
.cfi_offset 12, -48
movq %rsi, %r12
pushq %rbx
subq $312, %rsp
.cfi_offset 3, -56
cmpq $32, %rsi
jbe .L1843
cmpq $0, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
je .L1844
.L1830:
leaq -336(%rbp), %rcx
leaq 0(%r13,%r12,8), %rsi
movq %r12, %rdx
movq %r13, %rdi
movl $50, %r9d
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %r8
call _ZN3hwy6N_SSE26detail7RecurseINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_T0_PT1_SE_mSE_Pmm.isra.0
.L1819:
addq $312, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1840:
.cfi_restore 3
.cfi_restore 6
.cfi_restore 12
.cfi_restore 13
.cfi_restore 14
.cfi_restore 15
ret
.p2align 4,,10
.p2align 3
.L1843:
.cfi_def_cfa 6, 16
.cfi_offset 3, -56
.cfi_offset 6, -16
.cfi_offset 12, -48
.cfi_offset 13, -40
.cfi_offset 14, -32
.cfi_offset 15, -24
leaq 0(,%rsi,8), %r8
leaq 256(%rdi), %rax
leaq (%rdi,%r8), %rdx
cmpq %rax, %rdx
jb .L1823
movl $2, %esi
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
jmp .L1819
.p2align 4,,10
.p2align 3
.L1844:
xorl %edx, %edx
movl $16, %esi
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %rdi
call getrandom@PLT
cmpq $16, %rax
jne .L1838
movq $1, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
jmp .L1830
.L1823:
leaq -2(%rsi), %r14
movq %r12, %rdx
leaq -336(%rbp), %r15
movq %r13, %rsi
movq %r14, %rbx
andq $-2, %r14
movq %r15, %rdi
shrq %rbx
addq $2, %r14
addq $1, %rbx
salq $4, %rbx
movl %ebx, %ecx
shrl $3, %ecx
subq %r14, %rdx
rep movsq
movq %rdx, -344(%rbp)
je .L1827
leaq 0(,%r14,8), %rax
salq $3, %rdx
movq %r8, -352(%rbp)
leaq (%r15,%rax), %rdi
leaq 0(%r13,%rax), %rsi
call memcpy@PLT
movq -352(%rbp), %r8
.L1827:
leal -1(%r12), %eax
movl $32, %ecx
bsrl %eax, %eax
xorl $31, %eax
subl %eax, %ecx
movl $1, %eax
salq %cl, %rax
shrq $4, %rax
movq %rax, %rsi
movl $1, %eax
cmove %rax, %rsi
movq %rsi, %rdx
salq $4, %rdx
leaq 2(%rdx), %rax
cmpq %rax, %r12
jnb .L1828
movdqa .LC4(%rip), %xmm0
leaq 2(%r12), %rdx
movups %xmm0, -336(%rbp,%r8)
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -320(%rbp,%r8)
leaq 4(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -304(%rbp,%r8)
leaq 6(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -288(%rbp,%r8)
leaq 8(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -272(%rbp,%r8)
leaq 10(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -256(%rbp,%r8)
leaq 12(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -240(%rbp,%r8)
leaq 14(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -224(%rbp,%r8)
leaq 16(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -208(%rbp,%r8)
leaq 18(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -192(%rbp,%r8)
leaq 20(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -176(%rbp,%r8)
leaq 22(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -160(%rbp,%r8)
leaq 24(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
movups %xmm0, -144(%rbp,%r8)
leaq 26(%r12), %rdx
cmpq %rdx, %rax
jbe .L1828
leaq 28(%r12), %rdx
movups %xmm0, -128(%rbp,%r8)
cmpq %rdx, %rax
jbe .L1828
addq $30, %r12
movups %xmm0, -112(%rbp,%r8)
cmpq %r12, %rax
jbe .L1828
movups %xmm0, -96(%rbp,%r8)
.L1828:
movq %r15, %rdi
call _ZN3hwy6N_SSE26detail14SortingNetworkINS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEvT_PT0_m.isra.0
movq -336(%rbp), %rax
leaq 8(%r13), %rdi
movq %r15, %rsi
andq $-8, %rdi
movq %rax, 0(%r13)
movl %ebx, %eax
movq -8(%r15,%rax), %rdx
movq %rdx, -8(%r13,%rax)
movq %r13, %rax
subq %rdi, %rax
addl %eax, %ebx
subq %rax, %rsi
shrl $3, %ebx
movl %ebx, %ecx
rep movsq
movq -344(%rbp), %rax
testq %rax, %rax
je .L1819
salq $3, %r14
salq $3, %rax
leaq 0(%r13,%r14), %rdi
movq %rax, %rdx
leaq (%r15,%r14), %rsi
call memcpy@PLT
jmp .L1819
.cfi_endproc
.section .text.unlikely._ZN3hwy6N_SSE210SortI64AscEPlm
.cfi_startproc
.type _ZN3hwy6N_SSE210SortI64AscEPlm.cold, @function
_ZN3hwy6N_SSE210SortI64AscEPlm.cold:
.LFSB16254:
.L1838:
.cfi_def_cfa 6, 16
.cfi_offset 3, -56
.cfi_offset 6, -16
.cfi_offset 12, -48
.cfi_offset 13, -40
.cfi_offset 14, -32
.cfi_offset 15, -24
call abort@PLT
.cfi_endproc
.LFE16254:
.section .text._ZN3hwy6N_SSE210SortI64AscEPlm
.size _ZN3hwy6N_SSE210SortI64AscEPlm, .-_ZN3hwy6N_SSE210SortI64AscEPlm
.section .text.unlikely._ZN3hwy6N_SSE210SortI64AscEPlm
.size _ZN3hwy6N_SSE210SortI64AscEPlm.cold, .-_ZN3hwy6N_SSE210SortI64AscEPlm.cold
.LCOLDE20:
.section .text._ZN3hwy6N_SSE210SortI64AscEPlm
.LHOTE20:
.section .text.unlikely._ZN3hwy17GetGeneratorStateEv,"ax",@progbits
.LCOLDB21:
.section .text._ZN3hwy17GetGeneratorStateEv,"ax",@progbits
.LHOTB21:
.p2align 4
.globl _ZN3hwy17GetGeneratorStateEv
.hidden _ZN3hwy17GetGeneratorStateEv
.type _ZN3hwy17GetGeneratorStateEv, @function
_ZN3hwy17GetGeneratorStateEv:
.LFB16255:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r12
.cfi_offset 12, -24
leaq _ZZN3hwy17GetGeneratorStateEvE5state(%rip), %r12
subq $8, %rsp
cmpq $0, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
je .L1850
movq %r12, %rax
movq -8(%rbp), %r12
leave
.cfi_remember_state
.cfi_def_cfa 7, 8
ret
.p2align 4,,10
.p2align 3
.L1850:
.cfi_restore_state
xorl %edx, %edx
movl $16, %esi
movq %r12, %rdi
call getrandom@PLT
cmpq $16, %rax
jne .L1848
movq $1, 16+_ZZN3hwy17GetGeneratorStateEvE5state(%rip)
movq %r12, %rax
movq -8(%rbp), %r12
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.section .text.unlikely._ZN3hwy17GetGeneratorStateEv
.cfi_startproc
.type _ZN3hwy17GetGeneratorStateEv.cold, @function
_ZN3hwy17GetGeneratorStateEv.cold:
.LFSB16255:
.L1848:
.cfi_def_cfa 6, 16
.cfi_offset 6, -16
.cfi_offset 12, -24
call abort@PLT
.cfi_endproc
.LFE16255:
.section .text._ZN3hwy17GetGeneratorStateEv
.size _ZN3hwy17GetGeneratorStateEv, .-_ZN3hwy17GetGeneratorStateEv
.section .text.unlikely._ZN3hwy17GetGeneratorStateEv
.size _ZN3hwy17GetGeneratorStateEv.cold, .-_ZN3hwy17GetGeneratorStateEv.cold
.LCOLDE21:
.section .text._ZN3hwy17GetGeneratorStateEv
.LHOTE21:
.section .text.vqsort_int64_avx2,"ax",@progbits
.p2align 4
.globl vqsort_int64_avx2
.hidden vqsort_int64_avx2
.type vqsort_int64_avx2, @function
vqsort_int64_avx2:
.LFB16256:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
call _ZN3hwy6N_AVX210SortI64AscEPlm
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE16256:
.size vqsort_int64_avx2, .-vqsort_int64_avx2
.section .text.vqsort_int64_sse4,"ax",@progbits
.p2align 4
.globl vqsort_int64_sse4
.hidden vqsort_int64_sse4
.type vqsort_int64_sse4, @function
vqsort_int64_sse4:
.LFB16257:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
call _ZN3hwy6N_SSE410SortI64AscEPlm
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE16257:
.size vqsort_int64_sse4, .-vqsort_int64_sse4
.section .text.vqsort_int64_ssse3,"ax",@progbits
.p2align 4
.globl vqsort_int64_ssse3
.hidden vqsort_int64_ssse3
.type vqsort_int64_ssse3, @function
vqsort_int64_ssse3:
.LFB16258:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
call _ZN3hwy7N_SSSE310SortI64AscEPlm
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE16258:
.size vqsort_int64_ssse3, .-vqsort_int64_ssse3
.section .text.vqsort_int64_sse2,"ax",@progbits
.p2align 4
.globl vqsort_int64_sse2
.hidden vqsort_int64_sse2
.type vqsort_int64_sse2, @function
vqsort_int64_sse2:
.LFB16259:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
call _ZN3hwy6N_SSE210SortI64AscEPlm
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE16259:
.size vqsort_int64_sse2, .-vqsort_int64_sse2
.hidden _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices
.weak _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices
.section .rodata._ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices,"aG",@progbits,_ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices,comdat
.balign 32
.type _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices, @object
.size _ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices, 512
_ZZN3hwy6N_AVX26detail21IndicesFromNotBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices:
.long 8
.long 9
.long 10
.long 11
.long 12
.long 13
.long 14
.long 15
.long 10
.long 11
.long 12
.long 13
.long 14
.long 15
.long 8
.long 9
.long 8
.long 9
.long 12
.long 13
.long 14
.long 15
.long 10
.long 11
.long 12
.long 13
.long 14
.long 15
.long 8
.long 9
.long 10
.long 11
.long 8
.long 9
.long 10
.long 11
.long 14
.long 15
.long 12
.long 13
.long 10
.long 11
.long 14
.long 15
.long 8
.long 9
.long 12
.long 13
.long 8
.long 9
.long 14
.long 15
.long 10
.long 11
.long 12
.long 13
.long 14
.long 15
.long 8
.long 9
.long 10
.long 11
.long 12
.long 13
.long 8
.long 9
.long 10
.long 11
.long 12
.long 13
.long 14
.long 15
.long 10
.long 11
.long 12
.long 13
.long 8
.long 9
.long 14
.long 15
.long 8
.long 9
.long 12
.long 13
.long 10
.long 11
.long 14
.long 15
.long 12
.long 13
.long 8
.long 9
.long 10
.long 11
.long 14
.long 15
.long 8
.long 9
.long 10
.long 11
.long 12
.long 13
.long 14
.long 15
.long 10
.long 11
.long 8
.long 9
.long 12
.long 13
.long 14
.long 15
.long 8
.long 9
.long 10
.long 11
.long 12
.long 13
.long 14
.long 15
.long 8
.long 9
.long 10
.long 11
.long 12
.long 13
.long 14
.long 15
.section .rodata._ZZN3hwy6N_AVX3L11CompressNotIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array,"a"
.balign 16
.type _ZZN3hwy6N_AVX3L11CompressNotIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array, @object
.size _ZZN3hwy6N_AVX3L11CompressNotIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array, 2048
_ZZN3hwy6N_AVX3L11CompressNotIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array:
.quad 1985229328
.quad 124076833
.quad 392512288
.quad 276190258
.quad 660947728
.quad 544625713
.quad 561402928
.quad 554132803
.quad 929382928
.quad 813061153
.quad 829838368
.quad 822568258
.quad 846615568
.quad 839345473
.quad 840394048
.quad 839939668
.quad 1197814288
.quad 1081496353
.quad 1098273568
.quad 1091003698
.quad 1115050768
.quad 1107780913
.quad 1108829488
.quad 1108375123
.quad 1131827728
.quad 1124558113
.quad 1125606688
.quad 1125152338
.quad 1126655248
.quad 1126200913
.quad 1126266448
.quad 1126238053
.quad 1466184208
.quad 1349927713
.quad 1366704928
.quad 1359438898
.quad 1383482128
.quad 1376216113
.quad 1377264688
.quad 1376810563
.quad 1400259088
.quad 1392993313
.quad 1394041888
.quad 1393587778
.quad 1395090448
.quad 1394636353
.quad 1394701888
.quad 1394673508
.quad 1417032208
.quad 1409770273
.quad 1410818848
.quad 1410364978
.quad 1411867408
.quad 1411413553
.quad 1411479088
.quad 1411450723
.quad 1412915728
.quad 1412462113
.quad 1412527648
.quad 1412499298
.quad 1412593168
.quad 1412564833
.quad 1412568928
.quad 1412567158
.quad 1733571088
.quad 1618297633
.quad 1635074848
.quad 1627870258
.quad 1651852048
.quad 1644647473
.quad 1645696048
.quad 1645245763
.quad 1668629008
.quad 1661424673
.quad 1662473248
.quad 1662022978
.quad 1663521808
.quad 1663071553
.quad 1663137088
.quad 1663108948
.quad 1685402128
.quad 1678201633
.quad 1679250208
.quad 1678800178
.quad 1680298768
.quad 1679848753
.quad 1679914288
.quad 1679886163
.quad 1681347088
.quad 1680897313
.quad 1680962848
.quad 1680934738
.quad 1681028368
.quad 1681000273
.quad 1681004368
.quad 1681002613
.quad 1702113808
.quad 1694974753
.quad 1696023328
.quad 1695577138
.quad 1697071888
.quad 1696625713
.quad 1696691248
.quad 1696663363
.quad 1698120208
.quad 1697674273
.quad 1697739808
.quad 1697711938
.quad 1697805328
.quad 1697777473
.quad 1697781568
.quad 1697779828
.quad 1699164688
.quad 1698722593
.quad 1698788128
.quad 1698760498
.quad 1698853648
.quad 1698826033
.quad 1698830128
.quad 1698828403
.quad 1698918928
.quad 1698891553
.quad 1698895648
.quad 1698893938
.quad 1698899728
.quad 1698898033
.quad 1698898288
.quad 1698898183
.quad 1985229328
.quad 1885684513
.quad 1902461728
.quad 1896240178
.quad 1919238928
.quad 1913017393
.quad 1914065968
.quad 1913677123
.quad 1936015888
.quad 1929794593
.quad 1930843168
.quad 1930454338
.quad 1931891728
.quad 1931502913
.quad 1931568448
.quad 1931544148
.quad 1952789008
.quad 1946571553
.quad 1947620128
.quad 1947231538
.quad 1948668688
.quad 1948280113
.quad 1948345648
.quad 1948321363
.quad 1949717008
.quad 1949328673
.quad 1949394208
.quad 1949369938
.quad 1949459728
.quad 1949435473
.quad 1949439568
.quad 1949438053
.quad 1969500688
.quad 1963344673
.quad 1964393248
.quad 1964008498
.quad 1965441808
.quad 1965057073
.quad 1965122608
.quad 1965098563
.quad 1966490128
.quad 1966105633
.quad 1966171168
.quad 1966147138
.quad 1966236688
.quad 1966212673
.quad 1966216768
.quad 1966215268
.quad 1967534608
.quad 1967153953
.quad 1967219488
.quad 1967195698
.quad 1967285008
.quad 1967261233
.quad 1967265328
.quad 1967263843
.quad 1967350288
.quad 1967326753
.quad 1967330848
.quad 1967329378
.quad 1967334928
.quad 1967333473
.quad 1967333728
.quad 1967333638
.quad 1985229328
.quad 1980056353
.quad 1981104928
.quad 1980781618
.quad 1982153488
.quad 1981830193
.quad 1981895728
.quad 1981875523
.quad 1983201808
.quad 1982878753
.quad 1982944288
.quad 1982924098
.quad 1983009808
.quad 1982989633
.quad 1982993728
.quad 1982992468
.quad 1984246288
.quad 1983927073
.quad 1983992608
.quad 1983972658
.quad 1984058128
.quad 1984038193
.quad 1984042288
.quad 1984041043
.quad 1984123408
.quad 1984103713
.quad 1984107808
.quad 1984106578
.quad 1984111888
.quad 1984110673
.quad 1984110928
.quad 1984110853
.quad 1985229328
.quad 1984971553
.quad 1985037088
.quad 1985020978
.quad 1985102608
.quad 1985086513
.quad 1985090608
.quad 1985089603
.quad 1985167888
.quad 1985152033
.quad 1985156128
.quad 1985155138
.quad 1985160208
.quad 1985159233
.quad 1985159488
.quad 1985159428
.quad 1985229328
.quad 1985217313
.quad 1985221408
.quad 1985220658
.quad 1985225488
.quad 1985224753
.quad 1985225008
.quad 1985224963
.quad 1985229328
.quad 1985228833
.quad 1985229088
.quad 1985229058
.quad 1985229328
.quad 1985229313
.quad 1985229328
.quad 1985229328
.set _ZZN3hwy11N_AVX3_ZEN4L11CompressNotIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array,_ZZN3hwy6N_AVX3L11CompressNotIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array
.hidden _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.weak _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.section .rodata._ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,"aG",@progbits,_ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,comdat
.balign 16
.type _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, @object
.size _ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, 64
_ZZN3hwy6N_SSE26detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices:
.string ""
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007"
.ascii "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.section .rodata._ZZN3hwy11N_AVX3_ZEN4L8CompressIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array,"a"
.balign 16
.type _ZZN3hwy11N_AVX3_ZEN4L8CompressIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array, @object
.size _ZZN3hwy11N_AVX3_ZEN4L8CompressIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array, 2048
_ZZN3hwy11N_AVX3_ZEN4L8CompressIlLPv0EEENS0_6Vec512IT_EES5_NS0_7Mask512IS4_EEE12packed_array:
.quad 1985229328
.quad 1985229328
.quad 1985229313
.quad 1985229328
.quad 1985229058
.quad 1985229088
.quad 1985228833
.quad 1985229328
.quad 1985224963
.quad 1985225008
.quad 1985224753
.quad 1985225488
.quad 1985220658
.quad 1985221408
.quad 1985217313
.quad 1985229328
.quad 1985159428
.quad 1985159488
.quad 1985159233
.quad 1985160208
.quad 1985155138
.quad 1985156128
.quad 1985152033
.quad 1985167888
.quad 1985089603
.quad 1985090608
.quad 1985086513
.quad 1985102608
.quad 1985020978
.quad 1985037088
.quad 1984971553
.quad 1985229328
.quad 1984110853
.quad 1984110928
.quad 1984110673
.quad 1984111888
.quad 1984106578
.quad 1984107808
.quad 1984103713
.quad 1984123408
.quad 1984041043
.quad 1984042288
.quad 1984038193
.quad 1984058128
.quad 1983972658
.quad 1983992608
.quad 1983927073
.quad 1984246288
.quad 1982992468
.quad 1982993728
.quad 1982989633
.quad 1983009808
.quad 1982924098
.quad 1982944288
.quad 1982878753
.quad 1983201808
.quad 1981875523
.quad 1981895728
.quad 1981830193
.quad 1982153488
.quad 1980781618
.quad 1981104928
.quad 1980056353
.quad 1985229328
.quad 1967333638
.quad 1967333728
.quad 1967333473
.quad 1967334928
.quad 1967329378
.quad 1967330848
.quad 1967326753
.quad 1967350288
.quad 1967263843
.quad 1967265328
.quad 1967261233
.quad 1967285008
.quad 1967195698
.quad 1967219488
.quad 1967153953
.quad 1967534608
.quad 1966215268
.quad 1966216768
.quad 1966212673
.quad 1966236688
.quad 1966147138
.quad 1966171168
.quad 1966105633
.quad 1966490128
.quad 1965098563
.quad 1965122608
.quad 1965057073
.quad 1965441808
.quad 1964008498
.quad 1964393248
.quad 1963344673
.quad 1969500688
.quad 1949438053
.quad 1949439568
.quad 1949435473
.quad 1949459728
.quad 1949369938
.quad 1949394208
.quad 1949328673
.quad 1949717008
.quad 1948321363
.quad 1948345648
.quad 1948280113
.quad 1948668688
.quad 1947231538
.quad 1947620128
.quad 1946571553
.quad 1952789008
.quad 1931544148
.quad 1931568448
.quad 1931502913
.quad 1931891728
.quad 1930454338
.quad 1930843168
.quad 1929794593
.quad 1936015888
.quad 1913677123
.quad 1914065968
.quad 1913017393
.quad 1919238928
.quad 1896240178
.quad 1902461728
.quad 1885684513
.quad 1985229328
.quad 1698898183
.quad 1698898288
.quad 1698898033
.quad 1698899728
.quad 1698893938
.quad 1698895648
.quad 1698891553
.quad 1698918928
.quad 1698828403
.quad 1698830128
.quad 1698826033
.quad 1698853648
.quad 1698760498
.quad 1698788128
.quad 1698722593
.quad 1699164688
.quad 1697779828
.quad 1697781568
.quad 1697777473
.quad 1697805328
.quad 1697711938
.quad 1697739808
.quad 1697674273
.quad 1698120208
.quad 1696663363
.quad 1696691248
.quad 1696625713
.quad 1697071888
.quad 1695577138
.quad 1696023328
.quad 1694974753
.quad 1702113808
.quad 1681002613
.quad 1681004368
.quad 1681000273
.quad 1681028368
.quad 1680934738
.quad 1680962848
.quad 1680897313
.quad 1681347088
.quad 1679886163
.quad 1679914288
.quad 1679848753
.quad 1680298768
.quad 1678800178
.quad 1679250208
.quad 1678201633
.quad 1685402128
.quad 1663108948
.quad 1663137088
.quad 1663071553
.quad 1663521808
.quad 1662022978
.quad 1662473248
.quad 1661424673
.quad 1668629008
.quad 1645245763
.quad 1645696048
.quad 1644647473
.quad 1651852048
.quad 1627870258
.quad 1635074848
.quad 1618297633
.quad 1733571088
.quad 1412567158
.quad 1412568928
.quad 1412564833
.quad 1412593168
.quad 1412499298
.quad 1412527648
.quad 1412462113
.quad 1412915728
.quad 1411450723
.quad 1411479088
.quad 1411413553
.quad 1411867408
.quad 1410364978
.quad 1410818848
.quad 1409770273
.quad 1417032208
.quad 1394673508
.quad 1394701888
.quad 1394636353
.quad 1395090448
.quad 1393587778
.quad 1394041888
.quad 1392993313
.quad 1400259088
.quad 1376810563
.quad 1377264688
.quad 1376216113
.quad 1383482128
.quad 1359438898
.quad 1366704928
.quad 1349927713
.quad 1466184208
.quad 1126238053
.quad 1126266448
.quad 1126200913
.quad 1126655248
.quad 1125152338
.quad 1125606688
.quad 1124558113
.quad 1131827728
.quad 1108375123
.quad 1108829488
.quad 1107780913
.quad 1115050768
.quad 1091003698
.quad 1098273568
.quad 1081496353
.quad 1197814288
.quad 839939668
.quad 840394048
.quad 839345473
.quad 846615568
.quad 822568258
.quad 829838368
.quad 813061153
.quad 929382928
.quad 554132803
.quad 561402928
.quad 544625713
.quad 660947728
.quad 276190258
.quad 392512288
.quad 124076833
.quad 1985229328
.hidden _ZZN3hwy6N_AVX26detail18IndicesFromBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices
.weak _ZZN3hwy6N_AVX26detail18IndicesFromBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices
.section .rodata._ZZN3hwy6N_AVX26detail18IndicesFromBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices,"aG",@progbits,_ZZN3hwy6N_AVX26detail18IndicesFromBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices,comdat
.balign 32
.type _ZZN3hwy6N_AVX26detail18IndicesFromBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices, @object
.size _ZZN3hwy6N_AVX26detail18IndicesFromBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices, 512
_ZZN3hwy6N_AVX26detail18IndicesFromBits256IlLPv0EEENS0_6Vec256IjEEmE11u32_indices:
.long 0
.long 1
.long 2
.long 3
.long 4
.long 5
.long 6
.long 7
.long 8
.long 9
.long 2
.long 3
.long 4
.long 5
.long 6
.long 7
.long 10
.long 11
.long 0
.long 1
.long 4
.long 5
.long 6
.long 7
.long 8
.long 9
.long 10
.long 11
.long 4
.long 5
.long 6
.long 7
.long 12
.long 13
.long 0
.long 1
.long 2
.long 3
.long 6
.long 7
.long 8
.long 9
.long 12
.long 13
.long 2
.long 3
.long 6
.long 7
.long 10
.long 11
.long 12
.long 13
.long 0
.long 1
.long 6
.long 7
.long 8
.long 9
.long 10
.long 11
.long 12
.long 13
.long 6
.long 7
.long 14
.long 15
.long 0
.long 1
.long 2
.long 3
.long 4
.long 5
.long 8
.long 9
.long 14
.long 15
.long 2
.long 3
.long 4
.long 5
.long 10
.long 11
.long 14
.long 15
.long 0
.long 1
.long 4
.long 5
.long 8
.long 9
.long 10
.long 11
.long 14
.long 15
.long 4
.long 5
.long 12
.long 13
.long 14
.long 15
.long 0
.long 1
.long 2
.long 3
.long 8
.long 9
.long 12
.long 13
.long 14
.long 15
.long 2
.long 3
.long 10
.long 11
.long 12
.long 13
.long 14
.long 15
.long 0
.long 1
.long 8
.long 9
.long 10
.long 11
.long 12
.long 13
.long 14
.long 15
.hidden _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.weak _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.section .rodata._ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,"aG",@progbits,_ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,comdat
.balign 16
.type _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, @object
.size _ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, 64
_ZZN3hwy6N_SSE46detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices:
.string ""
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007"
.ascii "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.hidden _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.weak _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices
.section .rodata._ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,"aG",@progbits,_ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices,comdat
.balign 16
.type _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, @object
.size _ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices, 64
_ZZN3hwy7N_SSSE36detail18IndicesFromBits128INS0_4SimdIlLm2ELi0EEELPv0EEEDTcl4ZerocvT__EEES6_mE10u8_indices:
.string ""
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\b\t\n\013\f\r\016\017"
.string "\001\002\003\004\005\006\007"
.ascii "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017"
.section .bss._ZZN3hwy17GetGeneratorStateEvE5state,"aw",@nobits
.balign 16
.type _ZZN3hwy17GetGeneratorStateEvE5state, @object
.size _ZZN3hwy17GetGeneratorStateEvE5state, 24
_ZZN3hwy17GetGeneratorStateEvE5state:
.zero 24
.set .LC0,.LC3
.set .LC1,.LC3
.section .rodata
.balign 64
.LC2:
.quad 7
.quad 6
.quad 5
.quad 4
.quad 3
.quad 2
.quad 1
.quad 0
.section .rodata.cst32,"aM",@progbits,32
.balign 32
.LC3:
.quad 0
.quad 1
.quad 2
.quad 3
.set .LC4,.LC7
.set .LC5,.LC8
.set .LC6,.LC7
.section .rodata
.balign 64
.LC7:
.quad 9223372036854775807
.quad 9223372036854775807
.quad 9223372036854775807
.quad 9223372036854775807
.quad 9223372036854775807
.quad 9223372036854775807
.quad 9223372036854775807
.quad 9223372036854775807
.balign 64
.LC8:
.quad -9223372036854775808
.quad -9223372036854775808
.quad -9223372036854775808
.quad -9223372036854775808
.quad -9223372036854775808
.quad -9223372036854775808
.quad -9223372036854775808
.quad -9223372036854775808
.balign 64
.LC9:
.quad 0
.quad 4
.quad 8
.quad 12
.quad 16
.quad 20
.quad 24
.quad 28
.set .LC10,.LC7
.set .LC12,.LC8
.set .LC13,.LC7
.set .LC14,.LC8
| 527,044 | 23,680 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/system.inc | // clang-format off
/* -------------------------- system alloc setup ------------------------- */
/* Operations on mflags */
#define use_lock(M) ((M)->mflags & USE_LOCK_BIT)
#define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT)
#if USE_LOCKS
#define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT)
#else
#define disable_lock(M)
#endif
#define use_mmap(M) ((M)->mflags & USE_MMAP_BIT)
#define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT)
#if HAVE_MMAP
#define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT)
#else
#define disable_mmap(M)
#endif
#define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT)
#define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT)
#define set_lock(M,L)\
((M)->mflags = (L)?\
((M)->mflags | USE_LOCK_BIT) :\
((M)->mflags & ~USE_LOCK_BIT))
/* page-align a size */
#define page_align(S)\
(((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))
/* granularity-align a size */
#define granularity_align(S)\
(((S) + (mparams.granularity - SIZE_T_ONE))\
& ~(mparams.granularity - SIZE_T_ONE))
/* For mmap, use granularity alignment on windows, else page-align */
#if defined(WIN32) || defined(__COSMOPOLITAN__)
#define mmap_align(S) granularity_align(S)
#else
#define mmap_align(S) page_align(S)
#endif
/* For sys_alloc, enough padding to ensure can malloc request on success */
#define SYS_ALLOC_PADDING (TOP_FOOT_SIZE + MALLOC_ALIGNMENT)
#define is_page_aligned(S)\
(((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0)
#define is_granularity_aligned(S)\
(((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0)
/* True if segment S holds address A */
#define segment_holds(S, A)\
((char*)(A) >= S->base && (char*)(A) < S->base + S->size)
/* Return segment holding given address */
static msegmentptr segment_holding(mstate m, char* addr) {
msegmentptr sp = &m->seg;
for (;;) {
if (addr >= sp->base && addr < sp->base + sp->size)
return sp;
if ((sp = sp->next) == 0)
return 0;
}
}
/* Return true if segment contains a segment link */
static int has_segment_link(mstate m, msegmentptr ss) {
msegmentptr sp = &m->seg;
for (;;) {
if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size)
return 1;
if ((sp = sp->next) == 0)
return 0;
}
}
#ifndef MORECORE_CANNOT_TRIM
#define should_trim(M,s) ((s) > (M)->trim_check)
#else /* MORECORE_CANNOT_TRIM */
#define should_trim(M,s) (0)
#endif /* MORECORE_CANNOT_TRIM */
/*
TOP_FOOT_SIZE is padding at the end of a segment, including space
that may be needed to place segment records and fenceposts when new
noncontiguous segments are added.
*/
#define TOP_FOOT_SIZE\
(align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
| 2,820 | 95 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/dlmalloc_abort.greg.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¡
â Copyright 2022 Justine Alexandra Roberts Tunney â
â â
â Permission to use, copy, modify, and/or distribute this software for â
â any purpose with or without fee is hereby granted, provided that the â
â above copyright notice and this permission notice appear in all copies. â
â â
â THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL â
â WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED â
â WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE â
â AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL â
â DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR â
â PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER â
â TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR â
â PERFORMANCE OF THIS SOFTWARE. â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/calls/calls.h"
#include "libc/intrin/weaken.h"
#include "libc/log/log.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#define MESSAGE "dlmalloc_abort()\n"
void dlmalloc_abort(void) {
write(2, MESSAGE, strlen(MESSAGE));
if (_weaken(__die)) _weaken(__die)();
_Exit(44);
}
| 2,144 | 32 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/debuglib.inc | // clang-format off
#if DEBUG
/* ------------------------- Debugging Support --------------------------- */
/* Check properties of any chunk, whether free, inuse, mmapped etc */
static void do_check_any_chunk(mstate m, mchunkptr p) {
assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
assert(ok_address(m, p));
}
/* Check properties of top chunk */
static void do_check_top_chunk(mstate m, mchunkptr p) {
msegmentptr sp = segment_holding(m, (char*)p);
size_t sz = p->head & ~INUSE_BITS; /* third-lowest bit can be set! */
assert(sp != 0);
assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
assert(ok_address(m, p));
assert(sz == m->topsize);
assert(sz > 0);
assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE);
assert(pinuse(p));
assert(!pinuse(chunk_plus_offset(p, sz)));
}
/* Check properties of (inuse) mmapped chunks */
static void do_check_mmapped_chunk(mstate m, mchunkptr p) {
size_t sz = chunksize(p);
size_t len = (sz + (p->prev_foot) + MMAP_FOOT_PAD);
assert(is_mmapped(p));
assert(use_mmap(m));
assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
assert(ok_address(m, p));
assert(!is_small(sz));
assert((len & (mparams.page_size-SIZE_T_ONE)) == 0);
assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD);
assert(chunk_plus_offset(p, sz+SIZE_T_SIZE)->head == 0);
}
/* Check properties of inuse chunks */
static void do_check_inuse_chunk(mstate m, mchunkptr p) {
do_check_any_chunk(m, p);
assert(is_inuse(p));
assert(next_pinuse(p));
/* If not pinuse and not mmapped, previous chunk has OK offset */
assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p);
if (is_mmapped(p))
do_check_mmapped_chunk(m, p);
}
/* Check properties of free chunks */
static void do_check_free_chunk(mstate m, mchunkptr p) {
size_t sz = chunksize(p);
mchunkptr next = chunk_plus_offset(p, sz);
do_check_any_chunk(m, p);
assert(!is_inuse(p));
assert(!next_pinuse(p));
assert (!is_mmapped(p));
if (p != m->dv && p != m->top) {
if (sz >= MIN_CHUNK_SIZE) {
assert((sz & CHUNK_ALIGN_MASK) == 0);
assert(is_aligned(chunk2mem(p)));
assert(next->prev_foot == sz);
assert(pinuse(p));
assert (next == m->top || is_inuse(next));
assert(p->fd->bk == p);
assert(p->bk->fd == p);
}
else /* markers are always of size SIZE_T_SIZE */
assert(sz == SIZE_T_SIZE);
}
}
/* Check properties of malloced chunks at the point they are malloced */
static void do_check_malloced_chunk(mstate m, void* mem, size_t s) {
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
size_t sz = p->head & ~INUSE_BITS;
do_check_inuse_chunk(m, p);
assert((sz & CHUNK_ALIGN_MASK) == 0);
assert(sz >= MIN_CHUNK_SIZE);
assert(sz >= s);
/* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */
assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE));
}
}
/* Check a tree and its subtrees. */
static void do_check_tree(mstate m, tchunkptr t) {
tchunkptr head = 0;
tchunkptr u = t;
bindex_t tindex = t->index;
size_t tsize = chunksize(t);
bindex_t idx;
compute_tree_index(tsize, idx);
assert(tindex == idx);
assert(tsize >= MIN_LARGE_SIZE);
assert(tsize >= minsize_for_tree_index(idx));
assert((idx == NTREEBINS-1) || (tsize < minsize_for_tree_index((idx+1))));
do { /* traverse through chain of same-sized nodes */
do_check_any_chunk(m, ((mchunkptr)u));
assert(u->index == tindex);
assert(chunksize(u) == tsize);
assert(!is_inuse(u));
assert(!next_pinuse(u));
assert(u->fd->bk == u);
assert(u->bk->fd == u);
if (u->parent == 0) {
assert(u->child[0] == 0);
assert(u->child[1] == 0);
}
else {
assert(head == 0); /* only one node on chain has parent */
head = u;
assert(u->parent != u);
assert (u->parent->child[0] == u ||
u->parent->child[1] == u ||
*((tbinptr*)(u->parent)) == u);
if (u->child[0] != 0) {
assert(u->child[0]->parent == u);
assert(u->child[0] != u);
do_check_tree(m, u->child[0]);
}
if (u->child[1] != 0) {
assert(u->child[1]->parent == u);
assert(u->child[1] != u);
do_check_tree(m, u->child[1]);
}
if (u->child[0] != 0 && u->child[1] != 0) {
assert(chunksize(u->child[0]) < chunksize(u->child[1]));
}
}
u = u->fd;
} while (u != t);
assert(head != 0);
}
/* Check all the chunks in a treebin. */
static void do_check_treebin(mstate m, bindex_t i) {
tbinptr* tb = treebin_at(m, i);
tchunkptr t = *tb;
int empty = (m->treemap & (1U << i)) == 0;
if (t == 0)
assert(empty);
if (!empty)
do_check_tree(m, t);
}
/* Check all the chunks in a smallbin. */
static void do_check_smallbin(mstate m, bindex_t i) {
sbinptr b = smallbin_at(m, i);
mchunkptr p = b->bk;
unsigned int empty = (m->smallmap & (1U << i)) == 0;
if (p == b)
assert(empty);
if (!empty) {
for (; p != b; p = p->bk) {
size_t size = chunksize(p);
mchunkptr q;
/* each chunk claims to be free */
do_check_free_chunk(m, p);
/* chunk belongs in bin */
assert(small_index(size) == i);
assert(p->bk == b || chunksize(p->bk) == chunksize(p));
/* chunk is followed by an inuse chunk */
q = next_chunk(p);
if (q->head != FENCEPOST_HEAD)
do_check_inuse_chunk(m, q);
}
}
}
/* Find x in a bin. Used in other check functions. */
static int bin_find(mstate m, mchunkptr x) {
size_t size = chunksize(x);
if (is_small(size)) {
bindex_t sidx = small_index(size);
sbinptr b = smallbin_at(m, sidx);
if (smallmap_is_marked(m, sidx)) {
mchunkptr p = b;
do {
if (p == x)
return 1;
} while ((p = p->fd) != b);
}
}
else {
bindex_t tidx;
compute_tree_index(size, tidx);
if (treemap_is_marked(m, tidx)) {
tchunkptr t = *treebin_at(m, tidx);
size_t sizebits = size << leftshift_for_tree_index(tidx);
while (t != 0 && chunksize(t) != size) {
t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1];
sizebits <<= 1;
}
if (t != 0) {
tchunkptr u = t;
do {
if (u == (tchunkptr)x)
return 1;
} while ((u = u->fd) != t);
}
}
}
return 0;
}
/* Traverse each chunk and check it; return total */
static size_t traverse_and_check(mstate m) {
size_t sum = 0;
if (is_initialized(m)) {
msegmentptr s = &m->seg;
sum += m->topsize + TOP_FOOT_SIZE;
while (s != 0) {
mchunkptr q = align_as_chunk(s->base);
mchunkptr lastq = 0;
assert(pinuse(q));
while (segment_holds(s, q) &&
q != m->top && q->head != FENCEPOST_HEAD) {
sum += chunksize(q);
if (is_inuse(q)) {
assert(!bin_find(m, q));
do_check_inuse_chunk(m, q);
}
else {
assert(q == m->dv || bin_find(m, q));
assert(lastq == 0 || is_inuse(lastq)); /* Not 2 consecutive free */
do_check_free_chunk(m, q);
}
lastq = q;
q = next_chunk(q);
}
s = s->next;
}
}
return sum;
}
/* Check all properties of malloc_state. */
static void do_check_malloc_state(mstate m) {
bindex_t i;
size_t total;
/* check bins */
for (i = 0; i < NSMALLBINS; ++i)
do_check_smallbin(m, i);
for (i = 0; i < NTREEBINS; ++i)
do_check_treebin(m, i);
if (m->dvsize != 0) { /* check dv chunk */
do_check_any_chunk(m, m->dv);
assert(m->dvsize == chunksize(m->dv));
assert(m->dvsize >= MIN_CHUNK_SIZE);
assert(bin_find(m, m->dv) == 0);
}
if (m->top != 0) { /* check top chunk */
do_check_top_chunk(m, m->top);
/*assert(m->topsize == chunksize(m->top)); redundant */
assert(m->topsize > 0);
assert(bin_find(m, m->top) == 0);
}
total = traverse_and_check(m);
assert(total <= m->footprint);
assert(m->footprint <= m->max_footprint);
}
#endif /* DEBUG */
| 8,074 | 271 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/binmaps.inc | // clang-format off
/* ------------------------ Operations on bin maps ----------------------- */
/* bit corresponding to given index */
#define idx2bit(i) ((binmap_t)(1) << (i))
/* Mark/Clear bits with given index */
#define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i))
#define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i))
#define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i))
#define mark_treemap(M,i) ((M)->treemap |= idx2bit(i))
#define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i))
#define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i))
/* isolate the least set bit of a bitmap */
#define least_bit(x) ((x) & -(x))
/* mask with all bits to left of least bit of x on */
#define left_bits(x) ((x<<1) | -(x<<1))
/* mask with all bits to left of or equal to least bit of x on */
#define same_or_left_bits(x) ((x) | -(x))
/* index corresponding to given bit. Use x86 asm if possible */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define compute_bit2idx(X, I)\
{\
unsigned int J;\
J = __builtin_ctz(X); \
I = (bindex_t)J;\
}
#elif defined (__INTEL_COMPILER)
#define compute_bit2idx(X, I)\
{\
unsigned int J;\
J = _bit_scan_forward (X); \
I = (bindex_t)J;\
}
#elif defined(_MSC_VER) && _MSC_VER>=1300
#define compute_bit2idx(X, I)\
{\
unsigned int J;\
_BitScanForward((DWORD *) &J, X);\
I = (bindex_t)J;\
}
#elif USE_BUILTIN_FFS
#define compute_bit2idx(X, I) I = ffs(X)-1
#else
#define compute_bit2idx(X, I)\
{\
unsigned int Y = X - 1;\
unsigned int K = Y >> (16-4) & 16;\
unsigned int N = K; Y >>= K;\
N += K = Y >> (8-3) & 8; Y >>= K;\
N += K = Y >> (4-2) & 4; Y >>= K;\
N += K = Y >> (2-1) & 2; Y >>= K;\
N += K = Y >> (1-0) & 1; Y >>= K;\
I = (bindex_t)(N + Y);\
}
#endif /* GNUC */
| 1,855 | 68 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/chunks.inc | // clang-format off
/* ------------------- Chunks sizes and alignments ----------------------- */
#define MCHUNK_SIZE (sizeof(mchunk))
#if FOOTERS
#define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
#else /* FOOTERS */
#define CHUNK_OVERHEAD (SIZE_T_SIZE)
#endif /* FOOTERS */
/* MMapped chunks need a second word of overhead ... */
#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
/* ... and additional padding for fake next-chunk at foot */
#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES)
/* The smallest size we can malloc is an aligned minimal chunk */
#define MIN_CHUNK_SIZE\
((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
/* conversion from malloc headers to user pointers, and back */
#define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES))
#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES))
/* chunk associated with aligned address A */
#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A)))
/* Bounds on request (not chunk) sizes. */
#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2)
#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)
/* pad request bytes into a usable size */
#define pad_request(req) \
(((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
/* pad request, checking for minimum (but not maximum) */
#define request2size(req) \
(((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req))
| 1,444 | 39 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/dlmalloc.c | #include "third_party/dlmalloc/dlmalloc.h"
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/bsr.h"
#include "libc/intrin/likely.h"
#include "libc/intrin/weaken.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/rdtsc.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/sysconf.h"
#include "libc/stdio/rand.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"
#include "libc/thread/thread.h"
#include "third_party/dlmalloc/vespene.internal.h"
// clang-format off
#define FOOTERS 0
#define MSPACES 0
#define HAVE_MMAP 1
#define HAVE_MREMAP 0
#define HAVE_MORECORE 0
#define USE_LOCKS 2
#define MORECORE_CONTIGUOUS 0
#define MALLOC_INSPECT_ALL 1
#define ABORT_ON_ASSERT_FAILURE 0
#define LOCK_AT_FORK 1
#define NO_MALLOC_STATS 1
#if IsTiny()
#define INSECURE 1
#define PROCEED_ON_ERROR 1
#endif
#if IsModeDbg()
#define DEBUG 1
#endif
#undef assert
#define assert(x) _npassert(x)
#include "third_party/dlmalloc/platform.inc"
#include "third_party/dlmalloc/locks.inc"
#include "third_party/dlmalloc/chunks.inc"
#include "third_party/dlmalloc/headfoot.inc"
#include "third_party/dlmalloc/global.inc"
#include "third_party/dlmalloc/system.inc"
#include "third_party/dlmalloc/hooks.inc"
#include "third_party/dlmalloc/debugging.inc"
#include "third_party/dlmalloc/indexing.inc"
#include "third_party/dlmalloc/binmaps.inc"
#include "third_party/dlmalloc/runtimechecks.inc"
#include "third_party/dlmalloc/init.inc"
#include "third_party/dlmalloc/debuglib.inc"
#include "third_party/dlmalloc/statistics.inc"
#include "third_party/dlmalloc/smallbins.inc"
#include "third_party/dlmalloc/directmap.inc"
#include "third_party/dlmalloc/trees.inc"
#include "third_party/dlmalloc/management.inc"
/* -------------------------- System allocation -------------------------- */
/* Get memory from system using MORECORE or MMAP */
static void* sys_alloc(mstate m, size_t nb) {
char* tbase = CMFAIL;
size_t tsize = 0;
flag_t mmap_flag = 0;
size_t asize; /* allocation size */
ensure_initialization();
/* Directly map large chunks, but only if already initialized */
if (use_mmap(m) && nb >= mparams.mmap_threshold && m->topsize != 0) {
void* mem = mmap_alloc(m, nb);
if (mem != 0)
return mem;
}
asize = granularity_align(nb + SYS_ALLOC_PADDING);
if (asize <= nb)
return 0; /* wraparound */
if (m->footprint_limit != 0) {
size_t fp = m->footprint + asize;
if (fp <= m->footprint || fp > m->footprint_limit)
return 0;
}
/*
Try getting memory in any of three ways (in most-preferred to
least-preferred order):
1. A call to MORECORE that can normally contiguously extend memory.
(disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or
or main space is mmapped or a previous contiguous call failed)
2. A call to MMAP new space (disabled if not HAVE_MMAP).
Note that under the default settings, if MORECORE is unable to
fulfill a request, and HAVE_MMAP is true, then mmap is
used as a noncontiguous system allocator. This is a useful backup
strategy for systems with holes in address spaces -- in this case
sbrk cannot contiguously expand the heap, but mmap may be able to
find space.
3. A call to MORECORE that cannot usually contiguously extend memory.
(disabled if not HAVE_MORECORE)
In all cases, we need to request enough bytes from system to ensure
we can malloc nb bytes upon success, so pad with enough space for
top_foot, plus alignment-pad to make sure we don't lose bytes if
not on boundary, and round this up to a granularity unit.
*/
if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) {
char* br = CMFAIL;
size_t ssize = asize; /* sbrk call size */
msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (char*)m->top);
ACQUIRE_MALLOC_GLOBAL_LOCK();
if (ss == 0) { /* First time through or recovery */
char* base = (char*)CALL_MORECORE(0);
if (base != CMFAIL) {
size_t fp;
/* Adjust to end on a page boundary */
if (!is_page_aligned(base))
ssize += (page_align((size_t)base) - (size_t)base);
fp = m->footprint + ssize; /* recheck limits */
if (ssize > nb && ssize < HALF_MAX_SIZE_T &&
(m->footprint_limit == 0 ||
(fp > m->footprint && fp <= m->footprint_limit)) &&
(br = (char*)(CALL_MORECORE(ssize))) == base) {
tbase = base;
tsize = ssize;
}
}
}
else {
/* Subtract out existing available top space from MORECORE request. */
ssize = granularity_align(nb - m->topsize + SYS_ALLOC_PADDING);
/* Use mem here only if it did continuously extend old space */
if (ssize < HALF_MAX_SIZE_T &&
(br = (char*)(CALL_MORECORE(ssize))) == ss->base+ss->size) {
tbase = br;
tsize = ssize;
}
}
if (tbase == CMFAIL) { /* Cope with partial failure */
if (br != CMFAIL) { /* Try to use/extend the space we did get */
if (ssize < HALF_MAX_SIZE_T &&
ssize < nb + SYS_ALLOC_PADDING) {
size_t esize = granularity_align(nb + SYS_ALLOC_PADDING - ssize);
if (esize < HALF_MAX_SIZE_T) {
char* end = (char*)CALL_MORECORE(esize);
if (end != CMFAIL)
ssize += esize;
else { /* Can't use; try to release */
(void) CALL_MORECORE(-ssize);
br = CMFAIL;
}
}
}
}
if (br != CMFAIL) { /* Use the space we did get */
tbase = br;
tsize = ssize;
}
else
disable_contiguous(m); /* Don't try contiguous path in the future */
}
RELEASE_MALLOC_GLOBAL_LOCK();
}
if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */
char* mp = (char*)(dlmalloc_requires_more_vespene_gas(asize));
if (mp != CMFAIL) {
tbase = mp;
tsize = asize;
mmap_flag = USE_MMAP_BIT;
}
}
if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */
if (asize < HALF_MAX_SIZE_T) {
char* br = CMFAIL;
char* end = CMFAIL;
ACQUIRE_MALLOC_GLOBAL_LOCK();
br = (char*)(CALL_MORECORE(asize));
end = (char*)(CALL_MORECORE(0));
RELEASE_MALLOC_GLOBAL_LOCK();
if (br != CMFAIL && end != CMFAIL && br < end) {
size_t ssize = end - br;
if (ssize > nb + TOP_FOOT_SIZE) {
tbase = br;
tsize = ssize;
}
}
}
}
if (tbase != CMFAIL) {
if ((m->footprint += tsize) > m->max_footprint)
m->max_footprint = m->footprint;
if (!is_initialized(m)) { /* first-time initialization */
if (m->least_addr == 0 || tbase < m->least_addr)
m->least_addr = tbase;
m->seg.base = tbase;
m->seg.size = tsize;
m->seg.sflags = mmap_flag;
m->magic = mparams.magic;
m->release_checks = MAX_RELEASE_CHECK_RATE;
init_bins(m);
#if !ONLY_MSPACES
if (is_global(m))
init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
else
#endif
{
/* Offset top by embedded malloc_state */
mchunkptr mn = next_chunk(mem2chunk(m));
init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) -TOP_FOOT_SIZE);
}
}
else {
/* Try to merge with an existing segment */
msegmentptr sp = &m->seg;
/* Only consider most recent segment if traversal suppressed */
while (sp != 0 && tbase != sp->base + sp->size)
sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next;
if (sp != 0 &&
!is_extern_segment(sp) &&
(sp->sflags & USE_MMAP_BIT) == mmap_flag &&
segment_holds(sp, m->top)) { /* append */
sp->size += tsize;
init_top(m, m->top, m->topsize + tsize);
}
else {
if (tbase < m->least_addr)
m->least_addr = tbase;
sp = &m->seg;
while (sp != 0 && sp->base != tbase + tsize)
sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next;
if (sp != 0 &&
!is_extern_segment(sp) &&
(sp->sflags & USE_MMAP_BIT) == mmap_flag) {
char* oldbase = sp->base;
sp->base = tbase;
sp->size += tsize;
return prepend_alloc(m, tbase, oldbase, nb);
}
else
add_segment(m, tbase, tsize, mmap_flag);
}
}
if (nb < m->topsize) { /* Allocate from new or extended top space */
size_t rsize = m->topsize -= nb;
mchunkptr p = m->top;
mchunkptr r = m->top = chunk_plus_offset(p, nb);
r->head = rsize | PINUSE_BIT;
set_size_and_pinuse_of_inuse_chunk(m, p, nb);
check_top_chunk(m, m->top);
check_malloced_chunk(m, chunk2mem(p), nb);
return chunk2mem(p);
}
}
MALLOC_FAILURE_ACTION;
return 0;
}
/* ----------------------- system deallocation -------------------------- */
/* Unmap and unlink any mmapped segments that don't contain used chunks */
static size_t release_unused_segments(mstate m) {
size_t released = 0;
int nsegs = 0;
msegmentptr pred = &m->seg;
msegmentptr sp = pred->next;
while (sp != 0) {
char* base = sp->base;
size_t size = sp->size;
msegmentptr next = sp->next;
++nsegs;
if (is_mmapped_segment(sp) && !is_extern_segment(sp)) {
mchunkptr p = align_as_chunk(base);
size_t psize = chunksize(p);
/* Can unmap if first chunk holds entire segment and not pinned */
if (!is_inuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) {
tchunkptr tp = (tchunkptr)p;
assert(segment_holds(sp, (char*)sp));
if (p == m->dv) {
m->dv = 0;
m->dvsize = 0;
}
else {
unlink_large_chunk(m, tp);
}
if (CALL_MUNMAP(base, size) == 0) {
released += size;
m->footprint -= size;
/* unlink obsoleted record */
sp = pred;
sp->next = next;
}
else { /* back out if cannot unmap */
insert_large_chunk(m, tp, psize);
}
}
}
if (NO_SEGMENT_TRAVERSAL) /* scan only first segment */
break;
pred = sp;
sp = next;
}
/* Reset check counter */
m->release_checks = (((size_t) nsegs > (size_t) MAX_RELEASE_CHECK_RATE)?
(size_t) nsegs : (size_t) MAX_RELEASE_CHECK_RATE);
return released;
}
static int sys_trim(mstate m, size_t pad) {
size_t released = 0;
ensure_initialization();
if (pad < MAX_REQUEST && is_initialized(m)) {
pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */
if (m->topsize > pad) {
/* Shrink top space in granularity-size units, keeping at least one */
size_t unit = mparams.granularity;
size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit -
SIZE_T_ONE) * unit;
msegmentptr sp = segment_holding(m, (char*)m->top);
if (!is_extern_segment(sp)) {
if (is_mmapped_segment(sp)) {
if (HAVE_MMAP &&
sp->size >= extra &&
!has_segment_link(m, sp)) { /* can't shrink if pinned */
size_t newsize = sp->size - extra;
(void)newsize; /* placate people compiling -Wunused-variable */
/* Prefer mremap, fall back to munmap */
if (CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL ||
(!extra || !CALL_MUNMAP(sp->base + newsize, extra))) {
released = extra;
}
}
}
else if (HAVE_MORECORE) {
if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */
extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit;
ACQUIRE_MALLOC_GLOBAL_LOCK();
{
/* Make sure end of memory is where we last set it. */
char* old_br = (char*)(CALL_MORECORE(0));
if (old_br == sp->base + sp->size) {
char* rel_br = (char*)(CALL_MORECORE(-extra));
char* new_br = (char*)(CALL_MORECORE(0));
if (rel_br != CMFAIL && new_br < old_br)
released = old_br - new_br;
}
}
RELEASE_MALLOC_GLOBAL_LOCK();
}
}
if (released != 0) {
sp->size -= released;
m->footprint -= released;
init_top(m, m->top, m->topsize - released);
check_top_chunk(m, m->top);
}
}
/* Unmap any unused mmapped segments */
if (HAVE_MMAP)
released += release_unused_segments(m);
/* On failure, disable autotrim to avoid repeated failed future calls */
if (released == 0 && m->topsize > m->trim_check)
m->trim_check = MAX_SIZE_T;
}
return (released != 0)? 1 : 0;
}
/* Consolidate and bin a chunk. Differs from exported versions
of free mainly in that the chunk need not be marked as inuse.
*/
static void dispose_chunk(mstate m, mchunkptr p, size_t psize) {
mchunkptr next = chunk_plus_offset(p, psize);
if (!pinuse(p)) {
mchunkptr prev;
size_t prevsize = p->prev_foot;
if (is_mmapped(p)) {
psize += prevsize + MMAP_FOOT_PAD;
if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
m->footprint -= psize;
return;
}
prev = chunk_minus_offset(p, prevsize);
psize += prevsize;
p = prev;
if (RTCHECK(ok_address(m, prev))) { /* consolidate backward */
if (p != m->dv) {
unlink_chunk(m, p, prevsize);
}
else if ((next->head & INUSE_BITS) == INUSE_BITS) {
m->dvsize = psize;
set_free_with_pinuse(p, psize, next);
return;
}
}
else {
CORRUPTION_ERROR_ACTION(m);
return;
}
}
if (RTCHECK(ok_address(m, next))) {
if (!cinuse(next)) { /* consolidate forward */
if (next == m->top) {
size_t tsize = m->topsize += psize;
m->top = p;
p->head = tsize | PINUSE_BIT;
if (p == m->dv) {
m->dv = 0;
m->dvsize = 0;
}
return;
}
else if (next == m->dv) {
size_t dsize = m->dvsize += psize;
m->dv = p;
set_size_and_pinuse_of_free_chunk(p, dsize);
return;
}
else {
size_t nsize = chunksize(next);
psize += nsize;
unlink_chunk(m, next, nsize);
set_size_and_pinuse_of_free_chunk(p, psize);
if (p == m->dv) {
m->dvsize = psize;
return;
}
}
}
else {
set_free_with_pinuse(p, psize, next);
}
insert_chunk(m, p, psize);
}
else {
CORRUPTION_ERROR_ACTION(m);
}
}
/* ---------------------------- malloc --------------------------- */
/* allocate a large request from the best fitting chunk in a treebin */
static void* tmalloc_large(mstate m, size_t nb) {
tchunkptr v = 0;
size_t rsize = -nb; /* Unsigned negation */
tchunkptr t;
bindex_t idx;
compute_tree_index(nb, idx);
if ((t = *treebin_at(m, idx)) != 0) {
/* Traverse tree for this bin looking for node with size == nb */
size_t sizebits = nb << leftshift_for_tree_index(idx);
tchunkptr rst = 0; /* The deepest untaken right subtree */
for (;;) {
tchunkptr rt;
size_t trem = chunksize(t) - nb;
if (trem < rsize) {
v = t;
if ((rsize = trem) == 0)
break;
}
rt = t->child[1];
t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1];
if (rt != 0 && rt != t)
rst = rt;
if (t == 0) {
t = rst; /* set t to least subtree holding sizes > nb */
break;
}
sizebits <<= 1;
}
}
if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */
binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap;
if (leftbits != 0) {
bindex_t i;
binmap_t leastbit = least_bit(leftbits);
compute_bit2idx(leastbit, i);
t = *treebin_at(m, i);
}
}
while (t != 0) { /* find smallest of tree or subtree */
size_t trem = chunksize(t) - nb;
if (trem < rsize) {
rsize = trem;
v = t;
}
t = leftmost_child(t);
}
/* If dv is a better fit, return 0 so malloc will use it */
if (v != 0 && rsize < (size_t)(m->dvsize - nb)) {
if (RTCHECK(ok_address(m, v))) { /* split */
mchunkptr r = chunk_plus_offset(v, nb);
assert(chunksize(v) == rsize + nb);
if (RTCHECK(ok_next(v, r))) {
unlink_large_chunk(m, v);
if (rsize < MIN_CHUNK_SIZE)
set_inuse_and_pinuse(m, v, (rsize + nb));
else {
set_size_and_pinuse_of_inuse_chunk(m, v, nb);
set_size_and_pinuse_of_free_chunk(r, rsize);
insert_chunk(m, r, rsize);
}
return chunk2mem(v);
}
}
CORRUPTION_ERROR_ACTION(m);
}
return 0;
}
/* allocate a small request from the best fitting chunk in a treebin */
static void* tmalloc_small(mstate m, size_t nb) {
tchunkptr t, v;
size_t rsize;
bindex_t i;
binmap_t leastbit = least_bit(m->treemap);
compute_bit2idx(leastbit, i);
v = t = *treebin_at(m, i);
rsize = chunksize(t) - nb;
while ((t = leftmost_child(t)) != 0) {
size_t trem = chunksize(t) - nb;
if (trem < rsize) {
rsize = trem;
v = t;
}
}
if (RTCHECK(ok_address(m, v))) {
mchunkptr r = chunk_plus_offset(v, nb);
assert(chunksize(v) == rsize + nb);
if (RTCHECK(ok_next(v, r))) {
unlink_large_chunk(m, v);
if (rsize < MIN_CHUNK_SIZE)
set_inuse_and_pinuse(m, v, (rsize + nb));
else {
set_size_and_pinuse_of_inuse_chunk(m, v, nb);
set_size_and_pinuse_of_free_chunk(r, rsize);
replace_dv(m, r, rsize);
}
return chunk2mem(v);
}
}
CORRUPTION_ERROR_ACTION(m);
return 0;
}
#if !ONLY_MSPACES
void* dlmalloc(size_t bytes) {
/*
Basic algorithm:
If a small request (< 256 bytes minus per-chunk overhead):
1. If one exists, use a remainderless chunk in associated smallbin.
(Remainderless means that there are too few excess bytes to
represent as a chunk.)
2. If it is big enough, use the dv chunk, which is normally the
chunk adjacent to the one used for the most recent small request.
3. If one exists, split the smallest available chunk in a bin,
saving remainder in dv.
4. If it is big enough, use the top chunk.
5. If available, get memory from system and use it
Otherwise, for a large request:
1. Find the smallest available binned chunk that fits, and use it
if it is better fitting than dv chunk, splitting if necessary.
2. If better fitting than any binned chunk, use the dv chunk.
3. If it is big enough, use the top chunk.
4. If request size >= mmap threshold, try to directly mmap this chunk.
5. If available, get memory from system and use it
The ugly goto's here ensure that postaction occurs along all paths.
*/
#if USE_LOCKS
ensure_initialization(); /* initialize in sys_alloc if not using locks */
#endif
if (!PREACTION(gm)) {
void* mem;
size_t nb;
if (bytes <= MAX_SMALL_REQUEST) {
bindex_t idx;
binmap_t smallbits;
nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes);
idx = small_index(nb);
smallbits = gm->smallmap >> idx;
if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
mchunkptr b, p;
idx += ~smallbits & 1; /* Uses next bin if idx empty */
b = smallbin_at(gm, idx);
p = b->fd;
assert(chunksize(p) == small_index2size(idx));
unlink_first_small_chunk(gm, b, p, idx);
set_inuse_and_pinuse(gm, p, small_index2size(idx));
mem = chunk2mem(p);
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
else if (nb > gm->dvsize) {
if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
mchunkptr b, p, r;
size_t rsize;
bindex_t i;
binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx));
binmap_t leastbit = least_bit(leftbits);
compute_bit2idx(leastbit, i);
b = smallbin_at(gm, i);
p = b->fd;
assert(chunksize(p) == small_index2size(i));
unlink_first_small_chunk(gm, b, p, i);
rsize = small_index2size(i) - nb;
/* Fit here cannot be remainderless if 4byte sizes */
if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
set_inuse_and_pinuse(gm, p, small_index2size(i));
else {
set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
r = chunk_plus_offset(p, nb);
set_size_and_pinuse_of_free_chunk(r, rsize);
replace_dv(gm, r, rsize);
}
mem = chunk2mem(p);
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) {
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
}
}
else if (bytes >= MAX_REQUEST)
nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
else {
nb = pad_request(bytes);
if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) {
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
}
if (nb <= gm->dvsize) {
size_t rsize = gm->dvsize - nb;
mchunkptr p = gm->dv;
if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
mchunkptr r = gm->dv = chunk_plus_offset(p, nb);
gm->dvsize = rsize;
set_size_and_pinuse_of_free_chunk(r, rsize);
set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
}
else { /* exhaust dv */
size_t dvs = gm->dvsize;
gm->dvsize = 0;
gm->dv = 0;
set_inuse_and_pinuse(gm, p, dvs);
}
mem = chunk2mem(p);
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
else if (nb < gm->topsize) { /* Split top */
size_t rsize = gm->topsize -= nb;
mchunkptr p = gm->top;
mchunkptr r = gm->top = chunk_plus_offset(p, nb);
r->head = rsize | PINUSE_BIT;
set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
mem = chunk2mem(p);
check_top_chunk(gm, gm->top);
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
mem = sys_alloc(gm, nb);
POSTACTION(gm);
if (mem == MAP_FAILED && _weaken(__oom_hook)) {
_weaken(__oom_hook)(bytes);
}
return mem;
postaction:
POSTACTION(gm);
return mem;
}
return 0;
}
/* ---------------------------- free --------------------------- */
void dlfree(void* mem) {
/*
Consolidate freed chunks with preceeding or succeeding bordering
free chunks, if they exist, and then place in a bin. Intermixed
with special cases for top, dv, mmapped chunks, and usage errors.
*/
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
#if FOOTERS
mstate fm = get_mstate_for(p);
if (!ok_magic(fm)) {
USAGE_ERROR_ACTION(fm, p);
return;
}
#else /* FOOTERS */
#define fm gm
#endif /* FOOTERS */
if (!PREACTION(fm)) {
check_inuse_chunk(fm, p);
if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) {
size_t psize = chunksize(p);
mchunkptr next = chunk_plus_offset(p, psize);
if (!pinuse(p)) {
size_t prevsize = p->prev_foot;
if (is_mmapped(p)) {
psize += prevsize + MMAP_FOOT_PAD;
if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
fm->footprint -= psize;
goto postaction;
}
else {
mchunkptr prev = chunk_minus_offset(p, prevsize);
psize += prevsize;
p = prev;
if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */
if (p != fm->dv) {
unlink_chunk(fm, p, prevsize);
}
else if ((next->head & INUSE_BITS) == INUSE_BITS) {
fm->dvsize = psize;
set_free_with_pinuse(p, psize, next);
goto postaction;
}
}
else
goto erroraction;
}
}
if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) {
if (!cinuse(next)) { /* consolidate forward */
if (next == fm->top) {
size_t tsize = fm->topsize += psize;
fm->top = p;
p->head = tsize | PINUSE_BIT;
if (p == fm->dv) {
fm->dv = 0;
fm->dvsize = 0;
}
if (should_trim(fm, tsize))
sys_trim(fm, 0);
goto postaction;
}
else if (next == fm->dv) {
size_t dsize = fm->dvsize += psize;
fm->dv = p;
set_size_and_pinuse_of_free_chunk(p, dsize);
goto postaction;
}
else {
size_t nsize = chunksize(next);
psize += nsize;
unlink_chunk(fm, next, nsize);
set_size_and_pinuse_of_free_chunk(p, psize);
if (p == fm->dv) {
fm->dvsize = psize;
goto postaction;
}
}
}
else
set_free_with_pinuse(p, psize, next);
if (is_small(psize)) {
insert_small_chunk(fm, p, psize);
check_free_chunk(fm, p);
}
else {
tchunkptr tp = (tchunkptr)p;
insert_large_chunk(fm, tp, psize);
check_free_chunk(fm, p);
if (--fm->release_checks == 0)
release_unused_segments(fm);
}
goto postaction;
}
}
erroraction:
USAGE_ERROR_ACTION(fm, p);
postaction:
POSTACTION(fm);
}
}
#if !FOOTERS
#undef fm
#endif /* FOOTERS */
}
void* dlcalloc(size_t n_elements, size_t elem_size) {
void* mem;
size_t req = 0;
if (__builtin_mul_overflow(n_elements, elem_size, &req)) req = -1;
mem = dlmalloc(req);
if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
bzero(mem, req);
return mem;
}
#endif /* !ONLY_MSPACES */
/* ------------ Internal support for realloc, memalign, etc -------------- */
/* Try to realloc; only in-place unless can_move true */
static mchunkptr try_realloc_chunk(mstate m, mchunkptr p, size_t nb,
int can_move) {
mchunkptr newp = 0;
size_t oldsize = chunksize(p);
mchunkptr next = chunk_plus_offset(p, oldsize);
if (RTCHECK(ok_address(m, p) && ok_inuse(p) &&
ok_next(p, next) && ok_pinuse(next))) {
if (is_mmapped(p)) {
newp = mmap_resize(m, p, nb, can_move);
}
else if (oldsize >= nb) { /* already big enough */
size_t rsize = oldsize - nb;
if (rsize >= MIN_CHUNK_SIZE) { /* split off remainder */
mchunkptr r = chunk_plus_offset(p, nb);
set_inuse(m, p, nb);
set_inuse(m, r, rsize);
dispose_chunk(m, r, rsize);
}
newp = p;
}
else if (next == m->top) { /* extend into top */
if (oldsize + m->topsize > nb) {
size_t newsize = oldsize + m->topsize;
size_t newtopsize = newsize - nb;
mchunkptr newtop = chunk_plus_offset(p, nb);
set_inuse(m, p, nb);
newtop->head = newtopsize |PINUSE_BIT;
m->top = newtop;
m->topsize = newtopsize;
newp = p;
}
}
else if (next == m->dv) { /* extend into dv */
size_t dvs = m->dvsize;
if (oldsize + dvs >= nb) {
size_t dsize = oldsize + dvs - nb;
if (dsize >= MIN_CHUNK_SIZE) {
mchunkptr r = chunk_plus_offset(p, nb);
mchunkptr n = chunk_plus_offset(r, dsize);
set_inuse(m, p, nb);
set_size_and_pinuse_of_free_chunk(r, dsize);
clear_pinuse(n);
m->dvsize = dsize;
m->dv = r;
}
else { /* exhaust dv */
size_t newsize = oldsize + dvs;
set_inuse(m, p, newsize);
m->dvsize = 0;
m->dv = 0;
}
newp = p;
}
}
else if (!cinuse(next)) { /* extend into next free chunk */
size_t nextsize = chunksize(next);
if (oldsize + nextsize >= nb) {
size_t rsize = oldsize + nextsize - nb;
unlink_chunk(m, next, nextsize);
if (rsize < MIN_CHUNK_SIZE) {
size_t newsize = oldsize + nextsize;
set_inuse(m, p, newsize);
}
else {
mchunkptr r = chunk_plus_offset(p, nb);
set_inuse(m, p, nb);
set_inuse(m, r, rsize);
dispose_chunk(m, r, rsize);
}
newp = p;
}
}
}
else {
USAGE_ERROR_ACTION(m, chunk2mem(p));
}
return newp;
}
static void* internal_memalign(mstate m, size_t alignment, size_t bytes) {
void* mem = 0;
if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */
alignment = MIN_CHUNK_SIZE;
/* alignment is 32+ bytes rounded up to nearest two power */
alignment = 2ul << _bsrl(MAX(MIN_CHUNK_SIZE, alignment) - 1);
if (bytes >= MAX_REQUEST - alignment) {
if (m != 0) { /* Test isn't needed but avoids compiler warning */
MALLOC_FAILURE_ACTION;
}
}
else {
size_t nb = request2size(bytes);
size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD;
mem = internal_malloc(m, req);
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
if (PREACTION(m))
return 0;
if ((((size_t)(mem)) & (alignment - 1)) != 0) { /* misaligned */
/*
Find an aligned spot inside chunk. Since we need to give
back leading space in a chunk of at least MIN_CHUNK_SIZE, if
the first calculation places us at a spot with less than
MIN_CHUNK_SIZE leader, we can move to the next aligned spot.
We've allocated enough total room so that this is always
possible.
*/
char* br = (char*)mem2chunk((size_t)(((size_t)((char*)mem + alignment -
SIZE_T_ONE)) &
-alignment));
char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE)?
br : br+alignment;
mchunkptr newp = (mchunkptr)pos;
size_t leadsize = pos - (char*)(p);
size_t newsize = chunksize(p) - leadsize;
if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */
newp->prev_foot = p->prev_foot + leadsize;
newp->head = newsize;
}
else { /* Otherwise, give back leader, use the rest */
set_inuse(m, newp, newsize);
set_inuse(m, p, leadsize);
dispose_chunk(m, p, leadsize);
}
p = newp;
}
/* Give back spare room at the end */
if (!is_mmapped(p)) {
size_t size = chunksize(p);
if (size > nb + MIN_CHUNK_SIZE) {
size_t remainder_size = size - nb;
mchunkptr remainder = chunk_plus_offset(p, nb);
set_inuse(m, p, nb);
set_inuse(m, remainder, remainder_size);
dispose_chunk(m, remainder, remainder_size);
}
}
mem = chunk2mem(p);
assert (chunksize(p) >= nb);
assert(((size_t)mem & (alignment - 1)) == 0);
check_inuse_chunk(m, p);
POSTACTION(m);
}
}
return mem;
}
/*
Common support for independent_X routines, handling
all of the combinations that can result.
The opts arg has:
bit 0 set if all elements are same size (using sizes[0])
bit 1 set if elements should be zeroed
*/
static void** ialloc(mstate m,
size_t n_elements,
size_t* sizes,
int opts,
void* chunks[]) {
size_t element_size; /* chunksize of each element, if all same */
size_t contents_size; /* total size of elements */
size_t array_size; /* request size of pointer array */
void* mem; /* malloced aggregate space */
mchunkptr p; /* corresponding chunk */
size_t remainder_size; /* remaining bytes while splitting */
void** marray; /* either "chunks" or malloced ptr array */
mchunkptr array_chunk; /* chunk for malloced ptr array */
flag_t was_enabled; /* to disable mmap */
size_t size;
size_t i;
ensure_initialization();
/* compute array length, if needed */
if (chunks != 0) {
if (n_elements == 0)
return chunks; /* nothing to do */
marray = chunks;
array_size = 0;
}
else {
/* if empty req, must still return chunk representing empty array */
if (n_elements == 0)
return (void**)internal_malloc(m, 0);
marray = 0;
array_size = request2size(n_elements * (sizeof(void*)));
}
/* compute total element size */
if (opts & 0x1) { /* all-same-size */
element_size = request2size(*sizes);
contents_size = n_elements * element_size;
}
else { /* add up all the sizes */
element_size = 0;
contents_size = 0;
for (i = 0; i != n_elements; ++i)
contents_size += request2size(sizes[i]);
}
size = contents_size + array_size;
/*
Allocate the aggregate chunk. First disable direct-mmapping so
malloc won't use it, since we would not be able to later
free/realloc space internal to a segregated mmap region.
*/
was_enabled = use_mmap(m);
disable_mmap(m);
mem = internal_malloc(m, size - CHUNK_OVERHEAD);
if (was_enabled)
enable_mmap(m);
if (mem == 0)
return 0;
if (PREACTION(m)) return 0;
p = mem2chunk(mem);
remainder_size = chunksize(p);
assert(!is_mmapped(p));
if (opts & 0x2) { /* optionally clear the elements */
bzero((size_t*)mem, remainder_size - SIZE_T_SIZE - array_size);
}
/* If not provided, allocate the pointer array as final part of chunk */
if (marray == 0) {
size_t array_chunk_size;
array_chunk = chunk_plus_offset(p, contents_size);
array_chunk_size = remainder_size - contents_size;
marray = (void**) (chunk2mem(array_chunk));
set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size);
remainder_size = contents_size;
}
/* split out elements */
for (i = 0; ; ++i) {
marray[i] = chunk2mem(p);
if (i != n_elements-1) {
if (element_size != 0)
size = element_size;
else
size = request2size(sizes[i]);
remainder_size -= size;
set_size_and_pinuse_of_inuse_chunk(m, p, size);
p = chunk_plus_offset(p, size);
}
else { /* the final element absorbs any overallocation slop */
set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size);
break;
}
}
#if DEBUG
if (marray != chunks) {
/* final element must have exactly exhausted chunk */
if (element_size != 0) {
assert(remainder_size == element_size);
}
else {
assert(remainder_size == request2size(sizes[i]));
}
check_inuse_chunk(m, mem2chunk(marray));
}
for (i = 0; i != n_elements; ++i)
check_inuse_chunk(m, mem2chunk(marray[i]));
#endif /* DEBUG */
POSTACTION(m);
return marray;
}
/* Try to free all pointers in the given array.
Note: this could be made faster, by delaying consolidation,
at the price of disabling some user integrity checks, We
still optimize some consolidations by combining adjacent
chunks before freeing, which will occur often if allocated
with ialloc or the array is sorted.
*/
static size_t internal_bulk_free(mstate m, void* array[], size_t nelem) {
size_t unfreed = 0;
if (!PREACTION(m)) {
void** a;
void** fence = &(array[nelem]);
for (a = array; a != fence; ++a) {
void* mem = *a;
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
size_t psize = chunksize(p);
#if FOOTERS
if (get_mstate_for(p) != m) {
++unfreed;
continue;
}
#endif
check_inuse_chunk(m, p);
*a = 0;
if (RTCHECK(ok_address(m, p) && ok_inuse(p))) {
void ** b = a + 1; /* try to merge with next chunk */
mchunkptr next = next_chunk(p);
if (b != fence && *b == chunk2mem(next)) {
size_t newsize = chunksize(next) + psize;
set_inuse(m, p, newsize);
*b = chunk2mem(p);
}
else
dispose_chunk(m, p, psize);
}
else {
CORRUPTION_ERROR_ACTION(m);
break;
}
}
}
if (should_trim(m, m->topsize))
sys_trim(m, 0);
POSTACTION(m);
}
return unfreed;
}
/* Traversal */
#if MALLOC_INSPECT_ALL
static void internal_inspect_all(mstate m,
void(*handler)(void *start,
void *end,
size_t used_bytes,
void* callback_arg),
void* arg) {
if (is_initialized(m)) {
mchunkptr top = m->top;
msegmentptr s;
for (s = &m->seg; s != 0; s = s->next) {
mchunkptr q = align_as_chunk(s->base);
while (segment_holds(s, q) && q->head != FENCEPOST_HEAD) {
mchunkptr next = next_chunk(q);
size_t sz = chunksize(q);
size_t used;
void* start;
if (is_inuse(q)) {
used = sz - CHUNK_OVERHEAD; /* must not be mmapped */
start = chunk2mem(q);
}
else {
used = 0;
if (is_small(sz)) { /* offset by possible bookkeeping */
start = (void*)((char*)q + sizeof(struct malloc_chunk));
}
else {
start = (void*)((char*)q + sizeof(struct malloc_tree_chunk));
}
}
if (start < (void*)next) /* skip if all space is bookkeeping */
handler(start, next, used, arg);
if (q == top)
break;
q = next;
}
}
}
}
#endif /* MALLOC_INSPECT_ALL */
/* ------------------ Exported realloc, memalign, etc -------------------- */
#if !ONLY_MSPACES
void* dlrealloc(void* oldmem, size_t bytes) {
void* mem = 0;
if (oldmem == 0) {
mem = dlmalloc(bytes);
}
else if (UNLIKELY(bytes >= MAX_REQUEST)) {
MALLOC_FAILURE_ACTION;
}
#ifdef REALLOC_ZERO_BYTES_FREES
else if (bytes == 0) {
dlfree(oldmem);
}
#endif /* REALLOC_ZERO_BYTES_FREES */
else {
size_t nb = request2size(bytes);
mchunkptr oldp = mem2chunk(oldmem);
#if ! FOOTERS
mstate m = gm;
#else /* FOOTERS */
mstate m = get_mstate_for(oldp);
if (!ok_magic(m)) {
USAGE_ERROR_ACTION(m, oldmem);
return 0;
}
#endif /* FOOTERS */
if (!PREACTION(m)) {
mchunkptr newp = try_realloc_chunk(m, oldp, nb, 1);
POSTACTION(m);
if (newp != 0) {
check_inuse_chunk(m, newp);
mem = chunk2mem(newp);
}
else {
mem = internal_malloc(m, bytes);
if (mem != 0) {
size_t oc = chunksize(oldp) - overhead_for(oldp);
memcpy(mem, oldmem, (oc < bytes)? oc : bytes);
internal_free(m, oldmem);
}
}
}
}
return mem;
}
void* dlrealloc_in_place(void* oldmem, size_t bytes) {
void* mem = 0;
if (oldmem != 0) {
if (bytes >= MAX_REQUEST) {
MALLOC_FAILURE_ACTION;
}
else {
size_t nb = request2size(bytes);
mchunkptr oldp = mem2chunk(oldmem);
#if ! FOOTERS
mstate m = gm;
#else /* FOOTERS */
mstate m = get_mstate_for(oldp);
if (!ok_magic(m)) {
USAGE_ERROR_ACTION(m, oldmem);
return 0;
}
#endif /* FOOTERS */
if (!PREACTION(m)) {
mchunkptr newp = try_realloc_chunk(m, oldp, nb, 0);
POSTACTION(m);
if (newp == oldp) {
check_inuse_chunk(m, newp);
mem = oldmem;
}
}
}
}
return mem;
}
void* dlmemalign(size_t alignment, size_t bytes) {
if (alignment <= MALLOC_ALIGNMENT) {
return dlmalloc(bytes);
}
return internal_memalign(gm, alignment, bytes);
}
int dlposix_memalign(void** pp, size_t alignment, size_t bytes) {
void* mem = 0;
if (alignment == MALLOC_ALIGNMENT)
mem = dlmalloc(bytes);
else {
size_t d = alignment / sizeof(void*);
size_t r = alignment % sizeof(void*);
if (r != 0 || d == 0 || (d & (d-SIZE_T_ONE)) != 0)
return EINVAL;
else if (bytes <= MAX_REQUEST - alignment) {
if (alignment < MIN_CHUNK_SIZE)
alignment = MIN_CHUNK_SIZE;
mem = internal_memalign(gm, alignment, bytes);
}
}
if (!mem) {
return ENOMEM;
} else {
*pp = mem;
return 0;
}
}
#if USE_LOCKS
void dlmalloc_atfork(void) {
bzero(&gm->mutex, sizeof(gm->mutex));
bzero(&malloc_global_mutex, sizeof(malloc_global_mutex));
}
#endif
void* dlvalloc(size_t bytes) {
size_t pagesz;
ensure_initialization();
pagesz = mparams.page_size;
return dlmemalign(pagesz, bytes);
}
void* dlpvalloc(size_t bytes) {
size_t pagesz;
ensure_initialization();
pagesz = mparams.page_size;
return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE));
}
void** dlindependent_calloc(size_t n_elements, size_t elem_size,
void* chunks[]) {
size_t sz = elem_size; /* serves as 1-element array */
return ialloc(gm, n_elements, &sz, 3, chunks);
}
void** dlindependent_comalloc(size_t n_elements, size_t sizes[],
void* chunks[]) {
return ialloc(gm, n_elements, sizes, 0, chunks);
}
size_t dlbulk_free(void* array[], size_t nelem) {
return internal_bulk_free(gm, array, nelem);
}
#if MALLOC_INSPECT_ALL
void dlmalloc_inspect_all(void(*handler)(void *start,
void *end,
size_t used_bytes,
void* callback_arg),
void* arg) {
ensure_initialization();
if (!PREACTION(gm)) {
internal_inspect_all(gm, handler, arg);
POSTACTION(gm);
}
}
#endif /* MALLOC_INSPECT_ALL */
int dlmalloc_trim(size_t pad) {
int result = 0;
ensure_initialization();
if (!PREACTION(gm)) {
result = sys_trim(gm, pad);
POSTACTION(gm);
}
return result;
}
size_t dlmalloc_footprint(void) {
return gm->footprint;
}
size_t dlmalloc_max_footprint(void) {
return gm->max_footprint;
}
size_t dlmalloc_footprint_limit(void) {
size_t maf = gm->footprint_limit;
return maf == 0 ? MAX_SIZE_T : maf;
}
size_t dlmalloc_set_footprint_limit(size_t bytes) {
size_t result; /* invert sense of 0 */
if (bytes == 0)
result = granularity_align(1); /* Use minimal size */
if (bytes == MAX_SIZE_T)
result = 0; /* disable */
else
result = granularity_align(bytes);
return gm->footprint_limit = result;
}
#if !NO_MALLINFO
struct mallinfo dlmallinfo(void) {
return internal_mallinfo(gm);
}
#endif /* NO_MALLINFO */
#if !NO_MALLOC_STATS
void dlmalloc_stats() {
internal_malloc_stats(gm);
}
#endif /* NO_MALLOC_STATS */
int dlmallopt(int param_number, int value) {
return change_mparam(param_number, value);
}
size_t dlmalloc_usable_size(void* mem) {
mchunkptr p;
size_t bytes;
if (mem) {
p = mem2chunk(mem);
if (is_inuse(p)) {
bytes = chunksize(p) - overhead_for(p);
} else {
bytes = 0;
}
} else {
bytes = 0;
}
return bytes;
}
#endif /* !ONLY_MSPACES */
/* ----------------------------- user mspaces ---------------------------- */
#if MSPACES
#include "third_party/dlmalloc/mspaces.inc"
#endif /* MSPACES */
| 43,673 | 1,444 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/init.inc | // clang-format off
/* ---------------------------- setting mparams -------------------------- */
#if LOCK_AT_FORK
static void dlmalloc_pre_fork(void) { ACQUIRE_LOCK(&(gm)->mutex); }
static void dlmalloc_post_fork_parent(void) { RELEASE_LOCK(&(gm)->mutex); }
static void dlmalloc_post_fork_child(void) { INITIAL_LOCK(&(gm)->mutex); }
#endif /* LOCK_AT_FORK */
/* Initialize mparams */
__attribute__((__constructor__)) int init_mparams(void) {
#ifdef NEED_GLOBAL_LOCK_INIT
if (malloc_global_mutex_status <= 0)
init_malloc_global_mutex();
#endif
// ACQUIRE_MALLOC_GLOBAL_LOCK();
if (mparams.magic == 0) {
size_t magic;
size_t psize;
size_t gsize;
#if defined(__COSMOPOLITAN__)
psize = FRAMESIZE;
gsize = FRAMESIZE;
#elif !defined(WIN32)
psize = malloc_getpagesize;
gsize = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : psize);
#else /* WIN32 */
{
SYSTEM_INFO system_info;
GetSystemInfo(&system_info);
psize = system_info.dwPageSize;
gsize = ((DEFAULT_GRANULARITY != 0)?
DEFAULT_GRANULARITY : system_info.dwAllocationGranularity);
}
#endif /* WIN32 */
/* Sanity-check configuration:
size_t must be unsigned and as wide as pointer type.
ints must be at least 4 bytes.
alignment must be at least 8.
Alignment, min chunk size, and page size must all be powers of 2.
*/
if ((sizeof(size_t) != sizeof(char*)) ||
(MAX_SIZE_T < MIN_CHUNK_SIZE) ||
(sizeof(int) < 4) ||
(MALLOC_ALIGNMENT < (size_t)8U) ||
((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-SIZE_T_ONE)) != 0) ||
((MCHUNK_SIZE & (MCHUNK_SIZE-SIZE_T_ONE)) != 0) ||
((gsize & (gsize-SIZE_T_ONE)) != 0) ||
((psize & (psize-SIZE_T_ONE)) != 0))
ABORT;
mparams.granularity = gsize;
mparams.page_size = psize;
mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD;
#if MORECORE_CONTIGUOUS
mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT;
#else /* MORECORE_CONTIGUOUS */
mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT;
#endif /* MORECORE_CONTIGUOUS */
#if !ONLY_MSPACES
/* Set up lock for main malloc area */
gm->mflags = mparams.default_mflags;
(void)INITIAL_LOCK(&gm->mutex);
#endif
#if LOCK_AT_FORK
pthread_atfork(&dlmalloc_pre_fork,
&dlmalloc_post_fork_parent,
&dlmalloc_post_fork_child);
#endif
{
#if USE_DEV_RANDOM
int fd;
unsigned char buf[sizeof(size_t)];
/* Try to use /dev/urandom, else fall back on using time */
if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 &&
read(fd, buf, sizeof(buf)) == sizeof(buf)) {
magic = *((size_t *) buf);
close(fd);
}
else
#endif /* USE_DEV_RANDOM */
magic = (size_t)(_rand64() ^ (size_t)0x55555555U);
magic |= (size_t)8U; /* ensure nonzero */
magic &= ~(size_t)7U; /* improve chances of fault for bad values */
/* Until memory modes commonly available, use volatile-write */
(*(volatile size_t *)(&(mparams.magic))) = magic;
}
}
// RELEASE_MALLOC_GLOBAL_LOCK();
return 1;
}
/* support for mallopt */
static int change_mparam(int param_number, int value) {
size_t val;
ensure_initialization();
val = (value == -1)? MAX_SIZE_T : (size_t)value;
switch(param_number) {
case M_TRIM_THRESHOLD:
mparams.trim_threshold = val;
return 1;
case M_GRANULARITY:
if (val >= mparams.page_size && ((val & (val-1)) == 0)) {
mparams.granularity = val;
return 1;
}
else
return 0;
case M_MMAP_THRESHOLD:
mparams.mmap_threshold = val;
return 1;
default:
return 0;
}
}
| 3,820 | 125 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/README.cosmo | DESCRIPTION
malloc-2.8.6
written by Doug Lea
LICENSE
http://creativecommons.org/publicdomain/zero/1.0/
LOCAL CHANGES
- Use faster two power roundup for memalign()
- Poison maps to integrate with Address Sanitizer
- Introduce __oom_hook() by using _mapanon() vs. mmap()
- Wrap locks with __threaded check to improve perf lots
- Use assembly init rather than ensure_initialization()
| 402 | 17 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/directmap.inc | // clang-format off
/* ----------------------- Direct-mmapping chunks ----------------------- */
/*
Directly mmapped chunks are set up with an offset to the start of
the mmapped region stored in the prev_foot field of the chunk. This
allows reconstruction of the required argument to MUNMAP when freed,
and also allows adjustment of the returned chunk to meet alignment
requirements (especially in memalign).
*/
/* Malloc using mmap */
static void* mmap_alloc(mstate m, size_t nb) {
size_t mmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
if (m->footprint_limit != 0) {
size_t fp = m->footprint + mmsize;
if (fp <= m->footprint || fp > m->footprint_limit)
return 0;
}
if (mmsize > nb) { /* Check for wrap around 0 */
char* mm = (char*)(dlmalloc_requires_more_vespene_gas(mmsize));
if (mm != CMFAIL) {
size_t offset = align_offset(chunk2mem(mm));
size_t psize = mmsize - offset - MMAP_FOOT_PAD;
mchunkptr p = (mchunkptr)(mm + offset);
p->prev_foot = offset;
p->head = psize;
mark_inuse_foot(m, p, psize);
chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD;
chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0;
if (m->least_addr == 0 || mm < m->least_addr)
m->least_addr = mm;
if ((m->footprint += mmsize) > m->max_footprint)
m->max_footprint = m->footprint;
assert(is_aligned(chunk2mem(p)));
check_mmapped_chunk(m, p);
return chunk2mem(p);
}
}
return 0;
}
/* Realloc using mmap */
static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb, int flags) {
size_t oldsize = chunksize(oldp);
(void)flags; /* placate people compiling -Wunused */
if (is_small(nb)) /* Can't shrink mmap regions below small size */
return 0;
/* Keep old chunk if big enough but not too big */
if (oldsize >= nb + SIZE_T_SIZE &&
(oldsize - nb) <= (mparams.granularity << 1))
return oldp;
else {
size_t offset = oldp->prev_foot;
size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD;
size_t newmmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
char* cp = (char*)CALL_MREMAP((char*)oldp - offset,
oldmmsize, newmmsize, flags);
if (cp != CMFAIL) {
mchunkptr newp = (mchunkptr)(cp + offset);
size_t psize = newmmsize - offset - MMAP_FOOT_PAD;
newp->head = psize;
mark_inuse_foot(m, newp, psize);
chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD;
chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0;
if (cp < m->least_addr)
m->least_addr = cp;
if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint)
m->max_footprint = m->footprint;
check_mmapped_chunk(m, newp);
return newp;
}
}
return 0;
}
| 2,822 | 80 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/README | This is a version (aka dlmalloc) of malloc/free/realloc written by
Doug Lea and released to the public domain, as explained at
http://creativecommons.org/publicdomain/zero/1.0/ Send questions,
comments, complaints, performance data, etc to [email protected]
* Version 2.8.6 Wed Aug 29 06:57:58 2012 Doug Lea
Note: There may be an updated version of this malloc obtainable at
ftp://gee.cs.oswego.edu/pub/misc/malloc.c
Check before installing!
* Quickstart
This library is all in one file to simplify the most common usage:
ftp it, compile it (-O3), and link it into another program. All of
the compile-time options default to reasonable values for use on
most platforms. You might later want to step through various
compile-time and dynamic tuning options.
For convenience, an include file for code using this malloc is at:
ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.6.h
You don't really need this .h file unless you call functions not
defined in your system include files. The .h file contains only the
excerpts from this file needed for using this malloc on ANSI C/C++
systems, so long as you haven't changed compile-time options about
naming and tuning parameters. If you do, then you can create your
own malloc.h that does include all settings by cutting at the point
indicated below. Note that you may already by default be using a C
library containing a malloc that is based on some version of this
malloc (for example in linux). You might still want to use the one
in this file to customize settings or to avoid overheads associated
with library versions.
* Vital statistics:
Supported pointer/size_t representation: 4 or 8 bytes
size_t MUST be an unsigned type of the same width as
pointers. (If you are using an ancient system that declares
size_t as a signed type, or need it to be a different width
than pointers, you can use a previous release of this malloc
(e.g. 2.7.2) supporting these.)
Alignment: 8 bytes (minimum)
This suffices for nearly all current machines and C compilers.
However, you can define MALLOC_ALIGNMENT to be wider than this
if necessary (up to 128bytes), at the expense of using more space.
Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes)
8 or 16 bytes (if 8byte sizes)
Each malloced chunk has a hidden word of overhead holding size
and status information, and additional cross-check word
if FOOTERS is defined.
Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead)
8-byte ptrs: 32 bytes (including overhead)
Even a request for zero bytes (i.e., malloc(0)) returns a
pointer to something of the minimum allocatable size.
The maximum overhead wastage (i.e., number of extra bytes
allocated than were requested in malloc) is less than or equal
to the minimum size, except for requests >= mmap_threshold that
are serviced via mmap(), where the worst case wastage is about
32 bytes plus the remainder from a system page (the minimal
mmap unit); typically 4096 or 8192 bytes.
Security: static-safe; optionally more or less
The "security" of malloc refers to the ability of malicious
code to accentuate the effects of errors (for example, freeing
space that is not currently malloc'ed or overwriting past the
ends of chunks) in code that calls malloc. This malloc
guarantees not to modify any memory locations below the base of
heap, i.e., static variables, even in the presence of usage
errors. The routines additionally detect most improper frees
and reallocs. All this holds as long as the static bookkeeping
for malloc itself is not corrupted by some other means. This
is only one aspect of security -- these checks do not, and
cannot, detect all possible programming errors.
If FOOTERS is defined nonzero, then each allocated chunk
carries an additional check word to verify that it was malloced
from its space. These check words are the same within each
execution of a program using malloc, but differ across
executions, so externally crafted fake chunks cannot be
freed. This improves security by rejecting frees/reallocs that
could corrupt heap memory, in addition to the checks preventing
writes to statics that are always on. This may further improve
security at the expense of time and space overhead. (Note that
FOOTERS may also be worth using with MSPACES.)
By default detected errors cause the program to abort (calling
"abort()"). You can override this to instead proceed past
errors by defining PROCEED_ON_ERROR. In this case, a bad free
has no effect, and a malloc that encounters a bad address
caused by user overwrites will ignore the bad address by
dropping pointers and indices to all known memory. This may
be appropriate for programs that should continue if at all
possible in the face of programming errors, although they may
run out of memory because dropped memory is never reclaimed.
If you don't like either of these options, you can define
CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything
else. And if if you are sure that your program using malloc has
no errors or vulnerabilities, you can define INSECURE to 1,
which might (or might not) provide a small performance improvement.
It is also possible to limit the maximum total allocatable
space, using malloc_set_footprint_limit. This is not
designed as a security feature in itself (calls to set limits
are not screened or privileged), but may be useful as one
aspect of a secure implementation.
Thread-safety: NOT thread-safe unless USE_LOCKS defined non-zero
When USE_LOCKS is defined, each public call to malloc, free,
etc is surrounded with a lock. By default, this uses a plain
pthread mutex, win32 critical section, or a spin-lock if if
available for the platform and not disabled by setting
USE_SPIN_LOCKS=0. However, if USE_RECURSIVE_LOCKS is defined,
recursive versions are used instead (which are not required for
base functionality but may be needed in layered extensions).
Using a global lock is not especially fast, and can be a major
bottleneck. It is designed only to provide minimal protection
in concurrent environments, and to provide a basis for
extensions. If you are using malloc in a concurrent program,
consider instead using nedmalloc
(http://www.nedprod.com/programs/portable/nedmalloc/) or
ptmalloc (See http://www.malloc.de), which are derived from
versions of this malloc.
System requirements: Any combination of MORECORE and/or MMAP/MUNMAP
This malloc can use unix sbrk or any emulation (invoked using
the CALL_MORECORE macro) and/or mmap/munmap or any emulation
(invoked using CALL_MMAP/CALL_MUNMAP) to get and release system
memory. On most unix systems, it tends to work best if both
MORECORE and MMAP are enabled. On Win32, it uses emulations
based on VirtualAlloc. It also uses common C library functions
like memset.
Compliance: I believe it is compliant with the Single Unix Specification
(See http://www.unix.org). Also SVID/XPG, ANSI C, and probably
others as well.
* Overview of algorithms
This is not the fastest, most space-conserving, most portable, or
most tunable malloc ever written. However it is among the fastest
while also being among the most space-conserving, portable and
tunable. Consistent balance across these factors results in a good
general-purpose allocator for malloc-intensive programs.
In most ways, this malloc is a best-fit allocator. Generally, it
chooses the best-fitting existing chunk for a request, with ties
broken in approximately least-recently-used order. (This strategy
normally maintains low fragmentation.) However, for requests less
than 256bytes, it deviates from best-fit when there is not an
exactly fitting available chunk by preferring to use space adjacent
to that used for the previous small request, as well as by breaking
ties in approximately most-recently-used order. (These enhance
locality of series of small allocations.) And for very large requests
(>= 256Kb by default), it relies on system memory mapping
facilities, if supported. (This helps avoid carrying around and
possibly fragmenting memory used only for large chunks.)
All operations (except malloc_stats and mallinfo) have execution
times that are bounded by a constant factor of the number of bits in
a size_t, not counting any clearing in calloc or copying in realloc,
or actions surrounding MORECORE and MMAP that have times
proportional to the number of non-contiguous regions returned by
system allocation routines, which is often just 1. In real-time
applications, you can optionally suppress segment traversals using
NO_SEGMENT_TRAVERSAL, which assures bounded execution even when
system allocators return non-contiguous spaces, at the typical
expense of carrying around more memory and increased fragmentation.
The implementation is not very modular and seriously overuses
macros. Perhaps someday all C compilers will do as good a job
inlining modular code as can now be done by brute-force expansion,
but now, enough of them seem not to.
Some compilers issue a lot of warnings about code that is
dead/unreachable only on some platforms, and also about intentional
uses of negation on unsigned types. All known cases of each can be
ignored.
For a longer but out of date high-level description, see
http://gee.cs.oswego.edu/dl/html/malloc.html
----------------------- Chunk representations ------------------------
(The following includes lightly edited explanations by Colin Plumb.)
The malloc_chunk declaration below is misleading (but accurate and
necessary). It declares a "view" into memory allowing access to
necessary fields at known offsets from a given base.
Chunks of memory are maintained using a `boundary tag' method as
originally described by Knuth. (See the paper by Paul Wilson
ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such
techniques.) Sizes of free chunks are stored both in the front of
each chunk and at the end. This makes consolidating fragmented
chunks into bigger chunks fast. The head fields also hold bits
representing whether chunks are free or in use.
Here are some pictures to make it clearer. They are "exploded" to
show that the state of a chunk can be thought of as extending from
the high 31 bits of the head field of its header through the
prev_foot and PINUSE_BIT bit of the following chunk header.
A chunk that's in use looks like:
chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of previous chunk (if P = 0) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P|
| Size of this chunk 1| +-+
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+- -+
| |
+- -+
| :
+- size - sizeof(size_t) available payload bytes -+
: |
chunk-> +- -+
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1|
| Size of next chunk (may or may not be in use) | +-+
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
And if it's free, it looks like this:
chunk-> +- -+
| User payload (must be in use, or we would have merged!) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P|
| Size of this chunk 0| +-+
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next pointer |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Prev pointer |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :
+- size - sizeof(struct chunk) unused bytes -+
: |
chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of this chunk |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0|
| Size of next chunk (must be in use, or we would have merged)| +-+
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :
+- User payload -+
: |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0|
+-+
Note that since we always merge adjacent free chunks, the chunks
adjacent to a free chunk must be in use.
Given a pointer to a chunk (which can be derived trivially from the
payload pointer) we can, in O(1) time, find out whether the adjacent
chunks are free, and if so, unlink them from the lists that they
are on and merge them with the current chunk.
Chunks always begin on even word boundaries, so the mem portion
(which is returned to the user) is also on an even word boundary, and
thus at least double-word aligned.
The P (PINUSE_BIT) bit, stored in the unused low-order bit of the
chunk size (which is always a multiple of two words), is an in-use
bit for the *previous* chunk. If that bit is *clear*, then the
word before the current chunk size contains the previous chunk
size, and can be used to find the front of the previous chunk.
The very first chunk allocated always has this bit set, preventing
access to non-existent (or non-owned) memory. If pinuse is set for
any given chunk, then you CANNOT determine the size of the
previous chunk, and might even get a memory addressing fault when
trying to do so.
The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of
the chunk size redundantly records whether the current chunk is
inuse (unless the chunk is mmapped). This redundancy enables usage
checks within free and realloc, and reduces indirection when freeing
and consolidating chunks.
Each freshly allocated chunk must have both cinuse and pinuse set.
That is, each allocated chunk borders either a previously allocated
and still in-use chunk, or the base of its memory arena. This is
ensured by making all allocations from the `lowest' part of any
found chunk. Further, no free chunk physically borders another one,
so each free chunk is known to be preceded and followed by either
inuse chunks or the ends of memory.
Note that the `foot' of the current chunk is actually represented
as the prev_foot of the NEXT chunk. This makes it easier to
deal with alignments etc but can be very confusing when trying
to extend or adapt this code.
The exceptions to all this are
1. The special chunk `top' is the top-most available chunk (i.e.,
the one bordering the end of available memory). It is treated
specially. Top is never included in any bin, is used only if
no other chunk is available, and is released back to the
system if it is very large (see M_TRIM_THRESHOLD). In effect,
the top chunk is treated as larger (and thus less well
fitting) than any other available chunk. The top chunk
doesn't update its trailing size field since there is no next
contiguous chunk that would have to index off it. However,
space is still allocated for it (TOP_FOOT_SIZE) to enable
separation or merging when space is extended.
3. Chunks allocated via mmap, have both cinuse and pinuse bits
cleared in their head fields. Because they are allocated
one-by-one, each must carry its own prev_foot field, which is
also used to hold the offset this chunk has within its mmapped
region, which is needed to preserve alignment. Each mmapped
chunk is trailed by the first two fields of a fake next-chunk
for sake of usage checks.
---------------------- Overlaid data structures -----------------------
When chunks are not in use, they are treated as nodes of either
lists or trees.
"Small" chunks are stored in circular doubly-linked lists, and look
like this:
chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of previous chunk |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`head:' | Size of chunk, in bytes |P|
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Forward pointer to next chunk in list |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Back pointer to previous chunk in list |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Unused space (may be 0 bytes long) .
. .
. |
nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`foot:' | Size of chunk, in bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Larger chunks are kept in a form of bitwise digital trees (aka
tries) keyed on chunksizes. Because malloc_tree_chunks are only for
free chunks greater than 256 bytes, their size doesn't impose any
constraints on user chunk sizes. Each node looks like:
chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of previous chunk |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`head:' | Size of chunk, in bytes |P|
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Forward pointer to next chunk of same size |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Back pointer to previous chunk of same size |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Pointer to left child (child[0]) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Pointer to right child (child[1]) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Pointer to parent |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| bin index of this chunk |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Unused space .
. |
nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`foot:' | Size of chunk, in bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Each tree holding treenodes is a tree of unique chunk sizes. Chunks
of the same size are arranged in a circularly-linked list, with only
the oldest chunk (the next to be used, in our FIFO ordering)
actually in the tree. (Tree members are distinguished by a non-null
parent pointer.) If a chunk with the same size an an existing node
is inserted, it is linked off the existing node using pointers that
work in the same way as fd/bk pointers of small chunks.
Each tree contains a power of 2 sized range of chunk sizes (the
smallest is 0x100 <= x < 0x180), which is is divided in half at each
tree level, with the chunks in the smaller half of the range (0x100
<= x < 0x140 for the top nose) in the left subtree and the larger
half (0x140 <= x < 0x180) in the right subtree. This is, of course,
done by inspecting individual bits.
Using these rules, each node's left subtree contains all smaller
sizes than its right subtree. However, the node at the root of each
subtree has no particular ordering relationship to either. (The
dividing line between the subtree sizes is based on trie relation.)
If we remove the last chunk of a given size from the interior of the
tree, we need to replace it with a leaf node. The tree ordering
rules permit a node to be replaced by any leaf below it.
The smallest chunk in a tree (a common operation in a best-fit
allocator) can be found by walking a path to the leftmost leaf in
the tree. Unlike a usual binary tree, where we follow left child
pointers until we reach a null, here we follow the right child
pointer any time the left one is null, until we reach a leaf with
both child pointers null. The smallest chunk in the tree will be
somewhere along that path.
The worst case number of steps to add, find, or remove a node is
bounded by the number of bits differentiating chunks within
bins. Under current bin calculations, this ranges from 6 up to 21
(for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case
is of course much better.
----------------------------- Segments --------------------------------
Each malloc space may include non-contiguous segments, held in a
list headed by an embedded malloc_segment record representing the
top-most space. Segments also include flags holding properties of
the space. Large chunks that are directly allocated by mmap are not
included in this list. They are instead independently created and
destroyed without otherwise keeping track of them.
Segment management mainly comes into play for spaces allocated by
MMAP. Any call to MMAP might or might not return memory that is
adjacent to an existing segment. MORECORE normally contiguously
extends the current space, so this space is almost always adjacent,
which is simpler and faster to deal with. (This is why MORECORE is
used preferentially to MMAP when both are available -- see
sys_alloc.) When allocating using MMAP, we don't use any of the
hinting mechanisms (inconsistently) supported in various
implementations of unix mmap, or distinguish reserving from
committing memory. Instead, we just ask for space, and exploit
contiguity when we get it. It is probably possible to do
better than this on some systems, but no general scheme seems
to be significantly better.
Management entails a simpler variant of the consolidation scheme
used for chunks to reduce fragmentation -- new adjacent memory is
normally prepended or appended to an existing segment. However,
there are limitations compared to chunk consolidation that mostly
reflect the fact that segment processing is relatively infrequent
(occurring only when getting memory from system) and that we
don't expect to have huge numbers of segments:
* Segments are not indexed, so traversal requires linear scans. (It
would be possible to index these, but is not worth the extra
overhead and complexity for most programs on most platforms.)
* New segments are only appended to old ones when holding top-most
memory; if they cannot be prepended to others, they are held in
different segments.
Except for the top-most segment of an mstate, each segment record
is kept at the tail of its segment. Segments are added by pushing
segment records onto the list headed by &mstate.seg for the
containing mstate.
Segment flags control allocation/merge/deallocation policies:
* If EXTERN_BIT set, then we did not allocate this segment,
and so should not try to deallocate or merge with others.
(This currently holds only for the initial segment passed
into create_mspace_with_base.)
* If USE_MMAP_BIT set, the segment may be merged with
other surrounding mmapped segments and trimmed/de-allocated
using munmap.
* If neither bit is set, then the segment was obtained using
MORECORE so can be merged with surrounding MORECORE'd segments
and deallocated/trimmed using MORECORE with negative arguments.
---------------------------- malloc_state -----------------------------
A malloc_state holds all of the bookkeeping for a space.
The main fields are:
Top
The topmost chunk of the currently active segment. Its size is
cached in topsize. The actual size of topmost space is
topsize+TOP_FOOT_SIZE, which includes space reserved for adding
fenceposts and segment records if necessary when getting more
space from the system. The size at which to autotrim top is
cached from mparams in trim_check, except that it is disabled if
an autotrim fails.
Designated victim (dv)
This is the preferred chunk for servicing small requests that
don't have exact fits. It is normally the chunk split off most
recently to service another small request. Its size is cached in
dvsize. The link fields of this chunk are not maintained since it
is not kept in a bin.
SmallBins
An array of bin headers for free chunks. These bins hold chunks
with sizes less than MIN_LARGE_SIZE bytes. Each bin contains
chunks of all the same size, spaced 8 bytes apart. To simplify
use in double-linked lists, each bin header acts as a malloc_chunk
pointing to the real first node, if it exists (else pointing to
itself). This avoids special-casing for headers. But to avoid
waste, we allocate only the fd/bk pointers of bins, and then use
repositioning tricks to treat these as the fields of a chunk.
TreeBins
Treebins are pointers to the roots of trees holding a range of
sizes. There are 2 equally spaced treebins for each power of two
from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything
larger.
Bin maps
There is one bit map for small bins ("smallmap") and one for
treebins ("treemap). Each bin sets its bit when non-empty, and
clears the bit when empty. Bit operations are then used to avoid
bin-by-bin searching -- nearly all "search" is done without ever
looking at bins that won't be selected. The bit maps
conservatively use 32 bits per map word, even if on 64bit system.
For a good description of some of the bit-based techniques used
here, see Henry S. Warren Jr's book "Hacker's Delight" (and
supplement at http://hackersdelight.org/). Many of these are
intended to reduce the branchiness of paths through malloc etc, as
well as to reduce the number of memory locations read or written.
Segments
A list of segments headed by an embedded malloc_segment record
representing the initial space.
Address check support
The least_addr field is the least address ever obtained from
MORECORE or MMAP. Attempted frees and reallocs of any address less
than this are trapped (unless INSECURE is defined).
Magic tag
A cross-check field that should always hold same value as mparams.magic.
Max allowed footprint
The maximum allowed bytes to allocate from system (zero means no limit)
Flags
Bits recording whether to use MMAP, locks, or contiguous MORECORE
Statistics
Each space keeps track of current and maximum system memory
obtained via MORECORE or MMAP.
Trim support
Fields holding the amount of unused topmost memory that should trigger
trimming, and a counter to force periodic scanning to release unused
non-topmost segments.
Locking
If USE_LOCKS is defined, the "mutex" lock is acquired and released
around every public call using this mspace.
Extension support
A void* pointer and a size_t field that can be used to help implement
extensions to this malloc.
////////////////////////////////////////////////////////////////////////////////
* MSPACES
If MSPACES is defined, then in addition to malloc, free, etc.,
this file also defines mspace_malloc, mspace_free, etc. These
are versions of malloc routines that take an "mspace" argument
obtained using create_mspace, to control all internal bookkeeping.
If ONLY_MSPACES is defined, only these versions are compiled.
So if you would like to use this allocator for only some allocations,
and your system malloc for others, you can compile with
ONLY_MSPACES and then do something like...
static mspace mymspace = create_mspace(0,0); // for example
#define mymalloc(bytes) mspace_malloc(mymspace, bytes)
(Note: If you only need one instance of an mspace, you can instead
use "USE_DL_PREFIX" to relabel the global malloc.)
You can similarly create thread-local allocators by storing
mspaces as thread-locals. For example:
static __thread mspace tlms = 0;
void* tlmalloc(size_t bytes) {
if (tlms == 0) tlms = create_mspace(0, 0);
return mspace_malloc(tlms, bytes);
}
void tlfree(void* mem) { mspace_free(tlms, mem); }
Unless FOOTERS is defined, each mspace is completely independent.
You cannot allocate from one and free to another (although
conformance is only weakly checked, so usage errors are not always
caught). If FOOTERS is defined, then each chunk carries around a tag
indicating its originating mspace, and frees are directed to their
originating spaces. Normally, this requires use of locks.
------------------------- Compile-time options ---------------------------
Be careful in setting #define values for numerical constants of type
size_t. On some systems, literal values are not automatically extended
to size_t precision unless they are explicitly casted. You can also
use the symbolic values MAX_SIZE_T, SIZE_T_ONE, etc below.
WIN32 default: defined if _WIN32 defined
Defining WIN32 sets up defaults for MS environment and compilers.
Otherwise defaults are for unix. Beware that there seem to be some
cases where this malloc might not be a pure drop-in replacement for
Win32 malloc: Random-looking failures from Win32 GDI API's (eg;
SetDIBits()) may be due to bugs in some video driver implementations
when pixel buffers are malloc()ed, and the region spans more than
one VirtualAlloc()ed region. Because dlmalloc uses a small (64Kb)
default granularity, pixel buffers may straddle virtual allocation
regions more often than when using the Microsoft allocator. You can
avoid this by using VirtualAlloc() and VirtualFree() for all pixel
buffers rather than using malloc(). If this is not possible,
recompile this malloc with a larger DEFAULT_GRANULARITY. Note:
in cases where MSC and gcc (cygwin) are known to differ on WIN32,
conditions use _MSC_VER to distinguish them.
DLMALLOC_EXPORT default: extern
Defines how public APIs are declared. If you want to export via a
Windows DLL, you might define this as
#define DLMALLOC_EXPORT extern __declspec(dllexport)
If you want a POSIX ELF shared object, you might use
#define DLMALLOC_EXPORT extern __attribute__((visibility("default")))
MALLOC_ALIGNMENT default: (size_t)(2 * sizeof(void *))
Controls the minimum alignment for malloc'ed chunks. It must be a
power of two and at least 8, even on machines for which smaller
alignments would suffice. It may be defined as larger than this
though. Note however that code and data structures are optimized for
the case of 8-byte alignment.
MSPACES default: 0 (false)
If true, compile in support for independent allocation spaces.
This is only supported if HAVE_MMAP is true.
ONLY_MSPACES default: 0 (false)
If true, only compile in mspace versions, not regular versions.
USE_LOCKS default: 0 (false)
Causes each call to each public routine to be surrounded with
pthread or WIN32 mutex lock/unlock. (If set true, this can be
overridden on a per-mspace basis for mspace versions.) If set to a
non-zero value other than 1, locks are used, but their
implementation is left out, so lock functions must be supplied manually,
as described below.
USE_SPIN_LOCKS default: 1 iff USE_LOCKS and spin locks available
If true, uses custom spin locks for locking. This is currently
supported only gcc >= 4.1, older gccs on x86 platforms, and recent
MS compilers. Otherwise, posix locks or win32 critical sections are
used.
USE_RECURSIVE_LOCKS default: not defined
If defined nonzero, uses recursive (aka reentrant) locks, otherwise
uses plain mutexes. This is not required for malloc proper, but may
be needed for layered allocators such as nedmalloc.
LOCK_AT_FORK default: not defined
If defined nonzero, performs pthread_atfork upon initialization
to initialize child lock while holding parent lock. The implementation
assumes that pthread locks (not custom locks) are being used. In other
cases, you may need to customize the implementation.
FOOTERS default: 0
If true, provide extra checking and dispatching by placing
information in the footers of allocated chunks. This adds
space and time overhead.
INSECURE default: 0
If true, omit checks for usage errors and heap space overwrites.
USE_DL_PREFIX default: NOT defined
Causes compiler to prefix all public routines with the string 'dl'.
This can be useful when you only want to use this malloc in one part
of a program, using your regular system malloc elsewhere.
MALLOC_INSPECT_ALL default: NOT defined
If defined, compiles malloc_inspect_all and mspace_inspect_all, that
perform traversal of all heap space. Unless access to these
functions is otherwise restricted, you probably do not want to
include them in secure implementations.
ABORT default: defined as abort()
Defines how to abort on failed checks. On most systems, a failed
check cannot die with an "assert" or even print an informative
message, because the underlying print routines in turn call malloc,
which will fail again. Generally, the best policy is to simply call
abort(). It's not very useful to do more than this because many
errors due to overwriting will show up as address faults (null, odd
addresses etc) rather than malloc-triggered checks, so will also
abort. Also, most compilers know that abort() does not return, so
can better optimize code conditionally calling it.
PROCEED_ON_ERROR default: defined as 0 (false)
Controls whether detected bad addresses cause them to bypassed
rather than aborting. If set, detected bad arguments to free and
realloc are ignored. And all bookkeeping information is zeroed out
upon a detected overwrite of freed heap space, thus losing the
ability to ever return it from malloc again, but enabling the
application to proceed. If PROCEED_ON_ERROR is defined, the
static variable malloc_corruption_error_count is compiled in
and can be examined to see if errors have occurred. This option
generates slower code than the default abort policy.
DEBUG default: NOT defined
The DEBUG setting is mainly intended for people trying to modify
this code or diagnose problems when porting to new platforms.
However, it may also be able to better isolate user errors than just
using runtime checks. The assertions in the check routines spell
out in more detail the assumptions and invariants underlying the
algorithms. The checking is fairly extensive, and will slow down
execution noticeably. Calling malloc_stats or mallinfo with DEBUG
set will attempt to check every non-mmapped allocated and free chunk
in the course of computing the summaries.
ABORT_ON_ASSERT_FAILURE default: defined as 1 (true)
Debugging assertion failures can be nearly impossible if your
version of the assert macro causes malloc to be called, which will
lead to a cascade of further failures, blowing the runtime stack.
ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(),
which will usually make debugging easier.
MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32
The action to take before "return 0" when malloc fails to be able to
return memory because there is none available.
HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES
True if this system supports sbrk or an emulation of it.
MORECORE default: sbrk
The name of the sbrk-style system routine to call to obtain more
memory. See below for guidance on writing custom MORECORE
functions. The type of the argument to sbrk/MORECORE varies across
systems. It cannot be size_t, because it supports negative
arguments, so it is normally the signed type of the same width as
size_t (sometimes declared as "intptr_t"). It doesn't much matter
though. Internally, we only call it with arguments less than half
the max value of a size_t, which should work across all reasonable
possibilities, although sometimes generating compiler warnings.
MORECORE_CONTIGUOUS default: 1 (true) if HAVE_MORECORE
If true, take advantage of fact that consecutive calls to MORECORE
with positive arguments always return contiguous increasing
addresses. This is true of unix sbrk. It does not hurt too much to
set it true anyway, since malloc copes with non-contiguities.
Setting it false when definitely non-contiguous saves time
and possibly wasted space it would take to discover this though.
MORECORE_CANNOT_TRIM default: NOT defined
True if MORECORE cannot release space back to the system when given
negative arguments. This is generally necessary only if you are
using a hand-crafted MORECORE function that cannot handle negative
arguments.
NO_SEGMENT_TRAVERSAL default: 0
If non-zero, suppresses traversals of memory segments
returned by either MORECORE or CALL_MMAP. This disables
merging of segments that are contiguous, and selectively
releasing them to the OS if unused, but bounds execution times.
HAVE_MMAP default: 1 (true)
True if this system supports mmap or an emulation of it. If so, and
HAVE_MORECORE is not true, MMAP is used for all system
allocation. If set and HAVE_MORECORE is true as well, MMAP is
primarily used to directly allocate very large blocks. It is also
used as a backup strategy in cases where MORECORE fails to provide
space from system. Note: A single call to MUNMAP is assumed to be
able to unmap memory that may have be allocated using multiple calls
to MMAP, so long as they are adjacent.
HAVE_MREMAP default: 1 on linux, else 0
If true realloc() uses mremap() to re-allocate large blocks and
extend or shrink allocation spaces.
MMAP_CLEARS default: 1 except on WINCE.
True if mmap clears memory so calloc doesn't need to. This is true
for standard unix mmap using /dev/zero and on WIN32 except for WINCE.
USE_BUILTIN_FFS default: 0 (i.e., not used)
Causes malloc to use the builtin ffs() function to compute indices.
Some compilers may recognize and intrinsify ffs to be faster than the
supplied C version. Also, the case of x86 using gcc is special-cased
to an asm instruction, so is already as fast as it can be, and so
this setting has no effect. Similarly for Win32 under recent MS compilers.
(On most x86s, the asm version is only slightly faster than the C version.)
malloc_getpagesize default: derive from system includes, or 4096.
The system page size. To the extent possible, this malloc manages
memory from the system in page-size units. This may be (and
usually is) a function rather than a constant. This is ignored
if WIN32, where page size is determined using getSystemInfo during
initialization.
USE_DEV_RANDOM default: 0 (i.e., not used)
Causes malloc to use /dev/random to initialize secure magic seed for
stamping footers. Otherwise, the current time is used.
NO_MALLINFO default: 0
If defined, don't compile "mallinfo". This can be a simple way
of dealing with mismatches between system declarations and
those in this file.
MALLINFO_FIELD_TYPE default: size_t
The type of the fields in the mallinfo struct. This was originally
defined as "int" in SVID etc, but is more usefully defined as
size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set
NO_MALLOC_STATS default: 0
If defined, don't compile "malloc_stats". This avoids calls to
fprintf and bringing in stdio dependencies you might not want.
REALLOC_ZERO_BYTES_FREES default: not defined
This should be set if a call to realloc with zero bytes should
be the same as a call to free. Some people think it should. Otherwise,
since this malloc returns a unique pointer for malloc(0), so does
realloc(p, 0).
LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H
LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H
LACKS_STDLIB_H LACKS_SCHED_H LACKS_TIME_H default: NOT defined unless on WIN32
Define these if your system does not have these header files.
You might need to manually insert some of the declarations they provide.
DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS,
system_info.dwAllocationGranularity in WIN32,
otherwise 64K.
Also settable using mallopt(M_GRANULARITY, x)
The unit for allocating and deallocating memory from the system. On
most systems with contiguous MORECORE, there is no reason to
make this more than a page. However, systems with MMAP tend to
either require or encourage larger granularities. You can increase
this value to prevent system allocation functions to be called so
often, especially if they are slow. The value must be at least one
page and must be a power of two. Setting to 0 causes initialization
to either page size or win32 region size. (Note: In previous
versions of malloc, the equivalent of this option was called
"TOP_PAD")
DEFAULT_TRIM_THRESHOLD default: 2MB
Also settable using mallopt(M_TRIM_THRESHOLD, x)
The maximum amount of unused top-most memory to keep before
releasing via malloc_trim in free(). Automatic trimming is mainly
useful in long-lived programs using contiguous MORECORE. Because
trimming via sbrk can be slow on some systems, and can sometimes be
wasteful (in cases where programs immediately afterward allocate
more large chunks) the value should be high enough so that your
overall system performance would improve by releasing this much
memory. As a rough guide, you might set to a value close to the
average size of a process (program) running on your system.
Releasing this much memory would allow such a process to run in
memory. Generally, it is worth tuning trim thresholds when a
program undergoes phases where several large chunks are allocated
and released in ways that can reuse each other's storage, perhaps
mixed with phases where there are no such chunks at all. The trim
value must be greater than page size to have any useful effect. To
disable trimming completely, you can set to MAX_SIZE_T. Note that the trick
some people use of mallocing a huge space and then freeing it at
program startup, in an attempt to reserve system memory, doesn't
have the intended effect under automatic trimming, since that memory
will immediately be returned to the system.
DEFAULT_MMAP_THRESHOLD default: 256K
Also settable using mallopt(M_MMAP_THRESHOLD, x)
The request size threshold for using MMAP to directly service a
request. Requests of at least this size that cannot be allocated
using already-existing space will be serviced via mmap. (If enough
normal freed space already exists it is used instead.) Using mmap
segregates relatively large chunks of memory so that they can be
individually obtained and released from the host system. A request
serviced through mmap is never reused by any other request (at least
not directly; the system may just so happen to remap successive
requests to the same locations). Segregating space in this way has
the benefits that: Mmapped space can always be individually released
back to the system, which helps keep the system level memory demands
of a long-lived program low. Also, mapped memory doesn't become
`locked' between other chunks, as can happen with normally allocated
chunks, which means that even trimming via malloc_trim would not
release them. However, it has the disadvantage that the space
cannot be reclaimed, consolidated, and then used to service later
requests, as happens with normal chunks. The advantages of mmap
nearly always outweigh disadvantages for "large" chunks, but the
value of "large" may vary across systems. The default is an
empirically derived value that works well in most systems. You can
disable mmap by setting to MAX_SIZE_T.
MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
The number of consolidated frees between checks to release
unused segments when freeing. When using non-contiguous segments,
especially with multiple mspaces, checking only for topmost space
doesn't always suffice to trigger trimming. To compensate for this,
free() will, with a period of MAX_RELEASE_CHECK_RATE (or the
current number of segments, if greater) try to release unused
segments to the OS when freeing chunks that result in
consolidation. The best value for this parameter is a compromise
between slowing down frees with relatively costly checks that
rarely trigger versus holding on to unused memory. To effectively
disable, set to MAX_SIZE_T. This may lead to a very slight speed
improvement at the expense of carrying around more memory.
Guidelines for creating a custom version of MORECORE:
* For best performance, MORECORE should allocate in multiples of pagesize.
* MORECORE may allocate more memory than requested. (Or even less,
but this will usually result in a malloc failure.)
* MORECORE must not allocate memory when given argument zero, but
instead return one past the end address of memory from previous
nonzero call.
* For best performance, consecutive calls to MORECORE with positive
arguments should return increasing addresses, indicating that
space has been contiguously extended.
* Even though consecutive calls to MORECORE need not return contiguous
addresses, it must be OK for malloc'ed chunks to span multiple
regions in those cases where they do happen to be contiguous.
* MORECORE need not handle negative arguments -- it may instead
just return MFAIL when given negative arguments.
Negative arguments are always multiples of pagesize. MORECORE
must not misinterpret negative args as large positive unsigned
args. You can suppress all such calls from even occurring by defining
MORECORE_CANNOT_TRIM,
As an example alternative MORECORE, here is a custom allocator
kindly contributed for pre-OSX macOS. It uses virtually but not
necessarily physically contiguous non-paged memory (locked in,
present and won't get swapped out). You can use it by uncommenting
this section, adding some #includes, and setting up the appropriate
defines above:
#define MORECORE osMoreCore
There is also a shutdown routine that should somehow be called for
cleanup upon program exit.
#define MAX_POOL_ENTRIES 100
#define MINIMUM_MORECORE_SIZE (64 * 1024U)
static int next_os_pool;
void *our_os_pools[MAX_POOL_ENTRIES];
void *osMoreCore(int size)
{
void *ptr = 0;
static void *sbrk_top = 0;
if (size > 0)
{
if (size < MINIMUM_MORECORE_SIZE)
size = MINIMUM_MORECORE_SIZE;
if (CurrentExecutionLevel() == kTaskLevel)
ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0);
if (ptr == 0)
{
return (void *) MFAIL;
}
// save ptrs so they can be freed during cleanup
our_os_pools[next_os_pool] = ptr;
next_os_pool++;
ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK);
sbrk_top = (char *) ptr + size;
return ptr;
}
else if (size < 0)
{
// we don't currently support shrink behavior
return (void *) MFAIL;
}
else
{
return sbrk_top;
}
}
// cleanup any allocated memory pools
// called as last thing before shutting down driver
void osCleanupMem(void)
{
void **ptr;
for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++)
if (*ptr)
{
PoolDeallocate(*ptr);
*ptr = 0;
}
}
*/
/* -----------------------------------------------------------------------
History:
v2.8.6 Wed Aug 29 06:57:58 2012 Doug Lea
* fix bad comparison in dlposix_memalign
* don't reuse adjusted asize in sys_alloc
* add LOCK_AT_FORK -- thanks to Kirill Artamonov for the suggestion
* reduce compiler warnings -- thanks to all who reported/suggested these
v2.8.5 Sun May 22 10:26:02 2011 Doug Lea (dl at gee)
* Always perform unlink checks unless INSECURE
* Add posix_memalign.
* Improve realloc to expand in more cases; expose realloc_in_place.
Thanks to Peter Buhr for the suggestion.
* Add footprint_limit, inspect_all, bulk_free. Thanks
to Barry Hayes and others for the suggestions.
* Internal refactorings to avoid calls while holding locks
* Use non-reentrant locks by default. Thanks to Roland McGrath
for the suggestion.
* Small fixes to mspace_destroy, reset_on_error.
* Various configuration extensions/changes. Thanks
to all who contributed these.
V2.8.4a Thu Apr 28 14:39:43 2011 (dl at gee.cs.oswego.edu)
* Update Creative Commons URL
V2.8.4 Wed May 27 09:56:23 2009 Doug Lea (dl at gee)
* Use zeros instead of prev foot for is_mmapped
* Add mspace_track_large_chunks; thanks to Jean Brouwers
* Fix set_inuse in internal_realloc; thanks to Jean Brouwers
* Fix insufficient sys_alloc padding when using 16byte alignment
* Fix bad error check in mspace_footprint
* Adaptations for ptmalloc; thanks to Wolfram Gloger.
* Reentrant spin locks; thanks to Earl Chew and others
* Win32 improvements; thanks to Niall Douglas and Earl Chew
* Add NO_SEGMENT_TRAVERSAL and MAX_RELEASE_CHECK_RATE options
* Extension hook in malloc_state
* Various small adjustments to reduce warnings on some compilers
* Various configuration extensions/changes for more platforms. Thanks
to all who contributed these.
V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee)
* Add max_footprint functions
* Ensure all appropriate literals are size_t
* Fix conditional compilation problem for some #define settings
* Avoid concatenating segments with the one provided
in create_mspace_with_base
* Rename some variables to avoid compiler shadowing warnings
* Use explicit lock initialization.
* Better handling of sbrk interference.
* Simplify and fix segment insertion, trimming and mspace_destroy
* Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x
* Thanks especially to Dennis Flanagan for help on these.
V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee)
* Fix memalign brace error.
V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee)
* Fix improper #endif nesting in C++
* Add explicit casts needed for C++
V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee)
* Use trees for large bins
* Support mspaces
* Use segments to unify sbrk-based and mmap-based system allocation,
removing need for emulation on most platforms without sbrk.
* Default safety checks
* Optional footer checks. Thanks to William Robertson for the idea.
* Internal code refactoring
* Incorporate suggestions and platform-specific changes.
Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas,
Aaron Bachmann, Emery Berger, and others.
* Speed up non-fastbin processing enough to remove fastbins.
* Remove useless cfree() to avoid conflicts with other apps.
* Remove internal memcpy, memset. Compilers handle builtins better.
* Remove some options that no one ever used and rename others.
V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee)
* Fix malloc_state bitmap array misdeclaration
V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee)
* Allow tuning of FIRST_SORTED_BIN_SIZE
* Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte.
* Better detection and support for non-contiguousness of MORECORE.
Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger
* Bypass most of malloc if no frees. Thanks To Emery Berger.
* Fix freeing of old top non-contiguous chunk im sysmalloc.
* Raised default trim and map thresholds to 256K.
* Fix mmap-related #defines. Thanks to Lubos Lunak.
* Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield.
* Branch-free bin calculation
* Default trim and mmap thresholds now 256K.
V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee)
* Introduce independent_comalloc and independent_calloc.
Thanks to Michael Pachos for motivation and help.
* Make optional .h file available
* Allow > 2GB requests on 32bit systems.
* new WIN32 sbrk, mmap, munmap, lock code from <[email protected]>.
Thanks also to Andreas Mueller <a.mueller at paradatec.de>,
and Anonymous.
* Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for
helping test this.)
* memalign: check alignment arg
* realloc: don't try to shift chunks backwards, since this
leads to more fragmentation in some programs and doesn't
seem to help in any others.
* Collect all cases in malloc requiring system memory into sysmalloc
* Use mmap as backup to sbrk
* Place all internal state in malloc_state
* Introduce fastbins (although similar to 2.5.1)
* Many minor tunings and cosmetic improvements
* Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK
* Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS
Thanks to Tony E. Bennett <[email protected]> and others.
* Include errno.h to support default failure action.
V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee)
* return null for negative arguments
* Added Several WIN32 cleanups from Martin C. Fong <mcfong at yahoo.com>
* Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h'
(e.g. WIN32 platforms)
* Cleanup header file inclusion for WIN32 platforms
* Cleanup code to avoid Microsoft Visual C++ compiler complaints
* Add 'USE_DL_PREFIX' to quickly allow co-existence with existing
memory allocation routines
* Set 'malloc_getpagesize' for WIN32 platforms (needs more work)
* Use 'assert' rather than 'ASSERT' in WIN32 code to conform to
usage of 'assert' in non-WIN32 code
* Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to
avoid infinite loop
* Always call 'fREe()' rather than 'free()'
V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee)
* Fixed ordering problem with boundary-stamping
V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee)
* Added pvalloc, as recommended by H.J. Liu
* Added 64bit pointer support mainly from Wolfram Gloger
* Added anonymously donated WIN32 sbrk emulation
* Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen
* malloc_extend_top: fix mask error that caused wastage after
foreign sbrks
* Add linux mremap support code from HJ Liu
V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee)
* Integrated most documentation with the code.
* Add support for mmap, with help from
Wolfram Gloger ([email protected]).
* Use last_remainder in more cases.
* Pack bins using idea from [email protected]
* Use ordered bins instead of best-fit threshhold
* Eliminate block-local decls to simplify tracing and debugging.
* Support another case of realloc via move into top
* Fix error occuring when initial sbrk_base not word-aligned.
* Rely on page size for units instead of SBRK_UNIT to
avoid surprises about sbrk alignment conventions.
* Add mallinfo, mallopt. Thanks to Raymond Nijssen
([email protected]) for the suggestion.
* Add `pad' argument to malloc_trim and top_pad mallopt parameter.
* More precautions for cases where other routines call sbrk,
courtesy of Wolfram Gloger ([email protected]).
* Added macros etc., allowing use in linux libc from
H.J. Lu ([email protected])
* Inverted this history list
V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee)
* Re-tuned and fixed to behave more nicely with V2.6.0 changes.
* Removed all preallocation code since under current scheme
the work required to undo bad preallocations exceeds
the work saved in good cases for most test programs.
* No longer use return list or unconsolidated bins since
no scheme using them consistently outperforms those that don't
given above changes.
* Use best fit for very large chunks to prevent some worst-cases.
* Added some support for debugging
V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee)
* Removed footers when chunks are in use. Thanks to
Paul Wilson ([email protected]) for the suggestion.
V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee)
* Added malloc_trim, with help from Wolfram Gloger
([email protected]).
V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g)
V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g)
* realloc: try to expand in both directions
* malloc: swap order of clean-bin strategy;
* realloc: only conditionally expand backwards
* Try not to scavenge used bins
* Use bin counts as a guide to preallocation
* Occasionally bin return list chunks in first scan
* Add a few optimizations from [email protected]
V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g)
* faster bin computation & slightly different binning
* merged all consolidations to one part of malloc proper
(eliminating old malloc_find_space & malloc_clean_bin)
* Scan 2 returns chunks (not just 1)
* Propagate failure in realloc if malloc returns 0
* Add stuff to allow compilation on non-ANSI compilers
from [email protected]
V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu)
* removed potential for odd address access in prev_chunk
* removed dependency on getpagesize.h
* misc cosmetics and a bit more internal documentation
* anticosmetics: mangled names in macros to evade debugger strangeness
* tested on sparc, hp-700, dec-mips, rs6000
with gcc & native cc (hp, dec only) allowing
Detlefs & Zorn comparison study (in SIGPLAN Notices.)
Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu)
* Based loosely on libg++-1.2X malloc. (It retains some of the overall
structure of old version, but most details differ.)
| 61,750 | 1,192 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/trees.inc | // clang-format off
/* ------------------------- Operations on trees ------------------------- */
/* Insert chunk into tree */
#define insert_large_chunk(M, X, S) {\
tbinptr* H;\
bindex_t I;\
compute_tree_index(S, I);\
H = treebin_at(M, I);\
X->index = I;\
X->child[0] = X->child[1] = 0;\
if (!treemap_is_marked(M, I)) {\
mark_treemap(M, I);\
*H = X;\
X->parent = (tchunkptr)H;\
X->fd = X->bk = X;\
}\
else {\
tchunkptr T = *H;\
size_t K = S << leftshift_for_tree_index(I);\
for (;;) {\
if (chunksize(T) != S) {\
tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\
K <<= 1;\
if (*C != 0)\
T = *C;\
else if (RTCHECK(ok_address(M, C))) {\
*C = X;\
X->parent = T;\
X->fd = X->bk = X;\
break;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
break;\
}\
}\
else {\
tchunkptr F = T->fd;\
if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\
T->fd = F->bk = X;\
X->fd = F;\
X->bk = T;\
X->parent = 0;\
break;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
break;\
}\
}\
}\
}\
}
/*
Unlink steps:
1. If x is a chained node, unlink it from its same-sized fd/bk links
and choose its bk node as its replacement.
2. If x was the last node of its size, but not a leaf node, it must
be replaced with a leaf node (not merely one with an open left or
right), to make sure that lefts and rights of descendents
correspond properly to bit masks. We use the rightmost descendent
of x. We could use any other leaf, but this is easy to locate and
tends to counteract removal of leftmosts elsewhere, and so keeps
paths shorter than minimally guaranteed. This doesn't loop much
because on average a node in a tree is near the bottom.
3. If x is the base of a chain (i.e., has parent links) relink
x's parent and children to x's replacement (or null if none).
*/
#define unlink_large_chunk(M, X) {\
tchunkptr XP = X->parent;\
tchunkptr R;\
if (X->bk != X) {\
tchunkptr F = X->fd;\
R = X->bk;\
if (RTCHECK(ok_address(M, F) && F->bk == X && R->fd == X)) {\
F->bk = R;\
R->fd = F;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
else {\
tchunkptr* RP;\
if (((R = *(RP = &(X->child[1]))) != 0) ||\
((R = *(RP = &(X->child[0]))) != 0)) {\
tchunkptr* CP;\
while ((*(CP = &(R->child[1])) != 0) ||\
(*(CP = &(R->child[0])) != 0)) {\
R = *(RP = CP);\
}\
if (RTCHECK(ok_address(M, RP)))\
*RP = 0;\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
}\
if (XP != 0) {\
tbinptr* H = treebin_at(M, X->index);\
if (X == *H) {\
if ((*H = R) == 0) \
clear_treemap(M, X->index);\
}\
else if (RTCHECK(ok_address(M, XP))) {\
if (XP->child[0] == X) \
XP->child[0] = R;\
else \
XP->child[1] = R;\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
if (R != 0) {\
if (RTCHECK(ok_address(M, R))) {\
tchunkptr C0, C1;\
R->parent = XP;\
if ((C0 = X->child[0]) != 0) {\
if (RTCHECK(ok_address(M, C0))) {\
R->child[0] = C0;\
C0->parent = R;\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
}\
if ((C1 = X->child[1]) != 0) {\
if (RTCHECK(ok_address(M, C1))) {\
R->child[1] = C1;\
C1->parent = R;\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
}
/* Relays to large vs small bin operations */
#define insert_chunk(M, P, S)\
if (is_small(S)) insert_small_chunk(M, P, S)\
else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); }
#define unlink_chunk(M, P, S)\
if (is_small(S)) unlink_small_chunk(M, P, S)\
else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); }
/* Relays to internal calls to malloc/free from realloc, memalign etc */
#if ONLY_MSPACES
#define internal_malloc(m, b) mspace_malloc(m, b)
#define internal_free(m, mem) mspace_free(m,mem);
#else /* ONLY_MSPACES */
#if MSPACES
#define internal_malloc(m, b)\
((m == gm)? dlmalloc(b) : mspace_malloc(m, b))
#define internal_free(m, mem)\
if (m == gm) dlfree(mem); else mspace_free(m,mem);
#else /* MSPACES */
#define internal_malloc(m, b) dlmalloc(b)
#define internal_free(m, mem) dlfree(mem)
#endif /* MSPACES */
#endif /* ONLY_MSPACES */
| 4,706 | 172 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/indexing.inc | // clang-format off
/* ---------------------------- Indexing Bins ---------------------------- */
#define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS)
#define small_index(s) (bindex_t)((s) >> SMALLBIN_SHIFT)
#define small_index2size(i) ((i) << SMALLBIN_SHIFT)
#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE))
/* addressing by index. See above about smallbin repositioning */
#define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1])))
#define treebin_at(M,i) (&((M)->treebins[i]))
/* assign tree index for size S to variable I. Use x86 asm if possible */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define compute_tree_index(S, I)\
{\
unsigned int X = S >> TREEBIN_SHIFT;\
if (X == 0)\
I = 0;\
else if (X > 0xFFFF)\
I = NTREEBINS-1;\
else {\
unsigned int K = (unsigned) sizeof(X)*__CHAR_BIT__ - 1 - (unsigned) __builtin_clz(X); \
I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
}\
}
#elif defined (__INTEL_COMPILER)
#define compute_tree_index(S, I)\
{\
size_t X = S >> TREEBIN_SHIFT;\
if (X == 0)\
I = 0;\
else if (X > 0xFFFF)\
I = NTREEBINS-1;\
else {\
unsigned int K = _bit_scan_reverse (X); \
I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
}\
}
#elif defined(_MSC_VER) && _MSC_VER>=1300
#define compute_tree_index(S, I)\
{\
size_t X = S >> TREEBIN_SHIFT;\
if (X == 0)\
I = 0;\
else if (X > 0xFFFF)\
I = NTREEBINS-1;\
else {\
unsigned int K;\
_BitScanReverse((DWORD *) &K, (DWORD) X);\
I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
}\
}
#else /* GNUC */
#define compute_tree_index(S, I)\
{\
size_t X = S >> TREEBIN_SHIFT;\
if (X == 0)\
I = 0;\
else if (X > 0xFFFF)\
I = NTREEBINS-1;\
else {\
unsigned int Y = (unsigned int)X;\
unsigned int N = ((Y - 0x100) >> 16) & 8;\
unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\
N += K;\
N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\
K = 14 - N + ((Y <<= K) >> 15);\
I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\
}\
}
#endif /* GNUC */
/* Bit representing maximum resolved size in a treebin at i */
#define bit_for_tree_index(i) \
(i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2)
/* Shift placing maximum resolved bit in a treebin at i as sign bit */
#define leftshift_for_tree_index(i) \
((i == NTREEBINS-1)? 0 : \
((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2)))
/* The size of the smallest chunk held in bin with index i */
#define minsize_for_tree_index(i) \
((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \
(((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1)))
| 2,764 | 92 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/hooks.inc | // clang-format off
/* ------------------------------- Hooks -------------------------------- */
/*
PREACTION should be defined to return 0 on success, and nonzero on
failure. If you are not using locking, you can redefine these to do
anything you like.
*/
#if USE_LOCKS
#define PREACTION(M) ((use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0)
#define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); }
#else /* USE_LOCKS */
#ifndef PREACTION
#define PREACTION(M) (0)
#endif /* PREACTION */
#ifndef POSTACTION
#define POSTACTION(M)
#endif /* POSTACTION */
#endif /* USE_LOCKS */
/*
CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses.
USAGE_ERROR_ACTION is triggered on detected bad frees and
reallocs. The argument p is an address that might have triggered the
fault. It is ignored by the two predefined actions, but might be
useful in custom actions that try to help diagnose errors.
*/
#if PROCEED_ON_ERROR
/* A count of the number of corruption errors causing resets */
int malloc_corruption_error_count;
/* default corruption action */
static void reset_on_error(mstate m);
#define CORRUPTION_ERROR_ACTION(m) reset_on_error(m)
#define USAGE_ERROR_ACTION(m, p)
#else /* PROCEED_ON_ERROR */
#ifndef CORRUPTION_ERROR_ACTION
#define CORRUPTION_ERROR_ACTION(m) ABORT
#endif /* CORRUPTION_ERROR_ACTION */
#ifndef USAGE_ERROR_ACTION
#define USAGE_ERROR_ACTION(m,p) ABORT
#endif /* USAGE_ERROR_ACTION */
#endif /* PROCEED_ON_ERROR */
| 1,487 | 57 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/vespene.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¡
â Copyright 2022 Justine Alexandra Roberts Tunney â
â â
â Permission to use, copy, modify, and/or distribute this software for â
â any purpose with or without fee is hereby granted, provided that the â
â above copyright notice and this permission notice appear in all copies. â
â â
â THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL â
â WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED â
â WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE â
â AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL â
â DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR â
â PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER â
â TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR â
â PERFORMANCE OF THIS SOFTWARE. â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/asancodes.h"
#include "libc/runtime/runtime.h"
#include "third_party/dlmalloc/vespene.internal.h"
/**
* Acquires more system memory for dlmalloc.
* @return memory map address on success, or null w/ errno
*/
void *dlmalloc_requires_more_vespene_gas(size_t size) {
char *p;
if ((p = _mapanon(size))) {
if (IsAsan()) {
__asan_poison(p, size, kAsanHeapFree);
}
}
return p;
}
| 2,316 | 38 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/vespene.internal.h | #ifndef COSMOPOLITAN_THIRD_PARTY_DLMALLOC_VESPENE_INTERNAL_H_
#define COSMOPOLITAN_THIRD_PARTY_DLMALLOC_VESPENE_INTERNAL_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void *dlmalloc_requires_more_vespene_gas(size_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_THIRD_PARTY_DLMALLOC_VESPENE_INTERNAL_H_ */
| 370 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/dlmalloc.mk | #-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-â
#âââvi: set et ft=make ts=8 tw=8 fenc=utf-8 :viââââââââââââââââââââââââ
PKGS += THIRD_PARTY_DLMALLOC
THIRD_PARTY_DLMALLOC_ARTIFACTS += THIRD_PARTY_DLMALLOC_A
THIRD_PARTY_DLMALLOC = $(THIRD_PARTY_DLMALLOC_A_DEPS) $(THIRD_PARTY_DLMALLOC_A)
THIRD_PARTY_DLMALLOC_A = o/$(MODE)/third_party/dlmalloc/dlmalloc.a
THIRD_PARTY_DLMALLOC_A_FILES := $(wildcard third_party/dlmalloc/*)
THIRD_PARTY_DLMALLOC_A_HDRS = $(filter %.h,$(THIRD_PARTY_DLMALLOC_A_FILES))
THIRD_PARTY_DLMALLOC_A_INCS = $(filter %.inc,$(THIRD_PARTY_DLMALLOC_A_FILES))
THIRD_PARTY_DLMALLOC_A_SRCS = $(filter %.c,$(THIRD_PARTY_DLMALLOC_A_FILES))
THIRD_PARTY_DLMALLOC_A_OBJS = $(THIRD_PARTY_DLMALLOC_A_SRCS:%.c=o/$(MODE)/%.o)
THIRD_PARTY_DLMALLOC_A_CHECKS = \
$(THIRD_PARTY_DLMALLOC_A).pkg \
$(THIRD_PARTY_DLMALLOC_A_HDRS:%=o/$(MODE)/%.ok)
THIRD_PARTY_DLMALLOC_A_DIRECTDEPS = \
LIBC_CALLS \
LIBC_INTRIN \
LIBC_FMT \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STR \
LIBC_STUBS \
LIBC_SYSV \
LIBC_SYSV_CALLS \
THIRD_PARTY_COMPILER_RT \
THIRD_PARTY_NSYNC
THIRD_PARTY_DLMALLOC_A_DEPS := \
$(call uniq,$(foreach x,$(THIRD_PARTY_DLMALLOC_A_DIRECTDEPS),$($(x))))
$(THIRD_PARTY_DLMALLOC_A): \
third_party/dlmalloc/ \
$(THIRD_PARTY_DLMALLOC_A).pkg \
$(THIRD_PARTY_DLMALLOC_A_OBJS)
$(THIRD_PARTY_DLMALLOC_A).pkg: \
$(THIRD_PARTY_DLMALLOC_A_OBJS) \
$(foreach x,$(THIRD_PARTY_DLMALLOC_A_DIRECTDEPS),$($(x)_A).pkg)
ifneq ($(MODE),tiny)
ifneq ($(MODE),tinylinux)
# README file recommends -O3
# It does double performance in default mode
o/$(MODE)/third_party/dlmalloc/dlmalloc.o: private \
OVERRIDE_CFLAGS += \
-O3
endif
endif
# we can't use address sanitizer because:
# address sanitizer depends on dlmalloc
o/$(MODE)/third_party/dlmalloc/dlmalloc.o: private \
OVERRIDE_CFLAGS += \
-ffreestanding \
-fno-sanitize=address
# we must segregate codegen because:
# file contains multiple independently linkable apis
o/$(MODE)/third_party/dlmalloc/dlmalloc.o: private \
OVERRIDE_CFLAGS += \
-ffunction-sections \
-fdata-sections
THIRD_PARTY_DLMALLOC_LIBS = $(foreach x,$(THIRD_PARTY_DLMALLOC_ARTIFACTS),$($(x)))
THIRD_PARTY_DLMALLOC_SRCS = $(foreach x,$(THIRD_PARTY_DLMALLOC_ARTIFACTS),$($(x)_SRCS))
THIRD_PARTY_DLMALLOC_HDRS = $(foreach x,$(THIRD_PARTY_DLMALLOC_ARTIFACTS),$($(x)_HDRS))
THIRD_PARTY_DLMALLOC_INCS = $(foreach x,$(THIRD_PARTY_DLMALLOC_ARTIFACTS),$($(x)_INCS))
THIRD_PARTY_DLMALLOC_BINS = $(foreach x,$(THIRD_PARTY_DLMALLOC_ARTIFACTS),$($(x)_BINS))
THIRD_PARTY_DLMALLOC_CHECKS = $(foreach x,$(THIRD_PARTY_DLMALLOC_ARTIFACTS),$($(x)_CHECKS))
THIRD_PARTY_DLMALLOC_OBJS = $(foreach x,$(THIRD_PARTY_DLMALLOC_ARTIFACTS),$($(x)_OBJS))
THIRD_PARTY_DLMALLOC_TESTS = $(foreach x,$(THIRD_PARTY_DLMALLOC_ARTIFACTS),$($(x)_TESTS))
$(THIRD_PARTY_DLMALLOC_OBJS): $(BUILD_FILES) third_party/dlmalloc/dlmalloc.mk
.PHONY: o/$(MODE)/third_party/dlmalloc
o/$(MODE)/third_party/dlmalloc: $(THIRD_PARTY_DLMALLOC_CHECKS)
| 3,128 | 80 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/mspaces.inc | #include "third_party/dlmalloc/dlmalloc.h"
// clang-format off
static mstate init_user_mstate(char* tbase, size_t tsize) {
size_t msize = pad_request(sizeof(struct malloc_state));
mchunkptr mn;
mchunkptr msp = align_as_chunk(tbase);
mstate m = (mstate)(chunk2mem(msp));
bzero(m, msize);
(void)INITIAL_LOCK(&m->mutex);
msp->head = (msize|INUSE_BITS);
m->seg.base = m->least_addr = tbase;
m->seg.size = m->footprint = m->max_footprint = tsize;
m->magic = mparams.magic;
m->release_checks = MAX_RELEASE_CHECK_RATE;
m->mflags = mparams.default_mflags;
m->extp = 0;
m->exts = 0;
disable_contiguous(m);
init_bins(m);
mn = next_chunk(mem2chunk(m));
init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE);
check_top_chunk(m, m->top);
return m;
}
mspace create_mspace(size_t capacity, int locked) {
mstate m = 0;
size_t msize;
ensure_initialization();
msize = pad_request(sizeof(struct malloc_state));
if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) {
size_t rs = ((capacity == 0)? mparams.granularity :
(capacity + TOP_FOOT_SIZE + msize));
size_t tsize = granularity_align(rs);
char* tbase = (char*)(dlmalloc_requires_more_vespene_gas(tsize));
if (tbase != CMFAIL) {
m = init_user_mstate(tbase, tsize);
m->seg.sflags = USE_MMAP_BIT;
set_lock(m, locked);
}
}
return (mspace)m;
}
mspace create_mspace_with_base(void* base, size_t capacity, int locked) {
mstate m = 0;
size_t msize;
ensure_initialization();
msize = pad_request(sizeof(struct malloc_state));
if (capacity > msize + TOP_FOOT_SIZE &&
capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) {
m = init_user_mstate((char*)base, capacity);
m->seg.sflags = EXTERN_BIT;
set_lock(m, locked);
}
return (mspace)m;
}
int mspace_track_large_chunks(mspace msp, int enable) {
int ret = 0;
mstate ms = (mstate)msp;
if (!PREACTION(ms)) {
if (!use_mmap(ms)) {
ret = 1;
}
if (!enable) {
enable_mmap(ms);
} else {
disable_mmap(ms);
}
POSTACTION(ms);
}
return ret;
}
size_t destroy_mspace(mspace msp) {
size_t freed = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
msegmentptr sp = &ms->seg;
(void)DESTROY_LOCK(&ms->mutex); /* destroy before unmapped */
while (sp != 0) {
char* base = sp->base;
size_t size = sp->size;
flag_t flag = sp->sflags;
(void)base; /* placate people compiling -Wunused-variable */
sp = sp->next;
if ((flag & USE_MMAP_BIT) && !(flag & EXTERN_BIT) &&
CALL_MUNMAP(base, size) == 0)
freed += size;
}
}
else {
USAGE_ERROR_ACTION(ms,ms);
}
return freed;
}
/*
mspace versions of routines are near-clones of the global
versions. This is not so nice but better than the alternatives.
*/
void* mspace_malloc(mspace msp, size_t bytes) {
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms,ms);
return 0;
}
if (!PREACTION(ms)) {
void* mem;
size_t nb;
if (bytes <= MAX_SMALL_REQUEST) {
bindex_t idx;
binmap_t smallbits;
nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes);
idx = small_index(nb);
smallbits = ms->smallmap >> idx;
if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
mchunkptr b, p;
idx += ~smallbits & 1; /* Uses next bin if idx empty */
b = smallbin_at(ms, idx);
p = b->fd;
assert(chunksize(p) == small_index2size(idx));
unlink_first_small_chunk(ms, b, p, idx);
set_inuse_and_pinuse(ms, p, small_index2size(idx));
mem = chunk2mem(p);
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
else if (nb > ms->dvsize) {
if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
mchunkptr b, p, r;
size_t rsize;
bindex_t i;
binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx));
binmap_t leastbit = least_bit(leftbits);
compute_bit2idx(leastbit, i);
b = smallbin_at(ms, i);
p = b->fd;
assert(chunksize(p) == small_index2size(i));
unlink_first_small_chunk(ms, b, p, i);
rsize = small_index2size(i) - nb;
/* Fit here cannot be remainderless if 4byte sizes */
if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
set_inuse_and_pinuse(ms, p, small_index2size(i));
else {
set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
r = chunk_plus_offset(p, nb);
set_size_and_pinuse_of_free_chunk(r, rsize);
replace_dv(ms, r, rsize);
}
mem = chunk2mem(p);
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) {
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
}
}
else if (bytes >= MAX_REQUEST)
nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
else {
nb = pad_request(bytes);
if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) {
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
}
if (nb <= ms->dvsize) {
size_t rsize = ms->dvsize - nb;
mchunkptr p = ms->dv;
if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
mchunkptr r = ms->dv = chunk_plus_offset(p, nb);
ms->dvsize = rsize;
set_size_and_pinuse_of_free_chunk(r, rsize);
set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
}
else { /* exhaust dv */
size_t dvs = ms->dvsize;
ms->dvsize = 0;
ms->dv = 0;
set_inuse_and_pinuse(ms, p, dvs);
}
mem = chunk2mem(p);
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
else if (nb < ms->topsize) { /* Split top */
size_t rsize = ms->topsize -= nb;
mchunkptr p = ms->top;
mchunkptr r = ms->top = chunk_plus_offset(p, nb);
r->head = rsize | PINUSE_BIT;
set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
mem = chunk2mem(p);
check_top_chunk(ms, ms->top);
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
mem = sys_alloc(ms, nb);
POSTACTION(ms);
if (mem == MAP_FAILED && _weaken(__oom_hook)) {
_weaken(__oom_hook)(bytes);
}
return mem;
postaction:
POSTACTION(ms);
return mem;
}
return 0;
}
void mspace_free(mspace msp, void* mem) {
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
#if FOOTERS
mstate fm = get_mstate_for(p);
(void)msp; /* placate people compiling -Wunused */
#else /* FOOTERS */
mstate fm = (mstate)msp;
#endif /* FOOTERS */
if (!ok_magic(fm)) {
USAGE_ERROR_ACTION(fm, p);
return;
}
if (!PREACTION(fm)) {
check_inuse_chunk(fm, p);
if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) {
size_t psize = chunksize(p);
mchunkptr next = chunk_plus_offset(p, psize);
if (!pinuse(p)) {
size_t prevsize = p->prev_foot;
if (is_mmapped(p)) {
psize += prevsize + MMAP_FOOT_PAD;
if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
fm->footprint -= psize;
goto postaction;
}
else {
mchunkptr prev = chunk_minus_offset(p, prevsize);
psize += prevsize;
p = prev;
if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */
if (p != fm->dv) {
unlink_chunk(fm, p, prevsize);
}
else if ((next->head & INUSE_BITS) == INUSE_BITS) {
fm->dvsize = psize;
set_free_with_pinuse(p, psize, next);
goto postaction;
}
}
else
goto erroraction;
}
}
if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) {
if (!cinuse(next)) { /* consolidate forward */
if (next == fm->top) {
size_t tsize = fm->topsize += psize;
fm->top = p;
p->head = tsize | PINUSE_BIT;
if (p == fm->dv) {
fm->dv = 0;
fm->dvsize = 0;
}
if (should_trim(fm, tsize))
sys_trim(fm, 0);
goto postaction;
}
else if (next == fm->dv) {
size_t dsize = fm->dvsize += psize;
fm->dv = p;
set_size_and_pinuse_of_free_chunk(p, dsize);
goto postaction;
}
else {
size_t nsize = chunksize(next);
psize += nsize;
unlink_chunk(fm, next, nsize);
set_size_and_pinuse_of_free_chunk(p, psize);
if (p == fm->dv) {
fm->dvsize = psize;
goto postaction;
}
}
}
else
set_free_with_pinuse(p, psize, next);
if (is_small(psize)) {
insert_small_chunk(fm, p, psize);
check_free_chunk(fm, p);
}
else {
tchunkptr tp = (tchunkptr)p;
insert_large_chunk(fm, tp, psize);
check_free_chunk(fm, p);
if (--fm->release_checks == 0)
release_unused_segments(fm);
}
goto postaction;
}
}
erroraction:
USAGE_ERROR_ACTION(fm, p);
postaction:
POSTACTION(fm);
}
}
}
void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) {
void* mem;
size_t req = 0;
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms,ms);
return 0;
}
if (n_elements != 0) {
req = n_elements * elem_size;
if (((n_elements | elem_size) & ~(size_t)0xffff) &&
(req / n_elements != elem_size))
req = MAX_SIZE_T; /* force downstream failure on overflow */
}
mem = internal_malloc(ms, req);
if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
bzero(mem, req);
return mem;
}
void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) {
void* mem = 0;
if (oldmem == 0) {
mem = mspace_malloc(msp, bytes);
}
else if (bytes >= MAX_REQUEST) {
MALLOC_FAILURE_ACTION;
}
#ifdef REALLOC_ZERO_BYTES_FREES
else if (bytes == 0) {
mspace_free(msp, oldmem);
}
#endif /* REALLOC_ZERO_BYTES_FREES */
else {
size_t nb = request2size(bytes);
mchunkptr oldp = mem2chunk(oldmem);
#if ! FOOTERS
mstate m = (mstate)msp;
#else /* FOOTERS */
mstate m = get_mstate_for(oldp);
if (!ok_magic(m)) {
USAGE_ERROR_ACTION(m, oldmem);
return 0;
}
#endif /* FOOTERS */
if (!PREACTION(m)) {
mchunkptr newp = try_realloc_chunk(m, oldp, nb, 1);
POSTACTION(m);
if (newp != 0) {
check_inuse_chunk(m, newp);
mem = chunk2mem(newp);
}
else {
mem = mspace_malloc(m, bytes);
if (mem != 0) {
size_t oc = chunksize(oldp) - overhead_for(oldp);
memcpy(mem, oldmem, (oc < bytes)? oc : bytes);
mspace_free(m, oldmem);
}
}
}
}
return mem;
}
void* mspace_realloc_in_place(mspace msp, void* oldmem, size_t bytes) {
void* mem = 0;
if (oldmem != 0) {
if (bytes >= MAX_REQUEST) {
MALLOC_FAILURE_ACTION;
}
else {
size_t nb = request2size(bytes);
mchunkptr oldp = mem2chunk(oldmem);
#if ! FOOTERS
mstate m = (mstate)msp;
#else /* FOOTERS */
mstate m = get_mstate_for(oldp);
(void)msp; /* placate people compiling -Wunused */
if (!ok_magic(m)) {
USAGE_ERROR_ACTION(m, oldmem);
return 0;
}
#endif /* FOOTERS */
if (!PREACTION(m)) {
mchunkptr newp = try_realloc_chunk(m, oldp, nb, 0);
POSTACTION(m);
if (newp == oldp) {
check_inuse_chunk(m, newp);
mem = oldmem;
}
}
}
}
return mem;
}
void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) {
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms,ms);
return 0;
}
if (alignment <= MALLOC_ALIGNMENT)
return mspace_malloc(msp, bytes);
return internal_memalign(ms, alignment, bytes);
}
void** mspace_independent_calloc(mspace msp, size_t n_elements,
size_t elem_size, void* chunks[]) {
size_t sz = elem_size; /* serves as 1-element array */
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms,ms);
return 0;
}
return ialloc(ms, n_elements, &sz, 3, chunks);
}
void** mspace_independent_comalloc(mspace msp, size_t n_elements,
size_t sizes[], void* chunks[]) {
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms,ms);
return 0;
}
return ialloc(ms, n_elements, sizes, 0, chunks);
}
size_t mspace_bulk_free(mspace msp, void* array[], size_t nelem) {
return internal_bulk_free((mstate)msp, array, nelem);
}
#if MALLOC_INSPECT_ALL
void mspace_inspect_all(mspace msp,
void(*handler)(void *start,
void *end,
size_t used_bytes,
void* callback_arg),
void* arg) {
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
if (!PREACTION(ms)) {
internal_inspect_all(ms, handler, arg);
POSTACTION(ms);
}
}
else {
USAGE_ERROR_ACTION(ms,ms);
}
}
#endif /* MALLOC_INSPECT_ALL */
int mspace_trim(mspace msp, size_t pad) {
int result = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
if (!PREACTION(ms)) {
result = sys_trim(ms, pad);
POSTACTION(ms);
}
}
else {
USAGE_ERROR_ACTION(ms,ms);
}
return result;
}
#if !NO_MALLOC_STATS
void mspace_malloc_stats(mspace msp) {
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
internal_malloc_stats(ms);
}
else {
USAGE_ERROR_ACTION(ms,ms);
}
}
#endif /* NO_MALLOC_STATS */
size_t mspace_footprint(mspace msp) {
size_t result = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
result = ms->footprint;
}
else {
USAGE_ERROR_ACTION(ms,ms);
}
return result;
}
size_t mspace_max_footprint(mspace msp) {
size_t result = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
result = ms->max_footprint;
}
else {
USAGE_ERROR_ACTION(ms,ms);
}
return result;
}
size_t mspace_footprint_limit(mspace msp) {
size_t result = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
size_t maf = ms->footprint_limit;
result = (maf == 0) ? MAX_SIZE_T : maf;
}
else {
USAGE_ERROR_ACTION(ms,ms);
}
return result;
}
size_t mspace_set_footprint_limit(mspace msp, size_t bytes) {
size_t result = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
if (bytes == 0)
result = granularity_align(1); /* Use minimal size */
if (bytes == MAX_SIZE_T)
result = 0; /* disable */
else
result = granularity_align(bytes);
ms->footprint_limit = result;
}
else {
USAGE_ERROR_ACTION(ms,ms);
}
return result;
}
#if !NO_MALLINFO
struct mallinfo mspace_mallinfo(mspace msp) {
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms,ms);
}
return internal_mallinfo(ms);
}
#endif /* NO_MALLINFO */
size_t mspace_usable_size(const void* mem) {
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
if (is_inuse(p))
return chunksize(p) - overhead_for(p);
}
return 0;
}
int mspace_mallopt(int param_number, int value) {
return change_mparam(param_number, value);
}
| 15,782 | 582 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/locks.inc | // clang-format off
#include "third_party/nsync/mu.h"
#include "libc/atomic.h"
#include "libc/intrin/atomic.h"
#include "libc/calls/calls.h"
#include "libc/thread/tls.h"
/* --------------------------- Lock preliminaries ------------------------ */
/*
When locks are defined, there is one global lock, plus
one per-mspace lock.
The global lock_ensures that mparams.magic and other unique
mparams values are initialized only once. It also protects
sequences of calls to MORECORE. In many cases sys_alloc requires
two calls, that should not be interleaved with calls by other
threads. This does not protect against direct calls to MORECORE
by other threads not using this lock, so there is still code to
cope the best we can on interference.
Per-mspace locks surround calls to malloc, free, etc.
By default, locks are simple non-reentrant mutexes.
Because lock-protected regions generally have bounded times, it is
OK to use the supplied simple spinlocks. Spinlocks are likely to
improve performance for lightly contended applications, but worsen
performance under heavy contention.
If USE_LOCKS is > 1, the definitions of lock routines here are
bypassed, in which case you will need to define the type MLOCK_T,
and at least INITIAL_LOCK, DESTROY_LOCK, ACQUIRE_LOCK, RELEASE_LOCK
and TRY_LOCK. You must also declare a
static MLOCK_T malloc_global_mutex = { initialization values };.
*/
static int malloc_lock(atomic_int *lk) {
if (!__threaded) return 0;
while (atomic_exchange_explicit(lk, 1, memory_order_acquire)) {
donothing;
}
return 0;
}
static int malloc_trylock(atomic_int *lk) {
if (!__threaded) return 1;
return !atomic_exchange_explicit(lk, 1, memory_order_acquire);
}
static inline int malloc_unlock(atomic_int *lk) {
atomic_store_explicit(lk, 0, memory_order_release);
return 0;
}
#if !USE_LOCKS
#define USE_LOCK_BIT (0U)
#define INITIAL_LOCK(l) (0)
#define DESTROY_LOCK(l) (0)
#define ACQUIRE_MALLOC_GLOBAL_LOCK()
#define RELEASE_MALLOC_GLOBAL_LOCK()
#elif defined(TINY)
#define MLOCK_T atomic_int
#define ACQUIRE_LOCK(lk) malloc_lock(lk)
#define RELEASE_LOCK(lk) malloc_unlock(lk)
#define TRY_LOCK(lk) malloc_trylock(lk)
#define INITIAL_LOCK(lk) (atomic_store_explicit(lk, 0, memory_order_relaxed), 0)
#define DESTROY_LOCK(lk)
#define ACQUIRE_MALLOC_GLOBAL_LOCK() ACQUIRE_LOCK(&malloc_global_mutex);
#define RELEASE_MALLOC_GLOBAL_LOCK() RELEASE_LOCK(&malloc_global_mutex);
static MLOCK_T malloc_global_mutex;
#else
#define MLOCK_T nsync_mu
#define ACQUIRE_LOCK(lk) (__threaded && (nsync_mu_lock(lk), 0))
#define RELEASE_LOCK(lk) (__threaded && (nsync_mu_unlock(lk), 0))
#define TRY_LOCK(lk) (__threaded ? nsync_mu_trylock(lk) : 1)
#define INITIAL_LOCK(lk) memset(lk, 0, sizeof(*lk))
#define DESTROY_LOCK(lk) memset(lk, -1, sizeof(*lk))
#define ACQUIRE_MALLOC_GLOBAL_LOCK() ACQUIRE_LOCK(&malloc_global_mutex);
#define RELEASE_MALLOC_GLOBAL_LOCK() RELEASE_LOCK(&malloc_global_mutex);
static MLOCK_T malloc_global_mutex;
#endif
#define USE_LOCK_BIT (2U)
struct malloc_chunk {
size_t prev_foot; /* Size of previous chunk (if free). */
size_t head; /* Size and inuse bits. */
struct malloc_chunk* fd; /* double links -- used only if free. */
struct malloc_chunk* bk;
};
typedef struct malloc_chunk mchunk;
typedef struct malloc_chunk* mchunkptr;
typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */
typedef unsigned int bindex_t; /* Described below */
typedef unsigned int binmap_t; /* Described below */
typedef unsigned int flag_t; /* The type of various bit flag sets */
| 3,792 | 99 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/smallbins.inc | // clang-format off
/* ----------------------- Operations on smallbins ----------------------- */
/*
Various forms of linking and unlinking are defined as macros. Even
the ones for trees, which are very long but have very short typical
paths. This is ugly but reduces reliance on inlining support of
compilers.
*/
/* Link a free chunk into a smallbin */
#define insert_small_chunk(M, P, S) {\
bindex_t I = small_index(S);\
mchunkptr B = smallbin_at(M, I);\
mchunkptr F = B;\
assert(S >= MIN_CHUNK_SIZE);\
if (!smallmap_is_marked(M, I))\
mark_smallmap(M, I);\
else if (RTCHECK(ok_address(M, B->fd)))\
F = B->fd;\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
B->fd = P;\
F->bk = P;\
P->fd = F;\
P->bk = B;\
}
/* Unlink a chunk from a smallbin */
#define unlink_small_chunk(M, P, S) {\
mchunkptr F = P->fd;\
mchunkptr B = P->bk;\
bindex_t I = small_index(S);\
assert(P != B);\
assert(P != F);\
assert(chunksize(P) == small_index2size(I));\
if (RTCHECK(F == smallbin_at(M,I) || (ok_address(M, F) && F->bk == P))) { \
if (B == F) {\
clear_smallmap(M, I);\
}\
else if (RTCHECK(B == smallbin_at(M,I) ||\
(ok_address(M, B) && B->fd == P))) {\
F->bk = B;\
B->fd = F;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}
/* Unlink the first chunk from a smallbin */
#define unlink_first_small_chunk(M, B, P, I) {\
mchunkptr F = P->fd;\
assert(P != B);\
assert(P != F);\
assert(chunksize(P) == small_index2size(I));\
if (B == F) {\
clear_smallmap(M, I);\
}\
else if (RTCHECK(ok_address(M, F) && F->bk == P)) {\
F->bk = B;\
B->fd = F;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}
/* Replace dv node, binning the old one */
/* Used only when dvsize known to be small */
#define replace_dv(M, P, S) {\
size_t DVS = M->dvsize;\
assert(is_small(DVS));\
if (DVS != 0) {\
mchunkptr DV = M->dv;\
insert_small_chunk(M, DV, DVS);\
}\
M->dvsize = S;\
M->dv = P;\
}
| 2,079 | 87 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/management.inc | // clang-format off
/* -------------------------- mspace management -------------------------- */
/* Initialize top chunk and its size */
static void init_top(mstate m, mchunkptr p, size_t psize) {
/* Ensure alignment */
size_t offset = align_offset(chunk2mem(p));
p = (mchunkptr)((char*)p + offset);
psize -= offset;
m->top = p;
m->topsize = psize;
p->head = psize | PINUSE_BIT;
/* set size of fake trailing chunk holding overhead space only once */
chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE;
m->trim_check = mparams.trim_threshold; /* reset on each update */
}
/* Initialize bins for a new mstate that is otherwise zeroed out */
static void init_bins(mstate m) {
/* Establish circular links for smallbins */
bindex_t i;
for (i = 0; i < NSMALLBINS; ++i) {
sbinptr bin = smallbin_at(m,i);
bin->fd = bin->bk = bin;
}
}
#if PROCEED_ON_ERROR
/* default corruption action */
static void reset_on_error(mstate m) {
int i;
++malloc_corruption_error_count;
/* Reinitialize fields to forget about all memory */
m->smallmap = m->treemap = 0;
m->dvsize = m->topsize = 0;
m->seg.base = 0;
m->seg.size = 0;
m->seg.next = 0;
m->top = m->dv = 0;
for (i = 0; i < NTREEBINS; ++i)
*treebin_at(m, i) = 0;
init_bins(m);
}
#endif /* PROCEED_ON_ERROR */
/* Allocate chunk and prepend remainder with chunk in successor base. */
static void* prepend_alloc(mstate m, char* newbase, char* oldbase,
size_t nb) {
mchunkptr p = align_as_chunk(newbase);
mchunkptr oldfirst = align_as_chunk(oldbase);
size_t psize = (char*)oldfirst - (char*)p;
mchunkptr q = chunk_plus_offset(p, nb);
size_t qsize = psize - nb;
set_size_and_pinuse_of_inuse_chunk(m, p, nb);
assert((char*)oldfirst > (char*)q);
assert(pinuse(oldfirst));
assert(qsize >= MIN_CHUNK_SIZE);
/* consolidate remainder with first chunk of old base */
if (oldfirst == m->top) {
size_t tsize = m->topsize += qsize;
m->top = q;
q->head = tsize | PINUSE_BIT;
check_top_chunk(m, q);
}
else if (oldfirst == m->dv) {
size_t dsize = m->dvsize += qsize;
m->dv = q;
set_size_and_pinuse_of_free_chunk(q, dsize);
}
else {
if (!is_inuse(oldfirst)) {
size_t nsize = chunksize(oldfirst);
unlink_chunk(m, oldfirst, nsize);
oldfirst = chunk_plus_offset(oldfirst, nsize);
qsize += nsize;
}
set_free_with_pinuse(q, qsize, oldfirst);
insert_chunk(m, q, qsize);
check_free_chunk(m, q);
}
check_malloced_chunk(m, chunk2mem(p), nb);
return chunk2mem(p);
}
/* Add a segment to hold a new noncontiguous region */
static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) {
/* Determine locations and sizes of segment, fenceposts, old top */
char* old_top = (char*)m->top;
msegmentptr oldsp = segment_holding(m, old_top);
char* old_end = oldsp->base + oldsp->size;
size_t ssize = pad_request(sizeof(struct malloc_segment));
char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
size_t offset = align_offset(chunk2mem(rawsp));
char* asp = rawsp + offset;
char* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp;
mchunkptr sp = (mchunkptr)csp;
msegmentptr ss = (msegmentptr)(chunk2mem(sp));
mchunkptr tnext = chunk_plus_offset(sp, ssize);
mchunkptr p = tnext;
int nfences = 0;
/* reset top to new space */
init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
/* Set up segment record */
assert(is_aligned(ss));
set_size_and_pinuse_of_inuse_chunk(m, sp, ssize);
*ss = m->seg; /* Push current record */
m->seg.base = tbase;
m->seg.size = tsize;
m->seg.sflags = mmapped;
m->seg.next = ss;
/* Insert trailing fenceposts */
for (;;) {
mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE);
p->head = FENCEPOST_HEAD;
++nfences;
if ((char*)(&(nextp->head)) < old_end)
p = nextp;
else
break;
}
assert(nfences >= 2);
/* Insert the rest of old top into a bin as an ordinary free chunk */
if (csp != old_top) {
mchunkptr q = (mchunkptr)old_top;
size_t psize = csp - old_top;
mchunkptr tn = chunk_plus_offset(q, psize);
set_free_with_pinuse(q, psize, tn);
insert_chunk(m, q, psize);
}
check_top_chunk(m, m->top);
}
| 4,282 | 143 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/dlmalloc.h | #ifndef COSMOPOLITAN_THIRD_PARTY_DLMALLOC_DLMALLOC_H_
#define COSMOPOLITAN_THIRD_PARTY_DLMALLOC_DLMALLOC_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/*
malloc(size_t n)
Returns a pointer to a newly allocated chunk of at least n bytes, or
null if no space is available, in which case errno is set to ENOMEM
on ANSI C systems.
If n is zero, malloc returns a minimum-sized chunk. (The minimum
size is 16 bytes on most 32bit systems, and 32 bytes on 64bit
systems.) Note that size_t is an unsigned type, so calls with
arguments that would be negative if signed are interpreted as
requests for huge amounts of space, which will often fail. The
maximum supported value of n differs across systems, but is in all
cases less than the maximum representable value of a size_t.
*/
void* dlmalloc(size_t);
/*
free(void* p)
Releases the chunk of memory pointed to by p, that had been previously
allocated using malloc or a related routine such as realloc.
It has no effect if p is null. If p was not malloced or already
freed, free(p) will by default cuase the current program to abort.
*/
void dlfree(void*);
/*
calloc(size_t n_elements, size_t element_size);
Returns a pointer to n_elements * element_size bytes, with all locations
set to zero.
*/
void* dlcalloc(size_t, size_t);
/*
realloc(void* p, size_t n)
Returns a pointer to a chunk of size n that contains the same data
as does chunk p up to the minimum of (n, p's size) bytes, or null
if no space is available.
The returned pointer may or may not be the same as p. The algorithm
prefers extending p in most cases when possible, otherwise it
employs the equivalent of a malloc-copy-free sequence.
If p is null, realloc is equivalent to malloc.
If space is not available, realloc returns null, errno is set (if on
ANSI) and p is NOT freed.
if n is for fewer bytes than already held by p, the newly unused
space is lopped off and freed if possible. realloc with a size
argument of zero (re)allocates a minimum-sized chunk.
The old unix realloc convention of allowing the last-free'd chunk
to be used as an argument to realloc is not supported.
*/
void* dlrealloc(void*, size_t);
/*
realloc_in_place(void* p, size_t n)
Resizes the space allocated for p to size n, only if this can be
done without moving p (i.e., only if there is adjacent space
available if n is greater than p's current allocated size, or n is
less than or equal to p's size). This may be used instead of plain
realloc if an alternative allocation strategy is needed upon failure
to expand space; for example, reallocation of a buffer that must be
memory-aligned or cleared. You can use realloc_in_place to trigger
these alternatives only when needed.
Returns p if successful; otherwise null.
*/
void* dlrealloc_in_place(void*, size_t);
/*
memalign(size_t alignment, size_t n);
Returns a pointer to a newly allocated chunk of n bytes, aligned
in accord with the alignment argument.
The alignment argument should be a power of two. If the argument is
not a power of two, the nearest greater power is used.
8-byte alignment is guaranteed by normal malloc calls, so don't
bother calling memalign with an argument of 8 or less.
Overreliance on memalign is a sure way to fragment space.
*/
void* dlmemalign(size_t, size_t);
/*
int posix_memalign(void** pp, size_t alignment, size_t n);
Allocates a chunk of n bytes, aligned in accord with the alignment
argument. Differs from memalign only in that it (1) assigns the
allocated memory to *pp rather than returning it, (2) fails and
returns EINVAL if the alignment is not a power of two (3) fails and
returns ENOMEM if memory cannot be allocated.
*/
int dlposix_memalign(void**, size_t, size_t);
/*
valloc(size_t n);
Equivalent to memalign(pagesize, n), where pagesize is the page
size of the system. If the pagesize is unknown, 4096 is used.
*/
void* dlvalloc(size_t);
/*
mallopt(int parameter_number, int parameter_value)
Sets tunable parameters The format is to provide a
(parameter-number, parameter-value) pair. mallopt then sets the
corresponding parameter to the argument value if it can (i.e., so
long as the value is meaningful), and returns 1 if successful else
0. SVID/XPG/ANSI defines four standard param numbers for mallopt,
normally defined in malloc.h. None of these are use in this malloc,
so setting them has no effect. But this malloc also supports other
options in mallopt:
Symbol param # default allowed param values
M_TRIM_THRESHOLD -1 2*1024*1024 any (-1U disables trimming)
M_GRANULARITY -2 page size any power of 2 >= page size
M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support)
*/
int dlmallopt(int, int);
/*
malloc_footprint();
Returns the number of bytes obtained from the system. The total
number of bytes allocated by malloc, realloc etc., is less than this
value. Unlike mallinfo, this function returns only a precomputed
result, so can be called frequently to monitor memory consumption.
Even if locks are otherwise defined, this function does not use them,
so results might not be up to date.
*/
size_t dlmalloc_footprint(void);
/*
malloc_max_footprint();
Returns the maximum number of bytes obtained from the system. This
value will be greater than current footprint if deallocated space
has been reclaimed by the system. The peak number of bytes allocated
by malloc, realloc etc., is less than this value. Unlike mallinfo,
this function returns only a precomputed result, so can be called
frequently to monitor memory consumption. Even if locks are
otherwise defined, this function does not use them, so results might
not be up to date.
*/
size_t dlmalloc_max_footprint(void);
/*
malloc_footprint_limit();
Returns the number of bytes that the heap is allowed to obtain from
the system, returning the last value returned by
malloc_set_footprint_limit, or the maximum size_t value if
never set. The returned value reflects a permission. There is no
guarantee that this number of bytes can actually be obtained from
the system.
*/
size_t dlmalloc_footprint_limit(void);
/*
malloc_set_footprint_limit();
Sets the maximum number of bytes to obtain from the system, causing
failure returns from malloc and related functions upon attempts to
exceed this value. The argument value may be subject to page
rounding to an enforceable limit; this actual value is returned.
Using an argument of the maximum possible size_t effectively
disables checks. If the argument is less than or equal to the
current malloc_footprint, then all future allocations that require
additional system memory will fail. However, invocation cannot
retroactively deallocate existing used memory.
*/
size_t dlmalloc_set_footprint_limit(size_t bytes);
/*
malloc_inspect_all(void(*handler)(void *start,
void *end,
size_t used_bytes,
void* callback_arg),
void* arg);
Traverses the heap and calls the given handler for each managed
region, skipping all bytes that are (or may be) used for bookkeeping
purposes. Traversal does not include include chunks that have been
directly memory mapped. Each reported region begins at the start
address, and continues up to but not including the end address. The
first used_bytes of the region contain allocated data. If
used_bytes is zero, the region is unallocated. The handler is
invoked with the given callback argument. If locks are defined, they
are held during the entire traversal. It is a bad idea to invoke
other malloc functions from within the handler.
For example, to count the number of in-use chunks with size greater
than 1000, you could write:
static int count = 0;
void count_chunks(void* start, void* end, size_t used, void* arg) {
if (used >= 1000) ++count;
}
then:
malloc_inspect_all(count_chunks, NULL);
malloc_inspect_all is compiled only if MALLOC_INSPECT_ALL is defined.
*/
void dlmalloc_inspect_all(void (*handler)(void*, void*, size_t, void*),
void* arg);
/*
mallinfo()
Returns (by copy) a struct containing various summary statistics:
arena: current total non-mmapped bytes allocated from system
ordblks: the number of free chunks
smblks: always zero.
hblks: current number of mmapped regions
hblkhd: total bytes held in mmapped regions
usmblks: the maximum total allocated space. This will be greater
than current total if trimming has occurred.
fsmblks: always zero
uordblks: current total allocated space (normal or mmapped)
fordblks: total free space
keepcost: the maximum number of bytes that could ideally be released
back to system via malloc_trim. ("ideally" means that
it ignores page restrictions etc.)
Because these fields are ints, but internal bookkeeping may
be kept as longs, the reported values may wrap around zero and
thus be inaccurate.
*/
struct mallinfo dlmallinfo(void);
/*
independent_calloc(size_t n_elements, size_t element_size, void* chunks[]);
independent_calloc is similar to calloc, but instead of returning a
single cleared space, it returns an array of pointers to n_elements
independent elements that can hold contents of size elem_size, each
of which starts out cleared, and can be independently freed,
realloc'ed etc. The elements are guaranteed to be adjacently
allocated (this is not guaranteed to occur with multiple callocs or
mallocs), which may also improve cache locality in some
applications.
The "chunks" argument is optional (i.e., may be null, which is
probably the most typical usage). If it is null, the returned array
is itself dynamically allocated and should also be freed when it is
no longer needed. Otherwise, the chunks array must be of at least
n_elements in length. It is filled in with the pointers to the
chunks.
In either case, independent_calloc returns this pointer array, or
null if the allocation failed. If n_elements is zero and "chunks"
is null, it returns a chunk representing an array with zero elements
(which should be freed if not wanted).
Each element must be freed when it is no longer needed. This can be
done all at once using bulk_free.
independent_calloc simplifies and speeds up implementations of many
kinds of pools. It may also be useful when constructing large data
structures that initially have a fixed number of fixed-sized nodes,
but the number is not known at compile time, and some of the nodes
may later need to be freed. For example:
struct Node { int item; struct Node* next; };
struct Node* build_list() {
struct Node** pool;
int n = read_number_of_nodes_needed();
if (n <= 0) return 0;
pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0);
if (pool == 0) die();
// organize into a linked list...
struct Node* first = pool[0];
for (i = 0; i < n-1; ++i)
pool[i]->next = pool[i+1];
free(pool); // Can now free the array (or not, if it is needed later)
return first;
}
*/
void** dlindependent_calloc(size_t, size_t, void**);
/*
independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]);
independent_comalloc allocates, all at once, a set of n_elements
chunks with sizes indicated in the "sizes" array. It returns
an array of pointers to these elements, each of which can be
independently freed, realloc'ed etc. The elements are guaranteed to
be adjacently allocated (this is not guaranteed to occur with
multiple callocs or mallocs), which may also improve cache locality
in some applications.
The "chunks" argument is optional (i.e., may be null). If it is null
the returned array is itself dynamically allocated and should also
be freed when it is no longer needed. Otherwise, the chunks array
must be of at least n_elements in length. It is filled in with the
pointers to the chunks.
In either case, independent_comalloc returns this pointer array, or
null if the allocation failed. If n_elements is zero and chunks is
null, it returns a chunk representing an array with zero elements
(which should be freed if not wanted).
Each element must be freed when it is no longer needed. This can be
done all at once using bulk_free.
independent_comallac differs from independent_calloc in that each
element may have a different size, and also that it does not
automatically clear elements.
independent_comalloc can be used to speed up allocation in cases
where several structs or objects must always be allocated at the
same time. For example:
struct Head { ... }
struct Foot { ... }
void send_message(char* msg) {
int msglen = strlen(msg);
size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) };
void* chunks[3];
if (independent_comalloc(3, sizes, chunks) == 0)
die();
struct Head* head = (struct Head*)(chunks[0]);
char* body = (char*)(chunks[1]);
struct Foot* foot = (struct Foot*)(chunks[2]);
// ...
}
In general though, independent_comalloc is worth using only for
larger values of n_elements. For small values, you probably won't
detect enough difference from series of malloc calls to bother.
Overuse of independent_comalloc can increase overall memory usage,
since it cannot reuse existing noncontiguous small chunks that
might be available for some of the elements.
*/
void** dlindependent_comalloc(size_t, size_t*, void**);
/*
bulk_free(void* array[], size_t n_elements)
Frees and clears (sets to null) each non-null pointer in the given
array. This is likely to be faster than freeing them one-by-one.
If footers are used, pointers that have been allocated in different
mspaces are not freed or cleared, and the count of all such pointers
is returned. For large arrays of pointers with poor locality, it
may be worthwhile to sort this array before calling bulk_free.
*/
size_t dlbulk_free(void**, size_t n_elements);
/*
pvalloc(size_t n);
Equivalent to valloc(minimum-page-that-holds(n)), that is,
round up n to nearest pagesize.
*/
void* dlpvalloc(size_t);
/*
malloc_trim(size_t pad);
If possible, gives memory back to the system (via negative arguments
to sbrk) if there is unused memory at the `high' end of the malloc
pool or in unused MMAP segments. You can call this after freeing
large blocks of memory to potentially reduce the system-level memory
requirements of a program. However, it cannot guarantee to reduce
memory. Under some allocation patterns, some large free blocks of
memory will be locked between two used chunks, so they cannot be
given back to the system.
The `pad' argument to malloc_trim represents the amount of free
trailing space to leave untrimmed. If this argument is zero, only
the minimum amount of memory to maintain internal data structures
will be left. Non-zero arguments can be supplied to maintain enough
trailing space to service future expected allocations without having
to re-obtain memory from the system.
Malloc_trim returns 1 if it actually released any memory, else 0.
*/
int dlmalloc_trim(size_t);
/*
malloc_stats();
Prints on stderr the amount of space obtained from the system (both
via sbrk and mmap), the maximum amount (which may be more than
current if malloc_trim and/or munmap got called), and the current
number of bytes allocated via malloc (or realloc, etc) but not yet
freed. Note that this is the number of bytes allocated, not the
number requested. It will be larger than the number requested
because of alignment and bookkeeping overhead. Because it includes
alignment wastage as being in use, this figure may be greater than
zero even when no user-level chunks are allocated.
The reported current and maximum system memory can be inaccurate if
a program makes other calls to system memory allocation functions
(normally sbrk) outside of malloc.
malloc_stats prints only the most commonly interesting statistics.
More information can be obtained by calling mallinfo.
malloc_stats is not compiled if NO_MALLOC_STATS is defined.
*/
void dlmalloc_stats(void);
/*
malloc_usable_size(void* p);
Returns the number of bytes you can actually use in
an allocated chunk, which may be more than you requested (although
often not) due to alignment and minimum size constraints.
You can use this many bytes without worrying about
overwriting other allocated objects. This is not a particularly great
programming practice. malloc_usable_size can be more useful in
debugging and assertions, for example:
p = malloc(n);
assert(malloc_usable_size(p) >= 256);
*/
size_t dlmalloc_usable_size(void*);
/*
mspace is an opaque type representing an independent
region of space that supports mspace_malloc, etc.
*/
typedef void* mspace;
/*
create_mspace creates and returns a new independent space with the
given initial capacity, or, if 0, the default granularity size. It
returns null if there is no system memory available to create the
space. If argument locked is non-zero, the space uses a separate
lock to control access. The capacity of the space will grow
dynamically as needed to service mspace_malloc requests. You can
control the sizes of incremental increases of this space by
compiling with a different DEFAULT_GRANULARITY or dynamically
setting with mallopt(M_GRANULARITY, value).
*/
mspace create_mspace(size_t capacity, int locked);
/*
destroy_mspace destroys the given space, and attempts to return all
of its memory back to the system, returning the total number of
bytes freed. After destruction, the results of access to all memory
used by the space become undefined.
*/
size_t destroy_mspace(mspace msp);
/*
create_mspace_with_base uses the memory supplied as the initial base
of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this
space is used for bookkeeping, so the capacity must be at least this
large. (Otherwise 0 is returned.) When this initial space is
exhausted, additional memory will be obtained from the system.
Destroying this space will deallocate all additionally allocated
space (if possible) but not the initial base.
*/
mspace create_mspace_with_base(void* base, size_t capacity, int locked);
/*
mspace_track_large_chunks controls whether requests for large chunks
are allocated in their own untracked mmapped regions, separate from
others in this mspace. By default large chunks are not tracked,
which reduces fragmentation. However, such chunks are not
necessarily released to the system upon destroy_mspace. Enabling
tracking by setting to true may increase fragmentation, but avoids
leakage when relying on destroy_mspace to release all memory
allocated using this space. The function returns the previous
setting.
*/
int mspace_track_large_chunks(mspace msp, int enable);
/*
mspace_mallinfo behaves as mallinfo, but reports properties of
the given space.
*/
struct mallinfo mspace_mallinfo(mspace msp);
/*
An alias for mallopt.
*/
int mspace_mallopt(int, int);
/*
The following operate identically to their malloc counterparts
but operate only for the given mspace argument
*/
void* mspace_malloc(mspace msp, size_t bytes);
void mspace_free(mspace msp, void* mem);
void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size);
void* mspace_realloc(mspace msp, void* mem, size_t newsize);
void* mspace_realloc_in_place(mspace msp, void* mem, size_t newsize);
void* mspace_memalign(mspace msp, size_t alignment, size_t bytes);
void** mspace_independent_calloc(mspace msp, size_t n_elements,
size_t elem_size, void* chunks[]);
void** mspace_independent_comalloc(mspace msp, size_t n_elements,
size_t sizes[], void* chunks[]);
size_t mspace_bulk_free(mspace msp, void**, size_t n_elements);
size_t mspace_usable_size(const void* mem);
void mspace_malloc_stats(mspace msp);
int mspace_trim(mspace msp, size_t pad);
size_t mspace_footprint(mspace msp);
size_t mspace_max_footprint(mspace msp);
size_t mspace_footprint_limit(mspace msp);
size_t mspace_set_footprint_limit(mspace msp, size_t bytes);
void mspace_inspect_all(mspace msp,
void (*handler)(void*, void*, size_t, void*),
void* arg);
_Hide void dlmalloc_atfork(void);
_Hide void dlmalloc_abort(void);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_THIRD_PARTY_DLMALLOC_DLMALLOC_H_ */
| 20,841 | 514 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/debugging.inc | // clang-format off
/* -------------------------- Debugging setup ---------------------------- */
#if ! DEBUG
#define check_free_chunk(M,P)
#define check_inuse_chunk(M,P)
#define check_malloced_chunk(M,P,N)
#define check_mmapped_chunk(M,P)
#define check_malloc_state(M)
#define check_top_chunk(M,P)
#else /* DEBUG */
#define check_free_chunk(M,P) do_check_free_chunk(M,P)
#define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P)
#define check_top_chunk(M,P) do_check_top_chunk(M,P)
#define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N)
#define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P)
#define check_malloc_state(M) do_check_malloc_state(M)
static void do_check_any_chunk(mstate m, mchunkptr p);
static void do_check_top_chunk(mstate m, mchunkptr p);
static void do_check_mmapped_chunk(mstate m, mchunkptr p);
static void do_check_inuse_chunk(mstate m, mchunkptr p);
static void do_check_free_chunk(mstate m, mchunkptr p);
static void do_check_malloced_chunk(mstate m, void* mem, size_t s);
static void do_check_tree(mstate m, tchunkptr t);
static void do_check_treebin(mstate m, bindex_t i);
static void do_check_smallbin(mstate m, bindex_t i);
static void do_check_malloc_state(mstate m);
static int bin_find(mstate m, mchunkptr x);
static size_t traverse_and_check(mstate m);
#endif /* DEBUG */
| 1,377 | 35 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/statistics.inc | // clang-format off
/* ----------------------------- statistics ------------------------------ */
#if !NO_MALLINFO
static struct mallinfo internal_mallinfo(mstate m) {
struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
ensure_initialization();
if (!PREACTION(m)) {
check_malloc_state(m);
if (is_initialized(m)) {
size_t nfree = SIZE_T_ONE; /* top always free */
size_t mfree = m->topsize + TOP_FOOT_SIZE;
size_t sum = mfree;
msegmentptr s = &m->seg;
while (s != 0) {
mchunkptr q = align_as_chunk(s->base);
while (segment_holds(s, q) &&
q != m->top && q->head != FENCEPOST_HEAD) {
size_t sz = chunksize(q);
sum += sz;
if (!is_inuse(q)) {
mfree += sz;
++nfree;
}
q = next_chunk(q);
}
s = s->next;
}
nm.arena = sum;
nm.ordblks = nfree;
nm.hblkhd = m->footprint - sum;
nm.usmblks = m->max_footprint;
nm.uordblks = m->footprint - mfree;
nm.fordblks = mfree;
nm.keepcost = m->topsize;
}
POSTACTION(m);
}
return nm;
}
#endif /* !NO_MALLINFO */
#if !NO_MALLOC_STATS
static void internal_malloc_stats(mstate m) {
ensure_initialization();
if (!PREACTION(m)) {
size_t maxfp = 0;
size_t fp = 0;
size_t used = 0;
check_malloc_state(m);
if (is_initialized(m)) {
msegmentptr s = &m->seg;
maxfp = m->max_footprint;
fp = m->footprint;
used = fp - (m->topsize + TOP_FOOT_SIZE);
while (s != 0) {
mchunkptr q = align_as_chunk(s->base);
while (segment_holds(s, q) &&
q != m->top && q->head != FENCEPOST_HEAD) {
if (!is_inuse(q))
used -= chunksize(q);
q = next_chunk(q);
}
s = s->next;
}
}
POSTACTION(m); /* drop lock */
kprintf("max system bytes = %10lu\n", (unsigned long)(maxfp));
kprintf("system bytes = %10lu\n", (unsigned long)(fp));
kprintf("in use bytes = %10lu\n", (unsigned long)(used));
}
}
#endif /* NO_MALLOC_STATS */
| 2,120 | 78 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/global.inc | // clang-format off
/* ------------- Global malloc_state and malloc_params ------------------- */
/*
malloc_params holds global properties, including those that can be
dynamically set using mallopt. There is a single instance, mparams,
initialized in init_mparams. Note that the non-zeroness of "magic"
also serves as an initialization flag.
*/
struct malloc_params {
size_t magic;
size_t page_size;
size_t granularity;
size_t mmap_threshold;
size_t trim_threshold;
flag_t default_mflags;
};
static struct malloc_params mparams;
/* Ensure mparams initialized */
#define ensure_initialization() (void)0
#if !ONLY_MSPACES
/* The global malloc_state used for all non-"mspace" calls */
static struct malloc_state _gm_;
#define gm (&_gm_)
#define is_global(M) ((M) == &_gm_)
#endif /* !ONLY_MSPACES */
#define is_initialized(M) ((M)->top != 0)
| 891 | 36 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/runtimechecks.inc | // clang-format off
/* ----------------------- Runtime Check Support ------------------------- */
/*
For security, the main invariant is that malloc/free/etc never
writes to a static address other than malloc_state, unless static
malloc_state itself has been corrupted, which cannot occur via
malloc (because of these checks). In essence this means that we
believe all pointers, sizes, maps etc held in malloc_state, but
check all of those linked or offsetted from other embedded data
structures. These checks are interspersed with main code in a way
that tends to minimize their run-time cost.
When FOOTERS is defined, in addition to range checking, we also
verify footer fields of inuse chunks, which can be used guarantee
that the mstate controlling malloc/free is intact. This is a
streamlined version of the approach described by William Robertson
et al in "Run-time Detection of Heap-based Overflows" LISA'03
http://www.usenix.org/events/lisa03/tech/robertson.html The footer
of an inuse chunk holds the xor of its mstate and a random seed,
that is checked upon calls to free() and realloc(). This is
(probabalistically) unguessable from outside the program, but can be
computed by any code successfully malloc'ing any chunk, so does not
itself provide protection against code that has already broken
security through some other means. Unlike Robertson et al, we
always dynamically check addresses of all offset chunks (previous,
next, etc). This turns out to be cheaper than relying on hashes.
*/
#if !INSECURE
/* Check if address a is at least as high as any from MORECORE or MMAP */
#define ok_address(M, a) ((char*)(a) >= (M)->least_addr)
/* Check if address of next chunk n is higher than base chunk p */
#define ok_next(p, n) ((char*)(p) < (char*)(n))
/* Check if p has inuse status */
#define ok_inuse(p) is_inuse(p)
/* Check if p has its pinuse bit on */
#define ok_pinuse(p) pinuse(p)
#else /* !INSECURE */
#define ok_address(M, a) (1)
#define ok_next(b, n) (1)
#define ok_inuse(p) (1)
#define ok_pinuse(p) (1)
#endif /* !INSECURE */
#if (FOOTERS && !INSECURE)
/* Check if (alleged) mstate m has expected magic field */
#define ok_magic(M) ((M)->magic == mparams.magic)
#else /* (FOOTERS && !INSECURE) */
#define ok_magic(M) (1)
#endif /* (FOOTERS && !INSECURE) */
/* In gcc, use __builtin_expect to minimize impact of checks */
#if !INSECURE
#if defined(__GNUC__) && __GNUC__ >= 3
#define RTCHECK(e) __builtin_expect(e, 1)
#else /* GNUC */
#define RTCHECK(e) (e)
#endif /* GNUC */
#else /* !INSECURE */
#define RTCHECK(e) (1)
#endif /* !INSECURE */
/* macros to set up inuse chunks with or without footers */
#if !FOOTERS
#define mark_inuse_foot(M,p,s)
/* Macros for setting head/foot of non-mmapped chunks */
/* Set cinuse bit and pinuse bit of next chunk */
#define set_inuse(M,p,s)\
((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
/* Set cinuse and pinuse of this chunk and pinuse of next chunk */
#define set_inuse_and_pinuse(M,p,s)\
((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
/* Set size, cinuse and pinuse bit of this chunk */
#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
((p)->head = (s|PINUSE_BIT|CINUSE_BIT))
#else /* FOOTERS */
/* Set foot of inuse chunk to be xor of mstate and seed */
#define mark_inuse_foot(M,p,s)\
(((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic))
#define get_mstate_for(p)\
((mstate)(((mchunkptr)((char*)(p) +\
(chunksize(p))))->prev_foot ^ mparams.magic))
#define set_inuse(M,p,s)\
((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
(((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \
mark_inuse_foot(M,p,s))
#define set_inuse_and_pinuse(M,p,s)\
((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
(((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\
mark_inuse_foot(M,p,s))
#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
mark_inuse_foot(M, p, s))
#endif /* !FOOTERS */
| 4,160 | 113 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/platform.inc | // clang-format off
#define LACKS_UNISTD_H
#define LACKS_FCNTL_H
#define LACKS_SYS_PARAM_H
#define LACKS_SYS_MMAN_H
#define LACKS_STRINGS_H
#define LACKS_STRING_H
#define LACKS_SYS_TYPES_H
#define LACKS_ERRNO_H
#define LACKS_STDLIB_H
#define LACKS_SCHED_H
#define LACKS_TIME_H
/* Version identifier to allow people to support multiple versions */
#ifndef DLMALLOC_VERSION
#define DLMALLOC_VERSION 20806
#endif /* DLMALLOC_VERSION */
#ifndef DLMALLOC_EXPORT
#define DLMALLOC_EXPORT extern
#endif
/* The maximum possible size_t value has all bits set */
#define MAX_SIZE_T (~(size_t)0)
#ifndef USE_LOCKS /* ensure true if spin or recursive locks set */
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
#endif /* USE_LOCKS */
#if USE_LOCKS /* Spin locks for gcc >= 4.1, older gcc on x86, MSC >= 1310 */
#if ((defined(__GNUC__) && \
((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) || \
defined(__i386__) || defined(__x86_64__))) || \
(defined(_MSC_VER) && _MSC_VER>=1310))
#ifndef USE_SPIN_LOCKS
#define USE_SPIN_LOCKS 1
#endif /* USE_SPIN_LOCKS */
#elif USE_SPIN_LOCKS
#error "USE_SPIN_LOCKS defined without implementation"
#endif /* ... locks available... */
#elif !defined(USE_SPIN_LOCKS)
#define USE_SPIN_LOCKS 0
#endif /* USE_LOCKS */
#ifndef ONLY_MSPACES
#define ONLY_MSPACES 0
#endif /* ONLY_MSPACES */
#ifndef MSPACES
#if ONLY_MSPACES
#define MSPACES 1
#else /* ONLY_MSPACES */
#define MSPACES 0
#endif /* ONLY_MSPACES */
#endif /* MSPACES */
#ifndef MALLOC_ALIGNMENT
#define MALLOC_ALIGNMENT ((size_t)(2 * sizeof(void *)))
#endif /* MALLOC_ALIGNMENT */
#ifndef FOOTERS
#define FOOTERS 0
#endif /* FOOTERS */
#ifndef ABORT
#define ABORT dlmalloc_abort()
#endif /* ABORT */
#ifndef ABORT_ON_ASSERT_FAILURE
#define ABORT_ON_ASSERT_FAILURE 1
#endif /* ABORT_ON_ASSERT_FAILURE */
#ifndef PROCEED_ON_ERROR
#define PROCEED_ON_ERROR 0
#endif /* PROCEED_ON_ERROR */
#ifndef INSECURE
#define INSECURE 0
#endif /* INSECURE */
#ifndef MALLOC_INSPECT_ALL
#define MALLOC_INSPECT_ALL 0
#endif /* MALLOC_INSPECT_ALL */
#ifndef HAVE_MMAP
#define HAVE_MMAP 1
#endif /* HAVE_MMAP */
#ifndef MMAP_CLEARS
#define MMAP_CLEARS 1
#endif /* MMAP_CLEARS */
#ifndef HAVE_MREMAP
#ifdef linux
#define HAVE_MREMAP 1
#define _GNU_SOURCE /* Turns on mremap() definition */
#else /* linux */
#define HAVE_MREMAP 0
#endif /* linux */
#endif /* HAVE_MREMAP */
#ifndef MALLOC_FAILURE_ACTION
#define MALLOC_FAILURE_ACTION errno = ENOMEM;
#endif /* MALLOC_FAILURE_ACTION */
#ifndef HAVE_MORECORE
#if ONLY_MSPACES
#define HAVE_MORECORE 0
#else /* ONLY_MSPACES */
#define HAVE_MORECORE 1
#endif /* ONLY_MSPACES */
#endif /* HAVE_MORECORE */
#if !HAVE_MORECORE
#define MORECORE_CONTIGUOUS 0
#else /* !HAVE_MORECORE */
#define MORECORE_DEFAULT sbrk
#ifndef MORECORE_CONTIGUOUS
#define MORECORE_CONTIGUOUS 1
#endif /* MORECORE_CONTIGUOUS */
#endif /* HAVE_MORECORE */
#ifndef DEFAULT_GRANULARITY
#if (MORECORE_CONTIGUOUS || defined(WIN32))
#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */
#else /* MORECORE_CONTIGUOUS */
#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U)
#endif /* MORECORE_CONTIGUOUS */
#endif /* DEFAULT_GRANULARITY */
#ifndef DEFAULT_TRIM_THRESHOLD
#ifndef MORECORE_CANNOT_TRIM
#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U)
#else /* MORECORE_CANNOT_TRIM */
#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T
#endif /* MORECORE_CANNOT_TRIM */
#endif /* DEFAULT_TRIM_THRESHOLD */
#ifndef DEFAULT_MMAP_THRESHOLD
#if HAVE_MMAP
#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U)
#else /* HAVE_MMAP */
#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T
#endif /* HAVE_MMAP */
#endif /* DEFAULT_MMAP_THRESHOLD */
#ifndef MAX_RELEASE_CHECK_RATE
#if HAVE_MMAP
#define MAX_RELEASE_CHECK_RATE 4095
#else
#define MAX_RELEASE_CHECK_RATE MAX_SIZE_T
#endif /* HAVE_MMAP */
#endif /* MAX_RELEASE_CHECK_RATE */
#ifndef USE_BUILTIN_FFS
#define USE_BUILTIN_FFS 0
#endif /* USE_BUILTIN_FFS */
#ifndef USE_DEV_RANDOM
#define USE_DEV_RANDOM 0
#endif /* USE_DEV_RANDOM */
#ifndef NO_MALLINFO
#define NO_MALLINFO 0
#endif /* NO_MALLINFO */
#ifndef MALLINFO_FIELD_TYPE
#define MALLINFO_FIELD_TYPE size_t
#endif /* MALLINFO_FIELD_TYPE */
#ifndef NO_MALLOC_STATS
#define NO_MALLOC_STATS 0
#endif /* NO_MALLOC_STATS */
#ifndef NO_SEGMENT_TRAVERSAL
#define NO_SEGMENT_TRAVERSAL 0
#endif /* NO_SEGMENT_TRAVERSAL */
/*
mallopt tuning options. SVID/XPG defines four standard parameter
numbers for mallopt, normally defined in malloc.h. None of these
are used in this malloc, so setting them has no effect. But this
malloc does support the following options.
*/
#define M_TRIM_THRESHOLD (-1)
#define M_GRANULARITY (-2)
#define M_MMAP_THRESHOLD (-3)
/* ------------------------ Mallinfo declarations ------------------------ */
/*
Try to persuade compilers to inline. The most critical functions for
inlining are defined as macros, so these aren't used for them.
*/
#define FORCEINLINE forceinline
#define NOINLINE dontinline
/*
========================================================================
To make a fully customizable malloc.h header file, cut everything
#include "libc/sysv/consts/map.h"
#include "libc/runtime/runtime.h"
above this line, put into file malloc.h, edit to suit, and #include it
on the next line, as well as in programs that use this malloc.
========================================================================
*/
/* #include "malloc.h" */
/*------------------------------ internal #includes ---------------------- */
#ifdef _MSC_VER
#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
#endif /* _MSC_VER */
#if !NO_MALLOC_STATS
#endif /* NO_MALLOC_STATS */
#ifndef LACKS_ERRNO_H
#include <errno.h> /* for MALLOC_FAILURE_ACTION */
#endif /* LACKS_ERRNO_H */
#ifdef DEBUG
#if ABORT_ON_ASSERT_FAILURE
#endif /* ABORT_ON_ASSERT_FAILURE */
#else /* DEBUG */
#ifndef assert
#define assert(x)
#endif
#define DEBUG 0
#endif /* DEBUG */
#if !defined(WIN32) && !defined(LACKS_TIME_H)
#include <time.h> /* for magic initialization */
#endif /* WIN32 */
#ifndef LACKS_STDLIB_H
#include <stdlib.h> /* for abort() */
#endif /* LACKS_STDLIB_H */
#ifndef LACKS_STRING_H
#include <string.h> /* for memset etc */
#endif /* LACKS_STRING_H */
#if USE_BUILTIN_FFS
#ifndef LACKS_STRINGS_H
#include <strings.h> /* for ffs */
#endif /* LACKS_STRINGS_H */
#endif /* USE_BUILTIN_FFS */
#if HAVE_MMAP
#ifndef LACKS_SYS_MMAN_H
/* On some versions of linux, mremap decl in mman.h needs __USE_GNU set */
#if (defined(linux) && !defined(__USE_GNU))
#define __USE_GNU 1
#include <sys/mman.h> /* for mmap */
#undef __USE_GNU
#else
#include <sys/mman.h> /* for mmap */
#endif /* linux */
#endif /* LACKS_SYS_MMAN_H */
#ifndef LACKS_FCNTL_H
#include <fcntl.h>
#endif /* LACKS_FCNTL_H */
#endif /* HAVE_MMAP */
#ifndef LACKS_UNISTD_H
#include <unistd.h> /* for sbrk, sysconf */
#else /* LACKS_UNISTD_H */
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__COSMOPOLITAN__)
extern void* sbrk(ptrdiff_t);
#endif /* FreeBSD etc */
#endif /* LACKS_UNISTD_H */
/* Declarations for locking */
#if USE_LOCKS
#ifndef WIN32
#if defined (__SVR4) && defined (__sun) /* solaris */
#elif !defined(LACKS_SCHED_H)
#endif /* solaris or LACKS_SCHED_H */
#if (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0) || !USE_SPIN_LOCKS
#endif /* USE_RECURSIVE_LOCKS ... */
#elif defined(_MSC_VER)
#ifndef _M_AMD64
/* These are already defined on AMD64 builds */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
LONG __cdecl _InterlockedCompareExchange(LONG volatile *Dest, LONG Exchange, LONG Comp);
LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _M_AMD64 */
#pragma intrinsic (_InterlockedCompareExchange)
#pragma intrinsic (_InterlockedExchange)
#define interlockedcompareexchange _InterlockedCompareExchange
#define interlockedexchange _InterlockedExchange
#elif defined(WIN32) && defined(__GNUC__)
#define interlockedcompareexchange(a, b, c) __sync_val_compare_and_swap(a, c, b)
#define interlockedexchange __sync_lock_test_and_set
#endif /* Win32 */
#else /* USE_LOCKS */
#endif /* USE_LOCKS */
#ifndef LOCK_AT_FORK
#define LOCK_AT_FORK 0
#endif
/* Declarations for bit scanning on win32 */
#if defined(_MSC_VER) && _MSC_VER>=1300
#ifndef BitScanForward /* Try to avoid pulling in WinNT.h */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
unsigned char _BitScanForward(unsigned long *index, unsigned long mask);
unsigned char _BitScanReverse(unsigned long *index, unsigned long mask);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#define BitScanForward _BitScanForward
#define BitScanReverse _BitScanReverse
#pragma intrinsic(_BitScanForward)
#pragma intrinsic(_BitScanReverse)
#endif /* BitScanForward */
#endif /* defined(_MSC_VER) && _MSC_VER>=1300 */
#ifndef WIN32
#ifndef malloc_getpagesize
# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */
# ifndef _SC_PAGE_SIZE
# define _SC_PAGE_SIZE _SC_PAGESIZE
# endif
# endif
# ifdef _SC_PAGE_SIZE
# define malloc_getpagesize 4096 /*sysconf(_SC_PAGE_SIZE)*/
# else
# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
extern size_t getpagesize();
# define malloc_getpagesize getpagesize()
# else
# ifdef WIN32 /* use supplied emulation of getpagesize */
# define malloc_getpagesize getpagesize()
# else
# ifndef LACKS_SYS_PARAM_H
# include <sys/param.h>
# endif
# ifdef EXEC_PAGESIZE
# define malloc_getpagesize EXEC_PAGESIZE
# else
# ifdef NBPG
# ifndef CLSIZE
# define malloc_getpagesize NBPG
# else
# define malloc_getpagesize (NBPG * CLSIZE)
# endif
# else
# ifdef NBPC
# define malloc_getpagesize NBPC
# else
# ifdef PAGESIZE
# define malloc_getpagesize PAGESIZE
# else /* just guess */
# define malloc_getpagesize ((size_t)4096U)
# endif
# endif
# endif
# endif
# endif
# endif
# endif
#endif
#endif
/* ------------------- size_t and alignment properties -------------------- */
/* The byte and bit size of a size_t */
#define SIZE_T_SIZE (sizeof(size_t))
#define SIZE_T_BITSIZE (sizeof(size_t) << 3)
/* Some constants coerced to size_t */
/* Annoying but necessary to avoid errors on some platforms */
#define SIZE_T_ZERO ((size_t)0)
#define SIZE_T_ONE ((size_t)1)
#define SIZE_T_TWO ((size_t)2)
#define SIZE_T_FOUR ((size_t)4)
#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1)
#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2)
#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)
#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U)
/* The bit mask value corresponding to MALLOC_ALIGNMENT */
#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE)
/* True if address a has acceptable alignment */
#define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)
/* the number of bytes to offset an address to align it */
#define align_offset(A)\
((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))
/* -------------------------- MMAP preliminaries ------------------------- */
/*
If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and
checks to fail so compiler optimizer can delete code rather than
using so many "#if"s.
*/
/* MORECORE and MMAP must return MFAIL on failure */
#define MFAIL NULL
#define CMFAIL ((char*)(MFAIL)) /* defined for convenience */
#if HAVE_MMAP
#ifndef WIN32
#define MUNMAP_DEFAULT(a, s) munmap((a), (s))
#define MMAP_PROT (PROT_READ|PROT_WRITE)
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
#define MAP_ANONYMOUS MAP_ANON
#endif /* MAP_ANON */
#ifdef MAP_ANONYMOUS
#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS)
#define MMAP_DEFAULT(s) _mapanon(s)
#else /* MAP_ANONYMOUS */
/*
Nearly all versions of mmap support MAP_ANONYMOUS, so the following
is unlikely to be needed, but is supplied just in case.
*/
#define MMAP_FLAGS (MAP_PRIVATE)
static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
#define MMAP_DEFAULT(s) ((dev_zero_fd < 0) ? \
(dev_zero_fd = open("/dev/zero", O_RDWR), \
mmap_no(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \
mmap_no(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0))
#endif /* MAP_ANONYMOUS */
#define DIRECT_MMAP_DEFAULT(s) MMAP_DEFAULT(s)
#else /* WIN32 */
/* Win32 MMAP via VirtualAlloc */
FORCEINLINE void* win32mmap(size_t size) {
void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
return (ptr != 0)? ptr: MFAIL;
}
/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
FORCEINLINE void* win32direct_mmap(size_t size) {
void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN,
PAGE_READWRITE);
return (ptr != 0)? ptr: MFAIL;
}
/* This function supports releasing coalesed segments */
FORCEINLINE int win32munmap(void* ptr, size_t size) {
MEMORY_BASIC_INFORMATION minfo;
char* cptr = (char*)ptr;
while (size) {
if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0)
return -1;
if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr ||
minfo.State != MEM_COMMIT || minfo.RegionSize > size)
return -1;
if (VirtualFree(cptr, 0, MEM_RELEASE) == 0)
return -1;
cptr += minfo.RegionSize;
size -= minfo.RegionSize;
}
return 0;
}
#define MMAP_DEFAULT(s) win32mmap(s)
#define MUNMAP_DEFAULT(a, s) win32munmap((a), (s))
#define DIRECT_MMAP_DEFAULT(s) win32direct_mmap(s)
#endif /* WIN32 */
#endif /* HAVE_MMAP */
#if HAVE_MREMAP
#ifndef WIN32
#define MREMAP_DEFAULT(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
#endif /* WIN32 */
#endif /* HAVE_MREMAP */
/**
* Define CALL_MORECORE
*/
#if HAVE_MORECORE
#ifdef MORECORE
#define CALL_MORECORE(S) MORECORE(S)
#else /* MORECORE */
#define CALL_MORECORE(S) MORECORE_DEFAULT(S)
#endif /* MORECORE */
#else /* HAVE_MORECORE */
#define CALL_MORECORE(S) MFAIL
#endif /* HAVE_MORECORE */
/**
* Define CALL_MMAP/CALL_MUNMAP/CALL_DIRECT_MMAP
*/
#if HAVE_MMAP
#define USE_MMAP_BIT (SIZE_T_ONE)
#ifdef MMAP
#define CALL_MMAP(s) MMAP(s)
#else /* MMAP */
#define CALL_MMAP(s) MMAP_DEFAULT(s)
#endif /* MMAP */
#ifdef MUNMAP
#define CALL_MUNMAP(a, s) MUNMAP((a), (s))
#else /* MUNMAP */
#define CALL_MUNMAP(a, s) MUNMAP_DEFAULT((a), (s))
#endif /* MUNMAP */
#ifdef DIRECT_MMAP
#define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s)
#else /* DIRECT_MMAP */
#define CALL_DIRECT_MMAP(s) DIRECT_MMAP_DEFAULT(s)
#endif /* DIRECT_MMAP */
#else /* HAVE_MMAP */
#define USE_MMAP_BIT (SIZE_T_ZERO)
#define MMAP(s) MFAIL
#define MUNMAP(a, s) (-1)
#define DIRECT_MMAP(s) MFAIL
#define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s)
#define CALL_MMAP(s) MMAP(s)
#define CALL_MUNMAP(a, s) MUNMAP((a), (s))
#endif /* HAVE_MMAP */
/**
* Define CALL_MREMAP
*/
#if HAVE_MMAP && HAVE_MREMAP
#ifdef MREMAP
#define CALL_MREMAP(addr, osz, nsz, mv) MREMAP((addr), (osz), (nsz), (mv))
#else /* MREMAP */
#define CALL_MREMAP(addr, osz, nsz, mv) MREMAP_DEFAULT((addr), (osz), (nsz), (mv))
#endif /* MREMAP */
#else /* HAVE_MMAP && HAVE_MREMAP */
#define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
#endif /* HAVE_MMAP && HAVE_MREMAP */
/* mstate bit set if continguous morecore disabled or failed */
#define USE_NONCONTIGUOUS_BIT (4U)
/* segment bit set in create_mspace_with_base */
#define EXTERN_BIT (8U)
| 16,340 | 524 | jart/cosmopolitan | false |
cosmopolitan/third_party/dlmalloc/headfoot.inc | // clang-format off
/* ------------------ Operations on head and foot fields ----------------- */
/*
The head field of a chunk is or'ed with PINUSE_BIT when previous
adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in
use, unless mmapped, in which case both bits are cleared.
FLAG4_BIT is not used by this malloc, but might be useful in extensions.
*/
#define PINUSE_BIT (SIZE_T_ONE)
#define CINUSE_BIT (SIZE_T_TWO)
#define FLAG4_BIT (SIZE_T_FOUR)
#define INUSE_BITS (PINUSE_BIT|CINUSE_BIT)
#define FLAG_BITS (PINUSE_BIT|CINUSE_BIT|FLAG4_BIT)
/* Head value for fenceposts */
#define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE)
/* extraction of fields from head words */
#define cinuse(p) ((p)->head & CINUSE_BIT)
#define pinuse(p) ((p)->head & PINUSE_BIT)
#define flag4inuse(p) ((p)->head & FLAG4_BIT)
#define is_inuse(p) (((p)->head & INUSE_BITS) != PINUSE_BIT)
#define is_mmapped(p) (((p)->head & INUSE_BITS) == 0)
#define chunksize(p) ((p)->head & ~(FLAG_BITS))
#define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT)
#define set_flag4(p) ((p)->head |= FLAG4_BIT)
#define clear_flag4(p) ((p)->head &= ~FLAG4_BIT)
/* Treat space at ptr +/- offset as a chunk */
#define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s)))
#define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s)))
/* Ptr to next or previous physical malloc_chunk. */
#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~FLAG_BITS)))
#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) ))
/* extract next chunk's pinuse bit */
#define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT)
/* Get/set size at footer */
#define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot)
#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s))
/* Set size, pinuse bit, and foot */
#define set_size_and_pinuse_of_free_chunk(p, s)\
((p)->head = (s|PINUSE_BIT), set_foot(p, s))
/* Set size, pinuse bit, foot, and clear next pinuse */
#define set_free_with_pinuse(p, s, n)\
(clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s))
/* Get the internal overhead associated with chunk p */
#define overhead_for(p)\
(is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)
/* Return true if malloced space is not necessarily cleared */
#if MMAP_CLEARS
#define calloc_must_clear(p) (!is_mmapped(p))
#else /* MMAP_CLEARS */
#define calloc_must_clear(p) (1)
#endif /* MMAP_CLEARS */
struct malloc_tree_chunk {
/* The first four fields must be compatible with malloc_chunk */
size_t prev_foot;
size_t head;
struct malloc_tree_chunk* fd;
struct malloc_tree_chunk* bk;
struct malloc_tree_chunk* child[2];
struct malloc_tree_chunk* parent;
bindex_t index;
};
typedef struct malloc_tree_chunk tchunk;
typedef struct malloc_tree_chunk* tchunkptr;
typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */
/* A little helper macro for trees */
#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])
struct malloc_segment {
char* base; /* base address */
size_t size; /* allocated size */
struct malloc_segment* next; /* ptr to next segment */
flag_t sflags; /* mmap and extern flag */
};
#define is_mmapped_segment(S) ((S)->sflags & USE_MMAP_BIT)
#define is_extern_segment(S) ((S)->sflags & EXTERN_BIT)
typedef struct malloc_segment msegment;
typedef struct malloc_segment* msegmentptr;
/* Bin types, widths and sizes */
#define NSMALLBINS (32U)
#define NTREEBINS (32U)
#define SMALLBIN_SHIFT (3U)
#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT)
#define TREEBIN_SHIFT (8U)
#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT)
#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE)
#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)
struct malloc_state {
binmap_t smallmap;
binmap_t treemap;
size_t dvsize;
size_t topsize;
char* least_addr;
mchunkptr dv;
mchunkptr top;
size_t trim_check;
size_t release_checks;
size_t magic;
mchunkptr smallbins[(NSMALLBINS+1)*2];
tbinptr treebins[NTREEBINS];
size_t footprint;
size_t max_footprint;
size_t footprint_limit; /* zero means no limit */
flag_t mflags;
#if USE_LOCKS
MLOCK_T mutex; /* locate lock among fields that rarely change */
#endif /* USE_LOCKS */
msegment seg;
void* extp; /* Unused but available for extensions */
size_t exts;
};
typedef struct malloc_state* mstate;
| 4,751 | 138 | jart/cosmopolitan | false |
cosmopolitan/third_party/regex/regerror.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¡
â Copyright 2020 Justine Alexandra Roberts Tunney â
â â
â Permission to use, copy, modify, and/or distribute this software for â
â any purpose with or without fee is hereby granted, provided that the â
â above copyright notice and this permission notice appear in all copies. â
â â
â THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL â
â WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED â
â WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE â
â AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL â
â DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR â
â PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER â
â TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR â
â PERFORMANCE OF THIS SOFTWARE. â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/intrin/safemacros.internal.h"
#include "libc/fmt/fmt.h"
#include "libc/str/str.h"
#include "third_party/regex/regex.h"
/* Error message strings for error codes listed in `regex.h'. This list
needs to be in sync with the codes listed there, naturally. */
static const char kRegexErrors[] =
"No error\0"
"No match\0"
"Invalid regexp\0"
"Unknown collating element\0"
"Unknown character class name\0"
"Trailing backslash\0"
"Invalid back reference\0"
"Missing ']'\0"
"Missing ')'\0"
"Missing '}'\0"
"Invalid contents of {}\0"
"Invalid character range\0"
"Out of memory\0"
"Repetition not preceded by valid expression\0";
/**
* Converts regular expression error code to string.
*
* @param e is error code
* @return number of bytes needed to hold entire string
*/
size_t regerror(int e, const regex_t *preg, char *buf, size_t size) {
return 1 + (snprintf)(buf, size, "%s",
firstnonnull(IndexDoubleNulString(kRegexErrors, e),
"Unknown error"));
}
| 2,922 | 54 | jart/cosmopolitan | false |
cosmopolitan/third_party/regex/tre-mem.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â â
â tre-mem.c - TRE memory allocator â
â â
â Copyright (c) 2001-2009 Ville Laurikari <[email protected]> â
â All rights reserved. â
â â
â Redistribution and use in source and binary forms, with or without â
â modification, are permitted provided that the following conditions â
â are met: â
â â
â 1. Redistributions of source code must retain the above copyright â
â notice, this list of conditions and the following disclaimer. â
â â
â 2. Redistributions in binary form must reproduce the above copyright â
â notice, this list of conditions and the following disclaimer in â
â the documentation and/or other materials provided with the â
â distribution. â
â â
â THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS â
â ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT â
â LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR â
â A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT â
â HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, â
â SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT â
â LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, â
â DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY â
â THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT â
â (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE â
â OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. â
â â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â â
â Musl Libc â
â Copyright © 2005-2014 Rich Felker, et al. â
â â
â Permission is hereby granted, free of charge, to any person obtaining â
â a copy of this software and associated documentation files (the â
â "Software"), to deal in the Software without restriction, including â
â without limitation the rights to use, copy, modify, merge, publish, â
â distribute, sublicense, and/or sell copies of the Software, and to â
â permit persons to whom the Software is furnished to do so, subject to â
â the following conditions: â
â â
â The above copyright notice and this permission notice shall be â
â included in all copies or substantial portions of the Software. â
â â
â THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, â
â EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF â
â MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. â
â IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY â
â CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, â
â TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE â
â SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. â
â â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "third_party/regex/tre.inc"
/*
This memory allocator is for allocating small memory blocks efficiently
in terms of memory overhead and execution speed. The allocated blocks
cannot be freed individually, only all at once. There can be multiple
allocators, though.
*/
/*
This memory allocator is for allocating small memory blocks efficiently
in terms of memory overhead and execution speed. The allocated blocks
cannot be freed individually, only all at once. There can be multiple
allocators, though.
*/
/* Returns a new memory allocator or NULL if out of memory. */
tre_mem_t tre_mem_new_impl(int provided, void *provided_block) {
tre_mem_t mem;
if (provided) {
mem = provided_block;
bzero(mem, sizeof(*mem));
} else
mem = calloc(1, sizeof(*mem));
if (mem == NULL) return NULL;
return mem;
}
/* Frees the memory allocator and all memory allocated with it. */
void tre_mem_destroy(tre_mem_t mem) {
tre_list_t *tmp, *l = mem->blocks;
while (l != NULL) {
free(l->data), l->data = NULL;
tmp = l->next;
free(l), l = tmp;
}
free(mem), mem = NULL;
}
/* Allocates a block of `size' bytes from `mem'. Returns a pointer to the
allocated block or NULL if an underlying malloc() failed. */
void *tre_mem_alloc_impl(tre_mem_t mem, int provided, void *provided_block,
int zero, size_t size) {
void *ptr;
if (mem->failed) {
return NULL;
}
if (mem->n < size) {
/* We need more memory than is available in the current block.
Allocate a new block. */
tre_list_t *l;
if (provided) {
if (provided_block == NULL) {
mem->failed = 1;
return NULL;
}
mem->ptr = provided_block;
mem->n = TRE_MEM_BLOCK_SIZE;
} else {
int block_size;
if (size * 8 > TRE_MEM_BLOCK_SIZE)
block_size = size * 8;
else
block_size = TRE_MEM_BLOCK_SIZE;
l = malloc(sizeof(*l));
if (l == NULL) {
mem->failed = 1;
return NULL;
}
l->data = malloc(block_size);
if (l->data == NULL) {
free(l), l = NULL;
mem->failed = 1;
return NULL;
}
l->next = NULL;
if (mem->current != NULL) mem->current->next = l;
if (mem->blocks == NULL) mem->blocks = l;
mem->current = l;
mem->ptr = l->data;
mem->n = block_size;
}
}
/* Make sure the next pointer will be aligned. */
size += ALIGN(mem->ptr + size, long);
/* Allocate from current block. */
ptr = mem->ptr;
mem->ptr += size;
mem->n -= size;
/* Set to zero if needed. */
if (zero) bzero(ptr, size);
return ptr;
}
| 8,039 | 152 | jart/cosmopolitan | false |
cosmopolitan/third_party/regex/regexec.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â â
â regexec.c - TRE POSIX compatible matching functions (and more). â
â â
â Copyright (c) 2001-2009 Ville Laurikari <[email protected]> â
â All rights reserved. â
â â
â Redistribution and use in source and binary forms, with or without â
â modification, are permitted provided that the following conditions â
â are met: â
â â
â 1. Redistributions of source code must retain the above copyright â
â notice, this list of conditions and the following disclaimer. â
â â
â 2. Redistributions in binary form must reproduce the above copyright â
â notice, this list of conditions and the following disclaimer in â
â the documentation and/or other materials provided with the â
â distribution. â
â â
â THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS â
â ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT â
â LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR â
â A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT â
â HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, â
â SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT â
â LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, â
â DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY â
â THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT â
â (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE â
â OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. â
â â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â â
â Musl Libc â
â Copyright © 2005-2014 Rich Felker, et al. â
â â
â Permission is hereby granted, free of charge, to any person obtaining â
â a copy of this software and associated documentation files (the â
â "Software"), to deal in the Software without restriction, including â
â without limitation the rights to use, copy, modify, merge, publish, â
â distribute, sublicense, and/or sell copies of the Software, and to â
â permit persons to whom the Software is furnished to do so, subject to â
â the following conditions: â
â â
â The above copyright notice and this permission notice shall be â
â included in all copies or substantial portions of the Software. â
â â
â THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, â
â EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF â
â MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. â
â IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY â
â CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, â
â TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE â
â SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. â
â â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/assert.h"
#include "libc/limits.h"
#include "third_party/regex/tre.inc"
static void tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags,
const tre_tnfa_t *tnfa, regoff_t *tags,
regoff_t match_eo);
/***********************************************************************
from tre-match-utils.h
***********************************************************************/
#define GET_NEXT_WCHAR() \
do { \
prev_c = next_c; \
pos += pos_add_next; \
if ((pos_add_next = mbtowc(&next_c, str_byte, MB_LEN_MAX)) <= 0) { \
if (pos_add_next < 0) { \
ret = REG_NOMATCH; \
goto error_exit; \
} else \
pos_add_next++; \
} \
str_byte += pos_add_next; \
} while (0)
#define IS_WORD_CHAR(c) ((c) == L'_' || tre_isalnum(c))
#define CHECK_ASSERTIONS(assertions) \
(((assertions & ASSERT_AT_BOL) && (pos > 0 || reg_notbol) && \
(prev_c != L'\n' || !reg_newline)) || \
((assertions & ASSERT_AT_EOL) && (next_c != L'\0' || reg_noteol) && \
(next_c != L'\n' || !reg_newline)) || \
((assertions & ASSERT_AT_BOW) && \
(IS_WORD_CHAR(prev_c) || !IS_WORD_CHAR(next_c))) || \
((assertions & ASSERT_AT_EOW) && \
(!IS_WORD_CHAR(prev_c) || IS_WORD_CHAR(next_c))) || \
((assertions & ASSERT_AT_WB) && \
(pos != 0 && next_c != L'\0' && \
IS_WORD_CHAR(prev_c) == IS_WORD_CHAR(next_c))) || \
((assertions & ASSERT_AT_WB_NEG) && \
(pos == 0 || next_c == L'\0' || \
IS_WORD_CHAR(prev_c) != IS_WORD_CHAR(next_c))))
#define CHECK_CHAR_CLASSES(trans_i, tnfa, eflags) \
(((trans_i->assertions & ASSERT_CHAR_CLASS) && \
!(tnfa->cflags & REG_ICASE) && \
!tre_isctype((tre_cint_t)prev_c, trans_i->u.class)) || \
((trans_i->assertions & ASSERT_CHAR_CLASS) && (tnfa->cflags & REG_ICASE) && \
!tre_isctype(tre_tolower((tre_cint_t)prev_c), trans_i->u.class) && \
!tre_isctype(tre_toupper((tre_cint_t)prev_c), trans_i->u.class)) || \
((trans_i->assertions & ASSERT_CHAR_CLASS_NEG) && \
tre_neg_char_classes_match(trans_i->neg_classes, (tre_cint_t)prev_c, \
tnfa->cflags & REG_ICASE)))
/* Returns 1 if `t1' wins `t2', 0 otherwise. */
static int tre_tag_order(int num_tags, tre_tag_direction_t *tag_directions,
regoff_t *t1, regoff_t *t2) {
int i;
for (i = 0; i < num_tags; i++) {
if (tag_directions[i] == TRE_TAG_MINIMIZE) {
if (t1[i] < t2[i]) return 1;
if (t1[i] > t2[i]) return 0;
} else {
if (t1[i] > t2[i]) return 1;
if (t1[i] < t2[i]) return 0;
}
}
/* assert(0);*/
return 0;
}
static int tre_neg_char_classes_match(tre_ctype_t *classes, tre_cint_t wc,
int icase) {
while (*classes != (tre_ctype_t)0)
if ((!icase && tre_isctype(wc, *classes)) ||
(icase && (tre_isctype(tre_toupper(wc), *classes) ||
tre_isctype(tre_tolower(wc), *classes))))
return 1; /* Match. */
else
classes++;
return 0; /* No match. */
}
/***********************************************************************
from tre-match-parallel.c
***********************************************************************/
/*
This algorithm searches for matches basically by reading characters
in the searched string one by one, starting at the beginning. All
matching paths in the TNFA are traversed in parallel. When two or
more paths reach the same state, exactly one is chosen according to
tag ordering rules; if returning submatches is not required it does
not matter which path is chosen.
The worst case time required for finding the leftmost and longest
match, or determining that there is no match, is always linearly
dependent on the length of the text being searched.
This algorithm cannot handle TNFAs with back referencing nodes.
See `tre-match-backtrack.c'.
*/
typedef struct {
tre_tnfa_transition_t *state;
regoff_t *tags;
} tre_tnfa_reach_t;
typedef struct {
regoff_t pos;
regoff_t **tags;
} tre_reach_pos_t;
static reg_errcode_t tre_tnfa_run_parallel(const tre_tnfa_t *tnfa,
const void *string,
regoff_t *match_tags, int eflags,
regoff_t *match_end_ofs) {
/* State variables required by GET_NEXT_WCHAR. */
tre_char_t prev_c = 0, next_c = 0;
const char *str_byte = string;
regoff_t pos = -1;
regoff_t pos_add_next = 1;
#ifdef TRE_MBSTATE
mbstate_t mbstate;
#endif /* TRE_MBSTATE */
int reg_notbol = eflags & REG_NOTBOL;
int reg_noteol = eflags & REG_NOTEOL;
int reg_newline = tnfa->cflags & REG_NEWLINE;
reg_errcode_t ret;
char *buf;
tre_tnfa_transition_t *trans_i;
tre_tnfa_reach_t *reach, *reach_next, *reach_i, *reach_next_i;
tre_reach_pos_t *reach_pos;
int *tag_i;
int num_tags, i;
regoff_t match_eo = -1; /* end offset of match (-1 if no match found yet) */
int new_match = 0;
regoff_t *tmp_tags = NULL;
regoff_t *tmp_iptr;
#ifdef TRE_MBSTATE
bzero(&mbstate, sizeof(mbstate));
#endif /* TRE_MBSTATE */
if (!match_tags)
num_tags = 0;
else
num_tags = tnfa->num_tags;
/* Allocate memory for temporary data required for matching. This needs to
be done for every matching operation to be thread safe. This allocates
everything in a single large block with calloc(). */
{
size_t tbytes, rbytes, pbytes, xbytes, total_bytes;
char *tmp_buf;
/* Ensure that tbytes and xbytes*num_states cannot overflow, and that
* they don't contribute more than 1/8 of SIZE_MAX to total_bytes. */
if (num_tags > SIZE_MAX / (8 * sizeof(regoff_t) * tnfa->num_states))
return REG_ESPACE;
/* Likewise check rbytes. */
if (tnfa->num_states + 1 > SIZE_MAX / (8 * sizeof(*reach_next)))
return REG_ESPACE;
/* Likewise check pbytes. */
if (tnfa->num_states > SIZE_MAX / (8 * sizeof(*reach_pos)))
return REG_ESPACE;
/* Compute the length of the block we need. */
tbytes = sizeof(*tmp_tags) * num_tags;
rbytes = sizeof(*reach_next) * (tnfa->num_states + 1);
pbytes = sizeof(*reach_pos) * tnfa->num_states;
xbytes = sizeof(regoff_t) * num_tags;
total_bytes = (sizeof(long) - 1) * 4 /* for alignment paddings */
+ (rbytes + xbytes * tnfa->num_states) * 2 + tbytes + pbytes;
/* Allocate the memory. */
buf = calloc(total_bytes, 1);
if (buf == NULL) return REG_ESPACE;
/* Get the various pointers within tmp_buf (properly aligned). */
tmp_tags = (void *)buf;
tmp_buf = buf + tbytes;
tmp_buf += ALIGN(tmp_buf, long);
reach_next = (void *)tmp_buf;
tmp_buf += rbytes;
tmp_buf += ALIGN(tmp_buf, long);
reach = (void *)tmp_buf;
tmp_buf += rbytes;
tmp_buf += ALIGN(tmp_buf, long);
reach_pos = (void *)tmp_buf;
tmp_buf += pbytes;
tmp_buf += ALIGN(tmp_buf, long);
for (i = 0; i < tnfa->num_states; i++) {
reach[i].tags = (void *)tmp_buf;
tmp_buf += xbytes;
reach_next[i].tags = (void *)tmp_buf;
tmp_buf += xbytes;
}
}
for (i = 0; i < tnfa->num_states; i++) reach_pos[i].pos = -1;
GET_NEXT_WCHAR();
pos = 0;
reach_next_i = reach_next;
while (1) {
/* If no match found yet, add the initial states to `reach_next'. */
if (match_eo < 0) {
trans_i = tnfa->initial;
while (trans_i->state != NULL) {
if (reach_pos[trans_i->state_id].pos < pos) {
if (trans_i->assertions && CHECK_ASSERTIONS(trans_i->assertions)) {
trans_i++;
continue;
}
reach_next_i->state = trans_i->state;
for (i = 0; i < num_tags; i++) reach_next_i->tags[i] = -1;
tag_i = trans_i->tags;
if (tag_i)
while (*tag_i >= 0) {
if (*tag_i < num_tags) reach_next_i->tags[*tag_i] = pos;
tag_i++;
}
if (reach_next_i->state == tnfa->final) {
match_eo = pos;
new_match = 1;
for (i = 0; i < num_tags; i++)
match_tags[i] = reach_next_i->tags[i];
}
reach_pos[trans_i->state_id].pos = pos;
reach_pos[trans_i->state_id].tags = &reach_next_i->tags;
reach_next_i++;
}
trans_i++;
}
reach_next_i->state = NULL;
} else {
if (num_tags == 0 || reach_next_i == reach_next)
/* We have found a match. */
break;
}
/* Check for end of string. */
if (!next_c) break;
GET_NEXT_WCHAR();
/* Swap `reach' and `reach_next'. */
reach_i = reach;
reach = reach_next;
reach_next = reach_i;
/* For each state in `reach', weed out states that don't fulfill the
minimal matching conditions. */
if (tnfa->num_minimals && new_match) {
new_match = 0;
reach_next_i = reach_next;
for (reach_i = reach; reach_i->state; reach_i++) {
int skip = 0;
for (i = 0; tnfa->minimal_tags[i] >= 0; i += 2) {
int end = tnfa->minimal_tags[i];
int start = tnfa->minimal_tags[i + 1];
if (end >= num_tags) {
skip = 1;
break;
} else if (reach_i->tags[start] == match_tags[start] &&
reach_i->tags[end] < match_tags[end]) {
skip = 1;
break;
}
}
if (!skip) {
reach_next_i->state = reach_i->state;
tmp_iptr = reach_next_i->tags;
reach_next_i->tags = reach_i->tags;
reach_i->tags = tmp_iptr;
reach_next_i++;
}
}
reach_next_i->state = NULL;
/* Swap `reach' and `reach_next'. */
reach_i = reach;
reach = reach_next;
reach_next = reach_i;
}
/* For each state in `reach' see if there is a transition leaving with
the current input symbol to a state not yet in `reach_next', and
add the destination states to `reach_next'. */
reach_next_i = reach_next;
for (reach_i = reach; reach_i->state; reach_i++) {
for (trans_i = reach_i->state; trans_i->state; trans_i++) {
/* Does this transition match the input symbol? */
if (trans_i->code_min <= (tre_cint_t)prev_c &&
trans_i->code_max >= (tre_cint_t)prev_c) {
if (trans_i->assertions &&
(CHECK_ASSERTIONS(trans_i->assertions) ||
CHECK_CHAR_CLASSES(trans_i, tnfa, eflags))) {
continue;
}
/* Compute the tags after this transition. */
for (i = 0; i < num_tags; i++) tmp_tags[i] = reach_i->tags[i];
tag_i = trans_i->tags;
if (tag_i != NULL)
while (*tag_i >= 0) {
if (*tag_i < num_tags) tmp_tags[*tag_i] = pos;
tag_i++;
}
if (reach_pos[trans_i->state_id].pos < pos) {
/* Found an unvisited node. */
reach_next_i->state = trans_i->state;
tmp_iptr = reach_next_i->tags;
reach_next_i->tags = tmp_tags;
tmp_tags = tmp_iptr;
reach_pos[trans_i->state_id].pos = pos;
reach_pos[trans_i->state_id].tags = &reach_next_i->tags;
if (reach_next_i->state == tnfa->final &&
(match_eo == -1 ||
(num_tags > 0 && reach_next_i->tags[0] <= match_tags[0]))) {
match_eo = pos;
new_match = 1;
for (i = 0; i < num_tags; i++)
match_tags[i] = reach_next_i->tags[i];
}
reach_next_i++;
} else {
_unassert(reach_pos[trans_i->state_id].pos == pos);
/* Another path has also reached this state. We choose
the winner by examining the tag values for both
paths. */
if (tre_tag_order(num_tags, tnfa->tag_directions, tmp_tags,
*reach_pos[trans_i->state_id].tags)) {
/* The new path wins. */
tmp_iptr = *reach_pos[trans_i->state_id].tags;
*reach_pos[trans_i->state_id].tags = tmp_tags;
if (trans_i->state == tnfa->final) {
match_eo = pos;
new_match = 1;
for (i = 0; i < num_tags; i++) match_tags[i] = tmp_tags[i];
}
tmp_tags = tmp_iptr;
}
}
}
}
}
reach_next_i->state = NULL;
}
*match_end_ofs = match_eo;
ret = match_eo >= 0 ? REG_OK : REG_NOMATCH;
error_exit:
free(buf), buf = NULL;
return ret;
}
/***********************************************************************
from tre-match-backtrack.c
***********************************************************************/
/*
This matcher is for regexps that use back referencing. Regexp matching
with back referencing is an NP-complete problem on the number of back
references. The easiest way to match them is to use a backtracking
routine which basically goes through all possible paths in the TNFA
and chooses the one which results in the best (leftmost and longest)
match. This can be spectacularly expensive and may run out of stack
space, but there really is no better known generic algorithm. Quoting
Henry Spencer from comp.compilers:
<URL: http://compilers.iecc.com/comparch/article/93-03-102>
POSIX.2 REs require longest match, which is really exciting to
implement since the obsolete ("basic") variant also includes
\<digit>. I haven't found a better way of tackling this than doing
a preliminary match using a DFA (or simulation) on a modified RE
that just replicates subREs for \<digit>, and then doing a
backtracking match to determine whether the subRE matches were
right. This can be rather slow, but I console myself with the
thought that people who use \<digit> deserve very slow execution.
(Pun unintentional but very appropriate.)
*/
typedef struct {
regoff_t pos;
const char *str_byte;
tre_tnfa_transition_t *state;
int state_id;
int next_c;
regoff_t *tags;
#ifdef TRE_MBSTATE
mbstate_t mbstate;
#endif /* TRE_MBSTATE */
} tre_backtrack_item_t;
typedef struct tre_backtrack_struct {
tre_backtrack_item_t item;
struct tre_backtrack_struct *prev;
struct tre_backtrack_struct *next;
} * tre_backtrack_t;
#ifdef TRE_MBSTATE
#define BT_STACK_MBSTATE_IN stack->item.mbstate = (mbstate)
#define BT_STACK_MBSTATE_OUT (mbstate) = stack->item.mbstate
#else /* !TRE_MBSTATE */
#define BT_STACK_MBSTATE_IN
#define BT_STACK_MBSTATE_OUT
#endif /* !TRE_MBSTATE */
#define tre_bt_mem_new tre_mem_new
#define tre_bt_mem_alloc tre_mem_alloc
#define tre_bt_mem_destroy tre_mem_destroy
#define BT_STACK_PUSH(_pos, _str_byte, _str_wide, _state, _state_id, _next_c, \
_tags, _mbstate) \
do { \
int i; \
if (!stack->next) { \
tre_backtrack_t s; \
s = tre_bt_mem_alloc(mem, sizeof(*s)); \
if (!s) { \
tre_bt_mem_destroy(mem); \
if (tags) free(tags), tags = NULL; \
if (pmatch) free(pmatch), pmatch = NULL; \
if (states_seen) free(states_seen), states_seen = NULL; \
return REG_ESPACE; \
} \
s->prev = stack; \
s->next = NULL; \
s->item.tags = tre_bt_mem_alloc(mem, sizeof(*tags) * tnfa->num_tags); \
if (!s->item.tags) { \
tre_bt_mem_destroy(mem); \
if (tags) free(tags), tags = NULL; \
if (pmatch) free(pmatch), pmatch = NULL; \
if (states_seen) free(states_seen), states_seen = NULL; \
return REG_ESPACE; \
} \
stack->next = s; \
stack = s; \
} else \
stack = stack->next; \
stack->item.pos = (_pos); \
stack->item.str_byte = (_str_byte); \
stack->item.state = (_state); \
stack->item.state_id = (_state_id); \
stack->item.next_c = (_next_c); \
for (i = 0; i < tnfa->num_tags; i++) stack->item.tags[i] = (_tags)[i]; \
BT_STACK_MBSTATE_IN; \
} while (0)
#define BT_STACK_POP() \
do { \
int i; \
_unassert(stack->prev); \
pos = stack->item.pos; \
str_byte = stack->item.str_byte; \
state = stack->item.state; \
next_c = stack->item.next_c; \
for (i = 0; i < tnfa->num_tags; i++) tags[i] = stack->item.tags[i]; \
BT_STACK_MBSTATE_OUT; \
stack = stack->prev; \
} while (0)
#undef MIN
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
static reg_errcode_t tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa,
const void *string,
regoff_t *match_tags, int eflags,
regoff_t *match_end_ofs) {
/* State variables required by GET_NEXT_WCHAR. */
tre_char_t prev_c = 0, next_c = 0;
const char *str_byte = string;
regoff_t pos = 0;
regoff_t pos_add_next = 1;
#ifdef TRE_MBSTATE
mbstate_t mbstate;
#endif /* TRE_MBSTATE */
int reg_notbol = eflags & REG_NOTBOL;
int reg_noteol = eflags & REG_NOTEOL;
int reg_newline = tnfa->cflags & REG_NEWLINE;
/* These are used to remember the necessary values of the above
variables to return to the position where the current search
started from. */
int next_c_start;
const char *str_byte_start;
regoff_t pos_start = -1;
#ifdef TRE_MBSTATE
mbstate_t mbstate_start;
#endif /* TRE_MBSTATE */
/* End offset of best match so far, or -1 if no match found yet. */
regoff_t match_eo = -1;
/* Tag arrays. */
int *next_tags;
regoff_t *tags = NULL;
/* Current TNFA state. */
tre_tnfa_transition_t *state;
int *states_seen = NULL;
/* Memory allocator to for allocating the backtracking stack. */
tre_mem_t mem = tre_bt_mem_new();
/* The backtracking stack. */
tre_backtrack_t stack;
tre_tnfa_transition_t *trans_i;
regmatch_t *pmatch = NULL;
int ret;
#ifdef TRE_MBSTATE
bzero(&mbstate, sizeof(mbstate));
#endif /* TRE_MBSTATE */
if (!mem) return REG_ESPACE;
stack = tre_bt_mem_alloc(mem, sizeof(*stack));
if (!stack) {
ret = REG_ESPACE;
goto error_exit;
}
stack->prev = NULL;
stack->next = NULL;
if (tnfa->num_tags) {
tags = malloc(sizeof(*tags) * tnfa->num_tags);
if (!tags) {
ret = REG_ESPACE;
goto error_exit;
}
}
if (tnfa->num_submatches) {
pmatch = malloc(sizeof(*pmatch) * tnfa->num_submatches);
if (!pmatch) {
ret = REG_ESPACE;
goto error_exit;
}
}
if (tnfa->num_states) {
states_seen = malloc(sizeof(*states_seen) * tnfa->num_states);
if (!states_seen) {
ret = REG_ESPACE;
goto error_exit;
}
}
retry : {
int i;
for (i = 0; i < tnfa->num_tags; i++) {
tags[i] = -1;
if (match_tags) match_tags[i] = -1;
}
for (i = 0; i < tnfa->num_states; i++) states_seen[i] = 0;
}
state = NULL;
pos = pos_start;
GET_NEXT_WCHAR();
pos_start = pos;
next_c_start = next_c;
str_byte_start = str_byte;
#ifdef TRE_MBSTATE
mbstate_start = mbstate;
#endif /* TRE_MBSTATE */
/* Handle initial states. */
next_tags = NULL;
for (trans_i = tnfa->initial; trans_i->state; trans_i++) {
if (trans_i->assertions && CHECK_ASSERTIONS(trans_i->assertions)) {
continue;
}
if (state == NULL) {
/* Start from this state. */
state = trans_i->state;
next_tags = trans_i->tags;
} else {
/* Backtrack to this state. */
BT_STACK_PUSH(pos, str_byte, 0, trans_i->state, trans_i->state_id, next_c,
tags, mbstate);
{
int *tmp = trans_i->tags;
if (tmp)
while (*tmp >= 0) stack->item.tags[*tmp++] = pos;
}
}
}
if (next_tags)
for (; *next_tags >= 0; next_tags++) tags[*next_tags] = pos;
if (state == NULL) goto backtrack;
while (1) {
tre_tnfa_transition_t *next_state;
int empty_br_match;
if (state == tnfa->final) {
if (match_eo < pos || (match_eo == pos && match_tags &&
tre_tag_order(tnfa->num_tags, tnfa->tag_directions,
tags, match_tags))) {
int i;
/* This match wins the previous match. */
match_eo = pos;
if (match_tags)
for (i = 0; i < tnfa->num_tags; i++) match_tags[i] = tags[i];
}
/* Our TNFAs never have transitions leaving from the final state,
so we jump right to backtracking. */
goto backtrack;
}
/* Go to the next character in the input string. */
empty_br_match = 0;
trans_i = state;
if (trans_i->state && trans_i->assertions & ASSERT_BACKREF) {
/* This is a back reference state. All transitions leaving from
this state have the same back reference "assertion". Instead
of reading the next character, we match the back reference. */
regoff_t so, eo;
int bt = trans_i->u.backref;
regoff_t bt_len;
int result;
/* Get the substring we need to match against. Remember to
turn off REG_NOSUB temporarily. */
tre_fill_pmatch(bt + 1, pmatch, tnfa->cflags & ~REG_NOSUB, tnfa, tags,
pos);
so = pmatch[bt].rm_so;
eo = pmatch[bt].rm_eo;
bt_len = eo - so;
result = strncmp((const char *)string + so, str_byte - 1, (size_t)bt_len);
if (result == 0) {
/* Back reference matched. Check for infinite loop. */
if (bt_len == 0) empty_br_match = 1;
if (empty_br_match && states_seen[trans_i->state_id]) {
goto backtrack;
}
states_seen[trans_i->state_id] = empty_br_match;
/* Advance in input string and resync `prev_c', `next_c'
and pos. */
str_byte += bt_len - 1;
pos += bt_len - 1;
GET_NEXT_WCHAR();
} else {
goto backtrack;
}
} else {
/* Check for end of string. */
if (next_c == L'\0') goto backtrack;
/* Read the next character. */
GET_NEXT_WCHAR();
}
next_state = NULL;
for (trans_i = state; trans_i->state; trans_i++) {
if (trans_i->code_min <= (tre_cint_t)prev_c &&
trans_i->code_max >= (tre_cint_t)prev_c) {
if (trans_i->assertions &&
(CHECK_ASSERTIONS(trans_i->assertions) ||
CHECK_CHAR_CLASSES(trans_i, tnfa, eflags))) {
continue;
}
if (next_state == NULL) {
/* First matching transition. */
next_state = trans_i->state;
next_tags = trans_i->tags;
} else {
/* Second matching transition. We may need to backtrack here
to take this transition instead of the first one, so we
push this transition in the backtracking stack so we can
jump back here if needed. */
BT_STACK_PUSH(pos, str_byte, 0, trans_i->state, trans_i->state_id,
next_c, tags, mbstate);
{
int *tmp;
for (tmp = trans_i->tags; tmp && *tmp >= 0; tmp++)
stack->item.tags[*tmp] = pos;
}
#if 0 /* XXX - it's important not to look at all transitions here to keep \
the stack small! */
break;
#endif
}
}
}
if (next_state != NULL) {
/* Matching transitions were found. Take the first one. */
state = next_state;
/* Update the tag values. */
if (next_tags)
while (*next_tags >= 0) tags[*next_tags++] = pos;
} else {
backtrack:
/* A matching transition was not found. Try to backtrack. */
if (stack->prev) {
if (stack->item.state->assertions & ASSERT_BACKREF) {
states_seen[stack->item.state_id] = 0;
}
BT_STACK_POP();
} else if (match_eo < 0) {
/* Try starting from a later position in the input string. */
/* Check for end of string. */
if (next_c == L'\0') {
break;
}
next_c = next_c_start;
#ifdef TRE_MBSTATE
mbstate = mbstate_start;
#endif /* TRE_MBSTATE */
str_byte = str_byte_start;
goto retry;
} else {
break;
}
}
}
ret = match_eo >= 0 ? REG_OK : REG_NOMATCH;
*match_end_ofs = match_eo;
error_exit:
tre_bt_mem_destroy(mem);
#ifndef TRE_USE_ALLOCA
if (tags) free(tags), tags = NULL;
if (pmatch) free(pmatch), pmatch = NULL;
if (states_seen) free(states_seen), states_seen = NULL;
#endif /* !TRE_USE_ALLOCA */
return ret;
}
/***********************************************************************
from regexec.c
***********************************************************************/
/* Fills the POSIX.2 regmatch_t array according to the TNFA tag and match
endpoint values. */
static void tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags,
const tre_tnfa_t *tnfa, regoff_t *tags,
regoff_t match_eo) {
tre_submatch_data_t *submatch_data;
unsigned int i, j;
int *parents;
i = 0;
if (match_eo >= 0 && !(cflags & REG_NOSUB)) {
/* Construct submatch offsets from the tags. */
submatch_data = tnfa->submatch_data;
while (i < tnfa->num_submatches && i < nmatch) {
if (submatch_data[i].so_tag == tnfa->end_tag)
pmatch[i].rm_so = match_eo;
else
pmatch[i].rm_so = tags[submatch_data[i].so_tag];
if (submatch_data[i].eo_tag == tnfa->end_tag)
pmatch[i].rm_eo = match_eo;
else
pmatch[i].rm_eo = tags[submatch_data[i].eo_tag];
/* If either of the endpoints were not used, this submatch
was not part of the match. */
if (pmatch[i].rm_so == -1 || pmatch[i].rm_eo == -1)
pmatch[i].rm_so = pmatch[i].rm_eo = -1;
i++;
}
/* Reset all submatches that are not within all of their parent
submatches. */
i = 0;
while (i < tnfa->num_submatches && i < nmatch) {
if (pmatch[i].rm_eo == -1) _unassert(pmatch[i].rm_so == -1);
_unassert(pmatch[i].rm_so <= pmatch[i].rm_eo);
parents = submatch_data[i].parents;
if (parents != NULL)
for (j = 0; parents[j] >= 0; j++) {
if (pmatch[i].rm_so < pmatch[parents[j]].rm_so ||
pmatch[i].rm_eo > pmatch[parents[j]].rm_eo)
pmatch[i].rm_so = pmatch[i].rm_eo = -1;
}
i++;
}
}
while (i < nmatch) {
pmatch[i].rm_so = -1;
pmatch[i].rm_eo = -1;
i++;
}
}
/**
* Executes regular expression.
*
* @param preg is state object previously made by regcomp()
* @param eflags can have REG_NOTBOL, REG_NOTEOL
* @return 0 or REG_NOMATCH
*/
int regexec(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t *pmatch, int eflags) {
tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
reg_errcode_t status;
regoff_t *tags = NULL, eo;
if (tnfa->cflags & REG_NOSUB) nmatch = 0;
if (tnfa->num_tags > 0 && nmatch > 0) {
tags = malloc(sizeof(*tags) * tnfa->num_tags);
if (tags == NULL) return REG_ESPACE;
}
/* Dispatch to the appropriate matcher. */
if (tnfa->have_backrefs) {
/* The regex has back references, use the backtracking matcher. */
status = tre_tnfa_run_backtrack(tnfa, string, tags, eflags, &eo);
} else {
/* Exact matching, no back references, use the parallel matcher. */
status = tre_tnfa_run_parallel(tnfa, string, tags, eflags, &eo);
}
if (status == REG_OK) /* A match was found, so fill the submatch registers. */
tre_fill_pmatch(nmatch, pmatch, tnfa->cflags, tnfa, tags, eo);
if (tags) free(tags), tags = NULL;
return status;
}
| 36,009 | 901 | jart/cosmopolitan | false |
cosmopolitan/third_party/regex/regex.h | #ifndef COSMOPOLITAN_LIBC_REGEX_REGEX_H_
#define COSMOPOLITAN_LIBC_REGEX_REGEX_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#if 0
/*ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â cosmopolitan § regular expressions ââ¬âââ¼
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#endif
#define REG_EXTENDED 1
#define REG_ICASE 2
#define REG_NEWLINE 4
#define REG_NOSUB 8
#define REG_NOTBOL 1 /* ^ should not match beginning of string */
#define REG_NOTEOL 2 /* $ should not match end of string */
#define REG_OK 0
#define REG_NOMATCH 1
#define REG_BADPAT 2
#define REG_ECOLLATE 3
#define REG_ECTYPE 4
#define REG_EESCAPE 5
#define REG_ESUBREG 6
#define REG_EBRACK 7
#define REG_EPAREN 8
#define REG_EBRACE 9
#define REG_BADBR 10
#define REG_ERANGE 11
#define REG_ESPACE 12
#define REG_BADRPT 13
#define REG_ENOSYS -1
typedef long regoff_t;
struct PosixRegex {
size_t re_nsub;
void *__opaque, *__padding[4];
size_t __nsub2;
char __padding2;
};
struct PosixRegexMatch {
regoff_t rm_so;
regoff_t rm_eo;
};
typedef struct PosixRegex regex_t;
typedef struct PosixRegexMatch regmatch_t;
int regcomp(regex_t *, const char *, int);
int regexec(const regex_t *, const char *, size_t, regmatch_t *, int);
size_t regerror(int, const regex_t *, char *, size_t);
void regfree(regex_t *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_REGEX_REGEX_H_ */
| 1,883 | 62 | jart/cosmopolitan | false |
cosmopolitan/third_party/regex/regcomp.c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â â
â regcomp.c - TRE POSIX compatible regex compilation functions. â
â â
â Copyright (c) 2001-2009 Ville Laurikari <[email protected]> â
â All rights reserved. â
â â
â Redistribution and use in source and binary forms, with or without â
â modification, are permitted provided that the following conditions â
â are met: â
â â
â 1. Redistributions of source code must retain the above copyright â
â notice, this list of conditions and the following disclaimer. â
â â
â 2. Redistributions in binary form must reproduce the above copyright â
â notice, this list of conditions and the following disclaimer in â
â the documentation and/or other materials provided with the â
â distribution. â
â â
â THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS â
â ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT â
â LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR â
â A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT â
â HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, â
â SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT â
â LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, â
â DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY â
â THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT â
â (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE â
â OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. â
â â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â â
â Musl Libc â
â Copyright © 2005-2014 Rich Felker, et al. â
â â
â Permission is hereby granted, free of charge, to any person obtaining â
â a copy of this software and associated documentation files (the â
â "Software"), to deal in the Software without restriction, including â
â without limitation the rights to use, copy, modify, merge, publish, â
â distribute, sublicense, and/or sell copies of the Software, and to â
â permit persons to whom the Software is furnished to do so, subject to â
â the following conditions: â
â â
â The above copyright notice and this permission notice shall be â
â included in all copies or substantial portions of the Software. â
â â
â THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, â
â EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF â
â MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. â
â IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY â
â CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, â
â TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE â
â SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. â
â â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/mem/alg.h"
#include "third_party/regex/tre.inc"
#define CHARCLASS_NAME_MAX 14
#define RE_DUP_MAX 255
/***********************************************************************
from tre-compile.h
***********************************************************************/
typedef struct {
int position;
int code_min;
int code_max;
int *tags;
int assertions;
tre_ctype_t class;
tre_ctype_t *neg_classes;
int backref;
} tre_pos_and_tags_t;
/***********************************************************************
from tre-ast.c and tre-ast.h
***********************************************************************/
/* The different AST node types. */
typedef enum { LITERAL, CATENATION, ITERATION, UNION } tre_ast_type_t;
/* Special subtypes of TRE_LITERAL. */
#define EMPTY -1 /* Empty leaf (denotes empty string). */
#define ASSERTION -2 /* Assertion leaf. */
#define TAG -3 /* Tag leaf. */
#define BACKREF -4 /* Back reference leaf. */
#define IS_SPECIAL(x) ((x)->code_min < 0)
#define IS_EMPTY(x) ((x)->code_min == EMPTY)
#define IS_ASSERTION(x) ((x)->code_min == ASSERTION)
#define IS_TAG(x) ((x)->code_min == TAG)
#define IS_BACKREF(x) ((x)->code_min == BACKREF)
/* A generic AST node. All AST nodes consist of this node on the top
level with `obj' pointing to the actual content. */
typedef struct {
tre_ast_type_t type; /* Type of the node. */
void *obj; /* Pointer to actual node. */
int nullable;
int submatch_id;
int num_submatches;
int num_tags;
tre_pos_and_tags_t *firstpos;
tre_pos_and_tags_t *lastpos;
} tre_ast_node_t;
/* A "literal" node. These are created for assertions, back references,
tags, matching parameter settings, and all expressions that match one
character. */
typedef struct {
long code_min;
long code_max;
int position;
tre_ctype_t class;
tre_ctype_t *neg_classes;
} tre_literal_t;
/* A "catenation" node. These are created when two regexps are concatenated.
If there are more than one subexpressions in sequence, the `left' part
holds all but the last, and `right' part holds the last subexpression
(catenation is left associative). */
typedef struct {
tre_ast_node_t *left;
tre_ast_node_t *right;
} tre_catenation_t;
/* An "iteration" node. These are created for the "*", "+", "?", and "{m,n}"
operators. */
typedef struct {
/* Subexpression to match. */
tre_ast_node_t *arg;
/* Minimum number of consecutive matches. */
int min;
/* Maximum number of consecutive matches. */
int max;
/* If 0, match as many characters as possible, if 1 match as few as
possible. Note that this does not always mean the same thing as
matching as many/few repetitions as possible. */
unsigned int minimal : 1;
} tre_iteration_t;
/* An "union" node. These are created for the "|" operator. */
typedef struct {
tre_ast_node_t *left;
tre_ast_node_t *right;
} tre_union_t;
static tre_ast_node_t *tre_ast_new_node(tre_mem_t mem, int type, void *obj) {
tre_ast_node_t *node = tre_mem_calloc(mem, sizeof *node);
if (!node || !obj) return 0;
node->obj = obj;
node->type = type;
node->nullable = -1;
node->submatch_id = -1;
return node;
}
static tre_ast_node_t *tre_ast_new_literal(tre_mem_t mem, int code_min,
int code_max, int position) {
tre_ast_node_t *node;
tre_literal_t *lit;
lit = tre_mem_calloc(mem, sizeof *lit);
node = tre_ast_new_node(mem, LITERAL, lit);
if (!node) return 0;
lit->code_min = code_min;
lit->code_max = code_max;
lit->position = position;
return node;
}
static tre_ast_node_t *tre_ast_new_iter(tre_mem_t mem, tre_ast_node_t *arg,
int min, int max, int minimal) {
tre_ast_node_t *node;
tre_iteration_t *iter;
iter = tre_mem_calloc(mem, sizeof *iter);
node = tre_ast_new_node(mem, ITERATION, iter);
if (!node) return 0;
iter->arg = arg;
iter->min = min;
iter->max = max;
iter->minimal = minimal;
node->num_submatches = arg->num_submatches;
return node;
}
static tre_ast_node_t *tre_ast_new_union(tre_mem_t mem, tre_ast_node_t *left,
tre_ast_node_t *right) {
tre_ast_node_t *node;
tre_union_t *un;
if (!left) return right;
un = tre_mem_calloc(mem, sizeof *un);
node = tre_ast_new_node(mem, UNION, un);
if (!node || !right) return 0;
un->left = left;
un->right = right;
node->num_submatches = left->num_submatches + right->num_submatches;
return node;
}
static tre_ast_node_t *tre_ast_new_catenation(tre_mem_t mem,
tre_ast_node_t *left,
tre_ast_node_t *right) {
tre_ast_node_t *node;
tre_catenation_t *cat;
if (!left) return right;
cat = tre_mem_calloc(mem, sizeof *cat);
node = tre_ast_new_node(mem, CATENATION, cat);
if (!node) return 0;
cat->left = left;
cat->right = right;
node->num_submatches = left->num_submatches + right->num_submatches;
return node;
}
/***********************************************************************
from tre-stack.c and tre-stack.h
***********************************************************************/
typedef struct tre_stack_rec tre_stack_t;
/* Creates a new stack object. `size' is initial size in bytes, `max_size'
is maximum size, and `increment' specifies how much more space will be
allocated with realloc() if all space gets used up. Returns the stack
object or NULL if out of memory. */
static tre_stack_t *tre_stack_new(int size, int max_size, int increment);
/* Frees the stack object. */
static void tre_stack_destroy(tre_stack_t *s);
/* Returns the current number of objects in the stack. */
static int tre_stack_num_objects(tre_stack_t *s);
/* Each tre_stack_push_*(tre_stack_t *s, <type> value) function pushes
`value' on top of stack `s'. Returns REG_ESPACE if out of memory.
This tries to realloc() more space before failing if maximum size
has not yet been reached. Returns REG_OK if successful. */
#define declare_pushf(typetag, type) \
static reg_errcode_t tre_stack_push_##typetag(tre_stack_t *s, type value)
declare_pushf(voidptr, void *);
declare_pushf(int, int);
/* Each tre_stack_pop_*(tre_stack_t *s) function pops the topmost
element off of stack `s' and returns it. The stack must not be
empty. */
#define declare_popf(typetag, type) \
static type tre_stack_pop_##typetag(tre_stack_t *s)
declare_popf(voidptr, void *);
declare_popf(int, int);
/* Just to save some typing. */
#define STACK_PUSH(s, typetag, value) \
do { \
status = tre_stack_push_##typetag(s, value); \
} while (/*CONSTCOND*/ 0)
#define STACK_PUSHX(s, typetag, value) \
{ \
status = tre_stack_push_##typetag(s, value); \
if (status != REG_OK) break; \
}
#define STACK_PUSHR(s, typetag, value) \
{ \
reg_errcode_t _status; \
_status = tre_stack_push_##typetag(s, value); \
if (_status != REG_OK) return _status; \
}
union tre_stack_item {
void *voidptr_value;
int int_value;
};
struct tre_stack_rec {
int size;
int max_size;
int increment;
int ptr;
union tre_stack_item *stack;
};
static tre_stack_t *tre_stack_new(int size, int max_size, int increment) {
tre_stack_t *s;
s = malloc(sizeof(*s));
if (s != NULL) {
s->stack = malloc(sizeof(*s->stack) * size);
if (s->stack == NULL) {
free(s), s = NULL;
return NULL;
}
s->size = size;
s->max_size = max_size;
s->increment = increment;
s->ptr = 0;
}
return s;
}
static void tre_stack_destroy(tre_stack_t *s) {
free(s->stack), s->stack = NULL;
free(s), s = NULL;
}
static int tre_stack_num_objects(tre_stack_t *s) {
return s->ptr;
}
static reg_errcode_t tre_stack_push(tre_stack_t *s,
union tre_stack_item value) {
if (s->ptr < s->size) {
s->stack[s->ptr] = value;
s->ptr++;
} else {
if (s->size >= s->max_size) {
return REG_ESPACE;
} else {
union tre_stack_item *new_buffer;
int new_size;
new_size = s->size + s->increment;
if (new_size > s->max_size) new_size = s->max_size;
new_buffer = realloc(s->stack, sizeof(*new_buffer) * new_size);
if (new_buffer == NULL) {
return REG_ESPACE;
}
_unassert(new_size > s->size);
s->size = new_size;
s->stack = new_buffer;
tre_stack_push(s, value);
}
}
return REG_OK;
}
#define define_pushf(typetag, type) \
declare_pushf(typetag, type) { \
union tre_stack_item item; \
item.typetag##_value = value; \
return tre_stack_push(s, item); \
}
define_pushf(int, int) define_pushf(voidptr, void *)
#define define_popf(typetag, type) \
declare_popf(typetag, type) { \
return s->stack[--s->ptr].typetag##_value; \
}
define_popf(int, int) define_popf(voidptr, void *)
/***********************************************************************
from tre-parse.c and tre-parse.h
***********************************************************************/
/* Parse context. */
typedef struct {
/* Memory allocator. The AST is allocated using this. */
tre_mem_t mem;
/* Stack used for keeping track of regexp syntax. */
tre_stack_t *stack;
/* The parsed node after a parse function returns. */
tre_ast_node_t *n;
/* Position in the regexp pattern after a parse function returns. */
const char *s;
/* The first character of the last subexpression parsed. */
const char *start;
/* Current submatch ID. */
int submatch_id;
/* Current position (number of literal). */
int position;
/* The highest back reference or -1 if none seen so far. */
int max_backref;
/* Compilation flags. */
int cflags;
} tre_parse_ctx_t;
/* Some macros for expanding \w, \s, etc. */
static const struct {
char c;
const char *expansion;
} tre_macros[] = {
{'t', "\t"},
{'n', "\n"},
{'r', "\r"},
{'f', "\f"},
{'a', "\a"},
{'e', "\033"},
{'w', "[[:alnum:]_]"},
{'W', "[^[:alnum:]_]"},
{'s', "[[:space:]]"},
{'S', "[^[:space:]]"},
{'d', "[[:digit:]]"},
{'D', "[^[:digit:]]"},
{0, 0},
};
/* Expands a macro delimited by `regex' and `regex_end' to `buf', which
must have at least `len' items. Sets buf[0] to zero if the there
is no match in `tre_macros'. */
static const char *tre_expand_macro(const char *s) {
int i;
for (i = 0; tre_macros[i].c && tre_macros[i].c != *s; i++)
;
return tre_macros[i].expansion;
}
static int tre_compare_lit(const void *a, const void *b) {
const tre_literal_t *const *la = a;
const tre_literal_t *const *lb = b;
/* assumes the range of valid code_min is < INT_MAX */
return la[0]->code_min - lb[0]->code_min;
}
struct literals {
tre_mem_t mem;
tre_literal_t **a;
int len;
int cap;
};
static tre_literal_t *tre_new_lit(struct literals *p) {
tre_literal_t **a;
if (p->len >= p->cap) {
if (p->cap >= 1 << 15) return 0;
p->cap *= 2;
a = realloc(p->a, p->cap * sizeof *p->a);
if (!a) return 0;
p->a = a;
}
a = p->a + p->len++;
*a = tre_mem_calloc(p->mem, sizeof **a);
return *a;
}
static int add_icase_literals(struct literals *ls, int min, int max) {
tre_literal_t *lit;
int b, e, c;
for (c = min; c <= max;) {
/* assumes islower(c) and isupper(c) are exclusive
and toupper(c)!=c if islower(c).
multiple opposite case characters are not supported */
if (tre_islower(c)) {
b = e = tre_toupper(c);
for (c++, e++; c <= max; c++, e++)
if (tre_toupper(c) != e) break;
} else if (tre_isupper(c)) {
b = e = tre_tolower(c);
for (c++, e++; c <= max; c++, e++)
if (tre_tolower(c) != e) break;
} else {
c++;
continue;
}
lit = tre_new_lit(ls);
if (!lit) return -1;
lit->code_min = b;
lit->code_max = e - 1;
lit->position = -1;
}
return 0;
}
/* Maximum number of character classes in a negated bracket expression. */
#define MAX_NEG_CLASSES 64
struct neg {
int negate;
int len;
tre_ctype_t a[MAX_NEG_CLASSES];
};
// TODO: parse bracket into a set of non-overlapping [lo,hi] ranges
/*
bracket grammar:
Bracket = '[' List ']' | '[^' List ']'
List = Term | List Term
Term = Char | Range | Chclass | Eqclass
Range = Char '-' Char | Char '-' '-'
Char = Coll | coll_single
Meta = ']' | '-'
Coll = '[.' coll_single '.]' | '[.' coll_multi '.]' | '[.' Meta '.]'
Eqclass = '[=' coll_single '=]' | '[=' coll_multi '=]'
Chclass = '[:' class ':]'
coll_single is a single char collating element but it can be
'-' only at the beginning or end of a List and
']' only at the beginning of a List and
'^' anywhere except after the openning '['
*/
static reg_errcode_t parse_bracket_terms(tre_parse_ctx_t *ctx, const char *s,
struct literals *ls, struct neg *neg) {
const char *start = s;
tre_ctype_t class;
int min, max;
wchar_t wc;
int len;
for (;;) {
class = 0;
len = mbtowc(&wc, s, -1);
if (len <= 0) return *s ? REG_BADPAT : REG_EBRACK;
if (*s == ']' && s != start) {
ctx->s = s + 1;
return REG_OK;
}
if (*s == '-' && s != start && s[1] != ']' &&
/* extension: [a-z--@] is accepted as [a-z]|[--@] */
(s[1] != '-' || s[2] == ']')) {
return REG_ERANGE;
}
if (*s == '[' && (s[1] == '.' || s[1] == '=')) {
/* collating symbols and equivalence classes are not supported */
return REG_ECOLLATE;
}
if (*s == '[' && s[1] == ':') {
char tmp[CHARCLASS_NAME_MAX + 1];
s += 2;
for (len = 0; len < CHARCLASS_NAME_MAX && s[len]; len++) {
if (s[len] == ':') {
memcpy(tmp, s, len);
tmp[len] = 0;
class = tre_ctype(tmp);
break;
}
}
if (!class || s[len + 1] != ']') return REG_ECTYPE;
min = 0;
max = TRE_CHAR_MAX;
s += len + 2;
} else {
min = max = wc;
s += len;
if (*s == '-' && s[1] != ']') {
s++;
len = mbtowc(&wc, s, -1);
max = wc;
/* XXX - Should use collation order instead of
encoding values in character ranges. */
if (len <= 0 || min > max) {
return REG_ERANGE;
}
s += len;
}
}
if (class && neg->negate) {
if (neg->len >= MAX_NEG_CLASSES) return REG_ESPACE;
neg->a[neg->len++] = class;
} else {
tre_literal_t *lit = tre_new_lit(ls);
if (!lit) return REG_ESPACE;
lit->code_min = min;
lit->code_max = max;
lit->class = class;
lit->position = -1;
/* Add opposite-case codepoints if REG_ICASE is present.
It seems that POSIX requires that bracket negation
should happen before case-folding, but most practical
implementations do it the other way around. Changing
the order would need efficient representation of
case-fold ranges and bracket range sets even with
simple patterns so this is ok for now. */
if (ctx->cflags & REG_ICASE && !class)
if (add_icase_literals(ls, min, max)) return REG_ESPACE;
}
}
}
static reg_errcode_t parse_bracket(tre_parse_ctx_t *ctx, const char *s) {
int i, max, min, negmax, negmin;
tre_ast_node_t *node = 0, *n;
tre_ctype_t *nc = 0;
tre_literal_t *lit;
struct literals ls;
struct neg neg;
reg_errcode_t err;
ls.mem = ctx->mem;
ls.len = 0;
ls.cap = 32;
ls.a = malloc(ls.cap * sizeof *ls.a);
if (!ls.a) return REG_ESPACE;
neg.len = 0;
neg.negate = *s == '^';
if (neg.negate) s++;
err = parse_bracket_terms(ctx, s, &ls, &neg);
if (err != REG_OK) goto parse_bracket_done;
if (neg.negate) {
/*
* With REG_NEWLINE, POSIX requires that newlines are not matched by
* any form of a non-matching list.
*/
if (ctx->cflags & REG_NEWLINE) {
lit = tre_new_lit(&ls);
if (!lit) {
err = REG_ESPACE;
goto parse_bracket_done;
}
lit->code_min = '\n';
lit->code_max = '\n';
lit->position = -1;
}
/* Sort the array if we need to negate it. */
qsort(ls.a, ls.len, sizeof *ls.a, tre_compare_lit);
/* extra lit for the last negated range */
lit = tre_new_lit(&ls);
if (!lit) {
err = REG_ESPACE;
goto parse_bracket_done;
}
lit->code_min = TRE_CHAR_MAX + 1;
lit->code_max = TRE_CHAR_MAX + 1;
lit->position = -1;
/* negated classes */
if (neg.len) {
nc = tre_mem_alloc(ctx->mem, (neg.len + 1) * sizeof *neg.a);
if (!nc) {
err = REG_ESPACE;
goto parse_bracket_done;
}
memcpy(nc, neg.a, neg.len * sizeof *neg.a);
nc[neg.len] = 0;
}
}
/* Build a union of the items in the array, negated if necessary. */
negmax = negmin = 0;
for (i = 0; i < ls.len; i++) {
lit = ls.a[i];
min = lit->code_min;
max = lit->code_max;
if (neg.negate) {
if (min <= negmin) {
/* Overlap. */
negmin = MAX(max + 1, negmin);
continue;
}
negmax = min - 1;
lit->code_min = negmin;
lit->code_max = negmax;
negmin = max + 1;
}
lit->position = ctx->position;
lit->neg_classes = nc;
n = tre_ast_new_node(ctx->mem, LITERAL, lit);
node = tre_ast_new_union(ctx->mem, node, n);
if (!node) {
err = REG_ESPACE;
break;
}
}
parse_bracket_done:
free(ls.a), ls.a = NULL;
ctx->position++;
ctx->n = node;
return err;
}
static const char *parse_dup_count(const char *s, int *n) {
*n = -1;
if (!isdigit(*s)) return s;
*n = 0;
for (;;) {
*n = 10 * *n + (*s - '0');
s++;
if (!isdigit(*s) || *n > RE_DUP_MAX) break;
}
return s;
}
static const char *parse_dup(const char *s, int ere, int *pmin, int *pmax) {
int min, max;
s = parse_dup_count(s, &min);
if (*s == ',')
s = parse_dup_count(s + 1, &max);
else
max = min;
if ((max < min && max >= 0) || max > RE_DUP_MAX || min > RE_DUP_MAX ||
min < 0 || (!ere && *s++ != '\\') || *s++ != '}')
return 0;
*pmin = min;
*pmax = max;
return s;
}
static int hexval(unsigned c) {
if (c - '0' < 10) return c - '0';
c |= 32;
if (c - 'a' < 6) return c - 'a' + 10;
return -1;
}
static reg_errcode_t marksub(tre_parse_ctx_t *ctx, tre_ast_node_t *node,
int subid) {
if (node->submatch_id >= 0) {
tre_ast_node_t *n = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
if (!n) return REG_ESPACE;
n = tre_ast_new_catenation(ctx->mem, n, node);
if (!n) return REG_ESPACE;
n->num_submatches = node->num_submatches;
node = n;
}
node->submatch_id = subid;
node->num_submatches++;
ctx->n = node;
return REG_OK;
}
/*
BRE grammar:
Regex = Branch | '^' | '$' | '^$' | '^' Branch | Branch '$' | '^'
Branch '$' Branch = Atom | Branch Atom Atom = char | quoted_char | '.'
| Bracket | Atom Dup | '\(' Branch '\)' | back_ref Dup = '*' | '\{'
Count '\}' | '\{' Count ',\}' | '\{' Count ',' Count '\}'
(leading ^ and trailing $ in a sub expr may be an anchor or literal as well)
ERE grammar:
Regex = Branch | Regex '|' Branch
Branch = Atom | Branch Atom
Atom = char | quoted_char | '.' | Bracket | Atom Dup | '(' Regex
')' | '^' | '$' Dup = '*' | '+' | '?' | '{' Count '}' | '{'
Count ',}' | '{' Count ',' Count '}'
(a*+?, ^*, $+, \X, {, (|a) are unspecified)
*/
static reg_errcode_t parse_atom(tre_parse_ctx_t *ctx, const char *s) {
int len, ere = ctx->cflags & REG_EXTENDED;
const char *p;
tre_ast_node_t *node;
wchar_t wc;
switch (*s) {
case '[':
return parse_bracket(ctx, s + 1);
case '\\':
p = tre_expand_macro(s + 1);
if (p) {
/* assume \X expansion is a single atom */
reg_errcode_t err = parse_atom(ctx, p);
ctx->s = s + 2;
return err;
}
/* extensions: \b, \B, \<, \>, \xHH \x{HHHH} */
switch (*++s) {
case 0:
return REG_EESCAPE;
case 'b':
node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_WB, -1);
break;
case 'B':
node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_WB_NEG, -1);
break;
case '<':
node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_BOW, -1);
break;
case '>':
node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_EOW, -1);
break;
case 'x':
s++;
int i, v = 0, c;
len = 2;
if (*s == '{') {
len = 8;
s++;
}
for (i = 0; i < len && v < 0x110000; i++) {
c = hexval(s[i]);
if (c < 0) break;
v = 16 * v + c;
}
s += i;
if (len == 8) {
if (*s != '}') return REG_EBRACE;
s++;
}
node = tre_ast_new_literal(ctx->mem, v, v, ctx->position++);
s--;
break;
case '{':
case '+':
case '?':
/* extension: treat \+, \? as repetitions in BRE */
/* reject repetitions after empty expression in BRE */
if (!ere) return REG_BADRPT;
/* fallthrough */
case '|':
/* extension: treat \| as alternation in BRE */
if (!ere) {
node = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
s--;
goto end;
}
/* fallthrough */
default:
if (!ere && (unsigned)*s - '1' < 9) {
/* back reference */
int val = *s - '0';
node = tre_ast_new_literal(ctx->mem, BACKREF, val, ctx->position++);
ctx->max_backref = MAX(val, ctx->max_backref);
} else {
/* extension: accept unknown escaped char
as a literal */
goto parse_literal;
}
}
s++;
break;
case '.':
if (ctx->cflags & REG_NEWLINE) {
tre_ast_node_t *tmp1, *tmp2;
tmp1 = tre_ast_new_literal(ctx->mem, 0, '\n' - 1, ctx->position++);
tmp2 = tre_ast_new_literal(ctx->mem, '\n' + 1, TRE_CHAR_MAX,
ctx->position++);
if (tmp1 && tmp2)
node = tre_ast_new_union(ctx->mem, tmp1, tmp2);
else
node = 0;
} else {
node = tre_ast_new_literal(ctx->mem, 0, TRE_CHAR_MAX, ctx->position++);
}
s++;
break;
case '^':
/* '^' has a special meaning everywhere in EREs, and at beginning of BRE.
*/
if (!ere && s != ctx->start) goto parse_literal;
node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_BOL, -1);
s++;
break;
case '$':
/* '$' is special everywhere in EREs, and at the end of a BRE
* subexpression. */
if (!ere && s[1] && (s[1] != '\\' || (s[2] != ')' && s[2] != '|')))
goto parse_literal;
node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_EOL, -1);
s++;
break;
case '*':
case '{':
case '+':
case '?':
/* reject repetitions after empty expression in ERE */
if (ere) return REG_BADRPT;
/* fallthrough */
case '|':
if (!ere) goto parse_literal;
/* fallthrough */
case 0:
node = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
break;
default:
parse_literal:
len = mbtowc(&wc, s, -1);
if (len < 0) return REG_BADPAT;
if (ctx->cflags & REG_ICASE && (tre_isupper(wc) || tre_islower(wc))) {
tre_ast_node_t *tmp1, *tmp2;
/* multiple opposite case characters are not supported */
tmp1 = tre_ast_new_literal(ctx->mem, tre_toupper(wc), tre_toupper(wc),
ctx->position);
tmp2 = tre_ast_new_literal(ctx->mem, tre_tolower(wc), tre_tolower(wc),
ctx->position);
if (tmp1 && tmp2)
node = tre_ast_new_union(ctx->mem, tmp1, tmp2);
else
node = 0;
} else {
node = tre_ast_new_literal(ctx->mem, wc, wc, ctx->position);
}
ctx->position++;
s += len;
break;
}
end:
if (!node) return REG_ESPACE;
ctx->n = node;
ctx->s = s;
return REG_OK;
}
#define PUSHPTR(err, s, v) \
do { \
if ((err = tre_stack_push_voidptr(s, v)) != REG_OK) return err; \
} while (0)
#define PUSHINT(err, s, v) \
do { \
if ((err = tre_stack_push_int(s, v)) != REG_OK) return err; \
} while (0)
static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx) {
tre_ast_node_t *nbranch = 0, *nunion = 0;
int ere = ctx->cflags & REG_EXTENDED;
const char *s = ctx->start;
int subid = 0;
int depth = 0;
reg_errcode_t err;
tre_stack_t *stack = ctx->stack;
PUSHINT(err, stack, subid++);
for (;;) {
if ((!ere && *s == '\\' && s[1] == '(') || (ere && *s == '(')) {
PUSHPTR(err, stack, nunion);
PUSHPTR(err, stack, nbranch);
PUSHINT(err, stack, subid++);
s++;
if (!ere) s++;
depth++;
nbranch = nunion = 0;
ctx->start = s;
continue;
}
if ((!ere && *s == '\\' && s[1] == ')') || (ere && *s == ')' && depth)) {
ctx->n = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
if (!ctx->n) return REG_ESPACE;
} else {
err = parse_atom(ctx, s);
if (err != REG_OK) return err;
s = ctx->s;
}
parse_iter:
for (;;) {
int min, max;
if (*s != '\\' && *s != '*') {
if (!ere) break;
if (*s != '+' && *s != '?' && *s != '{') break;
}
if (*s == '\\' && ere) break;
/* extension: treat \+, \? as repetitions in BRE */
if (*s == '\\' && s[1] != '+' && s[1] != '?' && s[1] != '{') break;
if (*s == '\\') s++;
/* handle ^* at the start of a BRE. */
if (!ere && s == ctx->start + 1 && s[-1] == '^') break;
/* extension: multiple consecutive *+?{,} is unspecified,
but (a+)+ has to be supported so accepting a++ makes
sense, note however that the RE_DUP_MAX limit can be
circumvented: (a{255}){255} uses a lot of memory.. */
if (*s == '{') {
s = parse_dup(s + 1, ere, &min, &max);
if (!s) return REG_BADBR;
} else {
min = 0;
max = -1;
if (*s == '+') min = 1;
if (*s == '?') max = 1;
s++;
}
if (max == 0)
ctx->n = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
else
ctx->n = tre_ast_new_iter(ctx->mem, ctx->n, min, max, 0);
if (!ctx->n) return REG_ESPACE;
}
nbranch = tre_ast_new_catenation(ctx->mem, nbranch, ctx->n);
if ((ere && *s == '|') || (ere && *s == ')' && depth) ||
(!ere && *s == '\\' && s[1] == ')') ||
/* extension: treat \| as alternation in BRE */
(!ere && *s == '\\' && s[1] == '|') || !*s) {
/* extension: empty branch is unspecified (), (|a), (a|)
here they are not rejected but match on empty string */
int c = *s;
nunion = tre_ast_new_union(ctx->mem, nunion, nbranch);
nbranch = 0;
if (c == '\\' && s[1] == '|') {
s += 2;
ctx->start = s;
} else if (c == '|') {
s++;
ctx->start = s;
} else {
if (c == '\\') {
if (!depth) return REG_EPAREN;
s += 2;
} else if (c == ')')
s++;
depth--;
err = marksub(ctx, nunion, tre_stack_pop_int(stack));
if (err != REG_OK) return err;
if (!c && depth < 0) {
ctx->submatch_id = subid;
return REG_OK;
}
if (!c || depth < 0) return REG_EPAREN;
nbranch = tre_stack_pop_voidptr(stack);
nunion = tre_stack_pop_voidptr(stack);
goto parse_iter;
}
}
}
}
/***********************************************************************
from tre-compile.c
***********************************************************************/
/*
TODO:
- Fix tre_ast_to_tnfa() to recurse using a stack instead of recursive
function calls.
*/
/*
Algorithms to setup tags so that submatch addressing can be done.
*/
/* Inserts a catenation node to the root of the tree given in `node'.
As the left child a new tag with number `tag_id' to `node' is added,
and the right child is the old root. */
static reg_errcode_t tre_add_tag_left(tre_mem_t mem, tre_ast_node_t *node,
int tag_id) {
tre_catenation_t *c;
c = tre_mem_alloc(mem, sizeof(*c));
if (c == NULL) return REG_ESPACE;
c->left = tre_ast_new_literal(mem, TAG, tag_id, -1);
if (c->left == NULL) return REG_ESPACE;
c->right = tre_mem_alloc(mem, sizeof(tre_ast_node_t));
if (c->right == NULL) return REG_ESPACE;
c->right->obj = node->obj;
c->right->type = node->type;
c->right->nullable = -1;
c->right->submatch_id = -1;
c->right->firstpos = NULL;
c->right->lastpos = NULL;
c->right->num_tags = 0;
c->right->num_submatches = 0;
node->obj = c;
node->type = CATENATION;
return REG_OK;
}
/* Inserts a catenation node to the root of the tree given in `node'.
As the right child a new tag with number `tag_id' to `node' is added,
and the left child is the old root. */
static reg_errcode_t tre_add_tag_right(tre_mem_t mem, tre_ast_node_t *node,
int tag_id) {
tre_catenation_t *c;
c = tre_mem_alloc(mem, sizeof(*c));
if (c == NULL) return REG_ESPACE;
c->right = tre_ast_new_literal(mem, TAG, tag_id, -1);
if (c->right == NULL) return REG_ESPACE;
c->left = tre_mem_alloc(mem, sizeof(tre_ast_node_t));
if (c->left == NULL) return REG_ESPACE;
c->left->obj = node->obj;
c->left->type = node->type;
c->left->nullable = -1;
c->left->submatch_id = -1;
c->left->firstpos = NULL;
c->left->lastpos = NULL;
c->left->num_tags = 0;
c->left->num_submatches = 0;
node->obj = c;
node->type = CATENATION;
return REG_OK;
}
typedef enum {
ADDTAGS_RECURSE,
ADDTAGS_AFTER_ITERATION,
ADDTAGS_AFTER_UNION_LEFT,
ADDTAGS_AFTER_UNION_RIGHT,
ADDTAGS_AFTER_CAT_LEFT,
ADDTAGS_AFTER_CAT_RIGHT,
ADDTAGS_SET_SUBMATCH_END
} tre_addtags_symbol_t;
typedef struct {
int tag;
int next_tag;
} tre_tag_states_t;
/* Go through `regset' and set submatch data for submatches that are
using this tag. */
static void tre_purge_regset(int *regset, tre_tnfa_t *tnfa, int tag) {
int i;
for (i = 0; regset[i] >= 0; i++) {
int id = regset[i] / 2;
int start = !(regset[i] % 2);
if (start)
tnfa->submatch_data[id].so_tag = tag;
else
tnfa->submatch_data[id].eo_tag = tag;
}
regset[0] = -1;
}
/* Adds tags to appropriate locations in the parse tree in `tree', so that
subexpressions marked for submatch addressing can be traced. */
static reg_errcode_t tre_add_tags(tre_mem_t mem, tre_stack_t *stack,
tre_ast_node_t *tree, tre_tnfa_t *tnfa) {
reg_errcode_t status = REG_OK;
tre_addtags_symbol_t symbol;
tre_ast_node_t *node = tree; /* Tree node we are currently looking at. */
int bottom = tre_stack_num_objects(stack);
/* True for first pass (counting number of needed tags) */
int first_pass = (mem == NULL || tnfa == NULL);
int *regset, *orig_regset;
int num_tags = 0; /* Total number of tags. */
int num_minimals = 0; /* Number of special minimal tags. */
int tag = 0; /* The tag that is to be added next. */
int next_tag = 1; /* Next tag to use after this one. */
int *parents; /* Stack of submatches the current submatch is
contained in. */
int minimal_tag = -1; /* Tag that marks the beginning of a minimal match. */
tre_tag_states_t *saved_states;
tre_tag_direction_t direction = TRE_TAG_MINIMIZE;
if (!first_pass) {
tnfa->end_tag = 0;
tnfa->minimal_tags[0] = -1;
}
regset = malloc(sizeof(*regset) * ((tnfa->num_submatches + 1) * 2));
if (regset == NULL) return REG_ESPACE;
regset[0] = -1;
orig_regset = regset;
parents = malloc(sizeof(*parents) * (tnfa->num_submatches + 1));
if (parents == NULL) {
free(regset), regset = NULL;
return REG_ESPACE;
}
parents[0] = -1;
saved_states = malloc(sizeof(*saved_states) * (tnfa->num_submatches + 1));
if (saved_states == NULL) {
free(regset), regset = NULL;
free(parents), parents = NULL;
return REG_ESPACE;
} else {
unsigned int i;
for (i = 0; i <= tnfa->num_submatches; i++) saved_states[i].tag = -1;
}
STACK_PUSH(stack, voidptr, node);
STACK_PUSH(stack, int, ADDTAGS_RECURSE);
while (tre_stack_num_objects(stack) > bottom) {
if (status != REG_OK) break;
symbol = (tre_addtags_symbol_t)tre_stack_pop_int(stack);
switch (symbol) {
case ADDTAGS_SET_SUBMATCH_END: {
int id = tre_stack_pop_int(stack);
int i;
/* Add end of this submatch to regset. */
for (i = 0; regset[i] >= 0; i++)
;
regset[i] = id * 2 + 1;
regset[i + 1] = -1;
/* Pop this submatch from the parents stack. */
for (i = 0; parents[i] >= 0; i++)
;
parents[i - 1] = -1;
break;
}
case ADDTAGS_RECURSE:
node = tre_stack_pop_voidptr(stack);
if (node->submatch_id >= 0) {
int id = node->submatch_id;
int i;
/* Add start of this submatch to regset. */
for (i = 0; regset[i] >= 0; i++)
;
regset[i] = id * 2;
regset[i + 1] = -1;
if (!first_pass) {
for (i = 0; parents[i] >= 0; i++)
;
tnfa->submatch_data[id].parents = NULL;
if (i > 0) {
int *p = malloc(sizeof(*p) * (i + 1));
if (p == NULL) {
status = REG_ESPACE;
break;
}
_unassert(tnfa->submatch_data[id].parents == NULL);
tnfa->submatch_data[id].parents = p;
for (i = 0; parents[i] >= 0; i++) p[i] = parents[i];
p[i] = -1;
}
}
/* Add end of this submatch to regset after processing this
node. */
STACK_PUSHX(stack, int, node->submatch_id);
STACK_PUSHX(stack, int, ADDTAGS_SET_SUBMATCH_END);
}
switch (node->type) {
case LITERAL: {
tre_literal_t *lit = node->obj;
if (!IS_SPECIAL(lit) || IS_BACKREF(lit)) {
int i;
if (regset[0] >= 0) {
/* Regset is not empty, so add a tag before the
literal or backref. */
if (!first_pass) {
status = tre_add_tag_left(mem, node, tag);
tnfa->tag_directions[tag] = direction;
if (minimal_tag >= 0) {
for (i = 0; tnfa->minimal_tags[i] >= 0; i++)
;
tnfa->minimal_tags[i] = tag;
tnfa->minimal_tags[i + 1] = minimal_tag;
tnfa->minimal_tags[i + 2] = -1;
minimal_tag = -1;
num_minimals++;
}
tre_purge_regset(regset, tnfa, tag);
} else {
node->num_tags = 1;
}
regset[0] = -1;
tag = next_tag;
num_tags++;
next_tag++;
}
} else {
_unassert(!IS_TAG(lit));
}
break;
}
case CATENATION: {
tre_catenation_t *cat = node->obj;
tre_ast_node_t *left = cat->left;
tre_ast_node_t *right = cat->right;
int reserved_tag = -1;
/* After processing right child. */
STACK_PUSHX(stack, voidptr, node);
STACK_PUSHX(stack, int, ADDTAGS_AFTER_CAT_RIGHT);
/* Process right child. */
STACK_PUSHX(stack, voidptr, right);
STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
/* After processing left child. */
STACK_PUSHX(stack, int, next_tag + left->num_tags);
if (left->num_tags > 0 && right->num_tags > 0) {
/* Reserve the next tag to the right child. */
reserved_tag = next_tag;
next_tag++;
}
STACK_PUSHX(stack, int, reserved_tag);
STACK_PUSHX(stack, int, ADDTAGS_AFTER_CAT_LEFT);
/* Process left child. */
STACK_PUSHX(stack, voidptr, left);
STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
} break;
case ITERATION: {
tre_iteration_t *iter = node->obj;
if (first_pass) {
STACK_PUSHX(stack, int, regset[0] >= 0 || iter->minimal);
} else {
STACK_PUSHX(stack, int, tag);
STACK_PUSHX(stack, int, iter->minimal);
}
STACK_PUSHX(stack, voidptr, node);
STACK_PUSHX(stack, int, ADDTAGS_AFTER_ITERATION);
STACK_PUSHX(stack, voidptr, iter->arg);
STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
/* Regset is not empty, so add a tag here. */
if (regset[0] >= 0 || iter->minimal) {
if (!first_pass) {
int i;
status = tre_add_tag_left(mem, node, tag);
if (iter->minimal)
tnfa->tag_directions[tag] = TRE_TAG_MAXIMIZE;
else
tnfa->tag_directions[tag] = direction;
if (minimal_tag >= 0) {
for (i = 0; tnfa->minimal_tags[i] >= 0; i++)
;
tnfa->minimal_tags[i] = tag;
tnfa->minimal_tags[i + 1] = minimal_tag;
tnfa->minimal_tags[i + 2] = -1;
minimal_tag = -1;
num_minimals++;
}
tre_purge_regset(regset, tnfa, tag);
}
regset[0] = -1;
tag = next_tag;
num_tags++;
next_tag++;
}
direction = TRE_TAG_MINIMIZE;
} break;
case UNION: {
tre_union_t *uni = node->obj;
tre_ast_node_t *left = uni->left;
tre_ast_node_t *right = uni->right;
int left_tag;
int right_tag;
if (regset[0] >= 0) {
left_tag = next_tag;
right_tag = next_tag + 1;
} else {
left_tag = tag;
right_tag = next_tag;
}
/* After processing right child. */
STACK_PUSHX(stack, int, right_tag);
STACK_PUSHX(stack, int, left_tag);
STACK_PUSHX(stack, voidptr, regset);
STACK_PUSHX(stack, int, regset[0] >= 0);
STACK_PUSHX(stack, voidptr, node);
STACK_PUSHX(stack, voidptr, right);
STACK_PUSHX(stack, voidptr, left);
STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_RIGHT);
/* Process right child. */
STACK_PUSHX(stack, voidptr, right);
STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
/* After processing left child. */
STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_LEFT);
/* Process left child. */
STACK_PUSHX(stack, voidptr, left);
STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
/* Regset is not empty, so add a tag here. */
if (regset[0] >= 0) {
if (!first_pass) {
int i;
status = tre_add_tag_left(mem, node, tag);
tnfa->tag_directions[tag] = direction;
if (minimal_tag >= 0) {
for (i = 0; tnfa->minimal_tags[i] >= 0; i++)
;
tnfa->minimal_tags[i] = tag;
tnfa->minimal_tags[i + 1] = minimal_tag;
tnfa->minimal_tags[i + 2] = -1;
minimal_tag = -1;
num_minimals++;
}
tre_purge_regset(regset, tnfa, tag);
}
regset[0] = -1;
tag = next_tag;
num_tags++;
next_tag++;
}
if (node->num_submatches > 0) {
/* The next two tags are reserved for markers. */
next_tag++;
tag = next_tag;
next_tag++;
}
break;
}
}
if (node->submatch_id >= 0) {
int i;
/* Push this submatch on the parents stack. */
for (i = 0; parents[i] >= 0; i++)
;
parents[i] = node->submatch_id;
parents[i + 1] = -1;
}
break; /* end case: ADDTAGS_RECURSE */
case ADDTAGS_AFTER_ITERATION: {
int minimal = 0;
int enter_tag;
node = tre_stack_pop_voidptr(stack);
if (first_pass) {
node->num_tags = ((tre_iteration_t *)node->obj)->arg->num_tags +
tre_stack_pop_int(stack);
minimal_tag = -1;
} else {
minimal = tre_stack_pop_int(stack);
enter_tag = tre_stack_pop_int(stack);
if (minimal) minimal_tag = enter_tag;
}
if (!first_pass) {
if (minimal)
direction = TRE_TAG_MINIMIZE;
else
direction = TRE_TAG_MAXIMIZE;
}
break;
}
case ADDTAGS_AFTER_CAT_LEFT: {
int new_tag = tre_stack_pop_int(stack);
next_tag = tre_stack_pop_int(stack);
if (new_tag >= 0) {
tag = new_tag;
}
break;
}
case ADDTAGS_AFTER_CAT_RIGHT:
node = tre_stack_pop_voidptr(stack);
if (first_pass)
node->num_tags = ((tre_catenation_t *)node->obj)->left->num_tags +
((tre_catenation_t *)node->obj)->right->num_tags;
break;
case ADDTAGS_AFTER_UNION_LEFT:
/* Lift the bottom of the `regset' array so that when processing
the right operand the items currently in the array are
invisible. The original bottom was saved at ADDTAGS_UNION and
will be restored at ADDTAGS_AFTER_UNION_RIGHT below. */
while (*regset >= 0) regset++;
break;
case ADDTAGS_AFTER_UNION_RIGHT: {
int added_tags, tag_left, tag_right;
tre_ast_node_t *left = tre_stack_pop_voidptr(stack);
tre_ast_node_t *right = tre_stack_pop_voidptr(stack);
node = tre_stack_pop_voidptr(stack);
added_tags = tre_stack_pop_int(stack);
if (first_pass) {
node->num_tags = ((tre_union_t *)node->obj)->left->num_tags +
((tre_union_t *)node->obj)->right->num_tags +
added_tags + ((node->num_submatches > 0) ? 2 : 0);
}
regset = tre_stack_pop_voidptr(stack);
tag_left = tre_stack_pop_int(stack);
tag_right = tre_stack_pop_int(stack);
/* Add tags after both children, the left child gets a smaller
tag than the right child. This guarantees that we prefer
the left child over the right child. */
/* XXX - This is not always necessary (if the children have
tags which must be seen for every match of that child). */
/* XXX - Check if this is the only place where tre_add_tag_right
is used. If so, use tre_add_tag_left (putting the tag before
the child as opposed after the child) and throw away
tre_add_tag_right. */
if (node->num_submatches > 0) {
if (!first_pass) {
status = tre_add_tag_right(mem, left, tag_left);
tnfa->tag_directions[tag_left] = TRE_TAG_MAXIMIZE;
if (status == REG_OK)
status = tre_add_tag_right(mem, right, tag_right);
tnfa->tag_directions[tag_right] = TRE_TAG_MAXIMIZE;
}
num_tags += 2;
}
direction = TRE_TAG_MAXIMIZE;
break;
}
default:
unreachable;
} /* end switch(symbol) */
} /* end while(tre_stack_num_objects(stack) > bottom) */
if (!first_pass) tre_purge_regset(regset, tnfa, tag);
if (!first_pass && minimal_tag >= 0) {
int i;
for (i = 0; tnfa->minimal_tags[i] >= 0; i++)
;
tnfa->minimal_tags[i] = tag;
tnfa->minimal_tags[i + 1] = minimal_tag;
tnfa->minimal_tags[i + 2] = -1;
minimal_tag = -1;
num_minimals++;
}
_unassert(tree->num_tags == num_tags);
tnfa->end_tag = num_tags;
tnfa->num_tags = num_tags;
tnfa->num_minimals = num_minimals;
free(orig_regset), orig_regset = NULL;
free(parents), parents = NULL;
free(saved_states), saved_states = NULL;
return status;
}
/*
AST to TNFA compilation routines.
*/
typedef enum { COPY_RECURSE, COPY_SET_RESULT_PTR } tre_copyast_symbol_t;
/* Flags for tre_copy_ast(). */
#define COPY_REMOVE_TAGS 1
#define COPY_MAXIMIZE_FIRST_TAG 2
static reg_errcode_t tre_copy_ast(tre_mem_t mem, tre_stack_t *stack,
tre_ast_node_t *ast, int flags, int *pos_add,
tre_tag_direction_t *tag_directions,
tre_ast_node_t **copy, int *max_pos) {
reg_errcode_t status = REG_OK;
int bottom = tre_stack_num_objects(stack);
int num_copied = 0;
int first_tag = 1;
tre_ast_node_t **result = copy;
tre_copyast_symbol_t symbol;
STACK_PUSH(stack, voidptr, ast);
STACK_PUSH(stack, int, COPY_RECURSE);
while (status == REG_OK && tre_stack_num_objects(stack) > bottom) {
tre_ast_node_t *node;
if (status != REG_OK) break;
symbol = (tre_copyast_symbol_t)tre_stack_pop_int(stack);
switch (symbol) {
case COPY_SET_RESULT_PTR:
result = tre_stack_pop_voidptr(stack);
break;
case COPY_RECURSE:
node = tre_stack_pop_voidptr(stack);
switch (node->type) {
case LITERAL: {
tre_literal_t *lit = node->obj;
int pos = lit->position;
int min = lit->code_min;
int max = lit->code_max;
if (!IS_SPECIAL(lit) || IS_BACKREF(lit)) {
/* XXX - e.g. [ab] has only one position but two
nodes, so we are creating holes in the state space
here. Not fatal, just wastes memory. */
pos += *pos_add;
num_copied++;
} else if (IS_TAG(lit) && (flags & COPY_REMOVE_TAGS)) {
/* Change this tag to empty. */
min = EMPTY;
max = pos = -1;
} else if (IS_TAG(lit) && (flags & COPY_MAXIMIZE_FIRST_TAG) &&
first_tag) {
/* Maximize the first tag. */
tag_directions[max] = TRE_TAG_MAXIMIZE;
first_tag = 0;
}
*result = tre_ast_new_literal(mem, min, max, pos);
if (*result == NULL)
status = REG_ESPACE;
else {
tre_literal_t *p = (*result)->obj;
p->class = lit->class;
p->neg_classes = lit->neg_classes;
}
if (pos > *max_pos) *max_pos = pos;
break;
}
case UNION: {
tre_union_t *uni = node->obj;
tre_union_t *tmp;
*result = tre_ast_new_union(mem, uni->left, uni->right);
if (*result == NULL) {
status = REG_ESPACE;
break;
}
tmp = (*result)->obj;
result = &tmp->left;
STACK_PUSHX(stack, voidptr, uni->right);
STACK_PUSHX(stack, int, COPY_RECURSE);
STACK_PUSHX(stack, voidptr, &tmp->right);
STACK_PUSHX(stack, int, COPY_SET_RESULT_PTR);
STACK_PUSHX(stack, voidptr, uni->left);
STACK_PUSHX(stack, int, COPY_RECURSE);
break;
}
case CATENATION: {
tre_catenation_t *cat = node->obj;
tre_catenation_t *tmp;
*result = tre_ast_new_catenation(mem, cat->left, cat->right);
if (*result == NULL) {
status = REG_ESPACE;
break;
}
tmp = (*result)->obj;
tmp->left = NULL;
tmp->right = NULL;
result = &tmp->left;
STACK_PUSHX(stack, voidptr, cat->right);
STACK_PUSHX(stack, int, COPY_RECURSE);
STACK_PUSHX(stack, voidptr, &tmp->right);
STACK_PUSHX(stack, int, COPY_SET_RESULT_PTR);
STACK_PUSHX(stack, voidptr, cat->left);
STACK_PUSHX(stack, int, COPY_RECURSE);
break;
}
case ITERATION: {
tre_iteration_t *iter = node->obj;
STACK_PUSHX(stack, voidptr, iter->arg);
STACK_PUSHX(stack, int, COPY_RECURSE);
*result = tre_ast_new_iter(mem, iter->arg, iter->min, iter->max,
iter->minimal);
if (*result == NULL) {
status = REG_ESPACE;
break;
}
iter = (*result)->obj;
result = &iter->arg;
break;
}
default:
unreachable;
}
break;
}
}
*pos_add += num_copied;
return status;
}
typedef enum { EXPAND_RECURSE, EXPAND_AFTER_ITER } tre_expand_ast_symbol_t;
/* Expands each iteration node that has a finite nonzero minimum or maximum
iteration count to a catenated sequence of copies of the node. */
static reg_errcode_t tre_expand_ast(tre_mem_t mem, tre_stack_t *stack,
tre_ast_node_t *ast, int *position,
tre_tag_direction_t *tag_directions) {
reg_errcode_t status = REG_OK;
int bottom = tre_stack_num_objects(stack);
int pos_add = 0;
int pos_add_total = 0;
int max_pos = 0;
int iter_depth = 0;
STACK_PUSHR(stack, voidptr, ast);
STACK_PUSHR(stack, int, EXPAND_RECURSE);
while (status == REG_OK && tre_stack_num_objects(stack) > bottom) {
tre_ast_node_t *node;
tre_expand_ast_symbol_t symbol;
if (status != REG_OK) break;
symbol = (tre_expand_ast_symbol_t)tre_stack_pop_int(stack);
node = tre_stack_pop_voidptr(stack);
switch (symbol) {
case EXPAND_RECURSE:
switch (node->type) {
case LITERAL: {
tre_literal_t *lit = node->obj;
if (!IS_SPECIAL(lit) || IS_BACKREF(lit)) {
lit->position += pos_add;
if (lit->position > max_pos) max_pos = lit->position;
}
break;
}
case UNION: {
tre_union_t *uni = node->obj;
STACK_PUSHX(stack, voidptr, uni->right);
STACK_PUSHX(stack, int, EXPAND_RECURSE);
STACK_PUSHX(stack, voidptr, uni->left);
STACK_PUSHX(stack, int, EXPAND_RECURSE);
break;
}
case CATENATION: {
tre_catenation_t *cat = node->obj;
STACK_PUSHX(stack, voidptr, cat->right);
STACK_PUSHX(stack, int, EXPAND_RECURSE);
STACK_PUSHX(stack, voidptr, cat->left);
STACK_PUSHX(stack, int, EXPAND_RECURSE);
break;
}
case ITERATION: {
tre_iteration_t *iter = node->obj;
STACK_PUSHX(stack, int, pos_add);
STACK_PUSHX(stack, voidptr, node);
STACK_PUSHX(stack, int, EXPAND_AFTER_ITER);
STACK_PUSHX(stack, voidptr, iter->arg);
STACK_PUSHX(stack, int, EXPAND_RECURSE);
/* If we are going to expand this node at EXPAND_AFTER_ITER
then don't increase the `pos' fields of the nodes now, it
will get done when expanding. */
if (iter->min > 1 || iter->max > 1) pos_add = 0;
iter_depth++;
break;
}
default:
unreachable;
}
break;
case EXPAND_AFTER_ITER: {
tre_iteration_t *iter = node->obj;
int pos_add_last;
pos_add = tre_stack_pop_int(stack);
pos_add_last = pos_add;
if (iter->min > 1 || iter->max > 1) {
tre_ast_node_t *seq1 = NULL, *seq2 = NULL;
int j;
int pos_add_save = pos_add;
/* Create a catenated sequence of copies of the node. */
for (j = 0; j < iter->min; j++) {
tre_ast_node_t *copy;
/* Remove tags from all but the last copy. */
int flags = ((j + 1 < iter->min) ? COPY_REMOVE_TAGS
: COPY_MAXIMIZE_FIRST_TAG);
pos_add_save = pos_add;
status = tre_copy_ast(mem, stack, iter->arg, flags, &pos_add,
tag_directions, ©, &max_pos);
if (status != REG_OK) return status;
if (seq1 != NULL)
seq1 = tre_ast_new_catenation(mem, seq1, copy);
else
seq1 = copy;
if (seq1 == NULL) return REG_ESPACE;
}
if (iter->max == -1) {
/* No upper limit. */
pos_add_save = pos_add;
status = tre_copy_ast(mem, stack, iter->arg, 0, &pos_add, NULL,
&seq2, &max_pos);
if (status != REG_OK) return status;
seq2 = tre_ast_new_iter(mem, seq2, 0, -1, 0);
if (seq2 == NULL) return REG_ESPACE;
} else {
for (j = iter->min; j < iter->max; j++) {
tre_ast_node_t *tmp, *copy;
pos_add_save = pos_add;
status = tre_copy_ast(mem, stack, iter->arg, 0, &pos_add, NULL,
©, &max_pos);
if (status != REG_OK) return status;
if (seq2 != NULL)
seq2 = tre_ast_new_catenation(mem, copy, seq2);
else
seq2 = copy;
if (seq2 == NULL) return REG_ESPACE;
tmp = tre_ast_new_literal(mem, EMPTY, -1, -1);
if (tmp == NULL) return REG_ESPACE;
seq2 = tre_ast_new_union(mem, tmp, seq2);
if (seq2 == NULL) return REG_ESPACE;
}
}
pos_add = pos_add_save;
if (seq1 == NULL)
seq1 = seq2;
else if (seq2 != NULL)
seq1 = tre_ast_new_catenation(mem, seq1, seq2);
if (seq1 == NULL) return REG_ESPACE;
node->obj = seq1->obj;
node->type = seq1->type;
}
iter_depth--;
pos_add_total += pos_add - pos_add_last;
if (iter_depth == 0) pos_add = pos_add_total;
break;
}
default:
unreachable;
}
}
*position += pos_add_total;
/* `max_pos' should never be larger than `*position' if the above
code works, but just an extra safeguard let's make sure
`*position' is set large enough so enough memory will be
allocated for the transition table. */
if (max_pos > *position) *position = max_pos;
return status;
}
static tre_pos_and_tags_t *tre_set_empty(tre_mem_t mem) {
tre_pos_and_tags_t *new_set;
new_set = tre_mem_calloc(mem, sizeof(*new_set));
if (new_set == NULL) return NULL;
new_set[0].position = -1;
new_set[0].code_min = -1;
new_set[0].code_max = -1;
return new_set;
}
static tre_pos_and_tags_t *tre_set_one(tre_mem_t mem, int position,
int code_min, int code_max,
tre_ctype_t class,
tre_ctype_t *neg_classes, int backref) {
tre_pos_and_tags_t *new_set;
new_set = tre_mem_calloc(mem, sizeof(*new_set) * 2);
if (new_set == NULL) return NULL;
new_set[0].position = position;
new_set[0].code_min = code_min;
new_set[0].code_max = code_max;
new_set[0].class = class;
new_set[0].neg_classes = neg_classes;
new_set[0].backref = backref;
new_set[1].position = -1;
new_set[1].code_min = -1;
new_set[1].code_max = -1;
return new_set;
}
static tre_pos_and_tags_t *tre_set_union(tre_mem_t mem,
tre_pos_and_tags_t *set1,
tre_pos_and_tags_t *set2, int *tags,
int assertions) {
int s1, s2, i, j;
tre_pos_and_tags_t *new_set;
int *new_tags;
int num_tags;
for (num_tags = 0; tags != NULL && tags[num_tags] >= 0; num_tags++)
;
for (s1 = 0; set1[s1].position >= 0; s1++)
;
for (s2 = 0; set2[s2].position >= 0; s2++)
;
new_set = tre_mem_calloc(mem, sizeof(*new_set) * (s1 + s2 + 1));
if (!new_set) return NULL;
for (s1 = 0; set1[s1].position >= 0; s1++) {
new_set[s1].position = set1[s1].position;
new_set[s1].code_min = set1[s1].code_min;
new_set[s1].code_max = set1[s1].code_max;
new_set[s1].assertions = set1[s1].assertions | assertions;
new_set[s1].class = set1[s1].class;
new_set[s1].neg_classes = set1[s1].neg_classes;
new_set[s1].backref = set1[s1].backref;
if (set1[s1].tags == NULL && tags == NULL)
new_set[s1].tags = NULL;
else {
for (i = 0; set1[s1].tags != NULL && set1[s1].tags[i] >= 0; i++)
;
new_tags = tre_mem_alloc(mem, (sizeof(*new_tags) * (i + num_tags + 1)));
if (new_tags == NULL) return NULL;
for (j = 0; j < i; j++) new_tags[j] = set1[s1].tags[j];
for (i = 0; i < num_tags; i++) new_tags[j + i] = tags[i];
new_tags[j + i] = -1;
new_set[s1].tags = new_tags;
}
}
for (s2 = 0; set2[s2].position >= 0; s2++) {
new_set[s1 + s2].position = set2[s2].position;
new_set[s1 + s2].code_min = set2[s2].code_min;
new_set[s1 + s2].code_max = set2[s2].code_max;
/* XXX - why not | assertions here as well? */
new_set[s1 + s2].assertions = set2[s2].assertions;
new_set[s1 + s2].class = set2[s2].class;
new_set[s1 + s2].neg_classes = set2[s2].neg_classes;
new_set[s1 + s2].backref = set2[s2].backref;
if (set2[s2].tags == NULL)
new_set[s1 + s2].tags = NULL;
else {
for (i = 0; set2[s2].tags[i] >= 0; i++)
;
new_tags = tre_mem_alloc(mem, sizeof(*new_tags) * (i + 1));
if (new_tags == NULL) return NULL;
for (j = 0; j < i; j++) new_tags[j] = set2[s2].tags[j];
new_tags[j] = -1;
new_set[s1 + s2].tags = new_tags;
}
}
new_set[s1 + s2].position = -1;
return new_set;
}
/* Finds the empty path through `node' which is the one that should be
taken according to POSIX.2 rules, and adds the tags on that path to
`tags'. `tags' may be NULL. If `num_tags_seen' is not NULL, it is
set to the number of tags seen on the path. */
static reg_errcode_t tre_match_empty(tre_stack_t *stack, tre_ast_node_t *node,
int *tags, int *assertions,
int *num_tags_seen) {
tre_literal_t *lit;
tre_union_t *uni;
tre_catenation_t *cat;
tre_iteration_t *iter;
int i;
int bottom = tre_stack_num_objects(stack);
reg_errcode_t status = REG_OK;
if (num_tags_seen) *num_tags_seen = 0;
status = tre_stack_push_voidptr(stack, node);
/* Walk through the tree recursively. */
while (status == REG_OK && tre_stack_num_objects(stack) > bottom) {
node = tre_stack_pop_voidptr(stack);
switch (node->type) {
case LITERAL:
lit = (tre_literal_t *)node->obj;
switch (lit->code_min) {
case TAG:
if (lit->code_max >= 0) {
if (tags != NULL) {
/* Add the tag to `tags'. */
for (i = 0; tags[i] >= 0; i++)
if (tags[i] == lit->code_max) break;
if (tags[i] < 0) {
tags[i] = lit->code_max;
tags[i + 1] = -1;
}
}
if (num_tags_seen) (*num_tags_seen)++;
}
break;
case ASSERTION:
_unassert(lit->code_max >= 1 || lit->code_max <= ASSERT_LAST);
if (assertions != NULL) *assertions |= lit->code_max;
break;
case EMPTY:
break;
default:
unreachable;
}
break;
case UNION:
/* Subexpressions starting earlier take priority over ones
starting later, so we prefer the left subexpression over the
right subexpression. */
uni = (tre_union_t *)node->obj;
if (uni->left->nullable)
STACK_PUSHX(stack, voidptr, uni->left)
else if (uni->right->nullable)
STACK_PUSHX(stack, voidptr, uni->right)
else
unreachable;
break;
case CATENATION:
/* The path must go through both children. */
cat = (tre_catenation_t *)node->obj;
_unassert(cat->left->nullable);
_unassert(cat->right->nullable);
STACK_PUSHX(stack, voidptr, cat->left);
STACK_PUSHX(stack, voidptr, cat->right);
break;
case ITERATION:
/* A match with an empty string is preferred over no match at
all, so we go through the argument if possible. */
iter = (tre_iteration_t *)node->obj;
if (iter->arg->nullable) STACK_PUSHX(stack, voidptr, iter->arg);
break;
default:
unreachable;
}
}
return status;
}
typedef enum {
NFL_RECURSE,
NFL_POST_UNION,
NFL_POST_CATENATION,
NFL_POST_ITERATION
} tre_nfl_stack_symbol_t;
/* Computes and fills in the fields `nullable', `firstpos', and `lastpos' for
the nodes of the AST `tree'. */
static reg_errcode_t tre_compute_nfl(tre_mem_t mem, tre_stack_t *stack,
tre_ast_node_t *tree) {
int bottom = tre_stack_num_objects(stack);
STACK_PUSHR(stack, voidptr, tree);
STACK_PUSHR(stack, int, NFL_RECURSE);
while (tre_stack_num_objects(stack) > bottom) {
tre_nfl_stack_symbol_t symbol;
tre_ast_node_t *node;
symbol = (tre_nfl_stack_symbol_t)tre_stack_pop_int(stack);
node = tre_stack_pop_voidptr(stack);
switch (symbol) {
case NFL_RECURSE:
switch (node->type) {
case LITERAL: {
tre_literal_t *lit = (tre_literal_t *)node->obj;
if (IS_BACKREF(lit)) {
/* Back references: nullable = false, firstpos = {i},
lastpos = {i}. */
node->nullable = 0;
node->firstpos =
tre_set_one(mem, lit->position, 0, TRE_CHAR_MAX, 0, NULL, -1);
if (!node->firstpos) return REG_ESPACE;
node->lastpos = tre_set_one(mem, lit->position, 0, TRE_CHAR_MAX,
0, NULL, (int)lit->code_max);
if (!node->lastpos) return REG_ESPACE;
} else if (lit->code_min < 0) {
/* Tags, empty strings, params, and zero width assertions:
nullable = true, firstpos = {}, and lastpos = {}. */
node->nullable = 1;
node->firstpos = tre_set_empty(mem);
if (!node->firstpos) return REG_ESPACE;
node->lastpos = tre_set_empty(mem);
if (!node->lastpos) return REG_ESPACE;
} else {
/* Literal at position i: nullable = false, firstpos = {i},
lastpos = {i}. */
node->nullable = 0;
node->firstpos =
tre_set_one(mem, lit->position, (int)lit->code_min,
(int)lit->code_max, 0, NULL, -1);
if (!node->firstpos) return REG_ESPACE;
node->lastpos = tre_set_one(
mem, lit->position, (int)lit->code_min, (int)lit->code_max,
lit->class, lit->neg_classes, -1);
if (!node->lastpos) return REG_ESPACE;
}
break;
}
case UNION:
/* Compute the attributes for the two subtrees, and after that
for this node. */
STACK_PUSHR(stack, voidptr, node);
STACK_PUSHR(stack, int, NFL_POST_UNION);
STACK_PUSHR(stack, voidptr, ((tre_union_t *)node->obj)->right);
STACK_PUSHR(stack, int, NFL_RECURSE);
STACK_PUSHR(stack, voidptr, ((tre_union_t *)node->obj)->left);
STACK_PUSHR(stack, int, NFL_RECURSE);
break;
case CATENATION:
/* Compute the attributes for the two subtrees, and after that
for this node. */
STACK_PUSHR(stack, voidptr, node);
STACK_PUSHR(stack, int, NFL_POST_CATENATION);
STACK_PUSHR(stack, voidptr, ((tre_catenation_t *)node->obj)->right);
STACK_PUSHR(stack, int, NFL_RECURSE);
STACK_PUSHR(stack, voidptr, ((tre_catenation_t *)node->obj)->left);
STACK_PUSHR(stack, int, NFL_RECURSE);
break;
case ITERATION:
/* Compute the attributes for the subtree, and after that for
this node. */
STACK_PUSHR(stack, voidptr, node);
STACK_PUSHR(stack, int, NFL_POST_ITERATION);
STACK_PUSHR(stack, voidptr, ((tre_iteration_t *)node->obj)->arg);
STACK_PUSHR(stack, int, NFL_RECURSE);
break;
}
break; /* end case: NFL_RECURSE */
case NFL_POST_UNION: {
tre_union_t *uni = (tre_union_t *)node->obj;
node->nullable = uni->left->nullable || uni->right->nullable;
node->firstpos = tre_set_union(mem, uni->left->firstpos,
uni->right->firstpos, NULL, 0);
if (!node->firstpos) return REG_ESPACE;
node->lastpos = tre_set_union(mem, uni->left->lastpos,
uni->right->lastpos, NULL, 0);
if (!node->lastpos) return REG_ESPACE;
break;
}
case NFL_POST_ITERATION: {
tre_iteration_t *iter = (tre_iteration_t *)node->obj;
if (iter->min == 0 || iter->arg->nullable)
node->nullable = 1;
else
node->nullable = 0;
node->firstpos = iter->arg->firstpos;
node->lastpos = iter->arg->lastpos;
break;
}
case NFL_POST_CATENATION: {
int num_tags, *tags, assertions;
reg_errcode_t status;
tre_catenation_t *cat = node->obj;
node->nullable = cat->left->nullable && cat->right->nullable;
/* Compute firstpos. */
if (cat->left->nullable) {
/* The left side matches the empty string. Make a first pass
with tre_match_empty() to get the number of tags and
parameters. */
status = tre_match_empty(stack, cat->left, NULL, NULL, &num_tags);
if (status != REG_OK) return status;
/* Allocate arrays for the tags and parameters. */
tags = malloc(sizeof(*tags) * (num_tags + 1));
if (!tags) return REG_ESPACE;
tags[0] = -1;
assertions = 0;
/* Second pass with tre_mach_empty() to get the list of
tags and parameters. */
status = tre_match_empty(stack, cat->left, tags, &assertions, NULL);
if (status != REG_OK) {
free(tags), tags = NULL;
return status;
}
node->firstpos = tre_set_union(mem, cat->right->firstpos,
cat->left->firstpos, tags, assertions);
free(tags), tags = NULL;
if (!node->firstpos) return REG_ESPACE;
} else {
node->firstpos = cat->left->firstpos;
}
/* Compute lastpos. */
if (cat->right->nullable) {
/* The right side matches the empty string. Make a first pass
with tre_match_empty() to get the number of tags and
parameters. */
status = tre_match_empty(stack, cat->right, NULL, NULL, &num_tags);
if (status != REG_OK) return status;
/* Allocate arrays for the tags and parameters. */
tags = malloc(sizeof(int) * (num_tags + 1));
if (!tags) return REG_ESPACE;
tags[0] = -1;
assertions = 0;
/* Second pass with tre_mach_empty() to get the list of
tags and parameters. */
status = tre_match_empty(stack, cat->right, tags, &assertions, NULL);
if (status != REG_OK) {
free(tags), tags = NULL;
return status;
}
node->lastpos = tre_set_union(mem, cat->left->lastpos,
cat->right->lastpos, tags, assertions);
free(tags), tags = NULL;
if (!node->lastpos) return REG_ESPACE;
} else {
node->lastpos = cat->right->lastpos;
}
break;
}
default:
unreachable;
}
}
return REG_OK;
}
/* Adds a transition from each position in `p1' to each position in `p2'. */
static reg_errcode_t tre_make_trans(tre_pos_and_tags_t *p1,
tre_pos_and_tags_t *p2,
tre_tnfa_transition_t *transitions,
int *counts, int *offs) {
tre_pos_and_tags_t *orig_p2 = p2;
tre_tnfa_transition_t *trans;
int i, j, k, l, dup, prev_p2_pos;
if (transitions != NULL)
while (p1->position >= 0) {
p2 = orig_p2;
prev_p2_pos = -1;
while (p2->position >= 0) {
/* Optimization: if this position was already handled, skip it. */
if (p2->position == prev_p2_pos) {
p2++;
continue;
}
prev_p2_pos = p2->position;
/* Set `trans' to point to the next unused transition from
position `p1->position'. */
trans = transitions + offs[p1->position];
while (trans->state != NULL) {
#if 0
/* If we find a previous transition from `p1->position' to
`p2->position', it is overwritten. This can happen only
if there are nested loops in the regexp, like in "((a)*)*".
In POSIX.2 repetition using the outer loop is always
preferred over using the inner loop. Therefore the
transition for the inner loop is useless and can be thrown
away. */
/* XXX - The same position is used for all nodes in a bracket
expression, so this optimization cannot be used (it will
break bracket expressions) unless I figure out a way to
detect it here. */
if (trans->state_id == p2->position)
{
break;
}
#endif
trans++;
}
if (trans->state == NULL) (trans + 1)->state = NULL;
/* Use the character ranges, assertions, etc. from `p1' for
the transition from `p1' to `p2'. */
trans->code_min = p1->code_min;
trans->code_max = p1->code_max;
trans->state = transitions + offs[p2->position];
trans->state_id = p2->position;
trans->assertions =
p1->assertions | p2->assertions |
(p1->class ? ASSERT_CHAR_CLASS : 0) |
(p1->neg_classes != NULL ? ASSERT_CHAR_CLASS_NEG : 0);
if (p1->backref >= 0) {
_unassert((trans->assertions & ASSERT_CHAR_CLASS) == 0);
_unassert(p2->backref < 0);
trans->u.backref = p1->backref;
trans->assertions |= ASSERT_BACKREF;
} else
trans->u.class = p1->class;
if (p1->neg_classes != NULL) {
for (i = 0; p1->neg_classes[i] != (tre_ctype_t)0; i++)
;
trans->neg_classes = malloc(sizeof(*trans->neg_classes) * (i + 1));
if (trans->neg_classes == NULL) return REG_ESPACE;
for (i = 0; p1->neg_classes[i] != (tre_ctype_t)0; i++)
trans->neg_classes[i] = p1->neg_classes[i];
trans->neg_classes[i] = (tre_ctype_t)0;
} else
trans->neg_classes = NULL;
/* Find out how many tags this transition has. */
i = 0;
if (p1->tags != NULL)
while (p1->tags[i] >= 0) i++;
j = 0;
if (p2->tags != NULL)
while (p2->tags[j] >= 0) j++;
/* If we are overwriting a transition, free the old tag array. */
if (trans->tags != NULL) free(trans->tags), trans->tags = NULL;
trans->tags = NULL;
/* If there were any tags, allocate an array and fill it. */
if (i + j > 0) {
trans->tags = malloc(sizeof(*trans->tags) * (i + j + 1));
if (!trans->tags) return REG_ESPACE;
i = 0;
if (p1->tags != NULL)
while (p1->tags[i] >= 0) {
trans->tags[i] = p1->tags[i];
i++;
}
l = i;
j = 0;
if (p2->tags != NULL)
while (p2->tags[j] >= 0) {
/* Don't add duplicates. */
dup = 0;
for (k = 0; k < i; k++)
if (trans->tags[k] == p2->tags[j]) {
dup = 1;
break;
}
if (!dup) trans->tags[l++] = p2->tags[j];
j++;
}
trans->tags[l] = -1;
}
p2++;
}
p1++;
}
else
/* Compute a maximum limit for the number of transitions leaving
from each state. */
while (p1->position >= 0) {
p2 = orig_p2;
while (p2->position >= 0) {
counts[p1->position]++;
p2++;
}
p1++;
}
return REG_OK;
}
/* Converts the syntax tree to a TNFA. All the transitions in the TNFA are
labelled with one character range (there are no transitions on empty
strings). The TNFA takes O(n^2) space in the worst case, `n' is size of
the regexp. */
static reg_errcode_t tre_ast_to_tnfa(tre_ast_node_t *node,
tre_tnfa_transition_t *transitions,
int *counts, int *offs) {
tre_union_t *uni;
tre_catenation_t *cat;
tre_iteration_t *iter;
reg_errcode_t errcode = REG_OK;
/* XXX - recurse using a stack!. */
switch (node->type) {
case LITERAL:
break;
case UNION:
uni = (tre_union_t *)node->obj;
errcode = tre_ast_to_tnfa(uni->left, transitions, counts, offs);
if (errcode != REG_OK) return errcode;
errcode = tre_ast_to_tnfa(uni->right, transitions, counts, offs);
break;
case CATENATION:
cat = (tre_catenation_t *)node->obj;
/* Add a transition from each position in cat->left->lastpos
to each position in cat->right->firstpos. */
errcode = tre_make_trans(cat->left->lastpos, cat->right->firstpos,
transitions, counts, offs);
if (errcode != REG_OK) return errcode;
errcode = tre_ast_to_tnfa(cat->left, transitions, counts, offs);
if (errcode != REG_OK) return errcode;
errcode = tre_ast_to_tnfa(cat->right, transitions, counts, offs);
break;
case ITERATION:
iter = (tre_iteration_t *)node->obj;
_unassert(iter->max == -1 || iter->max == 1);
if (iter->max == -1) {
_unassert(iter->min == 0 || iter->min == 1);
/* Add a transition from each last position in the iterated
expression to each first position. */
errcode = tre_make_trans(iter->arg->lastpos, iter->arg->firstpos,
transitions, counts, offs);
if (errcode != REG_OK) return errcode;
}
errcode = tre_ast_to_tnfa(iter->arg, transitions, counts, offs);
break;
}
return errcode;
}
#define ERROR_EXIT(err) \
do { \
errcode = err; \
if (/*CONSTCOND*/ 1) goto error_exit; \
} while (/*CONSTCOND*/ 0)
/**
* Compiles regular expression, e.g.
*
* regex_t rx;
* CHECK_EQ(REG_OK, regcomp(&rx, "^[A-Za-z]{2}$", REG_EXTENDED));
* CHECK_EQ(REG_OK, regexec(&rx, "âA", 0, NULL, 0));
* regfree(&rx);
*
* @param preg points to caller allocated memory that's used to store
* your regular expression. This memory needn't be initialized. If
* this function succeeds, then `preg` must be passed to regfree()
* later on, to free its associated resources
* @param regex is utf-8 regular expression nul-terminated string
* @param cflags can have REG_EXTENDED, REG_ICASE, REG_NEWLINE, REG_NOSUB
* @return REG_OK, REG_NOMATCH, REG_BADPAT, etc.
* @see regexec(), regfree(), regerror()
*/
int regcomp(regex_t *preg, const char *regex, int cflags) {
tre_stack_t *stack;
tre_ast_node_t *tree, *tmp_ast_l, *tmp_ast_r;
tre_pos_and_tags_t *p;
int *counts = NULL, *offs = NULL;
int i, add = 0;
tre_tnfa_transition_t *transitions, *initial;
tre_tnfa_t *tnfa = NULL;
tre_submatch_data_t *submatch_data;
tre_tag_direction_t *tag_directions = NULL;
reg_errcode_t errcode;
tre_mem_t mem;
/* Parse context. */
tre_parse_ctx_t parse_ctx;
/* Allocate a stack used throughout the compilation process for various
purposes. */
stack = tre_stack_new(512, 1024000, 128);
if (!stack) return REG_ESPACE;
/* Allocate a fast memory allocator. */
mem = tre_mem_new();
if (!mem) {
tre_stack_destroy(stack);
return REG_ESPACE;
}
/* Parse the regexp. */
bzero(&parse_ctx, sizeof(parse_ctx));
parse_ctx.mem = mem;
parse_ctx.stack = stack;
parse_ctx.start = regex;
parse_ctx.cflags = cflags;
parse_ctx.max_backref = -1;
errcode = tre_parse(&parse_ctx);
if (errcode != REG_OK) ERROR_EXIT(errcode);
preg->re_nsub = parse_ctx.submatch_id - 1;
tree = parse_ctx.n;
#ifdef TRE_DEBUG
tre_ast_print(tree);
#endif /* TRE_DEBUG */
/* Referring to nonexistent subexpressions is illegal. */
if (parse_ctx.max_backref > (int)preg->re_nsub) ERROR_EXIT(REG_ESUBREG);
/* Allocate the TNFA struct. */
tnfa = calloc(1, sizeof(tre_tnfa_t));
if (tnfa == NULL) ERROR_EXIT(REG_ESPACE);
tnfa->have_backrefs = parse_ctx.max_backref >= 0;
tnfa->have_approx = 0;
tnfa->num_submatches = parse_ctx.submatch_id;
/* Set up tags for submatch addressing. If REG_NOSUB is set and the
regexp does not have back references, this can be skipped. */
if (tnfa->have_backrefs || !(cflags & REG_NOSUB)) {
/* Figure out how many tags we will need. */
errcode = tre_add_tags(NULL, stack, tree, tnfa);
if (errcode != REG_OK) ERROR_EXIT(errcode);
if (tnfa->num_tags > 0) {
tag_directions = malloc(sizeof(*tag_directions) * (tnfa->num_tags + 1));
if (tag_directions == NULL) ERROR_EXIT(REG_ESPACE);
tnfa->tag_directions = tag_directions;
memset(tag_directions, -1,
sizeof(*tag_directions) * (tnfa->num_tags + 1));
}
tnfa->minimal_tags =
calloc((unsigned)tnfa->num_tags * 2 + 1, sizeof(*tnfa->minimal_tags));
if (tnfa->minimal_tags == NULL) ERROR_EXIT(REG_ESPACE);
submatch_data =
calloc((unsigned)parse_ctx.submatch_id, sizeof(*submatch_data));
if (submatch_data == NULL) ERROR_EXIT(REG_ESPACE);
tnfa->submatch_data = submatch_data;
errcode = tre_add_tags(mem, stack, tree, tnfa);
if (errcode != REG_OK) ERROR_EXIT(errcode);
}
/* Expand iteration nodes. */
errcode =
tre_expand_ast(mem, stack, tree, &parse_ctx.position, tag_directions);
if (errcode != REG_OK) ERROR_EXIT(errcode);
/* Add a dummy node for the final state.
XXX - For certain patterns this dummy node can be optimized away,
for example "a*" or "ab*". Figure out a simple way to detect
this possibility. */
tmp_ast_l = tree;
tmp_ast_r = tre_ast_new_literal(mem, 0, 0, parse_ctx.position++);
if (tmp_ast_r == NULL) ERROR_EXIT(REG_ESPACE);
tree = tre_ast_new_catenation(mem, tmp_ast_l, tmp_ast_r);
if (tree == NULL) ERROR_EXIT(REG_ESPACE);
errcode = tre_compute_nfl(mem, stack, tree);
if (errcode != REG_OK) ERROR_EXIT(errcode);
counts = malloc(sizeof(int) * parse_ctx.position);
if (counts == NULL) ERROR_EXIT(REG_ESPACE);
offs = malloc(sizeof(int) * parse_ctx.position);
if (offs == NULL) ERROR_EXIT(REG_ESPACE);
for (i = 0; i < parse_ctx.position; i++) counts[i] = 0;
tre_ast_to_tnfa(tree, NULL, counts, NULL);
add = 0;
for (i = 0; i < parse_ctx.position; i++) {
offs[i] = add;
add += counts[i] + 1;
counts[i] = 0;
}
transitions = calloc((unsigned)add + 1, sizeof(*transitions));
if (transitions == NULL) ERROR_EXIT(REG_ESPACE);
tnfa->transitions = transitions;
tnfa->num_transitions = add;
errcode = tre_ast_to_tnfa(tree, transitions, counts, offs);
if (errcode != REG_OK) ERROR_EXIT(errcode);
tnfa->firstpos_chars = NULL;
p = tree->firstpos;
i = 0;
while (p->position >= 0) {
i++;
p++;
}
initial = calloc((unsigned)i + 1, sizeof(tre_tnfa_transition_t));
if (initial == NULL) ERROR_EXIT(REG_ESPACE);
tnfa->initial = initial;
i = 0;
for (p = tree->firstpos; p->position >= 0; p++) {
initial[i].state = transitions + offs[p->position];
initial[i].state_id = p->position;
initial[i].tags = NULL;
/* Copy the arrays p->tags, and p->params, they are allocated
from a tre_mem object. */
if (p->tags) {
int j;
for (j = 0; p->tags[j] >= 0; j++)
;
initial[i].tags = malloc(sizeof(*p->tags) * (j + 1));
if (!initial[i].tags) ERROR_EXIT(REG_ESPACE);
memcpy(initial[i].tags, p->tags, sizeof(*p->tags) * (j + 1));
}
initial[i].assertions = p->assertions;
i++;
}
initial[i].state = NULL;
tnfa->num_transitions = add;
tnfa->final = transitions + offs[tree->lastpos[0].position];
tnfa->num_states = parse_ctx.position;
tnfa->cflags = cflags;
tre_mem_destroy(mem);
tre_stack_destroy(stack);
free(counts), counts = NULL;
free(offs), offs = NULL;
preg->TRE_REGEX_T_FIELD = (void *)tnfa;
return REG_OK;
error_exit:
/* Free everything that was allocated and return the error code. */
tre_mem_destroy(mem);
if (stack != NULL) tre_stack_destroy(stack);
if (counts != NULL) free(counts), counts = NULL;
if (offs != NULL) free(offs), offs = NULL;
preg->TRE_REGEX_T_FIELD = (void *)tnfa;
regfree(preg);
return errcode;
}
/**
* Frees any memory allocated by regcomp().
*
* The same object may be destroyed by regfree() multiple times, in
* which case subsequent calls do nothing. Once a regex is freed, it may
* be passed to regcomp() to reinitialize it.
*/
void regfree(regex_t *preg) {
unsigned int i;
tre_tnfa_t *tnfa;
tre_tnfa_transition_t *trans;
if ((tnfa = preg->TRE_REGEX_T_FIELD)) {
preg->TRE_REGEX_T_FIELD = 0;
for (i = 0; i < tnfa->num_transitions; i++)
if (tnfa->transitions[i].state) {
if (tnfa->transitions[i].tags) {
free(tnfa->transitions[i].tags);
}
if (tnfa->transitions[i].neg_classes) {
free(tnfa->transitions[i].neg_classes);
}
}
if (tnfa->transitions) {
free(tnfa->transitions);
}
if (tnfa->initial) {
for (trans = tnfa->initial; trans->state; trans++) {
if (trans->tags) {
free(trans->tags);
}
}
free(tnfa->initial);
}
if (tnfa->submatch_data) {
for (i = 0; i < tnfa->num_submatches; i++) {
if (tnfa->submatch_data[i].parents) {
free(tnfa->submatch_data[i].parents);
}
}
free(tnfa->submatch_data);
}
if (tnfa->tag_directions) free(tnfa->tag_directions);
if (tnfa->firstpos_chars) free(tnfa->firstpos_chars);
if (tnfa->minimal_tags) free(tnfa->minimal_tags);
free(tnfa);
}
}
| 89,390 | 2,624 | jart/cosmopolitan | false |
cosmopolitan/third_party/regex/notice.inc | asm(".ident\t\"\\n\
Musl Libc (MIT License)\\n\
Copyright 2005-2014 Rich Felker\"");
asm(".include \"libc/disclaimer.inc\"");
asm(".ident\t\"\\n\
TRE regex (BSD-2 License)\\n\
Copyright 2001-2009 Ville Laurikari <[email protected]>\\n\
Copyright 2016 Szabolcs Nagy\"");
asm(".include \"libc/disclaimer.inc\"");
| 304 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/regex/regex.mk | #-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-â
#âââvi: set et ft=make ts=8 tw=8 fenc=utf-8 :viââââââââââââââââââââââââ
PKGS += THIRD_PARTY_REGEX
THIRD_PARTY_REGEX_ARTIFACTS += THIRD_PARTY_REGEX_A
THIRD_PARTY_REGEX = $(THIRD_PARTY_REGEX_A_DEPS) $(THIRD_PARTY_REGEX_A)
THIRD_PARTY_REGEX_A = o/$(MODE)/third_party/regex/regex.a
THIRD_PARTY_REGEX_A_FILES := $(wildcard third_party/regex/*)
THIRD_PARTY_REGEX_A_HDRS = $(filter %.h,$(THIRD_PARTY_REGEX_A_FILES))
THIRD_PARTY_REGEX_A_INCS = $(filter %.inc,$(THIRD_PARTY_REGEX_A_FILES))
THIRD_PARTY_REGEX_A_SRCS = $(filter %.c,$(THIRD_PARTY_REGEX_A_FILES))
THIRD_PARTY_REGEX_A_OBJS = \
$(THIRD_PARTY_REGEX_A_SRCS:%.c=o/$(MODE)/%.o)
THIRD_PARTY_REGEX_A_DIRECTDEPS = \
LIBC_FMT \
LIBC_INTRIN \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STR \
LIBC_STUBS
THIRD_PARTY_REGEX_A_DEPS := \
$(call uniq,$(foreach x,$(THIRD_PARTY_REGEX_A_DIRECTDEPS),$($(x))))
THIRD_PARTY_REGEX_A_CHECKS = \
$(THIRD_PARTY_REGEX_A).pkg \
$(THIRD_PARTY_REGEX_A_HDRS:%=o/$(MODE)/%.ok)
$(THIRD_PARTY_REGEX_A): \
third_party/regex/ \
$(THIRD_PARTY_REGEX_A).pkg \
$(THIRD_PARTY_REGEX_A_OBJS)
$(THIRD_PARTY_REGEX_A).pkg: \
$(THIRD_PARTY_REGEX_A_OBJS) \
$(foreach x,$(THIRD_PARTY_REGEX_A_DIRECTDEPS),$($(x)_A).pkg)
THIRD_PARTY_REGEX_LIBS = $(foreach x,$(THIRD_PARTY_REGEX_ARTIFACTS),$($(x)))
THIRD_PARTY_REGEX_HDRS = $(foreach x,$(THIRD_PARTY_REGEX_ARTIFACTS),$($(x)_HDRS))
THIRD_PARTY_REGEX_SRCS = $(foreach x,$(THIRD_PARTY_REGEX_ARTIFACTS),$($(x)_SRCS))
THIRD_PARTY_REGEX_INCS = $(foreach x,$(THIRD_PARTY_REGEX_ARTIFACTS),$($(x)_INCS))
THIRD_PARTY_REGEX_CHECKS = $(foreach x,$(THIRD_PARTY_REGEX_ARTIFACTS),$($(x)_CHECKS))
THIRD_PARTY_REGEX_OBJS = $(foreach x,$(THIRD_PARTY_REGEX_ARTIFACTS),$($(x)_OBJS))
$(THIRD_PARTY_REGEX_OBJS): third_party/regex/regex.mk
o/$(MODE)/third_party/regex/regcomp.o \
o/$(MODE)/third_party/regex/regexec.o \
o/$(MODE)/third_party/regex/tre-mem.o: private \
OVERRIDE_CFLAGS += \
$(OLD_CODE)
.PHONY: o/$(MODE)/third_party/regex
o/$(MODE)/third_party/regex: $(THIRD_PARTY_REGEX_CHECKS)
| 2,200 | 59 | jart/cosmopolitan | false |
cosmopolitan/third_party/regex/tre.inc | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â â
â Musl Libc â
â Copyright © 2005-2014 Rich Felker, et al. â
â â
â Permission is hereby granted, free of charge, to any person obtaining â
â a copy of this software and associated documentation files (the â
â "Software"), to deal in the Software without restriction, including â
â without limitation the rights to use, copy, modify, merge, publish, â
â distribute, sublicense, and/or sell copies of the Software, and to â
â permit persons to whom the Software is furnished to do so, subject to â
â the following conditions: â
â â
â The above copyright notice and this permission notice shall be â
â included in all copies or substantial portions of the Software. â
â â
â THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, â
â EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF â
â MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. â
â IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY â
â CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, â
â TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE â
â SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. â
â â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â â
â tre-internal.h - TRE internal definitions â
â â
â Copyright (c) 2001-2009 Ville Laurikari <[email protected]> â
â All rights reserved. â
â â
â Redistribution and use in source and binary forms, with or without â
â modification, are permitted provided that the following conditions â
â are met: â
â â
â 1. Redistributions of source code must retain the above copyright â
â notice, this list of conditions and the following disclaimer. â
â â
â 2. Redistributions in binary form must reproduce the above copyright â
â notice, this list of conditions and the following disclaimer in â
â the documentation and/or other materials provided with the â
â distribution. â
â â
â THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS â
â ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT â
â LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR â
â A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT â
â HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, â
â SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT â
â LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, â
â DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY â
â THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT â
â (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE â
â OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. â
â â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/assert.h"
#include "libc/mem/alg.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "third_party/regex/notice.inc"
#include "third_party/regex/regex.h"
#undef TRE_MBSTATE
#define TRE_REGEX_T_FIELD __opaque
typedef int reg_errcode_t;
typedef wchar_t tre_char_t;
#define DPRINT(msg) \
do { \
} while (0)
#define elementsof(x) (sizeof(x) / sizeof(x[0]))
#define tre_mbrtowc(pwc, s, n, ps) (mbtowc((pwc), (s), (n)))
/* Wide characters. */
typedef wint_t tre_cint_t;
#define TRE_CHAR_MAX 0x10ffff
#define tre_isalnum iswalnum
#define tre_isalpha iswalpha
#define tre_isblank iswblank
#define tre_iscntrl iswcntrl
#define tre_isdigit iswdigit
#define tre_isgraph iswgraph
#define tre_islower iswlower
#define tre_isprint iswprint
#define tre_ispunct iswpunct
#define tre_isspace iswspace
#define tre_isupper iswupper
#define tre_isxdigit iswxdigit
#define tre_tolower towlower
#define tre_toupper towupper
#define tre_strlen wcslen
/* Use system provided iswctype() and wctype(). */
typedef wctype_t tre_ctype_t;
#define tre_isctype iswctype
#define tre_ctype wctype
/* Returns number of bytes to add to (char *)ptr to make it
properly aligned for the type. */
#define ALIGN(ptr, type) \
((((long)ptr) % sizeof(type)) \
? (sizeof(type) - (((long)ptr) % sizeof(type))) \
: 0)
#undef MAX
#undef MIN
#define MAX(a, b) (((a) >= (b)) ? (a) : (b))
#define MIN(a, b) (((a) <= (b)) ? (a) : (b))
/* TNFA transition type. A TNFA state is an array of transitions,
the terminator is a transition with NULL `state'. */
typedef struct tnfa_transition tre_tnfa_transition_t;
struct tnfa_transition {
/* Range of accepted characters. */
tre_cint_t code_min;
tre_cint_t code_max;
/* Pointer to the destination state. */
tre_tnfa_transition_t *state;
/* ID number of the destination state. */
int state_id;
/* -1 terminated array of tags (or NULL). */
int *tags;
/* Assertion bitmap. */
int assertions;
/* Assertion parameters. */
union {
/* Character class assertion. */
tre_ctype_t class;
/* Back reference assertion. */
int backref;
} u;
/* Negative character class assertions. */
tre_ctype_t *neg_classes;
};
/* Assertions. */
#define ASSERT_AT_BOL 1 /* Beginning of line. */
#define ASSERT_AT_EOL 2 /* End of line. */
#define ASSERT_CHAR_CLASS 4 /* Character class in `class'. */
#define ASSERT_CHAR_CLASS_NEG 8 /* Character classes in `neg_classes'. */
#define ASSERT_AT_BOW 16 /* Beginning of word. */
#define ASSERT_AT_EOW 32 /* End of word. */
#define ASSERT_AT_WB 64 /* Word boundary. */
#define ASSERT_AT_WB_NEG 128 /* Not a word boundary. */
#define ASSERT_BACKREF 256 /* A back reference in `backref'. */
#define ASSERT_LAST 256
/* Tag directions. */
typedef enum { TRE_TAG_MINIMIZE = 0, TRE_TAG_MAXIMIZE = 1 } tre_tag_direction_t;
/* Instructions to compute submatch register values from tag values
after a successful match. */
struct tre_submatch_data {
/* Tag that gives the value for rm_so (submatch start offset). */
int so_tag;
/* Tag that gives the value for rm_eo (submatch end offset). */
int eo_tag;
/* List of submatches this submatch is contained in. */
int *parents;
};
typedef struct tre_submatch_data tre_submatch_data_t;
/* TNFA definition. */
typedef struct tnfa tre_tnfa_t;
struct tnfa {
tre_tnfa_transition_t *transitions;
unsigned int num_transitions;
tre_tnfa_transition_t *initial;
tre_tnfa_transition_t *final;
tre_submatch_data_t *submatch_data;
char *firstpos_chars;
int first_char;
unsigned int num_submatches;
tre_tag_direction_t *tag_directions;
int *minimal_tags;
int num_tags;
int num_minimals;
int end_tag;
int num_states;
int cflags;
int have_backrefs;
int have_approx;
};
/* from tre-mem.h: */
#define TRE_MEM_BLOCK_SIZE 1024
typedef struct tre_list {
void *data;
struct tre_list *next;
} tre_list_t;
typedef struct tre_mem_struct {
tre_list_t *blocks;
tre_list_t *current;
char *ptr;
size_t n;
int failed;
void **provided;
} * tre_mem_t;
#define tre_mem_new_impl __tre_mem_new_impl
#define tre_mem_alloc_impl __tre_mem_alloc_impl
#define tre_mem_destroy __tre_mem_destroy
tre_mem_t tre_mem_new_impl(int provided, void *provided_block) _Hide;
void *tre_mem_alloc_impl(tre_mem_t mem, int provided, void *provided_block,
int zero, size_t size) _Hide;
/* Returns a new memory allocator or NULL if out of memory. */
#define tre_mem_new() tre_mem_new_impl(0, NULL)
/* Allocates a block of `size' bytes from `mem'. Returns a pointer to the
allocated block or NULL if an underlying malloc() failed. */
#define tre_mem_alloc(mem, size) tre_mem_alloc_impl(mem, 0, NULL, 0, size)
/* Allocates a block of `size' bytes from `mem'. Returns a pointer to the
allocated block or NULL if an underlying malloc() failed. The memory
is set to zero. */
#define tre_mem_calloc(mem, size) tre_mem_alloc_impl(mem, 0, NULL, 1, size)
#ifdef TRE_USE_ALLOCA
/* alloca() versions. Like above, but memory is allocated with alloca()
instead of malloc(). */
#define tre_mem_newa() \
tre_mem_new_impl(1, alloca(sizeof(struct tre_mem_struct)))
#define tre_mem_alloca(mem, size) \
((mem)->n >= (size) \
? tre_mem_alloc_impl((mem), 1, NULL, 0, (size)) \
: tre_mem_alloc_impl((mem), 1, alloca(TRE_MEM_BLOCK_SIZE), 0, (size)))
#endif /* TRE_USE_ALLOCA */
/* Frees the memory allocator and all memory allocated with it. */
_Hide void tre_mem_destroy(tre_mem_t mem);
| 11,107 | 249 | jart/cosmopolitan | false |
cosmopolitan/third_party/intel/fxsrintrin.internal.h | #if !defined _IMMINTRIN_H_INCLUDED
#error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef _FXSRINTRIN_H_INCLUDED
#define _FXSRINTRIN_H_INCLUDED
#ifndef __FXSR__
#pragma GCC push_options
#pragma GCC target("fxsr")
#define __DISABLE_FXSR__
#endif /* __FXSR__ */
__funline void _fxsave(void *__P) {
__builtin_ia32_fxsave(__P);
}
__funline void _fxrstor(void *__P) {
__builtin_ia32_fxrstor(__P);
}
#ifdef __x86_64__
__funline void _fxsave64(void *__P) {
__builtin_ia32_fxsave64(__P);
}
__funline void _fxrstor64(void *__P) {
__builtin_ia32_fxrstor64(__P);
}
#endif
#ifdef __DISABLE_FXSR__
#undef __DISABLE_FXSR__
#pragma GCC pop_options
#endif /* __DISABLE_FXSR__ */
#endif /* _FXSRINTRIN_H_INCLUDED */
| 750 | 38 | jart/cosmopolitan | false |
cosmopolitan/third_party/intel/xsaveoptintrin.internal.h | #if !defined _IMMINTRIN_H_INCLUDED
#error "Never use <xsaveoptintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef _XSAVEOPTINTRIN_H_INCLUDED
#define _XSAVEOPTINTRIN_H_INCLUDED
#ifndef __XSAVEOPT__
#pragma GCC push_options
#pragma GCC target("xsaveopt")
#define __DISABLE_XSAVEOPT__
#endif /* __XSAVEOPT__ */
__funline void _xsaveopt(void *__P, long long __M) {
__builtin_ia32_xsaveopt(__P, __M);
}
#ifdef __x86_64__
__funline void _xsaveopt64(void *__P, long long __M) {
__builtin_ia32_xsaveopt64(__P, __M);
}
#endif
#ifdef __DISABLE_XSAVEOPT__
#undef __DISABLE_XSAVEOPT__
#pragma GCC pop_options
#endif /* __DISABLE_XSAVEOPT__ */
#endif /* _XSAVEOPTINTRIN_H_INCLUDED */
| 696 | 30 | jart/cosmopolitan | false |
cosmopolitan/third_party/intel/bmiintrin.internal.h | #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED
#error "Never use <bmiintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef _BMIINTRIN_H_INCLUDED
#define _BMIINTRIN_H_INCLUDED
#ifndef __BMI__
#pragma GCC push_options
#pragma GCC target("bmi")
#define __DISABLE_BMI__
#endif /* __BMI__ */
extern __inline unsigned short
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__tzcnt_u16(unsigned short __X) {
return __builtin_ia32_tzcnt_u16(__X);
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__andn_u32(unsigned int __X, unsigned int __Y) {
return ~__X & __Y;
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__bextr_u32(unsigned int __X, unsigned int __Y) {
return __builtin_ia32_bextr_u32(__X, __Y);
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_bextr_u32(unsigned int __X, unsigned int __Y, unsigned __Z) {
return __builtin_ia32_bextr_u32(__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__blsi_u32(unsigned int __X) {
return __X & -__X;
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_blsi_u32(unsigned int __X) {
return __blsi_u32(__X);
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__blsmsk_u32(unsigned int __X) {
return __X ^ (__X - 1);
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_blsmsk_u32(unsigned int __X) {
return __blsmsk_u32(__X);
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__blsr_u32(unsigned int __X) {
return __X & (__X - 1);
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_blsr_u32(unsigned int __X) {
return __blsr_u32(__X);
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__tzcnt_u32(unsigned int __X) {
return __builtin_ia32_tzcnt_u32(__X);
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_tzcnt_u32(unsigned int __X) {
return __builtin_ia32_tzcnt_u32(__X);
}
#ifdef __x86_64__
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__andn_u64(unsigned long long __X, unsigned long long __Y) {
return ~__X & __Y;
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__bextr_u64(unsigned long long __X, unsigned long long __Y) {
return __builtin_ia32_bextr_u64(__X, __Y);
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_bextr_u64(unsigned long long __X, unsigned int __Y, unsigned int __Z) {
return __builtin_ia32_bextr_u64(__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__blsi_u64(unsigned long long __X) {
return __X & -__X;
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_blsi_u64(unsigned long long __X) {
return __blsi_u64(__X);
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__blsmsk_u64(unsigned long long __X) {
return __X ^ (__X - 1);
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_blsmsk_u64(unsigned long long __X) {
return __blsmsk_u64(__X);
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__blsr_u64(unsigned long long __X) {
return __X & (__X - 1);
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_blsr_u64(unsigned long long __X) {
return __blsr_u64(__X);
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__tzcnt_u64(unsigned long long __X) {
return __builtin_ia32_tzcnt_u64(__X);
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_tzcnt_u64(unsigned long long __X) {
return __builtin_ia32_tzcnt_u64(__X);
}
#endif /* __x86_64__ */
#ifdef __DISABLE_BMI__
#undef __DISABLE_BMI__
#pragma GCC pop_options
#endif /* __DISABLE_BMI__ */
#endif /* _BMIINTRIN_H_INCLUDED */
| 4,767 | 161 | jart/cosmopolitan | false |
cosmopolitan/third_party/intel/lwpintrin.internal.h | #ifndef _X86INTRIN_H_INCLUDED
#error "Never use <lwpintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef _LWPINTRIN_H_INCLUDED
#define _LWPINTRIN_H_INCLUDED
#ifndef __LWP__
#pragma GCC push_options
#pragma GCC target("lwp")
#define __DISABLE_LWP__
#endif /* __LWP__ */
__funline void __llwpcb(void *__pcbAddress) {
__builtin_ia32_llwpcb(__pcbAddress);
}
__funline void *__slwpcb(void) {
return __builtin_ia32_slwpcb();
}
#ifdef __OPTIMIZE__
__funline void __lwpval32(unsigned int __data2, unsigned int __data1,
unsigned int __flags) {
__builtin_ia32_lwpval32(__data2, __data1, __flags);
}
#ifdef __x86_64__
__funline void __lwpval64(unsigned long long __data2, unsigned int __data1,
unsigned int __flags) {
__builtin_ia32_lwpval64(__data2, __data1, __flags);
}
#endif
#else
#define __lwpval32(D2, D1, F) \
(__builtin_ia32_lwpval32((unsigned int)(D2), (unsigned int)(D1), \
(unsigned int)(F)))
#ifdef __x86_64__
#define __lwpval64(D2, D1, F) \
(__builtin_ia32_lwpval64((unsigned long long)(D2), (unsigned int)(D1), \
(unsigned int)(F)))
#endif
#endif
#ifdef __OPTIMIZE__
__funline unsigned char __lwpins32(unsigned int __data2, unsigned int __data1,
unsigned int __flags) {
return __builtin_ia32_lwpins32(__data2, __data1, __flags);
}
#ifdef __x86_64__
__funline unsigned char __lwpins64(unsigned long long __data2,
unsigned int __data1, unsigned int __flags) {
return __builtin_ia32_lwpins64(__data2, __data1, __flags);
}
#endif
#else
#define __lwpins32(D2, D1, F) \
(__builtin_ia32_lwpins32((unsigned int)(D2), (unsigned int)(D1), \
(unsigned int)(F)))
#ifdef __x86_64__
#define __lwpins64(D2, D1, F) \
(__builtin_ia32_lwpins64((unsigned long long)(D2), (unsigned int)(D1), \
(unsigned int)(F)))
#endif
#endif
#ifdef __DISABLE_LWP__
#undef __DISABLE_LWP__
#pragma GCC pop_options
#endif /* __DISABLE_LWP__ */
#endif /* _LWPINTRIN_H_INCLUDED */
| 2,271 | 74 | jart/cosmopolitan | false |
cosmopolitan/third_party/intel/avx512erintrin.internal.h | #ifndef _IMMINTRIN_H_INCLUDED
#error "Never use <avx512erintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef _AVX512ERINTRIN_H_INCLUDED
#define _AVX512ERINTRIN_H_INCLUDED
#ifndef __AVX512ER__
#pragma GCC push_options
#pragma GCC target("avx512er")
#define __DISABLE_AVX512ER__
#endif /* __AVX512ER__ */
typedef double __v8df __attribute__((__vector_size__(64)));
typedef float __v16sf __attribute__((__vector_size__(64)));
typedef float __m512 __attribute__((__vector_size__(64), __may_alias__));
typedef double __m512d __attribute__((__vector_size__(64), __may_alias__));
typedef unsigned char __mmask8;
typedef unsigned short __mmask16;
#ifdef __OPTIMIZE__
__funline __m512d _mm512_exp2a23_round_pd(__m512d __A, int __R) {
__m512d __W;
return (__m512d)__builtin_ia32_exp2pd_mask((__v8df)__A, (__v8df)__W,
(__mmask8)-1, __R);
}
__funline __m512d _mm512_mask_exp2a23_round_pd(__m512d __W, __mmask8 __U,
__m512d __A, int __R) {
return (__m512d)__builtin_ia32_exp2pd_mask((__v8df)__A, (__v8df)__W,
(__mmask8)__U, __R);
}
__funline __m512d _mm512_maskz_exp2a23_round_pd(__mmask8 __U, __m512d __A,
int __R) {
return (__m512d)__builtin_ia32_exp2pd_mask(
(__v8df)__A, (__v8df)_mm512_setzero_pd(), (__mmask8)__U, __R);
}
__funline __m512 _mm512_exp2a23_round_ps(__m512 __A, int __R) {
__m512 __W;
return (__m512)__builtin_ia32_exp2ps_mask((__v16sf)__A, (__v16sf)__W,
(__mmask16)-1, __R);
}
__funline __m512 _mm512_mask_exp2a23_round_ps(__m512 __W, __mmask16 __U,
__m512 __A, int __R) {
return (__m512)__builtin_ia32_exp2ps_mask((__v16sf)__A, (__v16sf)__W,
(__mmask16)__U, __R);
}
__funline __m512 _mm512_maskz_exp2a23_round_ps(__mmask16 __U, __m512 __A,
int __R) {
return (__m512)__builtin_ia32_exp2ps_mask(
(__v16sf)__A, (__v16sf)_mm512_setzero_ps(), (__mmask16)__U, __R);
}
__funline __m512d _mm512_rcp28_round_pd(__m512d __A, int __R) {
__m512d __W;
return (__m512d)__builtin_ia32_rcp28pd_mask((__v8df)__A, (__v8df)__W,
(__mmask8)-1, __R);
}
__funline __m512d _mm512_mask_rcp28_round_pd(__m512d __W, __mmask8 __U,
__m512d __A, int __R) {
return (__m512d)__builtin_ia32_rcp28pd_mask((__v8df)__A, (__v8df)__W,
(__mmask8)__U, __R);
}
__funline __m512d _mm512_maskz_rcp28_round_pd(__mmask8 __U, __m512d __A,
int __R) {
return (__m512d)__builtin_ia32_rcp28pd_mask(
(__v8df)__A, (__v8df)_mm512_setzero_pd(), (__mmask8)__U, __R);
}
__funline __m512 _mm512_rcp28_round_ps(__m512 __A, int __R) {
__m512 __W;
return (__m512)__builtin_ia32_rcp28ps_mask((__v16sf)__A, (__v16sf)__W,
(__mmask16)-1, __R);
}
__funline __m512 _mm512_mask_rcp28_round_ps(__m512 __W, __mmask16 __U, __m512 __A,
int __R) {
return (__m512)__builtin_ia32_rcp28ps_mask((__v16sf)__A, (__v16sf)__W,
(__mmask16)__U, __R);
}
__funline __m512 _mm512_maskz_rcp28_round_ps(__mmask16 __U, __m512 __A, int __R) {
return (__m512)__builtin_ia32_rcp28ps_mask(
(__v16sf)__A, (__v16sf)_mm512_setzero_ps(), (__mmask16)__U, __R);
}
__funline __m128d _mm_rcp28_round_sd(__m128d __A, __m128d __B, int __R) {
return (__m128d)__builtin_ia32_rcp28sd_round((__v2df)__B, (__v2df)__A, __R);
}
__funline __m128 _mm_rcp28_round_ss(__m128 __A, __m128 __B, int __R) {
return (__m128)__builtin_ia32_rcp28ss_round((__v4sf)__B, (__v4sf)__A, __R);
}
__funline __m512d _mm512_rsqrt28_round_pd(__m512d __A, int __R) {
__m512d __W;
return (__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)__A, (__v8df)__W,
(__mmask8)-1, __R);
}
__funline __m512d _mm512_mask_rsqrt28_round_pd(__m512d __W, __mmask8 __U,
__m512d __A, int __R) {
return (__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)__A, (__v8df)__W,
(__mmask8)__U, __R);
}
__funline __m512d _mm512_maskz_rsqrt28_round_pd(__mmask8 __U, __m512d __A,
int __R) {
return (__m512d)__builtin_ia32_rsqrt28pd_mask(
(__v8df)__A, (__v8df)_mm512_setzero_pd(), (__mmask8)__U, __R);
}
__funline __m512 _mm512_rsqrt28_round_ps(__m512 __A, int __R) {
__m512 __W;
return (__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)__A, (__v16sf)__W,
(__mmask16)-1, __R);
}
__funline __m512 _mm512_mask_rsqrt28_round_ps(__m512 __W, __mmask16 __U,
__m512 __A, int __R) {
return (__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)__A, (__v16sf)__W,
(__mmask16)__U, __R);
}
__funline __m512 _mm512_maskz_rsqrt28_round_ps(__mmask16 __U, __m512 __A,
int __R) {
return (__m512)__builtin_ia32_rsqrt28ps_mask(
(__v16sf)__A, (__v16sf)_mm512_setzero_ps(), (__mmask16)__U, __R);
}
__funline __m128d _mm_rsqrt28_round_sd(__m128d __A, __m128d __B, int __R) {
return (__m128d)__builtin_ia32_rsqrt28sd_round((__v2df)__B, (__v2df)__A, __R);
}
__funline __m128 _mm_rsqrt28_round_ss(__m128 __A, __m128 __B, int __R) {
return (__m128)__builtin_ia32_rsqrt28ss_round((__v4sf)__B, (__v4sf)__A, __R);
}
#else
#define _mm512_exp2a23_round_pd(A, C) \
__builtin_ia32_exp2pd_mask(A, (__v8df)_mm512_setzero_pd(), -1, C)
#define _mm512_mask_exp2a23_round_pd(W, U, A, C) \
__builtin_ia32_exp2pd_mask(A, W, U, C)
#define _mm512_maskz_exp2a23_round_pd(U, A, C) \
__builtin_ia32_exp2pd_mask(A, (__v8df)_mm512_setzero_pd(), U, C)
#define _mm512_exp2a23_round_ps(A, C) \
__builtin_ia32_exp2ps_mask(A, (__v16sf)_mm512_setzero_ps(), -1, C)
#define _mm512_mask_exp2a23_round_ps(W, U, A, C) \
__builtin_ia32_exp2ps_mask(A, W, U, C)
#define _mm512_maskz_exp2a23_round_ps(U, A, C) \
__builtin_ia32_exp2ps_mask(A, (__v16sf)_mm512_setzero_ps(), U, C)
#define _mm512_rcp28_round_pd(A, C) \
__builtin_ia32_rcp28pd_mask(A, (__v8df)_mm512_setzero_pd(), -1, C)
#define _mm512_mask_rcp28_round_pd(W, U, A, C) \
__builtin_ia32_rcp28pd_mask(A, W, U, C)
#define _mm512_maskz_rcp28_round_pd(U, A, C) \
__builtin_ia32_rcp28pd_mask(A, (__v8df)_mm512_setzero_pd(), U, C)
#define _mm512_rcp28_round_ps(A, C) \
__builtin_ia32_rcp28ps_mask(A, (__v16sf)_mm512_setzero_ps(), -1, C)
#define _mm512_mask_rcp28_round_ps(W, U, A, C) \
__builtin_ia32_rcp28ps_mask(A, W, U, C)
#define _mm512_maskz_rcp28_round_ps(U, A, C) \
__builtin_ia32_rcp28ps_mask(A, (__v16sf)_mm512_setzero_ps(), U, C)
#define _mm512_rsqrt28_round_pd(A, C) \
__builtin_ia32_rsqrt28pd_mask(A, (__v8df)_mm512_setzero_pd(), -1, C)
#define _mm512_mask_rsqrt28_round_pd(W, U, A, C) \
__builtin_ia32_rsqrt28pd_mask(A, W, U, C)
#define _mm512_maskz_rsqrt28_round_pd(U, A, C) \
__builtin_ia32_rsqrt28pd_mask(A, (__v8df)_mm512_setzero_pd(), U, C)
#define _mm512_rsqrt28_round_ps(A, C) \
__builtin_ia32_rsqrt28ps_mask(A, (__v16sf)_mm512_setzero_ps(), -1, C)
#define _mm512_mask_rsqrt28_round_ps(W, U, A, C) \
__builtin_ia32_rsqrt28ps_mask(A, W, U, C)
#define _mm512_maskz_rsqrt28_round_ps(U, A, C) \
__builtin_ia32_rsqrt28ps_mask(A, (__v16sf)_mm512_setzero_ps(), U, C)
#define _mm_rcp28_round_sd(A, B, R) __builtin_ia32_rcp28sd_round(A, B, R)
#define _mm_rcp28_round_ss(A, B, R) __builtin_ia32_rcp28ss_round(A, B, R)
#define _mm_rsqrt28_round_sd(A, B, R) __builtin_ia32_rsqrt28sd_round(A, B, R)
#define _mm_rsqrt28_round_ss(A, B, R) __builtin_ia32_rsqrt28ss_round(A, B, R)
#endif
#define _mm512_exp2a23_pd(A) \
_mm512_exp2a23_round_pd(A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_mask_exp2a23_pd(W, U, A) \
_mm512_mask_exp2a23_round_pd(W, U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_maskz_exp2a23_pd(U, A) \
_mm512_maskz_exp2a23_round_pd(U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_exp2a23_ps(A) \
_mm512_exp2a23_round_ps(A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_mask_exp2a23_ps(W, U, A) \
_mm512_mask_exp2a23_round_ps(W, U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_maskz_exp2a23_ps(U, A) \
_mm512_maskz_exp2a23_round_ps(U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_rcp28_pd(A) _mm512_rcp28_round_pd(A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_mask_rcp28_pd(W, U, A) \
_mm512_mask_rcp28_round_pd(W, U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_maskz_rcp28_pd(U, A) \
_mm512_maskz_rcp28_round_pd(U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_rcp28_ps(A) _mm512_rcp28_round_ps(A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_mask_rcp28_ps(W, U, A) \
_mm512_mask_rcp28_round_ps(W, U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_maskz_rcp28_ps(U, A) \
_mm512_maskz_rcp28_round_ps(U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_rsqrt28_pd(A) \
_mm512_rsqrt28_round_pd(A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_mask_rsqrt28_pd(W, U, A) \
_mm512_mask_rsqrt28_round_pd(W, U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_maskz_rsqrt28_pd(U, A) \
_mm512_maskz_rsqrt28_round_pd(U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_rsqrt28_ps(A) \
_mm512_rsqrt28_round_ps(A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_mask_rsqrt28_ps(W, U, A) \
_mm512_mask_rsqrt28_round_ps(W, U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm512_maskz_rsqrt28_ps(U, A) \
_mm512_maskz_rsqrt28_round_ps(U, A, _MM_FROUND_CUR_DIRECTION)
#define _mm_rcp28_sd(A, B) \
__builtin_ia32_rcp28sd_round(B, A, _MM_FROUND_CUR_DIRECTION)
#define _mm_rcp28_ss(A, B) \
__builtin_ia32_rcp28ss_round(B, A, _MM_FROUND_CUR_DIRECTION)
#define _mm_rsqrt28_sd(A, B) \
__builtin_ia32_rsqrt28sd_round(B, A, _MM_FROUND_CUR_DIRECTION)
#define _mm_rsqrt28_ss(A, B) \
__builtin_ia32_rsqrt28ss_round(B, A, _MM_FROUND_CUR_DIRECTION)
#ifdef __DISABLE_AVX512ER__
#undef __DISABLE_AVX512ER__
#pragma GCC pop_options
#endif /* __DISABLE_AVX512ER__ */
#endif /* _AVX512ERINTRIN_H_INCLUDED */
| 10,350 | 282 | jart/cosmopolitan | false |
cosmopolitan/third_party/intel/avx512vldqintrin.internal.h | #ifndef _IMMINTRIN_H_INCLUDED
#error "Never use <avx512vldqintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef _AVX512VLDQINTRIN_H_INCLUDED
#define _AVX512VLDQINTRIN_H_INCLUDED
#if !defined(__AVX512VL__) || !defined(__AVX512DQ__)
#pragma GCC push_options
#pragma GCC target("avx512vl,avx512dq")
#define __DISABLE_AVX512VLDQ__
#endif /* __AVX512VLDQ__ */
__funline __m256i _mm256_cvttpd_epi64(__m256d __A) {
return (__m256i)__builtin_ia32_cvttpd2qq256_mask(
(__v4df)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)-1);
}
__funline __m256i _mm256_mask_cvttpd_epi64(__m256i __W, __mmask8 __U,
__m256d __A) {
return (__m256i)__builtin_ia32_cvttpd2qq256_mask((__v4df)__A, (__v4di)__W,
(__mmask8)__U);
}
__funline __m256i _mm256_maskz_cvttpd_epi64(__mmask8 __U, __m256d __A) {
return (__m256i)__builtin_ia32_cvttpd2qq256_mask(
(__v4df)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)__U);
}
__funline __m128i _mm_cvttpd_epi64(__m128d __A) {
return (__m128i)__builtin_ia32_cvttpd2qq128_mask(
(__v2df)__A, (__v2di)_mm_setzero_si128(), (__mmask8)-1);
}
__funline __m128i _mm_mask_cvttpd_epi64(__m128i __W, __mmask8 __U, __m128d __A) {
return (__m128i)__builtin_ia32_cvttpd2qq128_mask((__v2df)__A, (__v2di)__W,
(__mmask8)__U);
}
__funline __m128i _mm_maskz_cvttpd_epi64(__mmask8 __U, __m128d __A) {
return (__m128i)__builtin_ia32_cvttpd2qq128_mask(
(__v2df)__A, (__v2di)_mm_setzero_si128(), (__mmask8)__U);
}
__funline __m256i _mm256_cvttpd_epu64(__m256d __A) {
return (__m256i)__builtin_ia32_cvttpd2uqq256_mask(
(__v4df)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)-1);
}
__funline __m256i _mm256_mask_cvttpd_epu64(__m256i __W, __mmask8 __U,
__m256d __A) {
return (__m256i)__builtin_ia32_cvttpd2uqq256_mask((__v4df)__A, (__v4di)__W,
(__mmask8)__U);
}
__funline __m256i _mm256_maskz_cvttpd_epu64(__mmask8 __U, __m256d __A) {
return (__m256i)__builtin_ia32_cvttpd2uqq256_mask(
(__v4df)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)__U);
}
__funline __m128i _mm_cvttpd_epu64(__m128d __A) {
return (__m128i)__builtin_ia32_cvttpd2uqq128_mask(
(__v2df)__A, (__v2di)_mm_setzero_si128(), (__mmask8)-1);
}
__funline __m128i _mm_mask_cvttpd_epu64(__m128i __W, __mmask8 __U, __m128d __A) {
return (__m128i)__builtin_ia32_cvttpd2uqq128_mask((__v2df)__A, (__v2di)__W,
(__mmask8)__U);
}
__funline __m128i _mm_maskz_cvttpd_epu64(__mmask8 __U, __m128d __A) {
return (__m128i)__builtin_ia32_cvttpd2uqq128_mask(
(__v2df)__A, (__v2di)_mm_setzero_si128(), (__mmask8)__U);
}
__funline __m256i _mm256_cvtpd_epi64(__m256d __A) {
return (__m256i)__builtin_ia32_cvtpd2qq256_mask(
(__v4df)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)-1);
}
__funline __m256i _mm256_mask_cvtpd_epi64(__m256i __W, __mmask8 __U,
__m256d __A) {
return (__m256i)__builtin_ia32_cvtpd2qq256_mask((__v4df)__A, (__v4di)__W,
(__mmask8)__U);
}
__funline __m256i _mm256_maskz_cvtpd_epi64(__mmask8 __U, __m256d __A) {
return (__m256i)__builtin_ia32_cvtpd2qq256_mask(
(__v4df)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)__U);
}
__funline __m128i _mm_cvtpd_epi64(__m128d __A) {
return (__m128i)__builtin_ia32_cvtpd2qq128_mask(
(__v2df)__A, (__v2di)_mm_setzero_si128(), (__mmask8)-1);
}
__funline __m128i _mm_mask_cvtpd_epi64(__m128i __W, __mmask8 __U, __m128d __A) {
return (__m128i)__builtin_ia32_cvtpd2qq128_mask((__v2df)__A, (__v2di)__W,
(__mmask8)__U);
}
__funline __m128i _mm_maskz_cvtpd_epi64(__mmask8 __U, __m128d __A) {
return (__m128i)__builtin_ia32_cvtpd2qq128_mask(
(__v2df)__A, (__v2di)_mm_setzero_si128(), (__mmask8)__U);
}
__funline __m256i _mm256_cvtpd_epu64(__m256d __A) {
return (__m256i)__builtin_ia32_cvtpd2uqq256_mask(
(__v4df)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)-1);
}
__funline __m256i _mm256_mask_cvtpd_epu64(__m256i __W, __mmask8 __U,
__m256d __A) {
return (__m256i)__builtin_ia32_cvtpd2uqq256_mask((__v4df)__A, (__v4di)__W,
(__mmask8)__U);
}
__funline __m256i _mm256_maskz_cvtpd_epu64(__mmask8 __U, __m256d __A) {
return (__m256i)__builtin_ia32_cvtpd2uqq256_mask(
(__v4df)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)__U);
}
__funline __m128i _mm_cvtpd_epu64(__m128d __A) {
return (__m128i)__builtin_ia32_cvtpd2uqq128_mask(
(__v2df)__A, (__v2di)_mm_setzero_si128(), (__mmask8)-1);
}
__funline __m128i _mm_mask_cvtpd_epu64(__m128i __W, __mmask8 __U, __m128d __A) {
return (__m128i)__builtin_ia32_cvtpd2uqq128_mask((__v2df)__A, (__v2di)__W,
(__mmask8)__U);
}
__funline __m128i _mm_maskz_cvtpd_epu64(__mmask8 __U, __m128d __A) {
return (__m128i)__builtin_ia32_cvtpd2uqq128_mask(
(__v2df)__A, (__v2di)_mm_setzero_si128(), (__mmask8)__U);
}
__funline __m256i _mm256_cvttps_epi64(__m128 __A) {
return (__m256i)__builtin_ia32_cvttps2qq256_mask(
(__v4sf)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)-1);
}
__funline __m256i _mm256_mask_cvttps_epi64(__m256i __W, __mmask8 __U,
__m128 __A) {
return (__m256i)__builtin_ia32_cvttps2qq256_mask((__v4sf)__A, (__v4di)__W,
(__mmask8)__U);
}
__funline __m256i _mm256_maskz_cvttps_epi64(__mmask8 __U, __m128 __A) {
return (__m256i)__builtin_ia32_cvttps2qq256_mask(
(__v4sf)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)__U);
}
__funline __m128i _mm_cvttps_epi64(__m128 __A) {
return (__m128i)__builtin_ia32_cvttps2qq128_mask(
(__v4sf)__A, (__v2di)_mm_setzero_si128(), (__mmask8)-1);
}
__funline __m128i _mm_mask_cvttps_epi64(__m128i __W, __mmask8 __U, __m128 __A) {
return (__m128i)__builtin_ia32_cvttps2qq128_mask((__v4sf)__A, (__v2di)__W,
(__mmask8)__U);
}
__funline __m128i _mm_maskz_cvttps_epi64(__mmask8 __U, __m128 __A) {
return (__m128i)__builtin_ia32_cvttps2qq128_mask(
(__v4sf)__A, (__v2di)_mm_setzero_si128(), (__mmask8)__U);
}
__funline __m256i _mm256_cvttps_epu64(__m128 __A) {
return (__m256i)__builtin_ia32_cvttps2uqq256_mask(
(__v4sf)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)-1);
}
__funline __m256i _mm256_mask_cvttps_epu64(__m256i __W, __mmask8 __U,
__m128 __A) {
return (__m256i)__builtin_ia32_cvttps2uqq256_mask((__v4sf)__A, (__v4di)__W,
(__mmask8)__U);
}
__funline __m256i _mm256_maskz_cvttps_epu64(__mmask8 __U, __m128 __A) {
return (__m256i)__builtin_ia32_cvttps2uqq256_mask(
(__v4sf)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)__U);
}
__funline __m128i _mm_cvttps_epu64(__m128 __A) {
return (__m128i)__builtin_ia32_cvttps2uqq128_mask(
(__v4sf)__A, (__v2di)_mm_setzero_si128(), (__mmask8)-1);
}
__funline __m128i _mm_mask_cvttps_epu64(__m128i __W, __mmask8 __U, __m128 __A) {
return (__m128i)__builtin_ia32_cvttps2uqq128_mask((__v4sf)__A, (__v2di)__W,
(__mmask8)__U);
}
__funline __m128i _mm_maskz_cvttps_epu64(__mmask8 __U, __m128 __A) {
return (__m128i)__builtin_ia32_cvttps2uqq128_mask(
(__v4sf)__A, (__v2di)_mm_setzero_si128(), (__mmask8)__U);
}
__funline __m256d _mm256_broadcast_f64x2(__m128d __A) {
return (__m256d)__builtin_ia32_broadcastf64x2_256_mask(
(__v2df)__A, (__v4df)_mm256_undefined_pd(), (__mmask8)-1);
}
__funline __m256d _mm256_mask_broadcast_f64x2(__m256d __O, __mmask8 __M,
__m128d __A) {
return (__m256d)__builtin_ia32_broadcastf64x2_256_mask((__v2df)__A,
(__v4df)__O, __M);
}
__funline __m256d _mm256_maskz_broadcast_f64x2(__mmask8 __M, __m128d __A) {
return (__m256d)__builtin_ia32_broadcastf64x2_256_mask(
(__v2df)__A, (__v4df)_mm256_setzero_ps(), __M);
}
__funline __m256i _mm256_broadcast_i64x2(__m128i __A) {
return (__m256i)__builtin_ia32_broadcasti64x2_256_mask(
(__v2di)__A, (__v4di)_mm256_undefined_si256(), (__mmask8)-1);
}
__funline __m256i _mm256_mask_broadcast_i64x2(__m256i __O, __mmask8 __M,
__m128i __A) {
return (__m256i)__builtin_ia32_broadcasti64x2_256_mask((__v2di)__A,
(__v4di)__O, __M);
}
__funline __m256i _mm256_maskz_broadcast_i64x2(__mmask8 __M, __m128i __A) {
return (__m256i)__builtin_ia32_broadcasti64x2_256_mask(
(__v2di)__A, (__v4di)_mm256_setzero_si256(), __M);
}
__funline __m256 _mm256_broadcast_f32x2(__m128 __A) {
return (__m256)__builtin_ia32_broadcastf32x2_256_mask(
(__v4sf)__A, (__v8sf)_mm256_undefined_ps(), (__mmask8)-1);
}
__funline __m256 _mm256_mask_broadcast_f32x2(__m256 __O, __mmask8 __M,
__m128 __A) {
return (__m256)__builtin_ia32_broadcastf32x2_256_mask((__v4sf)__A,
(__v8sf)__O, __M);
}
__funline __m256 _mm256_maskz_broadcast_f32x2(__mmask8 __M, __m128 __A) {
return (__m256)__builtin_ia32_broadcastf32x2_256_mask(
(__v4sf)__A, (__v8sf)_mm256_setzero_ps(), __M);
}
__funline __m256i _mm256_broadcast_i32x2(__m128i __A) {
return (__m256i)__builtin_ia32_broadcasti32x2_256_mask(
(__v4si)__A, (__v8si)_mm256_undefined_si256(), (__mmask8)-1);
}
__funline __m256i _mm256_mask_broadcast_i32x2(__m256i __O, __mmask8 __M,
__m128i __A) {
return (__m256i)__builtin_ia32_broadcasti32x2_256_mask((__v4si)__A,
(__v8si)__O, __M);
}
__funline __m256i _mm256_maskz_broadcast_i32x2(__mmask8 __M, __m128i __A) {
return (__m256i)__builtin_ia32_broadcasti32x2_256_mask(
(__v4si)__A, (__v8si)_mm256_setzero_si256(), __M);
}
__funline __m128i _mm_broadcast_i32x2(__m128i __A) {
return (__m128i)__builtin_ia32_broadcasti32x2_128_mask(
(__v4si)__A, (__v4si)_mm_undefined_si128(), (__mmask8)-1);
}
__funline __m128i _mm_mask_broadcast_i32x2(__m128i __O, __mmask8 __M,
__m128i __A) {
return (__m128i)__builtin_ia32_broadcasti32x2_128_mask((__v4si)__A,
(__v4si)__O, __M);
}
__funline __m128i _mm_maskz_broadcast_i32x2(__mmask8 __M, __m128i __A) {
return (__m128i)__builtin_ia32_broadcasti32x2_128_mask(
(__v4si)__A, (__v4si)_mm_setzero_si128(), __M);
}
__funline __m256i _mm256_mullo_epi64(__m256i __A, __m256i __B) {
return (__m256i)((__v4du)__A * (__v4du)__B);
}
__funline __m256i _mm256_mask_mullo_epi64(__m256i __W, __mmask8 __U, __m256i __A,
__m256i __B) {
return (__m256i)__builtin_ia32_pmullq256_mask((__v4di)__A, (__v4di)__B,
(__v4di)__W, (__mmask8)__U);
}
__funline __m256i _mm256_maskz_mullo_epi64(__mmask8 __U, __m256i __A,
__m256i __B) {
return (__m256i)__builtin_ia32_pmullq256_mask(
(__v4di)__A, (__v4di)__B, (__v4di)_mm256_setzero_si256(), (__mmask8)__U);
}
__funline __m128i _mm_mullo_epi64(__m128i __A, __m128i __B) {
return (__m128i)((__v2du)__A * (__v2du)__B);
}
__funline __m128i _mm_mask_mullo_epi64(__m128i __W, __mmask8 __U, __m128i __A,
__m128i __B) {
return (__m128i)__builtin_ia32_pmullq128_mask((__v2di)__A, (__v2di)__B,
(__v2di)__W, (__mmask8)__U);
}
__funline __m128i _mm_maskz_mullo_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pmullq128_mask(
(__v2di)__A, (__v2di)__B, (__v2di)_mm_setzero_si128(), (__mmask8)__U);
}
__funline __m256d _mm256_mask_andnot_pd(__m256d __W, __mmask8 __U, __m256d __A,
__m256d __B) {
return (__m256d)__builtin_ia32_andnpd256_mask((__v4df)__A, (__v4df)__B,
(__v4df)__W, (__mmask8)__U);
}
__funline __m256d _mm256_maskz_andnot_pd(__mmask8 __U, __m256d __A, __m256d __B) {
return (__m256d)__builtin_ia32_andnpd256_mask(
(__v4df)__A, (__v4df)__B, (__v4df)_mm256_setzero_pd(), (__mmask8)__U);
}
__funline __m128d _mm_mask_andnot_pd(__m128d __W, __mmask8 __U, __m128d __A,
__m128d __B) {
return (__m128d)__builtin_ia32_andnpd128_mask((__v2df)__A, (__v2df)__B,
(__v2df)__W, (__mmask8)__U);
}
__funline __m128d _mm_maskz_andnot_pd(__mmask8 __U, __m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_andnpd128_mask(
(__v2df)__A, (__v2df)__B, (__v2df)_mm_setzero_pd(), (__mmask8)__U);
}
__funline __m256 _mm256_mask_andnot_ps(__m256 __W, __mmask8 __U, __m256 __A,
__m256 __B) {
return (__m256)__builtin_ia32_andnps256_mask((__v8sf)__A, (__v8sf)__B,
(__v8sf)__W, (__mmask8)__U);
}
__funline __m256 _mm256_maskz_andnot_ps(__mmask8 __U, __m256 __A, __m256 __B) {
return (__m256)__builtin_ia32_andnps256_mask(
(__v8sf)__A, (__v8sf)__B, (__v8sf)_mm256_setzero_ps(), (__mmask8)__U);
}
__funline __m128 _mm_mask_andnot_ps(__m128 __W, __mmask8 __U, __m128 __A,
__m128 __B) {
return (__m128)__builtin_ia32_andnps128_mask((__v4sf)__A, (__v4sf)__B,
(__v4sf)__W, (__mmask8)__U);
}
__funline __m128 _mm_maskz_andnot_ps(__mmask8 __U, __m128 __A, __m128 __B) {
return (__m128)__builtin_ia32_andnps128_mask(
(__v4sf)__A, (__v4sf)__B, (__v4sf)_mm_setzero_ps(), (__mmask8)__U);
}
__funline __m256i _mm256_cvtps_epi64(__m128 __A) {
return (__m256i)__builtin_ia32_cvtps2qq256_mask(
(__v4sf)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)-1);
}
__funline __m256i _mm256_mask_cvtps_epi64(__m256i __W, __mmask8 __U, __m128 __A) {
return (__m256i)__builtin_ia32_cvtps2qq256_mask((__v4sf)__A, (__v4di)__W,
(__mmask8)__U);
}
__funline __m256i _mm256_maskz_cvtps_epi64(__mmask8 __U, __m128 __A) {
return (__m256i)__builtin_ia32_cvtps2qq256_mask(
(__v4sf)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)__U);
}
__funline __m128i _mm_cvtps_epi64(__m128 __A) {
return (__m128i)__builtin_ia32_cvtps2qq128_mask(
(__v4sf)__A, (__v2di)_mm_setzero_si128(), (__mmask8)-1);
}
__funline __m128i _mm_mask_cvtps_epi64(__m128i __W, __mmask8 __U, __m128 __A) {
return (__m128i)__builtin_ia32_cvtps2qq128_mask((__v4sf)__A, (__v2di)__W,
(__mmask8)__U);
}
__funline __m128i _mm_maskz_cvtps_epi64(__mmask8 __U, __m128 __A) {
return (__m128i)__builtin_ia32_cvtps2qq128_mask(
(__v4sf)__A, (__v2di)_mm_setzero_si128(), (__mmask8)__U);
}
__funline __m256i _mm256_cvtps_epu64(__m128 __A) {
return (__m256i)__builtin_ia32_cvtps2uqq256_mask(
(__v4sf)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)-1);
}
__funline __m256i _mm256_mask_cvtps_epu64(__m256i __W, __mmask8 __U, __m128 __A) {
return (__m256i)__builtin_ia32_cvtps2uqq256_mask((__v4sf)__A, (__v4di)__W,
(__mmask8)__U);
}
__funline __m256i _mm256_maskz_cvtps_epu64(__mmask8 __U, __m128 __A) {
return (__m256i)__builtin_ia32_cvtps2uqq256_mask(
(__v4sf)__A, (__v4di)_mm256_setzero_si256(), (__mmask8)__U);
}
__funline __m128i _mm_cvtps_epu64(__m128 __A) {
return (__m128i)__builtin_ia32_cvtps2uqq128_mask(
(__v4sf)__A, (__v2di)_mm_setzero_si128(), (__mmask8)-1);
}
__funline __m128i _mm_mask_cvtps_epu64(__m128i __W, __mmask8 __U, __m128 __A) {
return (__m128i)__builtin_ia32_cvtps2uqq128_mask((__v4sf)__A, (__v2di)__W,
(__mmask8)__U);
}
__funline __m128i _mm_maskz_cvtps_epu64(__mmask8 __U, __m128 __A) {
return (__m128i)__builtin_ia32_cvtps2uqq128_mask(
(__v4sf)__A, (__v2di)_mm_setzero_si128(), (__mmask8)__U);
}
__funline __m128 _mm256_cvtepi64_ps(__m256i __A) {
return (__m128)__builtin_ia32_cvtqq2ps256_mask(
(__v4di)__A, (__v4sf)_mm_setzero_ps(), (__mmask8)-1);
}
__funline __m128 _mm256_mask_cvtepi64_ps(__m128 __W, __mmask8 __U, __m256i __A) {
return (__m128)__builtin_ia32_cvtqq2ps256_mask((__v4di)__A, (__v4sf)__W,
(__mmask8)__U);
}
__funline __m128 _mm256_maskz_cvtepi64_ps(__mmask8 __U, __m256i __A) {
return (__m128)__builtin_ia32_cvtqq2ps256_mask(
(__v4di)__A, (__v4sf)_mm_setzero_ps(), (__mmask8)__U);
}
__funline __m128 _mm_cvtepi64_ps(__m128i __A) {
return (__m128)__builtin_ia32_cvtqq2ps128_mask(
(__v2di)__A, (__v4sf)_mm_setzero_ps(), (__mmask8)-1);
}
__funline __m128 _mm_mask_cvtepi64_ps(__m128 __W, __mmask8 __U, __m128i __A) {
return (__m128)__builtin_ia32_cvtqq2ps128_mask((__v2di)__A, (__v4sf)__W,
(__mmask8)__U);
}
__funline __m128 _mm_maskz_cvtepi64_ps(__mmask8 __U, __m128i __A) {
return (__m128)__builtin_ia32_cvtqq2ps128_mask(
(__v2di)__A, (__v4sf)_mm_setzero_ps(), (__mmask8)__U);
}
__funline __m128 _mm256_cvtepu64_ps(__m256i __A) {
return (__m128)__builtin_ia32_cvtuqq2ps256_mask(
(__v4di)__A, (__v4sf)_mm_setzero_ps(), (__mmask8)-1);
}
__funline __m128 _mm256_mask_cvtepu64_ps(__m128 __W, __mmask8 __U, __m256i __A) {
return (__m128)__builtin_ia32_cvtuqq2ps256_mask((__v4di)__A, (__v4sf)__W,
(__mmask8)__U);
}
__funline __m128 _mm256_maskz_cvtepu64_ps(__mmask8 __U, __m256i __A) {
return (__m128)__builtin_ia32_cvtuqq2ps256_mask(
(__v4di)__A, (__v4sf)_mm_setzero_ps(), (__mmask8)__U);
}
__funline __m128 _mm_cvtepu64_ps(__m128i __A) {
return (__m128)__builtin_ia32_cvtuqq2ps128_mask(
(__v2di)__A, (__v4sf)_mm_setzero_ps(), (__mmask8)-1);
}
__funline __m128 _mm_mask_cvtepu64_ps(__m128 __W, __mmask8 __U, __m128i __A) {
return (__m128)__builtin_ia32_cvtuqq2ps128_mask((__v2di)__A, (__v4sf)__W,
(__mmask8)__U);
}
__funline __m128 _mm_maskz_cvtepu64_ps(__mmask8 __U, __m128i __A) {
return (__m128)__builtin_ia32_cvtuqq2ps128_mask(
(__v2di)__A, (__v4sf)_mm_setzero_ps(), (__mmask8)__U);
}
__funline __m256d _mm256_cvtepi64_pd(__m256i __A) {
return (__m256d)__builtin_ia32_cvtqq2pd256_mask(
(__v4di)__A, (__v4df)_mm256_setzero_pd(), (__mmask8)-1);
}
__funline __m256d _mm256_mask_cvtepi64_pd(__m256d __W, __mmask8 __U,
__m256i __A) {
return (__m256d)__builtin_ia32_cvtqq2pd256_mask((__v4di)__A, (__v4df)__W,
(__mmask8)__U);
}
__funline __m256d _mm256_maskz_cvtepi64_pd(__mmask8 __U, __m256i __A) {
return (__m256d)__builtin_ia32_cvtqq2pd256_mask(
(__v4di)__A, (__v4df)_mm256_setzero_pd(), (__mmask8)__U);
}
__funline __m128d _mm_cvtepi64_pd(__m128i __A) {
return (__m128d)__builtin_ia32_cvtqq2pd128_mask(
(__v2di)__A, (__v2df)_mm_setzero_pd(), (__mmask8)-1);
}
__funline __m128d _mm_mask_cvtepi64_pd(__m128d __W, __mmask8 __U, __m128i __A) {
return (__m128d)__builtin_ia32_cvtqq2pd128_mask((__v2di)__A, (__v2df)__W,
(__mmask8)__U);
}
__funline __m128d _mm_maskz_cvtepi64_pd(__mmask8 __U, __m128i __A) {
return (__m128d)__builtin_ia32_cvtqq2pd128_mask(
(__v2di)__A, (__v2df)_mm_setzero_pd(), (__mmask8)__U);
}
__funline __m256d _mm256_cvtepu64_pd(__m256i __A) {
return (__m256d)__builtin_ia32_cvtuqq2pd256_mask(
(__v4di)__A, (__v4df)_mm256_setzero_pd(), (__mmask8)-1);
}
__funline __m256d _mm256_mask_cvtepu64_pd(__m256d __W, __mmask8 __U,
__m256i __A) {
return (__m256d)__builtin_ia32_cvtuqq2pd256_mask((__v4di)__A, (__v4df)__W,
(__mmask8)__U);
}
__funline __m256d _mm256_maskz_cvtepu64_pd(__mmask8 __U, __m256i __A) {
return (__m256d)__builtin_ia32_cvtuqq2pd256_mask(
(__v4di)__A, (__v4df)_mm256_setzero_pd(), (__mmask8)__U);
}
__funline __m256d _mm256_mask_and_pd(__m256d __W, __mmask8 __U, __m256d __A,
__m256d __B) {
return (__m256d)__builtin_ia32_andpd256_mask((__v4df)__A, (__v4df)__B,
(__v4df)__W, (__mmask8)__U);
}
__funline __m256d _mm256_maskz_and_pd(__mmask8 __U, __m256d __A, __m256d __B) {
return (__m256d)__builtin_ia32_andpd256_mask(
(__v4df)__A, (__v4df)__B, (__v4df)_mm256_setzero_pd(), (__mmask8)__U);
}
__funline __m128d _mm_mask_and_pd(__m128d __W, __mmask8 __U, __m128d __A,
__m128d __B) {
return (__m128d)__builtin_ia32_andpd128_mask((__v2df)__A, (__v2df)__B,
(__v2df)__W, (__mmask8)__U);
}
__funline __m128d _mm_maskz_and_pd(__mmask8 __U, __m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_andpd128_mask(
(__v2df)__A, (__v2df)__B, (__v2df)_mm_setzero_pd(), (__mmask8)__U);
}
__funline __m256 _mm256_mask_and_ps(__m256 __W, __mmask8 __U, __m256 __A,
__m256 __B) {
return (__m256)__builtin_ia32_andps256_mask((__v8sf)__A, (__v8sf)__B,
(__v8sf)__W, (__mmask8)__U);
}
__funline __m256 _mm256_maskz_and_ps(__mmask8 __U, __m256 __A, __m256 __B) {
return (__m256)__builtin_ia32_andps256_mask(
(__v8sf)__A, (__v8sf)__B, (__v8sf)_mm256_setzero_ps(), (__mmask8)__U);
}
__funline __m128 _mm_mask_and_ps(__m128 __W, __mmask8 __U, __m128 __A,
__m128 __B) {
return (__m128)__builtin_ia32_andps128_mask((__v4sf)__A, (__v4sf)__B,
(__v4sf)__W, (__mmask8)__U);
}
__funline __m128 _mm_maskz_and_ps(__mmask8 __U, __m128 __A, __m128 __B) {
return (__m128)__builtin_ia32_andps128_mask(
(__v4sf)__A, (__v4sf)__B, (__v4sf)_mm_setzero_ps(), (__mmask8)__U);
}
__funline __m128d _mm_cvtepu64_pd(__m128i __A) {
return (__m128d)__builtin_ia32_cvtuqq2pd128_mask(
(__v2di)__A, (__v2df)_mm_setzero_pd(), (__mmask8)-1);
}
__funline __m128d _mm_mask_cvtepu64_pd(__m128d __W, __mmask8 __U, __m128i __A) {
return (__m128d)__builtin_ia32_cvtuqq2pd128_mask((__v2di)__A, (__v2df)__W,
(__mmask8)__U);
}
__funline __m128d _mm_maskz_cvtepu64_pd(__mmask8 __U, __m128i __A) {
return (__m128d)__builtin_ia32_cvtuqq2pd128_mask(
(__v2di)__A, (__v2df)_mm_setzero_pd(), (__mmask8)__U);
}
__funline __m256d _mm256_mask_xor_pd(__m256d __W, __mmask8 __U, __m256d __A,
__m256d __B) {
return (__m256d)__builtin_ia32_xorpd256_mask((__v4df)__A, (__v4df)__B,
(__v4df)__W, (__mmask8)__U);
}
__funline __m256d _mm256_maskz_xor_pd(__mmask8 __U, __m256d __A, __m256d __B) {
return (__m256d)__builtin_ia32_xorpd256_mask(
(__v4df)__A, (__v4df)__B, (__v4df)_mm256_setzero_pd(), (__mmask8)__U);
}
__funline __m128d _mm_mask_xor_pd(__m128d __W, __mmask8 __U, __m128d __A,
__m128d __B) {
return (__m128d)__builtin_ia32_xorpd128_mask((__v2df)__A, (__v2df)__B,
(__v2df)__W, (__mmask8)__U);
}
__funline __m128d _mm_maskz_xor_pd(__mmask8 __U, __m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_xorpd128_mask(
(__v2df)__A, (__v2df)__B, (__v2df)_mm_setzero_pd(), (__mmask8)__U);
}
__funline __m256 _mm256_mask_xor_ps(__m256 __W, __mmask8 __U, __m256 __A,
__m256 __B) {
return (__m256)__builtin_ia32_xorps256_mask((__v8sf)__A, (__v8sf)__B,
(__v8sf)__W, (__mmask8)__U);
}
__funline __m256 _mm256_maskz_xor_ps(__mmask8 __U, __m256 __A, __m256 __B) {
return (__m256)__builtin_ia32_xorps256_mask(
(__v8sf)__A, (__v8sf)__B, (__v8sf)_mm256_setzero_ps(), (__mmask8)__U);
}
__funline __m128 _mm_mask_xor_ps(__m128 __W, __mmask8 __U, __m128 __A,
__m128 __B) {
return (__m128)__builtin_ia32_xorps128_mask((__v4sf)__A, (__v4sf)__B,
(__v4sf)__W, (__mmask8)__U);
}
__funline __m128 _mm_maskz_xor_ps(__mmask8 __U, __m128 __A, __m128 __B) {
return (__m128)__builtin_ia32_xorps128_mask(
(__v4sf)__A, (__v4sf)__B, (__v4sf)_mm_setzero_ps(), (__mmask8)__U);
}
__funline __m256d _mm256_mask_or_pd(__m256d __W, __mmask8 __U, __m256d __A,
__m256d __B) {
return (__m256d)__builtin_ia32_orpd256_mask((__v4df)__A, (__v4df)__B,
(__v4df)__W, (__mmask8)__U);
}
__funline __m256d _mm256_maskz_or_pd(__mmask8 __U, __m256d __A, __m256d __B) {
return (__m256d)__builtin_ia32_orpd256_mask(
(__v4df)__A, (__v4df)__B, (__v4df)_mm256_setzero_pd(), (__mmask8)__U);
}
__funline __m128d _mm_mask_or_pd(__m128d __W, __mmask8 __U, __m128d __A,
__m128d __B) {
return (__m128d)__builtin_ia32_orpd128_mask((__v2df)__A, (__v2df)__B,
(__v2df)__W, (__mmask8)__U);
}
__funline __m128d _mm_maskz_or_pd(__mmask8 __U, __m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_orpd128_mask(
(__v2df)__A, (__v2df)__B, (__v2df)_mm_setzero_pd(), (__mmask8)__U);
}
__funline __m256 _mm256_mask_or_ps(__m256 __W, __mmask8 __U, __m256 __A,
__m256 __B) {
return (__m256)__builtin_ia32_orps256_mask((__v8sf)__A, (__v8sf)__B,
(__v8sf)__W, (__mmask8)__U);
}
__funline __m256 _mm256_maskz_or_ps(__mmask8 __U, __m256 __A, __m256 __B) {
return (__m256)__builtin_ia32_orps256_mask(
(__v8sf)__A, (__v8sf)__B, (__v8sf)_mm256_setzero_ps(), (__mmask8)__U);
}
__funline __m128 _mm_mask_or_ps(__m128 __W, __mmask8 __U, __m128 __A,
__m128 __B) {
return (__m128)__builtin_ia32_orps128_mask((__v4sf)__A, (__v4sf)__B,
(__v4sf)__W, (__mmask8)__U);
}
__funline __m128 _mm_maskz_or_ps(__mmask8 __U, __m128 __A, __m128 __B) {
return (__m128)__builtin_ia32_orps128_mask(
(__v4sf)__A, (__v4sf)__B, (__v4sf)_mm_setzero_ps(), (__mmask8)__U);
}
__funline __m128i _mm_movm_epi32(__mmask8 __A) {
return (__m128i)__builtin_ia32_cvtmask2d128(__A);
}
__funline __m256i _mm256_movm_epi32(__mmask8 __A) {
return (__m256i)__builtin_ia32_cvtmask2d256(__A);
}
__funline __m128i _mm_movm_epi64(__mmask8 __A) {
return (__m128i)__builtin_ia32_cvtmask2q128(__A);
}
__funline __m256i _mm256_movm_epi64(__mmask8 __A) {
return (__m256i)__builtin_ia32_cvtmask2q256(__A);
}
__funline __mmask8 _mm_movepi32_mask(__m128i __A) {
return (__mmask8)__builtin_ia32_cvtd2mask128((__v4si)__A);
}
__funline __mmask8 _mm256_movepi32_mask(__m256i __A) {
return (__mmask8)__builtin_ia32_cvtd2mask256((__v8si)__A);
}
__funline __mmask8 _mm_movepi64_mask(__m128i __A) {
return (__mmask8)__builtin_ia32_cvtq2mask128((__v2di)__A);
}
__funline __mmask8 _mm256_movepi64_mask(__m256i __A) {
return (__mmask8)__builtin_ia32_cvtq2mask256((__v4di)__A);
}
#ifdef __OPTIMIZE__
__funline __m128d _mm256_extractf64x2_pd(__m256d __A, const int __imm) {
return (__m128d)__builtin_ia32_extractf64x2_256_mask(
(__v4df)__A, __imm, (__v2df)_mm_setzero_pd(), (__mmask8)-1);
}
__funline __m128d _mm256_mask_extractf64x2_pd(__m128d __W, __mmask8 __U,
__m256d __A, const int __imm) {
return (__m128d)__builtin_ia32_extractf64x2_256_mask(
(__v4df)__A, __imm, (__v2df)__W, (__mmask8)__U);
}
__funline __m128d _mm256_maskz_extractf64x2_pd(__mmask8 __U, __m256d __A,
const int __imm) {
return (__m128d)__builtin_ia32_extractf64x2_256_mask(
(__v4df)__A, __imm, (__v2df)_mm_setzero_pd(), (__mmask8)__U);
}
__funline __m128i _mm256_extracti64x2_epi64(__m256i __A, const int __imm) {
return (__m128i)__builtin_ia32_extracti64x2_256_mask(
(__v4di)__A, __imm, (__v2di)_mm_setzero_si128(), (__mmask8)-1);
}
__funline __m128i _mm256_mask_extracti64x2_epi64(__m128i __W, __mmask8 __U,
__m256i __A, const int __imm) {
return (__m128i)__builtin_ia32_extracti64x2_256_mask(
(__v4di)__A, __imm, (__v2di)__W, (__mmask8)__U);
}
__funline __m128i _mm256_maskz_extracti64x2_epi64(__mmask8 __U, __m256i __A,
const int __imm) {
return (__m128i)__builtin_ia32_extracti64x2_256_mask(
(__v4di)__A, __imm, (__v2di)_mm_setzero_si128(), (__mmask8)__U);
}
__funline __m256d _mm256_reduce_pd(__m256d __A, int __B) {
return (__m256d)__builtin_ia32_reducepd256_mask(
(__v4df)__A, __B, (__v4df)_mm256_setzero_pd(), (__mmask8)-1);
}
__funline __m256d _mm256_mask_reduce_pd(__m256d __W, __mmask8 __U, __m256d __A,
int __B) {
return (__m256d)__builtin_ia32_reducepd256_mask((__v4df)__A, __B, (__v4df)__W,
(__mmask8)__U);
}
__funline __m256d _mm256_maskz_reduce_pd(__mmask8 __U, __m256d __A, int __B) {
return (__m256d)__builtin_ia32_reducepd256_mask(
(__v4df)__A, __B, (__v4df)_mm256_setzero_pd(), (__mmask8)__U);
}
__funline __m128d _mm_reduce_pd(__m128d __A, int __B) {
return (__m128d)__builtin_ia32_reducepd128_mask(
(__v2df)__A, __B, (__v2df)_mm_setzero_pd(), (__mmask8)-1);
}
__funline __m128d _mm_mask_reduce_pd(__m128d __W, __mmask8 __U, __m128d __A,
int __B) {
return (__m128d)__builtin_ia32_reducepd128_mask((__v2df)__A, __B, (__v2df)__W,
(__mmask8)__U);
}
__funline __m128d _mm_maskz_reduce_pd(__mmask8 __U, __m128d __A, int __B) {
return (__m128d)__builtin_ia32_reducepd128_mask(
(__v2df)__A, __B, (__v2df)_mm_setzero_pd(), (__mmask8)__U);
}
__funline __m256 _mm256_reduce_ps(__m256 __A, int __B) {
return (__m256)__builtin_ia32_reduceps256_mask(
(__v8sf)__A, __B, (__v8sf)_mm256_setzero_ps(), (__mmask8)-1);
}
__funline __m256 _mm256_mask_reduce_ps(__m256 __W, __mmask8 __U, __m256 __A,
int __B) {
return (__m256)__builtin_ia32_reduceps256_mask((__v8sf)__A, __B, (__v8sf)__W,
(__mmask8)__U);
}
__funline __m256 _mm256_maskz_reduce_ps(__mmask8 __U, __m256 __A, int __B) {
return (__m256)__builtin_ia32_reduceps256_mask(
(__v8sf)__A, __B, (__v8sf)_mm256_setzero_ps(), (__mmask8)__U);
}
__funline __m128 _mm_reduce_ps(__m128 __A, int __B) {
return (__m128)__builtin_ia32_reduceps128_mask(
(__v4sf)__A, __B, (__v4sf)_mm_setzero_ps(), (__mmask8)-1);
}
__funline __m128 _mm_mask_reduce_ps(__m128 __W, __mmask8 __U, __m128 __A,
int __B) {
return (__m128)__builtin_ia32_reduceps128_mask((__v4sf)__A, __B, (__v4sf)__W,
(__mmask8)__U);
}
__funline __m128 _mm_maskz_reduce_ps(__mmask8 __U, __m128 __A, int __B) {
return (__m128)__builtin_ia32_reduceps128_mask(
(__v4sf)__A, __B, (__v4sf)_mm_setzero_ps(), (__mmask8)__U);
}
__funline __m256d _mm256_range_pd(__m256d __A, __m256d __B, int __C) {
return (__m256d)__builtin_ia32_rangepd256_mask(
(__v4df)__A, (__v4df)__B, __C, (__v4df)_mm256_setzero_pd(), (__mmask8)-1);
}
__funline __m256d _mm256_mask_range_pd(__m256d __W, __mmask8 __U, __m256d __A,
__m256d __B, int __C) {
return (__m256d)__builtin_ia32_rangepd256_mask((__v4df)__A, (__v4df)__B, __C,
(__v4df)__W, (__mmask8)__U);
}
__funline __m256d _mm256_maskz_range_pd(__mmask8 __U, __m256d __A, __m256d __B,
int __C) {
return (__m256d)__builtin_ia32_rangepd256_mask((__v4df)__A, (__v4df)__B, __C,
(__v4df)_mm256_setzero_pd(),
(__mmask8)__U);
}
__funline __m128d _mm_range_pd(__m128d __A, __m128d __B, int __C) {
return (__m128d)__builtin_ia32_rangepd128_mask(
(__v2df)__A, (__v2df)__B, __C, (__v2df)_mm_setzero_pd(), (__mmask8)-1);
}
__funline __m128d _mm_mask_range_pd(__m128d __W, __mmask8 __U, __m128d __A,
__m128d __B, int __C) {
return (__m128d)__builtin_ia32_rangepd128_mask((__v2df)__A, (__v2df)__B, __C,
(__v2df)__W, (__mmask8)__U);
}
__funline __m128d _mm_maskz_range_pd(__mmask8 __U, __m128d __A, __m128d __B,
int __C) {
return (__m128d)__builtin_ia32_rangepd128_mask(
(__v2df)__A, (__v2df)__B, __C, (__v2df)_mm_setzero_pd(), (__mmask8)__U);
}
__funline __m256 _mm256_range_ps(__m256 __A, __m256 __B, int __C) {
return (__m256)__builtin_ia32_rangeps256_mask(
(__v8sf)__A, (__v8sf)__B, __C, (__v8sf)_mm256_setzero_ps(), (__mmask8)-1);
}
__funline __m256 _mm256_mask_range_ps(__m256 __W, __mmask8 __U, __m256 __A,
__m256 __B, int __C) {
return (__m256)__builtin_ia32_rangeps256_mask((__v8sf)__A, (__v8sf)__B, __C,
(__v8sf)__W, (__mmask8)__U);
}
__funline __m256 _mm256_maskz_range_ps(__mmask8 __U, __m256 __A, __m256 __B,
int __C) {
return (__m256)__builtin_ia32_rangeps256_mask((__v8sf)__A, (__v8sf)__B, __C,
(__v8sf)_mm256_setzero_ps(),
(__mmask8)__U);
}
__funline __m128 _mm_range_ps(__m128 __A, __m128 __B, int __C) {
return (__m128)__builtin_ia32_rangeps128_mask(
(__v4sf)__A, (__v4sf)__B, __C, (__v4sf)_mm_setzero_ps(), (__mmask8)-1);
}
__funline __m128 _mm_mask_range_ps(__m128 __W, __mmask8 __U, __m128 __A,
__m128 __B, int __C) {
return (__m128)__builtin_ia32_rangeps128_mask((__v4sf)__A, (__v4sf)__B, __C,
(__v4sf)__W, (__mmask8)__U);
}
__funline __m128 _mm_maskz_range_ps(__mmask8 __U, __m128 __A, __m128 __B,
int __C) {
return (__m128)__builtin_ia32_rangeps128_mask(
(__v4sf)__A, (__v4sf)__B, __C, (__v4sf)_mm_setzero_ps(), (__mmask8)__U);
}
__funline __mmask8 _mm256_mask_fpclass_pd_mask(__mmask8 __U, __m256d __A,
const int __imm) {
return (__mmask8)__builtin_ia32_fpclasspd256_mask((__v4df)__A, __imm, __U);
}
__funline __mmask8 _mm256_fpclass_pd_mask(__m256d __A, const int __imm) {
return (__mmask8)__builtin_ia32_fpclasspd256_mask((__v4df)__A, __imm,
(__mmask8)-1);
}
__funline __mmask8 _mm256_mask_fpclass_ps_mask(__mmask8 __U, __m256 __A,
const int __imm) {
return (__mmask8)__builtin_ia32_fpclassps256_mask((__v8sf)__A, __imm, __U);
}
__funline __mmask8 _mm256_fpclass_ps_mask(__m256 __A, const int __imm) {
return (__mmask8)__builtin_ia32_fpclassps256_mask((__v8sf)__A, __imm,
(__mmask8)-1);
}
__funline __mmask8 _mm_mask_fpclass_pd_mask(__mmask8 __U, __m128d __A,
const int __imm) {
return (__mmask8)__builtin_ia32_fpclasspd128_mask((__v2df)__A, __imm, __U);
}
__funline __mmask8 _mm_fpclass_pd_mask(__m128d __A, const int __imm) {
return (__mmask8)__builtin_ia32_fpclasspd128_mask((__v2df)__A, __imm,
(__mmask8)-1);
}
__funline __mmask8 _mm_mask_fpclass_ps_mask(__mmask8 __U, __m128 __A,
const int __imm) {
return (__mmask8)__builtin_ia32_fpclassps128_mask((__v4sf)__A, __imm, __U);
}
__funline __mmask8 _mm_fpclass_ps_mask(__m128 __A, const int __imm) {
return (__mmask8)__builtin_ia32_fpclassps128_mask((__v4sf)__A, __imm,
(__mmask8)-1);
}
__funline __m256i _mm256_inserti64x2(__m256i __A, __m128i __B, const int __imm) {
return (__m256i)__builtin_ia32_inserti64x2_256_mask(
(__v4di)__A, (__v2di)__B, __imm, (__v4di)_mm256_setzero_si256(),
(__mmask8)-1);
}
__funline __m256i _mm256_mask_inserti64x2(__m256i __W, __mmask8 __U, __m256i __A,
__m128i __B, const int __imm) {
return (__m256i)__builtin_ia32_inserti64x2_256_mask(
(__v4di)__A, (__v2di)__B, __imm, (__v4di)__W, (__mmask8)__U);
}
__funline __m256i _mm256_maskz_inserti64x2(__mmask8 __U, __m256i __A, __m128i __B,
const int __imm) {
return (__m256i)__builtin_ia32_inserti64x2_256_mask(
(__v4di)__A, (__v2di)__B, __imm, (__v4di)_mm256_setzero_si256(),
(__mmask8)__U);
}
__funline __m256d _mm256_insertf64x2(__m256d __A, __m128d __B, const int __imm) {
return (__m256d)__builtin_ia32_insertf64x2_256_mask(
(__v4df)__A, (__v2df)__B, __imm, (__v4df)_mm256_setzero_pd(),
(__mmask8)-1);
}
__funline __m256d _mm256_mask_insertf64x2(__m256d __W, __mmask8 __U, __m256d __A,
__m128d __B, const int __imm) {
return (__m256d)__builtin_ia32_insertf64x2_256_mask(
(__v4df)__A, (__v2df)__B, __imm, (__v4df)__W, (__mmask8)__U);
}
__funline __m256d _mm256_maskz_insertf64x2(__mmask8 __U, __m256d __A, __m128d __B,
const int __imm) {
return (__m256d)__builtin_ia32_insertf64x2_256_mask(
(__v4df)__A, (__v2df)__B, __imm, (__v4df)_mm256_setzero_pd(),
(__mmask8)__U);
}
#else
#define _mm256_insertf64x2(X, Y, C) \
((__m256d)__builtin_ia32_insertf64x2_256_mask( \
(__v4df)(__m256d)(X), (__v2df)(__m128d)(Y), (int)(C), \
(__v4df)(__m256d)_mm256_setzero_pd(), (__mmask8)-1))
#define _mm256_mask_insertf64x2(W, U, X, Y, C) \
((__m256d)__builtin_ia32_insertf64x2_256_mask( \
(__v4df)(__m256d)(X), (__v2df)(__m128d)(Y), (int)(C), \
(__v4df)(__m256d)(W), (__mmask8)(U)))
#define _mm256_maskz_insertf64x2(U, X, Y, C) \
((__m256d)__builtin_ia32_insertf64x2_256_mask( \
(__v4df)(__m256d)(X), (__v2df)(__m128d)(Y), (int)(C), \
(__v4df)(__m256d)_mm256_setzero_pd(), (__mmask8)(U)))
#define _mm256_inserti64x2(X, Y, C) \
((__m256i)__builtin_ia32_inserti64x2_256_mask( \
(__v4di)(__m256i)(X), (__v2di)(__m128i)(Y), (int)(C), \
(__v4di)(__m256i)_mm256_setzero_si256(), (__mmask8)-1))
#define _mm256_mask_inserti64x2(W, U, X, Y, C) \
((__m256i)__builtin_ia32_inserti64x2_256_mask( \
(__v4di)(__m256i)(X), (__v2di)(__m128i)(Y), (int)(C), \
(__v4di)(__m256i)(W), (__mmask8)(U)))
#define _mm256_maskz_inserti64x2(U, X, Y, C) \
((__m256i)__builtin_ia32_inserti64x2_256_mask( \
(__v4di)(__m256i)(X), (__v2di)(__m128i)(Y), (int)(C), \
(__v4di)(__m256i)_mm256_setzero_si256(), (__mmask8)(U)))
#define _mm256_extractf64x2_pd(X, C) \
((__m128d)__builtin_ia32_extractf64x2_256_mask( \
(__v4df)(__m256d)(X), (int)(C), (__v2df)(__m128d)_mm_setzero_pd(), \
(__mmask8)-1))
#define _mm256_mask_extractf64x2_pd(W, U, X, C) \
((__m128d)__builtin_ia32_extractf64x2_256_mask( \
(__v4df)(__m256d)(X), (int)(C), (__v2df)(__m128d)(W), (__mmask8)(U)))
#define _mm256_maskz_extractf64x2_pd(U, X, C) \
((__m128d)__builtin_ia32_extractf64x2_256_mask( \
(__v4df)(__m256d)(X), (int)(C), (__v2df)(__m128d)_mm_setzero_pd(), \
(__mmask8)(U)))
#define _mm256_extracti64x2_epi64(X, C) \
((__m128i)__builtin_ia32_extracti64x2_256_mask( \
(__v4di)(__m256i)(X), (int)(C), (__v2di)(__m128i)_mm_setzero_si128(), \
(__mmask8)-1))
#define _mm256_mask_extracti64x2_epi64(W, U, X, C) \
((__m128i)__builtin_ia32_extracti64x2_256_mask( \
(__v4di)(__m256i)(X), (int)(C), (__v2di)(__m128i)(W), (__mmask8)(U)))
#define _mm256_maskz_extracti64x2_epi64(U, X, C) \
((__m128i)__builtin_ia32_extracti64x2_256_mask( \
(__v4di)(__m256i)(X), (int)(C), (__v2di)(__m128i)_mm_setzero_si128(), \
(__mmask8)(U)))
#define _mm256_reduce_pd(A, B) \
((__m256d)__builtin_ia32_reducepd256_mask((__v4df)(__m256d)(A), (int)(B), \
(__v4df)_mm256_setzero_pd(), \
(__mmask8)-1))
#define _mm256_mask_reduce_pd(W, U, A, B) \
((__m256d)__builtin_ia32_reducepd256_mask( \
(__v4df)(__m256d)(A), (int)(B), (__v4df)(__m256d)(W), (__mmask8)(U)))
#define _mm256_maskz_reduce_pd(U, A, B) \
((__m256d)__builtin_ia32_reducepd256_mask((__v4df)(__m256d)(A), (int)(B), \
(__v4df)_mm256_setzero_pd(), \
(__mmask8)(U)))
#define _mm_reduce_pd(A, B) \
((__m128d)__builtin_ia32_reducepd128_mask( \
(__v2df)(__m128d)(A), (int)(B), (__v2df)_mm_setzero_pd(), (__mmask8)-1))
#define _mm_mask_reduce_pd(W, U, A, B) \
((__m128d)__builtin_ia32_reducepd128_mask( \
(__v2df)(__m128d)(A), (int)(B), (__v2df)(__m128d)(W), (__mmask8)(U)))
#define _mm_maskz_reduce_pd(U, A, B) \
((__m128d)__builtin_ia32_reducepd128_mask((__v2df)(__m128d)(A), (int)(B), \
(__v2df)_mm_setzero_pd(), \
(__mmask8)(U)))
#define _mm256_reduce_ps(A, B) \
((__m256)__builtin_ia32_reduceps256_mask((__v8sf)(__m256)(A), (int)(B), \
(__v8sf)_mm256_setzero_ps(), \
(__mmask8)-1))
#define _mm256_mask_reduce_ps(W, U, A, B) \
((__m256)__builtin_ia32_reduceps256_mask( \
(__v8sf)(__m256)(A), (int)(B), (__v8sf)(__m256)(W), (__mmask8)(U)))
#define _mm256_maskz_reduce_ps(U, A, B) \
((__m256)__builtin_ia32_reduceps256_mask((__v8sf)(__m256)(A), (int)(B), \
(__v8sf)_mm256_setzero_ps(), \
(__mmask8)(U)))
#define _mm_reduce_ps(A, B) \
((__m128)__builtin_ia32_reduceps128_mask( \
(__v4sf)(__m128)(A), (int)(B), (__v4sf)_mm_setzero_ps(), (__mmask8)-1))
#define _mm_mask_reduce_ps(W, U, A, B) \
((__m128)__builtin_ia32_reduceps128_mask( \
(__v4sf)(__m128)(A), (int)(B), (__v4sf)(__m128)(W), (__mmask8)(U)))
#define _mm_maskz_reduce_ps(U, A, B) \
((__m128)__builtin_ia32_reduceps128_mask( \
(__v4sf)(__m128)(A), (int)(B), (__v4sf)_mm_setzero_ps(), (__mmask8)(U)))
#define _mm256_range_pd(A, B, C) \
((__m256d)__builtin_ia32_rangepd256_mask( \
(__v4df)(__m256d)(A), (__v4df)(__m256d)(B), (int)(C), \
(__v4df)_mm256_setzero_pd(), (__mmask8)-1))
#define _mm256_maskz_range_pd(U, A, B, C) \
((__m256d)__builtin_ia32_rangepd256_mask( \
(__v4df)(__m256d)(A), (__v4df)(__m256d)(B), (int)(C), \
(__v4df)_mm256_setzero_pd(), (__mmask8)(U)))
#define _mm_range_pd(A, B, C) \
((__m128d)__builtin_ia32_rangepd128_mask( \
(__v2df)(__m128d)(A), (__v2df)(__m128d)(B), (int)(C), \
(__v2df)_mm_setzero_pd(), (__mmask8)-1))
#define _mm256_range_ps(A, B, C) \
((__m256)__builtin_ia32_rangeps256_mask( \
(__v8sf)(__m256)(A), (__v8sf)(__m256)(B), (int)(C), \
(__v8sf)_mm256_setzero_ps(), (__mmask8)-1))
#define _mm256_mask_range_ps(W, U, A, B, C) \
((__m256)__builtin_ia32_rangeps256_mask((__v8sf)(__m256)(A), \
(__v8sf)(__m256)(B), (int)(C), \
(__v8sf)(__m256)(W), (__mmask8)(U)))
#define _mm256_maskz_range_ps(U, A, B, C) \
((__m256)__builtin_ia32_rangeps256_mask( \
(__v8sf)(__m256)(A), (__v8sf)(__m256)(B), (int)(C), \
(__v8sf)_mm256_setzero_ps(), (__mmask8)(U)))
#define _mm_range_ps(A, B, C) \
((__m128)__builtin_ia32_rangeps128_mask( \
(__v4sf)(__m128)(A), (__v4sf)(__m128)(B), (int)(C), \
(__v4sf)_mm_setzero_ps(), (__mmask8)-1))
#define _mm_mask_range_ps(W, U, A, B, C) \
((__m128)__builtin_ia32_rangeps128_mask((__v4sf)(__m128)(A), \
(__v4sf)(__m128)(B), (int)(C), \
(__v4sf)(__m128)(W), (__mmask8)(U)))
#define _mm_maskz_range_ps(U, A, B, C) \
((__m128)__builtin_ia32_rangeps128_mask( \
(__v4sf)(__m128)(A), (__v4sf)(__m128)(B), (int)(C), \
(__v4sf)_mm_setzero_ps(), (__mmask8)(U)))
#define _mm256_mask_range_pd(W, U, A, B, C) \
((__m256d)__builtin_ia32_rangepd256_mask( \
(__v4df)(__m256d)(A), (__v4df)(__m256d)(B), (int)(C), \
(__v4df)(__m256d)(W), (__mmask8)(U)))
#define _mm_mask_range_pd(W, U, A, B, C) \
((__m128d)__builtin_ia32_rangepd128_mask( \
(__v2df)(__m128d)(A), (__v2df)(__m128d)(B), (int)(C), \
(__v2df)(__m128d)(W), (__mmask8)(U)))
#define _mm_maskz_range_pd(U, A, B, C) \
((__m128d)__builtin_ia32_rangepd128_mask( \
(__v2df)(__m128d)(A), (__v2df)(__m128d)(B), (int)(C), \
(__v2df)_mm_setzero_pd(), (__mmask8)(U)))
#define _mm256_mask_fpclass_pd_mask(u, X, C) \
((__mmask8)__builtin_ia32_fpclasspd256_mask((__v4df)(__m256d)(X), (int)(C), \
(__mmask8)(u)))
#define _mm256_mask_fpclass_ps_mask(u, X, C) \
((__mmask8)__builtin_ia32_fpclassps256_mask((__v8sf)(__m256)(X), (int)(C), \
(__mmask8)(u)))
#define _mm_mask_fpclass_pd_mask(u, X, C) \
((__mmask8)__builtin_ia32_fpclasspd128_mask((__v2df)(__m128d)(X), (int)(C), \
(__mmask8)(u)))
#define _mm_mask_fpclass_ps_mask(u, X, C) \
((__mmask8)__builtin_ia32_fpclassps128_mask((__v4sf)(__m128)(X), (int)(C), \
(__mmask8)(u)))
#define _mm256_fpclass_pd_mask(X, C) \
((__mmask8)__builtin_ia32_fpclasspd256_mask((__v4df)(__m256d)(X), (int)(C), \
(__mmask8)-1))
#define _mm256_fpclass_ps_mask(X, C) \
((__mmask8)__builtin_ia32_fpclassps256_mask((__v8sf)(__m256)(X), (int)(C), \
(__mmask8)-1))
#define _mm_fpclass_pd_mask(X, C) \
((__mmask8)__builtin_ia32_fpclasspd128_mask((__v2df)(__m128d)(X), (int)(C), \
(__mmask8)-1))
#define _mm_fpclass_ps_mask(X, C) \
((__mmask8)__builtin_ia32_fpclassps128_mask((__v4sf)(__m128)(X), (int)(C), \
(__mmask8)-1))
#endif
#ifdef __DISABLE_AVX512VLDQ__
#undef __DISABLE_AVX512VLDQ__
#pragma GCC pop_options
#endif /* __DISABLE_AVX512VLDQ__ */
#endif /* _AVX512VLDQINTRIN_H_INCLUDED */
| 48,770 | 1,160 | jart/cosmopolitan | false |
cosmopolitan/third_party/intel/emmintrin.internal.h | #ifndef _EMMINTRIN_H_INCLUDED
#define _EMMINTRIN_H_INCLUDED
#ifdef __x86_64__
#include "third_party/intel/xmmintrin.internal.h"
#ifndef __SSE2__
#pragma GCC push_options
#pragma GCC target("sse2")
#define __DISABLE_SSE2__
#endif /* __SSE2__ */
typedef double __v2df __attribute__((__vector_size__(16)));
typedef long long __v2di __attribute__((__vector_size__(16)));
typedef unsigned long long __v2du __attribute__((__vector_size__(16)));
typedef int __v4si __attribute__((__vector_size__(16)));
typedef unsigned int __v4su __attribute__((__vector_size__(16)));
typedef short __v8hi __attribute__((__vector_size__(16)));
typedef unsigned short __v8hu __attribute__((__vector_size__(16)));
typedef char __v16qi __attribute__((__vector_size__(16)));
typedef signed char __v16qs __attribute__((__vector_size__(16)));
typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
typedef long long __m128i __attribute__((__vector_size__(16), __may_alias__));
typedef double __m128d __attribute__((__vector_size__(16), __may_alias__));
typedef long long __m128i_u
__attribute__((__vector_size__(16), __may_alias__, __aligned__(1)));
typedef double __m128d_u
__attribute__((__vector_size__(16), __may_alias__, __aligned__(1)));
#define _MM_SHUFFLE2(fp1, fp0) (((fp1) << 1) | (fp0))
__funline __m128d _mm_set_sd(double __F) {
return __extension__(__m128d){__F, 0.0};
}
__funline __m128d _mm_set1_pd(double __F) {
return __extension__(__m128d){__F, __F};
}
__funline __m128d _mm_set_pd1(double __F) {
return _mm_set1_pd(__F);
}
__funline __m128d _mm_set_pd(double __W, double __X) {
return __extension__(__m128d){__X, __W};
}
__funline __m128d _mm_setr_pd(double __W, double __X) {
return __extension__(__m128d){__W, __X};
}
__funline __m128d _mm_undefined_pd(void) {
__m128d __Y = __Y;
return __Y;
}
__funline __m128d _mm_setzero_pd(void) {
return __extension__(__m128d){0.0, 0.0};
}
__funline __m128d _mm_move_sd(__m128d __A, __m128d __B) {
return __extension__(__m128d)
__builtin_shuffle((__v2df)__A, (__v2df)__B, (__v2di){2, 1});
}
__funline __m128d _mm_load_pd(double const *__P) {
return *(__m128d *)__P;
}
__funline __m128d _mm_loadu_pd(double const *__P) {
return *(__m128d_u *)__P;
}
__funline __m128d _mm_load1_pd(double const *__P) {
return _mm_set1_pd(*__P);
}
__funline __m128d _mm_load_sd(double const *__P) {
return _mm_set_sd(*__P);
}
__funline __m128d _mm_load_pd1(double const *__P) {
return _mm_load1_pd(__P);
}
__funline __m128d _mm_loadr_pd(double const *__P) {
__m128d __tmp = _mm_load_pd(__P);
return __builtin_ia32_shufpd(__tmp, __tmp, _MM_SHUFFLE2(0, 1));
}
__funline void _mm_store_pd(double *__P, __m128d __A) {
*(__m128d *)__P = __A;
}
__funline void _mm_storeu_pd(double *__P, __m128d __A) {
*(__m128d_u *)__P = __A;
}
__funline void _mm_store_sd(double *__P, __m128d __A) {
*__P = ((__v2df)__A)[0];
}
__funline double _mm_cvtsd_f64(__m128d __A) {
return ((__v2df)__A)[0];
}
__funline void _mm_storel_pd(double *__P, __m128d __A) {
_mm_store_sd(__P, __A);
}
__funline void _mm_storeh_pd(double *__P, __m128d __A) {
*__P = ((__v2df)__A)[1];
}
__funline void _mm_store1_pd(double *__P, __m128d __A) {
_mm_store_pd(__P, __builtin_ia32_shufpd(__A, __A, _MM_SHUFFLE2(0, 0)));
}
__funline void _mm_store_pd1(double *__P, __m128d __A) {
_mm_store1_pd(__P, __A);
}
__funline void _mm_storer_pd(double *__P, __m128d __A) {
_mm_store_pd(__P, __builtin_ia32_shufpd(__A, __A, _MM_SHUFFLE2(0, 1)));
}
__funline int _mm_cvtsi128_si32(__m128i __A) {
return __builtin_ia32_vec_ext_v4si((__v4si)__A, 0);
}
#ifdef __x86_64__
__funline long long _mm_cvtsi128_si64(__m128i __A) {
return ((__v2di)__A)[0];
}
__funline long long _mm_cvtsi128_si64x(__m128i __A) {
return ((__v2di)__A)[0];
}
#endif
__funline __m128d _mm_add_pd(__m128d __A, __m128d __B) {
return (__m128d)((__v2df)__A + (__v2df)__B);
}
__funline __m128d _mm_add_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_addsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_sub_pd(__m128d __A, __m128d __B) {
return (__m128d)((__v2df)__A - (__v2df)__B);
}
__funline __m128d _mm_sub_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_subsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_mul_pd(__m128d __A, __m128d __B) {
return (__m128d)((__v2df)__A * (__v2df)__B);
}
__funline __m128d _mm_mul_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_mulsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_div_pd(__m128d __A, __m128d __B) {
return (__m128d)((__v2df)__A / (__v2df)__B);
}
__funline __m128d _mm_div_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_divsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_sqrt_pd(__m128d __A) {
return (__m128d)__builtin_ia32_sqrtpd((__v2df)__A);
}
__funline __m128d _mm_sqrt_sd(__m128d __A, __m128d __B) {
__v2df __tmp = __builtin_ia32_movsd((__v2df)__A, (__v2df)__B);
return (__m128d)__builtin_ia32_sqrtsd((__v2df)__tmp);
}
__funline __m128d _mm_min_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_minpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_min_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_minsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_max_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_maxpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_max_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_maxsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_and_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_andpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_andnot_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_andnpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_or_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_orpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_xor_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_xorpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpeq_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpeqpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmplt_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpltpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmple_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmplepd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpgt_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpgtpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpge_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpgepd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpneq_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpneqpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpnlt_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpnltpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpnle_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpnlepd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpngt_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpngtpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpnge_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpngepd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpord_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpordpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpunord_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpunordpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpeq_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpeqsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmplt_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpltsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmple_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmplesd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpgt_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_movsd(
(__v2df)__A, (__v2df)__builtin_ia32_cmpltsd((__v2df)__B, (__v2df)__A));
}
__funline __m128d _mm_cmpge_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_movsd(
(__v2df)__A, (__v2df)__builtin_ia32_cmplesd((__v2df)__B, (__v2df)__A));
}
__funline __m128d _mm_cmpneq_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpneqsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpnlt_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpnltsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpnle_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpnlesd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpngt_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_movsd(
(__v2df)__A, (__v2df)__builtin_ia32_cmpnltsd((__v2df)__B, (__v2df)__A));
}
__funline __m128d _mm_cmpnge_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_movsd(
(__v2df)__A, (__v2df)__builtin_ia32_cmpnlesd((__v2df)__B, (__v2df)__A));
}
__funline __m128d _mm_cmpord_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpordsd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_cmpunord_sd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_cmpunordsd((__v2df)__A, (__v2df)__B);
}
__funline int _mm_comieq_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_comisdeq((__v2df)__A, (__v2df)__B);
}
__funline int _mm_comilt_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_comisdlt((__v2df)__A, (__v2df)__B);
}
__funline int _mm_comile_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_comisdle((__v2df)__A, (__v2df)__B);
}
__funline int _mm_comigt_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_comisdgt((__v2df)__A, (__v2df)__B);
}
__funline int _mm_comige_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_comisdge((__v2df)__A, (__v2df)__B);
}
__funline int _mm_comineq_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_comisdneq((__v2df)__A, (__v2df)__B);
}
__funline int _mm_ucomieq_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_ucomisdeq((__v2df)__A, (__v2df)__B);
}
__funline int _mm_ucomilt_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_ucomisdlt((__v2df)__A, (__v2df)__B);
}
__funline int _mm_ucomile_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_ucomisdle((__v2df)__A, (__v2df)__B);
}
__funline int _mm_ucomigt_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_ucomisdgt((__v2df)__A, (__v2df)__B);
}
__funline int _mm_ucomige_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_ucomisdge((__v2df)__A, (__v2df)__B);
}
__funline int _mm_ucomineq_sd(__m128d __A, __m128d __B) {
return __builtin_ia32_ucomisdneq((__v2df)__A, (__v2df)__B);
}
__funline __m128i _mm_set_epi64x(long long __q1, long long __q0) {
return __extension__(__m128i)(__v2di){__q0, __q1};
}
__funline __m128i _mm_set_epi64(__m64 __q1, __m64 __q0) {
return _mm_set_epi64x((long long)__q1, (long long)__q0);
}
__funline __m128i _mm_set_epi32(int __q3, int __q2, int __q1, int __q0) {
return __extension__(__m128i)(__v4si){__q0, __q1, __q2, __q3};
}
__funline __m128i _mm_set_epi16(short __q7, short __q6, short __q5, short __q4,
short __q3, short __q2, short __q1, short __q0) {
return __extension__(__m128i)(__v8hi){__q0, __q1, __q2, __q3,
__q4, __q5, __q6, __q7};
}
__funline __m128i _mm_set_epi8(char __q15, char __q14, char __q13, char __q12,
char __q11, char __q10, char __q09, char __q08,
char __q07, char __q06, char __q05, char __q04,
char __q03, char __q02, char __q01, char __q00) {
return __extension__(__m128i)(__v16qi){
__q00, __q01, __q02, __q03, __q04, __q05, __q06, __q07,
__q08, __q09, __q10, __q11, __q12, __q13, __q14, __q15};
}
__funline __m128i _mm_set1_epi64x(long long __A) {
return _mm_set_epi64x(__A, __A);
}
__funline __m128i _mm_set1_epi64(__m64 __A) {
return _mm_set_epi64(__A, __A);
}
__funline __m128i _mm_set1_epi32(int __A) {
return _mm_set_epi32(__A, __A, __A, __A);
}
__funline __m128i _mm_set1_epi16(short __A) {
return _mm_set_epi16(__A, __A, __A, __A, __A, __A, __A, __A);
}
__funline __m128i _mm_set1_epi8(char __A) {
return _mm_set_epi8(__A, __A, __A, __A, __A, __A, __A, __A, __A, __A, __A,
__A, __A, __A, __A, __A);
}
__funline __m128i _mm_setr_epi64(__m64 __q0, __m64 __q1) {
return _mm_set_epi64(__q1, __q0);
}
__funline __m128i _mm_setr_epi32(int __q0, int __q1, int __q2, int __q3) {
return _mm_set_epi32(__q3, __q2, __q1, __q0);
}
__funline __m128i _mm_setr_epi16(short __q0, short __q1, short __q2, short __q3,
short __q4, short __q5, short __q6, short __q7) {
return _mm_set_epi16(__q7, __q6, __q5, __q4, __q3, __q2, __q1, __q0);
}
__funline __m128i _mm_setr_epi8(char __q00, char __q01, char __q02, char __q03,
char __q04, char __q05, char __q06, char __q07,
char __q08, char __q09, char __q10, char __q11,
char __q12, char __q13, char __q14, char __q15) {
return _mm_set_epi8(__q15, __q14, __q13, __q12, __q11, __q10, __q09, __q08,
__q07, __q06, __q05, __q04, __q03, __q02, __q01, __q00);
}
__funline __m128i _mm_load_si128(__m128i const *__P) {
return *__P;
}
__funline __m128i _mm_loadu_si128(__m128i_u const *__P) {
return *__P;
}
__funline __m128i _mm_loadl_epi64(__m128i_u const *__P) {
return _mm_set_epi64((__m64)0LL, *(__m64_u *)__P);
}
__funline __m128i _mm_loadu_si64(void const *__P) {
return _mm_loadl_epi64((__m128i_u *)__P);
}
__funline void _mm_store_si128(__m128i *__P, __m128i __B) {
*__P = __B;
}
__funline void _mm_storeu_si128(__m128i_u *__P, __m128i __B) {
*__P = __B;
}
__funline void _mm_storel_epi64(__m128i_u *__P, __m128i __B) {
*(__m64_u *)__P = (__m64)((__v2di)__B)[0];
}
__funline void _mm_storeu_si64(void *__P, __m128i __B) {
_mm_storel_epi64((__m128i_u *)__P, __B);
}
__funline __m64 _mm_movepi64_pi64(__m128i __B) {
return (__m64)((__v2di)__B)[0];
}
__funline __m128i _mm_movpi64_epi64(__m64 __A) {
return _mm_set_epi64((__m64)0LL, __A);
}
__funline __m128i _mm_move_epi64(__m128i __A) {
return (__m128i)__builtin_ia32_movq128((__v2di)__A);
}
__funline __m128i _mm_undefined_si128(void) {
__m128i __Y = __Y;
return __Y;
}
__funline __m128i _mm_setzero_si128(void) {
return __extension__(__m128i)(__v4si){0, 0, 0, 0};
}
__funline __m128d _mm_cvtepi32_pd(__m128i __A) {
return (__m128d)__builtin_ia32_cvtdq2pd((__v4si)__A);
}
__funline __m128 _mm_cvtepi32_ps(__m128i __A) {
return (__m128)__builtin_ia32_cvtdq2ps((__v4si)__A);
}
__funline __m128i _mm_cvtpd_epi32(__m128d __A) {
return (__m128i)__builtin_ia32_cvtpd2dq((__v2df)__A);
}
__funline __m64 _mm_cvtpd_pi32(__m128d __A) {
return (__m64)__builtin_ia32_cvtpd2pi((__v2df)__A);
}
__funline __m128 _mm_cvtpd_ps(__m128d __A) {
return (__m128)__builtin_ia32_cvtpd2ps((__v2df)__A);
}
__funline __m128i _mm_cvttpd_epi32(__m128d __A) {
return (__m128i)__builtin_ia32_cvttpd2dq((__v2df)__A);
}
__funline __m64 _mm_cvttpd_pi32(__m128d __A) {
return (__m64)__builtin_ia32_cvttpd2pi((__v2df)__A);
}
__funline __m128d _mm_cvtpi32_pd(__m64 __A) {
return (__m128d)__builtin_ia32_cvtpi2pd((__v2si)__A);
}
__funline __m128i _mm_cvtps_epi32(__m128 __A) {
return (__m128i)__builtin_ia32_cvtps2dq((__v4sf)__A);
}
__funline __m128i _mm_cvttps_epi32(__m128 __A) {
return (__m128i)__builtin_ia32_cvttps2dq((__v4sf)__A);
}
__funline __m128d _mm_cvtps_pd(__m128 __A) {
return (__m128d)__builtin_ia32_cvtps2pd((__v4sf)__A);
}
__funline int _mm_cvtsd_si32(__m128d __A) {
return __builtin_ia32_cvtsd2si((__v2df)__A);
}
#ifdef __x86_64__
__funline long long _mm_cvtsd_si64(__m128d __A) {
return __builtin_ia32_cvtsd2si64((__v2df)__A);
}
__funline long long _mm_cvtsd_si64x(__m128d __A) {
return __builtin_ia32_cvtsd2si64((__v2df)__A);
}
#endif
__funline int _mm_cvttsd_si32(__m128d __A) {
return __builtin_ia32_cvttsd2si((__v2df)__A);
}
#ifdef __x86_64__
__funline long long _mm_cvttsd_si64(__m128d __A) {
return __builtin_ia32_cvttsd2si64((__v2df)__A);
}
__funline long long _mm_cvttsd_si64x(__m128d __A) {
return __builtin_ia32_cvttsd2si64((__v2df)__A);
}
#endif
__funline __m128 _mm_cvtsd_ss(__m128 __A, __m128d __B) {
return (__m128)__builtin_ia32_cvtsd2ss((__v4sf)__A, (__v2df)__B);
}
__funline __m128d _mm_cvtsi32_sd(__m128d __A, int __B) {
return (__m128d)__builtin_ia32_cvtsi2sd((__v2df)__A, __B);
}
#ifdef __x86_64__
__funline __m128d _mm_cvtsi64_sd(__m128d __A, long long __B) {
return (__m128d)__builtin_ia32_cvtsi642sd((__v2df)__A, __B);
}
__funline __m128d _mm_cvtsi64x_sd(__m128d __A, long long __B) {
return (__m128d)__builtin_ia32_cvtsi642sd((__v2df)__A, __B);
}
#endif
__funline __m128d _mm_cvtss_sd(__m128d __A, __m128 __B) {
return (__m128d)__builtin_ia32_cvtss2sd((__v2df)__A, (__v4sf)__B);
}
#ifdef __OPTIMIZE__
__funline __m128d _mm_shuffle_pd(__m128d __A, __m128d __B, const int __mask) {
return (__m128d)__builtin_ia32_shufpd((__v2df)__A, (__v2df)__B, __mask);
}
#else
#define _mm_shuffle_pd(A, B, N) \
((__m128d)__builtin_ia32_shufpd((__v2df)(__m128d)(A), (__v2df)(__m128d)(B), \
(int)(N)))
#endif
__funline __m128d _mm_unpackhi_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_unpckhpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_unpacklo_pd(__m128d __A, __m128d __B) {
return (__m128d)__builtin_ia32_unpcklpd((__v2df)__A, (__v2df)__B);
}
__funline __m128d _mm_loadh_pd(__m128d __A, double const *__B) {
return (__m128d)__builtin_ia32_loadhpd((__v2df)__A, __B);
}
__funline __m128d _mm_loadl_pd(__m128d __A, double const *__B) {
return (__m128d)__builtin_ia32_loadlpd((__v2df)__A, __B);
}
__funline int _mm_movemask_pd(__m128d __A) {
return __builtin_ia32_movmskpd((__v2df)__A);
}
__funline __m128i _mm_packs_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_packsswb128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_packs_epi32(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_packssdw128((__v4si)__A, (__v4si)__B);
}
__funline __m128i _mm_packus_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_packuswb128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_unpackhi_epi8(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_punpckhbw128((__v16qi)__A, (__v16qi)__B);
}
__funline __m128i _mm_unpackhi_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_punpckhwd128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_unpackhi_epi32(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_punpckhdq128((__v4si)__A, (__v4si)__B);
}
__funline __m128i _mm_unpackhi_epi64(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_punpckhqdq128((__v2di)__A, (__v2di)__B);
}
__funline __m128i _mm_unpacklo_epi8(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_punpcklbw128((__v16qi)__A, (__v16qi)__B);
}
__funline __m128i _mm_unpacklo_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_punpcklwd128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_unpacklo_epi32(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_punpckldq128((__v4si)__A, (__v4si)__B);
}
__funline __m128i _mm_unpacklo_epi64(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_punpcklqdq128((__v2di)__A, (__v2di)__B);
}
__funline __m128i _mm_add_epi8(__m128i __A, __m128i __B) {
return (__m128i)((__v16qu)__A + (__v16qu)__B);
}
__funline __m128i _mm_add_epi16(__m128i __A, __m128i __B) {
return (__m128i)((__v8hu)__A + (__v8hu)__B);
}
__funline __m128i _mm_add_epi32(__m128i __A, __m128i __B) {
return (__m128i)((__v4su)__A + (__v4su)__B);
}
__funline __m128i _mm_add_epi64(__m128i __A, __m128i __B) {
return (__m128i)((__v2du)__A + (__v2du)__B);
}
__funline __m128i _mm_adds_epi8(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_paddsb128((__v16qi)__A, (__v16qi)__B);
}
__funline __m128i _mm_adds_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_paddsw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_adds_epu8(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_paddusb128((__v16qi)__A, (__v16qi)__B);
}
__funline __m128i _mm_adds_epu16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_paddusw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_sub_epi8(__m128i __A, __m128i __B) {
return (__m128i)((__v16qu)__A - (__v16qu)__B);
}
__funline __m128i _mm_sub_epi16(__m128i __A, __m128i __B) {
return (__m128i)((__v8hu)__A - (__v8hu)__B);
}
__funline __m128i _mm_sub_epi32(__m128i __A, __m128i __B) {
return (__m128i)((__v4su)__A - (__v4su)__B);
}
__funline __m128i _mm_sub_epi64(__m128i __A, __m128i __B) {
return (__m128i)((__v2du)__A - (__v2du)__B);
}
__funline __m128i _mm_subs_epi8(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psubsb128((__v16qi)__A, (__v16qi)__B);
}
__funline __m128i _mm_subs_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psubsw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_subs_epu8(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psubusb128((__v16qi)__A, (__v16qi)__B);
}
__funline __m128i _mm_subs_epu16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psubusw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_madd_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pmaddwd128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_mulhi_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pmulhw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_mullo_epi16(__m128i __A, __m128i __B) {
return (__m128i)((__v8hu)__A * (__v8hu)__B);
}
__funline __m64 _mm_mul_su32(__m64 __A, __m64 __B) {
return (__m64)__builtin_ia32_pmuludq((__v2si)__A, (__v2si)__B);
}
__funline __m128i _mm_mul_epu32(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pmuludq128((__v4si)__A, (__v4si)__B);
}
__funline __m128i _mm_slli_epi16(__m128i __A, int __B) {
return (__m128i)__builtin_ia32_psllwi128((__v8hi)__A, __B);
}
__funline __m128i _mm_slli_epi32(__m128i __A, int __B) {
return (__m128i)__builtin_ia32_pslldi128((__v4si)__A, __B);
}
__funline __m128i _mm_slli_epi64(__m128i __A, int __B) {
return (__m128i)__builtin_ia32_psllqi128((__v2di)__A, __B);
}
__funline __m128i _mm_srai_epi16(__m128i __A, int __B) {
return (__m128i)__builtin_ia32_psrawi128((__v8hi)__A, __B);
}
__funline __m128i _mm_srai_epi32(__m128i __A, int __B) {
return (__m128i)__builtin_ia32_psradi128((__v4si)__A, __B);
}
#ifdef __OPTIMIZE__
__funline __m128i _mm_bsrli_si128(__m128i __A, const int __N) {
return (__m128i)__builtin_ia32_psrldqi128(__A, __N * 8);
}
__funline __m128i _mm_bslli_si128(__m128i __A, const int __N) {
return (__m128i)__builtin_ia32_pslldqi128(__A, __N * 8);
}
__funline __m128i _mm_srli_si128(__m128i __A, const int __N) {
return (__m128i)__builtin_ia32_psrldqi128(__A, __N * 8);
}
__funline __m128i _mm_slli_si128(__m128i __A, const int __N) {
return (__m128i)__builtin_ia32_pslldqi128(__A, __N * 8);
}
#else
#define _mm_bsrli_si128(A, N) \
((__m128i)__builtin_ia32_psrldqi128((__m128i)(A), (int)(N)*8))
#define _mm_bslli_si128(A, N) \
((__m128i)__builtin_ia32_pslldqi128((__m128i)(A), (int)(N)*8))
#define _mm_srli_si128(A, N) \
((__m128i)__builtin_ia32_psrldqi128((__m128i)(A), (int)(N)*8))
#define _mm_slli_si128(A, N) \
((__m128i)__builtin_ia32_pslldqi128((__m128i)(A), (int)(N)*8))
#endif
__funline __m128i _mm_srli_epi16(__m128i __A, int __B) {
return (__m128i)__builtin_ia32_psrlwi128((__v8hi)__A, __B);
}
__funline __m128i _mm_srli_epi32(__m128i __A, int __B) {
return (__m128i)__builtin_ia32_psrldi128((__v4si)__A, __B);
}
__funline __m128i _mm_srli_epi64(__m128i __A, int __B) {
return (__m128i)__builtin_ia32_psrlqi128((__v2di)__A, __B);
}
__funline __m128i _mm_sll_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psllw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_sll_epi32(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pslld128((__v4si)__A, (__v4si)__B);
}
__funline __m128i _mm_sll_epi64(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psllq128((__v2di)__A, (__v2di)__B);
}
__funline __m128i _mm_sra_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psraw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_sra_epi32(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psrad128((__v4si)__A, (__v4si)__B);
}
__funline __m128i _mm_srl_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psrlw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_srl_epi32(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psrld128((__v4si)__A, (__v4si)__B);
}
__funline __m128i _mm_srl_epi64(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psrlq128((__v2di)__A, (__v2di)__B);
}
__funline __m128i _mm_and_si128(__m128i __A, __m128i __B) {
return (__m128i)((__v2du)__A & (__v2du)__B);
}
__funline __m128i _mm_andnot_si128(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pandn128((__v2di)__A, (__v2di)__B);
}
__funline __m128i _mm_or_si128(__m128i __A, __m128i __B) {
return (__m128i)((__v2du)__A | (__v2du)__B);
}
__funline __m128i _mm_xor_si128(__m128i __A, __m128i __B) {
return (__m128i)((__v2du)__A ^ (__v2du)__B);
}
__funline __m128i _mm_cmpeq_epi8(__m128i __A, __m128i __B) {
return (__m128i)((__v16qs)__A == (__v16qs)__B);
}
__funline __m128i _mm_cmpeq_epi16(__m128i __A, __m128i __B) {
return (__m128i)((__v8hi)__A == (__v8hi)__B);
}
__funline __m128i _mm_cmpeq_epi32(__m128i __A, __m128i __B) {
return (__m128i)((__v4si)__A == (__v4si)__B);
}
__funline __m128i _mm_cmplt_epi8(__m128i __A, __m128i __B) {
return (__m128i)((__v16qs)__A < (__v16qs)__B);
}
__funline __m128i _mm_cmplt_epi16(__m128i __A, __m128i __B) {
return (__m128i)((__v8hi)__A < (__v8hi)__B);
}
__funline __m128i _mm_cmplt_epi32(__m128i __A, __m128i __B) {
return (__m128i)((__v4si)__A < (__v4si)__B);
}
__funline __m128i _mm_cmpgt_epi8(__m128i __A, __m128i __B) {
return (__m128i)((__v16qs)__A > (__v16qs)__B);
}
__funline __m128i _mm_cmpgt_epi16(__m128i __A, __m128i __B) {
return (__m128i)((__v8hi)__A > (__v8hi)__B);
}
__funline __m128i _mm_cmpgt_epi32(__m128i __A, __m128i __B) {
return (__m128i)((__v4si)__A > (__v4si)__B);
}
#ifdef __OPTIMIZE__
__funline int _mm_extract_epi16(__m128i const __A, int const __N) {
return (unsigned short)__builtin_ia32_vec_ext_v8hi((__v8hi)__A, __N);
}
__funline __m128i _mm_insert_epi16(__m128i const __A, int const __D,
int const __N) {
return (__m128i)__builtin_ia32_vec_set_v8hi((__v8hi)__A, __D, __N);
}
#else
#define _mm_extract_epi16(A, N) \
((int)(unsigned short)__builtin_ia32_vec_ext_v8hi((__v8hi)(__m128i)(A), \
(int)(N)))
#define _mm_insert_epi16(A, D, N) \
((__m128i)__builtin_ia32_vec_set_v8hi((__v8hi)(__m128i)(A), (int)(D), \
(int)(N)))
#endif
__funline __m128i _mm_max_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pmaxsw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_max_epu8(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pmaxub128((__v16qi)__A, (__v16qi)__B);
}
__funline __m128i _mm_min_epi16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pminsw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_min_epu8(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pminub128((__v16qi)__A, (__v16qi)__B);
}
__funline int _mm_movemask_epi8(__m128i __A) {
return __builtin_ia32_pmovmskb128((__v16qi)__A);
}
__funline __m128i _mm_mulhi_epu16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)__A, (__v8hi)__B);
}
#ifdef __OPTIMIZE__
__funline __m128i _mm_shufflehi_epi16(__m128i __A, const int __mask) {
return (__m128i)__builtin_ia32_pshufhw((__v8hi)__A, __mask);
}
__funline __m128i _mm_shufflelo_epi16(__m128i __A, const int __mask) {
return (__m128i)__builtin_ia32_pshuflw((__v8hi)__A, __mask);
}
__funline __m128i _mm_shuffle_epi32(__m128i __A, const int __mask) {
return (__m128i)__builtin_ia32_pshufd((__v4si)__A, __mask);
}
#else
#define _mm_shufflehi_epi16(A, N) \
((__m128i)__builtin_ia32_pshufhw((__v8hi)(__m128i)(A), (int)(N)))
#define _mm_shufflelo_epi16(A, N) \
((__m128i)__builtin_ia32_pshuflw((__v8hi)(__m128i)(A), (int)(N)))
#define _mm_shuffle_epi32(A, N) \
((__m128i)__builtin_ia32_pshufd((__v4si)(__m128i)(A), (int)(N)))
#endif
__funline void _mm_maskmoveu_si128(__m128i __A, __m128i __B, char *__C) {
__builtin_ia32_maskmovdqu((__v16qi)__A, (__v16qi)__B, __C);
}
__funline __m128i _mm_avg_epu8(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pavgb128((__v16qi)__A, (__v16qi)__B);
}
__funline __m128i _mm_avg_epu16(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_pavgw128((__v8hi)__A, (__v8hi)__B);
}
__funline __m128i _mm_sad_epu8(__m128i __A, __m128i __B) {
return (__m128i)__builtin_ia32_psadbw128((__v16qi)__A, (__v16qi)__B);
}
__funline void _mm_stream_si32(int *__A, int __B) {
__builtin_ia32_movnti(__A, __B);
}
#ifdef __x86_64__
__funline void _mm_stream_si64(long long int *__A, long long int __B) {
__builtin_ia32_movnti64(__A, __B);
}
#endif
__funline void _mm_stream_si128(__m128i *__A, __m128i __B) {
__builtin_ia32_movntdq((__v2di *)__A, (__v2di)__B);
}
__funline void _mm_stream_pd(double *__A, __m128d __B) {
__builtin_ia32_movntpd(__A, (__v2df)__B);
}
__funline void _mm_clflush(void const *__A) {
__builtin_ia32_clflush(__A);
}
__funline void _mm_lfence(void) {
__builtin_ia32_lfence();
}
__funline void _mm_mfence(void) {
__builtin_ia32_mfence();
}
__funline __m128i _mm_cvtsi32_si128(int __A) {
return _mm_set_epi32(0, 0, 0, __A);
}
#ifdef __x86_64__
__funline __m128i _mm_cvtsi64_si128(long long __A) {
return _mm_set_epi64x(0, __A);
}
__funline __m128i _mm_cvtsi64x_si128(long long __A) {
return _mm_set_epi64x(0, __A);
}
#endif
__funline __m128 _mm_castpd_ps(__m128d __A) {
return (__m128)__A;
}
__funline __m128i _mm_castpd_si128(__m128d __A) {
return (__m128i)__A;
}
__funline __m128d _mm_castps_pd(__m128 __A) {
return (__m128d)__A;
}
__funline __m128i _mm_castps_si128(__m128 __A) {
return (__m128i)__A;
}
__funline __m128 _mm_castsi128_ps(__m128i __A) {
return (__m128)__A;
}
__funline __m128d _mm_castsi128_pd(__m128i __A) {
return (__m128d)__A;
}
#ifdef __DISABLE_SSE2__
#undef __DISABLE_SSE2__
#pragma GCC pop_options
#endif /* __DISABLE_SSE2__ */
#endif /* __x86_64__ */
#endif /* _EMMINTRIN_H_INCLUDED */
| 31,151 | 1,039 | jart/cosmopolitan | false |
cosmopolitan/third_party/intel/avx512vbmi2intrin.internal.h | #ifndef _IMMINTRIN_H_INCLUDED
#error \
"Never use <avx512vbmi2intrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __AVX512VBMI2INTRIN_H_INCLUDED
#define __AVX512VBMI2INTRIN_H_INCLUDED
#if !defined(__AVX512VBMI2__)
#pragma GCC push_options
#pragma GCC target("avx512vbmi2")
#define __DISABLE_AVX512VBMI2__
#endif /* __AVX512VBMI2__ */
#ifdef __OPTIMIZE__
__funline __m512i _mm512_shrdi_epi16(__m512i __A, __m512i __B, int __C) {
return (__m512i)__builtin_ia32_vpshrd_v32hi((__v32hi)__A, (__v32hi)__B, __C);
}
__funline __m512i _mm512_shrdi_epi32(__m512i __A, __m512i __B, int __C) {
return (__m512i)__builtin_ia32_vpshrd_v16si((__v16si)__A, (__v16si)__B, __C);
}
__funline __m512i _mm512_mask_shrdi_epi32(__m512i __A, __mmask16 __B, __m512i __C,
__m512i __D, int __E) {
return (__m512i)__builtin_ia32_vpshrd_v16si_mask(
(__v16si)__C, (__v16si)__D, __E, (__v16si)__A, (__mmask16)__B);
}
__funline __m512i _mm512_maskz_shrdi_epi32(__mmask16 __A, __m512i __B,
__m512i __C, int __D) {
return (__m512i)__builtin_ia32_vpshrd_v16si_mask(
(__v16si)__B, (__v16si)__C, __D, (__v16si)_mm512_setzero_si512(),
(__mmask16)__A);
}
__funline __m512i _mm512_shrdi_epi64(__m512i __A, __m512i __B, int __C) {
return (__m512i)__builtin_ia32_vpshrd_v8di((__v8di)__A, (__v8di)__B, __C);
}
__funline __m512i _mm512_mask_shrdi_epi64(__m512i __A, __mmask8 __B, __m512i __C,
__m512i __D, int __E) {
return (__m512i)__builtin_ia32_vpshrd_v8di_mask((__v8di)__C, (__v8di)__D, __E,
(__v8di)__A, (__mmask8)__B);
}
__funline __m512i _mm512_maskz_shrdi_epi64(__mmask8 __A, __m512i __B, __m512i __C,
int __D) {
return (__m512i)__builtin_ia32_vpshrd_v8di_mask(
(__v8di)__B, (__v8di)__C, __D, (__v8di)_mm512_setzero_si512(),
(__mmask8)__A);
}
__funline __m512i _mm512_shldi_epi16(__m512i __A, __m512i __B, int __C) {
return (__m512i)__builtin_ia32_vpshld_v32hi((__v32hi)__A, (__v32hi)__B, __C);
}
__funline __m512i _mm512_shldi_epi32(__m512i __A, __m512i __B, int __C) {
return (__m512i)__builtin_ia32_vpshld_v16si((__v16si)__A, (__v16si)__B, __C);
}
__funline __m512i _mm512_mask_shldi_epi32(__m512i __A, __mmask16 __B, __m512i __C,
__m512i __D, int __E) {
return (__m512i)__builtin_ia32_vpshld_v16si_mask(
(__v16si)__C, (__v16si)__D, __E, (__v16si)__A, (__mmask16)__B);
}
__funline __m512i _mm512_maskz_shldi_epi32(__mmask16 __A, __m512i __B,
__m512i __C, int __D) {
return (__m512i)__builtin_ia32_vpshld_v16si_mask(
(__v16si)__B, (__v16si)__C, __D, (__v16si)_mm512_setzero_si512(),
(__mmask16)__A);
}
__funline __m512i _mm512_shldi_epi64(__m512i __A, __m512i __B, int __C) {
return (__m512i)__builtin_ia32_vpshld_v8di((__v8di)__A, (__v8di)__B, __C);
}
__funline __m512i _mm512_mask_shldi_epi64(__m512i __A, __mmask8 __B, __m512i __C,
__m512i __D, int __E) {
return (__m512i)__builtin_ia32_vpshld_v8di_mask((__v8di)__C, (__v8di)__D, __E,
(__v8di)__A, (__mmask8)__B);
}
__funline __m512i _mm512_maskz_shldi_epi64(__mmask8 __A, __m512i __B, __m512i __C,
int __D) {
return (__m512i)__builtin_ia32_vpshld_v8di_mask(
(__v8di)__B, (__v8di)__C, __D, (__v8di)_mm512_setzero_si512(),
(__mmask8)__A);
}
#else
#define _mm512_shrdi_epi16(A, B, C) \
((__m512i) __builtin_ia32_vpshrd_v32hi ((__v32hi)(__m512i)(A), \
(__v32hi)(__m512i)(B),(int)(C))
#define _mm512_shrdi_epi32(A, B, C) \
((__m512i) __builtin_ia32_vpshrd_v16si ((__v16si)(__m512i)(A), \
(__v16si)(__m512i)(B),(int)(C))
#define _mm512_mask_shrdi_epi32(A, B, C, D, E) \
((__m512i) __builtin_ia32_vpshrd_v16si_mask ((__v16si)(__m512i)(C), \
(__v16si)(__m512i)(D), (int)(E), (__v16si)(__m512i)(A),(__mmask16)(B))
#define _mm512_maskz_shrdi_epi32(A, B, C, D) \
((__m512i) __builtin_ia32_vpshrd_v16si_mask ((__v16si)(__m512i)(B), \
(__v16si)(__m512i)(C),(int)(D), \
(__v16si)(__m512i)_mm512_setzero_si512 (), (__mmask16)(A))
#define _mm512_shrdi_epi64(A, B, C) \
((__m512i) __builtin_ia32_vpshrd_v8di ((__v8di)(__m512i)(A), \
(__v8di)(__m512i)(B),(int)(C))
#define _mm512_mask_shrdi_epi64(A, B, C, D, E) \
((__m512i) __builtin_ia32_vpshrd_v8di_mask ((__v8di)(__m512i)(C), \
(__v8di)(__m512i)(D), (int)(E), (__v8di)(__m512i)(A),(__mmask8)(B))
#define _mm512_maskz_shrdi_epi64(A, B, C, D) \
((__m512i) __builtin_ia32_vpshrd_v8di_mask ((__v8di)(__m512i)(B), \
(__v8di)(__m512i)(C),(int)(D), \
(__v8di)(__m512i)_mm512_setzero_si512 (), (__mmask8)(A))
#define _mm512_shldi_epi16(A, B, C) \
((__m512i) __builtin_ia32_vpshld_v32hi ((__v32hi)(__m512i)(A), \
(__v32hi)(__m512i)(B),(int)(C))
#define _mm512_shldi_epi32(A, B, C) \
((__m512i) __builtin_ia32_vpshld_v16si ((__v16si)(__m512i)(A), \
(__v16si)(__m512i)(B),(int)(C))
#define _mm512_mask_shldi_epi32(A, B, C, D, E) \
((__m512i) __builtin_ia32_vpshld_v16si_mask ((__v16si)(__m512i)(C), \
(__v16si)(__m512i)(D), (int)(E), (__v16si)(__m512i)(A),(__mmask16)(B))
#define _mm512_maskz_shldi_epi32(A, B, C, D) \
((__m512i) __builtin_ia32_vpshld_v16si_mask ((__v16si)(__m512i)(B), \
(__v16si)(__m512i)(C),(int)(D), \
(__v16si)(__m512i)_mm512_setzero_si512 (), (__mmask16)(A))
#define _mm512_shldi_epi64(A, B, C) \
((__m512i) __builtin_ia32_vpshld_v8di ((__v8di)(__m512i)(A), \
(__v8di)(__m512i)(B),(int)(C))
#define _mm512_mask_shldi_epi64(A, B, C, D, E) \
((__m512i) __builtin_ia32_vpshld_v8di_mask ((__v8di)(__m512i)(C), \
(__v8di)(__m512i)(D), (int)(E), (__v8di)(__m512i)(A),(__mmask8)(B))
#define _mm512_maskz_shldi_epi64(A, B, C, D) \
((__m512i) __builtin_ia32_vpshld_v8di_mask ((__v8di)(__m512i)(B), \
(__v8di)(__m512i)(C),(int)(D), \
(__v8di)(__m512i)_mm512_setzero_si512 (), (__mmask8)(A))
#endif
__funline __m512i _mm512_shrdv_epi16(__m512i __A, __m512i __B, __m512i __C) {
return (__m512i)__builtin_ia32_vpshrdv_v32hi((__v32hi)__A, (__v32hi)__B,
(__v32hi)__C);
}
__funline __m512i _mm512_shrdv_epi32(__m512i __A, __m512i __B, __m512i __C) {
return (__m512i)__builtin_ia32_vpshrdv_v16si((__v16si)__A, (__v16si)__B,
(__v16si)__C);
}
__funline __m512i _mm512_mask_shrdv_epi32(__m512i __A, __mmask16 __B, __m512i __C,
__m512i __D) {
return (__m512i)__builtin_ia32_vpshrdv_v16si_mask(
(__v16si)__A, (__v16si)__C, (__v16si)__D, (__mmask16)__B);
}
__funline __m512i _mm512_maskz_shrdv_epi32(__mmask16 __A, __m512i __B,
__m512i __C, __m512i __D) {
return (__m512i)__builtin_ia32_vpshrdv_v16si_maskz(
(__v16si)__B, (__v16si)__C, (__v16si)__D, (__mmask16)__A);
}
__funline __m512i _mm512_shrdv_epi64(__m512i __A, __m512i __B, __m512i __C) {
return (__m512i)__builtin_ia32_vpshrdv_v8di((__v8di)__A, (__v8di)__B,
(__v8di)__C);
}
__funline __m512i _mm512_mask_shrdv_epi64(__m512i __A, __mmask8 __B, __m512i __C,
__m512i __D) {
return (__m512i)__builtin_ia32_vpshrdv_v8di_mask((__v8di)__A, (__v8di)__C,
(__v8di)__D, (__mmask8)__B);
}
__funline __m512i _mm512_maskz_shrdv_epi64(__mmask8 __A, __m512i __B, __m512i __C,
__m512i __D) {
return (__m512i)__builtin_ia32_vpshrdv_v8di_maskz((__v8di)__B, (__v8di)__C,
(__v8di)__D, (__mmask8)__A);
}
__funline __m512i _mm512_shldv_epi16(__m512i __A, __m512i __B, __m512i __C) {
return (__m512i)__builtin_ia32_vpshldv_v32hi((__v32hi)__A, (__v32hi)__B,
(__v32hi)__C);
}
__funline __m512i _mm512_shldv_epi32(__m512i __A, __m512i __B, __m512i __C) {
return (__m512i)__builtin_ia32_vpshldv_v16si((__v16si)__A, (__v16si)__B,
(__v16si)__C);
}
__funline __m512i _mm512_mask_shldv_epi32(__m512i __A, __mmask16 __B, __m512i __C,
__m512i __D) {
return (__m512i)__builtin_ia32_vpshldv_v16si_mask(
(__v16si)__A, (__v16si)__C, (__v16si)__D, (__mmask16)__B);
}
__funline __m512i _mm512_maskz_shldv_epi32(__mmask16 __A, __m512i __B,
__m512i __C, __m512i __D) {
return (__m512i)__builtin_ia32_vpshldv_v16si_maskz(
(__v16si)__B, (__v16si)__C, (__v16si)__D, (__mmask16)__A);
}
__funline __m512i _mm512_shldv_epi64(__m512i __A, __m512i __B, __m512i __C) {
return (__m512i)__builtin_ia32_vpshldv_v8di((__v8di)__A, (__v8di)__B,
(__v8di)__C);
}
__funline __m512i _mm512_mask_shldv_epi64(__m512i __A, __mmask8 __B, __m512i __C,
__m512i __D) {
return (__m512i)__builtin_ia32_vpshldv_v8di_mask((__v8di)__A, (__v8di)__C,
(__v8di)__D, (__mmask8)__B);
}
__funline __m512i _mm512_maskz_shldv_epi64(__mmask8 __A, __m512i __B, __m512i __C,
__m512i __D) {
return (__m512i)__builtin_ia32_vpshldv_v8di_maskz((__v8di)__B, (__v8di)__C,
(__v8di)__D, (__mmask8)__A);
}
#ifdef __DISABLE_AVX512VBMI2__
#undef __DISABLE_AVX512VBMI2__
#pragma GCC pop_options
#endif /* __DISABLE_AVX512VBMI2__ */
#if !defined(__AVX512VBMI2__) || !defined(__AVX512BW__)
#pragma GCC push_options
#pragma GCC target("avx512vbmi2,avx512bw")
#define __DISABLE_AVX512VBMI2BW__
#endif /* __AVX512VBMI2BW__ */
__funline __m512i _mm512_mask_compress_epi8(__m512i __A, __mmask64 __B,
__m512i __C) {
return (__m512i)__builtin_ia32_compressqi512_mask((__v64qi)__C, (__v64qi)__A,
(__mmask64)__B);
}
__funline __m512i _mm512_maskz_compress_epi8(__mmask64 __A, __m512i __B) {
return (__m512i)__builtin_ia32_compressqi512_mask(
(__v64qi)__B, (__v64qi)_mm512_setzero_si512(), (__mmask64)__A);
}
__funline void _mm512_mask_compressstoreu_epi8(void *__A, __mmask64 __B,
__m512i __C) {
__builtin_ia32_compressstoreuqi512_mask((__v64qi *)__A, (__v64qi)__C,
(__mmask64)__B);
}
__funline __m512i _mm512_mask_compress_epi16(__m512i __A, __mmask32 __B,
__m512i __C) {
return (__m512i)__builtin_ia32_compresshi512_mask((__v32hi)__C, (__v32hi)__A,
(__mmask32)__B);
}
__funline __m512i _mm512_maskz_compress_epi16(__mmask32 __A, __m512i __B) {
return (__m512i)__builtin_ia32_compresshi512_mask(
(__v32hi)__B, (__v32hi)_mm512_setzero_si512(), (__mmask32)__A);
}
__funline void _mm512_mask_compressstoreu_epi16(void *__A, __mmask32 __B,
__m512i __C) {
__builtin_ia32_compressstoreuhi512_mask((__v32hi *)__A, (__v32hi)__C,
(__mmask32)__B);
}
__funline __m512i _mm512_mask_expand_epi8(__m512i __A, __mmask64 __B,
__m512i __C) {
return (__m512i)__builtin_ia32_expandqi512_mask((__v64qi)__C, (__v64qi)__A,
(__mmask64)__B);
}
__funline __m512i _mm512_maskz_expand_epi8(__mmask64 __A, __m512i __B) {
return (__m512i)__builtin_ia32_expandqi512_maskz(
(__v64qi)__B, (__v64qi)_mm512_setzero_si512(), (__mmask64)__A);
}
__funline __m512i _mm512_mask_expandloadu_epi8(__m512i __A, __mmask64 __B,
const void *__C) {
return (__m512i)__builtin_ia32_expandloadqi512_mask(
(const __v64qi *)__C, (__v64qi)__A, (__mmask64)__B);
}
__funline __m512i _mm512_maskz_expandloadu_epi8(__mmask64 __A, const void *__B) {
return (__m512i)__builtin_ia32_expandloadqi512_maskz(
(const __v64qi *)__B, (__v64qi)_mm512_setzero_si512(), (__mmask64)__A);
}
__funline __m512i _mm512_mask_expand_epi16(__m512i __A, __mmask32 __B,
__m512i __C) {
return (__m512i)__builtin_ia32_expandhi512_mask((__v32hi)__C, (__v32hi)__A,
(__mmask32)__B);
}
__funline __m512i _mm512_maskz_expand_epi16(__mmask32 __A, __m512i __B) {
return (__m512i)__builtin_ia32_expandhi512_maskz(
(__v32hi)__B, (__v32hi)_mm512_setzero_si512(), (__mmask32)__A);
}
__funline __m512i _mm512_mask_expandloadu_epi16(__m512i __A, __mmask32 __B,
const void *__C) {
return (__m512i)__builtin_ia32_expandloadhi512_mask(
(const __v32hi *)__C, (__v32hi)__A, (__mmask32)__B);
}
__funline __m512i _mm512_maskz_expandloadu_epi16(__mmask32 __A, const void *__B) {
return (__m512i)__builtin_ia32_expandloadhi512_maskz(
(const __v32hi *)__B, (__v32hi)_mm512_setzero_si512(), (__mmask32)__A);
}
#ifdef __OPTIMIZE__
__funline __m512i _mm512_mask_shrdi_epi16(__m512i __A, __mmask32 __B, __m512i __C,
__m512i __D, int __E) {
return (__m512i)__builtin_ia32_vpshrd_v32hi_mask(
(__v32hi)__C, (__v32hi)__D, __E, (__v32hi)__A, (__mmask32)__B);
}
__funline __m512i _mm512_maskz_shrdi_epi16(__mmask32 __A, __m512i __B,
__m512i __C, int __D) {
return (__m512i)__builtin_ia32_vpshrd_v32hi_mask(
(__v32hi)__B, (__v32hi)__C, __D, (__v32hi)_mm512_setzero_si512(),
(__mmask32)__A);
}
__funline __m512i _mm512_mask_shldi_epi16(__m512i __A, __mmask32 __B, __m512i __C,
__m512i __D, int __E) {
return (__m512i)__builtin_ia32_vpshld_v32hi_mask(
(__v32hi)__C, (__v32hi)__D, __E, (__v32hi)__A, (__mmask32)__B);
}
__funline __m512i _mm512_maskz_shldi_epi16(__mmask32 __A, __m512i __B,
__m512i __C, int __D) {
return (__m512i)__builtin_ia32_vpshld_v32hi_mask(
(__v32hi)__B, (__v32hi)__C, __D, (__v32hi)_mm512_setzero_si512(),
(__mmask32)__A);
}
#else
#define _mm512_mask_shrdi_epi16(A, B, C, D, E) \
((__m512i) __builtin_ia32_vpshrd_v32hi_mask ((__v32hi)(__m512i)(C), \
(__v32hi)(__m512i)(D), (int)(E), (__v32hi)(__m512i)(A),(__mmask32)(B))
#define _mm512_maskz_shrdi_epi16(A, B, C, D) \
((__m512i) __builtin_ia32_vpshrd_v32hi_mask ((__v32hi)(__m512i)(B), \
(__v32hi)(__m512i)(C),(int)(D), \
(__v32hi)(__m512i)_mm512_setzero_si512 (), (__mmask32)(A))
#define _mm512_mask_shldi_epi16(A, B, C, D, E) \
((__m512i) __builtin_ia32_vpshld_v32hi_mask ((__v32hi)(__m512i)(C), \
(__v32hi)(__m512i)(D), (int)(E), (__v32hi)(__m512i)(A),(__mmask32)(B))
#define _mm512_maskz_shldi_epi16(A, B, C, D) \
((__m512i) __builtin_ia32_vpshld_v32hi_mask ((__v32hi)(__m512i)(B), \
(__v32hi)(__m512i)(C),(int)(D), \
(__v32hi)(__m512i)_mm512_setzero_si512 (), (__mmask32)(A))
#endif
__funline __m512i _mm512_mask_shrdv_epi16(__m512i __A, __mmask32 __B, __m512i __C,
__m512i __D) {
return (__m512i)__builtin_ia32_vpshrdv_v32hi_mask(
(__v32hi)__A, (__v32hi)__C, (__v32hi)__D, (__mmask32)__B);
}
__funline __m512i _mm512_maskz_shrdv_epi16(__mmask32 __A, __m512i __B,
__m512i __C, __m512i __D) {
return (__m512i)__builtin_ia32_vpshrdv_v32hi_maskz(
(__v32hi)__B, (__v32hi)__C, (__v32hi)__D, (__mmask32)__A);
}
__funline __m512i _mm512_mask_shldv_epi16(__m512i __A, __mmask32 __B, __m512i __C,
__m512i __D) {
return (__m512i)__builtin_ia32_vpshldv_v32hi_mask(
(__v32hi)__A, (__v32hi)__C, (__v32hi)__D, (__mmask32)__B);
}
__funline __m512i _mm512_maskz_shldv_epi16(__mmask32 __A, __m512i __B,
__m512i __C, __m512i __D) {
return (__m512i)__builtin_ia32_vpshldv_v32hi_maskz(
(__v32hi)__B, (__v32hi)__C, (__v32hi)__D, (__mmask32)__A);
}
#ifdef __DISABLE_AVX512VBMI2BW__
#undef __DISABLE_AVX512VBMI2BW__
#pragma GCC pop_options
#endif /* __DISABLE_AVX512VBMI2BW__ */
#endif /* __AVX512VBMI2INTRIN_H_INCLUDED */
| 16,951 | 382 | jart/cosmopolitan | false |
cosmopolitan/third_party/intel/adxintrin.internal.h | #if !defined _IMMINTRIN_H_INCLUDED
#error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef _ADXINTRIN_H_INCLUDED
#define _ADXINTRIN_H_INCLUDED
__funline unsigned char _subborrow_u32(unsigned char __CF, unsigned int __X,
unsigned int __Y, unsigned int *__P) {
return __builtin_ia32_sbb_u32(__CF, __X, __Y, __P);
}
__funline unsigned char _addcarry_u32(unsigned char __CF, unsigned int __X,
unsigned int __Y, unsigned int *__P) {
return __builtin_ia32_addcarryx_u32(__CF, __X, __Y, __P);
}
__funline unsigned char _addcarryx_u32(unsigned char __CF, unsigned int __X,
unsigned int __Y, unsigned int *__P) {
return __builtin_ia32_addcarryx_u32(__CF, __X, __Y, __P);
}
#ifdef __x86_64__
__funline unsigned char _subborrow_u64(unsigned char __CF, unsigned long long __X,
unsigned long long __Y,
unsigned long long *__P) {
return __builtin_ia32_sbb_u64(__CF, __X, __Y, __P);
}
__funline unsigned char _addcarry_u64(unsigned char __CF, unsigned long long __X,
unsigned long long __Y,
unsigned long long *__P) {
return __builtin_ia32_addcarryx_u64(__CF, __X, __Y, __P);
}
__funline unsigned char _addcarryx_u64(unsigned char __CF, unsigned long long __X,
unsigned long long __Y,
unsigned long long *__P) {
return __builtin_ia32_addcarryx_u64(__CF, __X, __Y, __P);
}
#endif
#endif /* _ADXINTRIN_H_INCLUDED */
| 1,682 | 44 | jart/cosmopolitan | false |
cosmopolitan/third_party/intel/intel.mk | #-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-â
#âââvi: set et ft=make ts=8 tw=8 fenc=utf-8 :viââââââââââââââââââââââââ
PKGS += THIRD_PARTY_INTEL
THIRD_PARTY_INTEL_HDRS = $(filter %.h,$(THIRD_PARTY_INTEL_FILES))
THIRD_PARTY_INTEL_FILES := $(wildcard third_party/intel/*)
| 352 | 7 | jart/cosmopolitan | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.