int16 FUNC_CREATEBUF(){
qbs *tqbs;
ptrszint tmp_long;
int32 tmp_fileno;
uint32 qbs_tmp_base=qbs_tmp_list_nexti;
uint8 *tmp_mem_static_pointer=mem_static_pointer;
uint32 tmp_cmem_sp=cmem_sp;
#include "data170.txt"
mem_lock *sf_mem_lock;
new_mem_lock();
sf_mem_lock=mem_lock_tmp;
sf_mem_lock->type=3;
libqb_check_stack();
if (is_error_pending()) goto exit_subfunc;
do{
if(!qbevent)break;evnt(28168,25,"simplebuffer.bm");}while(r);
do{
*_FUNC_CREATEBUF_LONG_AUB=func_ubound(__ARRAY_STRING_SIMPLEBUFFER_ARRAY,1,1);
qbs_cleanup(qbs_tmp_base,0);
if(!qbevent)break;evnt(28168,27,"simplebuffer.bm");}while(r);
do{
*_FUNC_CREATEBUF_LONG_BUF= 0 ;
if(!qbevent)break;evnt(28168,28,"simplebuffer.bm");}while(r);
do{
*_FUNC_CREATEBUF_INTEGER_CREATEBUF= -1ll ;
if(!qbevent)break;evnt(28168,28,"simplebuffer.bm");}while(r);
S_38207:;
while((-(*_FUNC_CREATEBUF_LONG_BUF<*_FUNC_CREATEBUF_LONG_AUB))||is_error_pending()){
if(qbevent){evnt(28168,29,"simplebuffer.bm");if(r)goto S_38207;}
S_38208:;
if ((qbs_cleanup(qbs_tmp_base,qbs_equal(((qbs*)(((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[array_check((*_FUNC_CREATEBUF_LONG_BUF+ 1 )-__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4],__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5])])),qbs_new_txt_len("",0))))||is_error_pending()){
if(qbevent){evnt(28168,30,"simplebuffer.bm");if(r)goto S_38208;}
do{
goto ww_exit_4589;
if(!qbevent)break;evnt(28168,30,"simplebuffer.bm");}while(r);
}
do{
*_FUNC_CREATEBUF_LONG_BUF=*_FUNC_CREATEBUF_LONG_BUF+ 106 ;
if(!qbevent)break;evnt(28168,31,"simplebuffer.bm");}while(r);
S_38212:;
if ((-(*_FUNC_CREATEBUF_LONG_BUF>= 3473090 ))||is_error_pending()){
if(qbevent){evnt(28168,32,"simplebuffer.bm");if(r)goto S_38212;}
do{
goto exit_subfunc;
if(!qbevent)break;evnt(28168,32,"simplebuffer.bm");}while(r);
}
ww_continue_4589:;
}
ww_exit_4589:;
S_38216:;
if ((-(*_FUNC_CREATEBUF_LONG_AUB<(*_FUNC_CREATEBUF_LONG_BUF+ 105 )))||is_error_pending()){
if(qbevent){evnt(28168,35,"simplebuffer.bm");if(r)goto S_38216;}
do{
if (__ARRAY_STRING_SIMPLEBUFFER_ARRAY[2]&2){
error(10);
}else{
static int64 alloc_new_desc[8];
static uint64 alloc_req_elems;
static uint64 alloc_req_bytes;
static uint64 alloc_dim_value;
static uint64 alloc_bytes_per_element;
((mem_lock*)((ptrszint*)__ARRAY_STRING_SIMPLEBUFFER_ARRAY)[8])->id=(++mem_lock_id);
static ptrszint preserve_old_ptr;
static ptrszint preserve_old_flags;
static uint64 preserve_old_total;
static uint64 preserve_new_total;
static uint64 preserve_copy_count;
static ptrszint preserve_new_ptr;
if (__ARRAY_STRING_SIMPLEBUFFER_ARRAY[2]&1){
preserve_old_ptr=__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0];
preserve_old_flags=__ARRAY_STRING_SIMPLEBUFFER_ARRAY[2];
preserve_old_total=__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5];
}else{
preserve_old_total=0; preserve_old_ptr=0; preserve_old_flags=0; preserve_new_total=0; preserve_copy_count=0;
}
alloc_new_desc[4]= 0 ;
alloc_new_desc[5]=(*_FUNC_CREATEBUF_LONG_BUF+ 10599 )-alloc_new_desc[4]+1;
if (alloc_new_desc[5]<=0) error(5);
alloc_new_desc[6]=1;
alloc_req_elems=1;
alloc_bytes_per_element=(uint64)(8);
if (!alloc_bytes_per_element) error(257);
if (((int64)((ptrszint)alloc_new_desc[4]))!=alloc_new_desc[4]) error(257);
if (alloc_new_desc[5]<0) error(257);
if (((int64)((ptrszint)alloc_new_desc[5]))!=alloc_new_desc[5]) error(257);
if (alloc_new_desc[6]<0) error(257);
if (((int64)((ptrszint)alloc_new_desc[6]))!=alloc_new_desc[6]) error(257);
alloc_dim_value=(uint64)alloc_new_desc[5];
if (alloc_dim_value){
if (alloc_req_elems>(18446744073709551615ull/alloc_dim_value)) error(257);
alloc_req_elems*=alloc_dim_value;
}
if (alloc_req_elems>(18446744073709551615ull/alloc_bytes_per_element)) error(257);
alloc_req_bytes=alloc_req_elems*alloc_bytes_per_element;
if (((uint64)((ptrszint)alloc_req_elems))!=alloc_req_elems) error(257);
if (((uint64)((size_t)alloc_req_bytes))!=alloc_req_bytes) error(257);
preserve_new_total=alloc_req_elems;
preserve_copy_count=preserve_old_total;
if (preserve_new_total<preserve_copy_count) preserve_copy_count=preserve_new_total;
if (preserve_old_total){
preserve_new_ptr=(ptrszint)malloc((size_t)alloc_req_bytes);
if (!preserve_new_ptr) error(257);
__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]=preserve_new_ptr;
__ARRAY_STRING_SIMPLEBUFFER_ARRAY[2]|=1;
tmp_long=(ptrszint)alloc_req_elems;
if (__ARRAY_STRING_SIMPLEBUFFER_ARRAY[2]&4){
while(tmp_long--) ((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[tmp_long]=(uint64)qbs_new_cmem(0,0);
}else{
while(tmp_long--) ((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[tmp_long]=(uint64)qbs_new(0,0);
}
tmp_long=preserve_copy_count;
while(tmp_long--){
qbs_set((qbs*)((uint64*)(preserve_new_ptr))[tmp_long],(qbs*)((uint64*)(preserve_old_ptr))[tmp_long]);
}
tmp_long=preserve_old_total;
while(tmp_long--) qbs_free((qbs*)((uint64*)(preserve_old_ptr))[tmp_long]);
free((void*)(preserve_old_ptr));
__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]=preserve_new_ptr;
}else{
__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]=(ptrszint)malloc((size_t)alloc_req_bytes);
if (!__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]) error(257);
__ARRAY_STRING_SIMPLEBUFFER_ARRAY[2]|=1;
tmp_long=(ptrszint)alloc_req_elems;
if (__ARRAY_STRING_SIMPLEBUFFER_ARRAY[2]&4){
while(tmp_long--) ((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[tmp_long]=(uint64)qbs_new_cmem(0,0);
}else{
while(tmp_long--) ((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[tmp_long]=(uint64)qbs_new(0,0);
}
}
__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4]=alloc_new_desc[4];
__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5]=alloc_new_desc[5];
__ARRAY_STRING_SIMPLEBUFFER_ARRAY[6]=alloc_new_desc[6];
__ARRAY_STRING_SIMPLEBUFFER_ARRAY[7]=alloc_new_desc[7];
}
if(!qbevent)break;evnt(28168,35,"simplebuffer.bm");}while(r);
}
do{
tmp_long=array_check((*_FUNC_CREATEBUF_LONG_BUF+ 0 )-__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4],__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5]);
if (!is_error_pending()) qbs_set( ((qbs*)(((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[tmp_long])),func_space( 16384 ));
qbs_cleanup(qbs_tmp_base,0);
if(!qbevent)break;evnt(28168,37,"simplebuffer.bm");}while(r);
do{
tmp_long=array_check((*_FUNC_CREATEBUF_LONG_BUF+ 1 )-__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4],__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5]);
if (!is_error_pending()) qbs_set( ((qbs*)(((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[tmp_long])),qbs_add(qbs_add(qbs_add(l2string( 1 ),l2string( 0 )),qbs_new_txt_len("EolU",4)),l2string( -1 )));
qbs_cleanup(qbs_tmp_base,0);
if(!qbevent)break;evnt(28168,38,"simplebuffer.bm");}while(r);
do{
tmp_long=array_check((*_FUNC_CREATEBUF_LONG_BUF+ 2 )-__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4],__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5]);
if (!is_error_pending()) qbs_set( ((qbs*)(((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[tmp_long])),qbs_add(qbs_new_txt_len("BM|",3),func_space( 404 )));
qbs_cleanup(qbs_tmp_base,0);
if(!qbevent)break;evnt(28168,39,"simplebuffer.bm");}while(r);
do{
tmp_long=array_check((*_FUNC_CREATEBUF_LONG_BUF+ 3 )-__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4],__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5]);
if (!is_error_pending()) qbs_set( ((qbs*)(((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[tmp_long])),qbs_add(qbs_new_txt_len("FP|",3),func_space( 404 )));
qbs_cleanup(qbs_tmp_base,0);
if(!qbevent)break;evnt(28168,40,"simplebuffer.bm");}while(r);
do{
tmp_long=array_check((*_FUNC_CREATEBUF_LONG_BUF+ 4 )-__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4],__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5]);
if (!is_error_pending()) qbs_set( ((qbs*)(((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[tmp_long])),qbs_add(qbs_new_txt_len("FL|",3),func_space( 404 )));
qbs_cleanup(qbs_tmp_base,0);
if(!qbevent)break;evnt(28168,41,"simplebuffer.bm");}while(r);
S_38224:;
fornext_value4591= 1 ;
fornext_finalvalue4591= 101 ;
fornext_step4591= 1 ;
if (fornext_step4591<0) fornext_step_negative4591=1; else fornext_step_negative4591=0;
if (is_error_pending()) goto fornext_error4591;
goto fornext_entrylabel4591;
while(1){
fornext_value4591=fornext_step4591+(*_FUNC_CREATEBUF_INTEGER_IDX);
fornext_entrylabel4591:
*_FUNC_CREATEBUF_INTEGER_IDX=fornext_value4591;
if (fornext_step_negative4591){
if (fornext_value4591<fornext_finalvalue4591) break;
}else{
if (fornext_value4591>fornext_finalvalue4591) break;
}
fornext_error4591:;
if(qbevent){evnt(28168,42,"simplebuffer.bm");if(r)goto S_38224;}
do{
sub_mid(((qbs*)(((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[array_check((*_FUNC_CREATEBUF_LONG_BUF+ 2 )-__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4],__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5])])),*_FUNC_CREATEBUF_INTEGER_IDX* 4 , 4 ,l2string( -889275714 ),1);
if(!qbevent)break;evnt(28168,43,"simplebuffer.bm");}while(r);
do{
sub_mid(((qbs*)(((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[array_check((*_FUNC_CREATEBUF_LONG_BUF+ 3 )-__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4],__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5])])),*_FUNC_CREATEBUF_INTEGER_IDX* 4 , 4 ,l2string( -889275714 ),1);
if(!qbevent)break;evnt(28168,44,"simplebuffer.bm");}while(r);
do{
sub_mid(((qbs*)(((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[array_check((*_FUNC_CREATEBUF_LONG_BUF+ 4 )-__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4],__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5])])),*_FUNC_CREATEBUF_INTEGER_IDX* 4 , 4 ,l2string( -889275714 ),1);
if(!qbevent)break;evnt(28168,45,"simplebuffer.bm");}while(r);
do{
tmp_long=array_check((*_FUNC_CREATEBUF_LONG_BUF+*_FUNC_CREATEBUF_INTEGER_IDX+ 4 )-__ARRAY_STRING_SIMPLEBUFFER_ARRAY[4],__ARRAY_STRING_SIMPLEBUFFER_ARRAY[5]);
if (!is_error_pending()) qbs_set( ((qbs*)(((uint64*)(__ARRAY_STRING_SIMPLEBUFFER_ARRAY[0]))[tmp_long])),qbs_new_txt_len("",0));
qbs_cleanup(qbs_tmp_base,0);
if(!qbevent)break;evnt(28168,46,"simplebuffer.bm");}while(r);
fornext_continue_4590:;
}
fornext_exit_4590:;
do{
*_FUNC_CREATEBUF_INTEGER_CREATEBUF=qb_safe_idiv(*_FUNC_CREATEBUF_LONG_BUF, 106 );
if(!qbevent)break;evnt(28168,49,"simplebuffer.bm");}while(r);
exit_subfunc:;
free_mem_lock(sf_mem_lock);
#include "free170.txt"
if ((tmp_mem_static_pointer>=mem_static)&&(tmp_mem_static_pointer<=mem_static_limit)) mem_static_pointer=tmp_mem_static_pointer; else mem_static_pointer=mem_static;
cmem_sp=tmp_cmem_sp;
return *_FUNC_CREATEBUF_INTEGER_CREATEBUF;
}
